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 <behlendorf1@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by:	Alexander Motin <mav@FreeBSD.org>
Sponsored by:	iXsystems, Inc.
Closes #15368
This commit is contained in:
Alexander Motin 2023-10-09 16:27:18 -04:00 committed by GitHub
parent c57ff818f6
commit 008baa091f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 15 additions and 10 deletions

View File

@ -167,7 +167,7 @@ atomic_dec_64_nv(volatile uint64_t *target)
return (atomic_add_64_nv(target, -1)); return (atomic_add_64_nv(target, -1));
} }
#if !defined(COMPAT_32BIT) && defined(__LP64__) #ifdef __LP64__
static __inline void * static __inline void *
atomic_cas_ptr(volatile void *target, void *cmp, void *newval) 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, return ((void *)atomic_cas_32((volatile uint32_t *)target,
(uint32_t)cmp, (uint32_t)newval)); (uint32_t)cmp, (uint32_t)newval));
} }
#endif /* !defined(COMPAT_32BIT) && defined(__LP64__) */ #endif /* __LP64__ */
#else /* _STANDALONE */ #else /* _STANDALONE */
/* /*
@ -190,6 +190,8 @@ atomic_cas_ptr(volatile void *target, void *cmp, void *newval)
*/ */
#undef atomic_add_64 #undef atomic_add_64
#define atomic_add_64(ptr, val) *(ptr) += val #define atomic_add_64(ptr, val) *(ptr) += val
#undef atomic_sub_64
#define atomic_sub_64(ptr, val) *(ptr) -= val
#endif /* !_STANDALONE */ #endif /* !_STANDALONE */
#endif /* !_OPENSOLARIS_SYS_ATOMIC_H_ */ #endif /* !_OPENSOLARIS_SYS_ATOMIC_H_ */

View File

@ -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 * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions

View File

@ -39,5 +39,6 @@
((C) >= 0x3A && (C) <= 0x40) || \ ((C) >= 0x3A && (C) <= 0x40) || \
((C) >= 0x5B && (C) <= 0x60) || \ ((C) >= 0x5B && (C) <= 0x60) || \
((C) >= 0x7B && (C) <= 0x7E)) ((C) >= 0x7B && (C) <= 0x7E))
#define isspace(C) ((C) == 0x20 || ((C) >= 0x9 && (C) <= 0xD))
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD * SPDX-License-Identifier: BSD-2-Clause
* *
* Copyright (c) 2000 Jake Burkholder <jake@freebsd.org>. * Copyright (c) 2000 Jake Burkholder <jake@freebsd.org>.
* All rights reserved. * All rights reserved.

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD * SPDX-License-Identifier: BSD-2-Clause
* *
* Copyright (c) 2022 Martin Matuska * Copyright (c) 2022 Martin Matuska
* *

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD * SPDX-License-Identifier: BSD-2-Clause
* *
* Copyright (c) 2022 Rob Wing * Copyright (c) 2022 Rob Wing
* *

View File

@ -78,7 +78,7 @@ extern int hz;
extern int tick; extern int tick;
typedef int fstrans_cookie_t; typedef int fstrans_cookie_t;
#define spl_fstrans_mark() (0) #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 signal_pending(x) SIGPENDING(x)
#define current curthread #define current curthread
#define thread_join(x) #define thread_join(x)

View File

@ -695,8 +695,10 @@ extern char *kmem_asprintf(const char *fmt, ...);
#define kmem_strfree(str) kmem_free((str), strlen(str) + 1) #define kmem_strfree(str) kmem_free((str), strlen(str) + 1)
#define kmem_strdup(s) strdup(s) #define kmem_strdup(s) strdup(s)
#ifndef __cplusplus
extern int kmem_scnprintf(char *restrict str, size_t size, extern int kmem_scnprintf(char *restrict str, size_t size,
const char *restrict fmt, ...); const char *restrict fmt, ...);
#endif
/* /*
* Hostname information * Hostname information

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD * SPDX-License-Identifier: BSD-2-Clause
* *
* Copyright (c) 2022 Rob Wing * Copyright (c) 2022 Rob Wing
* *

View File

@ -141,7 +141,7 @@ zfsdev_ioctl(struct cdev *dev, ulong_t zcmd, caddr_t arg, int flag,
if (len != sizeof (zfs_iocparm_t)) if (len != sizeof (zfs_iocparm_t))
return (EINVAL); return (EINVAL);
uaddr = (void *)zp->zfs_cmd; uaddr = (void *)(uintptr_t)zp->zfs_cmd;
zc = vmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP); zc = vmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
#ifdef ZFS_LEGACY_SUPPORT #ifdef ZFS_LEGACY_SUPPORT
/* /*

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD * SPDX-License-Identifier: BSD-2-Clause
* *
* Copyright (c) 2021 iXsystems, Inc. * Copyright (c) 2021 iXsystems, Inc.
* *