freebsd11_network: Enable INVARIANTS at KDEBUG_LEVEL_2.

They were already enabled for the net80211 code (and thus all the Wi-Fi drivers)
unconditionally; now we enable them conditionally based on KDEBUG_LEVEL_2
for the freebsd11_network core code also.

Includes fixes to the build, since there were some issues with INVARIANTS otherwise.
This commit is contained in:
Augustin Cavalier 2018-06-27 18:47:32 -04:00
parent a549026d25
commit 8b4aff3eac
5 changed files with 15 additions and 10 deletions

View File

@ -28,7 +28,13 @@ int printf(const char *format, ...) __printflike(1, 2);
#define ovbcopy(f, t, l) bcopy((f), (t), (l))
#if KDEBUG_LEVEL_2
#define INVARIANTS
#endif
#if KDEBUG_LEVEL_1
#define bootverbose 1
#endif
#ifdef INVARIANTS
#define KASSERT(cond,msg) do { \

View File

@ -679,7 +679,7 @@ if_delmulti(struct ifnet *ifp, struct sockaddr *sa)
{
struct ifmultiaddr *ifma;
int lastref;
#ifdef INVARIANTS
#if 0 /* def INVARIANTS */
struct ifnet *oifp;
IFNET_RLOCK_NOSLEEP();

View File

@ -327,7 +327,7 @@ taskqueue_enqueue_timeout(struct taskqueue *queue,
cpu_status status;
tq_lock(queue, &status);
KASSERT(timeout_task->q == NULL || timeout_task->q == queue,
KASSERT(ttask->q == NULL || ttask->q == queue,
("Migrated queue"));
ttask->q = queue;
res = ttask->t.ta_pending;

View File

@ -13,6 +13,7 @@
#include <compat/sys/mutex.h>
#include <stdlib.h>
#include <util/RadixBitmap.h>
extern struct mtx gIdStoreLock;
@ -50,12 +51,12 @@ new_unrhdr(int low, int high, struct mtx* mutex)
void
delete_unrhdr(struct unrhdr* idStore)
{
KASSERT(uh != NULL,
KASSERT(idStore != NULL,
("ID-Store: %s: NULL pointer as argument.", __func__));
mtx_lock(idStore->storeMutex);
KASSERT(uh->idBuffer->root_size == 0,
KASSERT(idStore->idBuffer->root_size == 0,
("ID-Store: %s: some ids are still in use..", __func__));
_delete_unrhdr_buffer_locked(idStore);
@ -71,7 +72,7 @@ alloc_unr(struct unrhdr* idStore)
{
int id;
KASSERT(uh != NULL,
KASSERT(idStore != NULL,
("ID-Store: %s: NULL pointer as argument.", __func__));
mtx_lock(idStore->storeMutex);
@ -85,13 +86,13 @@ alloc_unr(struct unrhdr* idStore)
void
free_unr(struct unrhdr* idStore, u_int identity)
{
KASSERT(uh != NULL,
KASSERT(idStore != NULL,
("ID-Store: %s: NULL pointer as argument.", __func__));
mtx_lock(idStore->storeMutex);
KASSERT((int32)item - uh->idBias >= 0, ("ID-Store: %s(%p, %u): second "
+ "parameter is not in interval.", __func__, uh, item));
KASSERT((int32)identity - idStore->idBias >= 0, ("ID-Store: %s(%p, %u): second "
"parameter is not in interval.", __func__, idStore, identity));
_free_unr_locked(idStore, identity);

View File

@ -40,8 +40,6 @@
extern "C" {
# endif
#define INVARIANTS 1
#include <sys/kernel.h>
#include <sys/mutex.h>
#include <sys/sysctl.h>