vfio: fix stdbool usage without include
Checks
Commit Message
This became visible by backporting the following for the 19.11 stable tree:
c13ca4e8 "vfio: fix DMA mapping granularity for IOVA as VA"
The usage of type bool in the vfio code would require "#include
<stdbool.h>", but rte_vfio.h has no direct paths to stdbool.h.
It happens that in eal_vfio_mp_sync.c it comes after "#include
<rte_log.h>".
And rte_log.h since 20.05 includes stdbool since this change:
241e67bfe "log: add API to check if a logtype can log in a given level"
and thereby masks the issue in >20.05.
It should be safe to include stdbool.h from rte_vfio.h itself
to have bool present exactly when needed for the struct it defines
using that type.
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
lib/eal/include/rte_vfio.h | 1 +
1 file changed, 1 insertion(+)
Comments
01/06/2021 07:42, Christian Ehrhardt:
> This became visible by backporting the following for the 19.11 stable tree:
> c13ca4e8 "vfio: fix DMA mapping granularity for IOVA as VA"
>
> The usage of type bool in the vfio code would require "#include
> <stdbool.h>", but rte_vfio.h has no direct paths to stdbool.h.
> It happens that in eal_vfio_mp_sync.c it comes after "#include
> <rte_log.h>".
>
> And rte_log.h since 20.05 includes stdbool since this change:
> 241e67bfe "log: add API to check if a logtype can log in a given level"
> and thereby masks the issue in >20.05.
>
> It should be safe to include stdbool.h from rte_vfio.h itself
> to have bool present exactly when needed for the struct it defines
> using that type.
A line "Fixes" is missing for the record of the root cause.
On Tue, Jun 1, 2021 at 9:25 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 01/06/2021 07:42, Christian Ehrhardt:
> > This became visible by backporting the following for the 19.11 stable tree:
> > c13ca4e8 "vfio: fix DMA mapping granularity for IOVA as VA"
> >
> > The usage of type bool in the vfio code would require "#include
> > <stdbool.h>", but rte_vfio.h has no direct paths to stdbool.h.
> > It happens that in eal_vfio_mp_sync.c it comes after "#include
> > <rte_log.h>".
> >
> > And rte_log.h since 20.05 includes stdbool since this change:
> > 241e67bfe "log: add API to check if a logtype can log in a given level"
> > and thereby masks the issue in >20.05.
> >
> > It should be safe to include stdbool.h from rte_vfio.h itself
> > to have bool present exactly when needed for the struct it defines
> > using that type.
>
> A line "Fixes" is missing for the record of the root cause.
Thanks Thomas for having a look,
it is slightly up for debate what exactly the root cause is here, but I think
c13ca4e81cac that introduced using bool without adding a header is the
right reference.
I'll send a v2 with that added
>
>
@@ -14,6 +14,7 @@
extern "C" {
#endif
+#include <stdbool.h>
#include <stdint.h>
/*