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: Juergen Weigert
Subject: Re: df enhancment for removable media
Date: Tue, 20 Sep 2005 22:54:38 +0200

On Sep 20, 05 13:12:46 -0700, Paul Eggert wrote:
> 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.

I chose opendir(), because I am not sure if all systems allow open() on a
directory node. Otherwise I'd also favour open(), it has no issue with 
getting a header file for dirent/direct, or whatever the directory structure 
may be called.

> 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.

These hald mounts are different. For almost every aspect such a device
appears to be mounted. So I figured, df should also pretend the 
device is mounted.

> 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. 

Looks ugly in df.c, right. But in fsusage.c we'd have to place the 
new code in multiple implementations. Ugly too.

> 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?
Sure. 
Is it sufficient to abondon copyright, 
or do you want to have it?

        thanks,
                Jw.

-- 
 o \  Juergen Weigert  paint it green! __/ _=======.=======_
<V> | address@hidden       wide open suse_/        _---|____________\/
 \  | 0911 74053-508         (tm)__/          (____/            /\
(/) | __________________________/             _/ \_ vim:set sw=2 wm=8




reply via email to

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