From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C8D881FF15F for ; Mon, 21 Oct 2024 17:47:29 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 088AF37F4C; Mon, 21 Oct 2024 17:48:06 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Mon, 21 Oct 2024 17:47:35 +0200 Message-Id: <20241021154744.325556-2-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241021154744.325556-1-c.ebner@proxmox.com> References: <20241021154744.325556-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.027 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH v4 proxmox-backup 01/10] client: tools: make tools module public X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Change namespace visibility for tools module for it to be accessible from other creates. This allows to use it for common pxar related helpers. Switch helpers declared as `pub` to `pub(crate)` in order to keep module encapsulation, adapt namespace for functions required to be `pub`. This is done in preparation for refactoring common pxar code to the module in subsequent patches. No functional changes. Signed-off-by: Christian Ebner --- changes since version 3: - s/submodule/module - Reword commit message in order to clarify intend of this and subsequent patches changes since version 2: - not present in previous version pbs-client/src/catalog_shell.rs | 2 +- pbs-client/src/pxar/mod.rs | 4 +--- pbs-client/src/pxar/tools.rs | 8 +++++--- pxar-bin/src/main.rs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pbs-client/src/catalog_shell.rs b/pbs-client/src/catalog_shell.rs index 349bb7cbc..f568f6676 100644 --- a/pbs-client/src/catalog_shell.rs +++ b/pbs-client/src/catalog_shell.rs @@ -705,7 +705,7 @@ impl Shell { let file = Self::walk_pxar_archive(&self.accessor, &mut stack).await?; std::io::stdout() - .write_all(crate::pxar::format_multi_line_entry(file.entry()).as_bytes())?; + .write_all(crate::pxar::tools::format_multi_line_entry(file.entry()).as_bytes())?; Ok(()) } diff --git a/pbs-client/src/pxar/mod.rs b/pbs-client/src/pxar/mod.rs index 334759df6..661501782 100644 --- a/pbs-client/src/pxar/mod.rs +++ b/pbs-client/src/pxar/mod.rs @@ -52,7 +52,7 @@ pub(crate) mod dir_stack; pub(crate) mod extract; pub(crate) mod look_ahead_cache; pub(crate) mod metadata; -pub(crate) mod tools; +pub mod tools; mod flags; pub use flags::Flags; @@ -69,5 +69,3 @@ pub use extract::{ /// memory, so we restrict the number of allowed entries to limit /// maximum memory usage. pub const ENCODER_MAX_ENTRIES: usize = 1024 * 1024; - -pub use tools::{format_multi_line_entry, format_single_line_entry}; diff --git a/pbs-client/src/pxar/tools.rs b/pbs-client/src/pxar/tools.rs index 27e5185a3..9d4ad6a4f 100644 --- a/pbs-client/src/pxar/tools.rs +++ b/pbs-client/src/pxar/tools.rs @@ -10,7 +10,7 @@ use nix::sys::stat::Mode; use pxar::{format::StatxTimestamp, mode, Entry, EntryKind, Metadata}; /// Get the file permissions as `nix::Mode` -pub fn perms_from_metadata(meta: &Metadata) -> Result { +pub(crate) fn perms_from_metadata(meta: &Metadata) -> Result { let mode = meta.stat.get_permission_bits(); u32::try_from(mode) @@ -22,12 +22,14 @@ pub fn perms_from_metadata(meta: &Metadata) -> Result { } /// Make sure path is relative and not '.' or '..'. -pub fn assert_relative_path + ?Sized>(path: &S) -> Result<(), Error> { +pub(crate) fn assert_relative_path + ?Sized>(path: &S) -> Result<(), Error> { assert_relative_path_do(Path::new(path)) } /// Make sure path is a single component and not '.' or '..'. -pub fn assert_single_path_component + ?Sized>(path: &S) -> Result<(), Error> { +pub(crate) fn assert_single_path_component + ?Sized>( + path: &S, +) -> Result<(), Error> { assert_single_path_component_do(Path::new(path)) } diff --git a/pxar-bin/src/main.rs b/pxar-bin/src/main.rs index 9d822eae2..2fc0d1bb5 100644 --- a/pxar-bin/src/main.rs +++ b/pxar-bin/src/main.rs @@ -12,9 +12,9 @@ use futures::select; use tokio::signal::unix::{signal, SignalKind}; use pathpatterns::{MatchEntry, MatchType, PatternFlag}; +use pbs_client::pxar::tools::format_single_line_entry; use pbs_client::pxar::{ - format_single_line_entry, Flags, OverwriteFlags, PxarExtractOptions, PxarWriters, - ENCODER_MAX_ENTRIES, + Flags, OverwriteFlags, PxarExtractOptions, PxarWriters, ENCODER_MAX_ENTRIES, }; use pxar::EntryKind; -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel