1191783Srmacklem/*- 2191783Srmacklem * Copyright (c) 2009 Rick Macklem, University of Guelph 3191783Srmacklem * All rights reserved. 4191783Srmacklem * 5191783Srmacklem * Redistribution and use in source and binary forms, with or without 6191783Srmacklem * modification, are permitted provided that the following conditions 7191783Srmacklem * are met: 8191783Srmacklem * 1. Redistributions of source code must retain the above copyright 9191783Srmacklem * notice, this list of conditions and the following disclaimer. 10191783Srmacklem * 2. Redistributions in binary form must reproduce the above copyright 11191783Srmacklem * notice, this list of conditions and the following disclaimer in the 12191783Srmacklem * documentation and/or other materials provided with the distribution. 13191783Srmacklem * 14191783Srmacklem * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15191783Srmacklem * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16191783Srmacklem * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17191783Srmacklem * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18191783Srmacklem * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19191783Srmacklem * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20191783Srmacklem * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21191783Srmacklem * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22191783Srmacklem * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23191783Srmacklem * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24191783Srmacklem * SUCH DAMAGE. 25191783Srmacklem * 26191783Srmacklem * $FreeBSD: releng/10.2/sys/fs/nfs/nfsv4_errstr.h 191783 2009-05-04 15:23:58Z rmacklem $ 27191783Srmacklem */ 28191783Srmacklem 29191783Srmacklem#ifndef _NFS_NFSV4ERRSTR_H_ 30191783Srmacklem#define _NFS_NFSV4ERRSTR_H_ 31191783Srmacklem 32191783Srmacklem/* 33191783Srmacklem * Defines static storage in the C file, but I can't be bothered creating 34191783Srmacklem * a library of one function for this, since it is only currently used by 35191783Srmacklem * mount_newnfs.c. 36191783Srmacklem */ 37191783Srmacklemstatic const char *nfsv4_errstr[48] = { 38191783Srmacklem "Illegal filehandle", 39191783Srmacklem "Undefined NFSv4 err", 40191783Srmacklem "READDIR cookie is stale", 41191783Srmacklem "operation not supported", 42191783Srmacklem "response limit exceeded", 43191783Srmacklem "undefined server error", 44191783Srmacklem "type invalid for CREATE", 45191783Srmacklem "file busy - retry", 46191783Srmacklem "nverify says attrs same", 47191783Srmacklem "lock unavailable", 48191783Srmacklem "lock lease expired", 49191783Srmacklem "I/O failed due to lock", 50191783Srmacklem "in grace period", 51191783Srmacklem "filehandle expired", 52191783Srmacklem "share reserve denied", 53191783Srmacklem "wrong security flavor", 54191783Srmacklem "clientid in use", 55191783Srmacklem "resource exhaustion", 56191783Srmacklem "filesystem relocated", 57191783Srmacklem "current FH is not set", 58191783Srmacklem "minor vers not supp", 59191783Srmacklem "server has rebooted", 60191783Srmacklem "server has rebooted", 61191783Srmacklem "state is out of sync", 62191783Srmacklem "incorrect stateid", 63191783Srmacklem "request is out of seq", 64191783Srmacklem "verify - attrs not same", 65191783Srmacklem "lock range not supported", 66191783Srmacklem "should be file/directory", 67191783Srmacklem "no saved filehandle", 68191783Srmacklem "some filesystem moved", 69191783Srmacklem "recommended attr not sup", 70191783Srmacklem "reclaim outside of grace", 71191783Srmacklem "reclaim error at server", 72191783Srmacklem "conflict on reclaim", 73191783Srmacklem "XDR decode failed", 74191783Srmacklem "file locks held at CLOSE", 75191783Srmacklem "conflict in OPEN and I/O", 76191783Srmacklem "owner translation bad", 77191783Srmacklem "utf-8 char not supported", 78191783Srmacklem "name not supported", 79191783Srmacklem "lock range not supported", 80191783Srmacklem "no atomic up/downgrade", 81191783Srmacklem "undefined operation", 82191783Srmacklem "file locking deadlock", 83191783Srmacklem "open file blocks op", 84191783Srmacklem "lockowner state revoked", 85191783Srmacklem "callback path down" 86191783Srmacklem}; 87191783Srmacklem 88191783Srmacklem/* 89191783Srmacklem * Return the error string for the NFS4ERR_xxx. The pointers returned are 90191783Srmacklem * static and must not be free'd. 91191783Srmacklem */ 92191783Srmacklemstatic const char * 93191783Srmacklemnfsv4_geterrstr(int errval) 94191783Srmacklem{ 95191783Srmacklem 96191783Srmacklem if (errval < NFSERR_BADHANDLE || errval > NFSERR_CBPATHDOWN) 97191783Srmacklem return (NULL); 98191783Srmacklem return (nfsv4_errstr[errval - NFSERR_BADHANDLE]); 99191783Srmacklem} 100191783Srmacklem 101191783Srmacklem#endif /* _NFS_NFSV4ERRSTR_H_ */ 102