search for: rcookie

Displaying 20 results from an estimated 30 matches for "rcookie".

Did you mean: cookie
2020 Sep 06
0
[libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...r/GoLang.ml | 13 ++++++++++++- generator/OCaml.ml | 4 ++++ generator/Python.ml | 2 ++ 6 files changed, 42 insertions(+), 15 deletions(-) diff --git a/generator/API.ml b/generator/API.ml index 962b787..bf6030f 100644 --- a/generator/API.ml +++ b/generator/API.ml @@ -66,6 +66,8 @@ and ret = | RCookie | RString | RUInt +| REnum of enum +| RFlags of flags and closure = { cbname : string; cbargs : cbarg list; @@ -442,7 +444,7 @@ test whether this is the case with L<nbd_supports_tls(3)>."; "get_tls", { default_call with - args = []; ret = RInt; + args =...
2019 Jul 30
0
[PATCH libnbd] examples: Fix theoretical cookie race in example.
...ffer_state { struct buffer { uint64_t offset; - /* Note that command cookies are only unique per libnbd handle. - * Since we have two handles but we must look up completed commands - * in the buffer table by cookie we must maintain separate read and - * write cookies. - */ - int64_t rcookie; - int64_t wcookie; enum buffer_state state; char *data; }; @@ -355,7 +349,7 @@ static gboolean read_data (gpointer user_data) { static uint64_t posn = 0; - const size_t i = nr_buffers; + size_t i; if (gssrc == NULL) return FALSE; @@ -367,16 +361,21 @@ read_data (gpointer u...
2019 Jul 17
2
Re: [PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...y may matter to some clients. Also, there may still be a possible race: > +/* This idle callback reads data from the source nbdkit until the ring > + * is full. > + */ > +static gboolean > +read_data (gpointer user_data) > +{ > + static uint64_t posn = 0; > + buffers[i].rcookie = > + nbd_aio_pread_callback (gssrc->nbd, buffers[i].data, > + BUFFER_SIZE, buffers[i].offset, > + finished_read, NULL, 0); It may be possible in rare situations that the libnbd state machine can send() the command AND see data r...
2019 Jul 17
2
[PATCH libnbd v2] examples: Include an example of integrating with glib main loop.
This is working now, and incorporates all of the changes in Eric's review, *except* that it still doesn't retire commands (although this seems to make no obvious difference, except possibly a performance and memory impact). Rich.
2019 Jul 30
4
[PATCH libnbd] examples: Fix theoretical cookie race in example.
Previously discussed here: https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html It turns out that deferring callbacks is a PITA. (It would be a bit easier if C has closures.) However by rewriting the example we can avoid the need to use the cookie at all and make it run a bit more efficiently, so let's do that instead. Rich.
2020 Sep 06
8
[libnbd PATCH 0/3] Improve type-safety of ocaml/golang getters
Natural fallout after my recent testsuite additions that fixed a couple of ocaml bugs in the setters. However, on at least the OCaml code, I'm not sure what we should do if a newer libnbd ever returns a bit that an older NBD.mli was not expecting at the time the OCaml compiler ran (see below). I'm also not sure if there is a more efficient way to avoid outputting Val_FOO() converters for
2019 Jul 17
0
[PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...WRITING, +}; + +struct buffer { + uint64_t offset; + /* Note that command cookies are only unique per libnbd handle. + * Since we have two handles but we must look up completed commands + * in the buffer table by cookie we must maintain separate read and + * write cookies. + */ + int64_t rcookie; + int64_t wcookie; + enum buffer_state state; + char *data; +}; + +static struct buffer buffers[MAX_BUFFERS]; +static size_t nr_buffers; + +static bool finished, reader_paused; + +static GMainLoop *loop; + +static void connected (struct NBDSource *source); +static gboolean read_data (gpointer u...
2020 Sep 11
0
[libnbd PATCH v2 2/5] generator: Refactor filtering of accepted OFlags
...s = [ BytesPersistOut ("buf", "count"); UInt64 "offset" ]; - optargs = [ OClosure completion_closure; OFlags ("flags", cmd_flags) ]; + optargs = [ OClosure completion_closure; + OFlags ("flags", cmd_flags, Some []) ]; ret = RCookie; permitted_states = [ Connected ]; shortdesc = "read from the NBD server"; @@ -2048,7 +2055,8 @@ completed. Other parameters behave as documented in L<nbd_pread(3)>."; default_call with args = [ BytesPersistOut ("buf", "count"); UInt64 &...
2019 Jul 17
0
Re: [PATCH libnbd v2] examples: Include an example of integrating with the glib main loop.
...to recv() (perhaps from a previous > command still in flight), where it ends up read()ing until blocking and > happens to get the server's reply to this command and fire off the > callback, all prior to the nbd_aio_pread_callback() returning. If that > ever happens, then buffers[i].rcookie will still be unset at the time > the callback fires... > >> +/* This callback is called from libnbd when any read command finishes. */ >> +static int >> +finished_read (void *vp, int64_t rcookie, int *error) >> +{ >> + size_t i; >> + >> + if (gssr...
2020 Sep 07
2
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
...arg list; (** all closures return int for now *) > diff --git a/generator/C.ml b/generator/C.ml > index 6b65f6e..1eb5e85 100644 > --- a/generator/C.ml > +++ b/generator/C.ml > @@ -66,15 +66,15 @@ let errcode_of_ret = > function > | RBool | RErr | RFd | RInt | RInt64 | RCookie -> Some "-1" > | RStaticString | RString -> Some "NULL" > - | RUInt -> None (* errors not possible *) > + | RUInt | REnum (_) | RFlags (_) -> None (* errors not possible *) > > let type_of_ret = > function > - | RBool | RErr | RFd | RI...
2020 Mar 17
0
[PATCH libnbd v2 3/3] golang: Add straightforward bindings, without callbacks.
...ly have + * an error (RUInt). + *) +let go_ret_type = function + | RBool -> "bool" + | RStaticString -> "*string" + | RErr -> "int" (* always 0 *) + | RFd -> "int/*XXX*/" + | RInt -> "int" + | RInt64 -> "int64" + | RCookie -> "int64" + | RString -> "*string" + | RUInt -> "uint" + +let go_ret_error = function + | RBool -> "false" + | RStaticString -> "nil" + | RErr -> "0" + | RFd -> "0/*XXX*/" + | RInt -> "0"...
2012 Jun 07
1
How to set cookies in RCurl
...Cookies disabled 3 4 Your browser currently does not accept cookies.\rCookies need to be enabled for Scopus to function properly.\rPlease enable session cookies in your browser and try again. $`NULL` V1 V2 V3 1 $`NULL` V1 1 Cookies disabled $`NULL` V1 1 2 3 I have carefully read section 4.4. from this: http://www.omegahat.org/RCurl/R...
2019 Aug 31
1
[PATCH libnbd] Add bindings for Rust language
Still not working, but I took the latest patch and: - rebased it against libnbd 1.0 - fixed it so it handles new args and cbargs The generator now runs without warnings. This patch doesn't handle optargs at all. In C these are converted to non-optional parameter. Rust doesn't (AFAIK) have optional or labelled arguments unfortunately. Rich.
2020 Sep 06
0
[libnbd PATCH 3/3] ocaml: Typesafe returns for REnum/RFlags
...5 +- ocaml/tests/test_120_set_non_defaults.ml | 4 +- 3 files changed, 60 insertions(+), 8 deletions(-) diff --git a/generator/OCaml.ml b/generator/OCaml.ml index 4a835b0..cb6633c 100644 --- a/generator/OCaml.ml +++ b/generator/OCaml.ml @@ -66,8 +66,8 @@ and ocaml_ret_to_string = function | RCookie -> "cookie" | RString -> "string" | RUInt -> "int" - | REnum (_) -> "int" (* XXX return enum_prefix.t instead *) - | RFlags (_) -> "int" (* XXX return flag_prefix.t list instead *) + | REnum ({ enum_prefix }) -> enum_prefi...
2020 Sep 07
0
[libnbd PATCH v2 3/3] ocaml: Typesafe returns for REnum/RFlags
...5 +- ocaml/tests/test_120_set_non_defaults.ml | 9 +-- 3 files changed, 79 insertions(+), 12 deletions(-) diff --git a/generator/OCaml.ml b/generator/OCaml.ml index db7003c..4bcd450 100644 --- a/generator/OCaml.ml +++ b/generator/OCaml.ml @@ -66,8 +66,8 @@ and ocaml_ret_to_string = function | RCookie -> "cookie" | RString -> "string" | RUInt -> "int" - | REnum _ -> "int" (* XXX return enum_prefix.t instead *) - | RFlags _ -> "int" (* XXX return flag_prefix.t list instead *) + | REnum { enum_prefix } -> enum_prefix ^ &q...
2020 Sep 11
10
[libnbd PATCH v2 0/5] Add knobs for client- vs. server-side validation
In v2: - now based on my proposal to add LIBNBD_SHUTDOWN_IMMEDIATE - four flags instead of two: STRICT_FLAGS is new (patch 4), and STRICT_BOUNDS is separate from STRICT_ZERO_SIZE (patch 5) - various refactorings for more shared code and less duplication Eric Blake (5): api: Add xxx_MASK constant for each Flags type generator: Refactor filtering of accepted OFlags api: Add
2020 Sep 07
0
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
On 9/7/20 9:13 AM, Richard W.M. Jones wrote: >> +++ b/generator/C.ml >> @@ -66,15 +66,15 @@ let errcode_of_ret = >> function >> | RBool | RErr | RFd | RInt | RInt64 | RCookie -> Some "-1" >> | RStaticString | RString -> Some "NULL" >> - | RUInt -> None (* errors not possible *) >> + | RUInt | REnum (_) | RFlags (_) -> None (* errors not possible *) >> >> let type_of_ret = >> function >&gt...
2019 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...b-main-loop.c index c633c1d..9d61923 100644 --- a/examples/glib-main-loop.c +++ b/examples/glib-main-loop.c @@ -272,9 +272,11 @@ static GMainLoop *loop; static void connected (struct NBDSource *source); static gboolean read_data (gpointer user_data); -static int finished_read (void *vp, int64_t rcookie, int *error); +static int finished_read (int valid_flag, void *vp, + int64_t rcookie, int *error); static gboolean write_data (gpointer user_data); -static int finished_write (void *vp, int64_t wcookie, int *error); +static int finished_write (int valid_flag, void *vp, +...
2020 Sep 07
1
Re: [libnbd PATCH 1/3] generator: Introduce REnum/RFlags return types
On Mon, Sep 07, 2020 at 09:38:15AM -0500, Eric Blake wrote: > On 9/7/20 9:13 AM, Richard W.M. Jones wrote: > > >>+++ b/generator/C.ml > >>@@ -66,15 +66,15 @@ let errcode_of_ret = > >> function > >> | RBool | RErr | RFd | RInt | RInt64 | RCookie -> Some "-1" > >> | RStaticString | RString -> Some "NULL" > >>- | RUInt -> None (* errors not possible *) > >>+ | RUInt | REnum (_) | RFlags (_) -> None (* errors not possible *) > >> > >> let type_of_ret = > &gt...
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...b-main-loop.c index c633c1d..b7c496f 100644 --- a/examples/glib-main-loop.c +++ b/examples/glib-main-loop.c @@ -272,9 +272,11 @@ static GMainLoop *loop; static void connected (struct NBDSource *source); static gboolean read_data (gpointer user_data); -static int finished_read (void *vp, int64_t rcookie, int *error); +static int finished_read (unsigned valid_flag, void *vp, + int64_t rcookie, int *error); static gboolean write_data (gpointer user_data); -static int finished_write (void *vp, int64_t wcookie, int *error); +static int finished_write (unsigned valid_flag, voi...