xref: /freebsd/sys/fs/nfs/nfsv4_errstr.h (revision 7899f917b1c0ea178f1d2be0cfb452086d079d23)
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 
29 #ifndef _NFS_NFSV4ERRSTR_H_
30 #define	_NFS_NFSV4ERRSTR_H_
31 
32 /*
33  * Defines static storage in the C file, but I can't be bothered creating
34  * a library of one function for this, since it is only currently used by
35  * mount_newnfs.c.
36  */
37 static const char *nfsv4_errstr[NFSERR_XATTR2BIG - 10000] = {
38 	"Illegal filehandle",
39 	"Undefined NFSv4 err",
40 	"READDIR cookie is stale",
41 	"operation not supported",
42 	"response limit exceeded",
43 	"undefined server error",
44 	"type invalid for CREATE",
45 	"file busy - retry",
46 	"nverify says attrs same",
47 	"lock unavailable",
48 	"lock lease expired",
49 	"I/O failed due to lock",
50 	"in grace period",
51 	"filehandle expired",
52 	"share reserve denied",
53 	"wrong security flavor",
54 	"clientid in use",
55 	"resource exhaustion",
56 	"filesystem relocated",
57 	"current FH is not set",
58 	"minor version not supported",
59 	"server has rebooted",
60 	"server has rebooted",
61 	"state is out of sync",
62 	"incorrect stateid",
63 	"request is out of seq",
64 	"verify - attrs not same",
65 	"lock range not supported",
66 	"should be file/directory",
67 	"no saved filehandle",
68 	"some filesystem moved",
69 	"recommended attr not sup",
70 	"reclaim outside of grace",
71 	"reclaim error at server",
72 	"conflict on reclaim",
73 	"XDR decode failed",
74 	"file locks held at CLOSE",
75 	"conflict in OPEN and I/O",
76 	"owner translation bad",
77 	"utf-8 char not supported",
78 	"name not supported",
79 	"lock range not supported",
80 	"no atomic up/downgrade",
81 	"undefined operation",
82 	"file locking deadlock",
83 	"open file blocks op",
84 	"lockowner state revoked",
85 	"callback path down",
86 	"bad IO mode",
87 	"bad layout",
88 	"bad session digest",
89 	"bad session",
90 	"bad slot",
91 	"complete already",
92 	"not bound to session",
93 	"delegation already wanted",
94 	"back channel busy",
95 	"layout try later",
96 	"layout unavailable",
97 	"no matching layout",
98 	"recall conflict",
99 	"unknown layout type",
100 	"sequence misordered",
101 	"sequence position",
102 	"request too big",
103 	"reply too big",
104 	"reply too big to cache",
105 	"retry uncached reply",
106 	"unsafe compound",
107 	"too many operations",
108 	"operation not in session",
109 	"hash algorithm unsupported",
110 	"unknown error",
111 	"clientID busy",
112 	"pNFS IO hole",
113 	"sequence false retry",
114 	"bad high slot",
115 	"dead session",
116 	"encrypt algorithm unsupported",
117 	"pNFS no layout",
118 	"not only operation",
119 	"wrong credential",
120 	"wrong type",
121 	"directory delegation unavailable",
122 	"reject delegation",
123 	"return conflict",
124 	"delegation revoked",
125 	"partner not supported",
126 	"partner no auth",
127 	"union not supported",
128 	"offload denied",
129 	"wrong LFS",
130 	"bad label",
131 	"offload no request",
132 	"no extended attribute",
133 	"extended attribute too big",
134 };
135 
136 /*
137  * Return the error string for the NFS4ERR_xxx. The pointers returned are
138  * static and must not be free'd.
139  */
140 static const char *
141 nfsv4_geterrstr(int errval)
142 {
143 
144 	if (errval < NFSERR_BADHANDLE || errval > NFSERR_XATTR2BIG)
145 		return (NULL);
146 	return (nfsv4_errstr[errval - NFSERR_BADHANDLE]);
147 }
148 
149 #endif	/* _NFS_NFSV4ERRSTR_H_ */
150