Displaying 20 results from an estimated 26 matches for "nbd_cmd_flag_".
2019 Aug 10
1
Re: [PATCH libnbd 2/9] generator: Generalize OFlags.
On 8/10/19 8:02 AM, Richard W.M. Jones wrote:
> In a future commit we want to add (non-optional) Flags arg.  As a step
> to doing this, generalize OFlags so it's not tied to just
> NBD_CMD_FLAG_*.
> 
> This does not change the C API.
> 
> It does introduce a small change to the OCaml API -- putting related
> flags into a submodule, basically renaming them.  Note we don't
> provide guarantees for non-C APIs.
And even if we decide to provide guarantees for non-C, we...
2019 Jul 24
2
Re: [PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...y
> +                               exist during the function call *)
Do we still need the closure record type, or can/should we simplify
further to:
| Closure of bool * string * arg list
(and later in the series, even further by dropping 'bool *')
>  | Flags of string          (* NBD_CMD_FLAG_* flags *)
>  | Int of string            (* small int *)
>  | 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 (tr...
2019 Jul 24
0
Re: [PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...*')
There's actually no difference at the machine code level - both tuple
and struct have the same representation (same as it would be in C in
fact).  So it comes down to which is nicer, and I think it's slightly
nicer to have the named fields.
> >  | Flags of string          (* NBD_CMD_FLAG_* flags *)
> >  | Int of string            (* small int *)
> >  | 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
>...
2019 Aug 10
0
[PATCH libnbd 2/9] generator: Generalize OFlags.
In a future commit we want to add (non-optional) Flags arg.  As a step
to doing this, generalize OFlags so it's not tied to just
NBD_CMD_FLAG_*.
This does not change the C API.
It does introduce a small change to the OCaml API -- putting related
flags into a submodule, basically renaming them.  Note we don't
provide guarantees for non-C APIs.
---
 generator/generator                      | 180 +++++++++++++++++------
 ocaml/nbd-c.h...
2019 Aug 09
1
Re: [PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
...om plain arguments.  These are mapped to optional
> arguments in languages that support them such as Python.
> 
> This commit adds a new concept of optargs.  At the moment it is simply
> limited to handling the optional (in some bindings) flags parameter
> which is used to handle the NBD_CMD_FLAG_* flags.
> 
> If present, the old Flags parameter becomes OFlags and is moved into
> the optargs list.
> 
> For the OCaml generation this change simplifies things considerably as
> we no longer need the mapping from C arg to ocaml_arg (they are now
> the same).
> 
> In the...
2019 Aug 09
0
[PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
...rgs which is
different from plain arguments.  These are mapped to optional
arguments in languages that support them such as Python.
This commit adds a new concept of optargs.  At the moment it is simply
limited to handling the optional (in some bindings) flags parameter
which is used to handle the NBD_CMD_FLAG_* flags.
If present, the old Flags parameter becomes OFlags and is moved into
the optargs list.
For the OCaml generation this change simplifies things considerably as
we no longer need the mapping from C arg to ocaml_arg (they are now
the same).
In the libguestfs C bindings the handling of optarg...
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 Jun 04
0
[PATCH libnbd v2 2/4] generator: Callback returns int instead of void.
...rsists *)
 | BytesPersistOut of string * string
-| Callback of string * arg list (* callback function returning void *)
+| Callback of string * arg list (* callback function returning int *)
 | CallbackPersist of string * arg list (* as above, but callback persists *)
 | Flags of string          (* NBD_CMD_FLAG_* flags *)
 | Int of string            (* small int *)
@@ -2680,7 +2680,7 @@ let rec print_c_arg_list ?(handle = false) args =
       | BytesPersistOut (n, len) -> pr "void *%s, size_t %s" n len
       | Callback (n, args)
       | CallbackPersist (n, args) ->
-         pr "void...
2019 May 28
0
[PATCH] api: Add a special type for the flags argument.
...-- a/generator/generator
+++ b/generator/generator
@@ -820,6 +820,7 @@ and arg =
 | BytesPersistIn of string * string (* same as above, but buffer persists *)
 | BytesPersistOut of string * string
 | Callback of string * arg list (* callback function returning void *)
+| Flags of string          (* NBD_CMD_FLAG_* flags *)
 | Int of string            (* small int *)
 | Int64 of string          (* 64 bit signed int *)
 | Opaque of string         (* opaque object, void* in C *)
@@ -1225,7 +1226,7 @@ with the server.";
 
   "pread", {
     default_call with
-    args = [ BytesOut ("buf"...
2019 May 28
2
[PATCH] api: Add a special type for the flags argument.
This applies on top of patches 1 & 2 here (instead of patch 3):
https://www.redhat.com/archives/libguestfs/2019-May/msg00206.html
https://www.redhat.com/archives/libguestfs/2019-May/msg00207.html
Rich.
2019 Jun 25
3
[PATCH libnbd] generator: Add Mutable type to the generator.
...75 +++++++++++++++++++++++++++++++++++++--------
 1 file changed, 63 insertions(+), 12 deletions(-)
diff --git a/generator/generator b/generator/generator
index e1a97a5..72d37c8 100755
--- a/generator/generator
+++ b/generator/generator
@@ -843,6 +843,7 @@ and arg =
 | Flags of string          (* NBD_CMD_FLAG_* flags *)
 | Int of string            (* small int *)
 | Int64 of string          (* 64 bit signed int *)
+| Mutable of arg           (* mutable argument, eg. int* *)
 | Opaque of string         (* opaque object, void* in C *)
 | Path of string           (* filename or path *)
 | SockAddrAndLen of...
2019 Aug 10
17
[PATCH libnbd 0/9] Add Enum and Flags types.
This largish series adds several new features to the generator.
Enum maps to enumerated types (like enum in C).  The only current use
for this is replacing the nbd_set_tls (nbd, 0/1/2) parameter with
LIBNBD_TLS_DISABLE, LIBNBD_TLS_ALLOW, LIBNBD_TLS_REQUIRE (and natural
equivalents in other programming languages).
Flags maps to any uint32_t bitmask.  It is basically a non-optional,
generalized
2019 Jul 16
2
[PATCH libnbd] generator: Define new Closure type
** INCOMPLETE **
This is the generator change as discussed on the list already.
The Python and OCaml bindings are not yet done.
It passes all [C only] tests and valgrind.
Note that nbd_add_close_callback is inconsistent with other closure
types because it passes the user_data parameter after the function.
(This is not caused by the current patch, it was already
inconsistent).  We decided that
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 Aug 09
0
[PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
...of arg * string (* array + number of entries *)
 | Bool of string           (* bool *)
 | BytesIn of string * string (* byte array + size passed in to the function *)
 | BytesOut of string * string(* byte array + size specified by caller,
@@ -858,7 +857,6 @@ and arg =
 | Flags of string          (* NBD_CMD_FLAG_* flags *)
 | Int of string            (* small int *)
 | Int64 of string          (* 64 bit signed int *)
-| Mutable of arg           (* mutable argument, eg. int* *)
 | Path of string           (* filename or path *)
 | SockAddrAndLen of string * string (* struct sockaddr * + socklen_t *)
 | Strin...
2019 Jul 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
...*)
 | BytesPersistIn of string * string (* same as above, but buffer persists *)
 | BytesPersistOut of string * string
-| Callback of string * arg list (* callback function returning int *)
-| CallbackPersist of string * arg list (* as above, but callback persists *)
 | Flags of string          (* NBD_CMD_FLAG_* flags *)
 | Int of string            (* small int *)
 | Int64 of string          (* 64 bit signed int *)
 | Mutable of arg           (* mutable argument, eg. int* *)
-| Opaque of string         (* opaque object, void* in C *)
+| OpaqueAndCallbacks of string * callback list (* one or more callbacks...
2019 Jul 24
0
[PATCH libnbd 2/3] lib: Implement closure lifetimes.
...flag if true means callbacks persist
-                               in the handle, false means they only
-                               exist during the function call *)
+| Closure of closure       (* function pointer + void *opaque *)
 | Flags of string          (* NBD_CMD_FLAG_* flags *)
 | Int of string            (* small int *)
 | 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,
-                      {...
2019 Jul 16
3
[RFC libnbd PATCH 0/2] Start fixing python nbd.pread_structured_callback
Posting now that I got something to compile (at the expense of
breaking OCaml bindings), but I'm open to ideas on how to improve it.
Eric Blake (2):
  generator: Tweak print_c_arg_list to take alternate first arg
  RFC: generator: Handle shared callbacks in Python
 generator/generator | 556 ++++++++++++++++++++++----------------------
 1 file changed, 280 insertions(+), 276 deletions(-)
-- 
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...read_verify (unsigned valid_flag, void *opaque, int64_t cookie, int *error)
 {
-  struct data *data = opaque;
-  int ret = -1;
+  int ret = 0;
 
-  total_reads++;
-  total_chunks += data->chunks;
-  if (*error)
-    goto cleanup;
-  assert (data->chunks > 0);
-  if (data->flags & LIBNBD_CMD_FLAG_DF) {
-    total_df_reads++;
-    if (data->chunks > 1) {
-      fprintf (stderr, "buggy server: too many chunks for DF flag\n");
+  if (valid_flag & LIBNBD_CALLBACK_VALID) {
+    struct data *data = opaque;
+
+    ret = -1;
+    total_reads++;
+    total_chunks += data->chunk...
2019 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...+| Closure of bool * closure (* function pointer + void *opaque
+                               flag if true means callbacks persist
+                               in the handle, false means they only
+                               exist during the function call *)
 | Flags of string          (* NBD_CMD_FLAG_* flags *)
 | Int of string            (* small int *)
 | 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,
-                      [{...