sbuf: make assertion message a lot more useable
Saying that we are called with an (un)finished or corrupted sbuf is like saying "error" (though [un]finished is an extra hint). Add the pointer to the sbuf so one could easily check it, add the flags we are checking so one could see quickly about a possible state mismatch. Given we already dereference the pointer in the KASSERT there is no extra harm adding it to the message. Found while: testing lindebugfs changes Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D55919
This commit is contained in:
@@ -124,8 +124,8 @@ _assert_sbuf_state(const char *fun, struct sbuf *s, int state)
|
||||
{
|
||||
|
||||
KASSERT((s->s_flags & SBUF_FINISHED) == state,
|
||||
("%s called with %sfinished or corrupt sbuf", fun,
|
||||
(state ? "un" : "")));
|
||||
("%s called with %sfinished or corrupt sbuf %p { s_flags %#010x }, "
|
||||
"state %#010x", fun, (state ? "un" : ""), s, s->s_flags, state));
|
||||
}
|
||||
|
||||
#define assert_sbuf_integrity(s) _assert_sbuf_integrity(__func__, (s))
|
||||
|
||||
Reference in New Issue
Block a user