pbs-client: drop deprecated Fd usage
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
61dd5af5aa
commit
4cceaf3a2d
@ -3,7 +3,7 @@ use std::ffi::{CStr, CString, OsStr};
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
use std::os::unix::ffi::OsStrExt;
|
use std::os::unix::ffi::OsStrExt;
|
||||||
use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
|
use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
@ -22,7 +22,6 @@ use pxar::Metadata;
|
|||||||
use proxmox_io::vec;
|
use proxmox_io::vec;
|
||||||
use proxmox_lang::c_str;
|
use proxmox_lang::c_str;
|
||||||
use proxmox_sys::error::SysError;
|
use proxmox_sys::error::SysError;
|
||||||
use proxmox_sys::fd::Fd;
|
|
||||||
use proxmox_sys::fd::RawFdNum;
|
use proxmox_sys::fd::RawFdNum;
|
||||||
use proxmox_sys::fs::{self, acl, xattr};
|
use proxmox_sys::fs::{self, acl, xattr};
|
||||||
|
|
||||||
@ -315,13 +314,13 @@ impl Archiver {
|
|||||||
file_name: &CStr,
|
file_name: &CStr,
|
||||||
oflags: OFlag,
|
oflags: OFlag,
|
||||||
existed: bool,
|
existed: bool,
|
||||||
) -> Result<Option<Fd>, Error> {
|
) -> Result<Option<OwnedFd>, Error> {
|
||||||
// common flags we always want to use:
|
// common flags we always want to use:
|
||||||
let oflags = oflags | OFlag::O_CLOEXEC | OFlag::O_NOCTTY;
|
let oflags = oflags | OFlag::O_CLOEXEC | OFlag::O_NOCTTY;
|
||||||
|
|
||||||
let mut noatime = OFlag::O_NOATIME;
|
let mut noatime = OFlag::O_NOATIME;
|
||||||
loop {
|
loop {
|
||||||
return match Fd::openat(
|
return match proxmox_sys::fd::openat(
|
||||||
&unsafe { RawFdNum::from_raw_fd(parent) },
|
&unsafe { RawFdNum::from_raw_fd(parent) },
|
||||||
file_name,
|
file_name,
|
||||||
oflags | noatime,
|
oflags | noatime,
|
||||||
@ -725,7 +724,7 @@ impl Archiver {
|
|||||||
async fn add_regular_file<T: SeqWrite + Send>(
|
async fn add_regular_file<T: SeqWrite + Send>(
|
||||||
&mut self,
|
&mut self,
|
||||||
encoder: &mut Encoder<'_, T>,
|
encoder: &mut Encoder<'_, T>,
|
||||||
fd: Fd,
|
fd: OwnedFd,
|
||||||
file_name: &Path,
|
file_name: &Path,
|
||||||
metadata: &Metadata,
|
metadata: &Metadata,
|
||||||
file_size: u64,
|
file_size: u64,
|
||||||
@ -764,7 +763,7 @@ impl Archiver {
|
|||||||
async fn add_symlink<T: SeqWrite + Send>(
|
async fn add_symlink<T: SeqWrite + Send>(
|
||||||
&mut self,
|
&mut self,
|
||||||
encoder: &mut Encoder<'_, T>,
|
encoder: &mut Encoder<'_, T>,
|
||||||
fd: Fd,
|
fd: OwnedFd,
|
||||||
file_name: &Path,
|
file_name: &Path,
|
||||||
metadata: &Metadata,
|
metadata: &Metadata,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
|
@ -66,7 +66,7 @@ pub fn apply_at(
|
|||||||
path_info: &Path,
|
path_info: &Path,
|
||||||
on_error: &mut (dyn FnMut(Error) -> Result<(), Error> + Send),
|
on_error: &mut (dyn FnMut(Error) -> Result<(), Error> + Send),
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let fd = proxmox_sys::fd::Fd::openat(
|
let fd = proxmox_sys::fd::openat(
|
||||||
&unsafe { RawFdNum::from_raw_fd(parent) },
|
&unsafe { RawFdNum::from_raw_fd(parent) },
|
||||||
file_name,
|
file_name,
|
||||||
OFlag::O_PATH | OFlag::O_CLOEXEC | OFlag::O_NOFOLLOW,
|
OFlag::O_PATH | OFlag::O_CLOEXEC | OFlag::O_NOFOLLOW,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user