update update_global method on Ext2

This commit is contained in:
Szymon Walter 2018-03-19 19:41:45 +01:00
parent fb1b5bdef5
commit 1415941a96

View file

@ -1,3 +1,4 @@
use core::mem;
use alloc::Vec;
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(
&self.superblock.inner,
self.superblock.offset,
);
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 {