- Thinko fix to the SPL module interface
- Enhanse the VERIFY() support to output the values which failed to compare as expected before crashing. This make debugging much much much easier. git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@55 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
parent
8ac547ec4c
commit
d429b03d85
@ -161,7 +161,7 @@ static __inline__ void ddi_prop_remove_all(dev_info_t *dip) { }
|
||||
static __inline__ major_t
|
||||
ddi_driver_major(dev_info_t *di)
|
||||
{
|
||||
return getminor(di->di_dev);
|
||||
return getmajor(di->di_dev);
|
||||
}
|
||||
|
||||
static __inline__ int
|
||||
|
@ -76,16 +76,19 @@ extern "C" {
|
||||
#define ASSERT(x) BUG_ON(!(x))
|
||||
#define VERIFY(x) ASSERT(x)
|
||||
|
||||
#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \
|
||||
#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) do { \
|
||||
const TYPE __left = (TYPE)(LEFT); \
|
||||
const TYPE __right = (TYPE)(RIGHT); \
|
||||
if (!(__left OP __right)) \
|
||||
if (!(__left OP __right)) { \
|
||||
printk("Failed VERIFY3(" FMT " " #OP " " FMT ")\n", \
|
||||
CAST __left, CAST __right); \
|
||||
BUG(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t)
|
||||
#define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t)
|
||||
#define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t)
|
||||
#define VERIFY3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t, "%ld", (long))
|
||||
#define VERIFY3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t, "%lu", (unsigned long))
|
||||
#define VERIFY3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t, "%p", (void *))
|
||||
|
||||
#define ASSERT3S(x, y, z) VERIFY3S(x, y, z)
|
||||
#define ASSERT3U(x, y, z) VERIFY3U(x, y, z)
|
||||
|
Loading…
Reference in New Issue
Block a user