实现pty,附带测试程序 (#685)

* 实现pty,附带测试程序

* fmt ** clippy

* 将file层的锁粒度缩小,从而不使用no_preempt。更改pipe在sleep部分的bug

* 修复拼写错误
This commit is contained in:
GnoCiYeH
2024-04-05 00:21:55 +08:00
committed by GitHub
parent b8ed38251d
commit dfe53cf087
49 changed files with 1691 additions and 384 deletions

View File

@ -383,11 +383,15 @@ impl DeviceINode for FbDevice {
}
impl IndexNode for FbDevice {
fn open(&self, _data: &mut FilePrivateData, _mode: &FileMode) -> Result<(), SystemError> {
fn open(
&self,
_data: SpinLockGuard<FilePrivateData>,
_mode: &FileMode,
) -> Result<(), SystemError> {
Ok(())
}
fn close(&self, _data: &mut FilePrivateData) -> Result<(), SystemError> {
fn close(&self, _data: SpinLockGuard<FilePrivateData>) -> Result<(), SystemError> {
Ok(())
}
fn read_at(
@ -395,7 +399,7 @@ impl IndexNode for FbDevice {
offset: usize,
len: usize,
buf: &mut [u8],
_data: &mut FilePrivateData,
_data: SpinLockGuard<FilePrivateData>,
) -> Result<usize, SystemError> {
let fb = self.inner.lock().fb.upgrade().unwrap();
return fb.fb_read(&mut buf[0..len], offset);
@ -406,7 +410,7 @@ impl IndexNode for FbDevice {
offset: usize,
len: usize,
buf: &[u8],
_data: &mut FilePrivateData,
_data: SpinLockGuard<FilePrivateData>,
) -> Result<usize, SystemError> {
let fb = self.inner.lock().fb.upgrade().unwrap();
return fb.fb_write(&buf[0..len], offset);