base: apply Red Bear patches on latest upstream/main
251 files: init, acpid, ipcd, netcfg, ihdgd, virtio-gpud, scheme-utils, inputd, block driver, ptyd, ramfs, randd, initfs bootstrap, path deps, version +rb0.3.1, author attribution
This commit is contained in:
+5
-3
@@ -216,6 +216,9 @@ impl<'initfs> InitFs<'initfs> {
|
||||
|
||||
Ok(this)
|
||||
}
|
||||
pub fn image_creation_time(&self) -> Timespec {
|
||||
self.get_header_assume_valid().creation_time
|
||||
}
|
||||
fn get_header_assume_valid(&self) -> &Header {
|
||||
plain::from_bytes::<Header>(&self.base[..core::mem::size_of::<Header>()])
|
||||
.expect("expected header type to require no alignment, and size to be sufficient")
|
||||
@@ -265,9 +268,8 @@ impl<'initfs> InitFs<'initfs> {
|
||||
plain::slice_from_bytes::<InodeHeader>(inode_table_bytes)
|
||||
.expect("expected inode struct alignment to be 1")
|
||||
}
|
||||
pub fn root_inode(&self) -> Inode {
|
||||
Inode(self.get_header_assume_valid().root_inode.get())
|
||||
}
|
||||
pub const ROOT_INODE: Inode = Inode(0);
|
||||
|
||||
pub fn all_inodes(&self) -> impl Iterator<Item = Inode> {
|
||||
(0..self.inode_count()).map(Inode)
|
||||
}
|
||||
|
||||
+10
-3
@@ -53,16 +53,23 @@ pub struct Offset(pub U32);
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Length(pub U32);
|
||||
|
||||
#[repr(C, packed)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Timespec {
|
||||
pub sec: U64,
|
||||
pub nsec: U32,
|
||||
}
|
||||
|
||||
#[repr(C, packed)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Header {
|
||||
pub magic: Magic,
|
||||
pub inode_table_offset: Offset,
|
||||
pub initfs_size: U64,
|
||||
pub page_size: U16,
|
||||
pub root_inode: U16,
|
||||
pub creation_time: Timespec,
|
||||
pub inode_count: U16,
|
||||
pub bootstrap_entry: U64,
|
||||
pub initfs_size: U64,
|
||||
pub page_size: U16,
|
||||
}
|
||||
|
||||
const _: () = {
|
||||
|
||||
Reference in New Issue
Block a user