xref: /freebsd/sys/fs/nfs/nfsv4_errstr.h (revision 4e8d558c)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2009 Rick Macklem, University of Guelph
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  * $FreeBSD$
29  */
30 
31 #ifndef _NFS_NFSV4ERRSTR_H_
32 #define	_NFS_NFSV4ERRSTR_H_
33 
34 /*
35  * Defines static storage in the C file, but I can't be bothered creating
36  * a library of one function for this, since it is only currently used by
37  * mount_newnfs.c.
38  */
39 static const char *nfsv4_errstr[NFSERR_XATTR2BIG - 10000] = {
40 	"Illegal filehandle",
41 	"Undefined NFSv4 err",
42 	"READDIR cookie is stale",
43 	"operation not supported",
44 	"response limit exceeded",
45 	"undefined server error",
46 	"type invalid for CREATE",
47 	"file busy - retry",
48 	"nverify says attrs same",
49 	"lock unavailable",
50 	"lock lease expired",
51 	"I/O failed due to lock",
52 	"in grace period",
53 	"filehandle expired",
54 	"share reserve denied",
55 	"wrong security flavor",
56 	"clientid in use",
57 	"resource exhaustion",
58 	"filesystem relocated",
59 	"current FH is not set",
60 	"minor version not supported",
61 	"server has rebooted",
62 	"server has rebooted",
63 	"state is out of sync",
64 	"incorrect stateid",
65 	"request is out of seq",
66 	"verify - attrs not same",
67 	"lock range not supported",
68 	"should be file/directory",
69 	"no saved filehandle",
70 	"some filesystem moved",
71 	"recommended attr not sup",
72 	"reclaim outside of grace",
73 	"reclaim error at server",
74 	"conflict on reclaim",
75 	"XDR decode failed",
76 	"file locks held at CLOSE",
77 	"conflict in OPEN and I/O",
78 	"owner translation bad",
79 	"utf-8 char not supported",
80 	"name not supported",
81 	"lock range not supported",
82 	"no atomic up/downgrade",
83 	"undefined operation",
84 	"file locking deadlock",
85 	"open file blocks op",
86 	"lockowner state revoked",
87 	"callback path down",
88 	"bad IO mode",
89 	"bad layout",
90 	"bad session digest",
91 	"bad session",
92 	"bad slot",
93 	"complete already",
94 	"not bound to session",
95 	"delegation already wanted",
96 	"back channel busy",
97 	"layout try later",
98 	"layout unavailable",
99 	"no matching layout",
100 	"recall conflict",
101 	"unknown layout type",
102 	"sequence misordered",
103 	"sequence position",
104 	"request too big",
105 	"reply too big",
106 	"reply too big to cache",
107 	"retry uncached reply",
108 	"unsafe compound",
109 	"too many operations",
110 	"operation not in session",
111 	"hash algorithm unsupported",
112 	"unknown error",
113 	"clientID busy",
114 	"pNFS IO hole",
115 	"sequence false retry",
116 	"bad high slot",
117 	"dead session",
118 	"encrypt algorithm unsupported",
119 	"pNFS no layout",
120 	"not only operation",
121 	"wrong credential",
122 	"wrong type",
123 	"directory delegation unavailable",
124 	"reject delegation",
125 	"return conflict",
126 	"delegation revoked",
127 	"partner not supported",
128 	"partner no auth",
129 	"union not supported",
130 	"offload denied",
131 	"wrong LFS",
132 	"bad label",
133 	"offload no request",
134 	"no extended attribute",
135 	"extended attribute too big",
136 };
137 
138 /*
139  * Return the error string for the NFS4ERR_xxx. The pointers returned are
140  * static and must not be free'd.
141  */
142 static const char *
143 nfsv4_geterrstr(int errval)
144 {
145 
146 	if (errval < NFSERR_BADHANDLE || errval > NFSERR_XATTR2BIG)
147 		return (NULL);
148 	return (nfsv4_errstr[errval - NFSERR_BADHANDLE]);
149 }
150 
151 #endif	/* _NFS_NFSV4ERRSTR_H_ */
152