remove open() & close() from INode

master
WangRunji 6 years ago
parent d75aab77d6
commit 1fbda15575

@ -248,13 +248,6 @@ impl INodeImpl {
} }
impl vfs::INode for INodeImpl { impl vfs::INode for INodeImpl {
fn open(&self, _flags: u32) -> vfs::Result<()> {
// Do nothing
Ok(())
}
fn close(&self) -> vfs::Result<()> {
self.sync()
}
fn read_at(&self, offset: usize, buf: &mut [u8]) -> vfs::Result<usize> { fn read_at(&self, offset: usize, buf: &mut [u8]) -> vfs::Result<usize> {
assert_eq!(self.disk_inode.read().type_, FileType::File, "read_at is only available on file"); assert_eq!(self.disk_inode.read().type_, FileType::File, "read_at is only available on file");
self._read_at(offset, buf) self._read_at(offset, buf)

@ -11,8 +11,6 @@ pub trait Device: Send {
/// Abstract operations on a inode. /// Abstract operations on a inode.
pub trait INode: Debug + Any + Sync + Send { pub trait INode: Debug + Any + Sync + Send {
fn open(&self, flags: u32) -> Result<()>;
fn close(&self) -> Result<()>;
fn read_at(&self, offset: usize, buf: &mut [u8]) -> Result<usize>; fn read_at(&self, offset: usize, buf: &mut [u8]) -> Result<usize>;
fn write_at(&self, offset: usize, buf: &[u8]) -> Result<usize>; fn write_at(&self, offset: usize, buf: &[u8]) -> Result<usize>;
fn info(&self) -> Result<FileInfo>; fn info(&self) -> Result<FileInfo>;

Loading…
Cancel
Save