I think just returning error codes to the client is far too little
information. I don't think we need the fully normalized structure
that Luiz originally proposed with bus/dev addresses split out, but
we certainly need to include a string description giving as much
detail as possible. If attaching a host USB device failed, I don't
want a single error code QERR_OPEN_FAILED, nor a generic message
like 'could not open device', i want the exact details, eg
'could not open device: permission denied'
'could not open device: no such file or directory'
'could not open device: device or resource busy'
Which makes me wonder whenever it makes sense to re-use errno for the
error codes instead of inventing our own QERR_* codes? Not the numbers
of course because they are not standardized as far I know, but the Ename
strings.
If you error out because a system call failed you can pass up errno
straight to the client without loosing information along the way. And
for other error conditions it should be possible to find error codes
describing what happened, i.e. when trying to add a device where no
backend driver exists in qemu you can return ENOENT (plus freeform text
message for error logging).
cheers,
Gerd