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

Re: [PATCH v3 09/33] tools/xenlogd: add 9pfs walk request support



On Thu, Jan 4, 2024 at 4:10 AM Juergen Gross <jgross@xxxxxxxx> wrote:
>
> Add the walk request of the 9pfs protocol.
>
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>

Reviewed-by: Jason Andryuk <jandryuk@xxxxxxxxx>

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.

> +            strcat(path, ring->str + names[i]);
> +            ret = fill_qid(device, path, qids + i, NULL);
> +            if ( ret )
> +            {
> +                if ( !walked )
> +                {
> +                    p9_error(ring, hdr->tag, errno);
> +                    goto out;
> +                }
> +                break;
> +            }
> +            walked++;
> +        }
> +    }



 


Rackspace

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