|
From: | Gerd Hoffmann |
Subject: | Re: [Qemu-devel] [PATCH 7/9] qdev: Use QError for not found error |
Date: | Mon, 19 Oct 2009 12:40:08 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20090922 Fedora/3.0-2.7.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |