On Mon, Nov 02, 2026 at 04:27:59PM +0100, Thomas Monjalon wrote:
> System headers may indirectly include linux/stddef.h
> before the imported UAPI headers.
> Both versions share the _LINUX_STDDEF_H include guard,
> so the imported header is then skipped.
>
> If the system header lacks __counted_by,
> its fallback definition in the imported header is not processed,
> causing a compilation failure in vfio.h:
>
> In file included from lib/eal/linux/eal_vfio_cdev.c:14:
> kernel/linux/uapi/linux/vfio.h:1524:51: error:
> expected ':', ',', ';', '}' or '__attribute__' before '__counted_by'
>
> Include the imported UAPI headers before the system headers
> so their compatibility definitions are available.
>
> Fixes: d129414711aa ("vfio: introduce cdev mode")
>
> Signed-off-by: Thomas Monjalon <[email protected]>
> ---
Acked-by: Bruce Richardson <[email protected]>
LGTM
> lib/eal/linux/eal_vfio_cdev.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/eal/linux/eal_vfio_cdev.c b/lib/eal/linux/eal_vfio_cdev.c
> index 4a955248ae..e7cd547c1c 100644
> --- a/lib/eal/linux/eal_vfio_cdev.c
> +++ b/lib/eal/linux/eal_vfio_cdev.c
> @@ -2,6 +2,9 @@
> * Copyright(c) 2010-2025 Intel Corporation
> */
>
> +#include <uapi/linux/iommufd.h>
> +#include <uapi/linux/vfio.h>
> +
> #include <dirent.h>
> #include <fcntl.h>
> #include <limits.h>
> @@ -10,9 +13,6 @@
> #include <sys/ioctl.h>
> #include <unistd.h>
>
> -#include <uapi/linux/iommufd.h>
> -#include <uapi/linux/vfio.h>
> -
> #include <rte_log.h>
> #include <rte_errno.h>
> #include <rte_memory.h>
> --
> 2.55.0
>