The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=6573b7db71438f852fb80f10b3f5539f596f23f8
commit 6573b7db71438f852fb80f10b3f5539f596f23f8 Author: Bjoern A. Zeeb <b...@freebsd.org> AuthorDate: 2025-05-02 20:10:38 +0000 Commit: Bjoern A. Zeeb <b...@freebsd.org> CommitDate: 2025-06-04 22:23:31 +0000 LinuxKPI: add struct_group_tagged() Restructure struct_group() into a wrapper around __struct_group(). Various callers have arguments annotated as /* no foo */ so try to add all we can find. Sponsored by: The FreeBSD Foundation Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D50157 (cherry picked from commit 54d0e1772fb6b83d72725764e0a5d3ead8337673) --- sys/compat/linuxkpi/common/include/linux/stddef.h | 26 ++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/stddef.h b/sys/compat/linuxkpi/common/include/linux/stddef.h index a3bc6b13765e..d04a5a4bf516 100644 --- a/sys/compat/linuxkpi/common/include/linux/stddef.h +++ b/sys/compat/linuxkpi/common/include/linux/stddef.h @@ -5,11 +5,27 @@ #include <sys/stddef.h> -#define struct_group(NAME, ...) \ +/* + * FreeBSD has multiple (vendor) drivers containing copies of this + * and including LinuxKPI headers. Put the #defines behind guards. + */ + +#ifndef __struct_group +#define __struct_group(_tag, _name, _attrs, _members...) \ union { \ - struct { __VA_ARGS__ }; \ - struct { __VA_ARGS__ } NAME; \ - } + struct { _members } _attrs; \ + struct _tag { _members } _attrs _name; \ + } _attrs +#endif -#endif /* _LINUXKPI_LINUX_STDDEF_H_ */ +#ifndef struct_group +#define struct_group(_name, _members...) \ + __struct_group(/* no tag */, _name, /* no attrs */, _members) +#endif +#ifndef struct_group_tagged +#define struct_group_tagged(_tag, _name, _members...) \ + __struct_group(_tag, _name, /* no attrs */, _members) +#endif + +#endif /* _LINUXKPI_LINUX_STDDEF_H_ */