aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAlexander Motin <[email protected]>2023-10-09 16:27:18 -0400
committerBrian Behlendorf <[email protected]>2023-10-10 19:19:09 -0700
commitf6e6e77ed8a9be8cd8ef3dbc386a18908ea4f01b (patch)
tree9b36bfaf55f887b89b4c6e4a9339e99b033886f7 /include
parent120d1787d74d51fc65819be25dbc50f3303587e8 (diff)
FreeBSD: Reduce divergence from in-tree sources
This includes random small tweaks, primarily a build fixes, required when ZFS is built as part of FreeBSD base. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes #15368
Diffstat (limited to 'include')
-rw-r--r--include/os/freebsd/spl/sys/atomic.h6
-rw-r--r--include/os/freebsd/spl/sys/ccompat.h2
-rw-r--r--include/os/freebsd/spl/sys/ctype.h1
-rw-r--r--include/os/freebsd/spl/sys/spl_condvar.h2
-rw-r--r--include/os/freebsd/zfs/sys/arc_os.h2
-rw-r--r--include/os/freebsd/zfs/sys/freebsd_event.h2
-rw-r--r--include/os/freebsd/zfs/sys/zfs_context_os.h2
-rw-r--r--include/sys/zfs_context.h2
8 files changed, 12 insertions, 7 deletions
diff --git a/include/os/freebsd/spl/sys/atomic.h b/include/os/freebsd/spl/sys/atomic.h
index 8b9cec15c..40a67704f 100644
--- a/include/os/freebsd/spl/sys/atomic.h
+++ b/include/os/freebsd/spl/sys/atomic.h
@@ -167,7 +167,7 @@ atomic_dec_64_nv(volatile uint64_t *target)
return (atomic_add_64_nv(target, -1));
}
-#if !defined(COMPAT_32BIT) && defined(__LP64__)
+#ifdef __LP64__
static __inline void *
atomic_cas_ptr(volatile void *target, void *cmp, void *newval)
{
@@ -181,7 +181,7 @@ atomic_cas_ptr(volatile void *target, void *cmp, void *newval)
return ((void *)atomic_cas_32((volatile uint32_t *)target,
(uint32_t)cmp, (uint32_t)newval));
}
-#endif /* !defined(COMPAT_32BIT) && defined(__LP64__) */
+#endif /* __LP64__ */
#else /* _STANDALONE */
/*
@@ -190,6 +190,8 @@ atomic_cas_ptr(volatile void *target, void *cmp, void *newval)
*/
#undef atomic_add_64
#define atomic_add_64(ptr, val) *(ptr) += val
+#undef atomic_sub_64
+#define atomic_sub_64(ptr, val) *(ptr) -= val
#endif /* !_STANDALONE */
#endif /* !_OPENSOLARIS_SYS_ATOMIC_H_ */
diff --git a/include/os/freebsd/spl/sys/ccompat.h b/include/os/freebsd/spl/sys/ccompat.h
index eaee9159e..e34bab7e8 100644
--- a/include/os/freebsd/spl/sys/ccompat.h
+++ b/include/os/freebsd/spl/sys/ccompat.h
@@ -1,5 +1,5 @@
/*
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/include/os/freebsd/spl/sys/ctype.h b/include/os/freebsd/spl/sys/ctype.h
index 53afd8b8b..b9ca0f8ef 100644
--- a/include/os/freebsd/spl/sys/ctype.h
+++ b/include/os/freebsd/spl/sys/ctype.h
@@ -39,5 +39,6 @@
((C) >= 0x3A && (C) <= 0x40) || \
((C) >= 0x5B && (C) <= 0x60) || \
((C) >= 0x7B && (C) <= 0x7E))
+#define isspace(C) ((C) == 0x20 || ((C) >= 0x9 && (C) <= 0xD))
#endif
diff --git a/include/os/freebsd/spl/sys/spl_condvar.h b/include/os/freebsd/spl/sys/spl_condvar.h
index 7405f647d..2835adafd 100644
--- a/include/os/freebsd/spl/sys/spl_condvar.h
+++ b/include/os/freebsd/spl/sys/spl_condvar.h
@@ -1,5 +1,5 @@
/*
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2000 Jake Burkholder <[email protected]>.
* All rights reserved.
diff --git a/include/os/freebsd/zfs/sys/arc_os.h b/include/os/freebsd/zfs/sys/arc_os.h
index a95618b91..ad2aba23b 100644
--- a/include/os/freebsd/zfs/sys/arc_os.h
+++ b/include/os/freebsd/zfs/sys/arc_os.h
@@ -1,5 +1,5 @@
/*
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2022 Martin Matuska
*
diff --git a/include/os/freebsd/zfs/sys/freebsd_event.h b/include/os/freebsd/zfs/sys/freebsd_event.h
index 544ff8b0f..a32596d91 100644
--- a/include/os/freebsd/zfs/sys/freebsd_event.h
+++ b/include/os/freebsd/zfs/sys/freebsd_event.h
@@ -1,5 +1,5 @@
/*
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2022 Rob Wing
*
diff --git a/include/os/freebsd/zfs/sys/zfs_context_os.h b/include/os/freebsd/zfs/sys/zfs_context_os.h
index 1ce723304..457fa3af8 100644
--- a/include/os/freebsd/zfs/sys/zfs_context_os.h
+++ b/include/os/freebsd/zfs/sys/zfs_context_os.h
@@ -78,7 +78,7 @@ extern int hz;
extern int tick;
typedef int fstrans_cookie_t;
#define spl_fstrans_mark() (0)
-#define spl_fstrans_unmark(x) (x = 0)
+#define spl_fstrans_unmark(x) ((void)x)
#define signal_pending(x) SIGPENDING(x)
#define current curthread
#define thread_join(x)
diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
index 0d3119544..6a337b49e 100644
--- a/include/sys/zfs_context.h
+++ b/include/sys/zfs_context.h
@@ -695,8 +695,10 @@ extern char *kmem_asprintf(const char *fmt, ...);
#define kmem_strfree(str) kmem_free((str), strlen(str) + 1)
#define kmem_strdup(s) strdup(s)
+#ifndef __cplusplus
extern int kmem_scnprintf(char *restrict str, size_t size,
const char *restrict fmt, ...);
+#endif
/*
* Hostname information