* [pbs-devel] [PATCH backup 2/4] use C-string literals
2024-06-20 9:00 [pbs-devel] [PATCH backup 1/4] cargo: use default-features Maximiliano Sandoval
@ 2024-06-20 9:00 ` Maximiliano Sandoval
2024-06-20 9:00 ` [pbs-devel] [PATCH backup 3/4] datastore: use std::mem::ofset_of! Maximiliano Sandoval
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Maximiliano Sandoval @ 2024-06-20 9:00 UTC (permalink / raw)
To: pbs-devel
Requires Rust 1.77.0.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
Cargo.toml | 1 +
pbs-client/src/pxar/create.rs | 3 +--
src/api2/node/status.rs | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index abbde299..347b6370 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,7 @@ authors = [
edition = "2021"
license = "AGPL-3"
repository = "https://git.proxmox.com/?p=proxmox-backup.git"
+rust-version = "1.77"
[package]
name = "proxmox-backup"
diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
index 89a5b5ab..e5a9f75a 100644
--- a/pbs-client/src/pxar/create.rs
+++ b/pbs-client/src/pxar/create.rs
@@ -27,7 +27,6 @@ use pxar::{EntryKind, Metadata, PxarVariant};
use proxmox_human_byte::HumanByte;
use proxmox_io::vec;
-use proxmox_lang::c_str;
use proxmox_sys::fs::{self, acl, xattr};
use pbs_datastore::catalog::BackupCatalogWriter;
@@ -496,7 +495,7 @@ impl Archiver {
}
fn read_pxar_excludes(&mut self, parent: RawFd) -> Result<(), Error> {
- let fd = match self.open_file(parent, c_str!(".pxarexclude"), OFlag::O_RDONLY, false)? {
+ let fd = match self.open_file(parent, c".pxarexclude", OFlag::O_RDONLY, false)? {
Some(fd) => fd,
None => return Ok(()),
};
diff --git a/src/api2/node/status.rs b/src/api2/node/status.rs
index 07c20444..78913e4c 100644
--- a/src/api2/node/status.rs
+++ b/src/api2/node/status.rs
@@ -98,7 +98,7 @@ async fn get_status(
uname.machine(),
);
- let disk = crate::tools::fs::fs_info_static(proxmox_lang::c_str!("/")).await?;
+ let disk = crate::tools::fs::fs_info_static(c"/").await?;
let boot_info = boot_mode_to_info(boot_mode::BootMode::query(), boot_mode::SecureBoot::query());
--
2.39.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pbs-devel] [PATCH backup 3/4] datastore: use std::mem::ofset_of!
2024-06-20 9:00 [pbs-devel] [PATCH backup 1/4] cargo: use default-features Maximiliano Sandoval
2024-06-20 9:00 ` [pbs-devel] [PATCH backup 2/4] use C-string literals Maximiliano Sandoval
@ 2024-06-20 9:00 ` Maximiliano Sandoval
2024-06-20 9:00 ` [pbs-devel] [PATCH backup 4/4] fs: update comment to reflect usage of C-string literals Maximiliano Sandoval
2024-06-20 10:27 ` [pbs-devel] applied-series: [PATCH backup 1/4] cargo: use default-features Wolfgang Bumiller
3 siblings, 0 replies; 5+ messages in thread
From: Maximiliano Sandoval @ 2024-06-20 9:00 UTC (permalink / raw)
To: pbs-devel
Requires Rust 1.77.0.
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
pbs-datastore/src/data_blob.rs | 4 ++--
pbs-datastore/src/dynamic_index.rs | 2 +-
pbs-datastore/src/fixed_index.rs | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/pbs-datastore/src/data_blob.rs b/pbs-datastore/src/data_blob.rs
index 4119c4a4..e3039354 100644
--- a/pbs-datastore/src/data_blob.rs
+++ b/pbs-datastore/src/data_blob.rs
@@ -56,13 +56,13 @@ impl DataBlob {
/// accessor to crc32 checksum
pub fn crc(&self) -> u32 {
- let crc_o = proxmox_lang::offsetof!(DataBlobHeader, crc);
+ let crc_o = std::mem::offset_of!(DataBlobHeader, crc);
u32::from_le_bytes(self.raw_data[crc_o..crc_o + 4].try_into().unwrap())
}
// set the CRC checksum field
pub fn set_crc(&mut self, crc: u32) {
- let crc_o = proxmox_lang::offsetof!(DataBlobHeader, crc);
+ let crc_o = std::mem::offset_of!(DataBlobHeader, crc);
self.raw_data[crc_o..crc_o + 4].copy_from_slice(&crc.to_le_bytes());
}
diff --git a/pbs-datastore/src/dynamic_index.rs b/pbs-datastore/src/dynamic_index.rs
index dc9eee05..0e99ce58 100644
--- a/pbs-datastore/src/dynamic_index.rs
+++ b/pbs-datastore/src/dynamic_index.rs
@@ -353,7 +353,7 @@ impl DynamicIndexWriter {
self.writer.flush()?;
- let csum_offset = proxmox_lang::offsetof!(DynamicIndexHeader, index_csum);
+ let csum_offset = std::mem::offset_of!(DynamicIndexHeader, index_csum);
self.writer.seek(SeekFrom::Start(csum_offset as u64))?;
let csum = self.csum.take().unwrap();
diff --git a/pbs-datastore/src/fixed_index.rs b/pbs-datastore/src/fixed_index.rs
index 9ed943fa..d67c388e 100644
--- a/pbs-datastore/src/fixed_index.rs
+++ b/pbs-datastore/src/fixed_index.rs
@@ -349,7 +349,7 @@ impl FixedIndexWriter {
self.unmap()?;
- let csum_offset = proxmox_lang::offsetof!(FixedIndexHeader, index_csum);
+ let csum_offset = std::mem::offset_of!(FixedIndexHeader, index_csum);
self.file.seek(SeekFrom::Start(csum_offset as u64))?;
self.file.write_all(&index_csum)?;
self.file.flush()?;
--
2.39.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pbs-devel] [PATCH backup 4/4] fs: update comment to reflect usage of C-string literals
2024-06-20 9:00 [pbs-devel] [PATCH backup 1/4] cargo: use default-features Maximiliano Sandoval
2024-06-20 9:00 ` [pbs-devel] [PATCH backup 2/4] use C-string literals Maximiliano Sandoval
2024-06-20 9:00 ` [pbs-devel] [PATCH backup 3/4] datastore: use std::mem::ofset_of! Maximiliano Sandoval
@ 2024-06-20 9:00 ` Maximiliano Sandoval
2024-06-20 10:27 ` [pbs-devel] applied-series: [PATCH backup 1/4] cargo: use default-features Wolfgang Bumiller
3 siblings, 0 replies; 5+ messages in thread
From: Maximiliano Sandoval @ 2024-06-20 9:00 UTC (permalink / raw)
To: pbs-devel
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
src/tools/fs.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/tools/fs.rs b/src/tools/fs.rs
index 4eab0d56..78ecc3b8 100644
--- a/src/tools/fs.rs
+++ b/src/tools/fs.rs
@@ -13,8 +13,8 @@ pub async fn fs_info(path: PathBuf) -> Result<proxmox_sys::fs::FileSystemInforma
/// `proxmox_sys::fs::fs_into` wrapped in a `spawn_blocking` call.
///
-/// We cannot use `&'static CStr` in the above as we get from `proxmox_lang::c_str!` because
-/// `NixPath` is only implemented directly on `CStr`, not on `&CStr`.
+/// We cannot use `&'static CStr` in the above as we get from a C-string literal
+/// because `NixPath` is only implemented directly on `CStr`, not on `&CStr`.
pub async fn fs_info_static(
path: &'static CStr,
) -> Result<proxmox_sys::fs::FileSystemInformation, Error> {
--
2.39.2
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pbs-devel] applied-series: [PATCH backup 1/4] cargo: use default-features
2024-06-20 9:00 [pbs-devel] [PATCH backup 1/4] cargo: use default-features Maximiliano Sandoval
` (2 preceding siblings ...)
2024-06-20 9:00 ` [pbs-devel] [PATCH backup 4/4] fs: update comment to reflect usage of C-string literals Maximiliano Sandoval
@ 2024-06-20 10:27 ` Wolfgang Bumiller
3 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Bumiller @ 2024-06-20 10:27 UTC (permalink / raw)
To: Maximiliano Sandoval; +Cc: pbs-devel
applied, thanks
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
^ permalink raw reply [flat|nested] 5+ messages in thread