From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH backup 3/4] datastore: use std::mem::ofset_of!
Date: Thu, 20 Jun 2024 11:00:07 +0200 [thread overview]
Message-ID: <20240620090008.1823043-3-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20240620090008.1823043-1-m.sandoval@proxmox.com>
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
next prev parent reply other threads:[~2024-06-20 9:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2024-06-20 9:00 ` [pbs-devel] [PATCH backup 4/4] fs: update comment to reflect usage of " Maximiliano Sandoval
2024-06-20 10:27 ` [pbs-devel] applied-series: [PATCH backup 1/4] cargo: use default-features Wolfgang Bumiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240620090008.1823043-3-m.sandoval@proxmox.com \
--to=m.sandoval@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.