[PATCH v1] coverage: add missing include for macro

victorm.lira@amd.com posted 1 patch 3 days, 3 hours ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/ae1c963aa985694967ca7ba87929b2a66dcfd8bd.1757545904.git.victorm.lira@amd.com
xen/include/xen/coverage.h | 1 +
1 file changed, 1 insertion(+)
[PATCH v1] coverage: add missing include for macro
Posted by victorm.lira@amd.com 3 days, 3 hours ago
From: Victor Lira <victorm.lira@amd.com>

The missing include prevents it from compiling when CONFIG_COVERAGE is not set
and the header is included in a file that has not already included errno.h,
causing EOPNOTSUPP to be undeclared.

Add the missing include.

Signed-off-by: Victor Lira <victorm.lira@amd.com>
---
example of the problem:
    diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
    index 7ad870e382c..4d27f16e8ef 100644
    --- a/xen/arch/arm/setup.c
    +++ b/xen/arch/arm/setup.c
    @@ -10,6 +10,7 @@

    #include <xen/bootinfo.h>
    #include <xen/compile.h>
    +#include <xen/coverage.h>
    #include <xen/device_tree.h>
    #include <xen/dom0less-build.h>
    #include <xen/domain_page.h>
    ---

    In file included from arch/arm/setup.c:13:
    ./include/xen/coverage.h: In function 'sysctl_cov_op':
    ./include/xen/coverage.h:10:13: error: 'EOPNOTSUPP' undeclared (first use in this function)
       10 |     return -EOPNOTSUPP;
---
 xen/include/xen/coverage.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/include/xen/coverage.h b/xen/include/xen/coverage.h
index ba5fb67947..28506c239b 100644
--- a/xen/include/xen/coverage.h
+++ b/xen/include/xen/coverage.h
@@ -5,6 +5,7 @@
 #include <public/sysctl.h>
 int sysctl_cov_op(struct xen_sysctl_coverage_op *op);
 #else
+#include <xen/errno.h>
 static inline int sysctl_cov_op(void *unused)
 {
     return -EOPNOTSUPP;
--
2.50.GIT
Re: [PATCH v1] coverage: add missing include for macro
Posted by Andrew Cooper 3 days, 3 hours ago
On 11/09/2025 12:40 am, victorm.lira@amd.com wrote:
> From: Victor Lira <victorm.lira@amd.com>
>
> The missing include prevents it from compiling when CONFIG_COVERAGE is not set
> and the header is included in a file that has not already included errno.h,
> causing EOPNOTSUPP to be undeclared.
>
> Add the missing include.
>
> Signed-off-by: Victor Lira <victorm.lira@amd.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>, although

> ---
> example of the problem:
>     diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
>     index 7ad870e382c..4d27f16e8ef 100644
>     --- a/xen/arch/arm/setup.c
>     +++ b/xen/arch/arm/setup.c
>     @@ -10,6 +10,7 @@
>
>     #include <xen/bootinfo.h>
>     #include <xen/compile.h>
>     +#include <xen/coverage.h>
>     #include <xen/device_tree.h>
>     #include <xen/dom0less-build.h>
>     #include <xen/domain_page.h>
>     ---
>
>     In file included from arch/arm/setup.c:13:
>     ./include/xen/coverage.h: In function 'sysctl_cov_op':
>     ./include/xen/coverage.h:10:13: error: 'EOPNOTSUPP' undeclared (first use in this function)
>        10 |     return -EOPNOTSUPP;
> ---
>  xen/include/xen/coverage.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/xen/include/xen/coverage.h b/xen/include/xen/coverage.h
> index ba5fb67947..28506c239b 100644
> --- a/xen/include/xen/coverage.h
> +++ b/xen/include/xen/coverage.h
> @@ -5,6 +5,7 @@
>  #include <public/sysctl.h>
>  int sysctl_cov_op(struct xen_sysctl_coverage_op *op);
>  #else
> +#include <xen/errno.h>
>  static inline int sysctl_cov_op(void *unused)
>  {
>      return -EOPNOTSUPP;

... this is starting to get overly busy to read and could do with some
extra lines around the primary #ifdef CONFIG_COVERAGE / #else / #endif.

Happy to fix up on commit.

~Andrew
Re: [PATCH v1] coverage: add missing include for macro
Posted by Lira, Victor M 3 days, 2 hours ago
On 9/10/2025 4:47 PM, Andrew Cooper wrote:
> @@ -5,6 +5,7 @@
>   #include <public/sysctl.h>
>   int sysctl_cov_op(struct xen_sysctl_coverage_op *op);
>   #else
> +#include <xen/errno.h>
>   static inline int sysctl_cov_op(void *unused)
>   {
>       return -EOPNOTSUPP;
> ... this is starting to get overly busy to read and could do with some
> extra lines around the primary #ifdef CONFIG_COVERAGE / #else / #endif.
>
> Happy to fix up on commit.
OK, its fine by me.


Victor