mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-29 16:13:27 +00:00
Add sysfs implementation
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
3a5f270ee9
commit
79b0866259
@ -330,6 +330,19 @@ impl From<int_to_c_enum::TryFromIntError> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<systree::Error> for Error {
|
||||
fn from(err: systree::Error) -> Self {
|
||||
use systree::Error::*;
|
||||
match err {
|
||||
NodeNotFound(_) => Error::new(Errno::ENOENT),
|
||||
InvalidNodeOperation(_) => Error::new(Errno::EINVAL),
|
||||
AttributeError => Error::new(Errno::EIO),
|
||||
PermissionDenied => Error::new(Errno::EACCES),
|
||||
InternalError(msg) => Error::with_message(Errno::EIO, msg),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! return_errno {
|
||||
($errno: expr) => {
|
||||
|
Reference in New Issue
Block a user