mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
FreeBSD: Clean up ASSERT/VERIFY use in module
Convert use of ASSERT() to ASSERT0(), ASSERT3U(), ASSERT3S(), ASSERT3P(), and likewise for VERIFY(). In some cases it ended up making more sense to change the code, such as VERIFY on nvlist operations that I have converted to use fnvlist instead. In one place I changed an internal struct member from int to boolean_t to match its use. Some asserts that combined multiple checks with && in a single assert have been split to separate asserts, to make it apparent which check fails. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11971
This commit is contained in:
@@ -69,7 +69,7 @@ __kstat_set_seq_raw_ops(kstat_t *ksp,
|
||||
static int
|
||||
kstat_default_update(kstat_t *ksp, int rw)
|
||||
{
|
||||
ASSERT(ksp != NULL);
|
||||
ASSERT3P(ksp, !=, NULL);
|
||||
|
||||
if (rw == KSTAT_WRITE)
|
||||
return (EACCES);
|
||||
@@ -223,7 +223,7 @@ restart:
|
||||
sbuf_printf(sb, "%s", ksp->ks_raw_buf);
|
||||
|
||||
} else {
|
||||
ASSERT(ksp->ks_ndata == 1);
|
||||
ASSERT3U(ksp->ks_ndata, ==, 1);
|
||||
sbuf_hexdump(sb, ksp->ks_data,
|
||||
ksp->ks_data_size, NULL, 0);
|
||||
}
|
||||
@@ -250,7 +250,7 @@ __kstat_create(const char *module, int instance, const char *name,
|
||||
|
||||
KASSERT(instance == 0, ("instance=%d", instance));
|
||||
if ((ks_type == KSTAT_TYPE_INTR) || (ks_type == KSTAT_TYPE_IO))
|
||||
ASSERT(ks_ndata == 1);
|
||||
ASSERT3U(ks_ndata, ==, 1);
|
||||
|
||||
if (class == NULL)
|
||||
class = "misc";
|
||||
@@ -461,7 +461,7 @@ kstat_install(kstat_t *ksp)
|
||||
struct sysctl_oid *root;
|
||||
|
||||
if (ksp->ks_ndata == UINT32_MAX)
|
||||
VERIFY(ksp->ks_type == KSTAT_TYPE_RAW);
|
||||
VERIFY3U(ksp->ks_type, ==, KSTAT_TYPE_RAW);
|
||||
|
||||
switch (ksp->ks_type) {
|
||||
case KSTAT_TYPE_NAMED:
|
||||
@@ -493,7 +493,7 @@ kstat_install(kstat_t *ksp)
|
||||
default:
|
||||
panic("unsupported kstat type %d\n", ksp->ks_type);
|
||||
}
|
||||
VERIFY(root != NULL);
|
||||
VERIFY3P(root, !=, NULL);
|
||||
ksp->ks_sysctl_root = root;
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ kstat_waitq_exit(kstat_io_t *kiop)
|
||||
delta = new - kiop->wlastupdate;
|
||||
kiop->wlastupdate = new;
|
||||
wcnt = kiop->wcnt--;
|
||||
ASSERT((int)wcnt > 0);
|
||||
ASSERT3S(wcnt, >, 0);
|
||||
kiop->wlentime += delta * wcnt;
|
||||
kiop->wtime += delta;
|
||||
}
|
||||
@@ -566,7 +566,7 @@ kstat_runq_exit(kstat_io_t *kiop)
|
||||
delta = new - kiop->rlastupdate;
|
||||
kiop->rlastupdate = new;
|
||||
rcnt = kiop->rcnt--;
|
||||
ASSERT((int)rcnt > 0);
|
||||
ASSERT3S(rcnt, >, 0);
|
||||
kiop->rlentime += delta * rcnt;
|
||||
kiop->rtime += delta;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user