src/pxar/fuse.rs: rename from_decoder into new, new into from_path

This commit is contained in:
Dietmar Maurer
2019-11-26 10:56:41 +01:00
parent 99b5b6cba9
commit 2a11191072
3 changed files with 19 additions and 19 deletions

View File

@ -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