mirror of
https://gitlab.redox-os.org/redox-os/redox.git
synced 2026-06-21 04:14:17 +08:00
Add dup to ahci disk scheme
This commit is contained in:
parent
86487793b8
commit
b79c69cbfc
@ -43,6 +43,15 @@ impl Scheme for DiskScheme {
|
||||
}
|
||||
}
|
||||
|
||||
fn dup(&self, id: usize) -> Result<usize> {
|
||||
let mut handles = self.handles.lock();
|
||||
let mut handle = handles.get_mut(&id).ok_or(Error::new(EBADF))?;
|
||||
|
||||
let new_id = self.next_id.fetch_add(1, Ordering::SeqCst);
|
||||
self.handles.lock().insert(new_id, handle.clone());
|
||||
Ok(new_id)
|
||||
}
|
||||
|
||||
fn read(&self, id: usize, buf: &mut [u8]) -> Result<usize> {
|
||||
let mut handles = self.handles.lock();
|
||||
let mut handle = handles.get_mut(&id).ok_or(Error::new(EBADF))?;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user