1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 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[48] = { 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 vers not supp", 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 }; 89 90 /* 91 * Return the error string for the NFS4ERR_xxx. The pointers returned are 92 * static and must not be free'd. 93 */ 94 static const char * 95 nfsv4_geterrstr(int errval) 96 { 97 98 if (errval < NFSERR_BADHANDLE || errval > NFSERR_CBPATHDOWN) 99 return (NULL); 100 return (nfsv4_errstr[errval - NFSERR_BADHANDLE]); 101 } 102 103 #endif /* _NFS_NFSV4ERRSTR_H_ */ 104