mirror of
https://github.com/opnsense/src.git
synced 2026-03-03 13:51:30 -05:00
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:
parent
9ad42ab594
commit
ce5c49f1aa
1 changed files with 10 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue