search for: nbd_callback_set_add

Displaying 3 results from an estimated 3 matches for "nbd_callback_set_add".

2019 May 28
1
Re: [libnbd PATCH 4/4] api: Add DF flag support for pread
..., or error. The signature may still need tweaking. > Or we may even want to let the user register a set of callbacks, where a > different callback is invoked for different chunk types: > > set = nbd_callback_set_create(nbd, NBD_CMD_READ, opaque, default_cb, > default_error_cb); > nbd_callback_set_add(nbd, set, NBD_REPLY_TYPE_OFFSET_DATA, opaque, cb); > nbd_callback_set_add(nbd, set, NBD_REPLY_TYPE_OFFSET_HOLE, opaque, cb); > nbd_pread_callback(nbd, buf, count, offset, set, flags); This would also work, with the caveat that the Python bindings will currently crash if you try to do this....
2019 May 28
2
Re: [libnbd PATCH 4/4] api: Add DF flag support for pread
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
2019 May 28
0
Re: [libnbd PATCH 4/4] api: Add DF flag support for pread
...and where status is data, hole, or error. The signature may still need tweaking. Or we may even want to let the user register a set of callbacks, where a different callback is invoked for different chunk types: set = nbd_callback_set_create(nbd, NBD_CMD_READ, opaque, default_cb, default_error_cb); nbd_callback_set_add(nbd, set, NBD_REPLY_TYPE_OFFSET_DATA, opaque, cb); nbd_callback_set_add(nbd, set, NBD_REPLY_TYPE_OFFSET_HOLE, opaque, cb); nbd_pread_callback(nbd, buf, count, offset, set, flags); The idea of registering a set of callbacks to handle a particular integer command id may work well for other extension...