From b78e048cf75976bdefb9dc45cb7fee701f1d349c Mon Sep 17 00:00:00 2001 From: millert Date: Fri, 24 Mar 2000 19:07:48 +0000 Subject: [PATCH] Make f_bsize signed. Having it unsigned causes surprising (and unwanted) type coercions. With this fixed I can back out the hack in df. --- bin/df/df.c | 6 +++--- lib/libc/sys/getfsstat.2 | 4 ++-- lib/libc/sys/statfs.2 | 4 ++-- sys/sys/mount.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/df/df.c b/bin/df/df.c index 4f6e39dc99d..818e66d9a87 100644 --- a/bin/df/df.c +++ b/bin/df/df.c @@ -1,4 +1,4 @@ -/* $OpenBSD: df.c,v 1.25 1999/12/31 05:00:04 millert Exp $ */ +/* $OpenBSD: df.c,v 1.26 2000/03/24 19:07:49 millert Exp $ */ /* $NetBSD: df.c,v 1.21.2.1 1995/11/01 00:06:11 jtc Exp $ */ /* @@ -49,7 +49,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: df.c,v 1.25 1999/12/31 05:00:04 millert Exp $"; +static char rcsid[] = "$OpenBSD: df.c,v 1.26 2000/03/24 19:07:49 millert Exp $"; #endif #endif /* not lint */ @@ -382,7 +382,7 @@ prtstat(sfsp, maxwidth, headerlen, blocksize) (void)printf(" %*u %8u %8d", headerlen, fsbtoblk(sfsp->f_blocks, sfsp->f_bsize, blocksize), fsbtoblk(used, sfsp->f_bsize, blocksize), - fsbtoblk(sfsp->f_bavail, (int)sfsp->f_bsize, blocksize)); + fsbtoblk(sfsp->f_bavail, sfsp->f_bsize, blocksize)); (void)printf(" %5.0f%%", availblks == 0 ? 100.0 : (double)used / (double)availblks * 100.0); if (iflag) { diff --git a/lib/libc/sys/getfsstat.2 b/lib/libc/sys/getfsstat.2 index ef0285afa62..69a872d9d17 100644 --- a/lib/libc/sys/getfsstat.2 +++ b/lib/libc/sys/getfsstat.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: getfsstat.2,v 1.11 1999/12/31 03:43:23 millert Exp $ +.\" $OpenBSD: getfsstat.2,v 1.12 2000/03/24 19:07:49 millert Exp $ .\" $NetBSD: getfsstat.2,v 1.6 1995/06/29 11:40:44 cgd Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 @@ -60,7 +60,7 @@ typedef struct { int32_t val[2]; } fsid_t; struct statfs { u_int32_t f_flags; /* copy of mount flags */ - u_int32_t f_bsize; /* fundamental file system block size */ + int32_t f_bsize; /* fundamental file system block size */ u_int32_t f_iosize; /* optimal transfer block size */ u_int32_t f_blocks; /* total data blocks in file system */ u_int32_t f_bfree; /* free blocks in fs */ diff --git a/lib/libc/sys/statfs.2 b/lib/libc/sys/statfs.2 index f579c674ef6..9ac4c675eb3 100644 --- a/lib/libc/sys/statfs.2 +++ b/lib/libc/sys/statfs.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: statfs.2,v 1.12 1999/12/31 03:43:24 millert Exp $ +.\" $OpenBSD: statfs.2,v 1.13 2000/03/24 19:07:49 millert Exp $ .\" $NetBSD: statfs.2,v 1.10 1995/06/29 11:40:48 cgd Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 @@ -64,7 +64,7 @@ typedef struct { int32_t val[2]; } fsid_t; struct statfs { u_int32_t f_flags; /* copy of mount flags */ - u_int32_t f_bsize; /* fundamental file system block size */ + int32_t f_bsize; /* fundamental file system block size */ u_int32_t f_iosize; /* optimal transfer block size */ u_int32_t f_blocks; /* total data blocks in file system */ u_int32_t f_bfree; /* free blocks in fs */ diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 82402282fce..b19e00e30d3 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mount.h,v 1.34 2000/02/09 10:29:56 assar Exp $ */ +/* $OpenBSD: mount.h,v 1.35 2000/03/24 19:07:48 millert Exp $ */ /* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */ /* @@ -255,7 +255,7 @@ union mount_info { /* new statfs structure with mount options */ struct statfs { u_int32_t f_flags; /* copy of mount flags */ - u_int32_t f_bsize; /* fundamental file system block size */ + int32_t f_bsize; /* fundamental file system block size */ u_int32_t f_iosize; /* optimal transfer block size */ u_int32_t f_blocks; /* total data blocks in file system */ u_int32_t f_bfree; /* free blocks in fs */ -- 2.20.1