Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
- [谢润霖](https://github.com/xiaolin2004)
- [蔡俊源](https://github.com/SMALLC04)
- Kelly
- [戴吕琛](https://github.com/Samuka007)
- [Samuka007](https://github.com/Samuka007)
- [杨璐玮](https://github.com/val213)
- [何懿聪](https://github.com/GnoCiYeH)
- [周凯韬](https://github.com/laokengwt)
Expand Down
2 changes: 1 addition & 1 deletion README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ We guarantee that all sponsorship funds and items will be used for:
- [谢润霖](https://github.com/xiaolin2004)
- [蔡俊源](https://github.com/SMALLC04)
- Kelly
- [戴吕琛](https://github.com/Samuka007)
- [Samuka007](https://github.com/Samuka007)
- [杨璐玮](https://github.com/val213)
- [何懿聪](https://github.com/GnoCiYeH)
- [周凯韬](https://github.com/laokengwt)
Expand Down
12 changes: 6 additions & 6 deletions docs/kernel/libs/lib_ui/scm.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@
pub trait ScmUiFramework: Sync + Send + Debug {
// 安装ui框架的回调函数
fn install(&self) -> Result<i32, SystemError> {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
// 卸载ui框架的回调函数
fn uninstall(&self) -> Result<i32, SystemError> {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
// 启用ui框架的回调函数
fn enable(&self) -> Result<i32, SystemError> {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
// 禁用ui框架的回调函数
fn disable(&self) -> Result<i32, SystemError> {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
// 改变ui框架的帧缓冲区的回调函数
fn change(&self, _buf: ScmBufferInfo) -> Result<i32, SystemError> {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
/// @brief 获取ScmUiFramework的元数据
/// @return 成功:Ok(ScmUiFramework的元数据)
/// 失败:Err(错误码)
fn metadata(&self) -> Result<ScmUiFrameworkMetadata, SystemError> {
// 若文件系统没有实现此方法,则返回“不支持”
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions kernel/src/arch/x86_64/kvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ impl X86_64KVMArch {
// Check to see if CPU is Intel (“GenuineIntel”).
if let Some(vi) = cpuid.get_vendor_info() {
if vi.as_str() != "GenuineIntel" {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
}
// Check processor supports for Virtual Machine Extension (VMX) technology
// CPUID.1:ECX.VMX[bit 5] = 1 (Intel Manual: 24.6 Discovering Support for VMX)
if let Some(fi) = cpuid.get_feature_info() {
if !fi.has_vmx() {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
}
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/arch/x86_64/kvm/vmx/ept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn check_ept_features() -> Result<(), SystemError> {
const MTRR_ENABLE_BIT: u64 = 1 << 11;
let ia32_mtrr_def_type = unsafe { msr::rdmsr(msr::IA32_MTRR_DEF_TYPE) };
if (ia32_mtrr_def_type & MTRR_ENABLE_BIT) == 0 {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
Ok(())
}
Expand Down
8 changes: 4 additions & 4 deletions kernel/src/arch/x86_64/kvm/vmx/vcpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ impl Vcpu for VmxVcpu {
}
Err(e) => {
kdebug!("[-] CPU does not support Intel VMX: {:?}", e);
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
};

Expand All @@ -429,7 +429,7 @@ impl Vcpu for VmxVcpu {
}
Err(_) => {
kdebug!("[-] VMX operation is not supported on this processor.");
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
}

Expand Down Expand Up @@ -574,12 +574,12 @@ pub fn has_intel_vmx_support() -> Result<(), SystemError> {
let cpuid = CpuId::new();
if let Some(vi) = cpuid.get_vendor_info() {
if vi.as_str() != "GenuineIntel" {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
}
if let Some(fi) = cpuid.get_feature_info() {
if !fi.has_vmx() {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
}
Ok(())
Expand Down
6 changes: 3 additions & 3 deletions kernel/src/driver/acpi/sysfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ impl AttrAcpiTable {

impl Attribute for AttrAcpiTable {
fn show(&self, _kobj: Arc<dyn KObject>, _buf: &mut [u8]) -> Result<usize, SystemError> {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}

fn store(&self, _kobj: Arc<dyn KObject>, _buf: &[u8]) -> Result<usize, SystemError> {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}

fn name(&self) -> &str {
Expand All @@ -235,7 +235,7 @@ impl BinAttribute for AttrAcpiTable {
_buf: &[u8],
_offset: usize,
) -> Result<usize, SystemError> {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}

/// 展示 ACPI 表的内容
Expand Down
8 changes: 4 additions & 4 deletions kernel/src/driver/base/device/bus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ pub trait Bus: Debug + Send + Sync {
///
/// ## 默认实现
///
/// 如果总线不支持该操作,返回`SystemError::EOPNOTSUPP_OR_ENOTSUP`
/// 如果总线不支持该操作,返回`SystemError::ENOSYS`
fn probe(&self, _device: &Arc<dyn Device>) -> Result<(), SystemError> {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
fn remove(&self, _device: &Arc<dyn Device>) -> Result<(), SystemError>;
fn sync_state(&self, _device: &Arc<dyn Device>) {}
Expand Down Expand Up @@ -750,7 +750,7 @@ impl Attribute for DriverAttrUnbind {
"Intertrait casting not implemented for kobj: {}",
kobj.name()
);
SystemError::EOPNOTSUPP_OR_ENOTSUP
SystemError::ENOSYS
})?;

let bus = driver
Expand Down Expand Up @@ -799,7 +799,7 @@ impl Attribute for DriverAttrBind {
"Intertrait casting not implemented for kobj: {}",
kobj.name()
);
SystemError::EOPNOTSUPP_OR_ENOTSUP
SystemError::ENOSYS
})?;

let bus = driver
Expand Down
6 changes: 3 additions & 3 deletions kernel/src/driver/base/device/dd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ impl DriverManager {
.and_then(|bus| bus.upgrade())
.ok_or(SystemError::EINVAL)?;
let r = bus.probe(device);
if r == Err(SystemError::EOPNOTSUPP_OR_ENOTSUP) {
if r == Err(SystemError::ENOSYS) {
kerror!(
"call_driver_probe: bus.probe() failed, dev: '{}', err: {:?}",
device.name(),
Expand Down Expand Up @@ -592,7 +592,7 @@ impl Attribute for DeviceAttrStateSynced {
"Intertrait casting not implemented for kobj: {}",
kobj.name()
);
SystemError::EOPNOTSUPP_OR_ENOTSUP
SystemError::ENOSYS
})?;

let val = dev.state_synced();
Expand Down Expand Up @@ -627,7 +627,7 @@ impl Attribute for DeviceAttrCoredump {
"Intertrait casting not implemented for kobj: {}",
kobj.name()
);
SystemError::EOPNOTSUPP_OR_ENOTSUP
SystemError::ENOSYS
})?;

let drv = dev.driver().ok_or(SystemError::EINVAL)?;
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/driver/base/device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ impl Attribute for DeviceAttrDev {
"Intertrait casting not implemented for kobj: {}",
kobj.name()
);
SystemError::EOPNOTSUPP_OR_ENOTSUP
SystemError::ENOSYS
})?;

let device_number = dev.id_table().device_number();
Expand Down
4 changes: 2 additions & 2 deletions kernel/src/driver/base/kobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl SysFSOps for KObjectSysFSOps {
buf: &mut [u8],
) -> Result<usize, SystemError> {
let r = attr.show(kobj, buf).map_err(|e| {
if e == SystemError::EOPNOTSUPP_OR_ENOTSUP {
if e == SystemError::ENOSYS {
SystemError::EIO
} else {
e
Expand All @@ -163,7 +163,7 @@ impl SysFSOps for KObjectSysFSOps {
buf: &[u8],
) -> Result<usize, SystemError> {
let r = attr.store(kobj, buf).map_err(|e| {
if e == SystemError::EOPNOTSUPP_OR_ENOTSUP {
if e == SystemError::ENOSYS {
SystemError::EIO
} else {
e
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/driver/base/subsys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ pub trait SubSysInterface: Debug + Send + Sync {
fn bus(&self) -> Option<Weak<dyn Bus>>;
fn set_bus(&self, bus: Option<Weak<dyn Bus>>);
fn add_device(&self, _device: &Arc<dyn Device>) -> Result<(), SystemError> {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
fn remove_device(&self, device: &Arc<dyn Device>);
}
6 changes: 3 additions & 3 deletions kernel/src/driver/disk/ahci/ahci_inode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ impl IndexNode for LockedAhciInode {
_data: SpinLockGuard<FilePrivateData>,
_mode: &FileMode,
) -> Result<(), SystemError> {
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
Err(SystemError::ENOSYS)
}

fn close(&self, _data: SpinLockGuard<FilePrivateData>) -> Result<(), SystemError> {
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
Err(SystemError::ENOSYS)
}

fn metadata(&self) -> Result<Metadata, SystemError> {
Expand All @@ -98,7 +98,7 @@ impl IndexNode for LockedAhciInode {
}

fn list(&self) -> Result<Vec<String>, SystemError> {
Err(SystemError::EOPNOTSUPP_OR_ENOTSUP)
Err(SystemError::ENOSYS)
}

fn set_metadata(&self, metadata: &Metadata) -> Result<(), SystemError> {
Expand Down
10 changes: 7 additions & 3 deletions kernel/src/driver/input/ps2_mouse/ps_mouse_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ use crate::{
devfs::{devfs_register, DevFS, DeviceINode},
kernfs::KernFSInode,
vfs::{
core::generate_inode_id, syscall::ModeType, FilePrivateData, FileSystem, FileType,
IndexNode, Metadata,
core::generate_inode_id, syscall::ModeType, utils::DName, FilePrivateData, FileSystem,
FileType, IndexNode, Metadata,
},
},
libs::{
Expand Down Expand Up @@ -627,7 +627,7 @@ impl IndexNode for Ps2MouseDevice {
_buf: &[u8],
_data: SpinLockGuard<FilePrivateData>,
) -> Result<usize, SystemError> {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}

fn fs(&self) -> Arc<dyn FileSystem> {
Expand Down Expand Up @@ -655,6 +655,10 @@ impl IndexNode for Ps2MouseDevice {
fn resize(&self, _len: usize) -> Result<(), SystemError> {
Ok(())
}

fn dname(&self) -> Result<DName, SystemError> {
Ok(DName::from(self.name()))
}
}

impl Ps2Device for Ps2MouseDevice {}
Expand Down
2 changes: 1 addition & 1 deletion kernel/src/driver/keyboard/ps2_keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl IndexNode for LockedPS2KeyBoardInode {
}

fn list(&self) -> Result<alloc::vec::Vec<alloc::string::String>, SystemError> {
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
return Err(SystemError::ENOSYS);
}
}

Expand Down
Loading