diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/unionfs.c | 14 | ||||
-rw-r--r-- | src/cstore/unionfs/cstore-unionfs.cpp | 18 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/common/unionfs.c b/src/common/unionfs.c index d8b7626..dff20e6 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -70,12 +70,26 @@ sys_umount_session(void) static inline void sys_mount_session(void) { +#ifdef USE_UNIONFSFUSE + char mopts[MAX_LENGTH_DIR_PATH * 2]; + const char *fstype; + const char *moptfmt; + int local_errno; + fstype = "/usr/bin/unionfs-fuse -o cow -o allow_other"; + moptfmt = "%s %s=RW:%s=RO %s"; + snprintf(mopts, MAX_LENGTH_DIR_PATH * 4, moptfmt, + fstype, get_cdirp(), get_adirp(), get_mdirp()); + if (system(mopts) != 0) { + perror("system"); + } +#else char mopts[MAX_LENGTH_DIR_PATH * 2]; snprintf(mopts, MAX_LENGTH_DIR_PATH * 2, "dirs=%s=rw:%s=ro", get_cdirp(), get_adirp()); if (mount("unionfs", get_mdirp(), "unionfs", 0, mopts) != 0) { perror("mount"); } +#endif } void diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp index e21e660..938436e 100644 --- a/src/cstore/unionfs/cstore-unionfs.cpp +++ b/src/cstore/unionfs/cstore-unionfs.cpp @@ -1477,6 +1477,23 @@ bool UnionfsCstore::do_mount(const FsPath& rwdir, const FsPath& rdir, const FsPath& mdir) { +#ifdef USE_UNIONFSFUSE + string mopts = "/usr/bin/unionfs-fuse "; + mopts += "-o cow -o allow_other "; + mopts += rwdir.path_cstr(); + mopts += "=RW:"; + mopts += rdir.path_cstr(); + mopts += "=RO"; + mopts += " "; + mopts += mdir.path_cstr(); + + if (system(mopts.c_str()) != 0) + { + output_internal("union mount failed [%s][%s][%s]\n", + strerror(errno), mdir.path_cstr(), mopts.c_str()); + return false; + } +#else string mopts = "dirs="; mopts += rwdir.path_cstr(); mopts += "=rw:"; @@ -1487,6 +1504,7 @@ UnionfsCstore::do_mount(const FsPath& rwdir, const FsPath& rdir, strerror(errno), mdir.path_cstr()); return false; } +#endif return true; } |