|
@@ -7,35 +7,53 @@
|
7
|
7
|
*
|
8
|
8
|
* Return status codes as used within gPXE are designed to allow for
|
9
|
9
|
* maximum visibility into the source of an error even in an end-user
|
10
|
|
- * build with no debugging. They are constructed in three parts: a
|
11
|
|
- * PXE error code, a POSIX error code, and a gPXE-specific error code.
|
|
10
|
+ * build with no debugging. They are constructed as follows:
|
12
|
11
|
*
|
13
|
|
- * The low byte is the closest equivalent PXE error code
|
|
12
|
+ * Bits 7-0 : PXE error code
|
|
13
|
+ *
|
|
14
|
+ * This is the closest equivalent PXE error code
|
14
|
15
|
* (e.g. PXENV_STATUS_OUT_OF_RESOURCES), and is the only part of the
|
15
|
16
|
* error that will be returned via the PXE API, since PXE has
|
16
|
17
|
* predefined error codes.
|
17
|
18
|
*
|
18
|
|
- * The next byte is the closest equivalent POSIX error code
|
19
|
|
- * (e.g. ENOMEM).
|
|
19
|
+ * Bits 12-8 : Per-file disambiguator
|
|
20
|
+ *
|
|
21
|
+ * When the same error number can be generated from multiple points
|
|
22
|
+ * within a file, this field can be used to identify the unique
|
|
23
|
+ * instance.
|
|
24
|
+ *
|
|
25
|
+ * Bits 23-13 : File identifier
|
|
26
|
+ *
|
|
27
|
+ * This is a unique identifier for the file generating the error
|
|
28
|
+ * (e.g. ERRFILE_tcp for tcp.c).
|
|
29
|
+ *
|
|
30
|
+ * Bits 30-24 : POSIX error code
|
|
31
|
+ *
|
|
32
|
+ * This is the closest equivalent POSIX error code (e.g. ENOMEM).
|
|
33
|
+ *
|
|
34
|
+ * Bit 31 : Reserved
|
|
35
|
+ *
|
|
36
|
+ * Errors are usually return as negative error numbers (e.g. -EINVAL);
|
|
37
|
+ * bit 31 is therefore unusable.
|
20
|
38
|
*
|
21
|
|
- * The remaining bytes are the gPXE-specific error code, which allow
|
22
|
|
- * us to disambiguate between errors which should have the same POSIX
|
23
|
|
- * error code but which mean very different things to the user
|
24
|
|
- * (e.g. ENOENT due to a DNS name not existing versus ENOENT due to
|
25
|
|
- * a web server returning HTTP/404 Not Found).
|
26
|
39
|
*
|
27
|
40
|
* The convention within the code is that errors are negative and
|
28
|
|
- * expressed as the bitwise OR of a POSIX error code and (optionally)
|
29
|
|
- * a gPXE error code, as in
|
|
41
|
+ * expressed using the POSIX error code and (optionally) a per-file
|
|
42
|
+ * disambiguator, e.g.
|
30
|
43
|
*
|
31
|
|
- * return -( ENOENT | NO_SUCH_FILE );
|
|
44
|
+ * return -EINVAL;
|
32
|
45
|
*
|
33
|
|
- * The POSIX error code is #defined to include the closest matching
|
34
|
|
- * PXE error code (which, in most cases, is just
|
35
|
|
- * PXENV_STATUS_FAILURE), so we don't need to litter the codebase with
|
36
|
|
- * PXEisms.
|
|
46
|
+ * or
|
37
|
47
|
*
|
38
|
|
- * Functions that wish to return failure should be declared as
|
|
48
|
+ * #define ETCP_BAD_CHECKSUM EUNIQ_02
|
|
49
|
+ * return -( EINVAL | ETCP_BAD_CHECKSUM )
|
|
50
|
+ *
|
|
51
|
+ * By various bits of preprocessor magic, the PXE error code and file
|
|
52
|
+ * identifier are already incorporated into the definition of the
|
|
53
|
+ * POSIX error code, which keeps the code relatively clean.
|
|
54
|
+ *
|
|
55
|
+ *
|
|
56
|
+ * Functions that wish to return failures should be declared as
|
39
|
57
|
* returning an integer @c rc "Return status code". A return value of
|
40
|
58
|
* zero indicates success, a non-zero value indicates failure. The
|
41
|
59
|
* return value can be passed directly to strerror() in order to
|
|
@@ -51,6 +69,20 @@
|
51
|
69
|
*
|
52
|
70
|
*/
|
53
|
71
|
|
|
72
|
+/* Get definitions for file identifiers */
|
|
73
|
+#include <gpxe/errfile.h>
|
|
74
|
+
|
|
75
|
+/* If we do not have a valid file identifier, generate a compiler
|
|
76
|
+ * warning upon usage of any error codes. (Don't just use a #warning,
|
|
77
|
+ * because some files include errno.h but don't ever actually use any
|
|
78
|
+ * error codes.)
|
|
79
|
+ */
|
|
80
|
+#if ! ERRFILE
|
|
81
|
+extern char missing_errfile_declaration[] __attribute__ (( deprecated ));
|
|
82
|
+#undef ERRFILE
|
|
83
|
+#define ERRFILE ( 0 * ( ( int ) missing_errfile_declaration ) )
|
|
84
|
+#endif
|
|
85
|
+
|
54
|
86
|
/** Derive PXENV_STATUS code from gPXE error number */
|
55
|
87
|
#define PXENV_STATUS( rc ) ( (-(rc)) & 0x00ff )
|
56
|
88
|
|
|
@@ -178,262 +210,297 @@
|
178
|
210
|
*/
|
179
|
211
|
|
180
|
212
|
/** Operation completed successfully */
|
181
|
|
-#define ENOERR ( PXENV_STATUS_SUCCESS | 0x0000 )
|
|
213
|
+#define ENOERR ( ERRFILE | PXENV_STATUS_SUCCESS | 0x00000000 )
|
182
|
214
|
|
183
|
215
|
/** Arg list too long */
|
184
|
|
-#define E2BIG ( PXENV_STATUS_BAD_FUNC | 0x0100 )
|
|
216
|
+#define E2BIG ( ERRFILE | PXENV_STATUS_BAD_FUNC | 0x01000000 )
|
185
|
217
|
|
186
|
218
|
/** Permission denied */
|
187
|
|
-#define EACCES ( PXENV_STATUS_TFTP_ACCESS_VIOLATION | 0x0200 )
|
|
219
|
+#define EACCES ( ERRFILE | PXENV_STATUS_TFTP_ACCESS_VIOLATION | 0x02000000 )
|
188
|
220
|
|
189
|
221
|
/** Address in use */
|
190
|
|
-#define EADDRINUSE ( PXENV_STATUS_UDP_OPEN | 0x0300 )
|
|
222
|
+#define EADDRINUSE ( ERRFILE | PXENV_STATUS_UDP_OPEN | 0x03000000 )
|
191
|
223
|
|
192
|
224
|
/** Address not available */
|
193
|
|
-#define EADDRNOTAVAIL ( PXENV_STATUS_UDP_OPEN | 0x0400 )
|
|
225
|
+#define EADDRNOTAVAIL ( ERRFILE | PXENV_STATUS_UDP_OPEN | 0x04000000 )
|
194
|
226
|
|
195
|
227
|
/** Address family not supported */
|
196
|
|
-#define EAFNOSUPPORT ( PXENV_STATUS_UNSUPPORTED | 0x0500 )
|
|
228
|
+#define EAFNOSUPPORT ( ERRFILE | PXENV_STATUS_UNSUPPORTED | 0x05000000 )
|
197
|
229
|
|
198
|
230
|
/** Resource temporarily unavailable */
|
199
|
|
-#define EAGAIN ( PXENV_STATUS_FAILURE | 0x0600 )
|
|
231
|
+#define EAGAIN ( ERRFILE | PXENV_STATUS_FAILURE | 0x06000000 )
|
200
|
232
|
|
201
|
233
|
/** Connection already in progress */
|
202
|
|
-#define EALREADY ( PXENV_STATUS_UDP_OPEN | 0x0700 )
|
|
234
|
+#define EALREADY ( ERRFILE | PXENV_STATUS_UDP_OPEN | 0x07000000 )
|
203
|
235
|
|
204
|
236
|
/** Bad file descriptor */
|
205
|
|
-#define EBADF ( PXENV_STATUS_TFTP_CLOSED | 0x0800 )
|
|
237
|
+#define EBADF ( ERRFILE | PXENV_STATUS_TFTP_CLOSED | 0x08000000 )
|
206
|
238
|
|
207
|
239
|
/** Bad message */
|
208
|
|
-#define EBADMSG ( PXENV_STATUS_FAILURE | 0x0900 )
|
|
240
|
+#define EBADMSG ( ERRFILE | PXENV_STATUS_FAILURE | 0x09000000 )
|
209
|
241
|
|
210
|
242
|
/** Resource busy */
|
211
|
|
-#define EBUSY ( PXENV_STATUS_OUT_OF_RESOURCES | 0x0a00 )
|
|
243
|
+#define EBUSY ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x0a000000 )
|
212
|
244
|
|
213
|
245
|
/** Operation canceled */
|
214
|
|
-#define ECANCELED ( PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE | 0x0b00 )
|
|
246
|
+#define ECANCELED \
|
|
247
|
+ ( ERRFILE | PXENV_STATUS_BINL_CANCELED_BY_KEYSTROKE | 0x0b000000 )
|
215
|
248
|
|
216
|
249
|
/** No child processes */
|
217
|
|
-#define ECHILD ( PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x0c00 )
|
|
250
|
+#define ECHILD ( ERRFILE | PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x0c000000 )
|
218
|
251
|
|
219
|
252
|
/** Connection aborted */
|
220
|
|
-#define ECONNABORTED ( PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION | 0x0d00 )
|
|
253
|
+#define ECONNABORTED \
|
|
254
|
+ ( ERRFILE | PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION | 0x0d000000 )
|
221
|
255
|
|
222
|
256
|
/** Connection refused */
|
223
|
|
-#define ECONNREFUSED ( PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION | 0x0e00 )
|
|
257
|
+#define ECONNREFUSED \
|
|
258
|
+ ( ERRFILE | PXENV_STATUS_TFTP_CANNOT_OPEN_CONNECTION | 0x0e000000 )
|
224
|
259
|
|
225
|
260
|
/** Connection reset */
|
226
|
|
-#define ECONNRESET ( PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION | 0x0f00 )
|
|
261
|
+#define ECONNRESET \
|
|
262
|
+ ( ERRFILE | PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION | 0x0f000000 )
|
227
|
263
|
|
228
|
264
|
/** Resource deadlock avoided */
|
229
|
|
-#define EDEADLK ( PXENV_STATUS_FAILURE | 0x1000 )
|
|
265
|
+#define EDEADLK ( ERRFILE | PXENV_STATUS_FAILURE | 0x10000000 )
|
230
|
266
|
|
231
|
267
|
/** Destination address required */
|
232
|
|
-#define EDESTADDRREQ ( PXENV_STATUS_BAD_FUNC | 0x1100 )
|
|
268
|
+#define EDESTADDRREQ ( ERRFILE | PXENV_STATUS_BAD_FUNC | 0x11000000 )
|
233
|
269
|
|
234
|
270
|
/** Domain error */
|
235
|
|
-#define EDOM ( PXENV_STATUS_FAILURE | 0x1200 )
|
|
271
|
+#define EDOM ( ERRFILE | PXENV_STATUS_FAILURE | 0x12000000 )
|
236
|
272
|
|
237
|
273
|
/** Reserved */
|
238
|
|
-#define EDQUOT ( PXENV_STATUS_FAILURE | 0x1300 )
|
|
274
|
+#define EDQUOT ( ERRFILE | PXENV_STATUS_FAILURE | 0x13000000 )
|
239
|
275
|
|
240
|
276
|
/** File exists */
|
241
|
|
-#define EEXIST ( PXENV_STATUS_FAILURE | 0x1400 )
|
|
277
|
+#define EEXIST ( ERRFILE | PXENV_STATUS_FAILURE | 0x14000000 )
|
242
|
278
|
|
243
|
279
|
/** Bad address */
|
244
|
|
-#define EFAULT ( PXENV_STATUS_MCOPY_PROBLEM | 0x1500 )
|
|
280
|
+#define EFAULT ( ERRFILE | PXENV_STATUS_MCOPY_PROBLEM | 0x15000000 )
|
245
|
281
|
|
246
|
282
|
/** File too large */
|
247
|
|
-#define EFBIG ( PXENV_STATUS_MCOPY_PROBLEM | 0x1600 )
|
|
283
|
+#define EFBIG ( ERRFILE | PXENV_STATUS_MCOPY_PROBLEM | 0x16000000 )
|
248
|
284
|
|
249
|
285
|
/** Host is unreachable */
|
250
|
|
-#define EHOSTUNREACH ( PXENV_STATUS_ARP_TIMEOUT | 0x1700 )
|
|
286
|
+#define EHOSTUNREACH ( ERRFILE | PXENV_STATUS_ARP_TIMEOUT | 0x17000000 )
|
251
|
287
|
|
252
|
288
|
/** Identifier removed */
|
253
|
|
-#define EIDRM ( PXENV_STATUS_FAILURE | 0x1800 )
|
|
289
|
+#define EIDRM ( ERRFILE | PXENV_STATUS_FAILURE | 0x18000000 )
|
254
|
290
|
|
255
|
291
|
/** Illegal byte sequence */
|
256
|
|
-#define EILSEQ ( PXENV_STATUS_FAILURE | 0x1900 )
|
|
292
|
+#define EILSEQ ( ERRFILE | PXENV_STATUS_FAILURE | 0x19000000 )
|
257
|
293
|
|
258
|
294
|
/** Operation in progress */
|
259
|
|
-#define EINPROGRESS ( PXENV_STATUS_FAILURE | 0x1a00 )
|
|
295
|
+#define EINPROGRESS ( ERRFILE | PXENV_STATUS_FAILURE | 0x1a000000 )
|
260
|
296
|
|
261
|
297
|
/** Interrupted function call */
|
262
|
|
-#define EINTR ( PXENV_STATUS_FAILURE | 0x1b00 )
|
|
298
|
+#define EINTR ( ERRFILE | PXENV_STATUS_FAILURE | 0x1b000000 )
|
263
|
299
|
|
264
|
300
|
/** Invalid argument */
|
265
|
|
-#define EINVAL ( PXENV_STATUS_BAD_FUNC | 0x1c00 )
|
|
301
|
+#define EINVAL ( ERRFILE | PXENV_STATUS_BAD_FUNC | 0x1c000000 )
|
266
|
302
|
|
267
|
303
|
/** Input/output error */
|
268
|
|
-#define EIO ( PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION | 0x1d00 )
|
|
304
|
+#define EIO \
|
|
305
|
+ ( ERRFILE | PXENV_STATUS_TFTP_CANNOT_READ_FROM_CONNECTION | 0x1d000000 )
|
269
|
306
|
|
270
|
307
|
/** Socket is connected */
|
271
|
|
-#define EISCONN ( PXENV_STATUS_UDP_OPEN | 0x1e00 )
|
|
308
|
+#define EISCONN ( ERRFILE | PXENV_STATUS_UDP_OPEN | 0x1e000000 )
|
272
|
309
|
|
273
|
310
|
/** Is a directory */
|
274
|
|
-#define EISDIR ( PXENV_STATUS_FAILURE | 0x1f00 )
|
|
311
|
+#define EISDIR ( ERRFILE | PXENV_STATUS_FAILURE | 0x1f000000 )
|
275
|
312
|
|
276
|
313
|
/** Too many levels of symbolic links */
|
277
|
|
-#define ELOOP ( PXENV_STATUS_FAILURE | 0x2000 )
|
|
314
|
+#define ELOOP ( ERRFILE | PXENV_STATUS_FAILURE | 0x20000000 )
|
278
|
315
|
|
279
|
316
|
/** Too many open files */
|
280
|
|
-#define EMFILE ( PXENV_STATUS_OUT_OF_RESOURCES | 0x2100 )
|
|
317
|
+#define EMFILE ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x21000000 )
|
281
|
318
|
|
282
|
319
|
/** Too many links */
|
283
|
|
-#define EMLINK ( PXENV_STATUS_FAILURE | 0x2200 )
|
|
320
|
+#define EMLINK ( ERRFILE | PXENV_STATUS_FAILURE | 0x22000000 )
|
284
|
321
|
|
285
|
322
|
/** Inappropriate message buffer length */
|
286
|
|
-#define EMSGSIZE ( PXENV_STATUS_BAD_FUNC | 0x2300 )
|
|
323
|
+#define EMSGSIZE ( ERRFILE | PXENV_STATUS_BAD_FUNC | 0x23000000 )
|
287
|
324
|
|
288
|
325
|
/** Reserved */
|
289
|
|
-#define EMULTIHOP ( PXENV_STATUS_FAILURE | 0x2400 )
|
|
326
|
+#define EMULTIHOP ( ERRFILE | PXENV_STATUS_FAILURE | 0x24000000 )
|
290
|
327
|
|
291
|
328
|
/** Filename too long */
|
292
|
|
-#define ENAMETOOLONG ( PXENV_STATUS_FAILURE | 0x2500 )
|
|
329
|
+#define ENAMETOOLONG ( ERRFILE | PXENV_STATUS_FAILURE | 0x25000000 )
|
293
|
330
|
|
294
|
331
|
/** Network is down */
|
295
|
|
-#define ENETDOWN ( PXENV_STATUS_ARP_TIMEOUT | 0x2600 )
|
|
332
|
+#define ENETDOWN ( ERRFILE | PXENV_STATUS_ARP_TIMEOUT | 0x26000000 )
|
296
|
333
|
|
297
|
334
|
/** Connection aborted by network */
|
298
|
|
-#define ENETRESET ( PXENV_STATUS_FAILURE | 0x2700 )
|
|
335
|
+#define ENETRESET ( ERRFILE | PXENV_STATUS_FAILURE | 0x27000000 )
|
299
|
336
|
|
300
|
337
|
/** Network unreachable */
|
301
|
|
-#define ENETUNREACH ( PXENV_STATUS_ARP_TIMEOUT | 0x2800 )
|
|
338
|
+#define ENETUNREACH ( ERRFILE | PXENV_STATUS_ARP_TIMEOUT | 0x28000000 )
|
302
|
339
|
|
303
|
340
|
/** Too many open files in system */
|
304
|
|
-#define ENFILE ( PXENV_STATUS_OUT_OF_RESOURCES | 0x2900 )
|
|
341
|
+#define ENFILE ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x29000000 )
|
305
|
342
|
|
306
|
343
|
/** No buffer space available */
|
307
|
|
-#define ENOBUFS ( PXENV_STATUS_OUT_OF_RESOURCES | 0x2a00 )
|
|
344
|
+#define ENOBUFS ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x2a000000 )
|
308
|
345
|
|
309
|
346
|
/** No message is available on the STREAM head read queue */
|
310
|
|
-#define ENODATA ( PXENV_STATUS_FAILURE | 0x2b00 )
|
|
347
|
+#define ENODATA ( ERRFILE | PXENV_STATUS_FAILURE | 0x2b000000 )
|
311
|
348
|
|
312
|
349
|
/** No such device */
|
313
|
|
-#define ENODEV ( PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x2c00 )
|
|
350
|
+#define ENODEV ( ERRFILE | PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x2c000000 )
|
314
|
351
|
|
315
|
352
|
/** No such file or directory */
|
316
|
|
-#define ENOENT ( PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x2d00 )
|
|
353
|
+#define ENOENT ( ERRFILE | PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x2d000000 )
|
317
|
354
|
|
318
|
355
|
/** Exec format error */
|
319
|
|
-#define ENOEXEC ( PXENV_STATUS_FAILURE | 0x2e00 )
|
|
356
|
+#define ENOEXEC ( ERRFILE | PXENV_STATUS_FAILURE | 0x2e000000 )
|
320
|
357
|
|
321
|
358
|
/** No locks available */
|
322
|
|
-#define ENOLCK ( PXENV_STATUS_FAILURE | 0x2f00 )
|
|
359
|
+#define ENOLCK ( ERRFILE | PXENV_STATUS_FAILURE | 0x2f000000 )
|
323
|
360
|
|
324
|
361
|
/** Reserved */
|
325
|
|
-#define ENOLINK ( PXENV_STATUS_FAILURE | 0x3000 )
|
|
362
|
+#define ENOLINK ( ERRFILE | PXENV_STATUS_FAILURE | 0x30000000 )
|
326
|
363
|
|
327
|
364
|
/** Not enough space */
|
328
|
|
-#define ENOMEM ( PXENV_STATUS_OUT_OF_RESOURCES | 0x3100 )
|
|
365
|
+#define ENOMEM ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x31000000 )
|
329
|
366
|
|
330
|
367
|
/** No message of the desired type */
|
331
|
|
-#define ENOMSG ( PXENV_STATUS_FAILURE | 0x3200 )
|
|
368
|
+#define ENOMSG ( ERRFILE | PXENV_STATUS_FAILURE | 0x32000000 )
|
332
|
369
|
|
333
|
370
|
/** Protocol not available */
|
334
|
|
-#define ENOPROTOOPT ( PXENV_STATUS_UNSUPPORTED | 0x3300 )
|
|
371
|
+#define ENOPROTOOPT ( ERRFILE | PXENV_STATUS_UNSUPPORTED | 0x33000000 )
|
335
|
372
|
|
336
|
373
|
/** No space left on device */
|
337
|
|
-#define ENOSPC ( PXENV_STATUS_OUT_OF_RESOURCES | 0x3400 )
|
|
374
|
+#define ENOSPC ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x34000000 )
|
338
|
375
|
|
339
|
376
|
/** No STREAM resources */
|
340
|
|
-#define ENOSR ( PXENV_STATUS_OUT_OF_RESOURCES | 0x3500 )
|
|
377
|
+#define ENOSR ( ERRFILE | PXENV_STATUS_OUT_OF_RESOURCES | 0x35000000 )
|
341
|
378
|
|
342
|
379
|
/** Not a STREAM */
|
343
|
|
-#define ENOSTR ( PXENV_STATUS_FAILURE | 0x3600 )
|
|
380
|
+#define ENOSTR ( ERRFILE | PXENV_STATUS_FAILURE | 0x36000000 )
|
344
|
381
|
|
345
|
382
|
/** Function not implemented */
|
346
|
|
-#define ENOSYS ( PXENV_STATUS_UNSUPPORTED | 0x3700 )
|
|
383
|
+#define ENOSYS ( ERRFILE | PXENV_STATUS_UNSUPPORTED | 0x37000000 )
|
347
|
384
|
|
348
|
385
|
/** The socket is not connected */
|
349
|
|
-#define ENOTCONN ( PXENV_STATUS_FAILURE | 0x3800 )
|
|
386
|
+#define ENOTCONN ( ERRFILE | PXENV_STATUS_FAILURE | 0x38000000 )
|
350
|
387
|
|
351
|
388
|
/** Not a directory */
|
352
|
|
-#define ENOTDIR ( PXENV_STATUS_FAILURE | 0x3900 )
|
|
389
|
+#define ENOTDIR ( ERRFILE | PXENV_STATUS_FAILURE | 0x39000000 )
|
353
|
390
|
|
354
|
391
|
/** Directory not empty */
|
355
|
|
-#define ENOTEMPTY ( PXENV_STATUS_FAILURE | 0x3a00 )
|
|
392
|
+#define ENOTEMPTY ( ERRFILE | PXENV_STATUS_FAILURE | 0x3a000000 )
|
356
|
393
|
|
357
|
394
|
/** Not a socket */
|
358
|
|
-#define ENOTSOCK ( PXENV_STATUS_FAILURE | 0x3b00 )
|
|
395
|
+#define ENOTSOCK ( ERRFILE | PXENV_STATUS_FAILURE | 0x3b000000 )
|
359
|
396
|
|
360
|
397
|
/** Not supported */
|
361
|
|
-#define ENOTSUP ( PXENV_STATUS_UNSUPPORTED | 0x3c00 )
|
|
398
|
+#define ENOTSUP ( ERRFILE | PXENV_STATUS_UNSUPPORTED | 0x3c000000 )
|
362
|
399
|
|
363
|
400
|
/** Inappropriate I/O control operation */
|
364
|
|
-#define ENOTTY ( PXENV_STATUS_FAILURE | 0x3d00 )
|
|
401
|
+#define ENOTTY ( ERRFILE | PXENV_STATUS_FAILURE | 0x3d000000 )
|
365
|
402
|
|
366
|
403
|
/** No such device or address */
|
367
|
|
-#define ENXIO ( PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x3e00 )
|
|
404
|
+#define ENXIO ( ERRFILE | PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x3e000000 )
|
368
|
405
|
|
369
|
406
|
/** Operation not supported on socket */
|
370
|
|
-#define EOPNOTSUPP ( PXENV_STATUS_UNSUPPORTED | 0x3f00 )
|
|
407
|
+#define EOPNOTSUPP ( ERRFILE | PXENV_STATUS_UNSUPPORTED | 0x3f000000 )
|
371
|
408
|
|
372
|
409
|
/** Value too large to be stored in data type */
|
373
|
|
-#define EOVERFLOW ( PXENV_STATUS_FAILURE | 0x4000 )
|
|
410
|
+#define EOVERFLOW ( ERRFILE | PXENV_STATUS_FAILURE | 0x40000000 )
|
374
|
411
|
|
375
|
412
|
/** Operation not permitted */
|
376
|
|
-#define EPERM ( PXENV_STATUS_TFTP_ACCESS_VIOLATION | 0x4100 )
|
|
413
|
+#define EPERM ( ERRFILE | PXENV_STATUS_TFTP_ACCESS_VIOLATION | 0x41000000 )
|
377
|
414
|
|
378
|
415
|
/** Broken pipe */
|
379
|
|
-#define EPIPE ( PXENV_STATUS_FAILURE | 0x4200 )
|
|
416
|
+#define EPIPE ( ERRFILE | PXENV_STATUS_FAILURE | 0x42000000 )
|
380
|
417
|
|
381
|
418
|
/** Protocol error */
|
382
|
|
-#define EPROTO ( PXENV_STATUS_FAILURE | 0x4300 )
|
|
419
|
+#define EPROTO ( ERRFILE | PXENV_STATUS_FAILURE | 0x43000000 )
|
383
|
420
|
|
384
|
421
|
/** Protocol not supported */
|
385
|
|
-#define EPROTONOSUPPORT ( PXENV_STATUS_UNSUPPORTED | 0x4400 )
|
|
422
|
+#define EPROTONOSUPPORT ( ERRFILE | PXENV_STATUS_UNSUPPORTED | 0x44000000 )
|
386
|
423
|
|
387
|
424
|
/** Protocol wrong type for socket */
|
388
|
|
-#define EPROTOTYPE ( PXENV_STATUS_FAILURE | 0x4500 )
|
|
425
|
+#define EPROTOTYPE ( ERRFILE | PXENV_STATUS_FAILURE | 0x45000000 )
|
389
|
426
|
|
390
|
427
|
/** Result too large */
|
391
|
|
-#define ERANGE ( PXENV_STATUS_FAILURE | 0x4600 )
|
|
428
|
+#define ERANGE ( ERRFILE | PXENV_STATUS_FAILURE | 0x46000000 )
|
392
|
429
|
|
393
|
430
|
/** Read-only file system */
|
394
|
|
-#define EROFS ( PXENV_STATUS_FAILURE | 0x4700 )
|
|
431
|
+#define EROFS ( ERRFILE | PXENV_STATUS_FAILURE | 0x47000000 )
|
395
|
432
|
|
396
|
433
|
/** Invalid seek */
|
397
|
|
-#define ESPIPE ( PXENV_STATUS_FAILURE | 0x4800 )
|
|
434
|
+#define ESPIPE ( ERRFILE | PXENV_STATUS_FAILURE | 0x48000000 )
|
398
|
435
|
|
399
|
436
|
/** No such process */
|
400
|
|
-#define ESRCH ( PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x4900 )
|
|
437
|
+#define ESRCH ( ERRFILE | PXENV_STATUS_TFTP_FILE_NOT_FOUND | 0x49000000 )
|
401
|
438
|
|
402
|
439
|
/** Stale file handle */
|
403
|
|
-#define ESTALE ( PXENV_STATUS_FAILURE | 0x4a00 )
|
|
440
|
+#define ESTALE ( ERRFILE | PXENV_STATUS_FAILURE | 0x4a000000 )
|
404
|
441
|
|
405
|
442
|
/** STREAM ioctl() timeout */
|
406
|
|
-#define ETIME ( PXENV_STATUS_FAILURE | 0x4b00 )
|
|
443
|
+#define ETIME ( ERRFILE | PXENV_STATUS_FAILURE | 0x4b000000 )
|
407
|
444
|
|
408
|
445
|
/** Operation timed out */
|
409
|
|
-#define ETIMEDOUT ( PXENV_STATUS_TFTP_READ_TIMEOUT | 0x4c00 )
|
|
446
|
+#define ETIMEDOUT ( ERRFILE | PXENV_STATUS_TFTP_READ_TIMEOUT | 0x4c000000 )
|
410
|
447
|
|
411
|
448
|
/** Text file busy */
|
412
|
|
-#define ETXTBSY ( PXENV_STATUS_FAILURE | 0x4d00 )
|
|
449
|
+#define ETXTBSY ( ERRFILE | PXENV_STATUS_FAILURE | 0x4d000000 )
|
413
|
450
|
|
414
|
451
|
/** Operation would block */
|
415
|
|
-#define EWOULDBLOCK ( PXENV_STATUS_FAILURE | 0x4e00 )
|
|
452
|
+#define EWOULDBLOCK ( ERRFILE | PXENV_STATUS_FAILURE | 0x4e000000 )
|
416
|
453
|
|
417
|
454
|
/** Improper link */
|
418
|
|
-#define EXDEV ( PXENV_STATUS_FAILURE | 0x4f00 )
|
|
455
|
+#define EXDEV ( ERRFILE | PXENV_STATUS_FAILURE | 0x4f000000 )
|
419
|
456
|
|
420
|
457
|
/** @} */
|
421
|
458
|
|
422
|
459
|
/**
|
423
|
|
- * @defgroup gpxeerrors gPXE-specific error codes
|
|
460
|
+ * @defgroup euniq Per-file error disambiguators
|
424
|
461
|
*
|
425
|
|
- * The names, meanings, and values of these error codes are defined by
|
426
|
|
- * this file. A gPXE-specific error code should be defined only where
|
427
|
|
- * the POSIX error code does not identify the error with sufficient
|
428
|
|
- * specificity. For example, ENOMEM probably encapsulates everything
|
429
|
|
- * that needs to be known about the error (we've run out of heap
|
430
|
|
- * space), while EACCES does not (did the server refuse the
|
431
|
|
- * connection, or did we decide that the server failed to provide a
|
432
|
|
- * valid SSL/TLS certificate?).
|
|
462
|
+ * Files which use the same error number multiple times should
|
|
463
|
+ * probably define their own error subspace using these
|
|
464
|
+ * disambiguators. For example:
|
|
465
|
+ *
|
|
466
|
+ * #define ETCP_HEADER_TOO_SHORT EUNIQ_01
|
|
467
|
+ * #define ETCP_BAD_CHECKSUM EUNIQ_02
|
433
|
468
|
*
|
434
|
469
|
* @{
|
435
|
470
|
*/
|
436
|
471
|
|
|
472
|
+#define EUNIQ_01 0x00000100
|
|
473
|
+#define EUNIQ_02 0x00000200
|
|
474
|
+#define EUNIQ_03 0x00000300
|
|
475
|
+#define EUNIQ_04 0x00000400
|
|
476
|
+#define EUNIQ_05 0x00000500
|
|
477
|
+#define EUNIQ_06 0x00000600
|
|
478
|
+#define EUNIQ_07 0x00000700
|
|
479
|
+#define EUNIQ_08 0x00000800
|
|
480
|
+#define EUNIQ_09 0x00000900
|
|
481
|
+#define EUNIQ_0A 0x00000a00
|
|
482
|
+#define EUNIQ_0B 0x00000b00
|
|
483
|
+#define EUNIQ_0C 0x00000c00
|
|
484
|
+#define EUNIQ_0D 0x00000d00
|
|
485
|
+#define EUNIQ_0E 0x00000e00
|
|
486
|
+#define EUNIQ_0F 0x00000f00
|
|
487
|
+#define EUNIQ_10 0x00001000
|
|
488
|
+#define EUNIQ_11 0x00001100
|
|
489
|
+#define EUNIQ_12 0x00001200
|
|
490
|
+#define EUNIQ_13 0x00001300
|
|
491
|
+#define EUNIQ_14 0x00001400
|
|
492
|
+#define EUNIQ_15 0x00001500
|
|
493
|
+#define EUNIQ_16 0x00001600
|
|
494
|
+#define EUNIQ_17 0x00001700
|
|
495
|
+#define EUNIQ_18 0x00001800
|
|
496
|
+#define EUNIQ_19 0x00001900
|
|
497
|
+#define EUNIQ_1A 0x00001a00
|
|
498
|
+#define EUNIQ_1B 0x00001b00
|
|
499
|
+#define EUNIQ_1C 0x00001c00
|
|
500
|
+#define EUNIQ_1D 0x00001d00
|
|
501
|
+#define EUNIQ_1E 0x00001e00
|
|
502
|
+#define EUNIQ_1F 0x00001f00
|
|
503
|
+
|
437
|
504
|
/** @} */
|
438
|
505
|
|
439
|
506
|
extern int errno;
|