mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
freebsd: Use compiler.h from FreeBSD's base's linuxkpi
The FreeBSD linux/compiler.h in OpenZFS was copied from a very old version of FreeBSD's linuxkpi's linux/compiler.h. There's no need for this duplication. Use FreeBSD's linuxkpi version instead, and provide zfs_fallthrough to augment it (it's all that's needed). Use #pragma once to avoid naming issues for guard variables. Since this is a complete rewrite, use my copyright here (the original code in FreeBSD still credits everybody). This works back at least to FreeBSD 12.4, which is not out of support, and all newer releases. Remove extra copies of macros that were defined elsewhere, but are now properly defined in LinuxKPI so are redundant. Sponsored-by: Netflix Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Warner Losh <imp@bsdimp.com> Closes #16650
This commit is contained in:
@@ -70,15 +70,6 @@ hlist_del(struct hlist_node *n)
|
||||
n->next->pprev = n->pprev;
|
||||
}
|
||||
/* BEGIN CSTYLED */
|
||||
#define READ_ONCE(x) ({ \
|
||||
__typeof(x) __var = ({ \
|
||||
barrier(); \
|
||||
ACCESS_ONCE(x); \
|
||||
}); \
|
||||
barrier(); \
|
||||
__var; \
|
||||
})
|
||||
|
||||
#define HLIST_HEAD_INIT { }
|
||||
#define HLIST_HEAD(name) struct hlist_head name = HLIST_HEAD_INIT
|
||||
#define INIT_HLIST_HEAD(head) (head)->first = NULL
|
||||
|
||||
@@ -95,10 +95,6 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
|
||||
#ifndef expect
|
||||
#define expect(expr, value) (__builtin_expect((expr), (value)))
|
||||
#endif
|
||||
#ifndef __linux__
|
||||
#define likely(expr) expect((expr) != 0, 1)
|
||||
#define unlikely(expr) expect((expr) != 0, 0)
|
||||
#endif
|
||||
|
||||
#define PANIC(fmt, a...) \
|
||||
spl_panic(__FILE__, __FUNCTION__, __LINE__, fmt, ## a)
|
||||
|
||||
Reference in New Issue
Block a user