[Libguestfs] [nbdkit PATCH v2 1/3] backend: Rework internal/filter error return semantics

Richard W.M. Jones rjones at redhat.com
Tue Feb 6 07:05:19 UTC 2018


I had a think about this.  How about (for the internal backend
interface only) returning an extra ‘int *err’ parameter?

  int (*pread) (struct backend *, struct connection *conn, void *buf, uint32_t count, uint64_t offset, uint32_t flags, int *err);

This has some advantages:

 - It's explicit.

 - It means we preserve the convention that -1 = error
   used everywhere else in nbdkit.

 - Better for APIs that actually return something like get_size.

 - Can be both read and written.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list