Expand description
O_DIRECT alignment utilities.
O_DIRECT requires that:
- The file offset is aligned to the logical block size (typically 512 or 4096).
- The memory buffer address is aligned to the logical block size.
- The I/O size is a multiple of the logical block size.
This module provides an aligned buffer type that satisfies these constraints.
Structs§
- Aligned
Buf - An aligned byte buffer suitable for O_DIRECT I/O.
Constants§
- DEFAULT_
ALIGNMENT - Default alignment for O_DIRECT I/O (4 KiB).
Functions§
- is_
aligned - Check if a value is aligned to the given alignment.
- round_
up - Round
valueup to the next multiple ofalign(which must be a power of two).