pub struct KdumpBuilder { /* private fields */ }Expand description
Build a synthetic kdump (makedumpfile) dump for testing.
Produces the disk_dump_header + kdump_sub_header + bitmaps + page
descriptors + compressed page data layout used by makedumpfile and
crash-utility.
File layout (block_size = 4096 by default):
- Block 0:
disk_dump_header - Block 1:
kdump_sub_header(mostly zeros for test) - Blocks 2..2+N: 1st bitmap (valid PFNs)
- Blocks 2+N..2+2N: 2nd bitmap (dumped PFNs)
- After bitmaps:
page_desc[]array (24 bytes each, block-aligned) - After descs: compressed page data
disk_dump_header (Block 0):
- 0x00: signature “KDUMP “ (8 bytes, 3 trailing spaces)
- 0x08: header_version = 6 (i32)
- 0x0C: utsname (390 bytes = 6 fields * 65, zeros)
- Aligned to 4 after utsname: block_size(i32) + sub_hdr_size(i32=1) + bitmap_blocks(u32) + max_mapnr(u32)
page_desc (24 bytes each):
- offset: i64 (file offset of compressed data)
- size: u32 (compressed size)
- flags: u32 (compression method)
- page_flags: u64 (kernel flags, 0 for test)
Implementations§
Source§impl KdumpBuilder
impl KdumpBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new builder with defaults: block_size=4096, compression=snappy (0x04).
Sourcepub fn block_size(self, bs: u32) -> Self
pub fn block_size(self, bs: u32) -> Self
Set the block size (must be a power of 2, typically 4096).
Sourcepub fn compression(self, flags: u32) -> Self
pub fn compression(self, flags: u32) -> Self
Set the compression flags for page data.
- 0x00: uncompressed
- 0x01: zlib
- 0x04: snappy
- 0x20: zstd (stored as minimal zstd frame)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KdumpBuilder
impl RefUnwindSafe for KdumpBuilder
impl Send for KdumpBuilder
impl Sync for KdumpBuilder
impl Unpin for KdumpBuilder
impl UnsafeUnpin for KdumpBuilder
impl UnwindSafe for KdumpBuilder
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