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

Re: [PATCH 7/7] Mini-OS: add read and write support to 9pfsfront



Juergen Gross, le ven. 03 févr. 2023 10:18:09 +0100, a ecrit:
> This patch is missing the limitation of read/write messages to stay
> below the max. supported message size.

It should at least be asserted.

> +static int p9_read(struct dev_9pfs *dev, uint32_t fid, uint64_t offset,
> +                   uint8_t *data, uint32_t len)
> +{
> +    struct req *req = get_free_req(dev);
> +    int ret;
> +    uint32_t count;
> +
> +    if ( !req )
> +    {
> +        errno = EIO;

Here as well (and in p9_write) we'd want EAGAIN rather than EIO which
can be mistaken with the error case below.

> +        return -1;
> +    }
> +
> +    req->cmd = P9_CMD_READ;
> +    send_9p(dev, req, "ULU", fid, offset, len);
> +    rcv_9p(dev, req, "D", &count, data);
> +
> +    if ( req->result )
> +    {
> +        ret = -1;
> +        errno = EIO;
> +    }
> +    else
> +        ret = count;
> +
> +    put_free_req(dev, req);
> +
> +    return ret;
> +}

Samuel



 


Rackspace

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