pub(super) struct L2Table {
cluster: Option<HostCluster>,
data: Box<[AtomicL2Entry]>,
cluster_bits: u32,
external_data_file: bool,
modified: AtomicBool,
writer_lock: Mutex<()>,
}
Expand description
L2 table.
Fields§
§cluster: Option<HostCluster>
Cluster of the L2 table.
data: Box<[AtomicL2Entry]>
Table data.
cluster_bits: u32
log2 of the cluster size.
external_data_file: bool
Whether this image uses an external data file.
modified: AtomicBool
Whether this table has been modified since it was last written.
writer_lock: Mutex<()>
Lock for creating L2TableWriteGuard
.
Implementations§
Source§impl L2Table
impl L2Table
Sourcepub fn new_cleared(header: &Header) -> Self
pub fn new_cleared(header: &Header) -> Self
Create a new zeroed L2 table.
Sourcepub fn get_mapping(&self, lookup_cluster: GuestCluster) -> Result<L2Mapping>
pub fn get_mapping(&self, lookup_cluster: GuestCluster) -> Result<L2Mapping>
Look up a cluster mapping.
Sourcepub async fn lock_write(&self) -> L2TableWriteGuard<'_>
pub async fn lock_write(&self) -> L2TableWriteGuard<'_>
Allow modifying this L2 table.
Note that readers are allowed to exist while modifications are happening.
Trait Implementations§
Source§impl Table for L2Table
impl Table for L2Table
Source§const MAX_ENTRIES: usize = 262_144usize
const MAX_ENTRIES: usize = 262_144usize
Maximum allowable number of entries.
Source§type InternalEntry = AtomicL2Entry
type InternalEntry = AtomicL2Entry
Internal type for each table entry.
Source§fn from_data(data: Box<[AtomicL2Entry]>, header: &Header) -> Self
fn from_data(data: Box<[AtomicL2Entry]>, header: &Header) -> Self
Create a new table with the given contents
Source§fn get_cluster(&self) -> Option<HostCluster>
fn get_cluster(&self) -> Option<HostCluster>
Get this table’s (first) cluster in the image file.
Source§fn get_offset(&self) -> Option<HostOffset>
fn get_offset(&self) -> Option<HostOffset>
Get this table’s offset in the image file.
Source§fn set_cluster(&mut self, cluster: HostCluster)
fn set_cluster(&mut self, cluster: HostCluster)
Set this table’s (first) cluster in the image file (for writing).
Source§fn unset_cluster(&mut self)
fn unset_cluster(&mut self)
Remove the table’s association with any cluster in the image file.
Source§fn is_modified(&self) -> bool
fn is_modified(&self) -> bool
Check whether this table has been modified since it was last written.
Source§fn clear_modified(&self)
fn clear_modified(&self)
Clear the modified flag.
Source§fn set_modified(&self)
fn set_modified(&self)
Set the modified flag.
Source§fn cluster_bits(&self) -> u32
fn cluster_bits(&self) -> u32
Return log2 of the cluster size. Read more
Source§fn cluster_count(&self) -> ClusterCount
fn cluster_count(&self) -> ClusterCount
Number of clusters used by this table.
Source§async fn load<S: Storage>(
image: &S,
header: &Header,
cluster: HostCluster,
entries: usize,
) -> Result<Self>
async fn load<S: Storage>( image: &S, header: &Header, cluster: HostCluster, entries: usize, ) -> Result<Self>
Load a table from the image file.
Auto Trait Implementations§
impl !Freeze for L2Table
impl !RefUnwindSafe for L2Table
impl Send for L2Table
impl Sync for L2Table
impl Unpin for L2Table
impl UnwindSafe for L2Table
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more