diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2014-12-14 18:58:16 +0100 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2014-12-14 23:04:06 +0100 |
commit | ba01996534d15dc725a2dcc56a59fbfb24b58787 (patch) | |
tree | 190f31034110ee180428bf3aaf7c36f4367fd2be /libfstools/overlay.c | |
parent | e65232440111b8f6654218033431e5bdd20525c2 (diff) | |
download | fstools-ba01996534d15dc725a2dcc56a59fbfb24b58787.tar.gz |
libfstools: accept volume as argument in most calls
This optimizes code: drops unneeded calls to the volume_find and checks.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Diffstat (limited to 'libfstools/overlay.c')
-rw-r--r-- | libfstools/overlay.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/libfstools/overlay.c b/libfstools/overlay.c index dc350b5..9e830a1 100644 --- a/libfstools/overlay.c +++ b/libfstools/overlay.c @@ -143,9 +143,8 @@ handle_whiteout(const char *dir) } int -jffs2_switch(int argc, char **argv) +jffs2_switch(struct volume *v) { - struct volume *v; char *mp; int ret = -1; @@ -157,7 +156,6 @@ jffs2_switch(int argc, char **argv) return ret; } - v = volume_find("rootfs_data"); mp = find_mount_point(v->blk, 0); if (mp) { fprintf(stderr, "rootfs_data:%s is already mounted as %s\n", v->blk, mp); @@ -201,9 +199,8 @@ jffs2_switch(int argc, char **argv) return ret; } -static int overlay_mount_fs(void) +static int overlay_mount_fs(struct volume *v) { - struct volume *v; char *fstype; if (mkdir("/tmp/overlay", 0755)) { @@ -211,12 +208,6 @@ static int overlay_mount_fs(void) return -1; } - v = volume_find("rootfs_data"); - if (!v) { - fprintf(stderr, "rootfs_data does not exist\n"); - return -1; - } - fstype = "jffs2"; switch (volume_identify(v)) { @@ -236,9 +227,8 @@ static int overlay_mount_fs(void) return -1; } -int mount_overlay(void) +int mount_overlay(struct volume *v) { - struct volume *v = volume_find("rootfs_data");; char *mp; if (!v) @@ -250,7 +240,7 @@ int mount_overlay(void) return -1; } - overlay_mount_fs(); + overlay_mount_fs(v); extroot_prefix = "/tmp/overlay"; if (!mount_extroot()) { |