Commit 2768ceb7 authored by Pádraig Brady's avatar Pádraig Brady

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.
parent ff138525
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
......@@ -183,10 +183,9 @@
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment