~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/nfs_common/common.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /fs/nfs_common/common.c (Architecture sparc64) and /fs/nfs_common/common.c (Architecture alpha)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 // SPDX-License-Identifier: GPL-2.0-only
  2                                                     2 
  3 #include <linux/module.h>                           3 #include <linux/module.h>
  4 #include <linux/nfs_common.h>                       4 #include <linux/nfs_common.h>
  5 #include <linux/nfs4.h>                             5 #include <linux/nfs4.h>
  6                                                     6 
  7 /*                                                  7 /*
  8  * We need to translate between nfs status ret      8  * We need to translate between nfs status return values and
  9  * the local errno values which may not be the      9  * the local errno values which may not be the same.
 10  */                                                10  */
 11 static const struct {                              11 static const struct {
 12         int stat;                                  12         int stat;
 13         int errno;                                 13         int errno;
 14 } nfs_errtbl[] = {                                 14 } nfs_errtbl[] = {
 15         { NFS_OK,               0                  15         { NFS_OK,               0               },
 16         { NFSERR_PERM,          -EPERM             16         { NFSERR_PERM,          -EPERM          },
 17         { NFSERR_NOENT,         -ENOENT            17         { NFSERR_NOENT,         -ENOENT         },
 18         { NFSERR_IO,            -errno_NFSERR_     18         { NFSERR_IO,            -errno_NFSERR_IO},
 19         { NFSERR_NXIO,          -ENXIO             19         { NFSERR_NXIO,          -ENXIO          },
 20 /*      { NFSERR_EAGAIN,        -EAGAIN            20 /*      { NFSERR_EAGAIN,        -EAGAIN         }, */
 21         { NFSERR_ACCES,         -EACCES            21         { NFSERR_ACCES,         -EACCES         },
 22         { NFSERR_EXIST,         -EEXIST            22         { NFSERR_EXIST,         -EEXIST         },
 23         { NFSERR_XDEV,          -EXDEV             23         { NFSERR_XDEV,          -EXDEV          },
 24         { NFSERR_NODEV,         -ENODEV            24         { NFSERR_NODEV,         -ENODEV         },
 25         { NFSERR_NOTDIR,        -ENOTDIR           25         { NFSERR_NOTDIR,        -ENOTDIR        },
 26         { NFSERR_ISDIR,         -EISDIR            26         { NFSERR_ISDIR,         -EISDIR         },
 27         { NFSERR_INVAL,         -EINVAL            27         { NFSERR_INVAL,         -EINVAL         },
 28         { NFSERR_FBIG,          -EFBIG             28         { NFSERR_FBIG,          -EFBIG          },
 29         { NFSERR_NOSPC,         -ENOSPC            29         { NFSERR_NOSPC,         -ENOSPC         },
 30         { NFSERR_ROFS,          -EROFS             30         { NFSERR_ROFS,          -EROFS          },
 31         { NFSERR_MLINK,         -EMLINK            31         { NFSERR_MLINK,         -EMLINK         },
 32         { NFSERR_NAMETOOLONG,   -ENAMETOOLONG      32         { NFSERR_NAMETOOLONG,   -ENAMETOOLONG   },
 33         { NFSERR_NOTEMPTY,      -ENOTEMPTY         33         { NFSERR_NOTEMPTY,      -ENOTEMPTY      },
 34         { NFSERR_DQUOT,         -EDQUOT            34         { NFSERR_DQUOT,         -EDQUOT         },
 35         { NFSERR_STALE,         -ESTALE            35         { NFSERR_STALE,         -ESTALE         },
 36         { NFSERR_REMOTE,        -EREMOTE           36         { NFSERR_REMOTE,        -EREMOTE        },
 37 #ifdef EWFLUSH                                     37 #ifdef EWFLUSH
 38         { NFSERR_WFLUSH,        -EWFLUSH           38         { NFSERR_WFLUSH,        -EWFLUSH        },
 39 #endif                                             39 #endif
 40         { NFSERR_BADHANDLE,     -EBADHANDLE        40         { NFSERR_BADHANDLE,     -EBADHANDLE     },
 41         { NFSERR_NOT_SYNC,      -ENOTSYNC          41         { NFSERR_NOT_SYNC,      -ENOTSYNC       },
 42         { NFSERR_BAD_COOKIE,    -EBADCOOKIE        42         { NFSERR_BAD_COOKIE,    -EBADCOOKIE     },
 43         { NFSERR_NOTSUPP,       -ENOTSUPP          43         { NFSERR_NOTSUPP,       -ENOTSUPP       },
 44         { NFSERR_TOOSMALL,      -ETOOSMALL         44         { NFSERR_TOOSMALL,      -ETOOSMALL      },
 45         { NFSERR_SERVERFAULT,   -EREMOTEIO         45         { NFSERR_SERVERFAULT,   -EREMOTEIO      },
 46         { NFSERR_BADTYPE,       -EBADTYPE          46         { NFSERR_BADTYPE,       -EBADTYPE       },
 47         { NFSERR_JUKEBOX,       -EJUKEBOX          47         { NFSERR_JUKEBOX,       -EJUKEBOX       },
 48         { -1,                   -EIO               48         { -1,                   -EIO            }
 49 };                                                 49 };
 50                                                    50 
 51 /**                                                51 /**
 52  * nfs_stat_to_errno - convert an NFS status c     52  * nfs_stat_to_errno - convert an NFS status code to a local errno
 53  * @status: NFS status code to convert             53  * @status: NFS status code to convert
 54  *                                                 54  *
 55  * Returns a local errno value, or -EIO if the     55  * Returns a local errno value, or -EIO if the NFS status code is
 56  * not recognized.  This function is used join     56  * not recognized.  This function is used jointly by NFSv2 and NFSv3.
 57  */                                                57  */
 58 int nfs_stat_to_errno(enum nfs_stat status)        58 int nfs_stat_to_errno(enum nfs_stat status)
 59 {                                                  59 {
 60         int i;                                     60         int i;
 61                                                    61 
 62         for (i = 0; nfs_errtbl[i].stat != -1;      62         for (i = 0; nfs_errtbl[i].stat != -1; i++) {
 63                 if (nfs_errtbl[i].stat == (int     63                 if (nfs_errtbl[i].stat == (int)status)
 64                         return nfs_errtbl[i].e     64                         return nfs_errtbl[i].errno;
 65         }                                          65         }
 66         return nfs_errtbl[i].errno;                66         return nfs_errtbl[i].errno;
 67 }                                                  67 }
 68 EXPORT_SYMBOL_GPL(nfs_stat_to_errno);              68 EXPORT_SYMBOL_GPL(nfs_stat_to_errno);
 69                                                    69 
 70 /*                                                 70 /*
 71  * We need to translate between nfs v4 status      71  * We need to translate between nfs v4 status return values and
 72  * the local errno values which may not be the     72  * the local errno values which may not be the same.
 73  */                                                73  */
 74 static const struct {                              74 static const struct {
 75         int stat;                                  75         int stat;
 76         int errno;                                 76         int errno;
 77 } nfs4_errtbl[] = {                                77 } nfs4_errtbl[] = {
 78         { NFS4_OK,              0                  78         { NFS4_OK,              0               },
 79         { NFS4ERR_PERM,         -EPERM             79         { NFS4ERR_PERM,         -EPERM          },
 80         { NFS4ERR_NOENT,        -ENOENT            80         { NFS4ERR_NOENT,        -ENOENT         },
 81         { NFS4ERR_IO,           -errno_NFSERR_     81         { NFS4ERR_IO,           -errno_NFSERR_IO},
 82         { NFS4ERR_NXIO,         -ENXIO             82         { NFS4ERR_NXIO,         -ENXIO          },
 83         { NFS4ERR_ACCESS,       -EACCES            83         { NFS4ERR_ACCESS,       -EACCES         },
 84         { NFS4ERR_EXIST,        -EEXIST            84         { NFS4ERR_EXIST,        -EEXIST         },
 85         { NFS4ERR_XDEV,         -EXDEV             85         { NFS4ERR_XDEV,         -EXDEV          },
 86         { NFS4ERR_NOTDIR,       -ENOTDIR           86         { NFS4ERR_NOTDIR,       -ENOTDIR        },
 87         { NFS4ERR_ISDIR,        -EISDIR            87         { NFS4ERR_ISDIR,        -EISDIR         },
 88         { NFS4ERR_INVAL,        -EINVAL            88         { NFS4ERR_INVAL,        -EINVAL         },
 89         { NFS4ERR_FBIG,         -EFBIG             89         { NFS4ERR_FBIG,         -EFBIG          },
 90         { NFS4ERR_NOSPC,        -ENOSPC            90         { NFS4ERR_NOSPC,        -ENOSPC         },
 91         { NFS4ERR_ROFS,         -EROFS             91         { NFS4ERR_ROFS,         -EROFS          },
 92         { NFS4ERR_MLINK,        -EMLINK            92         { NFS4ERR_MLINK,        -EMLINK         },
 93         { NFS4ERR_NAMETOOLONG,  -ENAMETOOLONG      93         { NFS4ERR_NAMETOOLONG,  -ENAMETOOLONG   },
 94         { NFS4ERR_NOTEMPTY,     -ENOTEMPTY         94         { NFS4ERR_NOTEMPTY,     -ENOTEMPTY      },
 95         { NFS4ERR_DQUOT,        -EDQUOT            95         { NFS4ERR_DQUOT,        -EDQUOT         },
 96         { NFS4ERR_STALE,        -ESTALE            96         { NFS4ERR_STALE,        -ESTALE         },
 97         { NFS4ERR_BADHANDLE,    -EBADHANDLE        97         { NFS4ERR_BADHANDLE,    -EBADHANDLE     },
 98         { NFS4ERR_BAD_COOKIE,   -EBADCOOKIE        98         { NFS4ERR_BAD_COOKIE,   -EBADCOOKIE     },
 99         { NFS4ERR_NOTSUPP,      -ENOTSUPP          99         { NFS4ERR_NOTSUPP,      -ENOTSUPP       },
100         { NFS4ERR_TOOSMALL,     -ETOOSMALL        100         { NFS4ERR_TOOSMALL,     -ETOOSMALL      },
101         { NFS4ERR_SERVERFAULT,  -EREMOTEIO        101         { NFS4ERR_SERVERFAULT,  -EREMOTEIO      },
102         { NFS4ERR_BADTYPE,      -EBADTYPE         102         { NFS4ERR_BADTYPE,      -EBADTYPE       },
103         { NFS4ERR_LOCKED,       -EAGAIN           103         { NFS4ERR_LOCKED,       -EAGAIN         },
104         { NFS4ERR_SYMLINK,      -ELOOP            104         { NFS4ERR_SYMLINK,      -ELOOP          },
105         { NFS4ERR_OP_ILLEGAL,   -EOPNOTSUPP       105         { NFS4ERR_OP_ILLEGAL,   -EOPNOTSUPP     },
106         { NFS4ERR_DEADLOCK,     -EDEADLK          106         { NFS4ERR_DEADLOCK,     -EDEADLK        },
107         { NFS4ERR_NOXATTR,      -ENODATA          107         { NFS4ERR_NOXATTR,      -ENODATA        },
108         { NFS4ERR_XATTR2BIG,    -E2BIG            108         { NFS4ERR_XATTR2BIG,    -E2BIG          },
109         { -1,                   -EIO              109         { -1,                   -EIO            }
110 };                                                110 };
111                                                   111 
112 /*                                                112 /*
113  * Convert an NFS error code to a local one.      113  * Convert an NFS error code to a local one.
114  * This one is used by NFSv4.                     114  * This one is used by NFSv4.
115  */                                               115  */
116 int nfs4_stat_to_errno(int stat)                  116 int nfs4_stat_to_errno(int stat)
117 {                                                 117 {
118         int i;                                    118         int i;
119         for (i = 0; nfs4_errtbl[i].stat != -1;    119         for (i = 0; nfs4_errtbl[i].stat != -1; i++) {
120                 if (nfs4_errtbl[i].stat == sta    120                 if (nfs4_errtbl[i].stat == stat)
121                         return nfs4_errtbl[i].    121                         return nfs4_errtbl[i].errno;
122         }                                         122         }
123         if (stat <= 10000 || stat > 10100) {      123         if (stat <= 10000 || stat > 10100) {
124                 /* The server is looney tunes.    124                 /* The server is looney tunes. */
125                 return -EREMOTEIO;                125                 return -EREMOTEIO;
126         }                                         126         }
127         /* If we cannot translate the error, t    127         /* If we cannot translate the error, the recovery routines should
128          * handle it.                             128          * handle it.
129          * Note: remaining NFSv4 error codes h    129          * Note: remaining NFSv4 error codes have values > 10000, so should
130          * not conflict with native Linux erro    130          * not conflict with native Linux error codes.
131          */                                       131          */
132         return -stat;                             132         return -stat;
133 }                                                 133 }
134 EXPORT_SYMBOL_GPL(nfs4_stat_to_errno);            134 EXPORT_SYMBOL_GPL(nfs4_stat_to_errno);
135                                                   135 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php