diff options
author | grog <grog@FreeBSD.org> | 2012-11-16 03:33:34 +0000 |
---|---|---|
committer | grog <grog@FreeBSD.org> | 2012-11-16 03:33:34 +0000 |
commit | 5de282f23da3bf379edbf238f017a8d0682cc278 (patch) | |
tree | f4d2e82722242289392cb7b3e93430d388b6cb9f /bin/df/df.c | |
parent | 2a4b9075dfd29011c27d8771d1fc86677c04e9fd (diff) | |
download | FreeBSD-src-5de282f23da3bf379edbf238f017a8d0682cc278.zip FreeBSD-src-5de282f23da3bf379edbf238f017a8d0682cc278.tar.gz |
Update man pages and clarify a number of options.
Rework block count calculations to work correctly with small "block" sizes.
MFC after: 14 days
Diffstat (limited to 'bin/df/df.c')
-rw-r--r-- | bin/df/df.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/df/df.c b/bin/df/df.c index 851c758..3058da0 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -393,16 +393,11 @@ prthumanvalinode(int64_t bytes) /* * Convert statfs returned file system size into BLOCKSIZE units. - * Attempts to avoid overflow for large file systems. */ static intmax_t fsbtoblk(int64_t num, uint64_t fsbs, u_long bs) { - - if (fsbs != 0 && fsbs < bs) - return (num / (intmax_t)(bs / fsbs)); - else - return (num * (intmax_t)(fsbs / bs)); + return (num * (intmax_t) fsbs / bs); } /* @@ -453,6 +448,12 @@ prtstat(struct statfs *sfsp, struct maxwidths *mwp) } (void)printf(" Mounted on\n"); } + /* Check for 0 block size. Can this happen? */ + if (sfsp->f_bsize == 0) { + warnx ("File system %s does not have a block size, assuming 512.", + sfsp->f_mntonname); + sfsp->f_bsize = 512; + } (void)printf("%-*s", mwp->mntfrom, sfsp->f_mntfromname); if (Tflag) (void)printf(" %-*s", mwp->fstype, sfsp->f_fstypename); |