aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/module/os/freebsd/spl
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/openzfs/module/os/freebsd/spl')
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/spl/acl_common.c6
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/spl/callb.c16
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/spl/list.c17
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/spl/spl_kmem.c6
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c14
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/spl/spl_string.c2
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c2
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/spl/spl_uio.c4
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/spl/spl_vfs.c6
9 files changed, 36 insertions, 37 deletions
diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/acl_common.c b/sys/contrib/openzfs/module/os/freebsd/spl/acl_common.c
index 66e27cefa396..7fd0e36e1ba7 100644
--- a/sys/contrib/openzfs/module/os/freebsd/spl/acl_common.c
+++ b/sys/contrib/openzfs/module/os/freebsd/spl/acl_common.c
@@ -43,7 +43,6 @@
#include <grp.h>
#include <pwd.h>
#include <acl_common.h>
-#define ASSERT assert
#endif
#define ACE_POSIX_SUPPORTED_BITS (ACE_READ_DATA | \
@@ -170,8 +169,9 @@ ksort(caddr_t v, int n, int s, int (*f)(void *, void *))
return;
/* Sanity check on arguments */
- ASSERT(((uintptr_t)v & 0x3) == 0 && (s & 0x3) == 0);
- ASSERT(s > 0);
+ ASSERT3U(((uintptr_t)v & 0x3), ==, 0);
+ ASSERT3S((s & 0x3), ==, 0);
+ ASSERT3S(s, >, 0);
for (g = n / 2; g > 0; g /= 2) {
for (i = g; i < n; i++) {
for (j = i - g; j >= 0 &&
diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/callb.c b/sys/contrib/openzfs/module/os/freebsd/spl/callb.c
index fffa85b6b91b..0b7fefc89a26 100644
--- a/sys/contrib/openzfs/module/os/freebsd/spl/callb.c
+++ b/sys/contrib/openzfs/module/os/freebsd/spl/callb.c
@@ -75,7 +75,7 @@ typedef struct callb {
typedef struct callb_table {
kmutex_t ct_lock; /* protect all callb states */
callb_t *ct_freelist; /* free callb structures */
- int ct_busy; /* != 0 prevents additions */
+ boolean_t ct_busy; /* B_TRUE prevents additions */
kcondvar_t ct_busy_cv; /* to wait for not busy */
int ct_ncallb; /* num of callbs allocated */
callb_t *ct_first_cb[NCBCLASS]; /* ptr to 1st callb in a class */
@@ -98,7 +98,7 @@ callb_cpr_t callb_cprinfo_safe = {
static void
callb_init(void *dummy __unused)
{
- callb_table.ct_busy = 0; /* mark table open for additions */
+ callb_table.ct_busy = B_FALSE; /* mark table open for additions */
mutex_init(&callb_safe_mutex, NULL, MUTEX_DEFAULT, NULL);
mutex_init(&callb_table.ct_lock, NULL, MUTEX_DEFAULT, NULL);
}
@@ -139,7 +139,7 @@ callb_add_common(boolean_t (*func)(void *arg, int code),
{
callb_t *cp;
- ASSERT(class < NCBCLASS);
+ ASSERT3S(class, <, NCBCLASS);
mutex_enter(&ct->ct_lock);
while (ct->ct_busy)
@@ -259,7 +259,7 @@ callb_execute_class(int class, int code)
callb_t *cp;
void *ret = NULL;
- ASSERT(class < NCBCLASS);
+ ASSERT3S(class, <, NCBCLASS);
mutex_enter(&ct->ct_lock);
@@ -351,8 +351,8 @@ void
callb_lock_table(void)
{
mutex_enter(&ct->ct_lock);
- ASSERT(ct->ct_busy == 0);
- ct->ct_busy = 1;
+ ASSERT(!ct->ct_busy);
+ ct->ct_busy = B_TRUE;
mutex_exit(&ct->ct_lock);
}
@@ -363,8 +363,8 @@ void
callb_unlock_table(void)
{
mutex_enter(&ct->ct_lock);
- ASSERT(ct->ct_busy != 0);
- ct->ct_busy = 0;
+ ASSERT(ct->ct_busy);
+ ct->ct_busy = B_FALSE;
cv_broadcast(&ct->ct_busy_cv);
mutex_exit(&ct->ct_lock);
}
diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/list.c b/sys/contrib/openzfs/module/os/freebsd/spl/list.c
index 0f5ae629126c..62374a417704 100644
--- a/sys/contrib/openzfs/module/os/freebsd/spl/list.c
+++ b/sys/contrib/openzfs/module/os/freebsd/spl/list.c
@@ -61,9 +61,8 @@
void
list_create(list_t *list, size_t size, size_t offset)
{
- ASSERT(list);
- ASSERT(size > 0);
- ASSERT(size >= offset + sizeof (list_node_t));
+ ASSERT3P(list, !=, NULL);
+ ASSERT3U(size, >=, offset + sizeof (list_node_t));
list->list_size = size;
list->list_offset = offset;
@@ -76,9 +75,9 @@ list_destroy(list_t *list)
{
list_node_t *node = &list->list_head;
- ASSERT(list);
- ASSERT(list->list_head.list_next == node);
- ASSERT(list->list_head.list_prev == node);
+ ASSERT3P(list, !=, NULL);
+ ASSERT3P(list->list_head.list_next, ==, node);
+ ASSERT3P(list->list_head.list_prev, ==, node);
node->list_next = node->list_prev = NULL;
}
@@ -124,7 +123,7 @@ list_remove(list_t *list, void *object)
{
list_node_t *lold = list_d2l(list, object);
ASSERT(!list_empty(list));
- ASSERT(lold->list_next != NULL);
+ ASSERT3P(lold->list_next, !=, NULL);
list_remove_node(lold);
}
@@ -195,8 +194,8 @@ list_move_tail(list_t *dst, list_t *src)
list_node_t *dstnode = &dst->list_head;
list_node_t *srcnode = &src->list_head;
- ASSERT(dst->list_size == src->list_size);
- ASSERT(dst->list_offset == src->list_offset);
+ ASSERT3U(dst->list_size, ==, src->list_size);
+ ASSERT3U(dst->list_offset, ==, src->list_offset);
if (list_empty(src))
return;
diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_kmem.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_kmem.c
index cfc61dd7fc2a..ee8f1d851a48 100644
--- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_kmem.c
+++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_kmem.c
@@ -112,7 +112,7 @@ zfs_kmem_free(void *buf, size_t size __unused)
if (i == buf)
break;
}
- ASSERT(i != NULL);
+ ASSERT3P(i, !=, NULL);
LIST_REMOVE(i, next);
mtx_unlock(&kmem_items_mtx);
memset(buf, 0xDC, MAX(size, 16));
@@ -162,7 +162,7 @@ kmem_cache_create(char *name, size_t bufsize, size_t align,
{
kmem_cache_t *cache;
- ASSERT(vmp == NULL);
+ ASSERT3P(vmp, ==, NULL);
cache = kmem_alloc(sizeof (*cache), KM_SLEEP);
strlcpy(cache->kc_name, name, sizeof (cache->kc_name));
@@ -324,7 +324,7 @@ void
spl_kmem_cache_set_move(kmem_cache_t *skc,
kmem_cbrc_t (move)(void *, void *, size_t, void *))
{
- ASSERT(move != NULL);
+ ASSERT3P(move, !=, NULL);
}
#ifdef KMEM_DEBUG
diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c
index 43ce358298b5..e591921ace1b 100644
--- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c
+++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_kstat.c
@@ -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;
}
diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_string.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_string.c
index d13b64b4cd26..00b1df766ab9 100644
--- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_string.c
+++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_string.c
@@ -102,6 +102,6 @@ kmem_asprintf(const char *fmt, ...)
void
kmem_strfree(char *str)
{
- ASSERT(str != NULL);
+ ASSERT3P(str, !=, NULL);
kmem_free(str, strlen(str) + 1);
}
diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c
index 8c0e495681e9..d5d50080fafd 100644
--- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c
+++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_sysevent.c
@@ -245,7 +245,7 @@ sysevent_worker(void *arg __unused)
if (error == ESHUTDOWN)
break;
} else {
- VERIFY(event != NULL);
+ VERIFY3P(event, !=, NULL);
log_sysevent(event);
nvlist_free(event);
}
diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_uio.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_uio.c
index 59a781ee1b64..0bf251a1edac 100644
--- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_uio.c
+++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_uio.c
@@ -48,7 +48,7 @@
int
zfs_uiomove(void *cp, size_t n, zfs_uio_rw_t dir, zfs_uio_t *uio)
{
- ASSERT(zfs_uio_rw(uio) == dir);
+ ASSERT3U(zfs_uio_rw(uio), ==, dir);
return (uiomove(cp, (int)n, GET_UIO_STRUCT(uio)));
}
@@ -102,6 +102,6 @@ zfs_uioskip(zfs_uio_t *uio, size_t n)
int
zfs_uio_fault_move(void *p, size_t n, zfs_uio_rw_t dir, zfs_uio_t *uio)
{
- ASSERT(zfs_uio_rw(uio) == dir);
+ ASSERT3U(zfs_uio_rw(uio), ==, dir);
return (vn_io_fault_uiomove(p, n, GET_UIO_STRUCT(uio)));
}
diff --git a/sys/contrib/openzfs/module/os/freebsd/spl/spl_vfs.c b/sys/contrib/openzfs/module/os/freebsd/spl/spl_vfs.c
index 09c8401267df..60ea627e975b 100644
--- a/sys/contrib/openzfs/module/os/freebsd/spl/spl_vfs.c
+++ b/sys/contrib/openzfs/module/os/freebsd/spl/spl_vfs.c
@@ -275,13 +275,13 @@ mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath,
void
vn_rele_async(vnode_t *vp, taskq_t *taskq)
{
- VERIFY(vp->v_count > 0);
+ VERIFY3U(vp->v_usecount, >, 0);
if (refcount_release_if_not_last(&vp->v_usecount)) {
#if __FreeBSD_version < 1300045
vdrop(vp);
#endif
return;
}
- VERIFY(taskq_dispatch((taskq_t *)taskq,
- (task_func_t *)vrele, vp, TQ_SLEEP) != 0);
+ VERIFY3U(taskq_dispatch((taskq_t *)taskq,
+ (task_func_t *)vrele, vp, TQ_SLEEP), !=, 0);
}