diff mbox series

uapi: add EROBLK

Message ID 9184b5e8-7070-4395-b179-4975b2e3fbc3@p183 (mailing list archive)
State New, archived
Headers show
Series uapi: add EROBLK | expand

Commit Message

Alexey Dobriyan Nov. 19, 2024, 3:54 p.m. UTC
Block drivers and DM sometimes use EROFS to report errors. There is
no confusion about what happens but naive error reporting code might
pass -EROFS to strerror(3) which will print "filesystem" when clearly
there is no filesystem anywhere, it is layer above.

Or in other words, if EROFS exists, why not EROBLK?
It is not like there is a tax on errno values.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 include/uapi/asm-generic/errno.h |    1 +
 1 file changed, 1 insertion(+)

Comments

Christoph Hellwig Nov. 19, 2024, 4:22 p.m. UTC | #1
On Tue, Nov 19, 2024 at 06:54:52PM +0300, Alexey Dobriyan wrote:
> Block drivers and DM sometimes use EROFS to report errors. There is
> no confusion about what happens but naive error reporting code might
> pass -EROFS to strerror(3) which will print "filesystem" when clearly
> there is no filesystem anywhere, it is layer above.
> 
> Or in other words, if EROFS exists, why not EROBLK?
> It is not like there is a tax on errno values.

And where would you return this value without breaking existing
userspace?
Alexey Dobriyan Nov. 19, 2024, 5:20 p.m. UTC | #2
On Tue, Nov 19, 2024 at 08:22:08AM -0800, Christoph Hellwig wrote:
> On Tue, Nov 19, 2024 at 06:54:52PM +0300, Alexey Dobriyan wrote:
> > Block drivers and DM sometimes use EROFS to report errors. There is
> > no confusion about what happens but naive error reporting code might
> > pass -EROFS to strerror(3) which will print "filesystem" when clearly
> > there is no filesystem anywhere, it is layer above.
> > 
> > Or in other words, if EROFS exists, why not EROBLK?
> > It is not like there is a tax on errno values.
> 
> And where would you return this value without breaking existing
> userspace?

New code may start returning it right away.

Old code may start checking for both and in ~100 years delete EROFS
clause.
Christoph Hellwig Nov. 19, 2024, 5:27 p.m. UTC | #3
On Tue, Nov 19, 2024 at 08:20:33PM +0300, Alexey Dobriyan wrote:
> > And where would you return this value without breaking existing
> > userspace?
> 
> New code may start returning it right away.
> 
> Old code may start checking for both and in ~100 years delete EROFS
> clause.

In other word it's all hypothetical, you have no actual users in mind
and no ral problem to solve?
diff mbox series

Patch

--- a/include/uapi/asm-generic/errno.h
+++ b/include/uapi/asm-generic/errno.h
@@ -119,5 +119,6 @@ 
 #define ERFKILL		132	/* Operation not possible due to RF-kill */
 
 #define EHWPOISON	133	/* Memory page has hardware error */
+#define EROBLK		134	/* Block device is read-only */
 
 #endif