Support offsets with io_raw too.
[lwext4.git] / prefix_patch / ext4_errno.patch
1 diff --git a/include/ext4_errno.h b/include/ext4_errno.h
2 index edf89a9..a4408c7 100644
3 --- a/include/ext4_errno.h
4 +++ b/include/ext4_errno.h
5 @@ -43,46 +43,74 @@ extern "C" {
6  #include "ext4_config.h"
7  
8  #if !CONFIG_HAVE_OWN_ERRNO
9 -#include <errno.h>
10 -#else
11 -#define EPERM 1      /* Operation not permitted */
12 -#define ENOENT 2     /* No such file or directory */
13 -#define EIO 5        /* I/O error */
14 -#define ENXIO 6      /* No such device or address */
15 -#define E2BIG 7      /* Argument list too long */
16 -#define ENOMEM 12    /* Out of memory */
17 -#define EACCES 13    /* Permission denied */
18 -#define EFAULT 14    /* Bad address */
19 -#define EEXIST 17    /* File exists */
20 -#define ENODEV 19    /* No such device */
21 -#define ENOTDIR 20   /* Not a directory */
22 -#define EISDIR 21    /* Is a directory */
23 -#define EINVAL 22    /* Invalid argument */
24 -#define EFBIG 27     /* File too large */
25 -#define ENOSPC 28    /* No space left on device */
26 -#define EROFS 30     /* Read-only file system */
27 -#define EMLINK 31    /* Too many links */
28 -#define ERANGE 34    /* Math result not representable */
29 -#define ENOTEMPTY 39 /* Directory not empty */
30 -#define ENODATA 61   /* No data available */
31 -#define ENOTSUP 95   /* Not supported */
32 -#endif
33  
34 -#ifndef ENODATA
35 - #ifdef ENOATTR
36 - #define ENODATA ENOATTR
37 - #else
38 - #define ENODATA 61
39 + #include <errno.h>
40 +
41 + #define LWEXT4_ERRNO(errno) (errno)
42 +
43 + #ifndef ENODATA
44 +  #ifdef ENOATTR
45 +   #define ENOATTR ENOATTR
46 +  #else
47 +   #define ENODATA 61
48 +  #endif
49   #endif
50 -#endif
51  
52 -#ifndef ENOTSUP
53 -#define ENOTSUP 95
54 -#endif
55 + #ifndef ENOTSUP
56 +  #define ENOTSUP 95
57 + #endif
58 +
59 + #ifndef EOK
60 +  #define EOK 0
61 + #endif
62 +
63 +#else /* CONFIG_HAVE_OWN_ERRNO */
64 +
65 + #define LWEXT4_ERRNO(errno) LWEXT4_##errno
66 +
67 + enum ext4_errno {
68 +       LWEXT4_ERRNO(EOK) = 0,
69 +       LWEXT4_ERRNO(EPERM) = 1,      /* Operation not permitted */
70 +       LWEXT4_ERRNO(ENOENT) = 2,     /* No such file or directory */
71 +       LWEXT4_ERRNO(ESRCH) = 3,      /* No such process */
72 +       LWEXT4_ERRNO(EINTR) = 4,      /* Interrupted system call */
73 +       LWEXT4_ERRNO(EIO) = 5,        /* I/O error */
74 +       LWEXT4_ERRNO(ENXIO) = 6,      /* No such device or address */
75 +       LWEXT4_ERRNO(E2BIG) = 7,      /* Argument list too long */
76 +       LWEXT4_ERRNO(ENOEXEC) = 8,    /* Exec format error */
77 +       LWEXT4_ERRNO(EBADF) = 9,      /* Bad file number */
78 +       LWEXT4_ERRNO(ECHILD) = 10,    /* No child processes */
79 +       LWEXT4_ERRNO(EAGAIN) = 11,    /* Try again */
80 +       LWEXT4_ERRNO(ENOMEM) = 12,    /* Out of memory */
81 +       LWEXT4_ERRNO(EACCES) = 13,    /* Permission denied */
82 +       LWEXT4_ERRNO(EFAULT) = 14,    /* Bad address */
83 +       LWEXT4_ERRNO(ENOTBLK) = 15,   /* Block device required */
84 +       LWEXT4_ERRNO(EBUSY) = 16,     /* Device or resource busy */
85 +       LWEXT4_ERRNO(EEXIST) = 17,    /* File exists */
86 +       LWEXT4_ERRNO(EXDEV) = 18,     /* Cross-device link */
87 +       LWEXT4_ERRNO(ENODEV) = 19,    /* No such device */
88 +       LWEXT4_ERRNO(ENOTDIR) = 20,   /* Not a directory */
89 +       LWEXT4_ERRNO(EISDIR) = 21,    /* Is a directory */
90 +       LWEXT4_ERRNO(EINVAL) = 22,    /* Invalid argument */
91 +       LWEXT4_ERRNO(ENFILE) = 23,    /* File table overflow */
92 +       LWEXT4_ERRNO(EMFILE) = 24,    /* Too many open files */
93 +       LWEXT4_ERRNO(ENOTTY) = 25,    /* Not a typewriter */
94 +       LWEXT4_ERRNO(ETXTBSY) = 26,   /* Text file busy */
95 +       LWEXT4_ERRNO(EFBIG) = 27,     /* File too large */
96 +       LWEXT4_ERRNO(ENOSPC) = 28,    /* No space left on device */
97 +       LWEXT4_ERRNO(ESPIPE) = 29,    /* Illegal seek */
98 +       LWEXT4_ERRNO(EROFS) = 30,     /* Read-only file system */
99 +       LWEXT4_ERRNO(EMLINK) = 31,    /* Too many links */
100 +       LWEXT4_ERRNO(EPIPE) = 32,     /* Broken pipe */
101 +       LWEXT4_ERRNO(EDOM) = 33,      /* Math argument out of domain of func */
102 +       LWEXT4_ERRNO(ERANGE) = 34,    /* Math result not representable */
103 +       LWEXT4_ERRNO(ENOTEMPTY) = 39, /* Directory not empty */
104 +       LWEXT4_ERRNO(ENODATA) = 61,   /* No data available */
105 +       LWEXT4_ERRNO(ENOTSUP) = 95    /* Not supported */
106 + };
107 +
108 +#endif /* CONFIG_HAVE_OWN_ERRNO */
109  
110 -#ifndef EOK
111 -#define EOK 0
112 -#endif
113  
114  #ifdef __cplusplus
115  }