On 01/24/2017 09:41 AM, Richard W.M. Jones wrote:
On Tue, Jan 24, 2017 at 03:16:45PM +0000, Richard W.M. Jones wrote:
> However we could add another API:
>
> nbdkit_set_errno (int errno);
>
> This allows the plugin to send the errno back to the core code
> explicitly. It's effectively stored as a global in the core code.
What I'm really saying here is that at the moment (after your previous
patch series) we have an implicit channel where errno is passed from
the plugin to the core code. We should simply make that channel
explicit and controlled by the plugin.
Sounds reasonable. Do we really want plugins to report the full range of
errno (using POSIX::errno in your perl example), or do we want the
plugins to expose a new enum, with just the 5 or 6 errno values actually
supported by the NBD protocol? I'm leaning towards each binding
providing an enum of just the supported error values, in an nbd_
namespace, rather than tying directly to system errno values.
Also, the NBD spec DOES allow for the server to send a string error
message alongside the error code; we aren't utilizing that yet, but it
would be worth exploring how easy it would be to let the plugin's error
message be reflected through to the client.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org