diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 08:13:27 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 08:13:27 +0930 |
commit | 2237daed7e4c6c38241bc07383ed1a421abe8d6c (patch) | |
tree | 11495936fbf2306d4e443bdf529ed71ff8e9f23a /lib/tdb2/private.h | |
parent | 45467c0118da0c1d4e5644f4570f10aafe37a8a7 (diff) | |
download | samba-2237daed7e4c6c38241bc07383ed1a421abe8d6c.tar.gz samba-2237daed7e4c6c38241bc07383ed1a421abe8d6c.tar.bz2 samba-2237daed7e4c6c38241bc07383ed1a421abe8d6c.zip |
tdb2: add error conversion functions.
This clarifies the code a little, but also provides a more explicit
mechanism which can be used to debug error handling (by introducing
tdb_err_t and making it a pointer type).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit afa6d57b7d93fe4675a952f556eb462951baa257)
Diffstat (limited to 'lib/tdb2/private.h')
-rw-r--r-- | lib/tdb2/private.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/tdb2/private.h b/lib/tdb2/private.h index 715bd1def7..161f156a4f 100644 --- a/lib/tdb2/private.h +++ b/lib/tdb2/private.h @@ -77,7 +77,9 @@ typedef uint64_t tdb_off_t; #define TDB_RECOVERY_MAGIC (0xf53bc0e7ad124589ULL) #define TDB_RECOVERY_INVALID_MAGIC (0x0ULL) -#define TDB_OFF_IS_ERR(off) unlikely(off >= (tdb_off_t)TDB_ERR_LAST) +#define TDB_OFF_IS_ERR(off) unlikely(off >= (tdb_off_t)(long)TDB_ERR_LAST) +#define TDB_OFF_TO_ERR(off) ((enum TDB_ERROR)(long)(off)) +#define TDB_ERR_TO_OFF(ecode) ((tdb_off_t)(long)(ecode)) /* Packing errors into pointers and v.v. */ #define TDB_PTR_IS_ERR(ptr) \ |