From 2a163a55ee90c0fb7cc1336d8a4129d9f46bfcd6 Mon Sep 17 00:00:00 2001 From: TheOddGarlic Date: Wed, 3 Aug 2022 21:17:28 +0300 Subject: [PATCH] vfs: rename FsNode::close() to FsNode::release() FsNode::close() will instead become a method that takes a closes a file descriptor, while release() will close the whole VFS node. --- ableos/src/filesystem/ext2.rs | 2 +- ableos/src/filesystem/mod.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ableos/src/filesystem/ext2.rs b/ableos/src/filesystem/ext2.rs index 1430d2a0..9277b87a 100644 --- a/ableos/src/filesystem/ext2.rs +++ b/ableos/src/filesystem/ext2.rs @@ -45,7 +45,7 @@ where Ok(FileDescriptor::new(node.flags, inode.size(), node.inode)) } - fn close(&self, node: &super::FsNode) -> Result<()> { + fn release(&self, node: &super::FsNode) -> Result<()> { todo!() } diff --git a/ableos/src/filesystem/mod.rs b/ableos/src/filesystem/mod.rs index 2217d192..7bd17554 100644 --- a/ableos/src/filesystem/mod.rs +++ b/ableos/src/filesystem/mod.rs @@ -22,7 +22,7 @@ where Self: Send, { fn open(&self, node: &FsNode /* TODO: flags */) -> Result; - fn close(&self, node: &FsNode) -> Result<()>; + fn release(&self, node: &FsNode) -> Result<()>; fn read(&self, node: &FsNode, offset: usize, size: usize) -> Result>; fn write(&self, node: &FsNode, offset: usize, buffer: Box<[u8]>) -> Result<()>; fn read_dir(&self, node: &FsNode, index: usize) -> Result; @@ -79,13 +79,13 @@ impl FsNode { /// This method is for closing the VFS node, which is done when no open file /// descriptors for this file are left. - pub fn close(&self) -> Result<()> { + pub fn release(&self) -> Result<()> { let state = KERNEL_STATE.lock(); let device = state .get_storage_device(self.device_handle) .ok_or_else(|| FsError::InvalidDevice)?; - device.close(self) + device.release(self) } /// This method reads from the VFS node without opening a new file