From 77417bc00d76086d3cb5876f6fd52d5369c918a4 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 3 Dec 2010 21:13:52 +0100 Subject: [PATCH] libmount: remove utab from API, update tests The utab file is private libmount stuff. Anything about utab should not be exported by library API. Signed-off-by: Karel Zak --- shlibs/mount/src/context.c | 18 +- shlibs/mount/src/context_umount.c | 5 +- shlibs/mount/src/fs.c | 20 +- shlibs/mount/src/mount.h.in | 7 +- shlibs/mount/src/mountP.h | 5 +- shlibs/mount/src/tab_parse.c | 4 +- shlibs/mount/src/tab_update.c | 171 ++++++++++-------- shlibs/mount/src/utils.c | 13 +- .../libmount/tabfiles-parse-mountinfo | 32 ++++ tests/expected/libmount/update-utab-mount | 4 +- tests/expected/libmount/update-utab-move | 4 +- tests/expected/libmount/update-utab-remount | 4 +- tests/expected/libmount/update-utab-umount | 2 +- tests/ts/libmount/update | 2 + 14 files changed, 166 insertions(+), 125 deletions(-) diff --git a/shlibs/mount/src/context.c b/shlibs/mount/src/context.c index 069a8834..4fe2eabf 100644 --- a/shlibs/mount/src/context.c +++ b/shlibs/mount/src/context.c @@ -1067,9 +1067,13 @@ int mnt_context_prepare_update(mnt_context *cxt) return 0; } if (!cxt->update) { - cxt->update = mnt_new_update(!cxt->mtab_writable); + cxt->update = mnt_new_update(); if (!cxt->update) return -ENOMEM; + + mnt_update_set_filename(cxt->update, + cxt->mtab_writable ? cxt->mtab_path : cxt->utab_path, + !cxt->mtab_writable); } rc = mnt_update_set_fs(cxt->update, cxt->mountflags, @@ -1081,9 +1085,6 @@ int mnt_context_prepare_update(mnt_context *cxt) int mnt_context_update_tabs(mnt_context *cxt) { - const char *filename; - mnt_lock *lock = NULL; - assert(cxt); if (cxt->flags & MNT_FL_NOMTAB) { @@ -1102,15 +1103,8 @@ int mnt_context_update_tabs(mnt_context *cxt) DBG(CXT, mnt_debug_h(cxt, "don't update: syscall failed")); return 0; } - if (mnt_update_is_userspace_only(cxt->update)) - filename = cxt->utab_path; - else { - filename = cxt->mtab_path; - lock = mnt_context_get_lock(cxt); - } - assert(filename); - return mnt_update_tab(cxt->update, filename, lock); + return mnt_update_tab(cxt->update, mnt_context_get_lock(cxt)); } static int is_remount(mnt_context *cxt) diff --git a/shlibs/mount/src/context_umount.c b/shlibs/mount/src/context_umount.c index ca9ca774..ec571300 100644 --- a/shlibs/mount/src/context_umount.c +++ b/shlibs/mount/src/context_umount.c @@ -502,9 +502,8 @@ int mnt_context_do_umount(mnt_context *cxt) if (!rc) rc = __mnt_fs_set_optstr_ptr(cxt->fs, n, FALSE); - if (!rc && cxt->update && - !mnt_update_is_userspace_only(cxt->update)) - /* refresh options in /etc/mtab as well*/ + /* refresh options in /etc/mtab as well */ + if (!rc && cxt->update && cxt->mtab_writable) rc = mnt_update_set_fs(cxt->update, cxt->mountflags, NULL, cxt->fs); } diff --git a/shlibs/mount/src/fs.c b/shlibs/mount/src/fs.c index a11061d9..30dabed7 100644 --- a/shlibs/mount/src/fs.c +++ b/shlibs/mount/src/fs.c @@ -900,25 +900,25 @@ int mnt_fs_print_debug(mnt_fs *fs, FILE *file) if (!fs) return -EINVAL; fprintf(file, "------ fs: %p\n", fs); - fprintf(file, "source: %s\n", mnt_fs_get_source(fs)); - fprintf(file, "target: %s\n", mnt_fs_get_target(fs)); - fprintf(file, "fstype: %s\n", mnt_fs_get_fstype(fs)); - fprintf(file, "optstr: %s\n", mnt_fs_get_optstr(fs)); + fprintf(file, "source: %s\n", mnt_fs_get_source(fs)); + fprintf(file, "target: %s\n", mnt_fs_get_target(fs)); + fprintf(file, "fstype: %s\n", mnt_fs_get_fstype(fs)); + fprintf(file, "optstr: %s\n", mnt_fs_get_optstr(fs)); if (mnt_fs_get_root(fs)) - fprintf(file, "root: %s\n", mnt_fs_get_root(fs)); + fprintf(file, "root: %s\n", mnt_fs_get_root(fs)); if (mnt_fs_get_bindsrc(fs)) fprintf(file, "bindsrc: %s\n", mnt_fs_get_bindsrc(fs)); if (mnt_fs_get_freq(fs)) - fprintf(file, "freq: %d\n", mnt_fs_get_freq(fs)); + fprintf(file, "freq: %d\n", mnt_fs_get_freq(fs)); if (mnt_fs_get_passno(fs)) - fprintf(file, "pass: %d\n", mnt_fs_get_passno(fs)); + fprintf(file, "pass: %d\n", mnt_fs_get_passno(fs)); if (mnt_fs_get_id(fs)) - fprintf(file, "id: %d\n", mnt_fs_get_id(fs)); + fprintf(file, "id: %d\n", mnt_fs_get_id(fs)); if (mnt_fs_get_parent_id(fs)) - fprintf(file, "parent: %d\n", mnt_fs_get_parent_id(fs)); + fprintf(file, "parent: %d\n", mnt_fs_get_parent_id(fs)); if (mnt_fs_get_devno(fs)) - fprintf(file, "devno: %d:%d\n", major(mnt_fs_get_devno(fs)), + fprintf(file, "devno: %d:%d\n", major(mnt_fs_get_devno(fs)), minor(mnt_fs_get_devno(fs))); return 0; } diff --git a/shlibs/mount/src/mount.h.in b/shlibs/mount/src/mount.h.in index 03753f78..74cdf0e7 100644 --- a/shlibs/mount/src/mount.h.in +++ b/shlibs/mount/src/mount.h.in @@ -124,13 +124,11 @@ extern int mnt_match_fstype(const char *type, const char *pattern); extern int mnt_match_options(const char *optstr, const char *pattern); extern const char *mnt_get_fstab_path(void); extern const char *mnt_get_mtab_path(void); -extern const char *mnt_get_utab_path(void); extern int mnt_get_filesystems(char ***filesystems, const char *pattern); extern void mnt_free_filesystems(char **filesystems); extern int mnt_has_regular_mtab(const char **mtab, int *writable); -extern int mnt_has_regular_utab(const char **utab, int *writable); /* cache.c */ extern mnt_cache *mnt_new_cache(void); @@ -286,13 +284,12 @@ extern int mnt_tab_find_next_fs(mnt_tab *tb, mnt_iter *itr, mnt_fs **fs); /* tab_update.c */ -extern mnt_update *mnt_new_update(int userspace_only); +extern mnt_update *mnt_new_update(void); extern void mnt_free_update(mnt_update *upd); extern int mnt_update_is_ready(mnt_update *upd); extern int mnt_update_set_fs(mnt_update *upd, int mountflags, const char *target, mnt_fs *fs); -extern int mnt_update_tab(mnt_update *upd, const char *filename, mnt_lock *lc); -extern int mnt_update_is_userspace_only(mnt_update *upd);; +extern int mnt_update_tab(mnt_update *upd, mnt_lock *lc); /* context.c */ diff --git a/shlibs/mount/src/mountP.h b/shlibs/mount/src/mountP.h index df451b77..7eebb209 100644 --- a/shlibs/mount/src/mountP.h +++ b/shlibs/mount/src/mountP.h @@ -103,7 +103,7 @@ struct mtest { const char *usage; }; -/* utils.c */ +/* test.c */ extern int mnt_run_test(struct mtest *tests, int argc, char *argv[]); #endif @@ -120,6 +120,8 @@ extern int mnt_in_group(gid_t gid); extern char *mnt_get_mountpoint(const char *path); extern char *mnt_get_fs_root(const char *path, const char *mountpoint); extern int mnt_open_uniq_filename(const char *filename, char **name, int flags); +extern int mnt_has_regular_utab(const char **utab, int *writable); +extern const char *mnt_get_utab_path(void); /* * Generic iterator @@ -315,5 +317,6 @@ extern int mnt_context_update_tabs(mnt_context *cxt); /* tab_update.c */ extern mnt_fs *mnt_update_get_fs(mnt_update *upd); +extern int mnt_update_set_filename(mnt_update *upd, const char *filename, int userspace_only); #endif /* _LIBMOUNT_PRIVATE_H */ diff --git a/shlibs/mount/src/tab_parse.c b/shlibs/mount/src/tab_parse.c index c69a064f..16fab89d 100644 --- a/shlibs/mount/src/tab_parse.c +++ b/shlibs/mount/src/tab_parse.c @@ -555,7 +555,7 @@ mnt_tab *mnt_new_tab_from_file(const char *filename) /** * mnt_new_tab_from_dir - * @dirname: for example /etc/fstab.d or /dev/.mount/utabs + * @dirname: for example /etc/fstab.d * * Returns: newly allocated tab on success and NULL in case of error. */ @@ -707,7 +707,7 @@ static mnt_fs *mnt_tab_merge_userspace_fs(mnt_tab *tb, mnt_fs *uf) * @filename: overwrites default (/etc/mtab or $LIBMOUNT_MTAB) or NULL * * This function parses /etc/mtab or /proc/self/mountinfo + - * /dev/.mount/utabs/<*>.mtab or /proc/mounts. + * /dev/.mount/utabs or /proc/mounts. * * See also mnt_tab_set_parser_errcb(). * diff --git a/shlibs/mount/src/tab_update.c b/shlibs/mount/src/tab_update.c index baf5b0b6..e9f6609e 100644 --- a/shlibs/mount/src/tab_update.c +++ b/shlibs/mount/src/tab_update.c @@ -29,6 +29,7 @@ struct _mnt_update { char *target; mnt_fs *fs; + char *filename; unsigned long mountflags; int userspace_only; int ready; @@ -39,11 +40,10 @@ static int set_fs_root(mnt_fs *result, mnt_fs *fs, unsigned long mountflags); /** * mnt_new_update: - * @userspace_only: TRUE/FALSE -- maintain userspace mount options only * * Returns: newly allocated update handler */ -mnt_update *mnt_new_update(int userspace_only) +mnt_update *mnt_new_update(void) { mnt_update *upd; @@ -51,7 +51,6 @@ mnt_update *mnt_new_update(int userspace_only) if (!upd) return NULL; - upd->userspace_only = userspace_only; DBG(UPDATE, mnt_debug_h(upd, "allocate")); return upd; @@ -72,9 +71,51 @@ void mnt_free_update(mnt_update *upd) mnt_free_fs(upd->fs); free(upd->target); + free(upd->filename); free(upd); } +/* + * Returns 0 on success, 1 if not file available, -1 in case of error. + */ +int mnt_update_set_filename(mnt_update *upd, const char *filename, int userspace_only) +{ + const char *path = NULL; + int rw = 0; + + assert(upd); + + /* filename explicitly defined */ + if (filename) { + char *p = strdup(filename); + if (!p) + return -ENOMEM; + + upd->userspace_only = userspace_only; + free(upd->filename); + upd->filename = p; + } + + if (upd->filename) + return 0; + + /* detect tab filename -- /etc/mtab or /dev/.mount/utab + */ + mnt_has_regular_mtab(&path, &rw); + if (!rw) { + path = NULL; + mnt_has_regular_utab(&path, &rw); + if (!rw) + return 1; + upd->userspace_only = TRUE; + } + upd->filename = strdup(path); + if (!upd->filename) + return -ENOMEM; + + return 0; +} + /** * mnt_update_is_ready: * @upd: update handler @@ -87,19 +128,6 @@ int mnt_update_is_ready(mnt_update *upd) return upd ? upd->ready : FALSE; } -/** - * mnt_update_is_userspace_only: - * @upd: update handler - * - * Returns: 1 if @upd cares about userspace mount options only (see - * mnt_new_update(). - */ -int mnt_update_is_userspace_only(mnt_update *upd) -{ - return upd ? upd->userspace_only : FALSE; -} - - /** * mnt_update_set_fs: * @upd: update handler @@ -112,6 +140,8 @@ int mnt_update_is_userspace_only(mnt_update *upd) int mnt_update_set_fs(mnt_update *upd, int mountflags, const char *target, mnt_fs *fs) { + int rc; + assert(upd); assert(target || fs); @@ -129,6 +159,10 @@ int mnt_update_set_fs(mnt_update *upd, int mountflags, upd->target = NULL; upd->mountflags = mountflags; + rc = mnt_update_set_filename(upd, NULL, 0); + if (rc) + return rc; /* error or no file available (rc = 1) */ + if (fs) { if (upd->userspace_only && !(mountflags & MS_MOVE)) { int rc = utab_new_entry(fs, mountflags, &upd->fs); @@ -405,18 +439,18 @@ static int fprintf_utab_fs(FILE *f, mnt_fs *fs) return 0; } -static int update_tab(mnt_update *upd, const char *filename, mnt_tab *tb) +static int update_tab(mnt_update *upd, mnt_tab *tb) { FILE *f; int rc, fd; char *uq = NULL; - if (!tb || !filename) + if (!tb || !upd->filename) return -EINVAL; - DBG(UPDATE, mnt_debug_h(upd, "%s: updating", filename)); + DBG(UPDATE, mnt_debug_h(upd, "%s: updating", upd->filename)); - fd = mnt_open_uniq_filename(filename, &uq, O_WRONLY); + fd = mnt_open_uniq_filename(upd->filename, &uq, O_WRONLY); if (fd < 0) return fd; /* error */ @@ -437,12 +471,12 @@ static int update_tab(mnt_update *upd, const char *filename, mnt_tab *tb) fd = fileno(f); rc = fchmod(fd, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) ? -errno : 0; - if (!rc &&stat(filename, &st) == 0) + if (!rc && stat(upd->filename, &st) == 0) /* Copy uid/gid from the present file before renaming. */ rc = fchown(fd, st.st_uid, st.st_gid) ? -errno : 0; fclose(f); - rc = rename(uq, filename) ? -errno : 0; + rc = rename(uq, upd->filename) ? -errno : 0; } else { rc = -errno; close(fd); @@ -487,7 +521,7 @@ static void utab_unlock(int fd) } } -static int update_add_entry(mnt_update *upd, const char *filename, mnt_lock *lc) +static int update_add_entry(mnt_update *upd, mnt_lock *lc) { FILE *f; int rc = 0, u_lc = -1; @@ -495,21 +529,21 @@ static int update_add_entry(mnt_update *upd, const char *filename, mnt_lock *lc) assert(upd); assert(upd->fs); - DBG(UPDATE, mnt_debug_h(upd, "%s: add entry", filename)); + DBG(UPDATE, mnt_debug_h(upd, "%s: add entry", upd->filename)); if (lc) mnt_lock_file(lc); else if (upd->userspace_only) - u_lc = utab_lock(filename); + u_lc = utab_lock(upd->filename); - f = fopen(filename, "a+"); + f = fopen(upd->filename, "a+"); if (f) { rc = upd->userspace_only ? fprintf_utab_fs(f, upd->fs) : fprintf_mtab_fs(f, upd->fs); - DBG(UPDATE, mnt_debug_h(upd, "%s: add [rc=%d]", filename, rc)); + DBG(UPDATE, mnt_debug_h(upd, "%s: add [rc=%d]", upd->filename, rc)); fclose(f); } else { - DBG(UPDATE, mnt_debug_h(upd, "%s: failed: %m", filename)); + DBG(UPDATE, mnt_debug_h(upd, "%s: failed: %m", upd->filename)); rc = -errno; } if (lc) @@ -519,7 +553,7 @@ static int update_add_entry(mnt_update *upd, const char *filename, mnt_lock *lc) return rc; } -static int update_remove_entry(mnt_update *upd, const char *filename, mnt_lock *lc) +static int update_remove_entry(mnt_update *upd, mnt_lock *lc) { mnt_tab *tb; int rc = 0, u_lc = -1; @@ -527,20 +561,20 @@ static int update_remove_entry(mnt_update *upd, const char *filename, mnt_lock * assert(upd); assert(upd->target); - DBG(UPDATE, mnt_debug_h(upd, "%s: remove entry", filename)); + DBG(UPDATE, mnt_debug_h(upd, "%s: remove entry", upd->filename)); if (lc) mnt_lock_file(lc); else if (upd->userspace_only) - u_lc = utab_lock(filename); + u_lc = utab_lock(upd->filename); - tb = __mnt_new_tab_from_file(filename, + tb = __mnt_new_tab_from_file(upd->filename, upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB); if (tb) { mnt_fs *rem = mnt_tab_find_target(tb, upd->target, MNT_ITER_BACKWARD); if (rem) { mnt_tab_remove_fs(tb, rem); - rc = update_tab(upd, filename, tb); + rc = update_tab(upd, tb); mnt_free_fs(rem); } mnt_free_tab(tb); @@ -552,26 +586,26 @@ static int update_remove_entry(mnt_update *upd, const char *filename, mnt_lock * return rc; } -static int update_modify_target(mnt_update *upd, const char *filename, mnt_lock *lc) +static int update_modify_target(mnt_update *upd, mnt_lock *lc) { mnt_tab *tb = NULL; int rc = 0, u_lc = -1; - DBG(UPDATE, mnt_debug_h(upd, "%s: modify target", filename)); + DBG(UPDATE, mnt_debug_h(upd, "%s: modify target", upd->filename)); if (lc) mnt_lock_file(lc); else if (upd->userspace_only) - u_lc = utab_lock(filename); + u_lc = utab_lock(upd->filename); - tb = __mnt_new_tab_from_file(filename, + tb = __mnt_new_tab_from_file(upd->filename, upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB); if (tb) { mnt_fs *cur = mnt_tab_find_target(tb, upd->target, MNT_ITER_BACKWARD); if (cur) { rc = mnt_fs_set_target(cur, mnt_fs_get_target(upd->fs)); if (!rc) - rc = update_tab(upd, filename, tb); + rc = update_tab(upd, tb); } mnt_free_tab(tb); } @@ -582,7 +616,7 @@ static int update_modify_target(mnt_update *upd, const char *filename, mnt_lock return rc; } -static int update_modify_options(mnt_update *upd, const char *filename, mnt_lock *lc) +static int update_modify_options(mnt_update *upd, mnt_lock *lc) { mnt_tab *tb = NULL; int rc = 0, u_lc = -1; @@ -590,14 +624,14 @@ static int update_modify_options(mnt_update *upd, const char *filename, mnt_lock assert(upd); assert(upd->fs); - DBG(UPDATE, mnt_debug_h(upd, "%s: modify options", filename)); + DBG(UPDATE, mnt_debug_h(upd, "%s: modify options", upd->filename)); if (lc) mnt_lock_file(lc); else if (upd->userspace_only) - u_lc = utab_lock(filename); + u_lc = utab_lock(upd->filename); - tb = __mnt_new_tab_from_file(filename, + tb = __mnt_new_tab_from_file(upd->filename, upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB); if (tb) { mnt_fs *cur = mnt_tab_find_target(tb, @@ -606,7 +640,7 @@ static int update_modify_options(mnt_update *upd, const char *filename, mnt_lock if (cur) { rc = mnt_fs_set_optstr(cur, mnt_fs_get_optstr(upd->fs)); if (!rc) - rc = update_tab(upd, filename, tb); + rc = update_tab(upd, tb); } mnt_free_tab(tb); } @@ -620,38 +654,37 @@ static int update_modify_options(mnt_update *upd, const char *filename, mnt_lock /** * mnt_update_tab: - * @filename: mtab of utab filename * @lc: lock * - * High-level API to update /etc/mtab or /dev/.mount/utab. + * High-level API to update /etc/mtab (or private /dev/.mount/utab file). * * Returns: 0 on success, negative number on error. */ -int mnt_update_tab(mnt_update *upd, const char *filename, mnt_lock *lc) +int mnt_update_tab(mnt_update *upd, mnt_lock *lc) { int rc = -EINVAL; assert(upd); - assert(filename); - - DBG(UPDATE, mnt_debug_h(upd, "%s: update tab", filename)); - if (!filename || !upd) + if (!upd->filename || !upd) return -EINVAL; if (!upd->ready) return 0; + DBG(UPDATE, mnt_debug_h(upd, "%s: update tab", upd->filename)); + if (!upd->fs && upd->target) - rc = update_remove_entry(upd, filename, lc); /* umount */ + rc = update_remove_entry(upd, lc); /* umount */ else if (upd->mountflags & MS_MOVE) - rc = update_modify_target(upd, filename, lc); /* move */ + rc = update_modify_target(upd, lc); /* move */ else if (upd->mountflags & MS_REMOUNT) - rc = update_modify_options(upd, filename, lc); /* remount */ + rc = update_modify_options(upd, lc); /* remount */ else if (upd->fs) - rc = update_add_entry(upd, filename, lc); /* mount */ + rc = update_add_entry(upd, lc); /* mount */ upd->ready = FALSE; - DBG(UPDATE, mnt_debug_h(upd, "%s: update tab: done [rc=%d]", filename, rc)); + DBG(UPDATE, mnt_debug_h(upd, "%s: update tab: done [rc=%d]", + upd->filename, rc)); return rc; } @@ -672,33 +705,19 @@ static int update(const char *target, mnt_fs *fs, unsigned long mountflags) int rc, writable = 0; const char *filename = NULL; mnt_update *upd; - mnt_lock *lock = NULL; DBG(UPDATE, mnt_debug("update test")); rc = mnt_has_regular_mtab(&filename, &writable); if (rc && writable) { - upd = mnt_new_update(FALSE); + /* normal mtab, lock required */ lock = mnt_new_lock(filename, 0); - - /* note that proper solution is to call mnt_unlock_file() from - * signal handler. The atexit() could be ignore if program ends - * by _exit(). The _exit() function is usually used in signal - * handlers. - */ - atexit(lock_fallback); - - } else { - filename = NULL; - rc = mnt_has_regular_utab(&filename, &writable); - - if (rc && writable) - upd = mnt_new_update(TRUE); - else { - fprintf(stderr, "utab useless: %m\n"); - return -1; - } + if (lock) + atexit(lock_fallback); } + upd = mnt_new_update(); + if (!upd) + return -ENOMEM; rc = mnt_update_set_fs(upd, mountflags, target, fs); if (rc == 1) { @@ -713,7 +732,7 @@ static int update(const char *target, mnt_fs *fs, unsigned long mountflags) /* [... here should be mount(2) call ...] */ - rc = mnt_update_tab(upd, filename, lock); + rc = mnt_update_tab(upd, lock); done: return rc; } diff --git a/shlibs/mount/src/utils.c b/shlibs/mount/src/utils.c index 2f62313c..96ce7ddb 100644 --- a/shlibs/mount/src/utils.c +++ b/shlibs/mount/src/utils.c @@ -569,11 +569,8 @@ done: return 0; } -/** - * - * mnt_has_regular_utab: - * @utab: returns path to utab (usually /dev/.mount/utab) - * @writable: returns 1 if the file is writable +/* + * Don't export this to libmount API -- utab is private library stuff. * * If the file does not exist and @writable argument is not NULL then it will * try to create the directory (e.g. /dev/.mount) and the file. @@ -656,10 +653,8 @@ const char *mnt_get_mtab_path(void) return p ? : _PATH_MOUNTED; } -/** - * mnt_get_utab_path: - * - * This function returns *default* location of the utab file. +/* + * Don't export this to libmount API -- utab is private library stuff. * * Returns: path to /dev/.mount/utab or $LIBMOUNT_UTAB. */ diff --git a/tests/expected/libmount/tabfiles-parse-mountinfo b/tests/expected/libmount/tabfiles-parse-mountinfo index 66f69425..a2de2ae7 100644 --- a/tests/expected/libmount/tabfiles-parse-mountinfo +++ b/tests/expected/libmount/tabfiles-parse-mountinfo @@ -3,6 +3,7 @@ source: /proc target: /proc fstype: proc optstr: rw,relatime +root: / id: 15 parent: 20 devno: 0:3 @@ -11,6 +12,7 @@ source: /sys target: /sys fstype: sysfs optstr: rw,relatime +root: / id: 16 parent: 20 devno: 0:15 @@ -19,6 +21,7 @@ source: udev target: /dev fstype: devtmpfs optstr: rw,relatime,size=1983516k,nr_inodes=495879,mode=755 +root: / id: 17 parent: 20 devno: 0:5 @@ -27,6 +30,7 @@ source: devpts target: /dev/pts fstype: devpts optstr: rw,relatime,gid=5,mode=620,ptmxmode=000 +root: / id: 18 parent: 17 devno: 0:10 @@ -35,6 +39,7 @@ source: tmpfs target: /dev/shm fstype: tmpfs optstr: rw,relatime +root: / id: 19 parent: 17 devno: 0:16 @@ -43,6 +48,7 @@ source: /dev/sda4 target: / fstype: ext3 optstr: rw,noatime,errors=continue,user_xattr,acl,barrier=0,data=ordered +root: / id: 20 parent: 1 devno: 8:4 @@ -51,6 +57,7 @@ source: tmpfs target: /sys/fs/cgroup fstype: tmpfs optstr: rw,nosuid,nodev,noexec,relatime,mode=755 +root: / id: 21 parent: 16 devno: 0:17 @@ -59,6 +66,7 @@ source: cgroup target: /sys/fs/cgroup/systemd fstype: cgroup optstr: rw,nosuid,nodev,noexec,relatime,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd +root: / id: 22 parent: 21 devno: 0:18 @@ -67,6 +75,7 @@ source: cgroup target: /sys/fs/cgroup/cpuset fstype: cgroup optstr: rw,nosuid,nodev,noexec,relatime,cpuset +root: / id: 23 parent: 21 devno: 0:19 @@ -75,6 +84,7 @@ source: cgroup target: /sys/fs/cgroup/ns fstype: cgroup optstr: rw,nosuid,nodev,noexec,relatime,ns +root: / id: 24 parent: 21 devno: 0:20 @@ -83,6 +93,7 @@ source: cgroup target: /sys/fs/cgroup/cpu fstype: cgroup optstr: rw,nosuid,nodev,noexec,relatime,cpu +root: / id: 25 parent: 21 devno: 0:21 @@ -91,6 +102,7 @@ source: cgroup target: /sys/fs/cgroup/cpuacct fstype: cgroup optstr: rw,nosuid,nodev,noexec,relatime,cpuacct +root: / id: 26 parent: 21 devno: 0:22 @@ -99,6 +111,7 @@ source: cgroup target: /sys/fs/cgroup/memory fstype: cgroup optstr: rw,nosuid,nodev,noexec,relatime,memory +root: / id: 27 parent: 21 devno: 0:23 @@ -107,6 +120,7 @@ source: cgroup target: /sys/fs/cgroup/devices fstype: cgroup optstr: rw,nosuid,nodev,noexec,relatime,devices +root: / id: 28 parent: 21 devno: 0:24 @@ -115,6 +129,7 @@ source: cgroup target: /sys/fs/cgroup/freezer fstype: cgroup optstr: rw,nosuid,nodev,noexec,relatime,freezer +root: / id: 29 parent: 21 devno: 0:25 @@ -123,6 +138,7 @@ source: cgroup target: /sys/fs/cgroup/net_cls fstype: cgroup optstr: rw,nosuid,nodev,noexec,relatime,net_cls +root: / id: 30 parent: 21 devno: 0:26 @@ -131,6 +147,7 @@ source: cgroup target: /sys/fs/cgroup/blkio fstype: cgroup optstr: rw,nosuid,nodev,noexec,relatime,blkio +root: / id: 31 parent: 21 devno: 0:27 @@ -139,6 +156,7 @@ source: systemd-1 target: /sys/kernel/security fstype: autofs optstr: rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +root: / id: 32 parent: 16 devno: 0:28 @@ -147,6 +165,7 @@ source: systemd-1 target: /dev/hugepages fstype: autofs optstr: rw,relatime,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +root: / id: 33 parent: 17 devno: 0:29 @@ -155,6 +174,7 @@ source: systemd-1 target: /sys/kernel/debug fstype: autofs optstr: rw,relatime,fd=24,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +root: / id: 34 parent: 16 devno: 0:30 @@ -163,6 +183,7 @@ source: systemd-1 target: /proc/sys/fs/binfmt_misc fstype: autofs optstr: rw,relatime,fd=25,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +root: / id: 35 parent: 15 devno: 0:31 @@ -171,6 +192,7 @@ source: systemd-1 target: /dev/mqueue fstype: autofs optstr: rw,relatime,fd=26,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +root: / id: 36 parent: 17 devno: 0:32 @@ -179,6 +201,7 @@ source: /proc/bus/usb target: /proc/bus/usb fstype: usbfs optstr: rw,relatime +root: / id: 37 parent: 15 devno: 0:14 @@ -187,6 +210,7 @@ source: hugetlbfs target: /dev/hugepages fstype: hugetlbfs optstr: rw,relatime +root: / id: 38 parent: 33 devno: 0:33 @@ -195,6 +219,7 @@ source: mqueue target: /dev/mqueue fstype: mqueue optstr: rw,relatime +root: / id: 39 parent: 36 devno: 0:12 @@ -203,6 +228,7 @@ source: /dev/sda6 target: /boot fstype: ext3 optstr: rw,noatime,errors=continue,barrier=0,data=ordered +root: / id: 40 parent: 20 devno: 8:6 @@ -211,6 +237,7 @@ source: /dev/mapper/kzak-home target: /home/kzak fstype: ext4 optstr: rw,noatime,barrier=1,data=ordered +root: / id: 41 parent: 20 devno: 253:0 @@ -219,6 +246,7 @@ source: (null) target: /proc/sys/fs/binfmt_misc fstype: binfmt_misc optstr: rw,relatime +root: / id: 42 parent: 35 devno: 0:34 @@ -227,6 +255,7 @@ source: fusectl target: /sys/fs/fuse/connections fstype: fusectl optstr: rw,relatime +root: / id: 43 parent: 16 devno: 0:35 @@ -235,6 +264,7 @@ source: gvfs-fuse-daemon target: /home/kzak/.gvfs fstype: fuse.gvfs-fuse-daemon optstr: rw,nosuid,nodev,relatime,user_id=500,group_id=500 +root: / id: 44 parent: 41 devno: 0:36 @@ -243,6 +273,7 @@ source: sunrpc target: /var/lib/nfs/rpc_pipefs fstype: rpc_pipefs optstr: rw,relatime +root: / id: 45 parent: 20 devno: 0:37 @@ -251,6 +282,7 @@ source: //foo.home/bar/ target: /mnt/sounds fstype: cifs optstr: rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 +root: / id: 47 parent: 20 devno: 0:38 diff --git a/tests/expected/libmount/update-utab-mount b/tests/expected/libmount/update-utab-mount index 0464c749..520324ac 100644 --- a/tests/expected/libmount/update-utab-mount +++ b/tests/expected/libmount/update-utab-mount @@ -1,2 +1,2 @@ -0 0 0:0 / /mnt/bar user - ext3 /dev/sdb1 none -0 0 0:0 / /mnt/xyz loop=/dev/loop0,uhelper=hal - ext3 /dev/sda2 none +SRC=/dev/sdb1 TARGET=/mnt/bar ROOT=/ OPTS=user +SRC=/dev/sda2 TARGET=/mnt/xyz ROOT=/ OPTS=loop=/dev/loop0,uhelper=hal diff --git a/tests/expected/libmount/update-utab-move b/tests/expected/libmount/update-utab-move index bdcf9cb3..316d129f 100644 --- a/tests/expected/libmount/update-utab-move +++ b/tests/expected/libmount/update-utab-move @@ -1,2 +1,2 @@ -0 0 0:0 / /mnt/newbar user - ext3 /dev/sdb1 none -0 0 0:0 / /mnt/newxyz loop=/dev/loop0,uhelper=hal - ext3 /dev/sda2 none +SRC=/dev/sdb1 TARGET=/mnt/newbar ROOT=/ OPTS=user +SRC=/dev/sda2 TARGET=/mnt/newxyz ROOT=/ OPTS=loop=/dev/loop0,uhelper=hal diff --git a/tests/expected/libmount/update-utab-remount b/tests/expected/libmount/update-utab-remount index 853d9fbe..c5573eaa 100644 --- a/tests/expected/libmount/update-utab-remount +++ b/tests/expected/libmount/update-utab-remount @@ -1,2 +1,2 @@ -0 0 0:0 / /mnt/newbar user - ext3 /dev/sdb1 none -0 0 0:0 / /mnt/newxyz user - ext3 /dev/sda2 none +SRC=/dev/sdb1 TARGET=/mnt/newbar ROOT=/ OPTS=user +SRC=/dev/sda2 TARGET=/mnt/newxyz ROOT=/ OPTS=user diff --git a/tests/expected/libmount/update-utab-umount b/tests/expected/libmount/update-utab-umount index b8c096bf..4c07d744 100644 --- a/tests/expected/libmount/update-utab-umount +++ b/tests/expected/libmount/update-utab-umount @@ -1 +1 @@ -0 0 0:0 / /mnt/newxyz user - ext3 /dev/sda2 none +SRC=/dev/sda2 TARGET=/mnt/newxyz ROOT=/ OPTS=user diff --git a/tests/ts/libmount/update b/tests/ts/libmount/update index b895ba05..65e0ea52 100755 --- a/tests/ts/libmount/update +++ b/tests/ts/libmount/update @@ -23,6 +23,7 @@ TESTPROG="$TS_HELPER_LIBMOUNT_UPDATE" # Traditional /etc/mtab # export LIBMOUNT_MTAB=$TS_OUTPUT.mtab +rm -f $LIBMOUNT_MTAB > $LIBMOUNT_MTAB ts_init_subtest "mtab-mount" @@ -58,6 +59,7 @@ rm -f $LIBMOUNT_MTAB ln -s /proc/mounts $LIBMOUNT_MTAB export LIBMOUNT_UTAB=$TS_OUTPUT.utab +rm -f $LIBMOUNT_UTAB > $LIBMOUNT_UTAB ts_init_subtest "utab-mount" -- 2.39.5