On Wed, 30 Mar 2022 at 19:26, Will Cohen <wwcohen@gmail.com> wrote:
>
> As noted by https://gitlab.com/qemu-project/qemu/-/issues/950, within
> the patch set adding 9p functionality to darwin, the commit
> 38d7fd68b0c8775b5253ab84367419621aa032e6 introduced an issue where
> limits.h, which defines XATTR_SIZE_MAX, is included in 9p.c, though the
> referenced constant is needed in 9p.h. This commit fixes that issue by
> moving the include to 9p.h.
>
> Signed-off-by: Will Cohen <wwcohen@gmail.com>
> ---
> hw/9pfs/9p.c | 5 -----
> hw/9pfs/9p.h | 5 +++++
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
> index dcaa602d4c..59c531ed47 100644
> --- a/hw/9pfs/9p.c
> +++ b/hw/9pfs/9p.c
> @@ -33,11 +33,6 @@
> #include "migration/blocker.h"
> #include "qemu/xxhash.h"
> #include <math.h>
> -#ifdef CONFIG_LINUX
> -#include <linux/limits.h>
> -#else
> -#include <limits.h>
> -#endif
>
> int open_fd_hw;
> int total_open_fd;
> diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h
> index af2635fae9..0ce4da375c 100644
> --- a/hw/9pfs/9p.h
> +++ b/hw/9pfs/9p.h
> @@ -9,6 +9,11 @@
> #include "qemu/thread.h"
> #include "qemu/coroutine.h"
> #include "qemu/qht.h"
> +#ifdef CONFIG_LINUX
> +#include <linux/limits.h>
> +#else
> +#include <limits.h>
> +#endif
Is it possible to do this with a meson.build check for whatever
host property we're relying on here rather than with a
"which OS is this?" ifdef ?
To confirm -- the game plan in this case would be to do a check for something along the lines of
config_host_data.set('CONFIG_XATTR_SIZE_MAX', cc.has_header_symbol('linux/limits.h', 'XATTR_SIZE_MAX'))
and using that in the corresponding ifs, right?
That makes sense -- if there's no objections, I'll go this route for v2, which I can submit tomorrow.
thanks
-- PMM