Skip to main content

Module align

Module align 

Source
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§

AlignedBuf
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 value up to the next multiple of align (which must be a power of two).