src/pxar/fuse.rs: rename from_decoder into new, new into from_path
This commit is contained in:
parent
99b5b6cba9
commit
2a11191072
@ -1709,7 +1709,7 @@ async fn mount_do(param: Value, pipe: Option<RawFd>) -> Result<Value, Error> {
|
||||
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
|
||||
|
@ -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)?;
|
||||
|
@ -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<Self, Error> {
|
||||
pub fn from_path(archive_path: &Path, options: &OsStr, verbose: bool) -> Result<Self, Error> {
|
||||
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<Self, Error> {
|
||||
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<Vec<CString>, 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<Self, Error> {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user