pxar::fuse: cleanup: Remove unused code.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Christian Ebner 2020-02-03 13:34:50 +01:00 committed by Wolfgang Bumiller
parent 3e69abef02
commit 9ff9a00572

View File

@ -32,7 +32,6 @@ use super::format_definition::PxarGoodbyeItem;
/// required. /// required.
const FUSE_ROOT_ID: u64 = 1; const FUSE_ROOT_ID: u64 = 1;
type Offset = u64;
/// FFI types for easier readability /// FFI types for easier readability
type Request = *mut c_void; type Request = *mut c_void;
type MutPtr = *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. /// offset within the archive for the i-node given by the caller.
struct Context { struct Context {
decoder: Decoder, decoder: Decoder,
ino_offset: Offset,
/// The start of each DirectoryEntry is used as inode, used as key for this /// The start of each DirectoryEntry is used as inode, used as key for this
/// hashmap. /// hashmap.
/// ///
@ -228,7 +226,6 @@ impl Session {
let ctx = Context { let ctx = Context {
decoder, decoder,
ino_offset: 0,
start_end_parent: map, start_end_parent: map,
entry_cache: LruCache::new(1024), entry_cache: LruCache::new(1024),
gbt_cache: LruCache::new(1024), gbt_cache: LruCache::new(1024),
@ -340,42 +337,6 @@ impl Session {
Ok(()) 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<F>(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<Context>;
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 /// Creates a context providing exclusive mutable references to the members of
/// `Context`. /// `Context`.
/// ///