Skip to main content

JournalHeader

Struct JournalHeader 

Source
pub struct JournalHeader {
    pub endian: JournalEndian,
    pub magic: u32,
    pub start: u64,
    pub end: u64,
    pub size: u64,
    pub blhdr_size: u32,
    pub checksum: u32,
    pub jhdr_size: u32,
    pub sequence_num: u32,
}
Expand description

The journal header at JournalInfoBlock.offset (struct journal_header). All multi-byte fields use endian.

Fields§

§endian: JournalEndian§magic: u32§start: u64

Byte offset (relative to the journal device base = jib.offset) of the first live transaction.

§end: u64

Byte offset of the first free byte. start == end means empty/clean.

§size: u64

Journal size in bytes (matches JournalInfoBlock.size).

§blhdr_size: u32

Size of each block_list_header region (data follows it).

§checksum: u32§jhdr_size: u32

Journal header block size, and the unit binfo.bnum is multiplied by.

§sequence_num: u32

Implementations§

Source§

impl JournalHeader

Source

pub fn parse(data: &[u8]) -> Result<Self, JournalError>

Parse the journal header, auto-detecting byte order from endian.

Source

pub fn is_empty(&self) -> bool

True when the journal has no pending transactions.

Source

pub fn serialize(&self, original: Option<&[u8]>) -> Vec<u8> ⓘ

Serialize the header back into a jhdr_size-byte block, recomputing the checksum. The bytes past the fixed header are preserved from original when supplied (so we don’t clobber any vendor padding macOS wrote).

Trait Implementations§

Source§

impl Clone for JournalHeader

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JournalHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.