From 9ff9a005724cf3ac4cb2ff342ce36dc1305ab094 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Mon, 3 Feb 2020 13:34:50 +0100 Subject: [PATCH] pxar::fuse: cleanup: Remove unused code. Signed-off-by: Christian Ebner Signed-off-by: Wolfgang Bumiller --- src/pxar/fuse.rs | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/src/pxar/fuse.rs b/src/pxar/fuse.rs index 81a67680..cfd3d929 100644 --- a/src/pxar/fuse.rs +++ b/src/pxar/fuse.rs @@ -32,7 +32,6 @@ use super::format_definition::PxarGoodbyeItem; /// required. const FUSE_ROOT_ID: u64 = 1; -type Offset = u64; /// FFI types for easier readability type Request = *mut c_void; type MutPtr = *mut c_void; @@ -75,7 +74,6 @@ struct FuseArgs { /// offset within the archive for the i-node given by the caller. struct Context { decoder: Decoder, - ino_offset: Offset, /// The start of each DirectoryEntry is used as inode, used as key for this /// hashmap. /// @@ -228,7 +226,6 @@ impl Session { let ctx = Context { decoder, - ino_offset: 0, start_end_parent: map, entry_cache: LruCache::new(1024), gbt_cache: LruCache::new(1024), @@ -340,42 +337,6 @@ impl Session { Ok(()) } - /// Creates a context providing an exclusive mutable reference to the `Context`. - /// - /// Each callback function needing access to the `Context` can easily get an - /// exclusive handle by running the code inside this context. - /// Responses with error code can easily be generated by returning with the - /// error code. - /// The error code will be used to reply to libfuse. - fn run_in_context(req: Request, inode: u64, code: F) - where - F: FnOnce(&mut Context) -> Result<(), i32>, - { - let boxed_ctx = unsafe { - let ptr = fuse_req_userdata(req) as *mut Mutex; - Box::from_raw(ptr) - }; - let result = boxed_ctx - .lock() - .map(|mut ctx| { - ctx.ino_offset = match inode { - FUSE_ROOT_ID => 0, - _ => inode, - }; - code(&mut ctx) - }) - .unwrap_or(Err(libc::EIO)); - - if let Err(err) = result { - unsafe { - let _res = fuse_reply_err(req, err); - } - } - - // Release ownership of boxed context, do not drop it. - let _ = Box::into_raw(boxed_ctx); - } - /// Creates a context providing exclusive mutable references to the members of /// `Context`. ///