On Wed, 2014-08-27 at 17:02 +0100, Pádraig Brady wrote: > On 08/27/2014 04:13 PM, Fridolin Pokorny wrote: > > diff --git a/src/df.c b/src/df.c > > index e907b94..156c7c1 100644 > > --- a/src/df.c > > +++ b/src/df.c > > @@ -622,11 +622,11 @@ filter_mount_list (bool devices_only) > > struct devlist *devlist; > > struct mount_entry *discard_me = NULL; > > > > - /* TODO: On Linux we might avoid this stat() and another in get_dev() > > - by using the device IDs available from /proc/self/mountinfo. > > - read_file_system_list() could populate me_dev from those > > - for efficiency and accuracy. */ > > +#ifdef _linux_ > > + if (me->me_dev == (dev_t) -1 && stat (me->me_mountdir, &buf) == -1) > > +#else > > if (-1 == stat (me->me_mountdir, &buf)) > > +#endif > > Do we need the ifdef at all? > Won't me_dev be -1 or valid?
I wasn't sure about this; I don't know why testing for me_dev == -1 wasn't already covered. This forced to call stat() even when me_dev was set from dev_from_mount_options() in gnulib on non-Linux systems (or specific calls on BeOS/Ultrix). These ifdefs should be removed in my opinion. If ifdefs will be removed, this patch has nothing to do with mountinfo on Linux. It simply lets me_dev to be populated from gnulib, if any, or it tries to find some using stat() (which might not be always correct in chroot). Have a nice day! Fridolin Pokorny.
