Skip to contentSkip to conversation

ENOATTR and other error enums

DISCUSSION Nathan Scott 2 participants 4 messages Oct 8, 2001 – Oct 9, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

hi there,

Quoted 3 lines · monkeyiq

Hi,
Anyone know where these are defined in Linux? I dont seem
to be able to find them, even with find/grep in /usr/include.

ENOATTR is not a blessed errno in Linux. In XFS we have simply defined it to be the same as ENODATA for the time being. The ext2 extended attributes project define it to be EDOM, also as a stop-gap solution I imagine.

A similar problem exists with ENOTSUP (defined by POSIX 1003.1b?)
- this is only supported via linux/asm-parisc/errno.h as a real errno, among all the architectures. Both the XFS and ext2 extended attributes implementations define this errno to be EOPNOTSUPP as an interim solution. Ah, wait - from a quick test, glibc does seem to do exactly this also, so this one is not a problem (except perhaps on the parisc port? -- hmm, that could actually be a bug on parisc).

On a related topic, but not specific to extended attributes - for XFS in general, we needed one other errno - EFSCORRUPTED. This is used when XFS goes into forced shutdown mode for a filesystem that has been detected as on-disk corrupt, to stop making the situation any worse (user must umount/xfs_repair). We couldn't find any pre- existing Linux errno vaguely similar to this one, so it was defined to "990" until a real solution could be found.

Obviously, these are not the correct long-term solutions ... they need to become real Linux errno's, I think, and ENOTSUP could be defined to EOPNOTSUPP? - EWOULDBLOCK, EDEADLOCK seem to do this. I'm not sure how to reach that point though (CC'ing linux-kernel for any advice) - for reference, in IRIX these errnos are defined as follows:

ENOATTR = Attribute not found
EFSCORRUPTED = Filesystem is corrupted

Quoted 2 lines

Also, is there a function to get a string rep of the error that occured in the attr code?

Someday it should become a part of asm-XXXXX/errno.h (errno's are architecture specific) and the libc strerror(3) routine should be able to provide a meaningful string. But currently that does not happen.

cheers.

Signature · 1 line
Nathan
#2 lore raw
In reply to a message not in the archive

hi fellas,

Here is an errno.h patch which provides these new errno values. XFS needs both values. ENOATTR is also required by the ext2 extended attributes project (and any other filesystem intending to implement extended attributes in the future). Both values need to be visible in both kernel and user space, so this patch would be an initial step toward libc support also, hopefully.

In the absence of any cleaner way to do this (?), could we have this patch applied please? Any/all feedback much appreciated -- thanks.

cheers.

Quoted 50 lines · Nathan Scott

hi there,

Quoted 3 lines · monkeyiq

Hi,
Anyone know where these are defined in Linux? I dont seem
to be able to find them, even with find/grep in /usr/include.

ENOATTR is not a blessed errno in Linux. In XFS we have simply defined it to be the same as ENODATA for the time being. The ext2 extended attributes project define it to be EDOM, also as a stop-gap solution I imagine.

A similar problem exists with ENOTSUP (defined by POSIX 1003.1b?)
- this is only supported via linux/asm-parisc/errno.h as a real errno, among all the architectures. Both the XFS and ext2 extended attributes implementations define this errno to be EOPNOTSUPP as an interim solution. Ah, wait - from a quick test, glibc does seem to do exactly this also, so this one is not a problem (except perhaps on the parisc port? -- hmm, that could actually be a bug on parisc).

On a related topic, but not specific to extended attributes - for XFS in general, we needed one other errno - EFSCORRUPTED. This is used when XFS goes into forced shutdown mode for a filesystem that has been detected as on-disk corrupt, to stop making the situation any worse (user must umount/xfs_repair). We couldn't find any pre- existing Linux errno vaguely similar to this one, so it was defined to "990" until a real solution could be found.

Obviously, these are not the correct long-term solutions ... they need to become real Linux errno's, I think, and ENOTSUP could be defined to EOPNOTSUPP? - EWOULDBLOCK, EDEADLOCK seem to do this. I'm not sure how to reach that point though (CC'ing linux-kernel for any advice) - for reference, in IRIX these errnos are defined as follows:

ENOATTR = Attribute not found
EFSCORRUPTED = Filesystem is corrupted

Quoted 2 lines

Also, is there a function to get a string rep of the error that occured in the attr code?

Someday it should become a part of asm-XXXXX/errno.h (errno's are architecture specific) and the libc strerror(3) routine should be able to provide a meaningful string. But currently that does not happen.

cheers.

Signature · 1 line
Nathan
Signature · 1 line
Nathan
include/asm-alpha/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-alpha/errno.h linux-errno/include/asm-alpha/errno.h
@@ -138,5 +138,7 @@
 
 #define ENOMEDIUM	129	/* No medium found */
 #define EMEDIUMTYPE	130	/* Wrong medium type */
+#define EFSCORRUPTED	131	/* Filesystem is corrupted */
+#define ENOATTR		132	/* No such attribute */
 
 #endif
include/asm-arm/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-arm/errno.h linux-errno/include/asm-arm/errno.h
@@ -128,5 +128,7 @@
 
 #define	ENOMEDIUM	123	/* No medium found */
 #define	EMEDIUMTYPE	124	/* Wrong medium type */
+#define	EFSCORRUPTED	125	/* Filesystem is corrupted */
+#define	ENOATTR		126	/* No such attribute */
 
 #endif
include/asm-cris/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-cris/errno.h linux-errno/include/asm-cris/errno.h
@@ -130,5 +130,7 @@
 
 #define	ENOMEDIUM	123	/* No medium found */
 #define	EMEDIUMTYPE	124	/* Wrong medium type */
+#define	EFSCORRUPTED	125	/* Filesystem is corrupted */
+#define	ENOATTR		126	/* No such attribute */
 
 #endif
include/asm-i386/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-i386/errno.h linux-errno/include/asm-i386/errno.h
@@ -128,5 +128,7 @@
 
 #define	ENOMEDIUM	123	/* No medium found */
 #define	EMEDIUMTYPE	124	/* Wrong medium type */
+#define	EFSCORRUPTED	125	/* Filesystem is corrupted */
+#define	ENOATTR		126	/* No such attribute */
 
 #endif
include/asm-ia64/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-ia64/errno.h linux-errno/include/asm-ia64/errno.h
@@ -135,5 +135,7 @@
 
 #define	ENOMEDIUM	123	/* No medium found */
 #define	EMEDIUMTYPE	124	/* Wrong medium type */
+#define	EFSCORRUPTED	125	/* Filesystem is corrupted */
+#define	ENOATTR		126	/* No such attribute */
 
 #endif /* _ASM_IA64_ERRNO_H */
include/asm-m68k/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-m68k/errno.h linux-errno/include/asm-m68k/errno.h
@@ -128,5 +128,7 @@
 
 #define	ENOMEDIUM	123	/* No medium found */
 #define	EMEDIUMTYPE	124	/* Wrong medium type */
+#define	EFSCORRUPTED	125	/* Filesystem is corrupted */
+#define	ENOATTR		126	/* No such attribute */
 
 #endif /* _M68K_ERRNO_H */
include/asm-mips/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-mips/errno.h linux-errno/include/asm-mips/errno.h
@@ -141,6 +141,8 @@
  */
 #define ENOMEDIUM	159	/* No medium found */
 #define EMEDIUMTYPE	160	/* Wrong medium type */
+#define EFSCORRUPTED	161	/* Filesystem is corrupted */
+#define ENOATTR		162	/* No such attribute */
 
 #define EDQUOT		1133	/* Quota exceeded */
 
include/asm-mips64/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-mips64/errno.h linux-errno/include/asm-mips64/errno.h
@@ -142,6 +142,8 @@
  */
 #define ENOMEDIUM	159	/* No medium found */
 #define EMEDIUMTYPE	160	/* Wrong medium type */
+#define EFSCORRUPTED	161	/* Filesystem is corrupted */
+#define ENOATTR		162	/* No such attribute */
 
 #define EDQUOT		1133	/* Quota exceeded */
 
include/asm-parisc/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-parisc/errno.h linux-errno/include/asm-parisc/errno.h
@@ -99,6 +99,8 @@
 #define	EREMOTEIO	181	/* Remote I/O error */
 #define	ENOMEDIUM	182	/* No medium found */
 #define	EMEDIUMTYPE	183	/* Wrong medium type */
+#define	EFSCORRUPTED	184	/* Filesystem is corrupted */
+#define	ENOATTR		185	/* No such attribute */
 
 /* We now return you to your regularly scheduled HPUX. */
 
include/asm-ppc/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-ppc/errno.h linux-errno/include/asm-ppc/errno.h
@@ -129,6 +129,8 @@
 
 #define	ENOMEDIUM	123	/* No medium found */
 #define	EMEDIUMTYPE	124	/* Wrong medium type */
+#define	EFSCORRUPTED	125	/* Filesystem is corrupted */
+#define	ENOATTR		126	/* No such attribute */
 
 /* Should never be seen by user programs */
 #define ERESTARTSYS	512
include/asm-s390/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-s390/errno.h linux-errno/include/asm-s390/errno.h
@@ -136,5 +136,7 @@
 
 #define	ENOMEDIUM	123	/* No medium found */
 #define	EMEDIUMTYPE	124	/* Wrong medium type */
+#define	EFSCORRUPTED	125	/* Filesystem is corrupted */
+#define	ENOATTR		126	/* No such attribute */
 
 #endif
include/asm-s390x/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-s390x/errno.h linux-errno/include/asm-s390x/errno.h
@@ -136,5 +136,7 @@
 
 #define	ENOMEDIUM	123	/* No medium found */
 #define	EMEDIUMTYPE	124	/* Wrong medium type */
+#define	EFSCORRUPTED	125	/* Filesystem is corrupted */
+#define	ENOATTR		126	/* No such attribute */
 
 #endif
include/asm-sh/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-sh/errno.h linux-errno/include/asm-sh/errno.h
@@ -128,5 +128,7 @@
 
 #define	ENOMEDIUM	123	/* No medium found */
 #define	EMEDIUMTYPE	124	/* Wrong medium type */
+#define	EFSCORRUPTED	125	/* Filesystem is corrupted */
+#define	ENOATTR		126	/* No such attribute */
 
 #endif /* __ASM_SH_ERRNO_H */
include/asm-sparc/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-sparc/errno.h linux-errno/include/asm-sparc/errno.h
@@ -132,5 +132,7 @@
 
 #define	ENOMEDIUM	125	/* No medium found */
 #define	EMEDIUMTYPE	126	/* Wrong medium type */
+#define	EFSCORRUPTED	127	/* Filesystem is corrupted */
+#define	ENOATTR		128	/* No such attribute */
 
 #endif
include/asm-sparc64/errno.h +2 -0
diff -Naur linux-vanilla/include/asm-sparc64/errno.h linux-errno/include/asm-sparc64/errno.h
@@ -132,5 +132,7 @@
 
 #define ENOMEDIUM       125     /* No medium found */
 #define EMEDIUMTYPE     126     /* Wrong medium type */
+#define EFSCORRUPTED    127     /* Filesystem is corrupted */
+#define ENOATTR         128     /* No such attribute */
 
 #endif /* !(_SPARC64_ERRNO_H) */
#3 lore raw
Quoted 8 lines

XFS needs both values. ENOATTR is also required by the ext2 extended attributes project (and any other filesystem intending to implement extended attributes in the future). Both values need to be visible in both kernel and user space, so this patch would be an initial step toward libc support also, hopefully.

In the absence of any cleaner way to do this (?), could we have this patch applied please? Any/all feedback much appreciated

Such an update needs to be synchronized with glibc to avoid people getting all sorts of odd "unknown" error messages. In general I dn't see why its needed.

Quoted 1 line
Quoted 1 line

EFSCORRUPTED = Filesystem is corrupted

EIO is normally used for this

As to the string names for errors. They can't sanely go into the kernel or kernel headers. Remember there are a lot of languages out there

#4 lore raw
In reply to Nathan Scott

hi Alan,

Thanks for the comments.

Quoted 11 lines · Alan Cox
Quoted 8 lines

XFS needs both values. ENOATTR is also required by the ext2 extended attributes project (and any other filesystem intending to implement extended attributes in the future). Both values need to be visible in both kernel and user space, so this patch would be an initial step toward libc support also, hopefully.

In the absence of any cleaner way to do this (?), could we have this patch applied please? Any/all feedback much appreciated

Such an update needs to be synchronized with glibc to avoid people getting all sorts of odd "unknown" error messages.

Yup, understood. I was punting that it would need to appear in the kernel headers first though, so thought I'd test the water with you guys and try to understand the process for such a change.

The "unknown error" messages can't really be avoided in all cases anyway - even when there is a coordinated libc release there will always be (the vast majority of?) people running new kernels with older libc versions for awhile ... thats life though, I guess, if there's no other solution to the problem.

Quoted 1 line

In general I dn't see why its needed.

For ENOATTR, an error code is needed which doesn't conflict with any other used in the filesystem, so that a failure to get/set/... an extended attribute can be distinguished from other errors related to looking up the pathname initially, as an example.

Quoted 3 lines
Quoted 1 line
Quoted 1 line

EFSCORRUPTED = Filesystem is corrupted

EIO is normally used for this

Yeah, the semantics here are slightly different, but perhaps we can get away with this... (Steve? do you know of any cases in the code where we need to be able to distinguish the EIO value from EFSCORRUPTED? or any other reason why this wouldn't work? It is the obvious one - I'd imagine there was a reason for not using it originally).

Quoted 2 lines

As to the string names for errors. They can't sanely go into the kernel or kernel headers.

Yes, that wasn't being suggested.

Quoted 1 line

Remember there are a lot of languages out there

Yup - understood.

thanks.

Signature · 1 line
Nathan