1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! An experimental, read-only APFS container and volume reader.
//!
//! The API is outside the Hadris 2.x stability promise and may change in a
//! minor release. Compressed files, encryption, snapshots and writes are not
//! supported; see the README for the full scope.
//!
//! On-disk structures live in [`types`]. The readers in the `sync` and
//! `async` modules walk them over a `hadris-storage` block device.
//!
//! ```rust,no_run
//! use std::fs::File;
//!
//! use hadris_apfs::sync::Container;
//! use hadris_storage::sync::SeekBlockDevice;
//! use hadris_storage::{BlockCount, BlockGeometry, BlockSize};
//!
//! let file = File::open("container.img")?;
//! let sectors = file.metadata()?.len() / 512;
//! let geometry = BlockGeometry::new(BlockSize::new(512).unwrap(), BlockCount(sectors));
//! let mut container = Container::open(SeekBlockDevice::new(file, geometry))?;
//! let latest = container.latest_superblock()?;
//! for volume in container.volume_superblocks(&latest)? {
//! if let Some(entry) = container.resolve_path(&volume, "/notes.txt")? {
//! let data = container.read_file(&volume, entry.file_id, 1 << 20)?;
//! println!("{}: {} bytes", volume.name()?, data.len());
//! }
//! }
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
extern crate alloc;
extern crate std;
/// Error types returned by APFS readers and writers.
pub use ;