[pbs-devel] [PATCH proxmox-backup v2 2/2] use io_format_err, io_bail, io_err_other from proxmox-lang

Dominik Csapak d.csapak at proxmox.com
Mon Feb 21 11:39:18 CET 2022


and move the comment from the local io_bail in pbs-client/src/pxar/fuse.rs
to the only use

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 pbs-client/src/pxar/fuse.rs                  | 20 ++++-----------
 pbs-datastore/src/cached_chunk_reader.rs     |  4 +--
 pbs-tape/src/blocked_reader.rs               | 26 ++++++++++----------
 pbs-tape/src/blocked_writer.rs               |  2 +-
 pbs-tape/src/emulate_tape_reader.rs          |  4 +--
 pbs-tape/src/emulate_tape_writer.rs          |  4 +--
 pbs-tape/src/sg_tape.rs                      | 18 +++++++-------
 pbs-tape/src/tape_write.rs                   |  2 +-
 proxmox-rest-server/src/rest.rs              |  2 +-
 src/tape/drive/virtual_tape.rs               |  4 +--
 src/tape/file_formats/catalog_archive.rs     |  4 +--
 src/tape/file_formats/chunk_archive.rs       |  2 +-
 src/tape/file_formats/multi_volume_reader.rs | 10 ++++----
 src/tape/file_formats/multi_volume_writer.rs | 14 +++++------
 src/tape/file_formats/snapshot_archive.rs    |  8 +++---
 src/tools/disks/mod.rs                       |  4 +--
 16 files changed, 59 insertions(+), 69 deletions(-)

diff --git a/pbs-client/src/pxar/fuse.rs b/pbs-client/src/pxar/fuse.rs
index b039c6bd..0b90ff2c 100644
--- a/pbs-client/src/pxar/fuse.rs
+++ b/pbs-client/src/pxar/fuse.rs
@@ -25,6 +25,7 @@ use pxar::accessor::{self, EntryRangeInfo, ReadAt};
 
 use proxmox_fuse::requests::{self, FuseRequest};
 use proxmox_fuse::{EntryParam, Fuse, ReplyBufState, Request, ROOT_ID};
+use proxmox_lang::io_format_err;
 use proxmox_sys::fs::xattr;
 
 /// We mark inodes for regular files this way so we know how to access them.
@@ -110,20 +111,6 @@ macro_rules! io_return {
     }};
 }
 
-/// Format an "other" error, see `io_bail` below for details.
-macro_rules! io_format_err {
-    ($($fmt:tt)*) => {
-        ::std::io::Error::new(::std::io::ErrorKind::Other, format!($($fmt)*))
-    }
-}
-
-/// We use this to bail out of a functionin an unexpected error case. This will cause the fuse
-/// request to be answered with a generic `EIO` error code. The error message contained in here
-/// will be printed to stdout if the verbose flag is used, otherwise silently dropped.
-macro_rules! io_bail {
-    ($($fmt:tt)*) => { return Err(io_format_err!($($fmt)*).into()); }
-}
-
 /// This is what we need to cache as a "lookup" entry. The kernel assumes that these are easily
 /// accessed.
 struct Lookup {
@@ -157,7 +144,10 @@ impl Lookup {
         loop {
             let old = self.refs.load(Ordering::Acquire);
             if count >= old {
-                io_bail!("reference count underflow");
+                // We use this to bail out of a functionin an unexpected error case. This will cause the fuse
+                // request to be answered with a generic `EIO` error code. The error message contained in here
+                // will be printed to stdout if the verbose flag is used, otherwise silently dropped.
+                return Err(io_format_err!("reference count underflow").into());
             }
             let new = old - count;
             match self
diff --git a/pbs-datastore/src/cached_chunk_reader.rs b/pbs-datastore/src/cached_chunk_reader.rs
index 1fa26436..0a383904 100644
--- a/pbs-datastore/src/cached_chunk_reader.rs
+++ b/pbs-datastore/src/cached_chunk_reader.rs
@@ -10,8 +10,8 @@ use anyhow::Error;
 use futures::ready;
 use tokio::io::{AsyncRead, AsyncSeek, ReadBuf};
 
-use proxmox_sys::io_format_err;
-use proxmox_sys::error::io_err_other;
+use proxmox_lang::io_format_err;
+use proxmox_lang::error::io_err_other;
 
 use pbs_tools::async_lru_cache::{AsyncCacher, AsyncLruCache};
 
diff --git a/pbs-tape/src/blocked_reader.rs b/pbs-tape/src/blocked_reader.rs
index 5a05e081..b01361f3 100644
--- a/pbs-tape/src/blocked_reader.rs
+++ b/pbs-tape/src/blocked_reader.rs
@@ -69,11 +69,11 @@ impl <R: BlockRead> BlockedReader<R> {
     fn check_buffer(buffer: &BlockHeader, seq_nr: u32) -> Result<(usize, bool), std::io::Error> {
 
         if buffer.magic != PROXMOX_TAPE_BLOCK_HEADER_MAGIC_1_0 {
-            proxmox_sys::io_bail!("detected tape block with wrong magic number - not written by proxmox tape");
+            proxmox_lang::io_bail!("detected tape block with wrong magic number - not written by proxmox tape");
         }
 
         if seq_nr != buffer.seq_nr() {
-            proxmox_sys::io_bail!(
+            proxmox_lang::io_bail!(
                 "detected tape block with wrong sequence number ({} != {})",
                 seq_nr, buffer.seq_nr())
         }
@@ -82,9 +82,9 @@ impl <R: BlockRead> BlockedReader<R> {
         let found_end_marker = buffer.flags.contains(BlockHeaderFlags::END_OF_STREAM);
 
         if size > buffer.payload.len() {
-            proxmox_sys::io_bail!("detected tape block with wrong payload size ({} > {}", size, buffer.payload.len());
+            proxmox_lang::io_bail!("detected tape block with wrong payload size ({} > {}", size, buffer.payload.len());
         } else if size == 0 && !found_end_marker {
-            proxmox_sys::io_bail!("detected tape block with zero payload size");
+            proxmox_lang::io_bail!("detected tape block with zero payload size");
         }
 
 
@@ -103,7 +103,7 @@ impl <R: BlockRead> BlockedReader<R> {
         let bytes = reader.read_block(data)?;
 
         if bytes != BlockHeader::SIZE {
-            return Err(proxmox_sys::io_format_err!("got wrong block size").into());
+            return Err(proxmox_lang::io_format_err!("got wrong block size").into());
         }
 
         Ok(())
@@ -113,13 +113,13 @@ impl <R: BlockRead> BlockedReader<R> {
         let mut tmp_buf = [0u8; 512]; // use a small buffer for testing EOF
         match reader.read_block(&mut tmp_buf) {
             Ok(_) => {
-                proxmox_sys::io_bail!("detected tape block after block-stream end marker");
+                proxmox_lang::io_bail!("detected tape block after block-stream end marker");
             }
             Err(BlockReadError::EndOfFile) => {
                 Ok(())
             }
             Err(BlockReadError::EndOfStream) => {
-                proxmox_sys::io_bail!("got unexpected end of tape");
+                proxmox_lang::io_bail!("got unexpected end of tape");
             }
             Err(BlockReadError::Error(err)) => {
                 Err(err)
@@ -135,12 +135,12 @@ impl <R: BlockRead> BlockedReader<R> {
                 self.got_eod = true;
                 self.read_pos = self.buffer.payload.len();
                 if !self.found_end_marker && check_end_marker {
-                    proxmox_sys::io_bail!("detected tape stream without end marker");
+                    proxmox_lang::io_bail!("detected tape stream without end marker");
                 }
                 return Ok(0); // EOD
             }
             Err(BlockReadError::EndOfStream) => {
-                proxmox_sys::io_bail!("got unexpected end of tape");
+                proxmox_lang::io_bail!("got unexpected end of tape");
             }
             Err(BlockReadError::Error(err)) => {
                 return Err(err);
@@ -167,10 +167,10 @@ impl <R: BlockRead> TapeRead for BlockedReader<R> {
 
     fn is_incomplete(&self) -> Result<bool, std::io::Error> {
         if !self.got_eod {
-            proxmox_sys::io_bail!("is_incomplete failed: EOD not reached");
+            proxmox_lang::io_bail!("is_incomplete failed: EOD not reached");
         }
         if !self.found_end_marker {
-            proxmox_sys::io_bail!("is_incomplete failed: no end marker found");
+            proxmox_lang::io_bail!("is_incomplete failed: no end marker found");
         }
 
         Ok(self.incomplete)
@@ -178,7 +178,7 @@ impl <R: BlockRead> TapeRead for BlockedReader<R> {
 
     fn has_end_marker(&self) -> Result<bool, std::io::Error> {
         if !self.got_eod {
-            proxmox_sys::io_bail!("has_end_marker failed: EOD not reached");
+            proxmox_lang::io_bail!("has_end_marker failed: EOD not reached");
         }
 
         Ok(self.found_end_marker)
@@ -207,7 +207,7 @@ impl <R: BlockRead> Read for BlockedReader<R> {
     fn read(&mut self, buffer: &mut [u8]) -> Result<usize, std::io::Error> {
 
          if self.read_error {
-            proxmox_sys::io_bail!("detected read after error - internal error");
+            proxmox_lang::io_bail!("detected read after error - internal error");
         }
 
         let mut buffer_size = self.buffer.size();
diff --git a/pbs-tape/src/blocked_writer.rs b/pbs-tape/src/blocked_writer.rs
index e98db5d0..9d5d39e4 100644
--- a/pbs-tape/src/blocked_writer.rs
+++ b/pbs-tape/src/blocked_writer.rs
@@ -65,7 +65,7 @@ impl <W: BlockWrite> BlockedWriter<W> {
 
     fn write_eof(&mut self) -> Result<(), std::io::Error> {
         if self.wrote_eof {
-            proxmox_sys::io_bail!("BlockedWriter: detected multiple EOF writes");
+            proxmox_lang::io_bail!("BlockedWriter: detected multiple EOF writes");
         }
         self.wrote_eof = true;
 
diff --git a/pbs-tape/src/emulate_tape_reader.rs b/pbs-tape/src/emulate_tape_reader.rs
index 1e6454ce..6553c3b4 100644
--- a/pbs-tape/src/emulate_tape_reader.rs
+++ b/pbs-tape/src/emulate_tape_reader.rs
@@ -22,7 +22,7 @@ impl <R: Read> EmulateTapeReader<R> {
 impl <R: Read> BlockRead for EmulateTapeReader<R> {
     fn read_block(&mut self, buffer: &mut [u8]) -> Result<usize, BlockReadError> {
         if self.got_eof {
-             return Err(BlockReadError::Error(proxmox_sys::io_format_err!("detected read after EOF!")));
+             return Err(BlockReadError::Error(proxmox_lang::io_format_err!("detected read after EOF!")));
         }
         match self.reader.read_exact_or_eof(buffer)? {
             false => {
@@ -33,7 +33,7 @@ impl <R: Read> BlockRead for EmulateTapeReader<R> {
                 // test buffer len after EOF test (to allow EOF test with small buffers in BufferedReader)
                 if buffer.len() != PROXMOX_TAPE_BLOCK_SIZE {
                     return Err(BlockReadError::Error(
-                        proxmox_sys::io_format_err!(
+                        proxmox_lang::io_format_err!(
                             "EmulateTapeReader: read_block with wrong block size ({} != {})",
                             buffer.len(),
                             PROXMOX_TAPE_BLOCK_SIZE,
diff --git a/pbs-tape/src/emulate_tape_writer.rs b/pbs-tape/src/emulate_tape_writer.rs
index 04ad697e..bae427c7 100644
--- a/pbs-tape/src/emulate_tape_writer.rs
+++ b/pbs-tape/src/emulate_tape_writer.rs
@@ -39,7 +39,7 @@ impl <W: Write> BlockWrite for EmulateTapeWriter<W> {
     fn write_block(&mut self, buffer: &[u8]) -> Result<bool, io::Error> {
 
         if buffer.len() != PROXMOX_TAPE_BLOCK_SIZE {
-            proxmox_sys::io_bail!("EmulateTapeWriter: got write with wrong block size ({} != {}",
+            proxmox_lang::io_bail!("EmulateTapeWriter: got write with wrong block size ({} != {}",
                               buffer.len(), PROXMOX_TAPE_BLOCK_SIZE);
         }
 
@@ -59,7 +59,7 @@ impl <W: Write> BlockWrite for EmulateTapeWriter<W> {
 
     fn write_filemark(&mut self) -> Result<(), std::io::Error> {
         if self.wrote_eof {
-            proxmox_sys::io_bail!("EmulateTapeWriter: detected multiple EOF writes");
+            proxmox_lang::io_bail!("EmulateTapeWriter: detected multiple EOF writes");
         }
         // do nothing, just record the call
         self.wrote_eof = true;
diff --git a/pbs-tape/src/sg_tape.rs b/pbs-tape/src/sg_tape.rs
index 9801ad47..e0590671 100644
--- a/pbs-tape/src/sg_tape.rs
+++ b/pbs-tape/src/sg_tape.rs
@@ -528,11 +528,11 @@ impl SgTape {
     ) ->  Result<(), std::io::Error> {
 
         if count > 255 {
-            proxmox_sys::io_bail!("write_filemarks failed: got strange count '{}'", count);
+            proxmox_lang::io_bail!("write_filemarks failed: got strange count '{}'", count);
         }
 
         let mut sg_raw = SgRaw::new(&mut self.file, 16)
-            .map_err(|err| proxmox_sys::io_format_err!("write_filemarks failed (alloc) - {}", err))?;
+            .map_err(|err| proxmox_lang::io_format_err!("write_filemarks failed (alloc) - {}", err))?;
 
         sg_raw.set_timeout(Self::SCSI_TAPE_DEFAULT_TIMEOUT);
         let mut cmd = Vec::new();
@@ -551,7 +551,7 @@ impl SgTape {
                 /* LEOM - ignore */
             }
             Err(err) => {
-                proxmox_sys::io_bail!("write filemark  failed - {}", err);
+                proxmox_lang::io_bail!("write filemark  failed - {}", err);
             }
         }
 
@@ -630,7 +630,7 @@ impl SgTape {
         let transfer_len = data.len();
 
         if transfer_len > 0x800000 {
-           proxmox_sys::io_bail!("write failed - data too large");
+           proxmox_lang::io_bail!("write failed - data too large");
         }
 
         let mut sg_raw = SgRaw::new(&mut self.file, 0)
@@ -654,7 +654,7 @@ impl SgTape {
                 Ok(true) // LEOM
             }
             Err(err) => {
-                proxmox_sys::io_bail!("write failed - {}", err);
+                proxmox_lang::io_bail!("write failed - {}", err);
             }
         }
     }
@@ -664,7 +664,7 @@ impl SgTape {
 
         if transfer_len > 0xFFFFFF {
             return Err(BlockReadError::Error(
-                proxmox_sys::io_format_err!("read failed - buffer too large")
+                proxmox_lang::io_format_err!("read failed - buffer too large")
             ));
         }
 
@@ -691,14 +691,14 @@ impl SgTape {
             }
             Err(err) => {
                 return Err(BlockReadError::Error(
-                    proxmox_sys::io_format_err!("read failed - {}", err)
+                    proxmox_lang::io_format_err!("read failed - {}", err)
                 ));
             }
         };
 
         if data.len() != transfer_len {
             return Err(BlockReadError::Error(
-                proxmox_sys::io_format_err!("read failed - unexpected block len ({} != {})", data.len(), buffer.len())
+                proxmox_lang::io_format_err!("read failed - unexpected block len ({} != {})", data.len(), buffer.len())
             ));
         }
 
@@ -949,7 +949,7 @@ impl <'a> BlockRead for SgTapeReader<'a> {
 
     fn read_block(&mut self, buffer: &mut [u8]) -> Result<usize, BlockReadError> {
         if self.end_of_file {
-            return Err(BlockReadError::Error(proxmox_sys::io_format_err!("detected read after EOF!")));
+            return Err(BlockReadError::Error(proxmox_lang::io_format_err!("detected read after EOF!")));
         }
         match self.sg_tape.read_block(buffer) {
             Ok(usize) => Ok(usize),
diff --git a/pbs-tape/src/tape_write.rs b/pbs-tape/src/tape_write.rs
index 321fb5d8..0d52e71d 100644
--- a/pbs-tape/src/tape_write.rs
+++ b/pbs-tape/src/tape_write.rs
@@ -34,7 +34,7 @@ pub trait TapeWrite {
         data: &[u8],
     ) -> Result<bool, std::io::Error> {
         if header.size as usize != data.len() {
-            proxmox_sys::io_bail!("write_header with wrong size - internal error");
+            proxmox_lang::io_bail!("write_header with wrong size - internal error");
         }
         let header = header.to_le();
 
diff --git a/proxmox-rest-server/src/rest.rs b/proxmox-rest-server/src/rest.rs
index 5194151c..3343d5d6 100644
--- a/proxmox-rest-server/src/rest.rs
+++ b/proxmox-rest-server/src/rest.rs
@@ -476,7 +476,7 @@ pub(crate) async fn handle_api_request<Env: RpcEnvironment, S: 'static + BuildHa
             resp.map(|body| {
                 Body::wrap_stream(DeflateEncoder::with_quality(
                     TryStreamExt::map_err(body, |err| {
-                        proxmox_sys::io_format_err!("error during compression: {}", err)
+                        proxmox_lang::io_format_err!("error during compression: {}", err)
                     }),
                     Level::Default,
                 ))
diff --git a/src/tape/drive/virtual_tape.rs b/src/tape/drive/virtual_tape.rs
index 186e87ac..21f91e2b 100644
--- a/src/tape/drive/virtual_tape.rs
+++ b/src/tape/drive/virtual_tape.rs
@@ -309,7 +309,7 @@ impl TapeDriver for VirtualTapeHandle {
                 Ok(Box::new(reader))
             }
             None => {
-                return Err(BlockReadError::Error(proxmox_sys::io_format_err!("drive is empty (no tape loaded).")));
+                return Err(BlockReadError::Error(proxmox_lang::io_format_err!("drive is empty (no tape loaded).")));
             }
         }
     }
@@ -362,7 +362,7 @@ impl TapeDriver for VirtualTapeHandle {
 
                 Ok(writer)
             }
-            None => proxmox_sys::io_bail!("drive is empty (no tape loaded)."),
+            None => proxmox_lang::io_bail!("drive is empty (no tape loaded)."),
         }
     }
 
diff --git a/src/tape/file_formats/catalog_archive.rs b/src/tape/file_formats/catalog_archive.rs
index 04a60319..4e8b8fdf 100644
--- a/src/tape/file_formats/catalog_archive.rs
+++ b/src/tape/file_formats/catalog_archive.rs
@@ -61,13 +61,13 @@ pub fn tape_write_catalog<'a>(
         while remaining != 0 {
             let got = file.read(&mut file_copy_buffer[..])?;
             if got as u64 > remaining {
-                proxmox_sys::io_bail!("catalog '{}' changed while reading", uuid);
+                proxmox_lang::io_bail!("catalog '{}' changed while reading", uuid);
             }
             writer.write_all(&file_copy_buffer[..got])?;
             remaining -= got as u64;
         }
         if remaining > 0 {
-            proxmox_sys::io_bail!("catalog '{}' shrunk while reading", uuid);
+            proxmox_lang::io_bail!("catalog '{}' shrunk while reading", uuid);
         }
         Ok(())
     });
diff --git a/src/tape/file_formats/chunk_archive.rs b/src/tape/file_formats/chunk_archive.rs
index 40479700..827dc347 100644
--- a/src/tape/file_formats/chunk_archive.rs
+++ b/src/tape/file_formats/chunk_archive.rs
@@ -69,7 +69,7 @@ impl <'a> ChunkArchiveWriter<'a> {
     fn write_all(&mut self, data: &[u8]) -> Result<bool, std::io::Error> {
         match self.writer {
             Some(ref mut writer) => writer.write_all(data),
-            None => proxmox_sys::io_bail!(
+            None => proxmox_lang::io_bail!(
                 "detected write after archive finished - internal error"),
         }
     }
diff --git a/src/tape/file_formats/multi_volume_reader.rs b/src/tape/file_formats/multi_volume_reader.rs
index cc0d52ab..fcc1d3c0 100644
--- a/src/tape/file_formats/multi_volume_reader.rs
+++ b/src/tape/file_formats/multi_volume_reader.rs
@@ -48,23 +48,23 @@ impl <'a> Read for MultiVolumeReader<'a> {
 
         if self.reader.is_none() {
             let mut reader = (self.next_reader_fn)()
-                .map_err(|err| proxmox_sys::io_format_err!("multi-volume next failed: {}", err))?;
+                .map_err(|err| proxmox_lang::io_format_err!("multi-volume next failed: {}", err))?;
 
             proxmox_lang::try_block!({
                 let part_header: MediaContentHeader = unsafe { reader.read_le_value()? };
                 self.reader = Some(reader);
 
                 if part_header.uuid != self.header.uuid {
-                    proxmox_sys::io_bail!("got wrong part uuid");
+                    proxmox_lang::io_bail!("got wrong part uuid");
                 }
                 if part_header.content_magic!= self.header.content_magic {
-                    proxmox_sys::io_bail!("got wrong part content magic");
+                    proxmox_lang::io_bail!("got wrong part content magic");
                 }
 
                 let expect_part_number = self.header.part_number + 1;
 
                 if part_header.part_number != expect_part_number {
-                    proxmox_sys::io_bail!("got wrong part number ({} != {})",
+                    proxmox_lang::io_bail!("got wrong part number ({} != {})",
                                       part_header.part_number, expect_part_number);
                 }
 
@@ -72,7 +72,7 @@ impl <'a> Read for MultiVolumeReader<'a> {
 
                 Ok(())
             }).map_err(|err| {
-                proxmox_sys::io_format_err!("multi-volume read content header failed: {}", err)
+                proxmox_lang::io_format_err!("multi-volume read content header failed: {}", err)
             })?;
          }
 
diff --git a/src/tape/file_formats/multi_volume_writer.rs b/src/tape/file_formats/multi_volume_writer.rs
index d1b2c70b..bca2a27f 100644
--- a/src/tape/file_formats/multi_volume_writer.rs
+++ b/src/tape/file_formats/multi_volume_writer.rs
@@ -53,16 +53,16 @@ impl <'a> TapeWrite for MultiVolumeWriter<'a> {
     fn write_all(&mut self, buf: &[u8]) -> Result<bool, std::io::Error> {
 
         if self.finished {
-            proxmox_sys::io_bail!("multi-volume writer already finished: internal error");
+            proxmox_lang::io_bail!("multi-volume writer already finished: internal error");
         }
 
         if self.got_leom {
             if !self.wrote_header {
-                proxmox_sys::io_bail!("multi-volume writer: got LEOM before writing anything - internal error");
+                proxmox_lang::io_bail!("multi-volume writer: got LEOM before writing anything - internal error");
             }
             let mut writer = match self.writer.take() {
                 Some(writer) => writer,
-                None =>  proxmox_sys::io_bail!("multi-volume writer: no writer  -internal error"),
+                None =>  proxmox_lang::io_bail!("multi-volume writer: no writer  -internal error"),
             };
             self.bytes_written = writer.bytes_written();
             writer.finish(true)?;
@@ -70,11 +70,11 @@ impl <'a> TapeWrite for MultiVolumeWriter<'a> {
 
         if self.writer.is_none() {
             if self.header.part_number == u8::MAX {
-                proxmox_sys::io_bail!("multi-volume writer: too many parts");
+                proxmox_lang::io_bail!("multi-volume writer: too many parts");
             }
             self.writer = Some(
                 (self.next_writer_fn)()
-                    .map_err(|err| proxmox_sys::io_format_err!("multi-volume get next volume failed: {}", err))?
+                    .map_err(|err| proxmox_lang::io_format_err!("multi-volume get next volume failed: {}", err))?
             );
             self.got_leom = false;
             self.wrote_header = false;
@@ -107,12 +107,12 @@ impl <'a> TapeWrite for MultiVolumeWriter<'a> {
 
     fn finish(&mut self, incomplete: bool) -> Result<bool, std::io::Error> {
         if incomplete {
-            proxmox_sys::io_bail!(
+            proxmox_lang::io_bail!(
                 "incomplete flag makes no sense for multi-volume stream: internal error");
         }
 
         match self.writer.take() {
-            None if self.finished => proxmox_sys::io_bail!(
+            None if self.finished => proxmox_lang::io_bail!(
                 "multi-volume writer already finished: internal error"),
             None => Ok(false),
             Some(ref mut writer) => {
diff --git a/src/tape/file_formats/snapshot_archive.rs b/src/tape/file_formats/snapshot_archive.rs
index d3bd590b..51ba6015 100644
--- a/src/tape/file_formats/snapshot_archive.rs
+++ b/src/tape/file_formats/snapshot_archive.rs
@@ -58,14 +58,14 @@ pub fn tape_write_snapshot_archive<'a>(
         for filename in file_list.iter() {
 
             let mut file = snapshot_reader.open_file(filename)
-                .map_err(|err| proxmox_sys::io_format_err!("open file '{}' failed - {}", filename, err))?;
+                .map_err(|err| proxmox_lang::io_format_err!("open file '{}' failed - {}", filename, err))?;
             let metadata = file.metadata()?;
             let file_size = metadata.len();
 
             let metadata: pxar::Metadata = metadata.into();
 
             if !metadata.is_regular_file() {
-                proxmox_sys::io_bail!("file '{}' is not a regular file", filename);
+                proxmox_lang::io_bail!("file '{}' is not a regular file", filename);
             }
 
             let mut remaining = file_size;
@@ -73,14 +73,14 @@ pub fn tape_write_snapshot_archive<'a>(
             while remaining != 0 {
                 let got = file.read(&mut file_copy_buffer[..])?;
                 if got as u64 > remaining {
-                    proxmox_sys::io_bail!("file '{}' changed while reading", filename);
+                    proxmox_lang::io_bail!("file '{}' changed while reading", filename);
                 }
                 out.write_all(&file_copy_buffer[..got])?;
                 remaining -= got as u64;
 
             }
             if remaining > 0 {
-                proxmox_sys::io_bail!("file '{}' shrunk while reading", filename);
+                proxmox_lang::io_bail!("file '{}' shrunk while reading", filename);
             }
         }
         encoder.finish()?;
diff --git a/src/tools/disks/mod.rs b/src/tools/disks/mod.rs
index 267de8d4..94da7b3a 100644
--- a/src/tools/disks/mod.rs
+++ b/src/tools/disks/mod.rs
@@ -15,9 +15,9 @@ use once_cell::sync::OnceCell;
 use ::serde::{Deserialize, Serialize};
 
 use proxmox_schema::api;
-use proxmox_sys::error::io_err_other;
+use proxmox_lang::error::io_err_other;
 use proxmox_sys::linux::procfs::{mountinfo::Device, MountInfo};
-use proxmox_sys::{io_bail, io_format_err};
+use proxmox_lang::{io_bail, io_format_err};
 
 use pbs_api_types::{StorageStatus, BLOCKDEVICE_NAME_REGEX};
 
-- 
2.30.2






More information about the pbs-devel mailing list