summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-01-04 06:54:01 -0600
committerAlejandro Soto <alejandro@34project.org>2022-01-04 06:54:01 -0600
commit2236d258859018a93b14504295385ad4fb0b3d9b (patch)
treecf8f65635ffc3cdea5c2755f20859676b855e790
parent70baa472b2bee69f205cc1aada304d597b858005 (diff)
Move error types to new module crate::error
-rw-r--r--src/error.rs23
-rw-r--r--src/lib.rs6
-rw-r--r--src/util.rs15
3 files changed, 26 insertions, 18 deletions
diff --git a/src/error.rs b/src/error.rs
new file mode 100644
index 0000000..f4db21a
--- /dev/null
+++ b/src/error.rs
@@ -0,0 +1,23 @@
+use quick_error::quick_error;
+
+quick_error! {
+ #[derive(Debug)]
+ pub enum FuseError {
+ Io(err: std::io::Error) { from() }
+ ProtocolInit { display("fuse handshake failed (ancient kernel?)") }
+ Truncated { display("fuse request truncated") }
+ BadOpcode { display("unknown fuse operation") }
+ BadLength { display("bad length in fuse request") }
+ ShortWrite { display("fuse reply was trimmed on write()") }
+ }
+}
+
+quick_error! {
+ #[derive(Debug)]
+ pub enum MountError {
+ Io(err: std::io::Error) { from() }
+ Fusermount { display("fusermount failed") }
+ }
+}
+
+pub type FuseResult<T> = Result<T, FuseError>;
diff --git a/src/lib.rs b/src/lib.rs
index f811ba1..4830308 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,10 +13,10 @@ use std::{
time::{SystemTime, UNIX_EPOCH},
};
-pub use nix;
-pub use nix::errno::Errno;
-pub use util::{FuseError, FuseResult};
+pub use self::error::{FuseError, FuseResult};
+pub use nix::{self, errno::Errno};
+pub mod error;
pub mod io;
pub mod mount;
pub mod ops;
diff --git a/src/util.rs b/src/util.rs
index 5da19c8..88d6ee1 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -4,21 +4,6 @@ use std::{
};
use nix::unistd::{close, sysconf, SysconfVar};
-use quick_error::quick_error;
-
-quick_error! {
- #[derive(Debug)]
- pub enum FuseError {
- Io(err: std::io::Error) { from() }
- ProtocolInit { display("fuse handshake failed (ancient kernel?)") }
- Truncated { display("fuse request truncated") }
- BadOpcode { display("unknown fuse operation") }
- BadLength { display("bad length in fuse request") }
- ShortWrite { display("fuse reply was trimmed on write()") }
- }
-}
-
-pub type FuseResult<T> = Result<T, FuseError>;
pub struct DumbFd(pub RawFd);