diff options
author | gpalmer <gpalmer@FreeBSD.org> | 1995-02-19 10:36:17 +0000 |
---|---|---|
committer | gpalmer <gpalmer@FreeBSD.org> | 1995-02-19 10:36:17 +0000 |
commit | 982d50d0ee738f45f783f9040411adf28d9effd1 (patch) | |
tree | a4e46422d971a227221a9f70a1c3bca14e2fa129 /sys | |
parent | 7d9397ef5d751669e648efc981bda8a37dccfe5c (diff) | |
download | FreeBSD-src-982d50d0ee738f45f783f9040411adf28d9effd1.zip FreeBSD-src-982d50d0ee738f45f783f9040411adf28d9effd1.tar.gz |
Bruces fixes for large filesystems
Submitted by: Bruce Evans <bde@zeta.org.au>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/i386/include/param.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index a127d5f..ed5f67f 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)param.h 5.8 (Berkeley) 6/28/91 - * $Id: param.h,v 1.16 1994/09/18 22:05:22 bde Exp $ + * $Id: param.h,v 1.17 1995/01/23 19:21:49 davidg Exp $ */ #ifndef _MACHINE_PARAM_H_ @@ -134,18 +134,18 @@ /* bytes to clicks */ #define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT) -#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ - ((unsigned)(bytes) >> DEV_BSHIFT) -#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ - ((unsigned)(db) << DEV_BSHIFT) - /* - * Map a ``block device block'' to a file system block. - * This should be device dependent, and will be if we - * add an entry to cdevsw/bdevsw for that purpose. - * For now though just use DEV_BSIZE. + * This is messy and perhaps slow because `bytes' may be an off_t. We + * have to shift an unsigned type to avoid sign extension and we don't + * want to widen `bytes' unnecessarily. Assume that off_t is long long + * and daddr_t is unsigned long. */ -#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) +#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ + (sizeof (bytes) > sizeof(long) \ + ? (unsigned long)((unsigned long long)(bytes) >> DEV_BSHIFT) \ + : (unsigned long)((unsigned long)(bytes) >> DEV_BSHIFT)) +#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ + ((unsigned long long)(db) << DEV_BSHIFT) /* * Mach derived conversion macros |