bug-coreutils
[Top][All Lists]
Advanced

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

Re: df enhancment for removable media


From: Paul Eggert
Subject: Re: df enhancment for removable media
Date: Tue, 20 Sep 2005 13:12:46 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Juergen Weigert <address@hidden> writes:

> On a recent SUSE Linux df became unreliable for e.g. USB-drives.
> This is because hald automatically mounts and unmounts such drives
> as they are accessed.
>
> Usually I get something like:
>
> $ df /media/USB_DISK
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/sda1                    0         0         0   -  /media/USB_DISK
>
> only if the USB_DISK is being accessed, I get the expected output.

Thanks for reporting the issue.

> A simple enhancement for df is to actively access the USB_DISK while running
> statfs(). I've added an opendir() call in the attached patch.

Wouldn't open() suffice?  That would be simpler.

Unless I'm missing something I'd rather not change the default behavor
of df, as that would be a compatibility hassle.  That is, df shouldn't
attempt to mount file systems by default; it should do so only if the
user asks, with a new option.

Also, the main fix needs to be in fsusage.c, not df.c.  If the new
option is in effect, fsusage.c should attempt to open() the file, then
use fstatfs on the result; it should fall back on statfs if the open
fails.  This will require a new boolean option to get_fs_usage, which
asks it to use open/fstatfs rather than statfs (and similarly for the
other hosts, e.g., use fstatvfs rather than statvfs).

Finally, we'd need copyright papers from you to accept such a patch;
I assume this is OK?




reply via email to

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