On Fri, Aug 16, 2019 at 08:29:28AM -0500, Eric Blake wrote:
--- a/plugins/ocaml/ocaml.c +++ b/plugins/ocaml/ocaml.c @@ -849,12 +849,19 @@ ocaml_nbdkit_set_error (value nv) int err;
switch (Int_val (nv)) { + /* On-the-wire values */
Not sure about this comment. The values on the left match the values in NBDKit.ml's ‘set_error’ function, and are basically internal to the OCaml bindings. The values on the right are from <errno.h> and AIUI they might be unrelated to what is sent on the wire (especially on non-Linux). Nevertheless the implementation is still correct, so ACK. Rich.
case 1: err = EPERM; break; case 2: err = EIO; break; case 3: err = ENOMEM; break; case 4: err = EINVAL; break; case 5: err = ENOSPC; break; case 6: err = ESHUTDOWN; break; + case 7: err = EOVERFLOW; break; + /* Necessary for .zero support */ + case 8: err = ENOTSUP; break; + /* Other errno that server/protocol.c treats specially */ + case 9: err = EROFS; break; + case 10: err = EFBIG; break; default: abort (); }
diff --git a/plugins/ocaml/NBDKit.ml b/plugins/ocaml/NBDKit.ml index 68d15836..e54a7705 100644 --- a/plugins/ocaml/NBDKit.ml +++ b/plugins/ocaml/NBDKit.ml @@ -267,6 +267,10 @@ let set_error unix_error = | Unix.EINVAL -> 4 | Unix.ENOSPC -> 5 | Unix.ESHUTDOWN -> 6 + | Unix.EOVERFLOW -> 7 + | Unix.EOPNOTSUPP -> 8 + | Unix.EROFS -> 9 + | Unix.EFBIG -> 10 | _ -> 4 (* EINVAL *) in
_set_error nbd_error -- 2.20.1
_______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW