xref: /linux/fs/smb/client/smberr.h (revision 81dc1e4d32b064ac47abc60b0acbf49b66a34d52)
1 /* SPDX-License-Identifier: LGPL-2.1 */
2 /*
3  *
4  *   Copyright (c) International Business Machines  Corp., 2002,2004
5  *   Author(s): Steve French (sfrench@us.ibm.com)
6  *
7  *   See Error Codes section of the SNIA CIFS Specification
8  *   for more information
9  *
10  */
11 
12 struct smb_to_posix_error {
13 	__u16 smb_err;
14 	int posix_code;
15 };
16 
17 /* The request was successful. */
18 #define SUCCESS	0x00
19 /* Error is from the core DOS operating system set */
20 #define ERRDOS	0x01
21 /* Error is generated by the file server daemon */
22 #define ERRSRV	0x02
23 /* Error is a hardware error. */
24 #define ERRHRD	0x03
25 /* Command was not in the "SMB" format. */
26 #define ERRCMD	0xFF
27 
28 /* The following error codes may be generated with the SUCCESS error class.*/
29 
30 /*#define SUCCESS	0	The request was successful. */
31 
32 /*
33  * The following error codes may be generated with the ERRDOS error class.
34  * The comment at the end of each definition indicates the POSIX error
35  * code; it is used to generate the `mapping_table_ERRDOS` array.
36  */
37 
38 /*
39  * Invalid function. The server did not
40  * recognize or could not perform a
41  * system call generated by the server,
42  * e.g., set the DIRECTORY attribute on
43  * a data file, invalid seek mode.
44  */
45 #define ERRbadfunc		1	// -EINVAL
46 /*
47  * File not found. The last component
48  * of a file's pathname could not be
49  * found.
50  */
51 #define ERRbadfile		2	// -ENOENT
52 /*
53  * Directory invalid. A directory
54  * component in a pathname could not be
55  * found.
56  */
57 #define ERRbadpath		3	// -ENOTDIR
58 /*
59  * Too many open files. The server has
60  * no file handles available.
61  */
62 #define ERRnofids		4	// -EMFILE
63 /*
64  * Access denied, the client's context
65  * does not permit the requested
66  * function. This includes the
67  * following conditions: invalid rename
68  * command, write to Fid open for read
69  * only, read on Fid open for write
70  * only, attempt to delete a non-empty
71  * directory
72  */
73 #define ERRnoaccess		5	// -EACCES
74 /*
75  * Invalid file handle. The file handle
76  * specified was not recognized by the
77  * server.
78  */
79 #define ERRbadfid		6	// -EBADF
80 /* Memory control blocks destroyed. */
81 #define ERRbadmcb		7	// -EIO
82 /*
83  * Insufficient server memory to
84  * perform the requested function.
85  */
86 #define ERRnomem		8	// -EREMOTEIO
87 /* Invalid memory block address. */
88 #define ERRbadmem		9	// -EFAULT
89 /* Invalid environment. */
90 #define ERRbadenv		10	// -EFAULT
91 /* Invalid format. */
92 #define ERRbadformat		11	// -EINVAL
93 /* Invalid open mode. */
94 #define ERRbadaccess		12	// -EACCES
95 /*
96  * Invalid data (generated only by
97  * IOCTL calls within the server).
98  */
99 #define ERRbaddata		13	// -EIO
100 /* Invalid drive specified. */
101 #define ERRbaddrive		15	// -ENXIO
102 /*
103  * A Delete Directory request attempted
104  * to remove the server's current
105  * directory.
106  */
107 #define ERRremcd		16	// -EACCES
108 /*
109  * Not same device (e.g., a cross
110  * volume rename was attempted
111  */
112 #define ERRdiffdevice		17	// -EXDEV
113 /*
114  * A File Search command can find no
115  * more files matching the specified
116  * criteria.
117  */
118 #define ERRnofiles		18	// -ENOENT
119 /* media is write protected */
120 #define ERRwriteprot		19	// -EROFS
121 #define ERRgeneral		31
122 /*
123  * The sharing mode specified for an
124  * Open conflicts with existing FIDs on
125  * the file.
126  */
127 #define ERRbadshare		32	// -EBUSY
128 /*
129  * A Lock request conflicted with an
130  * existing lock or specified an
131  * invalid mode, or an Unlock requested
132  * attempted to remove a lock held by
133  * another process.
134  */
135 #define ERRlock			33	// -EACCES
136 #define ERRunsup		50	// -EINVAL
137 #define ERRnosuchshare		67	// -ENXIO
138 /*
139  * The file named in the request
140  * already exists.
141  */
142 #define ERRfilexists		80	// -EEXIST
143 #define ERRinvparm		87	// -EINVAL
144 #define ERRdiskfull		112	// -ENOSPC
145 #define ERRinvname		123	// -ENOENT
146 #define ERRunknownlevel		124	// -EOPNOTSUPP
147 #define ERRdirnotempty		145	// -ENOTEMPTY
148 #define ERRnotlocked		158	// -ENOLCK
149 #define ERRcancelviolation	173	// -ENOLCK
150 #define ERRalreadyexists	183	// -EEXIST
151 #define ERRbadpipe		230
152 #define ERRpipebusy		231
153 #define ERRpipeclosing		232
154 #define ERRnotconnected		233
155 #define ERRmoredata		234	// -EOVERFLOW
156 #define ERReasnotsupported	282	// -EOPNOTSUPP
157 /*
158  * The operation would cause a quota
159  * limit to be exceeded.
160  */
161 #define ErrQuota		0x200	// -EDQUOT
162 /*
163  * A link operation was performed on a
164  * pathname that was not a link.
165  */
166 #define ErrNotALink		0x201	// -ENOLINK
167 #define ERRnetlogonNotStarted	2455	// -ENOPROTOOPT
168 
169 /* Below errors are used internally (do not come over the wire) for passthrough
170    from STATUS codes to POSIX only  */
171 #define ERRsymlink              0xFFFD	// -EOPNOTSUPP
172 #define ErrTooManyLinks         0xFFFE	// -EMLINK
173 
174 /*
175  * The following error codes may be generated with the ERRSRV error class.
176  * The comment at the end of each definition indicates the POSIX error
177  * code; it is used to generate the `mapping_table_ERRSRV` array.
178  */
179 
180 /*
181  * Non-specific error code. It is
182  * returned under the following
183  * conditions: resource other than disk
184  * space exhausted (e.g. TIDs), first
185  * SMB command was not negotiate,
186  * multiple negotiates attempted, and
187  * internal server error.
188  */
189 #define ERRerror		1	// -EIO
190 /*
191  * Bad password - name/password pair in
192  * a TreeConnect or Session Setup are
193  * invalid.
194  */
195 #define ERRbadpw		2	// -EACCES
196 /*
197  * used for indicating DFS referral
198  * needed
199  */
200 #define ERRbadtype		3	// -EREMOTE
201 /*
202  * The client does not have the
203  * necessary access rights within the
204  * specified context for requested
205  * function.
206  */
207 #define ERRaccess		4	// -EACCES
208 /*
209  * The Tid specified in a command was
210  * invalid.
211  */
212 #define ERRinvtid		5	// -ENXIO
213 /*
214  * Invalid network name in tree
215  * connect.
216  */
217 #define ERRinvnetname		6	// -ENXIO
218 /*
219  * Invalid device - printer request
220  * made to non-printer connection or
221  * non-printer request made to printer
222  * connection.
223  */
224 #define ERRinvdevice		7	// -ENXIO
225 /*
226  * Print queue full (files) -- returned
227  * by open print file.
228  */
229 #define ERRqfull		49	// -ENOSPC
230 /* Print queue full -- no space. */
231 #define ERRqtoobig		50	// -ENOSPC
232 /* EOF on print queue dump */
233 #define ERRqeof			51	// -EIO
234 /* Invalid print file FID. */
235 #define ERRinvpfid		52	// -EBADF
236 /*
237  * The server did not recognize the
238  * command received.
239  */
240 #define ERRsmbcmd		64	// -EBADRQC
241 /*
242  * The server encountered an internal
243  * error, e.g., system file
244  * unavailable.
245  */
246 #define ERRsrverror		65	// -EIO
247 /* (obsolete) */
248 #define ERRbadBID		66	// -EIO
249 /*
250  * The Fid and pathname parameters
251  * contained an invalid combination of
252  * values.
253  */
254 #define ERRfilespecs		67	// -EINVAL
255 /* (obsolete) */
256 #define ERRbadLink		68	// -EIO
257 /*
258  * The access permissions specified for
259  * a file or directory are not a valid
260  * combination.
261  */
262 #define ERRbadpermits		69	// -EINVAL
263 #define ERRbadPID		70	// -ESRCH
264 /* attribute (mode) is invalid */
265 #define ERRsetattrmode		71	// -EINVAL
266 /* Server is paused */
267 #define ERRpaused		81	// -EHOSTDOWN
268 /* reserved - messaging off */
269 #define ERRmsgoff		82	// -EHOSTDOWN
270 /* reserved - no room for message */
271 #define ERRnoroom		83	// -ENOSPC
272 /* reserved - too many remote names */
273 #define ERRrmuns		87	// -EUSERS
274 /* operation timed out */
275 #define ERRtimeout		88	// -ETIME
276 /* No resources available for request */
277 #define ERRnoresource		89	// -EREMOTEIO
278 /* Too many UIDs active on this session */
279 #define ERRtoomanyuids		90	// -EUSERS
280 /* The UID is not known as a valid user */
281 #define ERRbaduid		91	// -EACCES
282 /* temporarily unable to use raw */
283 #define ERRusempx		250	// -EIO
284 /*
285  * temporarily unable to use either raw
286  * or mpx
287  */
288 #define ERRusestd		251	// -EIO
289 #define ERR_NOTIFY_ENUM_DIR	1024	// -ENOBUFS
290 /* user account does not exist */
291 #define ERRnoSuchUser		2238	// -EACCES
292 #define ERRaccountexpired	2239	// -EKEYEXPIRED
293 /* can not logon from this client */
294 #define ERRbadclient		2240	// -EACCES
295 /* logon hours do not allow this */
296 #define ERRbadLogonTime		2241	// -EACCES
297 #define ERRpasswordExpired	2242	// -EKEYEXPIRED
298 #define ERRnosupport		0xFFFF	// -EINVAL
299