Debian Codegraph @

tapset/linux/nfsderrno.stp

raw
1 // nfsd errnos tapset
2 // Copyright (C) 2010 Red Hat Inc.
3 //
4 // This file is part of systemtap, and is free software. You can
5 // redistribute it and/or modify it under the terms of the GNU General
6 // Public License (GPL); either version 2, or (at your option) any
7 // later version.
8
9 %{
10 #include <linux/nfs.h>
11 #include <linux/nfs4.h>
12
13 /* NFSERR_OPNOTSUPP not an official error and was removed from Linux 6.10 */
14 #if LINUX_VERSION_CODE >= KERNEL_VERSION(6,10,0)
15 #define NFSERR_OPNOTSUPP 45
16 #endif
17
18 #define nfs_ok __constant_htonl(NFS_OK)
19 #define nfserr_perm __constant_htonl(NFSERR_PERM)
20 #define nfserr_noent __constant_htonl(NFSERR_NOENT)
21 #define nfserr_io __constant_htonl(NFSERR_IO)
22 #define nfserr_nxio __constant_htonl(NFSERR_NXIO)
23 #define nfserr_eagain __constant_htonl(NFSERR_EAGAIN)
24 #define nfserr_acces __constant_htonl(NFSERR_ACCES)
25 #define nfserr_exist __constant_htonl(NFSERR_EXIST)
26 #define nfserr_xdev __constant_htonl(NFSERR_XDEV)
27 #define nfserr_nodev __constant_htonl(NFSERR_NODEV)
28 #define nfserr_notdir __constant_htonl(NFSERR_NOTDIR)
29 #define nfserr_isdir __constant_htonl(NFSERR_ISDIR)
30 #define nfserr_inval __constant_htonl(NFSERR_INVAL)
31 #define nfserr_fbig __constant_htonl(NFSERR_FBIG)
32 #define nfserr_nospc __constant_htonl(NFSERR_NOSPC)
33 #define nfserr_rofs __constant_htonl(NFSERR_ROFS)
34 #define nfserr_mlink __constant_htonl(NFSERR_MLINK)
35 #define nfserr_opnotsupp __constant_htonl(NFSERR_OPNOTSUPP)
36 #define nfserr_nametoolong __constant_htonl(NFSERR_NAMETOOLONG)
37 #define nfserr_notempty __constant_htonl(NFSERR_NOTEMPTY)
38 #define nfserr_dquot __constant_htonl(NFSERR_DQUOT)
39 #define nfserr_stale __constant_htonl(NFSERR_STALE)
40 #define nfserr_remote __constant_htonl(NFSERR_REMOTE)
41 #define nfserr_wflush __constant_htonl(NFSERR_WFLUSH)
42 #define nfserr_badhandle __constant_htonl(NFSERR_BADHANDLE)
43 #define nfserr_notsync __constant_htonl(NFSERR_NOT_SYNC)
44 #define nfserr_badcookie __constant_htonl(NFSERR_BAD_COOKIE)
45 #define nfserr_notsupp __constant_htonl(NFSERR_NOTSUPP)
46 #define nfserr_toosmall __constant_htonl(NFSERR_TOOSMALL)
47 #define nfserr_serverfault __constant_htonl(NFSERR_SERVERFAULT)
48 #define nfserr_badtype __constant_htonl(NFSERR_BADTYPE)
49 #define nfserr_jukebox __constant_htonl(NFSERR_JUKEBOX)
50 #define nfserr_denied __constant_htonl(NFSERR_DENIED)
51 #define nfserr_deadlock __constant_htonl(NFSERR_DEADLOCK)
52 #define nfserr_expired __constant_htonl(NFSERR_EXPIRED)
53 #define nfserr_bad_cookie __constant_htonl(NFSERR_BAD_COOKIE)
54 #define nfserr_same __constant_htonl(NFSERR_SAME)
55 #define nfserr_clid_inuse __constant_htonl(NFSERR_CLID_INUSE)
56 #define nfserr_stale_clientid __constant_htonl(NFSERR_STALE_CLIENTID)
57 #define nfserr_resource __constant_htonl(NFSERR_RESOURCE)
58 #define nfserr_moved __constant_htonl(NFSERR_MOVED)
59 #define nfserr_nofilehandle __constant_htonl(NFSERR_NOFILEHANDLE)
60 #define nfserr_minor_vers_mismatch __constant_htonl(NFSERR_MINOR_VERS_MISMATCH)
61 #define nfserr_share_denied __constant_htonl(NFSERR_SHARE_DENIED)
62 #define nfserr_stale_stateid __constant_htonl(NFSERR_STALE_STATEID)
63 #define nfserr_old_stateid __constant_htonl(NFSERR_OLD_STATEID)
64 #define nfserr_bad_stateid __constant_htonl(NFSERR_BAD_STATEID)
65 #define nfserr_bad_seqid __constant_htonl(NFSERR_BAD_SEQID)
66 #define nfserr_symlink __constant_htonl(NFSERR_SYMLINK)
67 #define nfserr_not_same __constant_htonl(NFSERR_NOT_SAME)
68 #define nfserr_restorefh __constant_htonl(NFSERR_RESTOREFH)
69 #define nfserr_attrnotsupp __constant_htonl(NFSERR_ATTRNOTSUPP)
70 #define nfserr_bad_xdr __constant_htonl(NFSERR_BAD_XDR)
71 #define nfserr_openmode __constant_htonl(NFSERR_OPENMODE)
72 #define nfserr_locks_held __constant_htonl(NFSERR_LOCKS_HELD)
73 #define nfserr_op_illegal __constant_htonl(NFSERR_OP_ILLEGAL)
74 #define nfserr_grace __constant_htonl(NFSERR_GRACE)
75 #define nfserr_no_grace __constant_htonl(NFSERR_NO_GRACE)
76 #define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD)
77 #define nfserr_badname __constant_htonl(NFSERR_BADNAME)
78 #define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN)
79 #define nfserr_locked __constant_htonl(NFSERR_LOCKED)
80 #define nfserr_wrongsec __constant_htonl(NFSERR_WRONGSEC)
81 #define nfserr_badiomode __constant_htonl(NFS4ERR_BADIOMODE)
82 #define nfserr_badlayout __constant_htonl(NFS4ERR_BADLAYOUT)
83 #define nfserr_bad_session_digest __constant_htonl(NFS4ERR_BAD_SESSION_DIGEST)
84 #define nfserr_badsession __constant_htonl(NFS4ERR_BADSESSION)
85 #define nfserr_badslot __constant_htonl(NFS4ERR_BADSLOT)
86 #define nfserr_complete_already __constant_htonl(NFS4ERR_COMPLETE_ALREADY)
87 #define nfserr_conn_not_bound_to_session __constant_htonl(NFS4ERR_CONN_NOT_BOUND_TO_SESSION)
88 #define nfserr_deleg_already_wanted __constant_htonl(NFS4ERR_DELEG_ALREADY_WANTED)
89 #define nfserr_back_chan_busy __constant_htonl(NFS4ERR_BACK_CHAN_BUSY)
90 #define nfserr_layouttrylater __constant_htonl(NFS4ERR_LAYOUTTRYLATER)
91 #define nfserr_layoutunavailable __constant_htonl(NFS4ERR_LAYOUTUNAVAILABLE)
92 #define nfserr_nomatching_layout __constant_htonl(NFS4ERR_NOMATCHING_LAYOUT)
93 #define nfserr_recallconflict __constant_htonl(NFS4ERR_RECALLCONFLICT)
94 #define nfserr_unknown_layouttype __constant_htonl(NFS4ERR_UNKNOWN_LAYOUTTYPE)
95 #define nfserr_seq_misordered __constant_htonl(NFS4ERR_SEQ_MISORDERED)
96 #define nfserr_sequence_pos __constant_htonl(NFS4ERR_SEQUENCE_POS)
97 #define nfserr_req_too_big __constant_htonl(NFS4ERR_REQ_TOO_BIG)
98 #define nfserr_rep_too_big __constant_htonl(NFS4ERR_REP_TOO_BIG)
99 #define nfserr_rep_too_big_to_cache __constant_htonl(NFS4ERR_REP_TOO_BIG_TO_CACHE)
100 #define nfserr_retry_uncached_rep __constant_htonl(NFS4ERR_RETRY_UNCACHED_REP)
101 #define nfserr_unsafe_compound __constant_htonl(NFS4ERR_UNSAFE_COMPOUND)
102 #define nfserr_too_many_ops __constant_htonl(NFS4ERR_TOO_MANY_OPS)
103 #define nfserr_op_not_in_session __constant_htonl(NFS4ERR_OP_NOT_IN_SESSION)
104 #define nfserr_hash_alg_unsupp __constant_htonl(NFS4ERR_HASH_ALG_UNSUPP)
105 #define nfserr_clientid_busy __constant_htonl(NFS4ERR_CLIENTID_BUSY)
106 #define nfserr_pnfs_io_hole __constant_htonl(NFS4ERR_PNFS_IO_HOLE)
107 #define nfserr_seq_false_retry __constant_htonl(NFS4ERR_SEQ_FALSE_RETRY)
108 #define nfserr_bad_high_slot __constant_htonl(NFS4ERR_BAD_HIGH_SLOT)
109 #define nfserr_deadsession __constant_htonl(NFS4ERR_DEADSESSION)
110 #define nfserr_encr_alg_unsupp __constant_htonl(NFS4ERR_ENCR_ALG_UNSUPP)
111 #define nfserr_pnfs_no_layout __constant_htonl(NFS4ERR_PNFS_NO_LAYOUT)
112 #define nfserr_not_only_op __constant_htonl(NFS4ERR_NOT_ONLY_OP)
113 #define nfserr_wrong_cred __constant_htonl(NFS4ERR_WRONG_CRED)
114 #define nfserr_wrong_type __constant_htonl(NFS4ERR_WRONG_TYPE)
115 #define nfserr_dirdeleg_unavail __constant_htonl(NFS4ERR_DIRDELEG_UNAVAIL)
116 #define nfserr_reject_deleg __constant_htonl(NFS4ERR_REJECT_DELEG)
117 #define nfserr_returnconflict __constant_htonl(NFS4ERR_RETURNCONFLICT)
118 #define nfserr_deleg_revoked __constant_htonl(NFS4ERR_DELEG_REVOKED)
119 %}
120
121 /**
122 * sfunction nfsderror - Convert nfsd error number into string
123 * @err: errnum
124 *
125 * Description: This function returns a string for the error number
126 * passed into the function.
127 */
128 function nfsderror:string(err:long)
129 %{
130 static struct {
131 int nfserr;
132 char *string;
133 } nfs_errtbl[] = {
134 {nfs_ok, "NFS_OK"},
135 {nfserr_perm, "NFSERR_PERM"},
136 {nfserr_noent, "NFSERR_NOENT"},
137 {nfserr_io, "NFSERR_IO"},
138 {nfserr_nxio, "NFSERR_NXIO"},
139 {nfserr_eagain, "NFSERR_EAGAIN"},
140 {nfserr_acces, "NFSERR_ACCES"},
141 {nfserr_exist, "NFSERR_EXIST"},
142 {nfserr_xdev, "NFSERR_XDEV"},
143 {nfserr_nodev, "NFSERR_NODEV"},
144 {nfserr_notdir, "NFSERR_NOTDIR"},
145 {nfserr_isdir, "NFSERR_ISDIR"},
146 {nfserr_inval, "NFSERR_INVAL"},
147 {nfserr_fbig, "NFSERR_FBIG"},
148 {nfserr_nospc, "NFSERR_NOSPC"},
149 {nfserr_rofs, "NFSERR_ROFS"},
150 {nfserr_mlink, "NFSERR_MLINK"},
151 {nfserr_opnotsupp, "NFSERR_OPNOTSUPP"},
152 {nfserr_nametoolong, "NFSERR_NAMETOOLONG"},
153 {nfserr_notempty, "NFSERR_NOTEMPTY"},
154 {nfserr_dquot, "NFSERR_DQUOT"},
155 {nfserr_stale, "NFSERR_STALE"},
156 {nfserr_remote, "NFSERR_REMOTE"},
157 {nfserr_wflush, "NFSERR_WFLUSH"},
158 {nfserr_badhandle, "NFSERR_BADHANDLE"},
159 {nfserr_notsync, "NFSERR_NOT_SYNC"},
160 {nfserr_badcookie, "NFSERR_BAD_COOKIE"},
161 {nfserr_notsupp, "NFSERR_NOTSUPP"},
162 {nfserr_toosmall, "NFSERR_TOOSMALL"},
163 {nfserr_serverfault, "NFSERR_SERVERFAULT"},
164 {nfserr_badtype, "NFSERR_BADTYPE"},
165 {nfserr_jukebox, "NFSERR_JUKEBOX"},
166 {nfserr_denied, "NFSERR_DENIED"},
167 {nfserr_deadlock, "NFSERR_DEADLOCK"},
168 {nfserr_expired, "NFSERR_EXPIRED"},
169 {nfserr_bad_cookie, "NFSERR_BAD_COOKIE"},
170 {nfserr_same, "NFSERR_SAME"},
171 {nfserr_clid_inuse, "NFSERR_CLID_INUSE"},
172 {nfserr_stale_clientid, "NFSERR_STALE_CLIENTID"},
173 {nfserr_resource, "NFSERR_RESOURCE"},
174 {nfserr_moved, "NFSERR_MOVED"},
175 {nfserr_nofilehandle, "NFSERR_NOFILEHANDLE"},
176 {nfserr_minor_vers_mismatch, "NFSERR_MINOR_VERS_MISMATCH"},
177 {nfserr_share_denied, "NFSERR_SHARE_DENIED"},
178 {nfserr_stale_stateid, "NFSERR_STALE_STATEID"},
179 {nfserr_old_stateid, "NFSERR_OLD_STATEID"},
180 {nfserr_bad_stateid, "NFSERR_BAD_STATEID"},
181 {nfserr_bad_seqid, "NFSERR_BAD_SEQID"},
182 {nfserr_symlink , "NFSERR_SYMLINK"},
183 {nfserr_not_same , "NFSERR_NOT_SAME"},
184 {nfserr_restorefh , "NFSERR_RESTOREFH"},
185 {nfserr_attrnotsupp, "NFSERR_ATTRNOTSUPP"},
186 {nfserr_bad_xdr, "NFSERR_BAD_XDR"},
187 {nfserr_openmode, "NFSERR_OPENMODE"},
188 {nfserr_locks_held, "NFSERR_LOCKS_HELD"},
189 {nfserr_op_illegal, "NFSERR_OP_ILLEGAL"},
190 {nfserr_grace, "NFSERR_GRACE"},
191 {nfserr_no_grace, "NFSERR_NO_GRACE"},
192 {nfserr_reclaim_bad, "NFSERR_RECLAIM_BAD"},
193 {nfserr_badname, "NFSERR_BADNAME"},
194 {nfserr_cb_path_down, "NFSERR_CB_PATH_DOWN"},
195 {nfserr_locked, "NFSERR_LOCKED"},
196 {nfserr_wrongsec, "NFSERR_WRONGSEC"},
197 {nfserr_badiomode, "NFS4ERR_BADIOMODE"},
198 {nfserr_badlayout, "NFS4ERR_BADLAYOUT"},
199 {nfserr_bad_session_digest, "NFS4ERR_BAD_SESSION_DIGEST"},
200 {nfserr_badsession, "NFS4ERR_BADSESSION"},
201 {nfserr_badslot, "NFS4ERR_BADSLOT"},
202 {nfserr_complete_already, "NFS4ERR_COMPLETE_ALREADY"},
203 {nfserr_conn_not_bound_to_session, "NFS4ERR_CONN_NOT_BOUND_TO_SESSION"},
204 {nfserr_deleg_already_wanted, "NFS4ERR_DELEG_ALREADY_WANTED"},
205 {nfserr_back_chan_busy, "NFS4ERR_BACK_CHAN_BUSY"},
206 {nfserr_layouttrylater, "NFS4ERR_LAYOUTTRYLATER"},
207 {nfserr_layoutunavailable, "NFS4ERR_LAYOUTUNAVAILABLE"},
208 {nfserr_nomatching_layout, "NFS4ERR_NOMATCHING_LAYOUT"},
209 {nfserr_recallconflict, "NFS4ERR_RECALLCONFLICT"},
210 {nfserr_unknown_layouttype, "NFS4ERR_UNKNOWN_LAYOUTTYPE"},
211 {nfserr_seq_misordered, "NFS4ERR_SEQ_MISORDERED"},
212 {nfserr_sequence_pos, "NFS4ERR_SEQUENCE_POS"},
213 {nfserr_req_too_big, "NFS4ERR_REQ_TOO_BIG"},
214 {nfserr_rep_too_big, "NFS4ERR_REP_TOO_BIG"},
215 {nfserr_rep_too_big_to_cache, "NFS4ERR_REP_TOO_BIG_TO_CACHE"},
216 {nfserr_retry_uncached_rep, "NFS4ERR_RETRY_UNCACHED_REP"},
217 {nfserr_unsafe_compound, "NFS4ERR_UNSAFE_COMPOUND"},
218 {nfserr_too_many_ops, "NFS4ERR_TOO_MANY_OPS"},
219 {nfserr_op_not_in_session, "NFS4ERR_OP_NOT_IN_SESSION"},
220 {nfserr_hash_alg_unsupp, "NFS4ERR_HASH_ALG_UNSUPP"},
221 {nfserr_clientid_busy, "NFS4ERR_CLIENTID_BUSY"},
222 {nfserr_pnfs_io_hole, "NFS4ERR_PNFS_IO_HOLE"},
223 {nfserr_seq_false_retry, "NFS4ERR_SEQ_FALSE_RETRY"},
224 {nfserr_bad_high_slot, "NFS4ERR_BAD_HIGH_SLOT"},
225 {nfserr_deadsession, "NFS4ERR_DEADSESSION"},
226 {nfserr_encr_alg_unsupp, "NFS4ERR_ENCR_ALG_UNSUPP"},
227 {nfserr_pnfs_no_layout, "NFS4ERR_PNFS_NO_LAYOUT"},
228 {nfserr_not_only_op, "NFS4ERR_NOT_ONLY_OP"},
229 {nfserr_wrong_cred, "NFS4ERR_WRONG_CRED"},
230 {nfserr_wrong_type, "NFS4ERR_WRONG_TYPE"},
231 {nfserr_dirdeleg_unavail, "NFS4ERR_DIRDELEG_UNAVAIL"},
232 {nfserr_reject_deleg, "NFS4ERR_REJECT_DELEG"},
233 {nfserr_returnconflict, "NFS4ERR_RETURNCONFLICT"},
234 {nfserr_deleg_revoked, "NFS4ERR_DELEG_REVOKED"},
235 };
236 int i;
237 int tabsz = (sizeof(nfs_errtbl)/sizeof(nfs_errtbl[0]));
238
239 for (i = 0; i < tabsz; i++) {
240 if (nfs_errtbl[i].nfserr == STAP_ARG_err) {
241 break;
242 }
243 }
244 if (i == tabsz)
245 snprintf(STAP_RETVALUE, MAXSTRINGLEN, "nfsderr %d", ntohl(STAP_ARG_err));
246 else
247 snprintf(STAP_RETVALUE, MAXSTRINGLEN,
248 "nfsderr %d(%s)", ntohl(nfs_errtbl[i].nfserr), nfs_errtbl[i].string);
249
250 %}