[Libguestfs] [PATCH libnbd] DO NOT PUSH: Update api: Add get_nr_meta_contexts, clear_meta_contexts

Richard W.M. Jones rjones at redhat.com
Tue Sep 29 11:47:08 UTC 2020


---
 generator/API.ml | 2 +-
 lib/handle.c     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/generator/API.ml b/generator/API.ml
index 770f41e..fd6f033 100644
--- a/generator/API.ml
+++ b/generator/API.ml
@@ -1024,7 +1024,7 @@ what it actually supports, see L<nbd_can_meta_context(3)>.";
 
   "get_meta_context", {
     default_call with
-    args = [ Int "i" ]; ret = RString;
+    args = [ SizeT "i" ]; ret = RString;
     shortdesc = "return the i'th meta context request";
     longdesc = "\
 During connection libnbd can negotiate zero or more metadata
diff --git a/lib/handle.c b/lib/handle.c
index e0047b7..7adc6d1 100644
--- a/lib/handle.c
+++ b/lib/handle.c
@@ -320,12 +320,12 @@ nbd_unlocked_get_nr_meta_contexts (struct nbd_handle *h)
 }
 
 char *
-nbd_unlocked_get_meta_context (struct nbd_handle *h, int i)
+nbd_unlocked_get_meta_context (struct nbd_handle *h, size_t i)
 {
   size_t len = nbd_internal_string_list_length (h->request_meta_contexts);
   char *ret;
 
-  if (i < 0 || i >= len) {
+  if (i >= len) {
     set_error (EINVAL, "meta context request out of range");
     return NULL;
   }
-- 
2.28.0.rc2




More information about the Libguestfs mailing list