use proxmox-sys 0.2.1 and proxmox-io 1.0.1
And remove unused code from pbs-tools. Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
577095e2f7
commit
726b9d4469
|
@ -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"
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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)))
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
mod std_channel_writer;
|
||||
pub use std_channel_writer::StdChannelWriter;
|
|
@ -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(())
|
||||
}
|
||||
}
|
|
@ -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" }
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue