# HG changeset patch # User Pádraig Brady # Date 1414642130 0 # Node ID f8a2b0c3de246d47292de97f6e788f94f22cb25d # Parent 4761a2b66270e574b3aa06d1ad56e341d2cbc673 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. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2014-10-30 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. + 2014-10-29 Paul Eggert obstack: prefer __alignof__ to alignof diff --git a/lib/mountlist.c b/lib/mountlist.c --- a/lib/mountlist.c +++ b/lib/mountlist.c @@ -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 @@ 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 @@ 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);