search for: nbd_pread_structur

Displaying 20 results from an estimated 60 matches for "nbd_pread_structur".

Did you mean: nbd_pread_structured
2019 Jun 21
0
[libnbd PATCH v2 3/5] states: Add nbd_pread_structured API
...ue a read command to the NBD server for the range starting at C<offset> and ending at C<offset> + C<count> - 1. NBD can only read all or nothing using this call. The call returns when the data has been read fully into C<buf> or there is an -error. +error. See also C<nbd_pread_structured>, if finer visibility is +required into the server's replies. + +The C<flags> parameter must be C<0> for now (it exists for future NBD +protocol extensions)."; + }; + + "pread_structured", { + default_call with + args = [ BytesOut ("buf", "...
2019 Jul 16
1
[libnbd PATCH] generator: Prefer closure opaque after function pointer in C
...} diff --git a/interop/structured-read.c b/interop/structured-read.c index f9014c8..d00524f 100644 --- a/interop/structured-read.c +++ b/interop/structured-read.c @@ -143,7 +143,7 @@ main (int argc, char *argv[]) memset (rbuf, 2, sizeof rbuf); data = (struct data) { .count = 2, }; - if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2048, &data, read_cb, + if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2048, read_cb, &data, 0) == -1) { fprintf (stderr, "%s\n", nbd_get_error ()); exit (EXIT_FAILURE); @@ -153,7 +153,7 @@ main (int argc, char...
2019 Jun 21
9
[libnbd PATCH v2 0/5] nbd_pread_structured
Since v1: - rebase to applied patches - split out support for Int in callbacks - sort of test that callbacks work in OCaml (see comment in patch 5) - rename API to nbd_pread_structured - expose error as explicit parameter to callback Eric Blake (5): generator: Allow Int in callbacks states: Wire in a read callback states: Add nbd_pread_structured API states: Add tests for nbd_pread_structured states: Add DF flag support for pread .gitignore...
2019 Jul 30
3
[PATCH libnbd] lib: Remove cookie parameter from completion callbacks.
...letes, C<callback> will be invoked as described in L<libnbd(3)/Completion callbacks>. + Note that you must ensure C<buf> is valid until the command has completed. Other parameters behave as documented in C<nbd_pread>."; }; @@ -1773,8 +1776,7 @@ documented in C<nbd_pread_structured>."; UInt "status"; Mutable (Int "error"); ]}; Closure { cbname="callback"; - cbargs=[Int64 "cookie"; - Mutable (Int &qu...
2019 Aug 14
3
[libnbd PATCH 0/2] Drop generated file from git
Rich recently patched things to generate one man page per function rather than libnbd-api.3 (nice), but in doing so got stumped by a problem with a fresh git clone (automake fails for any 'include' directive that does not already exist). I've figured out how to hack around it, but the hack requires GNU make. We already use GNU make constructs elsewhere (such as $(wildcard)), but
2019 Jul 24
2
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
...if types then pr "int "; > + pr "valid_flag"; Should this be 'unsigned int valid_flag', as bitmasks over signed values have awkward semantics if you touch the sign bit? But I'm okay with int for now, as it matches 'int nbd_aio_get_direction(...)' and nbd_pread_structured using 'int status' in its callback. > @@ -3228,10 +3218,10 @@ let rec print_arg_list ?(handle = false) ?(user_data = false) > pr "%s, " n; > if types then pr "size_t "; > pr "%s" len > - | Closure (_, { cbna...
2019 Jul 30
0
Re: [PATCH libnbd] lib: Remove cookie parameter from completion callbacks.
...Closure { cbname="callback"; > - cbargs=[Int64 "cookie"; Mutable (Int "error")] }; > + cbargs=[Mutable (Int "error")] }; No trailing ; in cbargs=[]... > @@ -1773,8 +1776,7 @@ documented in C<nbd_pread_structured>."; > UInt "status"; > Mutable (Int "error"); ]}; > Closure { cbname="callback"; > - cbargs=[Int64 "cookie"; > -...
2019 Aug 14
2
Re: [PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...letion_callback) { .callback = finished_write, .user_data = buffer }, Worth splitting the long lines? > +++ b/interop/structured-read.c > @@ -147,7 +147,8 @@ main (int argc, char *argv[]) > > memset (rbuf, 2, sizeof rbuf); > data = (struct data) { .count = 2, }; > - if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2048, read_cb, &data, > + if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2048, > + (nbd_chunk_callback) { .callback = read_cb, .user_data = &data }, > 0) == -1) { > fprintf (stderr, &quot...
2019 Jun 21
0
[libnbd PATCH v2 5/5] states: Add DF flag support for pread
...t;can_df", { + default_call with + args = []; ret = RBool; + shortdesc = "does the server support the don't fragment flag to pread?"; + longdesc = "\ +Returns true if the server supports structured reads with an +ability to request a non-fragmented read (see C<nbd_pread_structured>, +C<nbd_aio_pread_structured>). Returns false if the server either lacks +structured reads or if it does not support a non-fragmented read request."; + }; + "can_multi_conn", { default_call with args = []; ret = RBool; @@ -1306,7 +1317,8 @@ at C<offset&g...
2019 Aug 13
0
[PATCH libnbd 1/4] api: Combine callback and user_data into a single struct.
...} diff --git a/interop/structured-read.c b/interop/structured-read.c index 0b189d1..31aadbe 100644 --- a/interop/structured-read.c +++ b/interop/structured-read.c @@ -147,7 +147,8 @@ main (int argc, char *argv[]) memset (rbuf, 2, sizeof rbuf); data = (struct data) { .count = 2, }; - if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2048, read_cb, &data, + if (nbd_pread_structured (nbd, rbuf, sizeof rbuf, 2048, + (nbd_chunk_callback) { .callback = read_cb, .user_data = &data }, 0) == -1) { fprintf (stderr, "%s\n", nbd_get...
2019 Jun 29
0
[libnbd PATCH 5/6] api: Add new nbd_aio_FOO_notify functions
...t;nbd_aio_pread>). +are two low level asynchronous equivalents (eg. C<nbd_aio_pread> for +starting a command, and C<nbd_aio_pread_notify> for also registering +a callback to be invoked right before the command is complete). + +=head1 CALLBACKS + +Some of the high-level commands (C<nbd_pread_structured>, +C<nbd_block_status>) involve the use of a callback function invoked by +the state machine at appropriate points in the server's reply before +the overall command is complete. Also, all of the low-level commands +have a notify variant that registers a callback function used right +...
2019 Jul 24
0
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
...uot;; > > + pr "valid_flag"; > > Should this be 'unsigned int valid_flag', as bitmasks over signed values > have awkward semantics if you touch the sign bit? But I'm okay with int > for now, as it matches 'int nbd_aio_get_direction(...)' and > nbd_pread_structured using 'int status' in its callback. Yes I can change it to unsigned - using a signed type was a mistake. I think we can change nbd_pread_structured (and friends) to use either unsigned or uint32_t which is consistent with other flag parameters. However we can't easily change nbd_aio...
2019 Jun 25
4
Re: Few libnbd questions/concerns
...e default. I'm guessing you didn't set an errno when you returned -1? Is there a better default we should use than EPROTO? Is there really a way to diagnose without an errno value that the callback failed but didn't set errno? There's also the related question - my patches to add nbd_pread_structured are set up to call the callback for as many chunks as the server sends, even if an earlier invocation of the callback fails, but to still preserve the errno of the first failed callback (again defaulting to EPROTO). Should nbd_block_status also call the callback for all chunks from the server, ra...
2020 Sep 05
2
libnbd completion callback question
...check client-side without traffic to the server), then the callback function was NOT registered, and the user must clean any resources then and there to avoid a leak. Only when nbd_aio_FOO() succeeds will the responsibility for cleanup be handled by the callback. But for nbd_block_status and nbd_pread_structured, we have a second callback. And _these_ callbacks have a problem: we can return -1 for two different reasons, either because the command was never attempted (nbd_aio_FOO failed) and so the callback will never be cleaned, or because the command got sent to the server and the server failed it...
2019 Jul 23
4
[libnbd PATCH] api: Allow completion callbacks to auto-retire
...s command, or C<-1> on error. If this command returns a cookie, then C<callback> will be called when the server is done replying, although you must still use C<nbd_aio_command_completed> after -the callback to retire the command. Other parameters behave as -documented in C<nbd_pread_structured>. +the callback to retire the command unless the callback returns C<1>. +Other parameters behave as documented in C<nbd_pread_structured>. The C<callback> function is called with the same C<user_data> passed to this function, C<cookie> set to the return value o...
2020 Sep 11
0
[libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...uctured", { @@ -2145,9 +2173,11 @@ To check if the command completed, call L<nbd_aio_command_completed(3)>. Or supply the optional C<completion_callback> which will be invoked as described in L<libnbd(3)/Completion callbacks>. -Other parameters behave as documented in L<nbd_pread_structured(3)>."; +Other parameters behave as documented in L<nbd_pread_structured(3)>." +^ strict_call_description; see_also = [SectionLink "Issuing asynchronous commands"; - Link "aio_pread"; Link "pread_structured"]; + Li...
2019 Aug 13
8
[PATCH libnbd 0/4] Add free function to callbacks.
Patches 1 & 2 are rather complex, but the end result is that we pass closures + user_data + free function in single struct parameters as I described previously in this email: https://www.redhat.com/archives/libguestfs/2019-August/msg00210.html Patch 3 adds a convenient FREE_CALLBACK macro which seems a worthwhile simplification if you buy into 1 & 2. Patch 4 adds another macro which is
2020 Sep 05
0
Re: libnbd completion callback question
...ut traffic to the server), then the callback function was NOT > registered, and the user must clean any resources then and there to > avoid a leak.  Only when nbd_aio_FOO() succeeds will the responsibility > for cleanup be handled by the callback. > > But for nbd_block_status and nbd_pread_structured, we have a second > callback.  And _these_ callbacks have a problem: we can return -1 for > two different reasons, either because the command was never attempted > (nbd_aio_FOO failed) and so the callback will never be cleaned, or > because the command got sent to the server and t...
2019 Aug 13
1
Re: [PATCH libnbd 4/6] lib: Check Closure parameter is not NULL.
On 8/13/19 5:06 AM, Richard W.M. Jones wrote: > This was not permitted by the API before, but would in some > circumstances work. > --- > generator/generator | 10 ++++++++++ > 1 file changed, 10 insertions(+) > Requires nbd_pread_structured and nbd_block_status to pass in a callback (good). Requires nbd_set_debug_callback to provide a non-NULL pointer (a bit rough, as now you can't pass NULL to deinstall your handler and get back to the default behavior - but how often are applications likely to deinstall a debug handler? If it...
2020 Sep 17
2
Re: [libnbd PATCH v2 4/5] api: Add STRICT_FLAGS to set_strict_mode
...-2145,9 +2173,11 @@ To check if the command completed, call L<nbd_aio_command_completed(3)>. > Or supply the optional C<completion_callback> which will be invoked > as described in L<libnbd(3)/Completion callbacks>. > > -Other parameters behave as documented in L<nbd_pread_structured(3)>."; > +Other parameters behave as documented in L<nbd_pread_structured(3)>." > +^ strict_call_description; > see_also = [SectionLink "Issuing asynchronous commands"; > - Link "aio_pread"; Link "pread_structured"];...