mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-08-08 06:53:56 +00:00
move fuse code from pbs-client to pbs-pxar-fuse
it's used by pxar-bin and proxmox-backup-client for mounting, but pbs-client is used by more (eg. the proxmox-backup-qemu library which really doesn't need to pull in any fuse dependencies) Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
16f6766a68
commit
d701808514
@ -25,7 +25,7 @@ members = [
|
|||||||
"pbs-config",
|
"pbs-config",
|
||||||
"pbs-datastore",
|
"pbs-datastore",
|
||||||
"pbs-fuse-loop",
|
"pbs-fuse-loop",
|
||||||
"proxmox-rrd",
|
"pbs-pxar-fuse",
|
||||||
"pbs-tape",
|
"pbs-tape",
|
||||||
"pbs-tools",
|
"pbs-tools",
|
||||||
|
|
||||||
@ -33,6 +33,8 @@ members = [
|
|||||||
"proxmox-backup-client",
|
"proxmox-backup-client",
|
||||||
"proxmox-file-restore",
|
"proxmox-file-restore",
|
||||||
"proxmox-restore-daemon",
|
"proxmox-restore-daemon",
|
||||||
|
"proxmox-rrd",
|
||||||
|
|
||||||
"pxar-bin",
|
"pxar-bin",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
3
Makefile
3
Makefile
@ -38,13 +38,14 @@ SUBCRATES := \
|
|||||||
pbs-config \
|
pbs-config \
|
||||||
pbs-datastore \
|
pbs-datastore \
|
||||||
pbs-fuse-loop \
|
pbs-fuse-loop \
|
||||||
proxmox-rrd \
|
pbs-pxar-fuse \
|
||||||
pbs-tape \
|
pbs-tape \
|
||||||
pbs-tools \
|
pbs-tools \
|
||||||
proxmox-backup-banner \
|
proxmox-backup-banner \
|
||||||
proxmox-backup-client \
|
proxmox-backup-client \
|
||||||
proxmox-file-restore \
|
proxmox-file-restore \
|
||||||
proxmox-restore-daemon \
|
proxmox-restore-daemon \
|
||||||
|
proxmox-rrd \
|
||||||
pxar-bin
|
pxar-bin
|
||||||
|
|
||||||
ifeq ($(BUILD_MODE), release)
|
ifeq ($(BUILD_MODE), release)
|
||||||
|
@ -35,7 +35,6 @@ pathpatterns = "0.1.2"
|
|||||||
|
|
||||||
proxmox-async = "0.4"
|
proxmox-async = "0.4"
|
||||||
proxmox-compression = "0.1.1"
|
proxmox-compression = "0.1.1"
|
||||||
proxmox-fuse = "0.1.3"
|
|
||||||
proxmox-http = { version = "0.7", features = [ "client", "http-helpers", "websocket" ] }
|
proxmox-http = { version = "0.7", features = [ "client", "http-helpers", "websocket" ] }
|
||||||
proxmox-io = { version = "1.0.1", features = [ "tokio" ] }
|
proxmox-io = { version = "1.0.1", features = [ "tokio" ] }
|
||||||
proxmox-lang = "1.1"
|
proxmox-lang = "1.1"
|
||||||
|
@ -17,16 +17,20 @@ use pathpatterns::{MatchEntry, MatchList, MatchPattern, MatchType, PatternFlag};
|
|||||||
use proxmox_router::cli::{self, CliCommand, CliCommandMap, CliHelper, CommandLineInterface};
|
use proxmox_router::cli::{self, CliCommand, CliCommandMap, CliHelper, CommandLineInterface};
|
||||||
use proxmox_schema::api;
|
use proxmox_schema::api;
|
||||||
use proxmox_sys::fs::{create_path, CreateOptions};
|
use proxmox_sys::fs::{create_path, CreateOptions};
|
||||||
|
use pxar::accessor::ReadAt;
|
||||||
use pxar::{EntryKind, Metadata};
|
use pxar::{EntryKind, Metadata};
|
||||||
|
|
||||||
use pbs_datastore::catalog::{self, DirEntryAttribute};
|
use pbs_datastore::catalog::{self, DirEntryAttribute};
|
||||||
use proxmox_async::runtime::block_in_place;
|
use proxmox_async::runtime::block_in_place;
|
||||||
|
|
||||||
use crate::pxar::fuse::{Accessor, FileEntry};
|
|
||||||
use crate::pxar::Flags;
|
use crate::pxar::Flags;
|
||||||
|
|
||||||
type CatalogReader = pbs_datastore::catalog::CatalogReader<std::fs::File>;
|
type CatalogReader = pbs_datastore::catalog::CatalogReader<std::fs::File>;
|
||||||
|
|
||||||
|
type Reader = std::sync::Arc<dyn ReadAt + Send + Sync + 'static>;
|
||||||
|
type Accessor = pxar::accessor::aio::Accessor<Reader>;
|
||||||
|
type FileEntry = pxar::accessor::aio::FileEntry<Reader>;
|
||||||
|
|
||||||
const MAX_SYMLINK_COUNT: usize = 40;
|
const MAX_SYMLINK_COUNT: usize = 40;
|
||||||
|
|
||||||
static mut SHELL: Option<usize> = None;
|
static mut SHELL: Option<usize> = None;
|
||||||
|
@ -50,7 +50,6 @@
|
|||||||
pub(crate) mod create;
|
pub(crate) mod create;
|
||||||
pub(crate) mod dir_stack;
|
pub(crate) mod dir_stack;
|
||||||
pub(crate) mod extract;
|
pub(crate) mod extract;
|
||||||
pub mod fuse;
|
|
||||||
pub(crate) mod metadata;
|
pub(crate) mod metadata;
|
||||||
pub(crate) mod tools;
|
pub(crate) mod tools;
|
||||||
|
|
||||||
|
19
pbs-pxar-fuse/Cargo.toml
Normal file
19
pbs-pxar-fuse/Cargo.toml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[package]
|
||||||
|
name = "pbs-pxar-fuse"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
description = "pxar fuse file system code"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
anyhow = "1.0"
|
||||||
|
futures = "0.3"
|
||||||
|
libc = "0.2"
|
||||||
|
log = "0.4"
|
||||||
|
tokio = "1.6"
|
||||||
|
|
||||||
|
proxmox-fuse = "0.1.3"
|
||||||
|
proxmox-io = "1.0.1"
|
||||||
|
proxmox-lang = "1.1"
|
||||||
|
proxmox-sys = "0.4.1"
|
||||||
|
|
||||||
|
pxar = { version = "0.10.2", features = [ "tokio-io" ] }
|
@ -9,8 +9,8 @@ anyhow = "1.0"
|
|||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
hyper = { version = "0.14", features = [ "full" ] }
|
hyper = { version = "0.14", features = [ "full" ] }
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
nix = "0.24"
|
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
nix = "0.24"
|
||||||
openssl = "0.10"
|
openssl = "0.10"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
@ -24,16 +24,18 @@ pathpatterns = "0.1.2"
|
|||||||
pxar = { version = "0.10.2", features = [ "tokio-io" ] }
|
pxar = { version = "0.10.2", features = [ "tokio-io" ] }
|
||||||
|
|
||||||
proxmox-async = "0.4"
|
proxmox-async = "0.4"
|
||||||
|
proxmox-fuse = "0.1.3"
|
||||||
proxmox-io = "1.0.1"
|
proxmox-io = "1.0.1"
|
||||||
proxmox-router = { version = "1.3.0", features = [ "cli" ] }
|
proxmox-router = { version = "1.3.0", features = [ "cli" ] }
|
||||||
proxmox-schema = { version = "1.3.1", features = [ "api-macro" ] }
|
proxmox-schema = { version = "1.3.1", features = [ "api-macro" ] }
|
||||||
proxmox-time = "1"
|
|
||||||
proxmox-sys = { version = "0.4.1", features = [ "sortable-macro" ] }
|
proxmox-sys = { version = "0.4.1", features = [ "sortable-macro" ] }
|
||||||
|
proxmox-time = "1"
|
||||||
|
|
||||||
pbs-api-types = { path = "../pbs-api-types" }
|
pbs-api-types = { path = "../pbs-api-types" }
|
||||||
pbs-buildcfg = { path = "../pbs-buildcfg" }
|
pbs-buildcfg = { path = "../pbs-buildcfg" }
|
||||||
pbs-config = { path = "../pbs-config" }
|
|
||||||
pbs-client = { path = "../pbs-client" }
|
pbs-client = { path = "../pbs-client" }
|
||||||
|
pbs-config = { path = "../pbs-config" }
|
||||||
pbs-datastore = { path = "../pbs-datastore" }
|
pbs-datastore = { path = "../pbs-datastore" }
|
||||||
pbs-fuse-loop = { path = "../pbs-fuse-loop" }
|
pbs-fuse-loop = { path = "../pbs-fuse-loop" }
|
||||||
|
pbs-pxar-fuse = { path = "../pbs-pxar-fuse" }
|
||||||
pbs-tools = { path = "../pbs-tools" }
|
pbs-tools = { path = "../pbs-tools" }
|
||||||
|
@ -219,8 +219,8 @@ async fn catalog_shell(param: Value) -> Result<(), Error> {
|
|||||||
);
|
);
|
||||||
let reader = BufferedDynamicReader::new(index, chunk_reader);
|
let reader = BufferedDynamicReader::new(index, chunk_reader);
|
||||||
let archive_size = reader.archive_size();
|
let archive_size = reader.archive_size();
|
||||||
let reader: pbs_client::pxar::fuse::Reader = Arc::new(BufferedDynamicReadAt::new(reader));
|
let reader: pbs_pxar_fuse::Reader = Arc::new(BufferedDynamicReadAt::new(reader));
|
||||||
let decoder = pbs_client::pxar::fuse::Accessor::new(reader, archive_size).await?;
|
let decoder = pbs_pxar_fuse::Accessor::new(reader, archive_size).await?;
|
||||||
|
|
||||||
client.download(CATALOG_NAME, &mut tmpfile).await?;
|
client.download(CATALOG_NAME, &mut tmpfile).await?;
|
||||||
let index = DynamicIndexReader::new(tmpfile)
|
let index = DynamicIndexReader::new(tmpfile)
|
||||||
|
@ -295,16 +295,12 @@ async fn mount_do(param: Value, pipe: Option<OwnedFd>) -> Result<Value, Error> {
|
|||||||
);
|
);
|
||||||
let reader = BufferedDynamicReader::new(index, chunk_reader);
|
let reader = BufferedDynamicReader::new(index, chunk_reader);
|
||||||
let archive_size = reader.archive_size();
|
let archive_size = reader.archive_size();
|
||||||
let reader: pbs_client::pxar::fuse::Reader = Arc::new(BufferedDynamicReadAt::new(reader));
|
let reader: pbs_pxar_fuse::Reader = Arc::new(BufferedDynamicReadAt::new(reader));
|
||||||
let decoder = pbs_client::pxar::fuse::Accessor::new(reader, archive_size).await?;
|
let decoder = pbs_pxar_fuse::Accessor::new(reader, archive_size).await?;
|
||||||
|
|
||||||
let session = pbs_client::pxar::fuse::Session::mount(
|
let session =
|
||||||
decoder,
|
pbs_pxar_fuse::Session::mount(decoder, options, false, Path::new(target.unwrap()))
|
||||||
options,
|
.map_err(|err| format_err!("pxar mount failed: {}", err))?;
|
||||||
false,
|
|
||||||
Path::new(target.unwrap()),
|
|
||||||
)
|
|
||||||
.map_err(|err| format_err!("pxar mount failed: {}", err))?;
|
|
||||||
|
|
||||||
daemonize()?;
|
daemonize()?;
|
||||||
|
|
||||||
|
@ -17,12 +17,13 @@ serde_json = "1.0"
|
|||||||
tokio = { version = "1.6", features = [ "rt", "rt-multi-thread" ] }
|
tokio = { version = "1.6", features = [ "rt", "rt-multi-thread" ] }
|
||||||
|
|
||||||
pathpatterns = "0.1.2"
|
pathpatterns = "0.1.2"
|
||||||
#proxmox = "0.15.3"
|
|
||||||
proxmox-async = "0.4"
|
|
||||||
proxmox-schema = { version = "1.3.1", features = [ "api-macro" ] }
|
|
||||||
proxmox-router = "1.3.0"
|
|
||||||
proxmox-sys = "0.4.1"
|
|
||||||
pxar = { version = "0.10.2", features = [ "tokio-io" ] }
|
pxar = { version = "0.10.2", features = [ "tokio-io" ] }
|
||||||
|
|
||||||
|
proxmox-async = "0.4"
|
||||||
|
proxmox-router = "1.3.0"
|
||||||
|
proxmox-schema = { version = "1.3.1", features = [ "api-macro" ] }
|
||||||
|
proxmox-sys = "0.4.1"
|
||||||
|
|
||||||
pbs-client = { path = "../pbs-client" }
|
pbs-client = { path = "../pbs-client" }
|
||||||
|
pbs-pxar-fuse = { path = "../pbs-pxar-fuse" }
|
||||||
pbs-tools = { path = "../pbs-tools" }
|
pbs-tools = { path = "../pbs-tools" }
|
||||||
|
@ -12,9 +12,7 @@ use futures::select;
|
|||||||
use tokio::signal::unix::{signal, SignalKind};
|
use tokio::signal::unix::{signal, SignalKind};
|
||||||
|
|
||||||
use pathpatterns::{MatchEntry, MatchType, PatternFlag};
|
use pathpatterns::{MatchEntry, MatchType, PatternFlag};
|
||||||
use pbs_client::pxar::{
|
use pbs_client::pxar::{format_single_line_entry, Flags, PxarExtractOptions, ENCODER_MAX_ENTRIES};
|
||||||
format_single_line_entry, fuse, Flags, PxarExtractOptions, ENCODER_MAX_ENTRIES,
|
|
||||||
};
|
|
||||||
|
|
||||||
use proxmox_router::cli::*;
|
use proxmox_router::cli::*;
|
||||||
use proxmox_schema::api;
|
use proxmox_schema::api;
|
||||||
@ -382,7 +380,7 @@ async fn mount_archive(archive: String, mountpoint: String, verbose: bool) -> Re
|
|||||||
let mountpoint = Path::new(&mountpoint);
|
let mountpoint = Path::new(&mountpoint);
|
||||||
let options = OsStr::new("ro,default_permissions");
|
let options = OsStr::new("ro,default_permissions");
|
||||||
|
|
||||||
let session = fuse::Session::mount_path(archive, options, verbose, mountpoint)
|
let session = pbs_pxar_fuse::Session::mount_path(archive, options, verbose, mountpoint)
|
||||||
.await
|
.await
|
||||||
.map_err(|err| format_err!("pxar mount failed: {}", err))?;
|
.map_err(|err| format_err!("pxar mount failed: {}", err))?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user