Skip to content

Commit 1074eb3

Browse files
authored
feat(filesystem): 引入Umount系统调用 (#719)
* feat(filesystem): 引入Umount系统调用 * 将所有ENOSYS误用更正 * 修复了一个使同一个挂载点可以挂载2个文件系统的bug * 统一注释,增强程序稳定性,统一接口。注意:Umount时在fatfs的路径要使用大写,此受限于当前文件系统设计。
1 parent ceeb2e9 commit 1074eb3

File tree

46 files changed

+1274
-463
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1274
-463
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
- [谢润霖](https://github.com/xiaolin2004)
113113
- [蔡俊源](https://github.com/SMALLC04)
114114
- Kelly
115-
- [戴吕琛](https://github.com/Samuka007)
115+
- [Samuka007](https://github.com/Samuka007)
116116
- [杨璐玮](https://github.com/val213)
117117
- [何懿聪](https://github.com/GnoCiYeH)
118118
- [周凯韬](https://github.com/laokengwt)

README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ We guarantee that all sponsorship funds and items will be used for:
104104
- [谢润霖](https://github.com/xiaolin2004)
105105
- [蔡俊源](https://github.com/SMALLC04)
106106
- Kelly
107-
- [戴吕琛](https://github.com/Samuka007)
107+
- [Samuka007](https://github.com/Samuka007)
108108
- [杨璐玮](https://github.com/val213)
109109
- [何懿聪](https://github.com/GnoCiYeH)
110110
- [周凯韬](https://github.com/laokengwt)

docs/kernel/libs/lib_ui/scm.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,30 @@
1313
pub trait ScmUiFramework: Sync + Send + Debug {
1414
// 安装ui框架的回调函数
1515
fn install(&self) -> Result<i32, SystemError> {
16-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
16+
return Err(SystemError::ENOSYS);
1717
}
1818
// 卸载ui框架的回调函数
1919
fn uninstall(&self) -> Result<i32, SystemError> {
20-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
20+
return Err(SystemError::ENOSYS);
2121
}
2222
// 启用ui框架的回调函数
2323
fn enable(&self) -> Result<i32, SystemError> {
24-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
24+
return Err(SystemError::ENOSYS);
2525
}
2626
// 禁用ui框架的回调函数
2727
fn disable(&self) -> Result<i32, SystemError> {
28-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
28+
return Err(SystemError::ENOSYS);
2929
}
3030
// 改变ui框架的帧缓冲区的回调函数
3131
fn change(&self, _buf: ScmBufferInfo) -> Result<i32, SystemError> {
32-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
32+
return Err(SystemError::ENOSYS);
3333
}
3434
/// @brief 获取ScmUiFramework的元数据
3535
/// @return 成功:Ok(ScmUiFramework的元数据)
3636
/// 失败:Err(错误码)
3737
fn metadata(&self) -> Result<ScmUiFrameworkMetadata, SystemError> {
3838
// 若文件系统没有实现此方法,则返回“不支持”
39-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
39+
return Err(SystemError::ENOSYS);
4040
}
4141
}
4242
```

kernel/src/arch/x86_64/kvm/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ impl X86_64KVMArch {
3434
// Check to see if CPU is Intel (“GenuineIntel”).
3535
if let Some(vi) = cpuid.get_vendor_info() {
3636
if vi.as_str() != "GenuineIntel" {
37-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
37+
return Err(SystemError::ENOSYS);
3838
}
3939
}
4040
// Check processor supports for Virtual Machine Extension (VMX) technology
4141
// CPUID.1:ECX.VMX[bit 5] = 1 (Intel Manual: 24.6 Discovering Support for VMX)
4242
if let Some(fi) = cpuid.get_feature_info() {
4343
if !fi.has_vmx() {
44-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
44+
return Err(SystemError::ENOSYS);
4545
}
4646
}
4747
Ok(())

kernel/src/arch/x86_64/kvm/vmx/ept.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn check_ept_features() -> Result<(), SystemError> {
1515
const MTRR_ENABLE_BIT: u64 = 1 << 11;
1616
let ia32_mtrr_def_type = unsafe { msr::rdmsr(msr::IA32_MTRR_DEF_TYPE) };
1717
if (ia32_mtrr_def_type & MTRR_ENABLE_BIT) == 0 {
18-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
18+
return Err(SystemError::ENOSYS);
1919
}
2020
Ok(())
2121
}

kernel/src/arch/x86_64/kvm/vmx/vcpu.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ impl Vcpu for VmxVcpu {
419419
}
420420
Err(e) => {
421421
kdebug!("[-] CPU does not support Intel VMX: {:?}", e);
422-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
422+
return Err(SystemError::ENOSYS);
423423
}
424424
};
425425

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

@@ -574,12 +574,12 @@ pub fn has_intel_vmx_support() -> Result<(), SystemError> {
574574
let cpuid = CpuId::new();
575575
if let Some(vi) = cpuid.get_vendor_info() {
576576
if vi.as_str() != "GenuineIntel" {
577-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
577+
return Err(SystemError::ENOSYS);
578578
}
579579
}
580580
if let Some(fi) = cpuid.get_feature_info() {
581581
if !fi.has_vmx() {
582-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
582+
return Err(SystemError::ENOSYS);
583583
}
584584
}
585585
Ok(())

kernel/src/driver/acpi/sysfs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ impl AttrAcpiTable {
205205

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

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

215215
fn name(&self) -> &str {
@@ -235,7 +235,7 @@ impl BinAttribute for AttrAcpiTable {
235235
_buf: &[u8],
236236
_offset: usize,
237237
) -> Result<usize, SystemError> {
238-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
238+
return Err(SystemError::ENOSYS);
239239
}
240240

241241
/// 展示 ACPI 表的内容

kernel/src/driver/base/device/bus.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ pub trait Bus: Debug + Send + Sync {
134134
///
135135
/// ## 默认实现
136136
///
137-
/// 如果总线不支持该操作,返回`SystemError::EOPNOTSUPP_OR_ENOTSUP`
137+
/// 如果总线不支持该操作,返回`SystemError::ENOSYS`
138138
fn probe(&self, _device: &Arc<dyn Device>) -> Result<(), SystemError> {
139-
return Err(SystemError::EOPNOTSUPP_OR_ENOTSUP);
139+
return Err(SystemError::ENOSYS);
140140
}
141141
fn remove(&self, _device: &Arc<dyn Device>) -> Result<(), SystemError>;
142142
fn sync_state(&self, _device: &Arc<dyn Device>) {}
@@ -750,7 +750,7 @@ impl Attribute for DriverAttrUnbind {
750750
"Intertrait casting not implemented for kobj: {}",
751751
kobj.name()
752752
);
753-
SystemError::EOPNOTSUPP_OR_ENOTSUP
753+
SystemError::ENOSYS
754754
})?;
755755

756756
let bus = driver
@@ -799,7 +799,7 @@ impl Attribute for DriverAttrBind {
799799
"Intertrait casting not implemented for kobj: {}",
800800
kobj.name()
801801
);
802-
SystemError::EOPNOTSUPP_OR_ENOTSUP
802+
SystemError::ENOSYS
803803
})?;
804804

805805
let bus = driver

kernel/src/driver/base/device/dd.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ impl DriverManager {
502502
.and_then(|bus| bus.upgrade())
503503
.ok_or(SystemError::EINVAL)?;
504504
let r = bus.probe(device);
505-
if r == Err(SystemError::EOPNOTSUPP_OR_ENOTSUP) {
505+
if r == Err(SystemError::ENOSYS) {
506506
kerror!(
507507
"call_driver_probe: bus.probe() failed, dev: '{}', err: {:?}",
508508
device.name(),
@@ -592,7 +592,7 @@ impl Attribute for DeviceAttrStateSynced {
592592
"Intertrait casting not implemented for kobj: {}",
593593
kobj.name()
594594
);
595-
SystemError::EOPNOTSUPP_OR_ENOTSUP
595+
SystemError::ENOSYS
596596
})?;
597597

598598
let val = dev.state_synced();
@@ -627,7 +627,7 @@ impl Attribute for DeviceAttrCoredump {
627627
"Intertrait casting not implemented for kobj: {}",
628628
kobj.name()
629629
);
630-
SystemError::EOPNOTSUPP_OR_ENOTSUP
630+
SystemError::ENOSYS
631631
})?;
632632

633633
let drv = dev.driver().ok_or(SystemError::EINVAL)?;

kernel/src/driver/base/device/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ impl Attribute for DeviceAttrDev {
875875
"Intertrait casting not implemented for kobj: {}",
876876
kobj.name()
877877
);
878-
SystemError::EOPNOTSUPP_OR_ENOTSUP
878+
SystemError::ENOSYS
879879
})?;
880880

881881
let device_number = dev.id_table().device_number();

0 commit comments

Comments
 (0)