2024-06-12 03:08:07

by Mike Snitzer

[permalink] [raw]
Subject: [RFC PATCH v2 05/15] nfs: move nfs_stat_to_errno to nfs.h

From: Peng Tao <[email protected]>

So that knfsd can use it to map nfs stat to sys errno as well.

Signed-off-by: Peng Tao <[email protected]>
Signed-off-by: Lance Shelton <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
---
fs/nfs/nfs2xdr.c | 69 ---------------------------------------------
include/linux/nfs.h | 63 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 69 deletions(-)

diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index c19093814296..f7ef44829f6e 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -27,9 +27,6 @@

#define NFSDBG_FACILITY NFSDBG_XDR

-/* Mapping from NFS error code to "errno" error code. */
-#define errno_NFSERR_IO EIO
-
/*
* Declare the space requirements for NFS arguments and replies as
* number of 32bit-words
@@ -64,8 +61,6 @@
#define NFS_readdirres_sz (1+NFS_pagepad_sz)
#define NFS_statfsres_sz (1+NFS_info_sz)

-static int nfs_stat_to_errno(enum nfs_stat);
-
/*
* Encode/decode NFSv2 basic data types
*
@@ -1054,70 +1049,6 @@ static int nfs2_xdr_dec_statfsres(struct rpc_rqst *req, struct xdr_stream *xdr,
return nfs_stat_to_errno(status);
}

-
-/*
- * We need to translate between nfs status return values and
- * the local errno values which may not be the same.
- */
-static const struct {
- int stat;
- int errno;
-} nfs_errtbl[] = {
- { NFS_OK, 0 },
- { NFSERR_PERM, -EPERM },
- { NFSERR_NOENT, -ENOENT },
- { NFSERR_IO, -errno_NFSERR_IO},
- { NFSERR_NXIO, -ENXIO },
-/* { NFSERR_EAGAIN, -EAGAIN }, */
- { NFSERR_ACCES, -EACCES },
- { NFSERR_EXIST, -EEXIST },
- { NFSERR_XDEV, -EXDEV },
- { NFSERR_NODEV, -ENODEV },
- { NFSERR_NOTDIR, -ENOTDIR },
- { NFSERR_ISDIR, -EISDIR },
- { NFSERR_INVAL, -EINVAL },
- { NFSERR_FBIG, -EFBIG },
- { NFSERR_NOSPC, -ENOSPC },
- { NFSERR_ROFS, -EROFS },
- { NFSERR_MLINK, -EMLINK },
- { NFSERR_NAMETOOLONG, -ENAMETOOLONG },
- { NFSERR_NOTEMPTY, -ENOTEMPTY },
- { NFSERR_DQUOT, -EDQUOT },
- { NFSERR_STALE, -ESTALE },
- { NFSERR_REMOTE, -EREMOTE },
-#ifdef EWFLUSH
- { NFSERR_WFLUSH, -EWFLUSH },
-#endif
- { NFSERR_BADHANDLE, -EBADHANDLE },
- { NFSERR_NOT_SYNC, -ENOTSYNC },
- { NFSERR_BAD_COOKIE, -EBADCOOKIE },
- { NFSERR_NOTSUPP, -ENOTSUPP },
- { NFSERR_TOOSMALL, -ETOOSMALL },
- { NFSERR_SERVERFAULT, -EREMOTEIO },
- { NFSERR_BADTYPE, -EBADTYPE },
- { NFSERR_JUKEBOX, -EJUKEBOX },
- { -1, -EIO }
-};
-
-/**
- * nfs_stat_to_errno - convert an NFS status code to a local errno
- * @status: NFS status code to convert
- *
- * Returns a local errno value, or -EIO if the NFS status code is
- * not recognized. This function is used jointly by NFSv2 and NFSv3.
- */
-static int nfs_stat_to_errno(enum nfs_stat status)
-{
- int i;
-
- for (i = 0; nfs_errtbl[i].stat != -1; i++) {
- if (nfs_errtbl[i].stat == (int)status)
- return nfs_errtbl[i].errno;
- }
- dprintk("NFS: Unrecognized nfs status value: %u\n", status);
- return nfs_errtbl[i].errno;
-}
-
#define PROC(proc, argtype, restype, timer) \
[NFSPROC_##proc] = { \
.p_proc = NFSPROC_##proc, \
diff --git a/include/linux/nfs.h b/include/linux/nfs.h
index ceb70a926b95..b94f51d17bc5 100644
--- a/include/linux/nfs.h
+++ b/include/linux/nfs.h
@@ -10,6 +10,7 @@

#include <linux/sunrpc/msg_prot.h>
#include <linux/string.h>
+#include <linux/errno.h>
#include <linux/crc32.h>
#include <uapi/linux/nfs.h>

@@ -46,6 +47,68 @@ enum nfs3_stable_how {
NFS_INVALID_STABLE_HOW = -1
};

+/*
+ * We need to translate between nfs status return values and
+ * the local errno values which may not be the same.
+ */
+static const struct {
+ int stat;
+ int errno;
+} nfs_common_errtbl[] = {
+ { NFS_OK, 0 },
+ { NFSERR_PERM, -EPERM },
+ { NFSERR_NOENT, -ENOENT },
+ { NFSERR_IO, -EIO },
+ { NFSERR_NXIO, -ENXIO },
+/* { NFSERR_EAGAIN, -EAGAIN }, */
+ { NFSERR_ACCES, -EACCES },
+ { NFSERR_EXIST, -EEXIST },
+ { NFSERR_XDEV, -EXDEV },
+ { NFSERR_NODEV, -ENODEV },
+ { NFSERR_NOTDIR, -ENOTDIR },
+ { NFSERR_ISDIR, -EISDIR },
+ { NFSERR_INVAL, -EINVAL },
+ { NFSERR_FBIG, -EFBIG },
+ { NFSERR_NOSPC, -ENOSPC },
+ { NFSERR_ROFS, -EROFS },
+ { NFSERR_MLINK, -EMLINK },
+ { NFSERR_NAMETOOLONG, -ENAMETOOLONG },
+ { NFSERR_NOTEMPTY, -ENOTEMPTY },
+ { NFSERR_DQUOT, -EDQUOT },
+ { NFSERR_STALE, -ESTALE },
+ { NFSERR_REMOTE, -EREMOTE },
+#ifdef EWFLUSH
+ { NFSERR_WFLUSH, -EWFLUSH },
+#endif
+ { NFSERR_BADHANDLE, -EBADHANDLE },
+ { NFSERR_NOT_SYNC, -ENOTSYNC },
+ { NFSERR_BAD_COOKIE, -EBADCOOKIE },
+ { NFSERR_NOTSUPP, -ENOTSUPP },
+ { NFSERR_TOOSMALL, -ETOOSMALL },
+ { NFSERR_SERVERFAULT, -EREMOTEIO },
+ { NFSERR_BADTYPE, -EBADTYPE },
+ { NFSERR_JUKEBOX, -EJUKEBOX },
+ { -1, -EIO }
+};
+
+/**
+ * nfs_stat_to_errno - convert an NFS status code to a local errno
+ * @status: NFS status code to convert
+ *
+ * Returns a local errno value, or -EIO if the NFS status code is
+ * not recognized. This function is used jointly by NFSv2 and NFSv3.
+ */
+static inline int nfs_stat_to_errno(enum nfs_stat status)
+{
+ int i;
+
+ for (i = 0; nfs_common_errtbl[i].stat != -1; i++) {
+ if (nfs_common_errtbl[i].stat == (int)status)
+ return nfs_common_errtbl[i].errno;
+ }
+ return nfs_common_errtbl[i].errno;
+}
+
#ifdef CONFIG_CRC32
/**
* nfs_fhandle_hash - calculate the crc32 hash for the filehandle
--
2.44.0



2024-06-12 03:29:18

by NeilBrown

[permalink] [raw]
Subject: Re: [RFC PATCH v2 05/15] nfs: move nfs_stat_to_errno to nfs.h

On Wed, 12 Jun 2024, Mike Snitzer wrote:
> From: Peng Tao <[email protected]>
>
> So that knfsd can use it to map nfs stat to sys errno as well.
>
> Signed-off-by: Peng Tao <[email protected]>
> Signed-off-by: Lance Shelton <[email protected]>
> Signed-off-by: Trond Myklebust <[email protected]>
> Signed-off-by: Mike Snitzer <[email protected]>
> ---
> fs/nfs/nfs2xdr.c | 69 ---------------------------------------------
> include/linux/nfs.h | 63 +++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 63 insertions(+), 69 deletions(-)
>
> diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
> index c19093814296..f7ef44829f6e 100644
> --- a/fs/nfs/nfs2xdr.c
> +++ b/fs/nfs/nfs2xdr.c
> @@ -27,9 +27,6 @@
>
> #define NFSDBG_FACILITY NFSDBG_XDR
>
> -/* Mapping from NFS error code to "errno" error code. */
> -#define errno_NFSERR_IO EIO
> -
> /*
> * Declare the space requirements for NFS arguments and replies as
> * number of 32bit-words
> @@ -64,8 +61,6 @@
> #define NFS_readdirres_sz (1+NFS_pagepad_sz)
> #define NFS_statfsres_sz (1+NFS_info_sz)
>
> -static int nfs_stat_to_errno(enum nfs_stat);
> -
> /*
> * Encode/decode NFSv2 basic data types
> *
> @@ -1054,70 +1049,6 @@ static int nfs2_xdr_dec_statfsres(struct rpc_rqst *req, struct xdr_stream *xdr,
> return nfs_stat_to_errno(status);
> }
>
> -
> -/*
> - * We need to translate between nfs status return values and
> - * the local errno values which may not be the same.
> - */
> -static const struct {
> - int stat;
> - int errno;
> -} nfs_errtbl[] = {

Will this array appear in every .o file that is compiled using this .h
file? That doesn't seem like a good idea.

NeilBrown


> - { NFS_OK, 0 },
> - { NFSERR_PERM, -EPERM },
> - { NFSERR_NOENT, -ENOENT },
> - { NFSERR_IO, -errno_NFSERR_IO},
> - { NFSERR_NXIO, -ENXIO },
> -/* { NFSERR_EAGAIN, -EAGAIN }, */
> - { NFSERR_ACCES, -EACCES },
> - { NFSERR_EXIST, -EEXIST },
> - { NFSERR_XDEV, -EXDEV },
> - { NFSERR_NODEV, -ENODEV },
> - { NFSERR_NOTDIR, -ENOTDIR },
> - { NFSERR_ISDIR, -EISDIR },
> - { NFSERR_INVAL, -EINVAL },
> - { NFSERR_FBIG, -EFBIG },
> - { NFSERR_NOSPC, -ENOSPC },
> - { NFSERR_ROFS, -EROFS },
> - { NFSERR_MLINK, -EMLINK },
> - { NFSERR_NAMETOOLONG, -ENAMETOOLONG },
> - { NFSERR_NOTEMPTY, -ENOTEMPTY },
> - { NFSERR_DQUOT, -EDQUOT },
> - { NFSERR_STALE, -ESTALE },
> - { NFSERR_REMOTE, -EREMOTE },
> -#ifdef EWFLUSH
> - { NFSERR_WFLUSH, -EWFLUSH },
> -#endif
> - { NFSERR_BADHANDLE, -EBADHANDLE },
> - { NFSERR_NOT_SYNC, -ENOTSYNC },
> - { NFSERR_BAD_COOKIE, -EBADCOOKIE },
> - { NFSERR_NOTSUPP, -ENOTSUPP },
> - { NFSERR_TOOSMALL, -ETOOSMALL },
> - { NFSERR_SERVERFAULT, -EREMOTEIO },
> - { NFSERR_BADTYPE, -EBADTYPE },
> - { NFSERR_JUKEBOX, -EJUKEBOX },
> - { -1, -EIO }
> -};
> -
> -/**
> - * nfs_stat_to_errno - convert an NFS status code to a local errno
> - * @status: NFS status code to convert
> - *
> - * Returns a local errno value, or -EIO if the NFS status code is
> - * not recognized. This function is used jointly by NFSv2 and NFSv3.
> - */
> -static int nfs_stat_to_errno(enum nfs_stat status)
> -{
> - int i;
> -
> - for (i = 0; nfs_errtbl[i].stat != -1; i++) {
> - if (nfs_errtbl[i].stat == (int)status)
> - return nfs_errtbl[i].errno;
> - }
> - dprintk("NFS: Unrecognized nfs status value: %u\n", status);
> - return nfs_errtbl[i].errno;
> -}
> -
> #define PROC(proc, argtype, restype, timer) \
> [NFSPROC_##proc] = { \
> .p_proc = NFSPROC_##proc, \
> diff --git a/include/linux/nfs.h b/include/linux/nfs.h
> index ceb70a926b95..b94f51d17bc5 100644
> --- a/include/linux/nfs.h
> +++ b/include/linux/nfs.h
> @@ -10,6 +10,7 @@
>
> #include <linux/sunrpc/msg_prot.h>
> #include <linux/string.h>
> +#include <linux/errno.h>
> #include <linux/crc32.h>
> #include <uapi/linux/nfs.h>
>
> @@ -46,6 +47,68 @@ enum nfs3_stable_how {
> NFS_INVALID_STABLE_HOW = -1
> };
>
> +/*
> + * We need to translate between nfs status return values and
> + * the local errno values which may not be the same.
> + */
> +static const struct {
> + int stat;
> + int errno;
> +} nfs_common_errtbl[] = {
> + { NFS_OK, 0 },
> + { NFSERR_PERM, -EPERM },
> + { NFSERR_NOENT, -ENOENT },
> + { NFSERR_IO, -EIO },
> + { NFSERR_NXIO, -ENXIO },
> +/* { NFSERR_EAGAIN, -EAGAIN }, */
> + { NFSERR_ACCES, -EACCES },
> + { NFSERR_EXIST, -EEXIST },
> + { NFSERR_XDEV, -EXDEV },
> + { NFSERR_NODEV, -ENODEV },
> + { NFSERR_NOTDIR, -ENOTDIR },
> + { NFSERR_ISDIR, -EISDIR },
> + { NFSERR_INVAL, -EINVAL },
> + { NFSERR_FBIG, -EFBIG },
> + { NFSERR_NOSPC, -ENOSPC },
> + { NFSERR_ROFS, -EROFS },
> + { NFSERR_MLINK, -EMLINK },
> + { NFSERR_NAMETOOLONG, -ENAMETOOLONG },
> + { NFSERR_NOTEMPTY, -ENOTEMPTY },
> + { NFSERR_DQUOT, -EDQUOT },
> + { NFSERR_STALE, -ESTALE },
> + { NFSERR_REMOTE, -EREMOTE },
> +#ifdef EWFLUSH
> + { NFSERR_WFLUSH, -EWFLUSH },
> +#endif
> + { NFSERR_BADHANDLE, -EBADHANDLE },
> + { NFSERR_NOT_SYNC, -ENOTSYNC },
> + { NFSERR_BAD_COOKIE, -EBADCOOKIE },
> + { NFSERR_NOTSUPP, -ENOTSUPP },
> + { NFSERR_TOOSMALL, -ETOOSMALL },
> + { NFSERR_SERVERFAULT, -EREMOTEIO },
> + { NFSERR_BADTYPE, -EBADTYPE },
> + { NFSERR_JUKEBOX, -EJUKEBOX },
> + { -1, -EIO }
> +};
> +
> +/**
> + * nfs_stat_to_errno - convert an NFS status code to a local errno
> + * @status: NFS status code to convert
> + *
> + * Returns a local errno value, or -EIO if the NFS status code is
> + * not recognized. This function is used jointly by NFSv2 and NFSv3.
> + */
> +static inline int nfs_stat_to_errno(enum nfs_stat status)
> +{
> + int i;
> +
> + for (i = 0; nfs_common_errtbl[i].stat != -1; i++) {
> + if (nfs_common_errtbl[i].stat == (int)status)
> + return nfs_common_errtbl[i].errno;
> + }
> + return nfs_common_errtbl[i].errno;
> +}
> +
> #ifdef CONFIG_CRC32
> /**
> * nfs_fhandle_hash - calculate the crc32 hash for the filehandle
> --
> 2.44.0
>
>


2024-06-12 03:50:10

by Mike Snitzer

[permalink] [raw]
Subject: Re: [RFC PATCH v2 05/15] nfs: move nfs_stat_to_errno to nfs.h

On Wed, Jun 12, 2024 at 01:23:59PM +1000, NeilBrown wrote:
> On Wed, 12 Jun 2024, Mike Snitzer wrote:
> > From: Peng Tao <[email protected]>
> >
> > So that knfsd can use it to map nfs stat to sys errno as well.
> >
> > Signed-off-by: Peng Tao <[email protected]>
> > Signed-off-by: Lance Shelton <[email protected]>
> > Signed-off-by: Trond Myklebust <[email protected]>
> > Signed-off-by: Mike Snitzer <[email protected]>
> > ---
> > fs/nfs/nfs2xdr.c | 69 ---------------------------------------------
> > include/linux/nfs.h | 63 +++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 63 insertions(+), 69 deletions(-)
> >
> > diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
> > index c19093814296..f7ef44829f6e 100644
> > --- a/fs/nfs/nfs2xdr.c
> > +++ b/fs/nfs/nfs2xdr.c
> > @@ -27,9 +27,6 @@
> >
> > #define NFSDBG_FACILITY NFSDBG_XDR
> >
> > -/* Mapping from NFS error code to "errno" error code. */
> > -#define errno_NFSERR_IO EIO
> > -
> > /*
> > * Declare the space requirements for NFS arguments and replies as
> > * number of 32bit-words
> > @@ -64,8 +61,6 @@
> > #define NFS_readdirres_sz (1+NFS_pagepad_sz)
> > #define NFS_statfsres_sz (1+NFS_info_sz)
> >
> > -static int nfs_stat_to_errno(enum nfs_stat);
> > -
> > /*
> > * Encode/decode NFSv2 basic data types
> > *
> > @@ -1054,70 +1049,6 @@ static int nfs2_xdr_dec_statfsres(struct rpc_rqst *req, struct xdr_stream *xdr,
> > return nfs_stat_to_errno(status);
> > }
> >
> > -
> > -/*
> > - * We need to translate between nfs status return values and
> > - * the local errno values which may not be the same.
> > - */
> > -static const struct {
> > - int stat;
> > - int errno;
> > -} nfs_errtbl[] = {
>
> Will this array appear in every .o file that is compiled using this .h
> file? That doesn't seem like a good idea.

Ouch, sure looks like it would. Nice catch.

Mike


> > - { NFS_OK, 0 },
> > - { NFSERR_PERM, -EPERM },
> > - { NFSERR_NOENT, -ENOENT },
> > - { NFSERR_IO, -errno_NFSERR_IO},
> > - { NFSERR_NXIO, -ENXIO },
> > -/* { NFSERR_EAGAIN, -EAGAIN }, */
> > - { NFSERR_ACCES, -EACCES },
> > - { NFSERR_EXIST, -EEXIST },
> > - { NFSERR_XDEV, -EXDEV },
> > - { NFSERR_NODEV, -ENODEV },
> > - { NFSERR_NOTDIR, -ENOTDIR },
> > - { NFSERR_ISDIR, -EISDIR },
> > - { NFSERR_INVAL, -EINVAL },
> > - { NFSERR_FBIG, -EFBIG },
> > - { NFSERR_NOSPC, -ENOSPC },
> > - { NFSERR_ROFS, -EROFS },
> > - { NFSERR_MLINK, -EMLINK },
> > - { NFSERR_NAMETOOLONG, -ENAMETOOLONG },
> > - { NFSERR_NOTEMPTY, -ENOTEMPTY },
> > - { NFSERR_DQUOT, -EDQUOT },
> > - { NFSERR_STALE, -ESTALE },
> > - { NFSERR_REMOTE, -EREMOTE },
> > -#ifdef EWFLUSH
> > - { NFSERR_WFLUSH, -EWFLUSH },
> > -#endif
> > - { NFSERR_BADHANDLE, -EBADHANDLE },
> > - { NFSERR_NOT_SYNC, -ENOTSYNC },
> > - { NFSERR_BAD_COOKIE, -EBADCOOKIE },
> > - { NFSERR_NOTSUPP, -ENOTSUPP },
> > - { NFSERR_TOOSMALL, -ETOOSMALL },
> > - { NFSERR_SERVERFAULT, -EREMOTEIO },
> > - { NFSERR_BADTYPE, -EBADTYPE },
> > - { NFSERR_JUKEBOX, -EJUKEBOX },
> > - { -1, -EIO }
> > -};
> > -
> > -/**
> > - * nfs_stat_to_errno - convert an NFS status code to a local errno
> > - * @status: NFS status code to convert
> > - *
> > - * Returns a local errno value, or -EIO if the NFS status code is
> > - * not recognized. This function is used jointly by NFSv2 and NFSv3.
> > - */
> > -static int nfs_stat_to_errno(enum nfs_stat status)
> > -{
> > - int i;
> > -
> > - for (i = 0; nfs_errtbl[i].stat != -1; i++) {
> > - if (nfs_errtbl[i].stat == (int)status)
> > - return nfs_errtbl[i].errno;
> > - }
> > - dprintk("NFS: Unrecognized nfs status value: %u\n", status);
> > - return nfs_errtbl[i].errno;
> > -}
> > -
> > #define PROC(proc, argtype, restype, timer) \
> > [NFSPROC_##proc] = { \
> > .p_proc = NFSPROC_##proc, \
> > diff --git a/include/linux/nfs.h b/include/linux/nfs.h
> > index ceb70a926b95..b94f51d17bc5 100644
> > --- a/include/linux/nfs.h
> > +++ b/include/linux/nfs.h
> > @@ -10,6 +10,7 @@
> >
> > #include <linux/sunrpc/msg_prot.h>
> > #include <linux/string.h>
> > +#include <linux/errno.h>
> > #include <linux/crc32.h>
> > #include <uapi/linux/nfs.h>
> >
> > @@ -46,6 +47,68 @@ enum nfs3_stable_how {
> > NFS_INVALID_STABLE_HOW = -1
> > };
> >
> > +/*
> > + * We need to translate between nfs status return values and
> > + * the local errno values which may not be the same.
> > + */
> > +static const struct {
> > + int stat;
> > + int errno;
> > +} nfs_common_errtbl[] = {
> > + { NFS_OK, 0 },
> > + { NFSERR_PERM, -EPERM },
> > + { NFSERR_NOENT, -ENOENT },
> > + { NFSERR_IO, -EIO },
> > + { NFSERR_NXIO, -ENXIO },
> > +/* { NFSERR_EAGAIN, -EAGAIN }, */
> > + { NFSERR_ACCES, -EACCES },
> > + { NFSERR_EXIST, -EEXIST },
> > + { NFSERR_XDEV, -EXDEV },
> > + { NFSERR_NODEV, -ENODEV },
> > + { NFSERR_NOTDIR, -ENOTDIR },
> > + { NFSERR_ISDIR, -EISDIR },
> > + { NFSERR_INVAL, -EINVAL },
> > + { NFSERR_FBIG, -EFBIG },
> > + { NFSERR_NOSPC, -ENOSPC },
> > + { NFSERR_ROFS, -EROFS },
> > + { NFSERR_MLINK, -EMLINK },
> > + { NFSERR_NAMETOOLONG, -ENAMETOOLONG },
> > + { NFSERR_NOTEMPTY, -ENOTEMPTY },
> > + { NFSERR_DQUOT, -EDQUOT },
> > + { NFSERR_STALE, -ESTALE },
> > + { NFSERR_REMOTE, -EREMOTE },
> > +#ifdef EWFLUSH
> > + { NFSERR_WFLUSH, -EWFLUSH },
> > +#endif
> > + { NFSERR_BADHANDLE, -EBADHANDLE },
> > + { NFSERR_NOT_SYNC, -ENOTSYNC },
> > + { NFSERR_BAD_COOKIE, -EBADCOOKIE },
> > + { NFSERR_NOTSUPP, -ENOTSUPP },
> > + { NFSERR_TOOSMALL, -ETOOSMALL },
> > + { NFSERR_SERVERFAULT, -EREMOTEIO },
> > + { NFSERR_BADTYPE, -EBADTYPE },
> > + { NFSERR_JUKEBOX, -EJUKEBOX },
> > + { -1, -EIO }
> > +};
> > +
> > +/**
> > + * nfs_stat_to_errno - convert an NFS status code to a local errno
> > + * @status: NFS status code to convert
> > + *
> > + * Returns a local errno value, or -EIO if the NFS status code is
> > + * not recognized. This function is used jointly by NFSv2 and NFSv3.
> > + */
> > +static inline int nfs_stat_to_errno(enum nfs_stat status)
> > +{
> > + int i;
> > +
> > + for (i = 0; nfs_common_errtbl[i].stat != -1; i++) {
> > + if (nfs_common_errtbl[i].stat == (int)status)
> > + return nfs_common_errtbl[i].errno;
> > + }
> > + return nfs_common_errtbl[i].errno;
> > +}
> > +
> > #ifdef CONFIG_CRC32
> > /**
> > * nfs_fhandle_hash - calculate the crc32 hash for the filehandle
> > --
> > 2.44.0
> >
> >
>
>