update update_global
method on Ext2
This commit is contained in:
parent
fb1b5bdef5
commit
1415941a96
19
src/fs.rs
19
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> {
|
||||||
|
// superblock
|
||||||
|
{
|
||||||
let slice = BufferSlice::from_cast(
|
let slice = BufferSlice::from_cast(
|
||||||
&self.superblock.inner,
|
&self.superblock.inner,
|
||||||
self.superblock.offset,
|
self.superblock.offset,
|
||||||
);
|
);
|
||||||
let commit = slice.commit();
|
let commit = slice.commit();
|
||||||
self.buffer.commit(commit).map_err(|err| Error::from(err))
|
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