update update_global
method on Ext2
This commit is contained in:
parent
fb1b5bdef5
commit
1415941a96
29
src/fs.rs
29
src/fs.rs
|
@ -1,3 +1,4 @@
|
||||||
|
use core::mem;
|
||||||
use alloc::Vec;
|
use alloc::Vec;
|
||||||
|
|
||||||
use error::Error;
|
use error::Error;
|
||||||
|
@ -53,13 +54,27 @@ where
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&mut self) -> Result<(), Error> {
|
pub fn update_global(&mut self) -> Result<(), Error> {
|
||||||
let slice = BufferSlice::from_cast(
|
// superblock
|
||||||
&self.superblock.inner,
|
{
|
||||||
self.superblock.offset,
|
let slice = BufferSlice::from_cast(
|
||||||
);
|
&self.superblock.inner,
|
||||||
let commit = slice.commit();
|
self.superblock.offset,
|
||||||
self.buffer.commit(commit).map_err(|err| Error::from(err))
|
);
|
||||||
|
let commit = slice.commit();
|
||||||
|
self.buffer.commit(commit).map_err(|err| Error::from(err))?;
|
||||||
|
}
|
||||||
|
|
||||||
|
// block group descriptors
|
||||||
|
let mut offset = self.block_groups.offset;
|
||||||
|
for descr in &self.block_groups.inner {
|
||||||
|
let slice = BufferSlice::from_cast(descr, offset);
|
||||||
|
let commit = slice.commit();
|
||||||
|
self.buffer.commit(commit).map_err(|err| Error::from(err))?;
|
||||||
|
offset += mem::size_of::<BlockGroupDescriptor>();
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn superblock(&self) -> &Superblock {
|
fn superblock(&self) -> &Superblock {
|
||||||
|
|
Reference in a new issue