projects
/
paraslash.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
32facbd
)
error.h: Add more helper macros.
author
Andre Noll
<maan@systemlinux.org>
Tue, 9 Oct 2007 18:05:16 +0000
(20:05 +0200)
committer
Andre Noll
<maan@systemlinux.org>
Tue, 9 Oct 2007 18:05:16 +0000
(20:05 +0200)
error.h
patch
|
blob
|
history
diff --git
a/error.h
b/error.h
index
5ed3830
..
2d03585
100644
(file)
--- a/
error.h
+++ b/
error.h
@@
-516,17
+516,23
@@
extern const char **para_errlist[];
*/
#define ERRNUM_TO_INDEX(num) (((1 << SS_SHIFT) - 1) & (num))
*/
#define ERRNUM_TO_INDEX(num) (((1 << SS_SHIFT) - 1) & (num))
+#define SYSTEM_ERROR_BIT 30
+
+#define IS_SYSTEM_ERROR(num) (!!((num) & (1 << SYSTEM_ERROR_BIT)))
+
+#define ERRNO_TO_PARA_ERROR(num) ((num) | (1 << SYSTEM_ERROR_BIT))
+
+#define IS_SYSTEM_ERRNO(val, _errno) (ERRNO_TO_PARA_ERROR(_errno) == (val))
+
/**
* paraslash's version of strerror(3)
*
* expands to the error text of \a num (a string constant).
*/
/**
* paraslash's version of strerror(3)
*
* expands to the error text of \a num (a string constant).
*/
-#define PARA_STRERROR(num)
(num) & (1 << 30
)? \
- strerror((num) & ((1 <<
30
) - 1)) : \
+#define PARA_STRERROR(num)
IS_SYSTEM_ERROR(num
)? \
+ strerror((num) & ((1 <<
SYSTEM_ERROR_BIT
) - 1)) : \
para_errlist[ERRNUM_TO_SS(num)] [ERRNUM_TO_INDEX(num)]
para_errlist[ERRNUM_TO_SS(num)] [ERRNUM_TO_INDEX(num)]
-#define ERRNO_TO_PARA_ERROR(num) (-((num) | (1 << 30)))
-
/**
* define the error list for one subsystem
#
/**
* define the error list for one subsystem
#