All handle calls which has the modifies_fd flag set to true will be
excluded from AsyncHandle (the asynchronous handle in the rust
bindings). This is a better approach then listing all calls that should
be excluded in Rust.ml explicetly.
---
 generator/Rust.ml | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/generator/Rust.ml b/generator/Rust.ml
index 3ee53bc..c86f9f7 100644
--- a/generator/Rust.ml
+++ b/generator/Rust.ml
@@ -574,18 +574,17 @@ let generate_rust_bindings () =
 
 let excluded_handle_calls : NameSet.t =
   NameSet.of_list
-    [
-      "aio_get_fd";
-      "aio_get_direction";
-      "aio_notify_read";
-      "aio_notify_write";
-      "clear_debug_callback";
-      "get_debug";
-      "poll";
-      "poll2";
-      "set_debug";
-      "set_debug_callback";
-    ]
+  @@ [
+       "aio_get_fd";
+       "aio_get_direction";
+       "clear_debug_callback";
+       "get_debug";
+       "set_debug";
+       "set_debug_callback";
+     ]
+  @ (handle_calls
+    |> List.filter (fun (_, { modifies_fd }) -> modifies_fd)
+    |> List.map (fun (name, _) -> name))
 
 (* A mapping with names as keys. *)
 module NameMap = Map.Make (String)
@@ -615,11 +614,7 @@ let async_handle_calls : (string * call * async_kind) 
NameMap.t =
 let sync_handle_calls : call NameMap.t =
   handle_calls
   |> List.filter (fun (n, _) -> not (NameSet.mem n excluded_handle_calls))
-  |> List.filter (fun (name, _) ->
-         (not (NameMap.mem name async_handle_calls))
-         && not
-              (String.starts_with ~prefix:"aio_" name
-              && NameMap.mem (strip_aio name) async_handle_calls))
+  |> List.filter (fun (n, _) -> not (NameMap.mem n async_handle_calls))
   |> List.to_seq |> NameMap.of_seq
 
 (* Get the Rust type for an argument in the asynchronous API. Like
-- 
2.42.0

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to