vfs: open() for pty halves
This commit is contained in:
parent
9b07dd7c6b
commit
8dbbc07ff6
@ -172,6 +172,22 @@ impl File {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn open_pty_master(pty: Arc<PseudoTerminalMaster>, node: Arc<Node>) -> Arc<Self> {
|
||||||
|
Arc::new(Self::PtyMaster(TerminalHalfWrapper {
|
||||||
|
blocking: AtomicBool::new(true),
|
||||||
|
half: pty,
|
||||||
|
node,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn open_pty_slave(pty: Arc<PseudoTerminalSlave>, node: Arc<Node>) -> Arc<Self> {
|
||||||
|
Arc::new(Self::PtySlave(TerminalHalfWrapper {
|
||||||
|
blocking: AtomicBool::new(true),
|
||||||
|
half: pty,
|
||||||
|
node,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
/// Creates a new [TimerFile]-backed File
|
/// Creates a new [TimerFile]-backed File
|
||||||
pub fn new_timer(options: TimerOptions) -> FileRef {
|
pub fn new_timer(options: TimerOptions) -> FileRef {
|
||||||
let repeat = options.contains(TimerOptions::REPEAT);
|
let repeat = options.contains(TimerOptions::REPEAT);
|
||||||
|
@ -40,7 +40,14 @@ impl Node {
|
|||||||
// TODO: maybe merge open_directory and open?
|
// TODO: maybe merge open_directory and open?
|
||||||
NodeImpl::Directory(_) => Err(Error::IsADirectory),
|
NodeImpl::Directory(_) => Err(Error::IsADirectory),
|
||||||
NodeImpl::Symlink(_) => todo!(),
|
NodeImpl::Symlink(_) => todo!(),
|
||||||
NodeImpl::PseudoTerminalSlave(_) | NodeImpl::PseudoTerminalMaster(_) => todo!(),
|
NodeImpl::PseudoTerminalSlave(pty) => {
|
||||||
|
let pty = pty.upgrade().ok_or(Error::DoesNotExist)?;
|
||||||
|
Ok(File::open_pty_slave(pty, self.clone()))
|
||||||
|
}
|
||||||
|
NodeImpl::PseudoTerminalMaster(pty) => {
|
||||||
|
let pty = pty.upgrade().ok_or(Error::DoesNotExist)?;
|
||||||
|
Ok(File::open_pty_master(pty, self.clone()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user