Merge fixes for dbtob() and btodb() from alpha/include/param.h. This stops

ffs_snapshot() from using negative numbers for byte offsets in large file
systems.
This commit is contained in:
Doug Rabson 2002-04-06 12:55:48 +00:00
parent 9ad42ab594
commit ce5c49f1aa

View file

@ -185,9 +185,16 @@
#define ctob(x) ((x) << PAGE_SHIFT)
#define btoc(x) (((x) + PAGE_MASK) >> PAGE_SHIFT)
/* bytes to disk blocks */
#define btodb(x) ((x) >> DEV_BSHIFT)
#define dbtob(x) ((x) << DEV_BSHIFT)
/*
* btodb() is messy and perhaps slow because `bytes' may be an off_t. We
* want to shift an unsigned type to avoid sign extension and we don't
* want to widen `bytes' unnecessarily. Assume that the result fits in
* a daddr_t.
*/
#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
(daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)
#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
((off_t)(db) << DEV_BSHIFT)
/*
* Mach derived conversion macros