NetBSD-Bugs archive

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

Re: bin/41541: df -P is broken on netbsd-5



The following reply was made to PR bin/41541; it has been noted by GNATS.

From: Michael van Elst <mlelstv%serpens.de@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/41541: df -P is broken on netbsd-5
Date: Thu, 4 Jun 2009 21:53:34 +0200

 lguillaume%berklee.edu@localhost writes:
 >      
 >The df -P command is broken. For example, on this system:
 
 >  $ df -Pk /
 >  Filesystem 1024-blocks Used Available Capacity Mounted on
 >  /dev/wd0a 4068920 953824 2911656 24% /
 
 >  $ df -k /
 >  Filesystem   1K-blocks       Used      Avail %Cap Mounted on
 >  /dev/wd0a        508615     119228     363957  24% /
 
 See that the -P numbers are just multiplied by 8.
 
 >This problem does not happen on a netbsd-4 machine.
 
 The output of -P shows block counts scaled by f_bsize (block size) instead
 of f_frsize (fundamental block size). However, the block counts are
 defines as '(in units of f_frsize)'.
 
 It also ignores reserved blocks.
 
 
 This should fix both issues.
 
 Index: df.c
 ===================================================================
 RCS file: /cvsroot/src/bin/df/df.c,v
 retrieving revision 1.83
 diff -u -r1.83 df.c
 --- df.c       20 Jul 2008 00:52:39 -0000      1.83
 +++ df.c       4 Jun 2009 19:33:20 -0000
 @@ -473,9 +473,9 @@
                 */
                (void)printf("%s %" PRId64 " %" PRId64 " %" PRId64 " %s %s\n",
                    sfsp->f_mntfromname,
 -                  fsbtoblk(sfsp->f_blocks, sfsp->f_bsize, blocksize),
 -                  fsbtoblk(used, sfsp->f_bsize, blocksize),
 -                  fsbtoblk(sfsp->f_bavail, sfsp->f_bsize, blocksize),
 +                  fsbtoblk(sfsp->f_blocks, sfsp->f_frsize, blocksize),
 +                  fsbtoblk(used, sfsp->f_frsize, blocksize),
 +                  fsbtoblk(bavail, sfsp->f_frsize, blocksize),
                    availblks == 0 ? full : strpct64((uint64_t) used,
                    (uint64_t) availblks, 0), sfsp->f_mntonname);
                /*
 
 -- 
                                 Michael van Elst
 Internet: mlelstv%serpens.de@localhost
                                 "A potential Snark may lurk in every tree."
 


Home | Main Index | Thread Index | Old Index