diff options
author | James Davidson <james.davidson@vyatta.com> | 2012-10-19 12:11:03 -0700 |
---|---|---|
committer | James Davidson <james.davidson@vyatta.com> | 2012-10-19 13:47:02 -0700 |
commit | 5ffad3ec21332a7cd8b967231b84d5eecee5be92 (patch) | |
tree | c89335c695e4608fe38d6110138549058c89720c /src/common | |
parent | 72c915729c7d98a23db8415119283808110d0972 (diff) | |
download | vyatta-cfg-5ffad3ec21332a7cd8b967231b84d5eecee5be92.tar.gz vyatta-cfg-5ffad3ec21332a7cd8b967231b84d5eecee5be92.zip |
Add support for overlayfs and start using it
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/unionfs.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/common/unionfs.c b/src/common/unionfs.c index d8b7626..c1752ac 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -71,9 +71,20 @@ static inline void sys_mount_session(void) { char mopts[MAX_LENGTH_DIR_PATH * 2]; - snprintf(mopts, MAX_LENGTH_DIR_PATH * 2, "dirs=%s=rw:%s=ro", + const char *fstype; + const char *moptfmt; + int local_errno; + +#ifdef USE_OVERLAYFS + fstype = "overlayfs"; + moptfmt = "upperdir=%s,lowerdir=%s"; +#else + fstype = "unionfs"; + moptfmt = "dirs=%s=rw:%s=ro"; +#endif + snprintf(mopts, MAX_LENGTH_DIR_PATH * 2, moptfmt, get_cdirp(), get_adirp()); - if (mount("unionfs", get_mdirp(), "unionfs", 0, mopts) != 0) { + if (mount(fstype, get_mdirp(), fstype, 0, mopts) != 0) { perror("mount"); } } |