xref: /freebsd/sys/fs/nfs/nfsv4_errstr.h (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1 /*-
2  * Copyright (c) 2009 Rick Macklem, University of Guelph
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
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[48] = {
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 vers not supp",
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 };
87 
88 /*
89  * Return the error string for the NFS4ERR_xxx. The pointers returned are
90  * static and must not be free'd.
91  */
92 static const char *
93 nfsv4_geterrstr(int errval)
94 {
95 
96 	if (errval < NFSERR_BADHANDLE || errval > NFSERR_CBPATHDOWN)
97 		return (NULL);
98 	return (nfsv4_errstr[errval - NFSERR_BADHANDLE]);
99 }
100 
101 #endif	/* _NFS_NFSV4ERRSTR_H_ */
102