]> git.proxmox.com Git - proxmox-backup.git/commitdiff
use proxmox-sys 0.2.1 and proxmox-io 1.0.1
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 25 Nov 2021 11:30:03 +0000 (12:30 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 25 Nov 2021 11:30:03 +0000 (12:30 +0100)
And remove unused code from pbs-tools.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
pbs-client/Cargo.toml
pbs-client/src/pxar_backup_stream.rs
pbs-tools/src/io.rs [deleted file]
pbs-tools/src/lib.rs
pbs-tools/src/sync/mod.rs [deleted file]
pbs-tools/src/sync/std_channel_writer.rs [deleted file]
proxmox-backup-client/Cargo.toml
proxmox-backup-client/src/main.rs
proxmox-backup-client/src/mount.rs

index a1b5df4455cb5be37b2502f11aa6463c29dfd50c..3e167ef6ab8efa05e0257a917bdf9c401207deeb 100644 (file)
@@ -33,7 +33,7 @@ pathpatterns = "0.1.2"
 proxmox-async = "0.3"
 proxmox-fuse = "0.1.1"
 proxmox-http = { version = "0.6", features = [ "client", "http-helpers", "websocket" ] }
-proxmox-io = { version = "1", features = [ "tokio" ] }
+proxmox-io = { version = "1.0.1", features = [ "tokio" ] }
 proxmox-lang = "1"
 proxmox-router = { version = "1.1", features = [ "cli" ] }
 proxmox-schema = "1"
index 484a3e32766b992e2f70b5ee21a1685623b66814..28e569a70318e5ce801fd0962888114f0985bd61 100644 (file)
@@ -13,9 +13,9 @@ use nix::fcntl::OFlag;
 use nix::sys::stat::Mode;
 
 use proxmox_async::blocking::TokioWriterAdapter;
+use proxmox_io::StdChannelWriter;
 
 use pbs_datastore::catalog::CatalogWriter;
-use pbs_tools::sync::StdChannelWriter;
 
 /// Stream implementation to encode and upload .pxar archives.
 ///
diff --git a/pbs-tools/src/io.rs b/pbs-tools/src/io.rs
deleted file mode 100644 (file)
index 6ddaa53..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-//! I/O utilities.
-
-use proxmox_sys::fd::Fd;
-
-/// safe wrapper for `nix::unistd::pipe2` defaulting to `O_CLOEXEC` and guarding the file
-/// descriptors.
-pub fn pipe() -> Result<(Fd, Fd), nix::Error> {
-    let (pin, pout) = nix::unistd::pipe2(nix::fcntl::OFlag::O_CLOEXEC)?;
-    Ok((Fd(pin), Fd(pout)))
-}
index 857efcb7e6fb8bff0d8c2eaae9f55066046c57eb..053b3c0ca1469ab92b06d230e26f9a2aa8fa9958 100644 (file)
@@ -1,12 +1,10 @@
 pub mod cert;
 pub mod crypt_config;
 pub mod format;
-pub mod io;
 pub mod json;
 pub mod lru_cache;
 pub mod nom;
 pub mod sha;
-pub mod sync;
 pub mod ticket;
 
 pub mod async_lru_cache;
diff --git a/pbs-tools/src/sync/mod.rs b/pbs-tools/src/sync/mod.rs
deleted file mode 100644 (file)
index fdd5eda..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-mod std_channel_writer;
-pub use std_channel_writer::StdChannelWriter;
diff --git a/pbs-tools/src/sync/std_channel_writer.rs b/pbs-tools/src/sync/std_channel_writer.rs
deleted file mode 100644 (file)
index c5131a1..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-use std::io::Write;
-use std::sync::mpsc::SyncSender;
-use std::string::ToString;
-
-/// Wrapper around SyncSender, which implements Write
-///
-/// Each write in translated into a send(Vec<u8>).
-pub struct StdChannelWriter<E>(SyncSender<Result<Vec<u8>, E>>);
-
-impl <E: ToString> StdChannelWriter<E> {
-    pub fn new(sender: SyncSender<Result<Vec<u8>, E>>) -> Self {
-        Self(sender)
-    }
-}
-
-impl <E: ToString> Write for StdChannelWriter<E> {
-    fn write(&mut self, buf: &[u8]) -> Result<usize, std::io::Error> {
-        self.0
-            .send(Ok(buf.to_vec()))
-            .map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err.to_string()))
-            .and(Ok(buf.len()))
-    }
-
-    fn flush(&mut self) -> Result<(), std::io::Error> {
-        Ok(())
-    }
-}
index 7a28959296f034ee6281b12b3b85a49133000900..8dfd499cea25598b8476925f3b9b0625cb599660 100644 (file)
@@ -23,11 +23,11 @@ pathpatterns = "0.1.2"
 pxar = { version = "0.10.1", features = [ "tokio-io" ] }
 
 proxmox-async = "0.3"
+proxmox-io = "1.0.1"
 proxmox-router = { version = "1.1", features = [ "cli" ] }
 proxmox-schema = { version = "1", features = [ "api-macro" ] }
 proxmox-time = "1"
-proxmox-sys = { version = "0.2",  features = [ "sortable-macro" ] }
-
+proxmox-sys = { version = "0.2.1",  features = [ "sortable-macro" ] }
 
 pbs-api-types = { path = "../pbs-api-types" }
 pbs-buildcfg = { path = "../pbs-buildcfg" }
index ca58759402ffb6a68b7457da3661f615406df0f4..95f82c780139e5d2b8d01df4405f9510f0669b0c 100644 (file)
@@ -13,6 +13,7 @@ use tokio_stream::wrappers::ReceiverStream;
 use xdg::BaseDirectories;
 
 use pathpatterns::{MatchEntry, MatchType, PatternFlag};
+use proxmox_io::StdChannelWriter;
 use proxmox_sys::fs::{file_get_json, replace_file, CreateOptions, image_size};
 use proxmox_router::{ApiMethod, RpcEnvironment, cli::*};
 use proxmox_schema::api;
@@ -68,7 +69,6 @@ use pbs_datastore::manifest::{
     ENCRYPTED_KEY_BLOB_NAME, MANIFEST_BLOB_NAME, ArchiveType, BackupManifest, archive_type,
 };
 use pbs_datastore::read_chunk::AsyncReadChunk;
-use pbs_tools::sync::StdChannelWriter;
 use pbs_tools::json;
 use pbs_tools::crypt_config::CryptConfig;
 
index bc0bc8d5909efc0dc854ce9a1091ff4dafb835d6..360cd047a9f02fdc3a8ae8cf908ef573dcec1743 100644 (file)
@@ -140,7 +140,7 @@ fn mount(
 
     // Process should be daemonized.
     // Make sure to fork before the async runtime is instantiated to avoid troubles.
-    let (pr, pw) = pbs_tools::io::pipe()?;
+    let (pr, pw) = proxmox_sys::pipe()?;
     match unsafe { fork() } {
         Ok(ForkResult::Parent { .. }) => {
             drop(pw);