forked from AbleOS/ableos
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.
This commit is contained in:
parent
cdb6632f98
commit
2a163a55ee
|
@ -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!()
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ where
|
|||
Self: Send,
|
||||
{
|
||||
fn open(&self, node: &FsNode /* TODO: flags */) -> Result<FileDescriptor>;
|
||||
fn close(&self, node: &FsNode) -> Result<()>;
|
||||
fn release(&self, node: &FsNode) -> Result<()>;
|
||||
fn read(&self, node: &FsNode, offset: usize, size: usize) -> Result<Box<[u8]>>;
|
||||
fn write(&self, node: &FsNode, offset: usize, buffer: Box<[u8]>) -> Result<()>;
|
||||
fn read_dir(&self, node: &FsNode, index: usize) -> Result<DirectoryEntry>;
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue