]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: remove mtab related code
authorKarel Zak <kzak@redhat.com>
Fri, 17 Jun 2022 15:45:29 +0000 (17:45 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 17 Jun 2022 15:45:29 +0000 (17:45 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
17 files changed:
libmount/src/cache.c
libmount/src/context.c
libmount/src/context_loopdev.c
libmount/src/context_mount.c
libmount/src/context_umount.c
libmount/src/fs.c
libmount/src/libmount.h.in
libmount/src/libmount.sym
libmount/src/mountP.h
libmount/src/tab.c
libmount/src/tab_parse.c
libmount/src/tab_update.c
libmount/src/utils.c
sys-utils/mount.8.adoc
sys-utils/umount.8.adoc
tests/ts/libmount/context-utab
tests/ts/libmount/context-utab-py

index 2fafdd0fabbd31953a3e3a998b14e7e38c5fac71..c9b99538a3154ff45b4006a72d0f3052afb6c638 100644 (file)
@@ -68,7 +68,7 @@ struct libmnt_cache {
         */
        blkid_cache             bc;
 
-       struct libmnt_table     *mtab;
+       struct libmnt_table     *mountinfo;
 };
 
 /**
@@ -141,7 +141,7 @@ void mnt_unref_cache(struct libmnt_cache *cache)
                cache->refcount--;
                /*DBG(CACHE, ul_debugobj(cache, "unref=%d", cache->refcount));*/
                if (cache->refcount <= 0) {
-                       mnt_unref_table(cache->mtab);
+                       mnt_unref_table(cache->mountinfo);
 
                        mnt_free_cache(cache);
                }
@@ -151,22 +151,22 @@ void mnt_unref_cache(struct libmnt_cache *cache)
 /**
  * mnt_cache_set_targets:
  * @cache: cache pointer
- * @mtab: table with already canonicalized mountpoints
+ * @mountinfo: table with already canonicalized mountpoints
  *
- * Add to @cache reference to @mtab. This can be used to avoid unnecessary paths
+ * Add to @cache reference to @mountinfo. This can be used to avoid unnecessary paths
  * canonicalization in mnt_resolve_target().
  *
  * Returns: negative number in case of error, or 0 o success.
  */
 int mnt_cache_set_targets(struct libmnt_cache *cache,
-                               struct libmnt_table *mtab)
+                               struct libmnt_table *mountinfo)
 {
        if (!cache)
                return -EINVAL;
 
-       mnt_ref_table(mtab);
-       mnt_unref_table(cache->mtab);
-       cache->mtab = mtab;
+       mnt_ref_table(mountinfo);
+       mnt_unref_table(cache->mountinfo);
+       cache->mountinfo = mountinfo;
        return 0;
 }
 
@@ -556,8 +556,8 @@ char *mnt_resolve_path(const char *path, struct libmnt_cache *cache)
  * @cache: cache for results or NULL.
  *
  * Like mnt_resolve_path(), unless @cache is not NULL and
- * mnt_cache_set_targets(cache, mtab) was called: if @path is found in the
- * cached @mtab and the matching entry was provided by the kernel, assume that
+ * mnt_cache_set_targets(cache, mountinfo) was called: if @path is found in the
+ * cached @mountinfo and the matching entry was provided by the kernel, assume that
  * @path is already canonicalized. By avoiding a call to realpath(2) on
  * known mount points, there is a lower risk of stepping on a stale mount
  * point, which can result in an application freeze. This is also faster in
@@ -572,7 +572,7 @@ char *mnt_resolve_target(const char *path, struct libmnt_cache *cache)
 
        /*DBG(CACHE, ul_debugobj(cache, "resolving target %s", path));*/
 
-       if (!cache || !cache->mtab)
+       if (!cache || !cache->mountinfo)
                return mnt_resolve_path(path, cache);
 
        p = (char *) cache_find_path(cache, path);
@@ -584,7 +584,7 @@ char *mnt_resolve_target(const char *path, struct libmnt_cache *cache)
                struct libmnt_fs *fs = NULL;
 
                mnt_reset_iter(&itr, MNT_ITER_BACKWARD);
-               while (mnt_table_next_fs(cache->mtab, &itr, &fs) == 0) {
+               while (mnt_table_next_fs(cache->mountinfo, &itr, &fs) == 0) {
 
                        if (!mnt_fs_is_kernel(fs)
                             || mnt_fs_is_swaparea(fs)
index ac74c0e7b344c054c38602b334a4494edd785acd..d325ce4309fccd544e90b48d71c61cfe0081e42e 100644 (file)
@@ -150,7 +150,7 @@ int mnt_reset_context(struct libmnt_context *cxt)
        fl = cxt->flags;
 
        mnt_unref_fs(cxt->fs);
-       mnt_unref_table(cxt->mtab);
+       mnt_unref_table(cxt->mountinfo);
        mnt_unref_table(cxt->utab);
 
        free(cxt->helper);
@@ -162,7 +162,7 @@ int mnt_reset_context(struct libmnt_context *cxt)
        cxt->tgt_mode = (mode_t) -1;
 
        cxt->fs = NULL;
-       cxt->mtab = NULL;
+       cxt->mountinfo = NULL;
        cxt->utab = NULL;
        cxt->helper = NULL;
        cxt->orig_user = NULL;
@@ -288,10 +288,10 @@ struct libmnt_context *mnt_copy_context(struct libmnt_context *o)
                        goto failed;
        }
 
-       n->mtab = o->mtab;
-       mnt_ref_table(n->mtab);
+       n->mountinfo = o->mountinfo;
+       mnt_ref_table(n->mountinfo);
 
-       n->mtab = o->utab;
+       n->utab = o->utab;
        mnt_ref_table(n->utab);
 
        if (strdup_between_structs(n, o, tgt_prefix))
@@ -360,8 +360,6 @@ static int context_init_paths(struct libmnt_context *cxt, int writable)
 
        DBG(CXT, ul_debugobj(cxt, "checking for writable tab files"));
 
-       cxt->mtab_writable = 0;
-
        ns_old = mnt_context_switch_target_ns(cxt);
        if (!ns_old)
                return -MNT_ERR_NAMESPACE;
@@ -375,14 +373,6 @@ static int context_init_paths(struct libmnt_context *cxt, int writable)
        return 0;
 }
 
-int mnt_context_mtab_writable(struct libmnt_context *cxt)
-{
-       assert(cxt);
-
-       context_init_paths(cxt, 1);
-       return cxt->mtab_writable == 1;
-}
-
 int mnt_context_utab_writable(struct libmnt_context *cxt)
 {
        assert(cxt);
@@ -396,7 +386,7 @@ const char *mnt_context_get_writable_tabpath(struct libmnt_context *cxt)
        assert(cxt);
 
        context_init_paths(cxt, 1);
-       return cxt->mtab_writable ? cxt->mtab_path : cxt->utab_path;
+       return cxt->utab_path;
 }
 
 
@@ -455,23 +445,23 @@ int mnt_context_force_unrestricted(struct libmnt_context *cxt)
  * @cxt: mount context
  * @mode: MNT_OMODE_* flags
  *
- * Controls how to use mount optionssource and target paths from fstab/mtab.
+ * Controls how to use mount optionssource and target paths from fstab/mountinfo.
  *
- * @MNT_OMODE_IGNORE: ignore mtab/fstab options
+ * @MNT_OMODE_IGNORE: ignore fstab options
  *
- * @MNT_OMODE_APPEND: append mtab/fstab options to existing options
+ * @MNT_OMODE_APPEND: append fstab options to existing options
  *
- * @MNT_OMODE_PREPEND: prepend mtab/fstab options to existing options
+ * @MNT_OMODE_PREPEND: prepend fstab options to existing options
  *
- * @MNT_OMODE_REPLACE: replace existing options with options from mtab/fstab
+ * @MNT_OMODE_REPLACE: replace existing options with options from fstab
  *
- * @MNT_OMODE_FORCE: always read mtab/fstab (although source and target are defined)
+ * @MNT_OMODE_FORCE: always read fstab (although source and target are defined)
  *
  * @MNT_OMODE_FSTAB: read from fstab
  *
- * @MNT_OMODE_MTAB: read from mtab if fstab not enabled or failed
+ * @MNT_OMODE_MTAB: read from mountinfo if fstab not enabled or failed
  *
- * @MNT_OMODE_NOTAB: do not read fstab/mtab at all
+ * @MNT_OMODE_NOTAB: do not read fstab/mountinfoat all
  *
  * @MNT_OMODE_AUTO: default mode (MNT_OMODE_PREPEND | MNT_OMODE_FSTAB | MNT_OMODE_MTAB)
  *
@@ -482,7 +472,7 @@ int mnt_context_force_unrestricted(struct libmnt_context *cxt)
  * - MNT_OMODE_USER is always used if mount context is in restricted mode
  * - MNT_OMODE_AUTO is used if nothing else is defined
  * - the flags are evaluated in this order: MNT_OMODE_NOTAB, MNT_OMODE_FORCE,
- *   MNT_OMODE_FSTAB, MNT_OMODE_MTAB and then the mount options from fstab/mtab
+ *   MNT_OMODE_FSTAB, MNT_OMODE_MTAB and then the mount options from fstab/mountinfo
  *   are set according to MNT_OMODE_{IGNORE,APPEND,PREPEND,REPLACE}
  *
  * Returns: 0 on success, negative number in case of error.
@@ -798,7 +788,8 @@ int mnt_context_is_fake(struct libmnt_context *cxt)
  * @cxt: mount context
  * @disable: TRUE or FALSE
  *
- * Disable/enable mtab update (see mount(8) man page, option -n).
+ * Disable/enable userspace mount table update (see mount(8) man page,
+ * option -n). Originally /etc/mtab, now /run/mount/utab.
  *
  * Returns: 0 on success, negative number in case of error.
  */
@@ -992,11 +983,15 @@ void *mnt_context_get_fstab_userdata(struct libmnt_context *cxt)
  * mnt_context_get_mtab_userdata:
  * @cxt: mount context
  *
+ * The file /etc/mtab is no more used, @context points always to mountinfo
+ * (/proc/self/mountinfo). The function uses "mtab" in the name for backward
+ * compatibility only.
+ *
  * Returns: pointer to userdata or NULL.
  */
 void *mnt_context_get_mtab_userdata(struct libmnt_context *cxt)
 {
-       return cxt->mtab ? mnt_table_get_userdata(cxt->mtab) : NULL;
+       return cxt->mountinfo ? mnt_table_get_userdata(cxt->mountinfo) : NULL;
 }
 
 /**
@@ -1284,73 +1279,55 @@ int mnt_context_get_fstab(struct libmnt_context *cxt, struct libmnt_table **tb)
        return 0;
 }
 
-/**
- * mnt_context_get_mtab:
- * @cxt: mount context
- * @tb: returns mtab
- *
- * See also mnt_table_parse_mtab() for more details about mtab/mountinfo. The
- * result will be deallocated by mnt_free_context(@cxt).
- *
- * Returns: 0 on success, negative number in case of error.
- */
-int mnt_context_get_mtab(struct libmnt_context *cxt, struct libmnt_table **tb)
+int mnt_context_get_mountinfo(struct libmnt_context *cxt, struct libmnt_table **tb)
 {
        int rc = 0;
        struct libmnt_ns *ns_old = NULL;
 
        if (!cxt)
                return -EINVAL;
-       if (!cxt->mtab) {
+       if (!cxt->mountinfo) {
                ns_old = mnt_context_switch_target_ns(cxt);
                if (!ns_old)
                        return -MNT_ERR_NAMESPACE;
 
                context_init_paths(cxt, 0);
 
-               cxt->mtab = mnt_new_table();
-               if (!cxt->mtab) {
+               cxt->mountinfo = mnt_new_table();
+               if (!cxt->mountinfo) {
                        rc = -ENOMEM;
                        goto end;
                }
 
                if (cxt->table_errcb)
-                       mnt_table_set_parser_errcb(cxt->mtab, cxt->table_errcb);
+                       mnt_table_set_parser_errcb(cxt->mountinfo, cxt->table_errcb);
                if (cxt->table_fltrcb)
-                       mnt_table_set_parser_fltrcb(cxt->mtab,
+                       mnt_table_set_parser_fltrcb(cxt->mountinfo,
                                        cxt->table_fltrcb,
                                        cxt->table_fltrcb_data);
 
-               mnt_table_set_cache(cxt->mtab, mnt_context_get_cache(cxt));
+               mnt_table_set_cache(cxt->mountinfo, mnt_context_get_cache(cxt));
        }
 
-       /* Read the table; it's empty, because this first mnt_context_get_mtab()
+       /* Read the table; it's empty, because this first mnt_context_get_mountinfo()
         * call, or because /proc was not accessible in previous calls */
-       if (mnt_table_is_empty(cxt->mtab)) {
+       if (mnt_table_is_empty(cxt->mountinfo)) {
                if (!ns_old) {
                        ns_old = mnt_context_switch_target_ns(cxt);
                        if (!ns_old)
                                return -MNT_ERR_NAMESPACE;
                }
 
-               /*
-                * Note that mtab_path is NULL if mtab is useless or unsupported
-                */
-               if (cxt->utab)
-                       /* utab already parsed, don't parse it again */
-                       rc = __mnt_table_parse_mtab(cxt->mtab,
-                                                   cxt->mtab_path, cxt->utab);
-               else
-                       rc = mnt_table_parse_mtab(cxt->mtab, cxt->mtab_path);
+               rc = __mnt_table_parse_mountinfo(cxt->mountinfo, NULL, cxt->utab);
                if (rc)
                        goto end;
        }
 
        if (tb)
-               *tb = cxt->mtab;
+               *tb = cxt->mountinfo;
 
-       DBG(CXT, ul_debugobj(cxt, "mtab requested [nents=%d]",
-                               mnt_table_get_nents(cxt->mtab)));
+       DBG(CXT, ul_debugobj(cxt, "mountinfo requested [nents=%d]",
+                               mnt_table_get_nents(cxt->mountinfo)));
 
 end:
        if (ns_old && !mnt_context_switch_ns(cxt, ns_old))
@@ -1359,11 +1336,32 @@ end:
        return rc;
 }
 
+/**
+ * mnt_context_get_mtab:
+ * @cxt: mount context
+ * @tb: returns mtab
+ *
+ * Parse /proc/self/mountinfo mount table.
+ *
+ * The file /etc/mtab is no more used, @context points always to mountinfo
+ * (/proc/self/mountinfo). The function uses "mtab" in the name for backward
+ * compatibility only.
+ *
+ * See also mnt_table_parse_mtab() for more details about mountinfo. The
+ * result will be deallocated by mnt_free_context(@cxt).
+ *
+ * Returns: 0 on success, negative number in case of error.
+ */
+int mnt_context_get_mtab(struct libmnt_context *cxt, struct libmnt_table **tb)
+{
+       return mnt_context_get_mountinfo(cxt, tb);
+}
+
 /*
- * Called by mtab parser to filter out entries, non-zero means that
+ * Called by mountinfo parser to filter out entries, non-zero means that
  * an entry has to be filtered out.
  */
-static int mtab_filter(struct libmnt_fs *fs, void *data)
+static int mountinfo_filter(struct libmnt_fs *fs, void *data)
 {
        if (!fs || !data)
                return 0;
@@ -1375,11 +1373,11 @@ static int mtab_filter(struct libmnt_fs *fs, void *data)
 }
 
 /*
- * The same like mnt_context_get_mtab(), but does not read all mountinfo/mtab
+ * The same like mnt_context_get_mountinfo(), but does not read all mountinfo
  * file, but only entries relevant for @tgt.
  */
-int mnt_context_get_mtab_for_target(struct libmnt_context *cxt,
-                                   struct libmnt_table **mtab,
+int mnt_context_get_mountinfo_for_target(struct libmnt_context *cxt,
+                                   struct libmnt_table **mountinfo,
                                    const char *tgt)
 {
        struct stat st;
@@ -1393,16 +1391,16 @@ int mnt_context_get_mtab_for_target(struct libmnt_context *cxt,
                return -MNT_ERR_NAMESPACE;
 
        if (mnt_context_is_nocanonicalize(cxt))
-               mnt_context_set_tabfilter(cxt, mtab_filter, (void *) tgt);
+               mnt_context_set_tabfilter(cxt, mountinfo_filter, (void *) tgt);
 
        else if (mnt_stat_mountpoint(tgt, &st) == 0 && S_ISDIR(st.st_mode)) {
                cache = mnt_context_get_cache(cxt);
                cn_tgt = mnt_resolve_path(tgt, cache);
                if (cn_tgt)
-                       mnt_context_set_tabfilter(cxt, mtab_filter, cn_tgt);
+                       mnt_context_set_tabfilter(cxt, mountinfo_filter, cn_tgt);
        }
 
-       rc = mnt_context_get_mtab(cxt, mtab);
+       rc = mnt_context_get_mountinfo(cxt, mountinfo);
        mnt_context_set_tabfilter(cxt, NULL, NULL);
 
        if (!mnt_context_switch_ns(cxt, ns_old))
@@ -1416,7 +1414,7 @@ int mnt_context_get_mtab_for_target(struct libmnt_context *cxt,
 
 /*
  * Allows to specify a filter for tab file entries. The filter is called by
- * the table parser. Currently used for mtab and utab only.
+ * the table parser. Currently used for utab only.
  */
 int mnt_context_set_tabfilter(struct libmnt_context *cxt,
                              int (*fltr)(struct libmnt_fs *, void *),
@@ -1428,8 +1426,8 @@ int mnt_context_set_tabfilter(struct libmnt_context *cxt,
        cxt->table_fltrcb = fltr;
        cxt->table_fltrcb_data = data;
 
-       if (cxt->mtab)
-               mnt_table_set_parser_fltrcb(cxt->mtab,
+       if (cxt->mountinfo)
+               mnt_table_set_parser_fltrcb(cxt->mountinfo,
                                cxt->table_fltrcb,
                                cxt->table_fltrcb_data);
 
@@ -1448,7 +1446,7 @@ int mnt_context_set_tabfilter(struct libmnt_context *cxt,
  * See also mnt_table_parse_file().
  *
  * It's strongly recommended to use the mnt_context_get_mtab() and
- * mnt_context_get_fstab() functions for mtab and fstab files. This function
+ * mnt_context_get_fstab() functions for mountinfo and fstab files. This function
  * does not care about LIBMOUNT_* env.variables and does not merge userspace
  * options.
  *
@@ -1497,7 +1495,7 @@ end:
  * @cxt: mount context
  * @cb: pointer to callback function
  *
- * The error callback is used for all tab files (e.g. mtab, fstab)
+ * The error callback is used for all tab files (e.g. mountinfo, fstab)
  * parsed within the context.
  *
  * See also mnt_context_get_mtab(),
@@ -1512,8 +1510,8 @@ int mnt_context_set_tables_errcb(struct libmnt_context *cxt,
        if (!cxt)
                return -EINVAL;
 
-       if (cxt->mtab)
-               mnt_table_set_parser_errcb(cxt->mtab, cb);
+       if (cxt->mountinfo)
+               mnt_table_set_parser_errcb(cxt->mountinfo, cb);
        if (cxt->fstab)
                mnt_table_set_parser_errcb(cxt->fstab, cb);
 
@@ -1531,7 +1529,7 @@ int mnt_context_set_tables_errcb(struct libmnt_context *cxt,
  * This function increments cache reference counter.
  *
  * If the @cache argument is NULL, then the current cache instance is reset.
- * This function apply the cache to fstab and mtab instances (if already
+ * This function apply the cache to fstab and mountinfo instances (if already
  * exists).
  *
  * The old cache instance reference counter is de-incremented.
@@ -1548,8 +1546,8 @@ int mnt_context_set_cache(struct libmnt_context *cxt, struct libmnt_cache *cache
 
        cxt->cache = cache;
 
-       if (cxt->mtab)
-               mnt_table_set_cache(cxt->mtab, cache);
+       if (cxt->mountinfo)
+               mnt_table_set_cache(cxt->mountinfo, cache);
        if (cxt->fstab)
                mnt_table_set_cache(cxt->fstab, cache);
 
@@ -1603,12 +1601,12 @@ int mnt_context_set_passwd_cb(struct libmnt_context *cxt,
  * mnt_context_get_lock:
  * @cxt: mount context
  *
- * The libmount applications don't have to care about mtab locking, but with a
+ * The libmount applications don't have to care about utab locking, but with a
  * small exception: the application has to be able to remove the lock file when
  * interrupted by signal or signals have to be ignored when the lock is locked.
  *
  * The default behavior is to ignore all signals (except SIGALRM and
- * SIGTRAP for mtab update) when the lock is locked. If this behavior
+ * SIGTRAP for utab update) when the lock is locked. If this behavior
  * is unacceptable, then use:
  *
  *     lc = mnt_context_get_lock(cxt);
@@ -1624,7 +1622,7 @@ struct libmnt_lock *mnt_context_get_lock(struct libmnt_context *cxt)
        /*
         * DON'T call this function within libmount, it will always allocate
         * the lock. The mnt_update_* functions are able to allocate the lock
-        * only when mtab/utab update is really necessary.
+        * only when utab update is really necessary.
         */
        if (!cxt || mnt_context_is_nomtab(cxt))
                return NULL;
@@ -2277,7 +2275,7 @@ int mnt_context_merge_mflags(struct libmnt_context *cxt)
 }
 
 /*
- * Prepare /etc/mtab or /run/mount/utab
+ * Prepare /run/mount/utab
  */
 int mnt_context_prepare_update(struct libmnt_context *cxt)
 {
@@ -2331,8 +2329,7 @@ int mnt_context_prepare_update(struct libmnt_context *cxt)
                if (!cxt->update)
                        return -ENOMEM;
 
-               mnt_update_set_filename(cxt->update, name,
-                               !mnt_context_mtab_writable(cxt));
+               mnt_update_set_filename(cxt->update, name);
        }
 
        if (cxt->action == MNT_ACT_UMOUNT)
@@ -2603,14 +2600,14 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt)
                        rc = apply_table(cxt, tab, MNT_ITER_FORWARD, mflags);
        }
 
-       /* try mtab */
+       /* try mountinfo */
        if (rc < 0 && (cxt->optsmode & MNT_OMODE_MTAB)
            && (isremount || cxt->action == MNT_ACT_UMOUNT)) {
-               DBG(CXT, ul_debugobj(cxt, "trying to apply mtab (src=%s, target=%s)", src, tgt));
+               DBG(CXT, ul_debugobj(cxt, "trying to apply mountinfo (src=%s, target=%s)", src, tgt));
                if (tgt)
-                       rc = mnt_context_get_mtab_for_target(cxt, &tab, tgt);
+                       rc = mnt_context_get_mountinfo_for_target(cxt, &tab, tgt);
                else
-                       rc = mnt_context_get_mtab(cxt, &tab);
+                       rc = mnt_context_get_mountinfo(cxt, &tab);
                if (!rc)
                        rc = apply_table(cxt, tab, MNT_ITER_BACKWARD, mflags);
        }
@@ -2622,13 +2619,13 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt)
                if (!mnt_context_is_restricted(cxt)
                    && tgt && !src
                    && isremount) {
-                       DBG(CXT, ul_debugobj(cxt, "only target; ignore missing mtab entry on remount"));
+                       DBG(CXT, ul_debugobj(cxt, "only target; ignore missing mountinfo entry on remount"));
                        return 0;
                }
 
-               DBG(CXT, ul_debugobj(cxt, "failed to find entry in fstab/mtab [rc=%d]: %m", rc));
+               DBG(CXT, ul_debugobj(cxt, "failed to find entry in fstab/mountinfo [rc=%d]: %m", rc));
 
-               /* force to "not found in fstab/mtab" error, the details why
+               /* force to "not found in fstab/mountinfo" error, the details why
                 * not found are not so important and may be misinterpreted by
                 * applications... */
                rc = -MNT_ERR_NOFSTAB;
@@ -2646,7 +2643,7 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt)
  * mnt_context_tab_applied:
  * @cxt: mount context
  *
- * Returns: 1 if fstab (or mtab) has been applied to the context, or 0.
+ * Returns: 1 if fstab (or mountinfo) has been applied to the context, or 0.
  */
 int mnt_context_tab_applied(struct libmnt_context *cxt)
 {
@@ -2953,7 +2950,7 @@ int mnt_context_helper_setopt(struct libmnt_context *cxt, int c, char *arg)
 int mnt_context_is_fs_mounted(struct libmnt_context *cxt,
                              struct libmnt_fs *fs, int *mounted)
 {
-       struct libmnt_table *mtab, *orig;
+       struct libmnt_table *mountinfo, *orig;
        int rc = 0;
        struct libmnt_ns *ns_old;
 
@@ -2964,19 +2961,18 @@ int mnt_context_is_fs_mounted(struct libmnt_context *cxt,
        if (!ns_old)
                return -MNT_ERR_NAMESPACE;
 
-       orig = cxt->mtab;
-       rc = mnt_context_get_mtab(cxt, &mtab);
-       if (rc == -ENOENT && mnt_fs_streq_target(fs, "/proc") &&
-           (!cxt->mtab_path || startswith(cxt->mtab_path, "/proc/"))) {
+       orig = cxt->mountinfo;
+       rc = mnt_context_get_mountinfo(cxt, &mountinfo);
+       if (rc == -ENOENT && mnt_fs_streq_target(fs, "/proc")) {
                if (!orig) {
-                       mnt_unref_table(cxt->mtab);
-                       cxt->mtab = NULL;
+                       mnt_unref_table(cxt->mountinfo);
+                       cxt->mountinfo = NULL;
                }
                *mounted = 0;
                rc = 0;                 /* /proc not mounted */
 
        } else if (rc == 0) {
-               *mounted = __mnt_table_is_fs_mounted(mtab, fs,
+               *mounted = __mnt_table_is_fs_mounted(mountinfo, fs,
                                mnt_context_get_target_prefix(cxt));
 
        }
index 62e319ce613132446a83aa2f9ff8e390e8ad3a78..a76e1907ee930becbb8258583647613735cc2ec4 100644 (file)
@@ -100,7 +100,7 @@ is_mounted_same_loopfile(struct libmnt_context *cxt,
        assert(cxt->fs);
        assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED));
 
-       if (mnt_context_get_mtab(cxt, &tb))
+       if (mnt_context_get_mountinfo(cxt, &tb))
                return 0;
 
        ns_old = mnt_context_switch_target_ns(cxt);
@@ -115,7 +115,7 @@ is_mounted_same_loopfile(struct libmnt_context *cxt,
 
        bf = cache ? mnt_resolve_path(backing_file, cache) : backing_file;
 
-       /* Search for a mountpoint node in mtab, proceed if any of these have the
+       /* Search for a mountpoint node in mountinfo, proceed if any of these have the
         * loop option set or the device is a loop device
         */
        while (rc == 0 && mnt_table_next_fs(tb, &itr, &fs) == 0) {
@@ -319,11 +319,10 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt)
        if (rc)
                goto done;
 
-       /* since 2.6.37 we don't have to store backing filename to mtab
+       /* since 2.6.37 we don't have to store backing filename to mountinfo
         * because kernel provides the name in /sys.
         */
-       if (get_linux_version() >= KERNEL_VERSION(2, 6, 37) ||
-           !mnt_context_mtab_writable(cxt)) {
+       if (get_linux_version() >= KERNEL_VERSION(2, 6, 37)) {
                DBG(LOOP, ul_debugobj(cxt, "enabling AUTOCLEAR flag"));
                lo_flags |= LO_FLAGS_AUTOCLEAR;
        }
@@ -379,9 +378,9 @@ success:
                    loopcxt_is_autoclear(&lc))) {
                        /*
                         * autoclear flag accepted by the kernel, don't store
-                        * the "loop=" option to mtab.
+                        * the "loop=" option to utab.
                         */
-                       DBG(LOOP, ul_debugobj(cxt, "removing unnecessary loop= from mtab"));
+                       DBG(LOOP, ul_debugobj(cxt, "removing unnecessary loop= from utab"));
                        cxt->user_mountflags &= ~MNT_MS_LOOP;
                        mnt_optstr_remove_option(&cxt->fs->user_optstr, "loop");
                }
index 0ebf8ec1b392f550d06c98f68b31953028325f2a..3eaa12f0f37156ee5bb9a29b491ace0b1b572dbe 100644 (file)
@@ -1241,7 +1241,7 @@ static struct libmnt_fs *get_already_mounted_source(struct libmnt_context *cxt)
 
        src = mnt_fs_get_srcpath(cxt->fs);
 
-       if (src && mnt_context_get_mtab(cxt, &tb) == 0) {
+       if (src && mnt_context_get_mountinfo(cxt, &tb) == 0) {
                struct libmnt_iter itr;
                struct libmnt_fs *fs;
 
@@ -1439,7 +1439,7 @@ int mnt_context_next_mount(struct libmnt_context *cxt,
                           int *mntrc,
                           int *ignored)
 {
-       struct libmnt_table *fstab, *mtab;
+       struct libmnt_table *fstab, *mountinfo;
        const char *o, *tgt;
        int rc, mounted = 0;
 
@@ -1497,7 +1497,7 @@ int mnt_context_next_mount(struct libmnt_context *cxt,
        /* ignore already mounted filesystems */
        rc = mnt_context_is_fs_mounted(cxt, *fs, &mounted);
        if (rc) {
-               if (mnt_table_is_empty(cxt->mtab)) {
+               if (mnt_table_is_empty(cxt->mountinfo)) {
                        DBG(CXT, ul_debugobj(cxt, "next-mount: no mount table [rc=%d], ignore", rc));
                        rc = 0;
                        if (ignored)
@@ -1522,11 +1522,11 @@ int mnt_context_next_mount(struct libmnt_context *cxt,
                mnt_context_save_template(cxt);
        }
 
-       /* reset context, but protect mtab */
-       mtab = cxt->mtab;
-       cxt->mtab = NULL;
+       /* reset context, but protect mountinfo */
+       mountinfo = cxt->mountinfo;
+       cxt->mountinfo = NULL;
        mnt_reset_context(cxt);
-       cxt->mtab = mtab;
+       cxt->mountinfo = mountinfo;
 
        if (mnt_context_is_fork(cxt)) {
                rc = mnt_fork_context(cxt);
@@ -1613,7 +1613,7 @@ int mnt_context_next_remount(struct libmnt_context *cxt,
                           int *mntrc,
                           int *ignored)
 {
-       struct libmnt_table *mtab;
+       struct libmnt_table *mountinfo;
        const char *tgt;
        int rc;
 
@@ -1625,11 +1625,11 @@ int mnt_context_next_remount(struct libmnt_context *cxt,
        if (!cxt || !fs || !itr)
                return -EINVAL;
 
-       rc = mnt_context_get_mtab(cxt, &mtab);
+       rc = mnt_context_get_mountinfo(cxt, &mountinfo);
        if (rc)
                return rc;
 
-       rc = mnt_table_next_fs(mtab, itr, fs);
+       rc = mnt_table_next_fs(mountinfo, itr, fs);
        if (rc != 0)
                return rc;      /* more filesystems (or error) */
 
@@ -1666,10 +1666,10 @@ int mnt_context_next_remount(struct libmnt_context *cxt,
                mnt_context_save_template(cxt);
        }
 
-       /* restore original, but protect mtab */
-       cxt->mtab = NULL;
+       /* restore original, but protect mountinfo */
+       cxt->mountinfo = NULL;
        mnt_reset_context(cxt);
-       cxt->mtab = mtab;
+       cxt->mountinfo = mountinfo;
 
        rc = mnt_context_set_target(cxt, tgt);
        if (!rc) {
@@ -1711,7 +1711,7 @@ static int is_shared_tree(struct libmnt_context *cxt, const char *dir)
 
        if (!dir)
                return 0;
-       if (mnt_context_get_mtab(cxt, &tb) || !tb)
+       if (mnt_context_get_mountinfo(cxt, &tb) || !tb)
                goto done;
 
        mnt = strdup(dir);
@@ -1859,7 +1859,7 @@ int mnt_context_get_mount_excode(
        } else if (mnt_context_get_syscall_errno(cxt) == 0) {
                /*
                 * mount(2) syscall success, but something else failed
-                * (probably error in mtab processing).
+                * (probably error in utab processing).
                 */
                if (rc == -MNT_ERR_LOCK) {
                        if (buf)
index 9c6d190e1383091e9979cc97d081ab7bdc1d2494..1b0faf9e709f1c565b9c2fb52d6f9e0fa7697ff4 100644 (file)
 # define UMOUNT_UNUSED    0x80000000   /* Flag guaranteed to be unused */
 #endif
 
-/* search in mountinfo/mtab */
-static int __mtab_find_umount_fs(struct libmnt_context *cxt,
+/* search in mountinfo */
+static int __mountinfo_find_umount_fs(struct libmnt_context *cxt,
                            const char *tgt,
                            struct libmnt_fs **pfs)
 {
        int rc;
        struct libmnt_ns *ns_old;
-       struct libmnt_table *mtab = NULL;
+       struct libmnt_table *mountinfo = NULL;
        struct libmnt_fs *fs;
        char *loopdev = NULL;
 
@@ -69,29 +69,27 @@ static int __mtab_find_umount_fs(struct libmnt_context *cxt,
         *
         * The filter uses mnt_fs_streq_{target,srcpath} function where all
         * paths should be absolute and canonicalized. This is done within
-        * mnt_context_get_mtab_for_target() where LABEL, UUID or symlinks are
+        * mnt_context_get_mountinfo_for_target() where LABEL, UUID or symlinks are
         * canonicalized. If --no-canonicalize is enabled than the target path
         * is expected already canonical.
         *
         * Anyway it's better to read huge mount table than canonicalize target
         * paths. It means we use the filter only if --no-canonicalize enabled.
         *
-        * It also means that we have to read mount table from kernel
-        * (non-writable mtab).
+        * It also means that we have to read mount table from kernel.
         */
-       if (mnt_context_is_nocanonicalize(cxt) &&
-           !mnt_context_mtab_writable(cxt) && *tgt == '/')
-               rc = mnt_context_get_mtab_for_target(cxt, &mtab, tgt);
+       if (mnt_context_is_nocanonicalize(cxt) && *tgt == '/')
+               rc = mnt_context_get_mountinfo_for_target(cxt, &mountinfo, tgt);
        else
-               rc = mnt_context_get_mtab(cxt, &mtab);
+               rc = mnt_context_get_mountinfo(cxt, &mountinfo);
 
        if (rc) {
-               DBG(CXT, ul_debugobj(cxt, "umount: failed to read mtab"));
+               DBG(CXT, ul_debugobj(cxt, "umount: failed to read mountinfo"));
                return rc;
        }
 
-       if (mnt_table_get_nents(mtab) == 0) {
-               DBG(CXT, ul_debugobj(cxt, "umount: mtab empty"));
+       if (mnt_table_get_nents(mountinfo) == 0) {
+               DBG(CXT, ul_debugobj(cxt, "umount: mountinfo empty"));
                return 1;
        }
 
@@ -100,20 +98,20 @@ static int __mtab_find_umount_fs(struct libmnt_context *cxt,
                return -MNT_ERR_NAMESPACE;
 
 try_loopdev:
-       fs = mnt_table_find_target(mtab, tgt, MNT_ITER_BACKWARD);
+       fs = mnt_table_find_target(mountinfo, tgt, MNT_ITER_BACKWARD);
        if (!fs && mnt_context_is_swapmatch(cxt)) {
                /*
                 * Maybe the option is source rather than target (sometimes
                 * people use e.g. "umount /dev/sda1")
                 */
-               fs = mnt_table_find_source(mtab, tgt, MNT_ITER_BACKWARD);
+               fs = mnt_table_find_source(mountinfo, tgt, MNT_ITER_BACKWARD);
 
                if (fs) {
-                       struct libmnt_fs *fs1 = mnt_table_find_target(mtab,
+                       struct libmnt_fs *fs1 = mnt_table_find_target(mountinfo,
                                                        mnt_fs_get_target(fs),
                                                        MNT_ITER_BACKWARD);
                        if (!fs1) {
-                               DBG(CXT, ul_debugobj(cxt, "mtab is broken?!?!"));
+                               DBG(CXT, ul_debugobj(cxt, "mountinfo is broken?!?!"));
                                rc = -EINVAL;
                                goto err;
                        }
@@ -195,16 +193,16 @@ int mnt_context_find_umount_fs(struct libmnt_context *cxt,
 
        /* In future this function should be extended to support for example
         * fsinfo() (or another cheap way kernel will support), for now the
-        * default is expensive mountinfo/mtab.
+        * default is expensive mountinfo.
         */
-       return __mtab_find_umount_fs(cxt, tgt, pfs);
+       return __mountinfo_find_umount_fs(cxt, tgt, pfs);
 }
 
 /* Check if there is something important in the utab file. The parsed utab is
  * stored in context->utab and deallocated by mnt_free_context().
  *
  * This function exists to avoid (if possible) /proc/self/mountinfo usage, so
- * don't use things like mnt_resolve_target(), mnt_context_get_mtab() etc here.
+ * don't use things like mnt_resolve_target(), mnt_context_get_mountinfo() etc here.
  * See lookup_umount_fs() for more details.
  */
 static int has_utab_entry(struct libmnt_context *cxt, const char *target)
@@ -273,7 +271,6 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg
        if (mnt_context_is_restricted(cxt)
            || *tgt != '/'
            || (cxt->flags & MNT_FL_HELPER)
-           || mnt_context_mtab_writable(cxt)
            || mnt_context_is_force(cxt)
            || mnt_context_is_lazy(cxt)
            || mnt_context_is_nocanonicalize(cxt)
@@ -303,7 +300,7 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg
                }
        }
        if (type) {
-               DBG(CXT, ul_debugobj(cxt, "  umount: disabling mtab"));
+               DBG(CXT, ul_debugobj(cxt, "  umount: disabling mountinfo"));
                mnt_context_disable_mtab(cxt, TRUE);
 
                DBG(CXT, ul_debugobj(cxt,
@@ -326,7 +323,7 @@ static int lookup_umount_fs_by_mountinfo(struct libmnt_context *cxt, const char
        DBG(CXT, ul_debugobj(cxt, " lookup by mountinfo"));
 
        /* search */
-       rc = __mtab_find_umount_fs(cxt, tgt, &fs);
+       rc = __mountinfo_find_umount_fs(cxt, tgt, &fs);
        if (rc != 0)
                return rc;
 
@@ -339,7 +336,7 @@ static int lookup_umount_fs_by_mountinfo(struct libmnt_context *cxt, const char
                        DBG(CXT, ul_debugobj(cxt, "  failed to copy FS"));
                        return -errno;
                }
-               DBG(CXT, ul_debugobj(cxt, "  mtab applied"));
+               DBG(CXT, ul_debugobj(cxt, "  mountinfo applied"));
        }
 
        cxt->flags |= MNT_FL_TAB_APPLIED;
@@ -490,7 +487,7 @@ static int is_fuse_usermount(struct libmnt_context *cxt, int *errsv)
 }
 
 /*
- * Note that cxt->fs contains relevant mtab entry!
+ * Note that cxt->fs contains relevant mountinfo entry!
  */
 static int evaluate_permissions(struct libmnt_context *cxt)
 {
@@ -511,7 +508,7 @@ static int evaluate_permissions(struct libmnt_context *cxt)
 
        if (!mnt_context_tab_applied(cxt)) {
                DBG(CXT, ul_debugobj(cxt,
-                               "cannot find %s in mtab and you are not root",
+                               "cannot find %s in mountinfo and you are not root",
                                mnt_fs_get_target(cxt->fs)));
                goto eperm;
        }
@@ -562,13 +559,13 @@ static int evaluate_permissions(struct libmnt_context *cxt)
        if (!fs) {
                /*
                 * It's possible that there is /path/file.img in fstab and
-                * /dev/loop0 in mtab -- then we have to check the relation
+                * /dev/loop0 in mountinfo -- then we have to check the relation
                 * between loopdev and the file.
                 */
                fs = mnt_table_find_target(fstab, tgt, MNT_ITER_FORWARD);
                if (fs) {
                        struct libmnt_cache *cache = mnt_context_get_cache(cxt);
-                       const char *sp = mnt_fs_get_srcpath(cxt->fs);           /* devname from mtab */
+                       const char *sp = mnt_fs_get_srcpath(cxt->fs);           /* devname from mountinfo */
                        const char *dev = sp && cache ? mnt_resolve_path(sp, cache) : sp;
 
                        if (!dev || !is_associated_fs(dev, fs))
@@ -576,7 +573,7 @@ static int evaluate_permissions(struct libmnt_context *cxt)
                }
                if (!fs) {
                        DBG(CXT, ul_debugobj(cxt,
-                                       "umount %s: mtab disagrees with fstab",
+                                       "umount %s: mountinfo disagrees with fstab",
                                        tgt));
                        goto eperm;
                }
@@ -590,7 +587,7 @@ static int evaluate_permissions(struct libmnt_context *cxt)
         * this may be a security risk.
         *
         * The options `user', `owner' and `group' only allow unmounting by the
-        * user that mounted (visible in mtab).
+        * user that mounted (visible in mountinfo).
         */
        optstr = mnt_fs_get_user_options(fs);   /* FSTAB mount options! */
        if (!optstr)
@@ -606,18 +603,18 @@ static int evaluate_permissions(struct libmnt_context *cxt)
                return 0;
        }
        /*
-        * Check user=<username> setting from mtab if there is a user, owner or
+        * Check user=<username> setting from utab if there is a user, owner or
         * group option in /etc/fstab
         */
        if (u_flags & (MNT_MS_USER | MNT_MS_OWNER | MNT_MS_GROUP)) {
 
                char *curr_user;
-               char *mtab_user = NULL;
+               char *utab_user = NULL;
                size_t sz;
                struct libmnt_ns *ns_old;
 
                DBG(CXT, ul_debugobj(cxt,
-                               "umount: checking user=<username> from mtab"));
+                               "umount: checking user=<username> from mountinfo"));
 
                ns_old = mnt_context_switch_origin_ns(cxt);
                if (!ns_old)
@@ -635,11 +632,11 @@ static int evaluate_permissions(struct libmnt_context *cxt)
                        goto eperm;
                }
 
-               /* get options from mtab */
+               /* get options from utab */
                optstr = mnt_fs_get_user_options(cxt->fs);
                if (optstr && !mnt_optstr_get_option(optstr,
-                                       "user", &mtab_user, &sz) && sz)
-                       ok = !strncmp(curr_user, mtab_user, sz);
+                                       "user", &utab_user, &sz) && sz)
+                       ok = !strncmp(curr_user, utab_user, sz);
 
                free(curr_user);
        }
@@ -963,7 +960,7 @@ int mnt_context_prepare_umount(struct libmnt_context *cxt)
        }
 
        if (!rc && (cxt->user_mountflags & MNT_MS_LOOP))
-               /* loop option explicitly specified in mtab, detach this loop */
+               /* loop option explicitly specified in utab, detach this loop */
                mnt_context_enable_loopdel(cxt, TRUE);
 
        if (!rc && mnt_context_is_loopdel(cxt) && cxt->fs) {
@@ -1028,24 +1025,12 @@ int mnt_context_do_umount(struct libmnt_context *cxt)
                /*
                 * Umounted, do some post-umount operations
                 *      - remove loopdev
-                *      - refresh in-memory mtab stuff if remount rather than
+                *      - refresh in-memory utab stuff if remount rather than
                 *        umount has been performed
                 */
                if (mnt_context_is_loopdel(cxt)
                    && !(cxt->mountflags & MS_REMOUNT))
                        rc = mnt_context_delete_loopdev(cxt);
-
-               if (!mnt_context_is_nomtab(cxt)
-                   && mnt_context_get_status(cxt)
-                   && !cxt->helper
-                   && mnt_context_is_rdonly_umount(cxt)
-                   && (cxt->mountflags & MS_REMOUNT)) {
-
-                       /* use "remount" instead of "umount" in /etc/mtab */
-                       if (!rc && cxt->update && mnt_context_mtab_writable(cxt))
-                               rc = mnt_update_set_fs(cxt->update,
-                                                      cxt->mountflags, NULL, cxt->fs);
-               }
        }
 end:
        if (!mnt_context_switch_ns(cxt, ns_old))
@@ -1141,8 +1126,7 @@ int mnt_context_umount(struct libmnt_context *cxt)
  * @mntrc: returns the return code from mnt_context_umount()
  * @ignored: returns 1 for not matching
  *
- * This function tries to umount the next filesystem from mtab (as returned by
- * mnt_context_get_mtab()).
+ * This function tries to umount the next filesystem from mountinfo file.
  *
  * You can filter out filesystems by:
  *     mnt_context_set_options_pattern() to simulate umount -a -O pattern
@@ -1167,7 +1151,7 @@ int mnt_context_next_umount(struct libmnt_context *cxt,
                           int *mntrc,
                           int *ignored)
 {
-       struct libmnt_table *mtab;
+       struct libmnt_table *mountinfo;
        const char *tgt;
        int rc;
 
@@ -1179,17 +1163,17 @@ int mnt_context_next_umount(struct libmnt_context *cxt,
        if (!cxt || !fs || !itr)
                return -EINVAL;
 
-       rc = mnt_context_get_mtab(cxt, &mtab);
-       cxt->mtab = NULL;               /* do not reset mtab */
+       rc = mnt_context_get_mountinfo(cxt, &mountinfo);
+       cxt->mountinfo = NULL;          /* do not reset mountinfo */
        mnt_reset_context(cxt);
 
        if (rc)
                return rc;
 
-       cxt->mtab = mtab;
+       cxt->mountinfo = mountinfo;
 
        do {
-               rc = mnt_table_next_fs(mtab, itr, fs);
+               rc = mnt_table_next_fs(mountinfo, itr, fs);
                if (rc != 0)
                        return rc;      /* no more filesystems (or error) */
 
@@ -1247,7 +1231,7 @@ int mnt_context_get_umount_excode(
                 */
                if (rc == -EPERM && !mnt_context_tab_applied(cxt)) {
                        /* failed to evaluate permissions because not found
-                        * relevant entry in mtab */
+                        * relevant entry in mountinfo */
                        if (buf)
                                snprintf(buf, bufsz, _("not mounted"));
                        return MNT_EX_USAGE;
@@ -1270,7 +1254,7 @@ int mnt_context_get_umount_excode(
        } if (mnt_context_get_syscall_errno(cxt) == 0) {
                /*
                 * umount(2) syscall success, but something else failed
-                * (probably error in mtab processing).
+                * (probably error in utab processing).
                 */
                if (rc == -MNT_ERR_LOCK) {
                        if (buf)
index 898ee64fb3f2588b7e3bd3ae2f52ded5f070011b..180cfc862d2ee43492ba9b6fc91d0fa58e1801f7 100644 (file)
@@ -13,7 +13,7 @@
 /**
  * SECTION: fs
  * @title: Filesystem
- * @short_description: represents one entry from fstab, mtab, or mountinfo file
+ * @short_description: represents one entry from fstab, or mountinfo file
  *
  */
 #include <ctype.h>
index 0ab1d6ece7aee41d58c850a317f15d360a4b1dc2..2fb641d03a4efb9db72ed216ea912fee81b00e60 100644 (file)
@@ -55,7 +55,7 @@ struct libmnt_cache;
 /**
  * libmnt_lock:
  *
- * Stores information about the locked file (e.g. /etc/mtab)
+ * Stores information about the locked file
  */
 struct libmnt_lock;
 
@@ -92,21 +92,21 @@ struct libmnt_optmap
 /**
  * libmnt_fs:
  *
- * Parsed fstab/mtab/mountinfo entry
+ * Parsed fstab or mountinfo entry
  */
 struct libmnt_fs;
 
 /**
  * libmnt_table:
  *
- * List of struct libmnt_fs entries (parsed fstab/mtab/mountinfo)
+ * List of struct libmnt_fs entries (parsed fstab or mountinfo)
  */
 struct libmnt_table;
 
 /**
  * libmnt_update
  *
- * /etc/mtab or utab update description
+ * utab update description
  */
 struct libmnt_update;
 
@@ -205,7 +205,7 @@ enum {
 /**
  * MNT_ERR_LOCK:
  *
- * failed to lock mtab/utab or so.
+ * failed to lock utab or so.
  */
 #define MNT_ERR_LOCK         5008
 /**
@@ -277,7 +277,7 @@ enum {
 /**
  * MNT_EX_FILEIO:
  *
- * [u]mount(8) exit code: problems writing, locking, ... mtab/utab
+ * [u]mount(8) exit code: problems writing, locking, ... utab
  */
 #define MNT_EX_FILEIO  16
 
@@ -355,7 +355,7 @@ extern void mnt_ref_cache(struct libmnt_cache *cache);
 extern void mnt_unref_cache(struct libmnt_cache *cache);
 
 extern int mnt_cache_set_targets(struct libmnt_cache *cache,
-                               struct libmnt_table *mtab);
+                               struct libmnt_table *mountinfo);
 extern int mnt_cache_read_tags(struct libmnt_cache *cache, const char *devname);
 
 extern int mnt_cache_device_has_tag(struct libmnt_cache *cache,
@@ -699,19 +699,19 @@ extern int mnt_monitor_event_cleanup(struct libmnt_monitor *mn);
 /* context.c */
 
 /*
- * Mode for mount options from fstab (or mtab), see mnt_context_set_optsmode().
+ * Mode for mount options from fstab), see mnt_context_set_optsmode().
  */
 enum {
-       MNT_OMODE_IGNORE  = (1 << 1),   /* ignore mtab/fstab options */
-       MNT_OMODE_APPEND  = (1 << 2),   /* append mtab/fstab options to existing options */
-       MNT_OMODE_PREPEND = (1 << 3),   /* prepend mtab/fstab options to existing options */
+       MNT_OMODE_IGNORE  = (1 << 1),   /* ignore fstab options */
+       MNT_OMODE_APPEND  = (1 << 2),   /* append fstab options to existing options */
+       MNT_OMODE_PREPEND = (1 << 3),   /* prepend fstab options to existing options */
        MNT_OMODE_REPLACE = (1 << 4),   /* replace existing options with options from mtab/fstab */
 
-       MNT_OMODE_FORCE   = (1 << 5),   /* always read mtab/fstab options */
+       MNT_OMODE_FORCE   = (1 << 5),   /* always read fstab options */
 
        MNT_OMODE_FSTAB   = (1 << 10),  /* read from fstab */
-       MNT_OMODE_MTAB    = (1 << 11),  /* read from mtab if fstab not enabled or failed */
-       MNT_OMODE_NOTAB   = (1 << 12),  /* do not read fstab/mtab at all */
+       MNT_OMODE_MTAB    = (1 << 11),  /* read from mountinfo if fstab not enabled or failed */
+       MNT_OMODE_NOTAB   = (1 << 12),  /* do not read fstab at all */
 
        /* default */
        MNT_OMODE_AUTO   = (MNT_OMODE_PREPEND | MNT_OMODE_FSTAB | MNT_OMODE_MTAB),
index b8198c3dd2d8b3284e9a47a04c624a6b27ec43c6..b99fc4cc29d218dc6aad636c943e351cb2249148 100644 (file)
@@ -370,4 +370,5 @@ MOUNT_2_38 {
 MOUNT_2_39 {
        mnt_context_enable_onlyonce;
        mnt_context_is_lazy;
+       mnt_context_get_mountinfo_userdata;
 } MOUNT_2_38;
index 26158e8d948cc1e04bdcc4d01a2c8ba256ebf4d5..7a8ed0b863a7c73de8767a5d4401cc34fdef5671 100644 (file)
@@ -135,7 +135,7 @@ extern int mnt_table_set_parser_fltrcb(     struct libmnt_table *tb,
                                        int (*cb)(struct libmnt_fs *, void *),
                                        void *data);
 
-extern int __mnt_table_parse_mtab(struct libmnt_table *tb,
+extern int __mnt_table_parse_mountinfo(struct libmnt_table *tb,
                                        const char *filename,
                                        struct libmnt_table *u_tb);
 
@@ -176,7 +176,7 @@ struct libmnt_iter {
 
 
 /*
- * This struct represents one entry in a mtab/fstab/mountinfo file.
+ * This struct represents one entry in a fstab/mountinfo file.
  * (note that fstab[1] means the first column from fstab, and so on...)
  */
 struct libmnt_fs {
@@ -233,7 +233,7 @@ struct libmnt_fs {
 #define MNT_FS_MERGED  (1 << 5) /* already merged data from /run/mount/utab */
 
 /*
- * mtab/fstab/mountinfo file
+ * fstab/mountinfo file
  */
 struct libmnt_table {
        int             fmt;            /* MNT_FMT_* file format */
@@ -304,8 +304,8 @@ struct libmnt_context
        struct libmnt_fs *fs;           /* filesystem description (type, mountpoint, device, ...) */
        struct libmnt_fs *fs_template;  /* used for @fs on mnt_reset_context() */
 
-       struct libmnt_table *fstab;     /* fstab (or mtab for some remounts) entries */
-       struct libmnt_table *mtab;      /* mtab entries */
+       struct libmnt_table *fstab;     /* fstab entries */
+       struct libmnt_table *mountinfo; /* already mounted filesystems */
        struct libmnt_table *utab;      /* rarely used by umount only */
 
        int     (*table_errcb)(struct libmnt_table *tb, /* callback for libmnt_table structs */
@@ -328,11 +328,10 @@ struct libmnt_context
        struct list_head        addmounts;      /* additional mounts */
 
        struct libmnt_cache     *cache; /* paths cache */
-       struct libmnt_lock      *lock;  /* mtab lock */
-       struct libmnt_update    *update;/* mtab/utab update */
+       struct libmnt_lock      *lock;  /* utab lock */
+       struct libmnt_update    *update;/* utab update */
 
-       const char      *mtab_path; /* path to mtab */
-       int             mtab_writable; /* is mtab writable */
+       const char      *mountinfo_path; /* usualy /proc/self/moutinfo */
 
        const char      *utab_path; /* path to utab */
        int             utab_writable; /* is utab writable */
@@ -378,7 +377,7 @@ struct libmnt_context
 #define MNT_FL_ONLYONCE                (1 << 15)
 
 #define MNT_FL_MOUNTDATA       (1 << 20)
-#define MNT_FL_TAB_APPLIED     (1 << 21)       /* mtab/fstab merged to cxt->fs */
+#define MNT_FL_TAB_APPLIED     (1 << 21)       /* fstab merged to cxt->fs */
 #define MNT_FL_MOUNTFLAGS_MERGED (1 << 22)     /* MS_* flags was read from optstr */
 #define MNT_FL_SAVED_USER      (1 << 23)
 #define MNT_FL_PREPARED                (1 << 24)
@@ -415,8 +414,7 @@ extern int mnt_optstr_fix_secontext(char **optstr, char *value, size_t valsz, ch
 extern int mnt_optstr_fix_user(char **optstr);
 
 /* fs.c */
-extern struct libmnt_fs *mnt_copy_mtab_fs(const struct libmnt_fs *fs)
-                       __attribute__((nonnull));
+extern struct libmnt_fs *mnt_copy_mtab_fs(const struct libmnt_fs *fs);
 extern int __mnt_fs_set_source_ptr(struct libmnt_fs *fs, char *source)
                        __attribute__((nonnull(1)));
 extern int __mnt_fs_set_fstype_ptr(struct libmnt_fs *fs, char *fstype)
@@ -424,12 +422,12 @@ extern int __mnt_fs_set_fstype_ptr(struct libmnt_fs *fs, char *fstype)
 
 /* context.c */
 extern struct libmnt_context *mnt_copy_context(struct libmnt_context *o);
-extern int mnt_context_mtab_writable(struct libmnt_context *cxt);
 extern int mnt_context_utab_writable(struct libmnt_context *cxt);
 extern const char *mnt_context_get_writable_tabpath(struct libmnt_context *cxt);
 
-extern int mnt_context_get_mtab_for_target(struct libmnt_context *cxt,
-                                   struct libmnt_table **mtab, const char *tgt);
+extern int mnt_context_get_mountinfo(struct libmnt_context *cxt, struct libmnt_table **tb);
+extern int mnt_context_get_mountinfo_for_target(struct libmnt_context *cxt,
+                                   struct libmnt_table **mountinfo, const char *tgt);
 
 extern int mnt_context_prepare_srcpath(struct libmnt_context *cxt);
 extern int mnt_context_prepare_target(struct libmnt_context *cxt);
@@ -480,8 +478,7 @@ extern int mnt_context_setup_veritydev(struct libmnt_context *cxt);
 extern int mnt_context_deferred_delete_veritydev(struct libmnt_context *cxt);
 
 /* tab_update.c */
-extern int mnt_update_set_filename(struct libmnt_update *upd,
-                                  const char *filename, int userspace_only);
+extern int mnt_update_set_filename(struct libmnt_update *upd, const char *filename);
 extern int mnt_update_already_done(struct libmnt_update *upd,
                                   struct libmnt_lock *lc);
 
index e1e308dc51b57c5d4f1e8d0f736924c5fab2ae90..0133ff6185baff3d5a9321c8aa9c8b34502ac548 100644 (file)
@@ -2154,14 +2154,8 @@ static int test_is_mounted(struct libmnt_test *ts, int argc, char *argv[])
        struct libmnt_fs *fs;
        struct libmnt_iter *itr = NULL;
        struct libmnt_cache *mpc = NULL;
-       int writable = 0;
-       const char *path = NULL;
-
-       if (mnt_has_regular_mtab(&path, &writable) == 1 && writable == 0)
-               tb = mnt_new_table_from_file(path);
-       else
-               tb = mnt_new_table_from_file("/proc/self/mountinfo");
 
+       tb = mnt_new_table_from_file("/proc/self/mountinfo");
        if (!tb) {
                fprintf(stderr, "failed to parse mountinfo\n");
                return -1;
index c5de990414703e1db0e85cdde8903cf5314e9555..294771dd4e49e5792566c614ae23fb8c81b3276d 100644 (file)
@@ -28,7 +28,7 @@
 #include "strutils.h"
 
 struct libmnt_parser {
-       FILE    *f;             /* fstab, mtab, swaps or mountinfo ... */
+       FILE    *f;             /* fstab, swaps or mountinfo ... */
        const char *filename;   /* file name or NULL */
        char    *buf;           /* buffer (the current line content) */
        size_t  bufsiz;         /* size of the buffer */
@@ -455,7 +455,7 @@ static int guess_table_format(const char *line)
        if (strncmp(line, "Filename\t", 9) == 0)
                return MNT_FMT_SWAPS;
 
-       return MNT_FMT_FSTAB;           /* fstab, mtab or /proc/mounts */
+       return MNT_FMT_FSTAB;           /* fstab, or /proc/mounts */
 }
 
 static int is_comment_line(const char *line)
@@ -1161,7 +1161,7 @@ static struct libmnt_fs *mnt_table_merge_user_fs(struct libmnt_table *tb, struct
 
 /* default filename is /proc/self/mountinfo
  */
-int __mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename,
+int __mnt_table_parse_mountinfo(struct libmnt_table *tb, const char *filename,
                           struct libmnt_table *u_tb)
 {
        int rc = 0, priv_utab = 0;
@@ -1170,12 +1170,12 @@ int __mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename,
        assert(tb);
 
        if (filename)
-               DBG(TAB, ul_debugobj(tb, "%s requested as mtab", filename));
+               DBG(TAB, ul_debugobj(tb, "%s requested as mount table", filename));
 
        if (!filename || strcmp(filename, _PATH_PROC_MOUNTINFO) == 0) {
                filename = _PATH_PROC_MOUNTINFO;
                tb->fmt = MNT_FMT_MOUNTINFO;
-               DBG(TAB, ul_debugobj(tb, "mtab parse: #1 read mountinfo"));
+               DBG(TAB, ul_debugobj(tb, "mountinfo parse: #1 read mountinfo"));
        } else
                tb->fmt = MNT_FMT_GUESS;
 
@@ -1191,7 +1191,7 @@ int __mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename,
 
        if (!is_mountinfo(tb))
                return 0;
-       DBG(TAB, ul_debugobj(tb, "mtab parse: #2 read utab"));
+       DBG(TAB, ul_debugobj(tb, "mountinfo parse: #2 read utab"));
 
        if (mnt_table_get_nents(tb) == 0)
                return 0;                       /* empty, ignore utab */
@@ -1215,7 +1215,7 @@ int __mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename,
                priv_utab = 1;
        }
 
-       DBG(TAB, ul_debugobj(tb, "mtab parse: #3 merge utab"));
+       DBG(TAB, ul_debugobj(tb, "mountinfo parse: #3 merge utab"));
 
        if (rc == 0) {
                struct libmnt_fs *u_fs;
@@ -1242,8 +1242,8 @@ int __mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename,
  * mountinfo file then /run/mount/utabs is parsed too and both files are merged
  * to the one libmnt_table.
  *
- * If libmount is compiled with classic mtab file support, and the /etc/mtab is
- * a regular file then this file is parsed.
+ * The file /etc/mtab is no more used. The function uses "mtab" in the name for
+ * backward compatibility only.
  *
  * It's strongly recommended to use NULL as a @filename to keep code portable.
  *
@@ -1253,5 +1253,5 @@ int __mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename,
  */
 int mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename)
 {
-       return __mnt_table_parse_mtab(tb, filename, NULL);
+       return __mnt_table_parse_mountinfo(tb, filename, NULL);
 }
index 6e16cd165e2f7ef53c50a692d2d90a9b694f717b..b045b1dcb520cac4b1aad600a26f66ab52bb54d7 100644 (file)
  * @short_description: userspace mount information management
  *
  * The struct libmnt_update provides an abstraction to manage mount options in
- * userspace independently of system configuration. This low-level API works on
- * systems both with and without /etc/mtab. On systems without the regular /etc/mtab
- * file, the userspace mount options (e.g. user=) are stored in the /run/mount/utab
- * file.
+ * userspace independently of system configuration. The userspace mount options
+ * (e.g. user=) are stored in the /run/mount/utab file.
  *
  * It's recommended to use high-level struct libmnt_context API.
  */
@@ -37,7 +35,6 @@ struct libmnt_update {
        struct libmnt_fs *fs;
        char            *filename;
        unsigned long   mountflags;
-       int             userspace_only;
        int             ready;
 
        struct libmnt_table *mountinfo;
@@ -86,8 +83,7 @@ void mnt_free_update(struct libmnt_update *upd)
 /*
  * Returns 0 on success, <0 in case of error.
  */
-int mnt_update_set_filename(struct libmnt_update *upd, const char *filename,
-                           int userspace_only)
+int mnt_update_set_filename(struct libmnt_update *upd, const char *filename)
 {
        const char *path = NULL;
        int rw = 0;
@@ -101,7 +97,6 @@ int mnt_update_set_filename(struct libmnt_update *upd, const char *filename,
                if (!p)
                        return -ENOMEM;
 
-               upd->userspace_only = userspace_only;
                free(upd->filename);
                upd->filename = p;
        }
@@ -109,13 +104,12 @@ int mnt_update_set_filename(struct libmnt_update *upd, const char *filename,
        if (upd->filename)
                return 0;
 
-       /* detect tab filename -- /etc/mtab or /run/mount/utab
+       /* detect tab filename -- /run/mount/utab
         */
        path = NULL;
        mnt_has_regular_utab(&path, &rw);
        if (!rw)
                return -EACCES;
-       upd->userspace_only = TRUE;
        upd->filename = strdup(path);
        if (!upd->filename)
                return -ENOMEM;
@@ -127,7 +121,7 @@ int mnt_update_set_filename(struct libmnt_update *upd, const char *filename,
  * mnt_update_get_filename:
  * @upd: update
  *
- * This function returns the file name (e.g. /etc/mtab) of the up-dated file.
+ * This function returns the file name of the up-dated file.
  *
  * Returns: pointer to filename that will be updated or NULL in case of error.
  */
@@ -141,7 +135,7 @@ const char *mnt_update_get_filename(struct libmnt_update *upd)
  * @upd: update handler
  *
  * Returns: 1 if entry described by @upd is successfully prepared and will be
- * written to the mtab/utab file.
+ * written to the utab file.
  */
 int mnt_update_is_ready(struct libmnt_update *upd)
 {
@@ -189,7 +183,7 @@ int mnt_update_set_fs(struct libmnt_update *upd, unsigned long mountflags,
 
        upd->mountflags = mountflags;
 
-       rc = mnt_update_set_filename(upd, NULL, 0);
+       rc = mnt_update_set_filename(upd, NULL);
        if (rc) {
                DBG(UPDATE, ul_debugobj(upd, "no writable file available [rc=%d]", rc));
                return rc;      /* error or no file available (rc = 1) */
@@ -200,19 +194,17 @@ int mnt_update_set_fs(struct libmnt_update *upd, unsigned long mountflags,
                        return -ENOMEM;
 
        } else if (fs) {
-               if (upd->userspace_only && !(mountflags & MS_MOVE)) {
+               if (!(mountflags & MS_MOVE)) {
                        rc = utab_new_entry(upd, fs, mountflags);
                        if (rc)
-                               return rc;
+                              return rc;
                } else {
                        upd->fs = mnt_copy_mtab_fs(fs);
                        if (!upd->fs)
                                return -ENOMEM;
-
                }
        }
 
-
        DBG(UPDATE, ul_debugobj(upd, "ready"));
        upd->ready = TRUE;
        return 0;
@@ -259,19 +251,6 @@ int mnt_update_force_rdonly(struct libmnt_update *upd, int rdonly)
        if (!rdonly && !(upd->mountflags & MS_RDONLY))
                return 0;
 
-       if (!upd->userspace_only) {
-               /* /etc/mtab -- we care about VFS options there */
-               const char *o = mnt_fs_get_options(upd->fs);
-               char *n = o ? strdup(o) : NULL;
-
-               if (n)
-                       mnt_optstr_remove_option(&n, rdonly ? "rw" : "ro");
-               if (!mnt_optstr_prepend_option(&n, rdonly ? "ro" : "rw", NULL))
-                       rc = mnt_fs_set_options(upd->fs, n);
-
-               free(n);
-       }
-
        if (rdonly)
                upd->mountflags &= ~MS_RDONLY;
        else
@@ -531,10 +510,7 @@ static int update_table(struct libmnt_update *upd, struct libmnt_table *tb)
                        fputs(mnt_table_get_intro_comment(tb), f);
 
                while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
-                       if (upd->userspace_only)
-                               rc = fprintf_utab_fs(f, fs);
-                       else
-                               rc = fprintf_mtab_fs(f, fs);
+                       rc = fprintf_utab_fs(f, fs);
                        if (rc) {
                                DBG(UPDATE, ul_debugobj(upd,
                                        "%s: write entry failed: %m", uq));
@@ -700,8 +676,7 @@ static int update_add_entry(struct libmnt_update *upd, struct libmnt_lock *lc)
        if (rc)
                return -MNT_ERR_LOCK;
 
-       tb = __mnt_new_table_from_file(upd->filename,
-                       upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB, 1);
+       tb = __mnt_new_table_from_file(upd->filename, MNT_FMT_UTAB, 1);
        if (tb)
                rc = add_file_entry(tb, upd);
        if (lc)
@@ -726,8 +701,7 @@ static int update_remove_entry(struct libmnt_update *upd, struct libmnt_lock *lc
        if (rc)
                return -MNT_ERR_LOCK;
 
-       tb = __mnt_new_table_from_file(upd->filename,
-                       upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB, 1);
+       tb = __mnt_new_table_from_file(upd->filename, MNT_FMT_UTAB, 1);
        if (tb) {
                struct libmnt_fs *rem = mnt_table_find_target(tb, upd->target, MNT_ITER_BACKWARD);
                if (rem) {
@@ -755,8 +729,7 @@ static int update_modify_target(struct libmnt_update *upd, struct libmnt_lock *l
        if (rc)
                return -MNT_ERR_LOCK;
 
-       tb = __mnt_new_table_from_file(upd->filename,
-                       upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB, 1);
+       tb = __mnt_new_table_from_file(upd->filename, MNT_FMT_UTAB, 1);
        if (tb) {
                const char *upd_source = mnt_fs_get_srcpath(upd->fs);
                const char *upd_target = mnt_fs_get_target(upd->fs);
@@ -826,15 +799,13 @@ static int update_modify_options(struct libmnt_update *upd, struct libmnt_lock *
        if (rc)
                return -MNT_ERR_LOCK;
 
-       tb = __mnt_new_table_from_file(upd->filename,
-                       upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB, 1);
+       tb = __mnt_new_table_from_file(upd->filename, MNT_FMT_UTAB, 1);
        if (tb) {
                struct libmnt_fs *cur = mnt_table_find_target(tb,
                                        mnt_fs_get_target(fs),
                                        MNT_ITER_BACKWARD);
                if (cur) {
-                       if (upd->userspace_only)
-                               rc = mnt_fs_set_attributes(cur, mnt_fs_get_attributes(fs));
+                       rc = mnt_fs_set_attributes(cur, mnt_fs_get_attributes(fs));
                        if (!rc)
                                rc = mnt_fs_set_options(cur, mnt_fs_get_options(fs));
                        if (!rc)
@@ -883,7 +854,7 @@ int mnt_update_table(struct libmnt_update *upd, struct libmnt_lock *lc)
                if (lc)
                        mnt_lock_block_signals(lc, TRUE);
        }
-       if (lc && upd->userspace_only)
+       if (lc)
                mnt_lock_use_simplelock(lc, TRUE);      /* use flock */
 
        if (!upd->fs && upd->target)
@@ -919,7 +890,7 @@ int mnt_update_already_done(struct libmnt_update *upd, struct libmnt_lock *lc)
                if (lc)
                        mnt_lock_block_signals(lc, TRUE);
        }
-       if (lc && upd->userspace_only)
+       if (lc)
                mnt_lock_use_simplelock(lc, TRUE);      /* use flock */
        if (lc) {
                rc = mnt_lock_file(lc);
@@ -929,8 +900,7 @@ int mnt_update_already_done(struct libmnt_update *upd, struct libmnt_lock *lc)
                }
        }
 
-       tb = __mnt_new_table_from_file(upd->filename,
-                       upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB, 1);
+       tb = __mnt_new_table_from_file(upd->filename, MNT_FMT_UTAB, 1);
        if (lc)
                mnt_unlock_file(lc);
        if (!tb)
index e967b65f74ce9e14deeb687c6f7773027a6ad88b..5693cf8adf3f9cd408e6c595d462852c1cba139b 100644 (file)
@@ -844,52 +844,19 @@ static int try_write(const char *filename, const char *directory)
 
 /**
  * mnt_has_regular_mtab:
- * @mtab: returns path to mtab
- * @writable: returns 1 if the file is writable
+ * @mtab: returns NULL
+ * @writable: returns 0
  *
- * If the file does not exist and @writable argument is not NULL, then it will
- * try to create the file.
+ * Returns: 0
  *
- * Returns: 1 if /etc/mtab is a regular file, and 0 in case of error (check
- *          errno for more details).
+ * Deprecated: libmount does not use /etc/mtab at all since v2.39.
  */
 int mnt_has_regular_mtab(const char **mtab, int *writable)
 {
-       struct stat st;
-       int rc;
-       const char *filename = mtab && *mtab ? *mtab : mnt_get_mtab_path();
-
        if (writable)
                *writable = 0;
-       if (mtab && !*mtab)
-               *mtab = filename;
-
-       DBG(UTILS, ul_debug("mtab: %s", filename));
-
-       rc = lstat(filename, &st);
-
-       if (rc == 0) {
-               /* file exists */
-               if (S_ISREG(st.st_mode)) {
-                       if (writable)
-                               *writable = !try_write(filename, NULL);
-                       DBG(UTILS, ul_debug("%s: writable", filename));
-                       return 1;
-               }
-               goto done;
-       }
-
-       /* try to create the file */
-       if (writable) {
-               *writable = !try_write(filename, NULL);
-               if (*writable) {
-                       DBG(UTILS, ul_debug("%s: writable", filename));
-                       return 1;
-               }
-       }
-
-done:
-       DBG(UTILS, ul_debug("%s: irregular/non-writable", filename));
+       if (mtab)
+               *mtab = NULL;
        return 0;
 }
 
@@ -978,10 +945,13 @@ const char *mnt_get_fstab_path(void)
 /**
  * mnt_get_mtab_path:
  *
- * This function returns the *default* location of the mtab file. The result does
- * not have to be writable. See also mnt_has_regular_mtab().
+ * This function returns the *default* location of the mtab file.
+ *
  *
  * Returns: path to /etc/mtab or $LIBMOUNT_MTAB.
+ *
+ * Deprecated: libmount uses /proc/self/mountinfo only.
+ *
  */
 const char *mnt_get_mtab_path(void)
 {
index 5f0ddd05ba560497aa17dfdb5635ce8032623a77..eb8072b74361bec09f39dc97bdd42fed774e4c8c 100644 (file)
@@ -1516,9 +1516,6 @@ The command *mount* does not pass the mount options *unbindable*, *runbindable*,
 *LIBMOUNT_FSTAB*=<path>::
 overrides the default location of the _fstab_ file (ignored for suid)
 
-*LIBMOUNT_MTAB*=<path>::
-overrides the default location of the _mtab_ file (ignored for suid)
-
 *LIBMOUNT_DEBUG*=all::
 enables libmount debug output
 
index 9101ed891600c7b9d35358521a7aada94b979ae0..47011316b9871929ad12bb6afeed198727c207f3 100644 (file)
@@ -152,9 +152,6 @@ Note that _/etc/mtab_ is currently deprecated and *helper=* and other userspace
 *LIBMOUNT_FSTAB*=<path>::
 overrides the default location of the _fstab_ file (ignored for *suid*)
 
-*LIBMOUNT_MTAB*=<path>::
-overrides the default location of the _mtab_ file (ignored for *suid*)
-
 *LIBMOUNT_DEBUG*=all::
 enables *libmount* debug output
 
index 47a6769bef173e0a64c6b48b05b5a56b16ad13b6..a8a3d6bec9548d0b1affca68f071b60cf118fd84 100755 (executable)
@@ -55,10 +55,6 @@ mkfs.ext4 -L "$LABEL" -U "$UUID" $DEVICE &> /dev/null
 
 ts_log "Do tests..."
 
-export LIBMOUNT_MTAB=$TS_OUTPUT.mtab
-rm -f $LIBMOUNT_MTAB
-ln -s /proc/mounts $LIBMOUNT_MTAB
-
 export LIBMOUNT_UTAB=$TS_OUTPUT.utab
 rm -f $LIBMOUNT_UTAB
 > $LIBMOUNT_UTAB
index 94c9e5b9a3b1408a5d21211a3c6498d3283ef7e2..c47d13b42c242aa82032e43f857733dff1a54c0f 100755 (executable)
@@ -60,10 +60,6 @@ mkfs.ext4 -L "$LABEL" -U "$UUID" $DEVICE &> /dev/null
 
 ts_log "Do tests..."
 
-export LIBMOUNT_MTAB=$TS_OUTPUT.mtab
-rm -f $LIBMOUNT_MTAB
-ln -s /proc/mounts $LIBMOUNT_MTAB
-
 export LIBMOUNT_UTAB=$TS_OUTPUT.utab
 rm -f $LIBMOUNT_UTAB
 > $LIBMOUNT_UTAB