mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-23 08:26:17 +04:00
panicless default fs implement
This commit is contained in:
parent
113a33e575
commit
6e8c80d328
@ -108,16 +108,16 @@ lazy_static! {
|
||||
// TODO: better way to provide default impl?
|
||||
macro_rules! impl_inode {
|
||||
() => {
|
||||
fn info(&self) -> Result<FileInfo> { unimplemented!() }
|
||||
fn sync(&self) -> Result<()> { unimplemented!() }
|
||||
fn resize(&self, _len: usize) -> Result<()> { unimplemented!() }
|
||||
fn create(&self, _name: &str, _type_: FileType) -> Result<Arc<INode>> { unimplemented!() }
|
||||
fn unlink(&self, _name: &str) -> Result<()> { unimplemented!() }
|
||||
fn link(&self, _name: &str, _other: &Arc<INode>) -> Result<()> { unimplemented!() }
|
||||
fn rename(&self, _old_name: &str, _new_name: &str) -> Result<()> { unimplemented!() }
|
||||
fn move_(&self, _old_name: &str, _target: &Arc<INode>, _new_name: &str) -> Result<()> { unimplemented!() }
|
||||
fn find(&self, _name: &str) -> Result<Arc<INode>> { unimplemented!() }
|
||||
fn get_entry(&self, _id: usize) -> Result<String> { unimplemented!() }
|
||||
fn info(&self) -> Result<FileInfo> { Err(FsError::NotSupported) }
|
||||
fn sync(&self) -> Result<()> { Ok(()) }
|
||||
fn resize(&self, _len: usize) -> Result<()> { Err(FsError::NotSupported) }
|
||||
fn create(&self, _name: &str, _type_: FileType) -> Result<Arc<INode>> { Err(FsError::NotDir) }
|
||||
fn unlink(&self, _name: &str) -> Result<()> { Err(FsError::NotDir) }
|
||||
fn link(&self, _name: &str, _other: &Arc<INode>) -> Result<()> { Err(FsError::NotDir) }
|
||||
fn rename(&self, _old_name: &str, _new_name: &str) -> Result<()> { Err(FsError::NotDir) }
|
||||
fn move_(&self, _old_name: &str, _target: &Arc<INode>, _new_name: &str) -> Result<()> { Err(FsError::NotDir) }
|
||||
fn find(&self, _name: &str) -> Result<Arc<INode>> { Err(FsError::NotDir) }
|
||||
fn get_entry(&self, _id: usize) -> Result<String> { Err(FsError::NotDir) }
|
||||
fn fs(&self) -> Arc<FileSystem> { unimplemented!() }
|
||||
fn as_any_ref(&self) -> &Any { self }
|
||||
};
|
||||
|
@ -53,7 +53,7 @@ pub fn syscall(id: usize, args: [usize; 6], tf: &mut TrapFrame) -> i32 {
|
||||
};
|
||||
match ret {
|
||||
Ok(code) => code,
|
||||
Err(err) => -(err as i32),
|
||||
Err(err) => (err as i32),
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,7 +286,8 @@ pub type SysResult = Result<i32, SysError>;
|
||||
#[repr(i32)]
|
||||
#[derive(Debug)]
|
||||
pub enum SysError {
|
||||
// ucore compatible error code, which is a modified version of the ones used in linux
|
||||
// ucore_plus compatible error code, which is a modified version of the ones used in linux
|
||||
// note that ucore_os_lab use another error code table
|
||||
// name conversion E_XXXXX -> SysError::Xxxxx
|
||||
// see https://github.com/oscourse-tsinghua/ucore_plus/blob/master/ucore/src/libs-user-ucore/common/error.h
|
||||
// we only add current used errors here
|
||||
|
Loading…
Reference in New Issue
Block a user