Displaying 20 results from an estimated 44 matches for "arrayandlen".
2019 Aug 09
0
[PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
If we accept that callbacks will never handle the full range of
parameters then we can simplify the generator quite a bit by using a
special type for closure args vs normal method args.
This removes many asserts and quite a bit of unreachable code
(eg. Python code for handling ArrayAndLen in normal methods that was
never used).
The output of the generator after this commit should be identical.
It's possible to go a little further if we wanted: CBArrayAndLen is
only ever used for ‘uint32_t’ arrays. CBMutable is only ever used for
‘int*’. We could make CB* types which only han...
2019 Jun 03
0
[PATCH libnbd discussion only 4/5] api: Implement concurrent writer.
...signedLong (%s[i]));\n" n n
+ | BytesIn _ -> ()
| Opaque n ->
pr " struct %s_%s_data *_data = %s;\n" name cb_name n
| String n
| UInt64 n -> ()
(* The following not yet implemented for callbacks XXX *)
- | ArrayAndLen _ | Bool _ | BytesIn _ | BytesOut _
+ | ArrayAndLen _ | Bool _ | BytesOut _
| BytesPersistIn _ | BytesPersistOut _ | Callback _ | CallbackPersist _
| Flags _ | Int _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _
| UInt _ | UInt32 _ -> assert false
@@...
2019 Jun 21
0
[libnbd PATCH v2 1/5] generator: Allow Int in callbacks
...| Int _ -> ()
| Opaque n ->
pr " struct %s_%s_data *_data = %s;\n" name cb_name n
| String n
@@ -3268,7 +3269,7 @@ let print_python_binding name { args; ret } =
(* The following not yet implemented for callbacks XXX *)
| ArrayAndLen _ | Bool _ | BytesOut _
| BytesPersistIn _ | BytesPersistOut _ | Callback _ | CallbackPersist _
- | Flags _ | Int _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _
+ | Flags _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _
| UInt _ | UInt32 _ -> ass...
2019 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...[ UInt64 "count"; UInt64 "offset";
Closure (false,
- [{ cbname="extent";
- cbargs=[String "metacontext";
- UInt64 "offset";
- ArrayAndLen (UInt32 "entries",
- "nr_entries");
- Mutable (Int "error")]} ]);
+ { cbname="extent";
+ cbargs=[String "metacontext";
+...
2019 Jun 29
0
[libnbd PATCH 3/6] generator: Allow Int64 in callbacks
...| Mutable (Int n) ->
pr " PyObject *py_%s_modname = PyUnicode_FromString (\"ctypes\");\n" n;
pr " if (!py_%s_modname) { PyErr_PrintEx (0); return -1; }\n" n;
@@ -3525,7 +3526,7 @@ let print_python_binding name { args; ret } =
| ArrayAndLen _ | Bool _ | BytesOut _
| BytesPersistIn _ | BytesPersistOut _
| Callback _ | CallbackPersist _
- | Flags _ | Int64 _ | Mutable _
+ | Flags _ | Mutable _
| Path _ | SockAddrAndLen _ | StringList _
| UInt _ | UInt32 _ -> assert false...
2019 Jul 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
...ll = {
*)
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,14 @@ and arg =
written by the function *)
| BytesPersistIn of string * string (* same as above, but buffer persists *)
| BytesPersistOut of string * string
-| Cal...
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 5/5] lib: Use unsigned for pread_structured status parameter.
..." n n n;
pr " if (!py_%s) { PyErr_PrintEx (0); return -1; }\n" n;
- | String n
- | UInt64 n -> ()
+ | String _
+ | UInt _
+ | UInt64 _ -> ()
(* The following not yet implemented for callbacks XXX *)
| ArrayAndLen _ | Bool _ | BytesOut _
| BytesPersistIn _ | BytesPersistOut _
| Closure _
| Flags _ | Mutable _
| Path _ | SockAddrAndLen _ | StringList _
- | UInt _ | UInt32 _ -> assert false
+ | UInt32 _ -> assert false
) cbargs...
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 18
0
[libnbd PATCH 6/8] states: Add nbd_pread_callback API
...| Int _ -> ()
| Opaque n ->
pr " struct %s_%s_data *_data = %s;\n" name cb_name n
| String n
@@ -3272,7 +3358,7 @@ let print_python_binding name { args; ret } =
(* The following not yet implemented for callbacks XXX *)
| ArrayAndLen _ | Bool _ | BytesOut _
| BytesPersistIn _ | BytesPersistOut _ | Callback _ | CallbackPersist _
- | Flags _ | Int _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _
+ | Flags _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _
| UInt _ | UInt32 _ -> ass...
2019 Jul 16
2
[PATCH libnbd v2] generator: Define new Closure type
As before, but this one has working Python bindings. OCaml still TBD.
Rich.
2019 Jun 20
1
Re: [libnbd PATCH 6/8] states: Add nbd_pread_callback API
...| Opaque n ->
> pr " struct %s_%s_data *_data = %s;\n" name cb_name n
> | String n
> @@ -3272,7 +3358,7 @@ let print_python_binding name { args; ret } =
> (* The following not yet implemented for callbacks XXX *)
> | ArrayAndLen _ | Bool _ | BytesOut _
> | BytesPersistIn _ | BytesPersistOut _ | Callback _ | CallbackPersist _
> - | Flags _ | Int _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _
> + | Flags _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _
> | UInt _...
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 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...args = [ UInt64 "count"; UInt64 "offset";
- Opaque "data";
- Callback ("extent", [Opaque "data"; String "metacontext";
- UInt64 "offset";
- ArrayAndLen (UInt32 "entries",
- "nr_entries");
- Mutable (Int "error")]);
+ Closure (false,
+ [ {cbname="extent";
+ cbargs=[String &qu...
2019 Jun 25
3
[PATCH libnbd] generator: Add Mutable type to the generator.
..._mod, \"c_int\", \"i\", *%s);\n" n n n
| Opaque n ->
pr " struct %s_%s_data *_data = %s;\n" name cb_name n
| String n
| UInt64 n -> ()
(* The following not yet implemented for callbacks XXX *)
| ArrayAndLen _ | Bool _ | BytesOut _
- | BytesPersistIn _ | BytesPersistOut _ | Callback _ | CallbackPersist _
- | Flags _ | Int _ | Int64 _ | Path _ | SockAddrAndLen _ | StringList _
+ | BytesPersistIn _ | BytesPersistOut _
+ | Callback _ | CallbackPersist _
+ | Flags _...
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
2
Re: [PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...ser_data);\n";
> pr "}\n";
> pr "\n";
> );
... (lots of churn due to reindentation, such is life)
> + pr " py_args = Py_BuildValue (\"(\"";
> + List.iter (
> + function
> + | ArrayAndLen (UInt32 n, len) -> pr " \"O\""
> + | BytesIn (n, len) -> pr " \"y#\""
> + | Int n -> pr " \"i\""
> + | Int64 n -> pr " \"L\""
> + | Mutable (Int n) -> pr "...
2019 Jul 16
1
Re: [PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...t;count"; UInt64 "offset";
> - Opaque "data";
> - Callback ("extent", [Opaque "data"; String "metacontext";
> - UInt64 "offset";
> - ArrayAndLen (UInt32 "entries",
> - "nr_entries");
> - Mutable (Int "error")]);
> + Closure (false,
> + [ {cbname="extent";
> +...
2019 May 28
0
[PATCH] api: Add a special type for the flags argument.
...64 "offset"; Flags "flags" ];
ret = RErr;
shortdesc = "send write zeroes to the NBD server";
longdesc = "\
@@ -1353,7 +1354,7 @@ punching a hole.";
UInt64 "offset";
ArrayAndLen (UInt32 "entries",
"nr_entries")]);
- UInt32 "flags" ];
+ Flags "flags" ];
ret = RErr;
shortdesc = "read the block status of the given range";
longdesc = "\...
2019 Jun 03
10
[PATCH libnbd discussion only 0/5] api: Implement concurrent writer.
This works, but there's no time saving and I'm still investigating
whether it does what I think it does. Nevertheless I thought I would
post it because it (probably) implements the idea I had last night
outlined in:
https://www.redhat.com/archives/libguestfs/2019-June/msg00010.html
The meat of the change is patch 4. Patch 5 is an example which I
would probably fold into patch 4 for