This doesn't change the C API, except that it is now permitted to pass
NULL, NULL for the completion callback. For the Python and OCaml
APIs the parameter changes to be an optional parameter.
---
generator/generator | 36 +++++++++----------
ocaml/examples/asynch_copy.ml | 5 +--
.../test_505_aio_pread_structured_callback.ml | 12 ++++---
ocaml/tests/test_590_aio_copy.ml | 5 +--
4 files changed, 30 insertions(+), 28 deletions(-)
diff --git a/generator/generator b/generator/generator
index 8f15786..6ccfc5f 100755
--- a/generator/generator
+++ b/generator/generator
@@ -1836,9 +1836,8 @@ C<nbd_pread>.";
"aio_pread_callback", {
default_call with
- args = [ BytesPersistOut ("buf", "count"); UInt64
"offset";
- Closure completion_closure ];
- optargs = [ OFlags ("flags", cmd_flags) ];
+ args = [ BytesPersistOut ("buf", "count"); UInt64
"offset" ];
+ optargs = [ OClosure completion_closure; OFlags ("flags", cmd_flags) ];
ret = RInt64;
permitted_states = [ Connected ];
shortdesc = "read from the NBD server, with callback on completion";
@@ -1874,9 +1873,8 @@ documented in C<nbd_pread_structured>.";
"aio_pread_structured_callback", {
default_call with
args = [ BytesPersistOut ("buf", "count"); UInt64
"offset";
- Closure chunk_closure;
- Closure completion_closure ];
- optargs = [ OFlags ("flags", cmd_flags) ];
+ Closure chunk_closure ];
+ optargs = [ OClosure completion_closure; OFlags ("flags", cmd_flags) ];
ret = RInt64;
permitted_states = [ Connected ];
shortdesc = "read from the NBD server, with callback on completion";
@@ -1910,9 +1908,8 @@ C<nbd_pwrite>.";
"aio_pwrite_callback", {
default_call with
- args = [ BytesPersistIn ("buf", "count"); UInt64
"offset";
- Closure completion_closure ];
- optargs = [ OFlags ("flags", cmd_flags) ];
+ args = [ BytesPersistIn ("buf", "count"); UInt64
"offset" ];
+ optargs = [ OClosure completion_closure; OFlags ("flags", cmd_flags) ];
ret = RInt64;
permitted_states = [ Connected ];
shortdesc = "write to the NBD server, with callback on completion";
@@ -1966,8 +1963,8 @@ Parameters behave as documented in C<nbd_flush>.";
"aio_flush_callback", {
default_call with
- args = [ Closure completion_closure ];
- optargs = [ OFlags ("flags", cmd_flags) ];
+ args = [];
+ optargs = [ OClosure completion_closure; OFlags ("flags", cmd_flags) ];
ret = RInt64;
permitted_states = [ Connected ];
shortdesc = "send flush command to the NBD server, with callback on
completion";
@@ -1999,8 +1996,8 @@ Parameters behave as documented in C<nbd_trim>.";
"aio_trim_callback", {
default_call with
- args = [ UInt64 "count"; UInt64 "offset"; Closure
completion_closure ];
- optargs = [ OFlags ("flags", cmd_flags) ];
+ args = [ UInt64 "count"; UInt64 "offset" ];
+ optargs = [ OClosure completion_closure; OFlags ("flags", cmd_flags) ];
ret = RInt64;
permitted_states = [ Connected ];
shortdesc = "send trim command to the NBD server, with callback on
completion";
@@ -2032,8 +2029,8 @@ Parameters behave as documented in C<nbd_cache>.";
"aio_cache_callback", {
default_call with
- args = [ UInt64 "count"; UInt64 "offset"; Closure
completion_closure ];
- optargs = [ OFlags ("flags", cmd_flags) ];
+ args = [ UInt64 "count"; UInt64 "offset" ];
+ optargs = [ OClosure completion_closure; OFlags ("flags", cmd_flags) ];
ret = RInt64;
permitted_states = [ Connected ];
shortdesc = "send cache (prefetch) command to the NBD server, with callback on
completion";
@@ -2065,8 +2062,8 @@ Parameters behave as documented in C<nbd_zero>.";
"aio_zero_callback", {
default_call with
- args = [ UInt64 "count"; UInt64 "offset"; Closure
completion_closure ];
- optargs = [ OFlags ("flags", cmd_flags) ];
+ args = [ UInt64 "count"; UInt64 "offset" ];
+ optargs = [ OClosure completion_closure; OFlags ("flags", cmd_flags) ];
ret = RInt64;
permitted_states = [ Connected ];
shortdesc = "send write zeroes command to the NBD server, with callback on
completion";
@@ -2098,9 +2095,8 @@ Parameters behave as documented in
C<nbd_block_status>.";
"aio_block_status_callback", {
default_call with
- args = [ UInt64 "count"; UInt64 "offset";
- Closure extent_closure; Closure completion_closure ];
- optargs = [ OFlags ("flags", cmd_flags) ];
+ args = [ UInt64 "count"; UInt64 "offset"; Closure extent_closure
];
+ optargs = [ OClosure completion_closure; OFlags ("flags", cmd_flags) ];
ret = RInt64;
permitted_states = [ Connected ];
shortdesc = "send block status command to the NBD server, with callback on
completion";
diff --git a/ocaml/examples/asynch_copy.ml b/ocaml/examples/asynch_copy.ml
index 7dbe976..5aa6e60 100644
--- a/ocaml/examples/asynch_copy.ml
+++ b/ocaml/examples/asynch_copy.ml
@@ -49,7 +49,7 @@ let asynch_copy src dst =
let bs = min bs (size -^ !soff) in
let buf = NBD.Buffer.alloc (Int64.to_int bs) in
ignore (NBD.aio_pread_callback src buf !soff
- (read_completed buf !soff));
+ ~completion:(read_completed buf !soff));
soff := !soff +^ bs
);
@@ -59,7 +59,8 @@ let asynch_copy src dst =
List.iter (
fun (buf, offset) ->
(* Note the size of the write is implicitly stored in buf. *)
- ignore (NBD.aio_pwrite_callback dst buf offset (write_completed buf))
+ ignore (NBD.aio_pwrite_callback dst buf offset
+ ~completion:(write_completed buf))
) !writes;
writes := [];
diff --git a/ocaml/tests/test_505_aio_pread_structured_callback.ml
b/ocaml/tests/test_505_aio_pread_structured_callback.ml
index 9b9ac2c..dc0d557 100644
--- a/ocaml/tests/test_505_aio_pread_structured_callback.ml
+++ b/ocaml/tests/test_505_aio_pread_structured_callback.ml
@@ -60,7 +60,8 @@ let () =
(* First try: succeed in both callbacks *)
let buf = NBD.Buffer.alloc 512 in
- let cookie = NBD.aio_pread_structured_callback nbd buf 0_L (chunk 42) (callback 42) in
+ let cookie = NBD.aio_pread_structured_callback nbd buf 0_L (chunk 42)
+ ~completion:(callback 42) in
while not (NBD.aio_command_completed nbd cookie) do
ignore (NBD.poll nbd (-1))
done;
@@ -71,7 +72,8 @@ let () =
(* Second try: fail only during callback *)
let buf = NBD.Buffer.alloc 512 in
- let cookie = NBD.aio_pread_structured_callback nbd buf 0_L (chunk 42) (callback 43) in
+ let cookie = NBD.aio_pread_structured_callback nbd buf 0_L (chunk 42)
+ ~completion:(callback 43) in
try
while not (NBD.aio_command_completed nbd cookie) do
ignore (NBD.poll nbd (-1))
@@ -84,7 +86,8 @@ let () =
(* Third try: fail during both *)
let buf = NBD.Buffer.alloc 512 in
- let cookie = NBD.aio_pread_structured_callback nbd buf 0_L (chunk 43) (callback 44) in
+ let cookie = NBD.aio_pread_structured_callback nbd buf 0_L (chunk 43)
+ ~completion:(callback 44) in
try
while not (NBD.aio_command_completed nbd cookie) do
ignore (NBD.poll nbd (-1))
@@ -97,7 +100,8 @@ let () =
(* Fourth try: fail only during chunk *)
let buf = NBD.Buffer.alloc 512 in
- let cookie = NBD.aio_pread_structured_callback nbd buf 0_L (chunk 43) (callback 42) in
+ let cookie = NBD.aio_pread_structured_callback nbd buf 0_L (chunk 43)
+ ~completion:(callback 42) in
try
while not (NBD.aio_command_completed nbd cookie) do
ignore (NBD.poll nbd (-1))
diff --git a/ocaml/tests/test_590_aio_copy.ml b/ocaml/tests/test_590_aio_copy.ml
index 290ca93..18ce389 100644
--- a/ocaml/tests/test_590_aio_copy.ml
+++ b/ocaml/tests/test_590_aio_copy.ml
@@ -72,7 +72,7 @@ let asynch_copy src dst =
let bs = min bs (size -^ !soff) in
let buf = NBD.Buffer.alloc (Int64.to_int bs) in
ignore (NBD.aio_pread_callback src buf !soff
- (read_completed buf !soff));
+ ~completion:(read_completed buf !soff));
soff := !soff +^ bs
);
@@ -82,7 +82,8 @@ let asynch_copy src dst =
List.iter (
fun (buf, offset) ->
(* Note the size of the write is implicitly stored in buf. *)
- ignore (NBD.aio_pwrite_callback dst buf offset (write_completed buf))
+ ignore (NBD.aio_pwrite_callback dst buf offset
+ ~completion:(write_completed buf))
) !writes;
writes := [];
--
2.22.0