[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[UNIKRAFT PATCH v2 4/9] lib/uk9p: Simplify uk_9p_walk serialization



Unifies two if branches with common code in uk_9p_walk.

Signed-off-by: Cristian Banu <cristb@xxxxxxxxx>
---
 lib/uk9p/9p.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/lib/uk9p/9p.c b/lib/uk9p/9p.c
index 638555b..f17a938 100644
--- a/lib/uk9p/9p.c
+++ b/lib/uk9p/9p.c
@@ -195,22 +195,15 @@ struct uk_9pfid *uk_9p_walk(struct uk_9pdev *dev, struct 
uk_9pfid *fid,
                goto out;
        }
 
-       if (name) {
-               uk_pr_debug("TWALK fid %u newfid %u nwname %d name %s\n",
-                               fid->fid, newfid->fid, nwname, name);
-               if ((rc = uk_9preq_write32(req, fid->fid)) ||
-                       (rc = uk_9preq_write32(req, newfid->fid)) ||
-                       (rc = uk_9preq_write16(req, nwname)) ||
-                       (rc = uk_9preq_writestr(req, &name_str)))
-                       goto out;
-       } else {
-               uk_pr_debug("TWALK fid %u newfid %u nwname %d\n",
-                               fid->fid, newfid->fid, nwname);
-               if ((rc = uk_9preq_write32(req, fid->fid)) ||
-                       (rc = uk_9preq_write32(req, newfid->fid)) ||
-                       (rc = uk_9preq_write16(req, nwname)))
-                       goto out;
-       }
+       uk_pr_debug("TWALK fid %u newfid %u nwname %d name %s\n",
+               fid->fid, newfid->fid, nwname, name ? name : "<NULL>");
+
+       if ((rc = uk_9preq_write32(req, fid->fid)) ||
+               (rc = uk_9preq_write32(req, newfid->fid)) ||
+               (rc = uk_9preq_write16(req, nwname)))
+               goto out;
+       if (name && (rc = uk_9preq_writestr(req, &name_str)))
+               goto out;
 
        if ((rc = send_and_wait_no_zc(dev, req))) {
                /*
-- 
2.26.2




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.