[Libguestfs] [libnbd PATCH 4/4] api: Add DF flag support for pread

Richard W.M. Jones rjones at redhat.com
Tue May 28 09:26:18 UTC 2019


On Mon, May 27, 2019 at 09:01:01PM -0500, Eric Blake wrote:
> diff --git a/lib/rw.c b/lib/rw.c
> index feaf468..343c340 100644
> --- a/lib/rw.c
> +++ b/lib/rw.c
> @@ -234,11 +234,17 @@ int64_t
>  nbd_unlocked_aio_pread (struct nbd_handle *h, void *buf,
>                          size_t count, uint64_t offset, uint32_t flags)
>  {
> -  if (flags != 0) {
> +  if ((flags & ~LIBNBD_CMD_FLAG_DF) != 0) {
>      set_error (EINVAL, "invalid flag: %" PRIu32, flags);
>      return -1;
>    }
> 
> +  if ((flags & LIBNBD_CMD_FLAG_DF) != 0 &&
> +      nbd_unlocked_can_df (h) != 1) {
> +    set_error (EINVAL, "server does not support the DF flag");
> +    return -1;
> +  }

I'm confused why you'd want to specify this flag to pread.  From the
caller point of view they shouldn't care about whether the reply on
the wire is fragmented or not?

(I can understand why you'd need this flag if we implemented a
separate structured_pread call.)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list