Skip to content

Commit 008baa0

Browse files
authored
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
1 parent c57ff81 commit 008baa0

File tree

11 files changed

+15
-10
lines changed

11 files changed

+15
-10
lines changed

include/os/freebsd/spl/sys/atomic.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ atomic_dec_64_nv(volatile uint64_t *target)
167167
return (atomic_add_64_nv(target, -1));
168168
}
169169

170-
#if !defined(COMPAT_32BIT) && defined(__LP64__)
170+
#ifdef __LP64__
171171
static __inline void *
172172
atomic_cas_ptr(volatile void *target, void *cmp, void *newval)
173173
{
@@ -181,7 +181,7 @@ atomic_cas_ptr(volatile void *target, void *cmp, void *newval)
181181
return ((void *)atomic_cas_32((volatile uint32_t *)target,
182182
(uint32_t)cmp, (uint32_t)newval));
183183
}
184-
#endif /* !defined(COMPAT_32BIT) && defined(__LP64__) */
184+
#endif /* __LP64__ */
185185

186186
#else /* _STANDALONE */
187187
/*
@@ -190,6 +190,8 @@ atomic_cas_ptr(volatile void *target, void *cmp, void *newval)
190190
*/
191191
#undef atomic_add_64
192192
#define atomic_add_64(ptr, val) *(ptr) += val
193+
#undef atomic_sub_64
194+
#define atomic_sub_64(ptr, val) *(ptr) -= val
193195
#endif /* !_STANDALONE */
194196

195197
#endif /* !_OPENSOLARIS_SYS_ATOMIC_H_ */

include/os/freebsd/spl/sys/ccompat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
2+
* SPDX-License-Identifier: BSD-2-Clause
33
*
44
* Redistribution and use in source and binary forms, with or without
55
* modification, are permitted provided that the following conditions

include/os/freebsd/spl/sys/ctype.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@
3939
((C) >= 0x3A && (C) <= 0x40) || \
4040
((C) >= 0x5B && (C) <= 0x60) || \
4141
((C) >= 0x7B && (C) <= 0x7E))
42+
#define isspace(C) ((C) == 0x20 || ((C) >= 0x9 && (C) <= 0xD))
4243

4344
#endif

include/os/freebsd/spl/sys/spl_condvar.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
2+
* SPDX-License-Identifier: BSD-2-Clause
33
*
44
* Copyright (c) 2000 Jake Burkholder <[email protected]>.
55
* All rights reserved.

include/os/freebsd/zfs/sys/arc_os.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
2+
* SPDX-License-Identifier: BSD-2-Clause
33
*
44
* Copyright (c) 2022 Martin Matuska
55
*

include/os/freebsd/zfs/sys/freebsd_event.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
2+
* SPDX-License-Identifier: BSD-2-Clause
33
*
44
* Copyright (c) 2022 Rob Wing
55
*

include/os/freebsd/zfs/sys/zfs_context_os.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ extern int hz;
7878
extern int tick;
7979
typedef int fstrans_cookie_t;
8080
#define spl_fstrans_mark() (0)
81-
#define spl_fstrans_unmark(x) (x = 0)
81+
#define spl_fstrans_unmark(x) ((void)x)
8282
#define signal_pending(x) SIGPENDING(x)
8383
#define current curthread
8484
#define thread_join(x)

include/sys/zfs_context.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,10 @@ extern char *kmem_asprintf(const char *fmt, ...);
695695
#define kmem_strfree(str) kmem_free((str), strlen(str) + 1)
696696
#define kmem_strdup(s) strdup(s)
697697

698+
#ifndef __cplusplus
698699
extern int kmem_scnprintf(char *restrict str, size_t size,
699700
const char *restrict fmt, ...);
701+
#endif
700702

701703
/*
702704
* Hostname information

module/os/freebsd/zfs/event_os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
2+
* SPDX-License-Identifier: BSD-2-Clause
33
*
44
* Copyright (c) 2022 Rob Wing
55
*

module/os/freebsd/zfs/kmod_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ zfsdev_ioctl(struct cdev *dev, ulong_t zcmd, caddr_t arg, int flag,
141141
if (len != sizeof (zfs_iocparm_t))
142142
return (EINVAL);
143143

144-
uaddr = (void *)zp->zfs_cmd;
144+
uaddr = (void *)(uintptr_t)zp->zfs_cmd;
145145
zc = vmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
146146
#ifdef ZFS_LEGACY_SUPPORT
147147
/*

tests/zfs-tests/cmd/dosmode_readonly_write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
2+
* SPDX-License-Identifier: BSD-2-Clause
33
*
44
* Copyright (c) 2021 iXsystems, Inc.
55
*

0 commit comments

Comments
 (0)