[PATCH v2 01/20] include: provide linux/errno.h
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Nov 22 09:29:32 PST 2023
We don't have the historic baggage of having to support different errno
definitions depending on architecture. We thus have only
asm-generic/errno.h and include that from errno.h and elsewhere
directly.
Kernel code however includes <linux/errno.h>, so let's provide that file
as well and define there the Linux-specific errno's and include
<asm-generic/errno.h> for all other errnos.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> v2:
- unchanged
---
arch/powerpc/lib/misc.S | 2 +-
arch/powerpc/lib/ppcstring.S | 2 +-
common/optee.c | 2 +-
include/asm-generic/errno.h | 11 ----------
include/bbu.h | 2 +-
include/errno.h | 2 +-
include/linux/err.h | 2 +-
include/linux/errno.h | 36 +++++++++++++++++++++++++++++++++
include/linux/pstore.h | 2 +-
include/mach/at91/iomux.h | 2 +-
include/tee/optee.h | 2 +-
lib/reed_solomon/reed_solomon.c | 2 +-
12 files changed, 46 insertions(+), 21 deletions(-)
create mode 100644 include/linux/errno.h
diff --git a/arch/powerpc/lib/misc.S b/arch/powerpc/lib/misc.S
index c45f02ba3af0..024d26ed58e9 100644
--- a/arch/powerpc/lib/misc.S
+++ b/arch/powerpc/lib/misc.S
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <asm/ppc_asm.tmpl>
-#include <asm-generic/errno.h>
+#include <linux/errno.h>
.globl __ashrdi3
__ashrdi3:
diff --git a/arch/powerpc/lib/ppcstring.S b/arch/powerpc/lib/ppcstring.S
index cce85e3252a8..55f96cc9a448 100644
--- a/arch/powerpc/lib/ppcstring.S
+++ b/arch/powerpc/lib/ppcstring.S
@@ -9,7 +9,7 @@
* 2 of the License, or (at your option) any later version.
*/
#include <asm/ppc_asm.tmpl>
-#include <asm-generic/errno.h>
+#include <linux/errno.h>
.globl strcpy
strcpy:
diff --git a/common/optee.c b/common/optee.c
index b460fbcd0161..32a6c0a15b94 100644
--- a/common/optee.c
+++ b/common/optee.c
@@ -4,7 +4,7 @@
#include <tee/optee.h>
#include <linux/printk.h>
-#include <asm-generic/errno.h>
+#include <linux/errno.h>
int optee_verify_header(struct optee_header *hdr)
{
diff --git a/include/asm-generic/errno.h b/include/asm-generic/errno.h
index a96f8864dfd4..7629d5c8dd58 100644
--- a/include/asm-generic/errno.h
+++ b/include/asm-generic/errno.h
@@ -134,15 +134,4 @@
#define EKEYREVOKED 128 /* Key has been revoked */
#define EKEYREJECTED 129 /* Key was rejected by service */
-/* Should never be seen by user programs */
-#define ERESTARTSYS 512
-#define ERESTARTNOINTR 513
-#define ERESTARTNOHAND 514 /* restart if no handler.. */
-#define ENOIOCTLCMD 515 /* No ioctl command */
-#define EPROBE_DEFER 517 /* Driver requests probe retry */
-
-#define ENOTSUPP 524 /* Operation is not supported */
-
-#define _LAST_ERRNO 524
-
#endif
diff --git a/include/bbu.h b/include/bbu.h
index cec7e22d4d90..0a4f324ade5b 100644
--- a/include/bbu.h
+++ b/include/bbu.h
@@ -2,7 +2,7 @@
#ifndef __INCLUDE_BBU_H
#define __INCLUDE_BBU_H
-#include <asm-generic/errno.h>
+#include <linux/errno.h>
#include <linux/list.h>
#include <linux/types.h>
#include <filetype.h>
diff --git a/include/errno.h b/include/errno.h
index 164426596604..6ec7af4d7e9f 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -2,7 +2,7 @@
#ifndef __ERRNO_H
#define __ERRNO_H
-#include <asm-generic/errno.h>
+#include <linux/errno.h>
#include <linux/err.h>
extern int errno;
diff --git a/include/linux/err.h b/include/linux/err.h
index db7ad6cc5bfa..d743b4d0928a 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -5,7 +5,7 @@
#include <linux/compiler.h>
-#include <asm-generic/errno.h>
+#include <linux/errno.h>
/*
* Kernel pointers have redundant information, so we can use a
diff --git a/include/linux/errno.h b/include/linux/errno.h
new file mode 100644
index 000000000000..b3bf44d24936
--- /dev/null
+++ b/include/linux/errno.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_ERRNO_H
+#define _LINUX_ERRNO_H
+
+#include <asm-generic/errno.h>
+
+
+/*
+ * These should never be seen by user programs. To return one of ERESTART*
+ * codes, signal_pending() MUST be set. Note that ptrace can observe these
+ * at syscall exit tracing, but they will never be left for the debugged user
+ * process to see.
+ */
+#define ERESTARTSYS 512
+#define ERESTARTNOINTR 513
+#define ERESTARTNOHAND 514 /* restart if no handler.. */
+#define ENOIOCTLCMD 515 /* No ioctl command */
+#define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */
+#define EPROBE_DEFER 517 /* Driver requests probe retry */
+#define EOPENSTALE 518 /* open found a stale dentry */
+#define ENOPARAM 519 /* Parameter not supported */
+
+/* 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 */
+#define ERECALLCONFLICT 530 /* conflict with recalled state */
+#define ENOGRACE 531 /* NFS file lock reclaim refused */
+
+#endif
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index f598f31a5438..90e3bd2d4255 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -23,7 +23,7 @@
#include <linux/time.h>
#include <linux/types.h>
-#include <asm-generic/errno.h>
+#include <linux/errno.h>
struct module;
diff --git a/include/mach/at91/iomux.h b/include/mach/at91/iomux.h
index 84b50e05e0dc..f3ac93474222 100644
--- a/include/mach/at91/iomux.h
+++ b/include/mach/at91/iomux.h
@@ -7,7 +7,7 @@
#define __ASM_ARCH_AT91_GPIO_H
#include <io.h>
-#include <asm-generic/errno.h>
+#include <linux/errno.h>
#include <mach/at91/at91_pio.h>
#include <mach/at91/hardware.h>
#include <mach/at91/gpio.h>
diff --git a/include/tee/optee.h b/include/tee/optee.h
index fa124236ba5e..607f5072d385 100644
--- a/include/tee/optee.h
+++ b/include/tee/optee.h
@@ -11,7 +11,7 @@
#define _OPTEE_H
#include <types.h>
-#include <asm-generic/errno.h>
+#include <linux/errno.h>
#define OPTEE_MAGIC 0x4554504f
#define OPTEE_VERSION 1
diff --git a/lib/reed_solomon/reed_solomon.c b/lib/reed_solomon/reed_solomon.c
index 51c67c3c8d5d..80c0ec4f7ab9 100644
--- a/lib/reed_solomon/reed_solomon.c
+++ b/lib/reed_solomon/reed_solomon.c
@@ -44,7 +44,7 @@
#include <module.h>
#include <linux/string.h>
#include <stdio.h>
-#include <asm-generic/errno.h>
+#include <linux/errno.h>
/* This list holds all currently allocated rs control structures */
static LIST_HEAD (rslist);
--
2.39.2
More information about the barebox
mailing list