Displaying 19 results from an estimated 19 matches for "ocamlarg".
2019 Aug 09
0
[PATCH libnbd 2/2] generator: Change handling of Flags to be a true optional argument.
...> unit
end = struct
-(* We convert the list of generic args to an OCaml-specific list
- * because the mapping between them is complicated.
- *)
-type ocaml_arg =
- | OCamlHandle (* The NBD handle (NBD.t) *)
- | OCamlFlags of string (* Optional ?flags parameter *)
- | OCamlArg of arg (* Other arg (string = name). *)
-
-let args_to_ocaml_args args =
- (* Flags argument, if present, is always placed first. *)
- let flags, args =
- match List.rev args with
- | Flags n :: rest -> Some (OCamlFlags n), List.rev rest
- | _ -> None, args in
- let ar...
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 16
0
[libnbd PATCH 2/2] RFC: generator: Handle shared callbacks in Python
..., " ^ String.concat ", " (List.map (fun cb -> cb.name) cbs), None
| Path n -> n, None
| SockAddrAndLen (n, _) -> n, None
| String n -> n, None
@@ -4399,16 +4406,12 @@ and ocaml_arg_to_string = function
| OCamlArg (BytesPersistIn _) -> "Buffer.t"
| OCamlArg (BytesOut _) -> "bytes"
| OCamlArg (BytesPersistOut _) -> "Buffer.t"
- | OCamlArg (Callback (_, args))
- | OCamlArg (CallbackPersist (_, args)) ->
- sprintf "(%s)"
- (ocaml_fundec...
2019 Jun 18
0
[libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type
...| Path n -> n, None
+ | ReadStatus n -> n, None
| SockAddrAndLen (n, _) -> n, None
| String n -> n, None
| StringList n -> n, None
@@ -3929,6 +3956,7 @@ and ocaml_arg_to_string = function
| OCamlArg (Int64 _) -> "int64"
| OCamlArg (Opaque n) -> sprintf "'%s" n
| OCamlArg (Path _) -> "string"
+ | OCamlArg (ReadStatus _) -> "int"
| OCamlArg (SockAddrAndLen _) -> "string" (* XXX not impl *)
| OCamlArg (String _) -&g...
2019 Aug 09
0
[PATCH libnbd 1/2] generator: Handle closure args (cbargs) specially.
...rgs = List.flatten args in
let () =
let args = List.map (
function
@@ -4622,21 +4579,16 @@ let rec ocaml_fundecl_to_string args ret =
and ocaml_arg_to_string = function
| OCamlHandle -> "t"
| OCamlFlags n -> sprintf "?%s:int32 list" n
- | OCamlArg (ArrayAndLen (t, _)) ->
- sprintf "%s array" (ocaml_arg_to_string (OCamlArg t))
| OCamlArg (Bool _) -> "bool"
| OCamlArg (BytesIn _) -> "bytes"
| OCamlArg (BytesPersistIn _) -> "Buffer.t"
| OCamlArg (BytesOut _) -> "bytes&q...
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 Jun 20
1
Re: [libnbd RFC PATCH 9/8] wip: generator: Add ReadStatus enum type
...gt; + | ReadStatus n -> n, None
> | SockAddrAndLen (n, _) -> n, None
> | String n -> n, None
> | StringList n -> n, None
> @@ -3929,6 +3956,7 @@ and ocaml_arg_to_string = function
> | OCamlArg (Int64 _) -> "int64"
> | OCamlArg (Opaque n) -> sprintf "'%s" n
> | OCamlArg (Path _) -> "string"
> + | OCamlArg (ReadStatus _) -> "int"
> | OCamlArg (SockAddrAndLen _) -> "string" (* XXX not impl *)
>...
2019 Jun 25
3
[PATCH libnbd] generator: Add Mutable type to the generator.
...gt; n, None
+ | Mutable arg -> List.hd (name_of_arg arg), None
| Opaque n -> n, None
| Path n -> n, None
| SockAddrAndLen (n, _) -> n, None
@@ -3820,6 +3854,7 @@ and ocaml_arg_to_string = function
| OCamlArg (Flags _) -> assert false (* see above *)
| OCamlArg (Int _) -> "int"
| OCamlArg (Int64 _) -> "int64"
+ | OCamlArg (Mutable arg) -> ocaml_arg_to_string (OCamlArg arg) ^ " ref"
| OCamlArg (Opaque n) -> sprintf "'%s" n
| OCamlArg...
2019 Jul 24
0
[PATCH libnbd 1/3] generator: Change Closure so it describes single callbacks.
...n, None]
| Int64 n -> [n, None]
@@ -4471,7 +4415,6 @@ end = struct
type ocaml_arg =
| OCamlHandle (* The NBD handle (NBD.t) *)
| OCamlFlags of string (* Optional ?flags parameter *)
- | OCamlClosure of bool * closure (* Single closure parameter *)
| OCamlArg of arg (* Other arg (string = name). *)
let args_to_ocaml_args args =
@@ -4483,8 +4426,6 @@ let args_to_ocaml_args args =
let args =
List.map (
function
- | Closure (persistent, cls) ->
- List.map (fun cl -> OCamlClosure (persistent, cl)) cls...
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 2/3] lib: Implement closure lifetimes.
...quot;0"]
| Int n -> [n, None]
| Int64 n -> [n, None]
@@ -4424,10 +4405,7 @@ let args_to_ocaml_args args =
| Flags n :: rest -> Some (OCamlFlags n), List.rev rest
| _ -> None, args in
let args =
- List.map (
- function
- | a -> [OCamlArg a]
- ) args in
+ List.map (fun a -> [OCamlArg a]) args in
let args = List.flatten args in
match flags with
| Some f -> f :: OCamlHandle :: args
@@ -4450,7 +4428,7 @@ and ocaml_arg_to_string = function
| OCamlArg (BytesPersistIn _) -> "Buffer.t"
| OCamlArg (By...
2019 Jun 18
17
[libnbd PATCH 0/8] Add nbd_pread_callback
I've mentioned this topic before (in fact, the idea of adding
NBD_CMD_FLAG_DF was first mentioned at [1]), but finally finished
enough of an implementation to feel confident in posting it.
I'd still like to add something under examples/ that uses the new API
to implement strict checking of a server's structured replies read
implementation (ensure that a server never sends data after
2019 Jul 24
0
[PATCH libnbd v2 2/5] lib: Implement closure lifetimes.
...quot;0"]
| Int n -> [n, None]
| Int64 n -> [n, None]
@@ -4424,10 +4396,7 @@ let args_to_ocaml_args args =
| Flags n :: rest -> Some (OCamlFlags n), List.rev rest
| _ -> None, args in
let args =
- List.map (
- function
- | a -> [OCamlArg a]
- ) args in
+ List.map (fun a -> [OCamlArg a]) args in
let args = List.flatten args in
match flags with
| Some f -> f :: OCamlHandle :: args
@@ -4450,7 +4419,7 @@ and ocaml_arg_to_string = function
| OCamlArg (BytesPersistIn _) -> "Buffer.t"
| OCamlArg (By...
2019 Jul 25
0
[PATCH libnbd v3 1/2] lib: Implement closure lifetimes.
...quot;0"]
| Int n -> [n, None]
| Int64 n -> [n, None]
@@ -4345,10 +4317,7 @@ let args_to_ocaml_args args =
| Flags n :: rest -> Some (OCamlFlags n), List.rev rest
| _ -> None, args in
let args =
- List.map (
- function
- | a -> [OCamlArg a]
- ) args in
+ List.map (fun a -> [OCamlArg a]) args in
let args = List.flatten args in
match flags with
| Some f -> f :: OCamlHandle :: args
@@ -4371,7 +4340,7 @@ and ocaml_arg_to_string = function
| OCamlArg (BytesPersistIn _) -> "Buffer.t"
| OCamlArg (By...
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 Aug 03
1
[PATCH libnbd] generator: Generate typedefs automatically for Closure arguments.
...egister_generational_global_root (%s_user_data);\n" cbname;
pr " *%s_user_data = %sv;\n" cbname cbname;
- pr " const void *%s = %s_%s_wrapper;\n" cbname name cbname
+ pr " const void *%s_callback = %s_%s_wrapper;\n" cbname name cbname
| OCamlArg (Flags _) -> assert false (* see above *)
| OCamlArg (Int n) ->
pr " int %s = Int_val (%sv);\n" n n
diff --git a/generator/states-reply-simple.c b/generator/states-reply-simple.c
index e0fd71d..9b249ab 100644
--- a/generator/states-reply-simple.c
+++ b/generator/states...
2019 Jul 16
0
[PATCH libnbd v2] generator: Define new Closure type instead of callbacks.
...quot;:
nbdsh.shell()
"
+(*
(*----------------------------------------------------------------------*)
(* OCaml bindings. *)
@@ -4427,7 +4447,7 @@ and ocaml_ret_to_string = function
let name_of_ocaml_arg = function
| OCamlHandle -> "h"
| OCamlFlags n -> n
- | OCamlArg a -> List.hd (name_of_arg a)
+ | OCamlArg a -> List.hd (c_name_of_arg a)
let generate_ocaml_nbd_mli () =
generate_header OCamlStyle;
@@ -4686,7 +4706,7 @@ let print_ocaml_binding (name, { args; ret }) =
pr " int ret;\n";
pr "\n";
pr "...
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.