aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/include/os/freebsd
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/openzfs/include/os/freebsd')
-rw-r--r--sys/contrib/openzfs/include/os/freebsd/Makefile.am4
-rw-r--r--sys/contrib/openzfs/include/os/freebsd/spl/rpc/xdr.h71
-rw-r--r--sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h40
3 files changed, 28 insertions, 87 deletions
diff --git a/sys/contrib/openzfs/include/os/freebsd/Makefile.am b/sys/contrib/openzfs/include/os/freebsd/Makefile.am
index 9819e534b7f6..d4103c2f062a 100644
--- a/sys/contrib/openzfs/include/os/freebsd/Makefile.am
+++ b/sys/contrib/openzfs/include/os/freebsd/Makefile.am
@@ -4,8 +4,6 @@ noinst_HEADERS = \
\
%D%/spl/acl/acl_common.h \
\
- %D%/spl/rpc/xdr.h \
- \
%D%/spl/sys/ia32/asm_linkage.h \
\
%D%/spl/sys/acl.h \
@@ -80,7 +78,9 @@ noinst_HEADERS = \
%D%/spl/sys/zmod.h \
%D%/spl/sys/zone.h \
\
+ %D%/zfs/sys/arc_os.h \
%D%/zfs/sys/freebsd_crypto.h \
+ %D%/zfs/sys/freebsd_event.h \
%D%/zfs/sys/vdev_os.h \
%D%/zfs/sys/zfs_bootenv_os.h \
%D%/zfs/sys/zfs_context_os.h \
diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/rpc/xdr.h b/sys/contrib/openzfs/include/os/freebsd/spl/rpc/xdr.h
deleted file mode 100644
index c98466e9d16a..000000000000
--- a/sys/contrib/openzfs/include/os/freebsd/spl/rpc/xdr.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-#ifndef _OPENSOLARIS_RPC_XDR_H_
-#define _OPENSOLARIS_RPC_XDR_H_
-
-#include <rpc/types.h>
-#include_next <rpc/xdr.h>
-
-#if !defined(_KERNEL) && !defined(_STANDALONE)
-
-#include <assert.h>
-
-/*
- * Taken from sys/xdr/xdr_mem.c.
- *
- * FreeBSD's userland XDR doesn't implement control method (only the kernel),
- * but OpenSolaris nvpair still depend on it, so we have to implement it here.
- */
-static __inline bool_t
-xdrmem_control(XDR *xdrs, int request, void *info)
-{
- xdr_bytesrec *xptr;
-
- switch (request) {
- case XDR_GET_BYTES_AVAIL:
- xptr = (xdr_bytesrec *)info;
- xptr->xc_is_last_record = TRUE;
- xptr->xc_num_avail = xdrs->x_handy;
- return (TRUE);
- default:
- assert(!"unexpected request");
- }
- return (FALSE);
-}
-
-#undef XDR_CONTROL
-#define XDR_CONTROL(xdrs, req, op) \
- (((xdrs)->x_ops->x_control == NULL) ? \
- xdrmem_control((xdrs), (req), (op)) : \
- (*(xdrs)->x_ops->x_control)(xdrs, req, op))
-
-#endif /* !_KERNEL && !_STANDALONE */
-
-#endif /* !_OPENSOLARIS_RPC_XDR_H_ */
diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h
index 3e67cf0e9a7d..785fcf62dd16 100644
--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/debug.h
@@ -39,12 +39,14 @@
* ASSERT3U() - Assert unsigned X OP Y is true, if not panic.
* ASSERT3P() - Assert pointer X OP Y is true, if not panic.
* ASSERT0() - Assert value is zero, if not panic.
+ * ASSERT0P() - Assert pointer is null, if not panic.
* VERIFY() - Verify X is true, if not panic.
* VERIFY3B() - Verify boolean X OP Y is true, if not panic.
* VERIFY3S() - Verify signed X OP Y is true, if not panic.
* VERIFY3U() - Verify unsigned X OP Y is true, if not panic.
* VERIFY3P() - Verify pointer X OP Y is true, if not panic.
* VERIFY0() - Verify value is zero, if not panic.
+ * VERIFY0P() - Verify pointer is null, if not panic.
*/
#ifndef _SPL_DEBUG_H
@@ -89,8 +91,8 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
"failed (%d " #OP " %d)\n", \
- (boolean_t)(_verify3_left), \
- (boolean_t)(_verify3_right)); \
+ (boolean_t)_verify3_left, \
+ (boolean_t)_verify3_right); \
} while (0)
#define VERIFY3S(LEFT, OP, RIGHT) do { \
@@ -100,8 +102,8 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
"failed (%lld " #OP " %lld)\n", \
- (long long) (_verify3_left), \
- (long long) (_verify3_right)); \
+ (long long)_verify3_left, \
+ (long long)_verify3_right); \
} while (0)
#define VERIFY3U(LEFT, OP, RIGHT) do { \
@@ -111,8 +113,8 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
"failed (%llu " #OP " %llu)\n", \
- (unsigned long long) (_verify3_left), \
- (unsigned long long) (_verify3_right)); \
+ (unsigned long long)_verify3_left, \
+ (unsigned long long)_verify3_right); \
} while (0)
#define VERIFY3P(LEFT, OP, RIGHT) do { \
@@ -121,19 +123,27 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
if (unlikely(!(_verify3_left OP _verify3_right))) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
"VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
- "failed (%px " #OP " %px)\n", \
- (void *) (_verify3_left), \
- (void *) (_verify3_right)); \
+ "failed (%p " #OP " %p)\n", \
+ (void *)_verify3_left, \
+ (void *)_verify3_right); \
} while (0)
#define VERIFY0(RIGHT) do { \
- const int64_t _verify3_left = (int64_t)(0); \
- const int64_t _verify3_right = (int64_t)(RIGHT); \
- if (unlikely(!(_verify3_left == _verify3_right))) \
+ const int64_t _verify0_right = (int64_t)(RIGHT); \
+ if (unlikely(!(0 == _verify0_right))) \
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
- "VERIFY0(0 == " #RIGHT ") " \
+ "VERIFY0(" #RIGHT ") " \
"failed (0 == %lld)\n", \
- (long long) (_verify3_right)); \
+ (long long)_verify0_right); \
+ } while (0)
+
+#define VERIFY0P(RIGHT) do { \
+ const uintptr_t _verify0_right = (uintptr_t)(RIGHT); \
+ if (unlikely(!(0 == _verify0_right))) \
+ spl_panic(__FILE__, __FUNCTION__, __LINE__, \
+ "VERIFY0P(" #RIGHT ") " \
+ "failed (NULL == %p)\n", \
+ (void *)_verify0_right); \
} while (0)
/*
@@ -151,6 +161,7 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
#define ASSERT3P(x, y, z) \
((void) sizeof ((uintptr_t)(x)), (void) sizeof ((uintptr_t)(z)))
#define ASSERT0(x) ((void) sizeof ((uintptr_t)(x)))
+#define ASSERT0P(x) ((void) sizeof ((uintptr_t)(x)))
#define IMPLY(A, B) \
((void) sizeof ((uintptr_t)(A)), (void) sizeof ((uintptr_t)(B)))
#define EQUIV(A, B) \
@@ -166,6 +177,7 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
#define ASSERT3U VERIFY3U
#define ASSERT3P VERIFY3P
#define ASSERT0 VERIFY0
+#define ASSERT0P VERIFY0P
#define ASSERT VERIFY
#define IMPLY(A, B) \
((void)(likely((!(A)) || (B)) || \