[storage] Introduce storage_units and migrate Fxfs Introduce the storage_units crate (//src/storage/lib/units) to represent power-of-two block sizes and system page sizes as zero-cost typed abstractions (GenericBlockSize, ValueBlockSize, and PAGE_SIZE). Block sizes are guaranteed to be powers of two, replacing expensive 64-bit integer division and modulo operations with single-cycle bit shifts and masks. Standard arithmetic, comparison, and formatting traits are implemented, along with overflow-safe alignment helpers (align_up, align_down, align_up_to_blocks, and is_aligned). On Fuchsia, PAGE_SIZE caches the system page mask using an atomic to avoid repeated zx::system_get_page_size() calls. Migrate Fxfs to use BlockSize and PAGE_SIZE across the filesystem. TAG: agy Change-Id: I99fcec912f96284a4834277e9c0a3db17996bdf5 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1807218 Reviewed-by: Chris Suter <csuter@google.com> Commit-Queue: Chris Drouillard <cdrllrd@google.com>
Fuchsia is an open source, general purpose operating system supporting modern 64-bit Intel and ARM processors.
We expect everyone interacting with our project to respect our code of conduct.
Read more about Fuchsia's principles.
See Getting Started.
See fuchsia.dev.