df: prefer fullpath entries when deduplicating
authorOndrej Oprala <ooprala@redhat.com>
Fri, 25 Jan 2013 00:07:58 +0000 (01:07 +0100)
committerBernhard Voelker <mail@bernhard-voelker.de>
Sun, 27 Jan 2013 17:43:58 +0000 (18:43 +0100)
commitbb116d35bf6248d803826fb582a141d02a311e71
tree5186358b5ea10623b24de996abac81a329e1043d
parentf8c0258d4643dbabc461a84d0b940be44a680a9b
df: prefer fullpath entries when deduplicating

* src/df.c (struct devlist): Add a new element for storing
pointers to mount_entry structures.
(devlist_head, dev_examined): Remove.
(filter_mount_list): Add new function to filter out the rootfs
entry (unless -trootfs is specified), and duplicities. The
function favors entries with a '/' character in me_devname
or those with the shortest me_mountdir string, if multiple
entries fulfill the first condition.
Use struct devlist to build up a list of entries already known,
and finally rebuild the global mount_list.
(get_all_entries): Call the above new function unless the -a
option is specified.
(get_dev): Remove the code for skipping rootfs and duplicities.
* tests/df/skip-duplicates.sh: Add test cases.

Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
src/df.c
tests/df/skip-duplicates.sh