coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: df: use mountinfo from /proc on Linux


From: Pádraig Brady
Subject: Re: df: use mountinfo from /proc on Linux
Date: Wed, 27 Aug 2014 17:02:19 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

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?

Also this should include a test that sets up some
loopback mounts in a chroot to demonstrate the
functionality difference.

thanks!
Pádraig.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]