]>
git.proxmox.com Git - proxmox-backup.git/blob - src/tools/fs.rs
2 use std
::path
::PathBuf
;
4 use anyhow
::{format_err, Error}
;
5 use tokio
::task
::spawn_blocking
;
7 /// `proxmox_sys::fs::fs_into` wrapped in a `spawn_blocking` call.
8 pub async
fn fs_info(path
: PathBuf
) -> Result
<proxmox_sys
::fs
::FileSystemInformation
, Error
> {
9 Ok(spawn_blocking(move || proxmox_sys
::fs
::fs_info(&path
))
11 .map_err(|err
| format_err
!("error waiting for fs_info call: {err}"))??
)
14 /// `proxmox_sys::fs::fs_into` wrapped in a `spawn_blocking` call.
16 /// We cannot use `&'static CStr` in the above as we get from a C-string literal
17 /// because `NixPath` is only implemented directly on `CStr`, not on `&CStr`.
18 pub async
fn fs_info_static(
20 ) -> Result
<proxmox_sys
::fs
::FileSystemInformation
, Error
> {
21 Ok(spawn_blocking(move || proxmox_sys
::fs
::fs_info(path
))
23 .map_err(|err
| format_err
!("error waiting for fs_info call: {err}"))??
)