Jesus Sanchez-Palencia <jesus.sanchez-palencia@...>
On Thu, 18 Feb 2016 17:47:56 -0200
Andre Guedes <andre.guedes(a)intel.com> wrote:
+1 from my side, mainly so we don't need to discuss the addition of new error codes ever again :).
I would say it's more about 3) and 4) really, as I've seen surprisingly often how 1) and 2) are not
always true. I've seen recently people getting confused about what to return and when, myself
included. In the end it doesn't matter from each .h file you get the errors from, as long as you
have clear guidelines for them, in my opinion.
+1 ! But I would propose that we first get this right for the device driver APIs.
What we have on device.h currently is:
/* Common Error Codes devices can provide */
#define DEV_OK 0 /* No error */
#define DEV_FAIL 1 /* General operation failure */
#define DEV_INVALID_OP 2 /* Invalid operation */
#define DEV_INVALID_CONF 3 /* Invalid configuration */
#define DEV_USED 4 /* Device controller in use */
#define DEV_NO_ACCESS 5 /* Controller not accessible */
#define DEV_NO_SUPPORT 6 /* Device type not supported */
#define DEV_NOT_CONFIG 7 /* Device not configured */
I liked Dirk's suggestion on the previous thread, so I'm gonna propose 2 quick steps:
a- let's try to map each of this to errno codes;
b- let's document when we should return each of them.
You probably have b) ready from the other thread as well, so let me give it a try with a).
If we get this two right, then we end up with both the guidelines for documenting and the
transition patch Dirk suggested. After he deprecates DEV_*, moving to errno codes will be as easy
as a few seds. So:
DEV_OK = 0
DEV_FAIL = (??)
DEV_INVALID_OP = -EPERM or -ENOTSUP (??)
DEV_INVALID_CONF = -EINVAL
DEV_USED = -EBUSY
DEV_NO_ACCESS = -EAGAIN
DEV_NO_SUPPORT = -ENODEV or -ENXIO (??)
DEV_NOT_CONFIG = (??)
DEV_NOT_IMPLEMENTED = -ENOSYS
*this last one is from your previous RFC.
How bad does that look?!