Add sysfs implementation

This commit is contained in:
Fabing Li
2025-04-24 10:04:37 +00:00
committed by Tate, Hongliang Tian
parent 3a5f270ee9
commit 79b0866259
19 changed files with 1639 additions and 1 deletions

View File

@ -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) => {