summaryrefslogtreecommitdiff
path: root/libfstools/overlay.c
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-04-06 03:16:05 +0100
committerJohn Crispin <blogic@openwrt.org>2014-04-07 13:27:38 +0100
commit9303a84fb4bcf84ebcf58f2afdd7cac7dde0161f (patch)
treebca39d16dac9e792f3a96dc6ab3a8048c17b977a /libfstools/overlay.c
parente694872b52348ae7cd7e5a2df7a24b94f58acfd4 (diff)
downloadfstools-9303a84fb4bcf84ebcf58f2afdd7cac7dde0161f.tar.gz
split fs-state back into seperate tools
Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'libfstools/overlay.c')
-rw-r--r--libfstools/overlay.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/libfstools/overlay.c b/libfstools/overlay.c
index 85237e4..06d0bfd 100644
--- a/libfstools/overlay.c
+++ b/libfstools/overlay.c
@@ -27,7 +27,7 @@
#include <dirent.h>
#include <fcntl.h>
-#include "../fs-state.h"
+#include "libfstools.h"
#include "volume.h"
#define SWITCH_JFFS2 "/tmp/.switch_jffs2"
@@ -142,18 +142,6 @@ handle_whiteout(const char *dir)
return 0;
}
-static int
-ask_user(int argc, char **argv)
-{
- if ((argc < 2) || strcmp(argv[1], "-y")) {
- fprintf(stderr, "This will erase all settings and remove any installed packages. Are you sure? [N/y]\n");
- if (getchar() != 'y')
- return -1;
- }
- return 0;
-
-}
-
int
jffs2_switch(int argc, char **argv)
{
@@ -182,7 +170,7 @@ jffs2_switch(int argc, char **argv)
/* fall through */
case FS_DEADCODE:
- ret = switch2jffs();
+ ret = switch2jffs(v);
if (!ret) {
fprintf(stderr, "doing fo cleanup\n");
umount2("/tmp/root", MNT_DETACH);
@@ -230,7 +218,7 @@ static int overlay_mount_fs(void)
return -1;
}
-static int overlay_mount(void)
+int mount_overlay(void)
{
struct volume *v = volume_find("rootfs_data");;
char *mp;
@@ -247,8 +235,8 @@ static int overlay_mount(void)
overlay_mount_fs();
extroot_prefix = "/tmp/overlay";
- if (!backend_mount("extroot")) {
- fprintf(stderr, "fs-state: switched to extroot\n");
+ if (!mount_extroot()) {
+ fprintf(stderr, "switched to extroot\n");
return 0;
}
@@ -260,9 +248,3 @@ static int overlay_mount(void)
return -1;
}
-
-static struct backend overlay_backend = {
- .name = "overlay",
- .mount = overlay_mount,
-};
-BACKEND(overlay_backend);