Date: Thu, 30 Apr 2026 07:18:30 +0000 From: Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron <dumbbell@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 796fff59a5d3 - main - linuxkpi: Define `DEFINE_XARRAY*()` macros Message-ID: <69f30246.37197.6ebce159@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=796fff59a5d32bc3be14feaeb228fc15ef43eb32 commit 796fff59a5d32bc3be14feaeb228fc15ef43eb32 Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> AuthorDate: 2026-04-13 21:44:16 +0000 Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> CommitDate: 2026-04-30 07:05:02 +0000 linuxkpi: Define `DEFINE_XARRAY*()` macros The `DEFINE_XARRAY*()` macros are used to declare a static xarray. As the structure embeds a mutex(9), we also need to declare the static mutex after the `struct xarray`. Thus the slightly awkward definition of `DEFINE_XARRAY_FLAGS()`. The DRM generic code started to use `DEFINE_XARRAY_ALLOC()` in Linux 6.12. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D56446 --- sys/compat/linuxkpi/common/include/linux/xarray.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/xarray.h b/sys/compat/linuxkpi/common/include/linux/xarray.h index e6511130d50c..b26aa6f0d13a 100644 --- a/sys/compat/linuxkpi/common/include/linux/xarray.h +++ b/sys/compat/linuxkpi/common/include/linux/xarray.h @@ -54,6 +54,18 @@ struct xarray { uint32_t xa_flags; /* see XA_FLAGS_XXX */ }; +#define DEFINE_XARRAY_FLAGS(name, flags) \ + struct xarray name = { \ + .xa_head.gfp_mask = GFP_NOWAIT, \ + .xa_flags = flags, \ + }; \ + MTX_SYSINIT(name ## _mtx, &name.xa_lock, \ + "linuxkpi_DEFINE_XARRAY(" #name ")", \ + MTX_DEF | MTX_RECURSE) + +#define DEFINE_XARRAY(name) DEFINE_XARRAY_FLAGS(name, 0) +#define DEFINE_XARRAY_ALLOC(name) DEFINE_XARRAY_FLAGS(name, XA_FLAGS_ALLOC) + struct xa_limit { uint32_t max; uint32_t min;home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f30246.37197.6ebce159>
