diff options
author | Pádraig Brady <P@draigBrady.com> | 2014-10-29 02:49:17 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-11-24 09:04:54 +0000 |
commit | 2e81e62243409c5c574b899f52b08c000e4d99fd (patch) | |
tree | fc5f35aeb4f13cb23d94e0364f01e5c066205a2f /src | |
parent | 3ab3c7bb24b86ef2d2fede9fe26e3ee585db5411 (diff) | |
download | coreutils-2e81e62243409c5c574b899f52b08c000e4d99fd.tar.xz |
df: only suppress remote mounts of separate exports with --total
* src/df.c (filter_mount_list): Separate remote locations are
generally explicitly mounted, so list each even if they share
the same remote device and thus storage. However with --total
keep the suppression to give a more accurate value for the
total storage available.
(usage): Expand on the new implications of --total and move
it in the options list according to alphabetic order.
doc/coreutils.texi (df invocation): Mention that --total impacts
on deduplication of remote file systems and also move location
according to alphabetic order.
* tests/df/skip-duplicates.sh: Add remote test cases.
* NEWS: Mention the change in behavior.
Reported in http://bugs.debian.org/737399
Reported in http://bugzilla.redhat.com/920806
Reported in http://bugzilla.opensuse.org/866010
Reported in http://bugzilla.opensuse.org/901905
Diffstat (limited to 'src')
-rw-r--r-- | src/df.c | 41 |
1 files changed, 28 insertions, 13 deletions
@@ -640,18 +640,28 @@ filter_mount_list (bool devices_only) if (devlist) { - /* let "real" devices with '/' in the name win. */ - if ((strchr (me->me_devname, '/') - && ! strchr (devlist->me->me_devname, '/')) - /* let a shorter mountdir win. */ - || (strlen (devlist->me->me_mountdir) - > strlen (me->me_mountdir)) - /* let an entry overmounted on a different device win... */ - || (! STREQ (devlist->me->me_devname, me->me_devname) - /* ... but only when matching an existing mount point, to - avoid problematic replacement when given inaccurate mount - lists, seen with some chroot environments for example. */ - && STREQ (me->me_mountdir, devlist->me->me_mountdir))) + if (! print_grand_total && me->me_remote && devlist->me->me_remote + && ! STREQ (devlist->me->me_devname, me->me_devname)) + { + /* Don't discard remote entries with different locations, + as these are more likely to be explicitly mounted. + However avoid this when producing a total to give + a more accurate value in that case. */ + } + else if ((strchr (me->me_devname, '/') + /* let "real" devices with '/' in the name win. */ + && ! strchr (devlist->me->me_devname, '/')) + /* let a shorter mountdir win. */ + || (strlen (devlist->me->me_mountdir) + > strlen (me->me_mountdir)) + /* let an entry overmounted on a new device win... */ + || (! STREQ (devlist->me->me_devname, me->me_devname) + /* ... but only when matching an existing mnt point, + to avoid problematic replacement when given + inaccurate mount lists, seen with some chroot + environments for example. */ + && STREQ (me->me_mountdir, + devlist->me->me_mountdir))) { /* Discard mount entry for existing device. */ discard_me = devlist->me; @@ -1403,7 +1413,6 @@ or all file systems by default.\n\ -B, --block-size=SIZE scale sizes by SIZE before printing them; e.g.,\n\ '-BM' prints sizes in units of 1,048,576 bytes;\n\ see SIZE format below\n\ - --total produce a grand total\n\ -h, --human-readable print sizes in powers of 1024 (e.g., 1023M)\n\ -H, --si print sizes in powers of 1000 (e.g., 1.1G)\n\ "), stdout); @@ -1419,6 +1428,12 @@ or all file systems by default.\n\ or print all fields if FIELD_LIST is omitted.\n\ -P, --portability use the POSIX output format\n\ --sync invoke sync before getting usage info\n\ +"), stdout); + fputs (_("\ + --total elide all entries insignificant to available space,\n\ + and produce a grand total\n\ +"), stdout); + fputs (_("\ -t, --type=TYPE limit listing to file systems of type TYPE\n\ -T, --print-type print file system type\n\ -x, --exclude-type=TYPE limit listing to file systems not of type TYPE\n\ |