From 2a111910723fac524ce4b5f1eed0b99a6472f163 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 26 Nov 2019 10:56:41 +0100 Subject: [PATCH] src/pxar/fuse.rs: rename from_decoder into new, new into from_path --- src/bin/proxmox-backup-client.rs | 2 +- src/bin/pxar.rs | 2 +- src/pxar/fuse.rs | 34 ++++++++++++++++---------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs index e508d5f4..f860055d 100644 --- a/src/bin/proxmox-backup-client.rs +++ b/src/bin/proxmox-backup-client.rs @@ -1709,7 +1709,7 @@ async fn mount_do(param: Value, pipe: Option) -> Result { let reader = BufferedDynamicReader::new(index, chunk_reader); let decoder = pxar::Decoder::new(reader)?; let options = OsStr::new("ro,default_permissions"); - let mut session = pxar::fuse::Session::from_decoder(decoder, &options, pipe.is_none()) + let mut session = pxar::fuse::Session::new(decoder, &options, pipe.is_none()) .map_err(|err| format_err!("pxar mount failed: {}", err))?; // Mount the session but not call fuse deamonize as this will cause diff --git a/src/bin/pxar.rs b/src/bin/pxar.rs index 0f8d1c0a..5d4b53c7 100644 --- a/src/bin/pxar.rs +++ b/src/bin/pxar.rs @@ -253,7 +253,7 @@ fn mount_archive( let archive = Path::new(archive); let mountpoint = Path::new(mountpoint); let options = OsStr::new("ro,default_permissions"); - let mut session = pxar::fuse::Session::new(&archive, &options, verbose) + let mut session = pxar::fuse::Session::from_path(&archive, &options, verbose) .map_err(|err| format_err!("pxar mount failed: {}", err))?; // Mount the session and deamonize if verbose is not set session.mount(&mountpoint, !verbose)?; diff --git a/src/pxar/fuse.rs b/src/pxar/fuse.rs index cb216744..14a40c60 100644 --- a/src/pxar/fuse.rs +++ b/src/pxar/fuse.rs @@ -159,7 +159,7 @@ impl Session { /// default signal handlers. /// Options have to be provided as comma separated OsStr, e.g. /// ("ro,default_permissions"). - pub fn new(archive_path: &Path, options: &OsStr, verbose: bool) -> Result { + pub fn from_path(archive_path: &Path, options: &OsStr, verbose: bool) -> Result { let file = File::open(archive_path)?; let args = Self::setup_args(options, verbose)?; let oprs = Self::setup_callbacks(); @@ -171,6 +171,22 @@ impl Session { Self::setup_session(decoder, args, oprs, verbose) } + /// Create a new low level fuse session using the given `Decoder`. + /// + /// `Session` is created using the provided mount options and sets the + /// default signal handlers. + /// Options have to be provided as comma separated OsStr, e.g. + /// ("ro,default_permissions"). + pub fn new( + decoder: Decoder, + options: &OsStr, + verbose: bool, + ) -> Result { + let args = Self::setup_args(options, verbose)?; + let oprs = Self::setup_callbacks(); + Self::setup_session(decoder, args, oprs, verbose) + } + fn setup_args(options: &OsStr, verbose: bool) -> Result, Error> { // First argument should be the executable name let mut arguments = vec![ @@ -246,22 +262,6 @@ impl Session { }) } - /// Create a new low level fuse session using the given `Decoder`. - /// - /// `Session` is created using the provided mount options and sets the - /// default signal handlers. - /// Options have to be provided as comma separated OsStr, e.g. - /// ("ro,default_permissions"). - pub fn from_decoder( - decoder: Decoder, - options: &OsStr, - verbose: bool, - ) -> Result { - let args = Self::setup_args(options, verbose)?; - let oprs = Self::setup_callbacks(); - Self::setup_session(decoder, args, oprs, verbose) - } - /// Mount the filesystem on the given mountpoint. /// /// Actually mount the filesystem for this session on the provided mountpoint