Skip to content

Commit

Permalink
FreeBSD: Reduce divergence from in-tree sources
Browse files Browse the repository at this point in the history
This includes random small tweaks, primarily a build fixes, required
when ZFS is built as part of FreeBSD base.

Signed-off-by:	Alexander Motin <[email protected]>
Sponsored by:	iXsystems, Inc.
  • Loading branch information
amotin committed Oct 6, 2023
1 parent 66b81b3 commit b40c6eb
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 10 deletions.
6 changes: 4 additions & 2 deletions include/os/freebsd/spl/sys/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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 */
/*
Expand All @@ -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_ */
2 changes: 1 addition & 1 deletion include/os/freebsd/spl/sys/ccompat.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions include/os/freebsd/spl/sys/ctype.h
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Check failure on line 42 in include/os/freebsd/spl/sys/ctype.h

View workflow job for this annotation

GitHub Actions / checkstyle

#define followed by space instead of tab

#endif
2 changes: 1 addition & 1 deletion include/os/freebsd/spl/sys/spl_condvar.h
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion include/os/freebsd/zfs/sys/arc_os.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2022 Martin Matuska
*
Expand Down
2 changes: 1 addition & 1 deletion include/os/freebsd/zfs/sys/freebsd_event.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2022 Rob Wing
*
Expand Down
2 changes: 1 addition & 1 deletion include/os/freebsd/zfs/sys/zfs_context_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions include/sys/zfs_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion module/os/freebsd/zfs/event_os.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2022 Rob Wing
*
Expand Down
2 changes: 1 addition & 1 deletion module/os/freebsd/zfs/kmod_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ zfsdev_ioctl(struct cdev *dev, ulong_t zcmd, caddr_t arg, int flag,
if (len != sizeof (zfs_iocparm_t))
return (EINVAL);

uaddr = (void *)zp->zfs_cmd;
uaddr = (void *)(uintptr_t)zp->zfs_cmd;
zc = vmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
#ifdef ZFS_LEGACY_SUPPORT
/*
Expand Down
2 changes: 1 addition & 1 deletion tests/zfs-tests/cmd/dosmode_readonly_write.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2021 iXsystems, Inc.
*
Expand Down

0 comments on commit b40c6eb

Please sign in to comment.