aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorAlan Somers <[email protected]>2023-11-27 13:58:03 -0700
committerTony Hutter <[email protected]>2023-11-28 15:19:07 -0800
commit349fb77f1167c287e9d2bf8bab5f1934d8b2672c (patch)
tree2e9629ee0a8e80f66e81b030354e97c25c007f6e /module
parent2a953e0ac928563166ad7caa89e48b8d257724d4 (diff)
FreeBSD: Fix the build on FreeBSD 12
It was broken for several reasons: * VOP_UNLOCK lost an argument in 13.0. So OpenZFS should be using VOP_UNLOCK1, but a few direct calls to VOP_UNLOCK snuck in. * The location of the zlib header moved in 13.0 and 12.1. We can drop support for building on 12.0, which is EoL. * knlist_init lost an argument in 13.0. OpenZFS change 9d0887402ba assumed 13.0 or later. * FreeBSD 13.0 added copy_file_range, and OpenZFS change 67a1b037915 assumed 13.0 or later. Sponsored-by: Axcient Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Alan Somers <[email protected]> Closes #15551
Diffstat (limited to 'module')
-rw-r--r--module/os/freebsd/spl/spl_zlib.c8
-rw-r--r--module/os/freebsd/zfs/event_os.c18
-rw-r--r--module/os/freebsd/zfs/zfs_vnops_os.c4
3 files changed, 22 insertions, 8 deletions
diff --git a/module/os/freebsd/spl/spl_zlib.c b/module/os/freebsd/spl/spl_zlib.c
index 8bd3bdedf..42c6d7f9d 100644
--- a/module/os/freebsd/spl/spl_zlib.c
+++ b/module/os/freebsd/spl/spl_zlib.c
@@ -32,11 +32,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kmem.h>
#include <sys/kmem_cache.h>
#include <sys/zmod.h>
-#if __FreeBSD_version >= 1300041
#include <contrib/zlib/zlib.h>
-#else
-#include <sys/zlib.h>
-#endif
#include <sys/kobj.h>
@@ -90,11 +86,7 @@ zlib_inflateInit(z_stream *stream)
static int
zlib_inflate(z_stream *stream, int finish)
{
-#if __FreeBSD_version >= 1300024
return (inflate(stream, finish));
-#else
- return (_zlib104_inflate(stream, finish));
-#endif
}
diff --git a/module/os/freebsd/zfs/event_os.c b/module/os/freebsd/zfs/event_os.c
index 239d44d0c..e774fbaaf 100644
--- a/module/os/freebsd/zfs/event_os.c
+++ b/module/os/freebsd/zfs/event_os.c
@@ -46,6 +46,7 @@ knlist_sx_xunlock(void *arg)
sx_xunlock((struct sx *)arg);
}
+#if __FreeBSD_version >= 1300128
static void
knlist_sx_assert_lock(void *arg, int what)
{
@@ -55,11 +56,28 @@ knlist_sx_assert_lock(void *arg, int what)
else
sx_assert((struct sx *)arg, SX_UNLOCKED);
}
+#else
+static void
+knlist_sx_assert_locked(void *arg)
+{
+ sx_assert((struct sx *)arg, SX_LOCKED);
+}
+static void
+knlist_sx_assert_unlocked(void *arg)
+{
+ sx_assert((struct sx *)arg, SX_UNLOCKED);
+}
+#endif
void
knlist_init_sx(struct knlist *knl, struct sx *lock)
{
+#if __FreeBSD_version >= 1300128
knlist_init(knl, lock, knlist_sx_xlock, knlist_sx_xunlock,
knlist_sx_assert_lock);
+#else
+ knlist_init(knl, lock, knlist_sx_xlock, knlist_sx_xunlock,
+ knlist_sx_assert_locked, knlist_sx_assert_unlocked);
+#endif
}
diff --git a/module/os/freebsd/zfs/zfs_vnops_os.c b/module/os/freebsd/zfs/zfs_vnops_os.c
index f672deed3..05f28033b 100644
--- a/module/os/freebsd/zfs/zfs_vnops_os.c
+++ b/module/os/freebsd/zfs/zfs_vnops_os.c
@@ -6213,6 +6213,7 @@ zfs_deallocate(struct vop_deallocate_args *ap)
}
#endif
+#if __FreeBSD_version >= 1300039
#ifndef _SYS_SYSPROTO_H_
struct vop_copy_file_range_args {
struct vnode *a_invp;
@@ -6319,6 +6320,7 @@ bad_write_fallback:
ap->a_incred, ap->a_outcred, ap->a_fsizetd);
return (error);
}
+#endif
struct vop_vector zfs_vnodeops;
struct vop_vector zfs_fifoops;
@@ -6383,7 +6385,9 @@ struct vop_vector zfs_vnodeops = {
#if __FreeBSD_version >= 1400043
.vop_add_writecount = vop_stdadd_writecount_nomsync,
#endif
+#if __FreeBSD_version >= 1300039
.vop_copy_file_range = zfs_freebsd_copy_file_range,
+#endif
};
VFS_VOP_VECTOR_REGISTER(zfs_vnodeops);