Merge close and on_close scheme calls

This commit is contained in:
bjorn3
2025-07-05 16:59:08 +02:00
parent 48ad866d02
commit 7a440bcd67
3 changed files with 5 additions and 11 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ impl FileDescription {
.ok_or(Error::new(EBADF))?
.clone();
scheme.on_close(self.number)
scheme.close(self.number)
}
}
-3
View File
@@ -484,9 +484,6 @@ pub trait KernelScheme: Send + Sync + 'static {
fn close(&self, id: usize) -> Result<()> {
Ok(())
}
fn on_close(&self, id: usize) -> Result<()> {
self.close(id)
}
fn kcall(
&self,
id: usize,
+4 -7
View File
@@ -1494,15 +1494,12 @@ impl KernelScheme for UserScheme {
Ok(())
}
fn close(&self, file: usize) -> Result<()> {
let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?;
inner.call(Opcode::Close, [file], &mut PageSpan::empty())?;
Ok(())
}
fn on_close(&self, id: usize) -> Result<()> {
fn close(&self, id: usize) -> Result<()> {
let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?;
if !inner.supports_on_close {
return self.close(id);
let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?;
inner.call(Opcode::Close, [id], &mut PageSpan::empty())?;
return Ok(());
}
inner.todo.send(Sqe {