search for: cbarg

Displaying 20 results from an estimated 77 matches for "cbarg".

Did you mean: cbargs
2019 Aug 09
0
[PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
...* string, cannot be NULL *) @@ -866,10 +864,6 @@ and arg = | UInt of string (* small unsigned int *) | UInt32 of string (* 32 bit unsigned int *) | UInt64 of string (* 64 bit unsigned int *) -and closure = { - cbname : string; (* name of callback function *) - cbargs : arg list; (* all closures return int for now *) -} and ret = | RBool (* return a boolean, or error *) | RStaticString (* return a static string (must be located in @@ -881,6 +875,19 @@ and ret = | RString (* return a newly allocated string...
2019 Aug 13
0
[PATCH libnbd 1/6] generator: Share single list of all Closures.
...nerator +++ b/generator/generator @@ -916,6 +916,32 @@ let non_blocking_test_call_description = "\n This call does not block, because it returns data that is saved in the handle from the NBD protocol handshake." +(* Closures. *) +let chunk_closure = { + cbname = "chunk"; + cbargs = [ CBBytesIn ("subbuf", "count"); + CBUInt64 "offset"; CBUInt "status"; + CBMutable (Int "error") ] +} +let completion_closure = { + cbname = "completion"; + cbargs = [ CBMutable (Int "error") ] +} +le...
2019 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...| Int64 of string (* 64 bit signed int *) @@ -921,8 +921,8 @@ Return the state of the debug flag on this handle."; "set_debug_callback", { default_call with args = [ Closure (true, - [{ cbname="debug_fn"; - cbargs=[String "context"; String "msg"] }]) ]; + { cbname="debug_fn"; + cbargs=[String "context"; String "msg"] }) ]; ret = RErr; shortdesc = "set the debug callback"; longdesc = "\...
2019 Aug 09
4
[PATCH libnbd 0/2] generator: Preparatory changes to the generator.
These are some simplifications to the generator. They don't probably make much sense on their own, but they are preparatory to better handling of enums, and or'd lists of flags. Rich.
2019 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...| Int64 of string (* 64 bit signed int *) @@ -920,9 +917,8 @@ Return the state of the debug flag on this handle."; "set_debug_callback", { default_call with - args = [ Closure (true, - { cbname="debug_fn"; - cbargs=[String "context"; String "msg"] }) ]; + args = [ Closure { cbname="debug_fn"; + cbargs=[String "context"; String "msg"] } ]; ret = RErr; shortdesc = "set the debug callback"; longdesc = "\ @@...
2019 Jul 24
8
[PATCH libnbd v2 0/5] lib: Implement closure lifetimes.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-July/thread.html#00231 The changes address everything that Eric picked up in his review of the first two patches. I have also added two more patches (4 and 5) which respectively fix docs and change int status -> unsigned status, as discussed. Passes make, check, check-valgrind. Rich.
2019 Jul 24
6
[PATCH libnbd 0/3] Implement closure lifetimes.
This implements most of what I wrote here: https://www.redhat.com/archives/libguestfs/2019-July/msg00213.html
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...| Int64 of string (* 64 bit signed int *) @@ -920,9 +917,8 @@ Return the state of the debug flag on this handle."; "set_debug_callback", { default_call with - args = [ Closure (true, - { cbname="debug_fn"; - cbargs=[String "context"; String "msg"] }) ]; + args = [ Closure { cbname="debug_fn"; + cbargs=[String "context"; String "msg"] } ]; ret = RErr; shortdesc = "set the debug callback"; longdesc = "\ @@...
2019 Aug 13
12
[PATCH 0/6] Implement OClosure.
Patches 1-4 are basically uncontroversial, straightforward refactoring and IMHO we should just push them. Possibly 1-3 should be squashed together, but I posted them separately so they are easier to review. Patches 5 and 6 together implement OClosure. Patch 5 adds the feature and is simple to understand. Patch 6 changes the Closure completion callbacks into OClosure, but because it doesn't
2019 Aug 09
1
Re: [PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
...ver used for > ‘int*’. We could make CB* types which only handle those cases. > --- > generator/generator | 428 +++++++++++++++++++------------------------- > 1 file changed, 186 insertions(+), 242 deletions(-) > Relatively large, but does look like a simplification. > +and cbarg = > +| CBArrayAndLen of arg * string (* array + number of entries *) > +| CBBytesIn of string * string (* like BytesIn *) > +| CBInt of string (* like Int *) > +| CBInt64 of string (* like Int64 *) > +| CBMutable of arg (* mutable argument, eg. int* *) Should...
2019 Jul 30
3
[PATCH libnbd] lib: Remove cookie parameter from completion callbacks.
...755 --- a/generator/generator +++ b/generator/generator @@ -1729,7 +1729,7 @@ C<nbd_pread>."; default_call with args = [ BytesPersistOut ("buf", "count"); UInt64 "offset"; Closure { cbname="callback"; - cbargs=[Int64 "cookie"; Mutable (Int "error")] }; + cbargs=[Mutable (Int "error")] }; Flags "flags" ]; ret = RInt64; permitted_states = [ Connected ]; @@ -1737,8 +1737,11 @@ C<nbd_pread>."; longdesc = &q...
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...| Int64 of string (* 64 bit signed int *) @@ -920,9 +917,8 @@ Return the state of the debug flag on this handle."; "set_debug_callback", { default_call with - args = [ Closure (true, - { cbname="debug_fn"; - cbargs=[String "context"; String "msg"] }) ]; + args = [ Closure { cbname="debug_fn"; + cbargs=[String "context"; String "msg"] } ]; ret = RErr; shortdesc = "set the debug callback"; longdesc = "\ @@...
2019 Aug 13
0
[PATCH libnbd 2/6] generator: Create only one Python wrapper per closure.
.../generator +++ b/generator/generator @@ -4108,126 +4108,122 @@ PyInit_libnbdmod (void) } " +(* Functions with a Closure parameter are special because we + * have to generate wrapper functions which translate the + * callbacks back to Python. + *) +let print_python_closure_wrapper { cbname; cbargs } = + pr "/* Wrapper for %s callback. */\n" cbname; + pr "static int\n"; + pr "%s_wrapper " cbname; + C.print_cbarg_list cbargs; + pr "\n"; + pr "{\n"; + pr " int ret = 0;\n"; + pr "\n"; + pr " if (valid_flag &am...
2019 Jul 24
0
[PATCH libnbd v2 5/5] lib: Use unsigned for pread_structured status parameter.
...ator index 34ca3f1..d46e8d6 100755 --- a/generator/generator +++ b/generator/generator @@ -1348,7 +1348,7 @@ protocol extensions)."; args = [ BytesOut ("buf", "count"); UInt64 "offset"; Closure { cbname="chunk"; cbargs=[BytesIn ("subbuf", "count"); - UInt64 "offset"; Int "status"; + UInt64 "offset"; UInt "status"; Mutable (Int "error")] };...
2019 Jul 25
4
[PATCH libnbd v3 0/2] lib: Implement closure lifetimes.
I think I've addressed everything that was raised in review. Some of the highlights: - Callbacks should be freed reliably along all exit paths. - There's a simple test of closure lifetimes. - I've tried to use VALID|FREE in all the places where I'm confident that it's safe and correct to do. There may be more places. Note this is an optimization and shouldn't
2019 Jul 24
2
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
...sing '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 (_, { cbname; cbargs }) -> > + | Closure { cbname; cbargs } -> > if types then ( > pr "int (*%s) " cbname; > - print_arg_list ~user_data:true cbargs; > + print_arg_list ~valid_flag:true ~user_data:true cbargs; Indentation. > + |...
2019 Aug 09
0
[PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
...ot;offset" ]; + optargs = [ OFlags "flags" ]; ret = RErr; permitted_states = [ Connected ]; shortdesc = "read from the NBD server"; @@ -1407,8 +1410,8 @@ protocol extensions)."; Closure { cbname="chunk"; cbargs=[CBBytesIn ("subbuf", "count"); CBUInt64 "offset"; CBUInt "status"; - CBMutable (Int "error")] }; - Flags "flags" ]; + CBMutable (Int...
2019 Jul 24
0
Re: [PATCH libnbd 2/3] lib: Implement closure lifetimes.
...a separate patch. > > @@ -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 (_, { cbname; cbargs }) -> > > + | Closure { cbname; cbargs } -> > > if types then ( > > pr "int (*%s) " cbname; > > - print_arg_list ~user_data:true cbargs; > > + print_arg_list ~valid_flag:true ~user_data:true cbargs; &g...
2019 Jul 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
...s(+), 270 deletions(-) diff --git a/generator/generator b/generator/generator index ad12b36..e48b1ad 100755 --- a/generator/generator +++ b/generator/generator @@ -841,6 +841,13 @@ type call = { *) may_set_error : bool; } +and callback = { + name : string; (* callback name *) + cbargs : arg list; (* parameters (except opaque) *) + (* For now, all callbacks return int; we could list a return type here if + * more variety is needed. + *) +} and arg = | ArrayAndLen of arg * string (* array + number of entries *) | Bool of string (* bool *) @@ -849,13 +856,1...
2019 Aug 03
1
[PATCH libnbd] generator: Generate typedefs automatically for Closure arguments.
...void *debug_callback_user_data); (Previously typedefs were available, but they were written by hand and only used internally to the library.) This change necessitates that we uniquely name all of our closures across methods (the same-named closure is required to have the same cbargs). I took this opportunity to rename some, so especially completion callbacks now have the type nbd_completion_callback. The generator also checks they are named uniquely. This does not change the C API or ABI. --- generator/generator | 93 +++++++++++++++++++++++------ generato...