pub mod extent {
pub use crate::extent::{
ExtentNodeBlock, MAX_EXTENT_DEPTH, MAX_EXTENT_LEN, TreeShape, build_leaves, build_tree,
node_capacity, parse_node, plan_tree, tail_offset, write_node,
};
}
pub mod feature {
pub use crate::feature::LARGE_FILE_MIN_SIZE;
}
pub mod geometry {
pub use crate::geometry::{MAX_32BIT_BLOCKS, MAX_EXTENT_BLOCKS};
}
pub mod hash {
pub use crate::hash::dir_hash;
}
pub mod journal {
pub use crate::journal::{
JBD2_MAGIC, JBD2_SUPERBLOCK_V2, MIN_JOURNAL_BLOCKS, build_superblock,
default_journal_blocks,
};
}
pub mod model {
pub use crate::model::{
Content, DirChild, FIRST_USER_INO, LOST_FOUND_INO, ModelInode, ROOT_INO,
};
}
pub mod ondisk {
pub use crate::ondisk::{
BG_BLOCK_UNINIT, BG_INODE_UNINIT, BG_INODE_ZEROED, DIR_TAIL_LEN, DX_CHECKSUM_OFFSET,
DX_ENTRY_LEN, DX_HASH_CONTINUED, DX_MAX_INDIRECT_LEVELS, DX_NODE_COUNT_OFFSET,
DX_ROOT_COUNT_OFFSET, DX_TAIL_LEN, DirEntry, DxEntry, EXTENT_ENTRY_SIZE, EXTENT_MAGIC,
EXTENT_TAIL_LEN, ExtentHeader, ExtentIdx, ExtentLeaf, FileType, GOOD_OLD_FIRST_INODE,
GOOD_OLD_INODE_SIZE, GroupDescriptor, Inode, InodeFlags, ORPHAN_BLOCK_MAGIC,
ORPHAN_TAIL_LEN, ROOT_INODE_MODE, STATE_CLEAN, STATE_ERRORS, SUPERBLOCK_MAGIC, SuperBlock,
TIME_SECS_MAX, TIME_SECS_MIN, decode_acl, decode_time, dx_limit, dx_tail_offset,
encode_acl, encode_time, extra_isize_for, min_rec_len, orphan_entries_len,
orphan_tail_bytes, read_dx_countlimit, read_dx_entries, read_dx_root_info,
read_orphan_tail, rec_len_from_disk, rec_len_to_disk, superblock_checksum,
time_is_representable, unpadded, write_dir_tail, write_dx_entries, write_dx_node_header,
write_dx_root_header, write_dx_tail,
};
}
pub mod read {
pub use crate::read::MIN_DIRENT_LEN;
}
pub use crate::alloc::{AllocError, Allocator};
pub use crate::csum::{Checksummer, Crc32c, CsumScheme, NullCsum};
pub use crate::dir::{DirBlock, DirBlockKind, DirError, DirLayout, HtreeDir, LinearDir};
pub use crate::extent::{ExtentError, ExtentNode, ExtentTree};
pub use crate::feature::{Compat, FeatureError, FeatureSet, Incompat, Profile, RoCompat};
pub use crate::geometry::{
BlockRange, GeometryError, GroupLayout, GrowReservation, InodeCount, Layout, PlanRequest,
ReservedRatio, plan_layout,
};
pub use crate::hash::{DirHash, HashSignedness, HashVersion};
pub use crate::identity::{
IdentityChange, IdentityError, IdentityReport, rewrite_identity, rewrite_identity_at,
};
pub use crate::journal::{JournalParams, JournalSize, JournalSuperblock};
pub use crate::materialize::{
ErrorBehavior, FormatError, FormatOptions, FormatPlan, Image, format, format_to,
};
pub use crate::model::{FsModel, ModelConfig, ModelError, build_model};
pub use crate::ondisk::ParseError;
pub use crate::read::{
Anomaly, Category, Entry, JournalReplay, Location, OpenOptions, ReadError, Reader, ScanReport,
WalkEntry, incompat_name, ro_compat_name,
};
pub use crate::acl::{Acl, AclEntry, AclError, AclQualifier};
pub use crate::finding::{Coordinate, Family, Finding, FindingReport, Severity};
pub use crate::policy::{Limits, ReadPolicy};
pub use crate::source::{
EntryKind, FileContent, FileRange, LayeredSource, Metadata, RemovalError, Source, SourceEntry,
TreeBuilder,
};
pub use crate::time::Timestamp;
pub use crate::xattr::Xattr;
#[must_use]
pub fn ext4(uuid: [u8; 16], time: Timestamp, hash_seed: [u8; 16]) -> FormatOptions {
FormatOptions::new(uuid, time, hash_seed).profile(Profile::Ext4)
}
#[must_use]
pub fn ext3(uuid: [u8; 16], time: Timestamp, hash_seed: [u8; 16]) -> FormatOptions {
FormatOptions::new(uuid, time, hash_seed).profile(Profile::Ext3)
}
#[must_use]
pub fn ext2(uuid: [u8; 16], time: Timestamp, hash_seed: [u8; 16]) -> FormatOptions {
FormatOptions::new(uuid, time, hash_seed).profile(Profile::Ext2)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn the_family_constructors_seed_the_matching_baseline() {
let time = Timestamp::from_secs(1_700_000_000);
assert_eq!(ext4([1; 16], time, [0; 16]).feature, FeatureSet::DEFAULT);
assert_eq!(ext3([1; 16], time, [0; 16]).feature, FeatureSet::EXT3);
assert_eq!(ext2([1; 16], time, [0; 16]).feature, FeatureSet::EXT2);
let opts = ext4([9; 16], time, [3; 16]);
assert_eq!(opts.uuid, [9; 16]);
assert_eq!(opts.hash_seed, [3; 16]);
}
}