]> Savannah Git Hosting - gnulib.git/commitdiff
mountlist: don't use libmount to decide on dummy/remote
authorPádraig Brady <P@draigBrady.com>
Thu, 30 Oct 2014 04:08:50 +0000 (04:08 +0000)
committerPádraig Brady <P@draigBrady.com>
Thu, 30 Oct 2014 09:33:23 +0000 (09:33 +0000)
* lib/mountlist.c (read_file_system_list): Don't use the libmount
routines to determine whether a file system is dummy or remote,
as they're not currently compatible.  For example the remoteness
is determined on file system type (for which the list seems incomplete),
rather than simply checking for a ':' in the device name.
Also libmount currently determines that 'tmpfs' is a dummy file system
even though it has associated storage.

ChangeLog
lib/mountlist.c

index 93c95dc95aa501f4d04c0d7d31e7291222f8c266..0d6c28552b2a9ff235c4d1c04cde444124866327 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-10-30  Pádraig Brady  <P@draigBrady.com>
+
+       mountlist: don't use libmount to decide on dummy/remote
+       * lib/mountlist.c (read_file_system_list): Don't use the libmount
+       routines to determine whether a file system is dummy or remote,
+       as they're not currently compatible.  For example the remoteness
+       is determined on file system type (for which the list seems incomplete),
+       rather than simply checking for a ':' in the device name.
+       Also libmount currently determines that 'tmpfs' is a dummy file system
+       even though it has associated storage.
+
 2014-10-29  Paul Eggert  <eggert@cs.ucla.edu>
 
        obstack: prefer __alignof__ to alignof
index 84dc2c8cc0749697fb77769fd0813d989919bcd2..a91dcaeb3d8e2591414f0a4e89fc859e3ca28a77 100644 (file)
    we grant an exception to any with "bind" in its list of mount options.
    I.e., those are *not* dummy entries.  */
 #ifdef MOUNTED_GETMNTENT1
-# define ME_DUMMY(Fs_name, Fs_type, Fs_ent)    \
+# define ME_DUMMY(Fs_name, Fs_type, Bind)      \
   (ME_DUMMY_0 (Fs_name, Fs_type)               \
-   || (strcmp (Fs_type, "none") == 0           \
-       && !hasmntopt (Fs_ent, "bind")))
+   || (strcmp (Fs_type, "none") == 0 && !Bind))
 #else
 # define ME_DUMMY(Fs_name, Fs_type)            \
   (ME_DUMMY_0 (Fs_name, Fs_type) || strcmp (Fs_type, "none") == 0)
@@ -456,8 +455,14 @@ read_file_system_list (bool need_fs_type)
             me->me_type = xstrdup (mnt_fs_get_fstype (fs));
             me->me_type_malloced = 1;
             me->me_dev = mnt_fs_get_devno (fs);
-            me->me_dummy = mnt_fs_is_pseudofs (fs);
-            me->me_remote = mnt_fs_is_netfs (fs);
+            /* Note we don't use mnt_fs_is_pseudofs() or mnt_fs_is_netfs() here
+               as libmount's classification is non-compatible currently.
+               Also we pass "false" for the "Bind" option as that's only
+               significant when the Fs_type is "none" which will not be
+               the case when parsing "/proc/self/mountinfo", and only
+               applies for static /etc/mtab files.  */
+            me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, false);
+            me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
 
             /* Add to the linked list. */
             *mtail = me;
@@ -480,12 +485,14 @@ read_file_system_list (bool need_fs_type)
 
         while ((mnt = getmntent (fp)))
           {
+            bool bind = hasmntopt (mnt, "bind");
+
             me = xmalloc (sizeof *me);
             me->me_devname = xstrdup (mnt->mnt_fsname);
             me->me_mountdir = xstrdup (mnt->mnt_dir);
             me->me_type = xstrdup (mnt->mnt_type);
             me->me_type_malloced = 1;
-            me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, mnt);
+            me->me_dummy = ME_DUMMY (me->me_devname, me->me_type, bind);
             me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
             me->me_dev = dev_from_mount_options (mnt->mnt_opts);