* [Question] Usage of ENOTSUPP error code
@ 2015-07-03 10:17 Masahiro Yamada
2015-07-06 7:37 ` Clemens Ladisch
0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2015-07-03 10:17 UTC (permalink / raw)
To: Linux Kernel Mailing List
Hello experts,
I noticed many drivers return -ENOTSUPP on error.
I assume ENOTSUPP is defined in include/linux/errno.h
as follows:
/* Defined for the NFSv3 protocol */
#define EBADHANDLE 521 /* Illegal NFS file handle */
#define ENOTSYNC 522 /* Update synchronization mismatch */
#define EBADCOOKIE 523 /* Cookie is stale */
#define ENOTSUPP 524 /* Operation is not supported */
#define ETOOSMALL 525 /* Buffer or request is too small */
#define ESERVERFAULT 526 /* An untranslatable error occurred */
#define EBADTYPE 527 /* Type not supported by server */
#define EJUKEBOX 528 /* Request initiated, but will not complete
before timeout */
#define EIOCBQUEUED 529 /* iocb queued, will get completion event */
I also assume the comment "Defined for the NFSv3 protocol"
is valid for whole of this block.
If so, should ENOTSUPP be only used for NFS-related errors?
In fact, ENOTSUPP is used by various drivers
including non-network ones such as pinctrl, USB, etc.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Question] Usage of ENOTSUPP error code
2015-07-03 10:17 [Question] Usage of ENOTSUPP error code Masahiro Yamada
@ 2015-07-06 7:37 ` Clemens Ladisch
2015-07-06 16:25 ` Masahiro Yamada
0 siblings, 1 reply; 3+ messages in thread
From: Clemens Ladisch @ 2015-07-06 7:37 UTC (permalink / raw)
To: Masahiro Yamada, Linux Kernel Mailing List
Masahiro Yamada wrote:
> I noticed many drivers return -ENOTSUPP on error.
>
> I assume ENOTSUPP is defined in include/linux/errno.h
> as follows:
>
> /* Defined for the NFSv3 protocol */
> ...
> #define ENOTSUPP 524 /* Operation is not supported */
>
> If so, should ENOTSUPP be only used for NFS-related errors?
There is typcially no such restriction.
However, the problem with ENOTSUPP is that it is not defined in
the uapi header, so it will not be known to user space programs.
> In fact, ENOTSUPP is used by various drivers
> including non-network ones such as pinctrl, USB, etc.
If it is possible that the error code shows up for user space, ENOTSUPP
should not be used. Alternatives would be something like ENOTSUP,
EOPNOTSUPP, ENOIOCTLCMD, ENOSYS, or EINVAL.
Regards,
Clemens
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Question] Usage of ENOTSUPP error code
2015-07-06 7:37 ` Clemens Ladisch
@ 2015-07-06 16:25 ` Masahiro Yamada
0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2015-07-06 16:25 UTC (permalink / raw)
To: Clemens Ladisch; +Cc: Linux Kernel Mailing List
Hi Clemens,
Thanks for your clarification.
2015-07-06 16:37 GMT+09:00 Clemens Ladisch <clemens@ladisch.de>:
> Masahiro Yamada wrote:
>> I noticed many drivers return -ENOTSUPP on error.
>>
>> I assume ENOTSUPP is defined in include/linux/errno.h
>> as follows:
>>
>> /* Defined for the NFSv3 protocol */
>> ...
>> #define ENOTSUPP 524 /* Operation is not supported */
>>
>> If so, should ENOTSUPP be only used for NFS-related errors?
>
> There is typcially no such restriction.
Maybe, shoulld such a confusing comment be deleted?
> However, the problem with ENOTSUPP is that it is not defined in
> the uapi header, so it will not be known to user space programs.
>
>> In fact, ENOTSUPP is used by various drivers
>> including non-network ones such as pinctrl, USB, etc.
>
> If it is possible that the error code shows up for user space, ENOTSUPP
> should not be used. Alternatives would be something like ENOTSUP,
> EOPNOTSUPP, ENOIOCTLCMD, ENOSYS, or EINVAL.
>
Oh dear, we have ENOTSUP as well as ENOTSUPP...
but, it looks like ENOTSUP is only defined by
arch/parisc/include/uapi/asm/errno.h,
so it is not globally available.
EOPNOTSUPP is also accompanied with a comment that implies it is
intended for network.
After all, I often use EINVAL when unsupported operations are requested.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-06 16:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-03 10:17 [Question] Usage of ENOTSUPP error code Masahiro Yamada
2015-07-06 7:37 ` Clemens Ladisch
2015-07-06 16:25 ` Masahiro Yamada
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.