From 2b4a0dd6c007e3c895e2e575ea0d949db669d5c6 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Sat, 18 Oct 2025 23:45:31 +1100 Subject: [PATCH] libspl: move callb stubs from zfs_context.h Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf Signed-off-by: Rob Norris Closes #17861 --- include/sys/zfs_context.h | 23 +---------------------- lib/libspl/include/sys/callb.h | 29 +++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index a209c19d2..c11c2c9e2 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -79,7 +79,6 @@ extern "C" { #define _SYS_VFS_H #define _SYS_SUNDDI_H -#define _SYS_CALLB_H #include #include @@ -131,6 +130,7 @@ extern "C" { #include #include #include +#include #include @@ -211,27 +211,6 @@ typedef off_t loff_t; extern int highbit64(uint64_t i); extern int lowbit64(uint64_t i); -typedef struct callb_cpr { - kmutex_t *cc_lockp; -} callb_cpr_t; - -#define CALLB_CPR_INIT(cp, lockp, func, name) { \ - (cp)->cc_lockp = lockp; \ -} - -#define CALLB_CPR_SAFE_BEGIN(cp) { \ - ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ -} - -#define CALLB_CPR_SAFE_END(cp, lockp) { \ - ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ -} - -#define CALLB_CPR_EXIT(cp) { \ - ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ - mutex_exit((cp)->cc_lockp); \ -} - #define zone_dataset_visible(x, y) (1) #define INGLOBALZONE(z) (1) extern uint32_t zone_get_hostid(void *zonep); diff --git a/lib/libspl/include/sys/callb.h b/lib/libspl/include/sys/callb.h index 46ed166e5..6e8e22338 100644 --- a/lib/libspl/include/sys/callb.h +++ b/lib/libspl/include/sys/callb.h @@ -21,11 +21,36 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2012, 2018 by Delphix. All rights reserved. + * Copyright (c) 2012, Joyent, Inc. All rights reserved. */ #ifndef _SYS_CALLB_H #define _SYS_CALLB_H +#include + +typedef struct callb_cpr { + kmutex_t *cc_lockp; +} callb_cpr_t; + +#define CALLB_CPR_INIT(cp, lockp, func, name) { \ + (cp)->cc_lockp = lockp; \ +} + +#define CALLB_CPR_SAFE_BEGIN(cp) { \ + ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ +} + +#define CALLB_CPR_SAFE_END(cp, lockp) { \ + ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ +} + +#define CALLB_CPR_EXIT(cp) { \ + ASSERT(MUTEX_HELD((cp)->cc_lockp)); \ + mutex_exit((cp)->cc_lockp); \ +} + #endif