On 09.01.24 20:19, Jason Andryuk wrote:
On Thu, Jan 4, 2024 at 4:10 AM Juergen Gross <[email protected]> wrote:

Add the walk request of the 9pfs protocol.

Signed-off-by: Juergen Gross <[email protected]>

Reviewed-by: Jason Andryuk <[email protected]>

With one minor comment.

+    path = calloc(path_len + 1, 1);
+    if ( !path )
+    {
+        p9_error(ring, hdr->tag, ENOMEM);
+        goto out;
+    }
+    strcpy(path, fidp->path);
+
+    if ( n_names )
+    {
+        qids = calloc(n_names, sizeof(*qids));
+        if ( !qids )
+        {
+            p9_error(ring, hdr->tag, ENOMEM);
+            goto out;
+        }
+        for ( i = 0; i < n_names; i++ )
+        {
+            if (strcmp(path, "/"))
+                strcat(path, "/");

strcmp() can only return 0 on the first iteration, so it seems
inefficient to have it inside this loop.  But the added complexity to
avoid calling it doesn't seem worthwhile.

With storing the relative path in fidp->path this call can be dropped.


Juergen

Reply via email to