summaryrefslogtreecommitdiffstats
path: root/tapset/nfsderrno.stp.orig
blob: c15e2c5bd8fc3f06458191e2d762959d5b723442 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

%{
#include <linux/kernel.h>
#include <linux/linkage.h>
#include <linux/time.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/stat.h>
#include <linux/fcntl.h>
#include <linux/net.h>
#include <linux/in.h>
#include <linux/namei.h>
#include <linux/unistd.h>
#include <linux/slab.h>

#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/svc.h>
#include <linux/nfsd/nfsd.h>
%}

function nfsderror:string(err:long) 
%{
	static struct {
		int	nfserr;
		int	syserr;
		char *string;
	} nfs_errtbl[] = {
		{ nfs_ok, 0, "nfserr_ok(ESUCCESS)" },
		{ nfserr_perm, EPERM, "nfserr_perm(EPERM)" },
		{ nfserr_noent, ENOENT , "nfserr_noent(ENOENT)"},
		{ nfserr_io, EIO , "nfserr_io(EIO)"},
		{ nfserr_nxio, ENXIO , "nfserr_nxio(ENXIO)"},
		{ nfserr_acces, EACCES , "nfserr_acces(EACCES)"},
		{ nfserr_exist, EEXIST , "nfserr_exist(EEXIST)"},
		{ nfserr_xdev, EXDEV , "nfserr_xdev(EXDEV)"},
		{ nfserr_mlink, EMLINK , "nfserr_mlink(EMLINK)"},
		{ nfserr_nodev, ENODEV , "nfserr_nodev(ENODEV)"},
		{ nfserr_notdir, ENOTDIR , "nfserr_notdir(ENOTDIR)"},
		{ nfserr_isdir, EISDIR , "nfserr_isdir(EISDIR)"},
		{ nfserr_inval, EINVAL , "nfserr_inval(EINVAL)"},
		{ nfserr_fbig, EFBIG , "nfserr_fbig(EFBIG)"},
		{ nfserr_nospc, ENOSPC , "nfserr_nospc(ENOSPC)"},
		{ nfserr_rofs, EROFS , "nfserr_rofs(EROFS)"},
		{ nfserr_mlink, EMLINK , "nfserr_mlink(EMLINK)"},
		{ nfserr_nametoolong, ENAMETOOLONG , "nfserr_nametoolong(ENAMETOOLONG)"},
		{ nfserr_notempty, ENOTEMPTY , "nfserr_notempty(ENOTEMPTY)"},
		{ nfserr_dquot, EDQUOT , "nfserr_dquot(EDQUOT)"},
		{ nfserr_stale, ESTALE , "nfserr_stale(ESTALE)"},
		{ nfserr_jukebox, ETIMEDOUT , "nfserr_jukebox(ETIMEDOUT)"},
		{ nfserr_dropit, EAGAIN , "nfserr_dropit(EAGAIN)"},
		{ nfserr_dropit, ENOMEM , "nfserr_dropit(ENOMEM)"},
		{ nfserr_badname, ESRCH , "nfserr_badname(ESRCH)"},
		{ nfserr_io, ETXTBSY , "nfserr_io(ETXTBSY)"},
		{ nfserr_notsupp, EOPNOTSUPP , "nfserr_notsupp(EOPNOTSUPP)"},
	};
	int	i;
	int tabsz = (sizeof(nfs_errtbl)/sizeof(nfs_errtbl[0]));

	for (i = 0; i < tabsz; i++) {
		if (nfs_errtbl[i].nfserr == THIS->err) {
			break;
		}
	}
	if (i == tabsz)
		snprintf(THIS->__retvalue, MAXSTRINGLEN, "nfsderr %d", ntohl(THIS->err));
	else
		snprintf(THIS->__retvalue, MAXSTRINGLEN, 
			"nfsderr %d(%s)", ntohl(nfs_errtbl[i].nfserr), nfs_errtbl[i].string);

%}