public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH backup v4 1/2] pxar-fuse: use ReplyBufState::is_full() when possible
Date: Wed, 14 Feb 2024 09:23:34 +0100	[thread overview]
Message-ID: <20240214082335.77143-1-m.sandoval@proxmox.com> (raw)

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
Differences from vN-1:
 - Separate into two commits
 - Leave unrelated changes for a follow up patch

 pbs-pxar-fuse/src/lib.rs | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/pbs-pxar-fuse/src/lib.rs b/pbs-pxar-fuse/src/lib.rs
index 98d28c57..bf196b6c 100644
--- a/pbs-pxar-fuse/src/lib.rs
+++ b/pbs-pxar-fuse/src/lib.rs
@@ -525,9 +525,11 @@ impl SessionImpl {
             let file = file?.decode_entry().await?;
             let stat = to_stat(to_inode(&file), &file)?;
             let name = file.file_name();
-            match request.add_entry(name, &stat, next, 1, f64::MAX, f64::MAX)? {
-                ReplyBufState::Ok => (),
-                ReplyBufState::Full => return Ok(lookups),
+            if request
+                .add_entry(name, &stat, next, 1, f64::MAX, f64::MAX)?
+                .is_full()
+            {
+                return Ok(lookups);
             }
             lookups.push(self.make_lookup(request.inode, stat.st_ino, &file)?);
         }
@@ -537,9 +539,11 @@ impl SessionImpl {
             let file = dir.lookup_self().await?;
             let stat = to_stat(to_inode(&file), &file)?;
             let name = OsStr::new(".");
-            match request.add_entry(name, &stat, next, 1, f64::MAX, f64::MAX)? {
-                ReplyBufState::Ok => (),
-                ReplyBufState::Full => return Ok(lookups),
+            if request
+                .add_entry(name, &stat, next, 1, f64::MAX, f64::MAX)?
+                .is_full()
+            {
+                return Ok(lookups);
             }
             lookups.push(LookupRef::clone(&dir_lookup));
         }
@@ -551,9 +555,11 @@ impl SessionImpl {
             let file = parent_dir.lookup_self().await?;
             let stat = to_stat(to_inode(&file), &file)?;
             let name = OsStr::new("..");
-            match request.add_entry(name, &stat, next, 1, f64::MAX, f64::MAX)? {
-                ReplyBufState::Ok => (),
-                ReplyBufState::Full => return Ok(lookups),
+            if request
+                .add_entry(name, &stat, next, 1, f64::MAX, f64::MAX)?
+                .is_full()
+            {
+                return Ok(lookups);
             }
             lookups.push(lookup);
         }
@@ -619,9 +625,8 @@ impl SessionImpl {
         let xattrs = self.listxattrs(request.inode).await?;
 
         for entry in xattrs {
-            match request.add_c_string(entry.name()) {
-                ReplyBufState::Ok => (),
-                ReplyBufState::Full => return Ok(ReplyBufState::Full),
+            if request.add_c_string(entry.name()).is_full() {
+                return Ok(ReplyBufState::Full);
             }
         }
 
-- 
2.39.2





             reply	other threads:[~2024-02-14  8:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-14  8:23 Maximiliano Sandoval [this message]
2024-02-14  8:23 ` [pbs-devel] [PATCH backup v4 2/2] api: use if-let pattern for error-only handling Maximiliano Sandoval
2024-03-25 17:03 ` [pbs-devel] applied-series: [PATCH backup v4 1/2] pxar-fuse: use ReplyBufState::is_full() when possible Thomas Lamprecht

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=20240214082335.77143-1-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 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