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

Re: [PATCH 13/29] tools/xenlogd: add 9pfs write request support



On Tue, Nov 7, 2023 at 9:43 AM Juergen Gross <jgross@xxxxxxxx> wrote:
>
> On 07.11.23 15:10, Jason Andryuk wrote:
> > On Wed, Nov 1, 2023 at 5:54 AM Juergen Gross <jgross@xxxxxxxx> wrote:
> >>
> >> Add the write request of the 9pfs protocol.
> >>
> >> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> >> ---
> >>   tools/xenlogd/io.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++
> >>   1 file changed, 50 insertions(+)
> >>
> >> diff --git a/tools/xenlogd/io.c b/tools/xenlogd/io.c
> >> index 6e92667fab..6b4692ca67 100644
> >> --- a/tools/xenlogd/io.c
> >> +++ b/tools/xenlogd/io.c
> >
> >> @@ -1010,6 +1011,51 @@ static void p9_create(device *device, struct 
> >> p9_header *hdr)
> >>       fill_buffer(device, hdr->cmd + 1, hdr->tag, "QU", &qid, &iounit);
> >>   }
> >>
> >> +static void p9_write(device *device, struct p9_header *hdr)
> >> +{
> >> +    uint32_t fid;
> >> +    uint64_t off;
> >> +    unsigned int len;
> >> +    uint32_t written;
> >> +    void *buf;
> >> +    struct p9_fid *fidp;
> >> +    int ret;
> >> +
> >> +    ret = fill_data(device, "ULD", &fid, &off, &len, device->buffer);
> >> +    if ( ret != 3 )
> >> +    {
> >> +        p9_error(device, hdr->tag, EINVAL);
> >> +        return;
> >> +    }
> >> +
> >> +    fidp = find_fid(device, fid);
> >> +    if ( !fidp || !fidp->opened || fidp->isdir )
> >
> > I think you want an additional check that the fidp is writable.
>
> The open was done with the correct mode. If fidp isn't writable, the write()
> will fail with the correct errno.

Oh, right.

Reviewed-by: Jason Andryuk <jandryuk@xxxxxxxxx>



 


Rackspace

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