X-Git-Url: http://git.archive.openwrt.org/?p=project%2Ffstools.git;a=blobdiff_plain;f=libfstools%2Fmount.c;h=4dc6e3a60da98305a6b2d9c094a5c864bc9534f5;hp=371082b64be89c2a47f78e63d37a9fa5527dcc65;hb=ef2cc03b52ba2d3d19de7c9e72e0131eab631e5a;hpb=3f0e8e1a08a7dbfd408affeece24f626bf4a54b8 diff --git a/libfstools/mount.c b/libfstools/mount.c index 371082b..4dc6e3a 100644 --- a/libfstools/mount.c +++ b/libfstools/mount.c @@ -25,6 +25,12 @@ /* this is a raw syscall - man 2 pivot_root */ extern int pivot_root(const char *new_root, const char *put_old); +/** + * mount_move - move mounted point to the new location + * + * @oldroot: directory that is current location of mount point + * @newroot: new directory for the mount point + */ int mount_move(char *oldroot, char *newroot, char *dir) { @@ -48,7 +54,7 @@ mount_move(char *oldroot, char *newroot, char *dir) ret = mount(olddir, newdir, NULL, MS_NOATIME | MS_MOVE, NULL); /* if (ret) - ULOG_ERR("failed %s %s: %s\n", olddir, newdir, strerror(errno));*/ + ULOG_ERR("failed %s %s: %m\n", olddir, newdir);*/ return ret; } @@ -67,7 +73,7 @@ pivot(char *new, char *old) ret = pivot_root(new, pivotdir); if (ret < 0) { - ULOG_ERR("pivot_root failed %s %s: %s\n", new, pivotdir, strerror(errno)); + ULOG_ERR("pivot_root failed %s %s: %m\n", new, pivotdir); return -1; } @@ -79,6 +85,12 @@ pivot(char *new, char *old) return 0; } +/** + * fopivot - switch to overlay using passed dir as upper one + * + * @rw_root: writable directory that will be used as upper dir + * @ro_root: directory where old root will be put + */ int fopivot(char *rw_root, char *ro_root) { @@ -124,8 +136,7 @@ fopivot(char *rw_root, char *ro_root) /* Mainlined overlayfs has been renamed to "overlay", try that first */ if (mount(overlay, "/mnt", "overlay", MS_NOATIME, mount_options)) { if (mount(overlay, "/mnt", "overlayfs", MS_NOATIME, mount_options)) { - ULOG_ERR("mount failed: %s, options %s\n", - strerror(errno), mount_options); + ULOG_ERR("mount failed: %s, options %m\n", mount_options); return -1; } } @@ -134,6 +145,9 @@ fopivot(char *rw_root, char *ro_root) return pivot("/mnt", ro_root); } +/** + * ramoverlay - use RAM to store filesystem changes on top of RO root + */ int ramoverlay(void) {