public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v3 proxmox-backup 01/10] client: tools: make tools module public
Date: Mon, 12 Aug 2024 12:31:30 +0200	[thread overview]
Message-ID: <20240812103139.288854-2-c.ebner@proxmox.com> (raw)
In-Reply-To: <20240812103139.288854-1-c.ebner@proxmox.com>

Change namespace visibility for tools submodule to be accessible from
other creates, to be used 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`.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
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<Mode, Error> {
+pub(crate) fn perms_from_metadata(meta: &Metadata) -> Result<Mode, Error> {
     let mode = meta.stat.get_permission_bits();
 
     u32::try_from(mode)
@@ -22,12 +22,14 @@ pub fn perms_from_metadata(meta: &Metadata) -> Result<Mode, Error> {
 }
 
 /// Make sure path is relative and not '.' or '..'.
-pub fn assert_relative_path<S: AsRef<OsStr> + ?Sized>(path: &S) -> Result<(), Error> {
+pub(crate) fn assert_relative_path<S: AsRef<OsStr> + ?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<S: AsRef<OsStr> + ?Sized>(path: &S) -> Result<(), Error> {
+pub(crate) fn assert_single_path_component<S: AsRef<OsStr> + ?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 6549ccf13..767a6668e 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.2



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  reply	other threads:[~2024-08-12 10:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 10:31 [pbs-devel] [PATCH v3 proxmox-backup 00/10] fix catalog dump and shell for split pxar archives Christian Ebner
2024-08-12 10:31 ` Christian Ebner [this message]
2024-08-12 10:31 ` [pbs-devel] [PATCH v3 proxmox-backup 02/10] client: pxar: move catalog lookup helper to pxar tools Christian Ebner
2024-08-12 10:31 ` [pbs-devel] [PATCH v3 proxmox-backup 03/10] client: tools: move pxar root entry helper to pxar submodule Christian Ebner
2024-08-12 10:31 ` [pbs-devel] [PATCH v3 proxmox-backup 04/10] client: make helper to get remote pxar reader reusable Christian Ebner
2024-08-12 10:31 ` [pbs-devel] [PATCH v3 proxmox-backup 05/10] client: tools: factor out entry path prefix helper Christian Ebner
2024-08-12 10:31 ` [pbs-devel] [PATCH v3 proxmox-backup 06/10] client: tools: factor out pxar entry to dir entry mapping Christian Ebner
2024-08-12 10:31 ` [pbs-devel] [PATCH v3 proxmox-backup 07/10] client: add helper to dump catalog from metadata archive Christian Ebner
2024-08-12 10:31 ` [pbs-devel] [PATCH v3 proxmox-backup 08/10] client: catalog: fallback to metadata archives for catalog dump Christian Ebner
2024-08-12 10:31 ` [pbs-devel] [PATCH v3 proxmox-backup 09/10] client: helper to mimic catalog find using metadata archive Christian Ebner
2024-08-12 10:31 ` [pbs-devel] [PATCH v3 proxmox-backup 10/10] client: catalog shell: fallback to accessor for navigation Christian Ebner
2024-10-21 14:09   ` Thomas Lamprecht
2024-10-21  9:09 ` [pbs-devel] [PATCH v3 proxmox-backup 00/10] fix catalog dump and shell for split pxar archives Christian Ebner
2024-10-21 14:07 ` Thomas Lamprecht
2024-10-21 14:09   ` Thomas Lamprecht
2024-10-21 14:16   ` Christian Ebner
2024-10-21 15:50 ` Christian Ebner

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=20240812103139.288854-2-c.ebner@proxmox.com \
    --to=c.ebner@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal