qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] 9pfs: include <linux/limits.h> for XATTR_SIZE_M


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH] 9pfs: include <linux/limits.h> for XATTR_SIZE_MAX
Date: Fri, 28 Jul 2017 14:20:49 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On Mon, Jun 26, 2017 at 12:20 PM, Patrick Steinhardt <address@hidden> wrote:
The function `v9fs_xattrcreate` makes use of the define `XATTR_SIZE_MAX`
to reject attempts of creating xattrs with an invalid size, which is
defined in <linux/limits.h>. On glibc-based systems, this header is
indirectly included via <limits.h>, <bits/posix1_lim.h>,
<bitts/local_lim.h>, but on other platforms this is not guaranteed due
to not being part of the POSIX standard. One examples are systems based
on musl libc, which do not include the <linux/limits.h> indirectly,
which leads to `XATTR_SIZE_MAX` being undefined.

Fix this error by directly include <linux/limits.h>. As the 9P fs code
is being Linux-based either way, we can simply do so without breaking
other platforms. This enables building 9pfs on musl-based systems.

Signed-off-by: Patrick Steinhardt <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
---
  hw/9pfs/9p.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 96d2683348..48cd558e96 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -13,6 +13,7 @@

  #include "qemu/osdep.h"
  #include <glib/gprintf.h>

This is likely to break on BSD, but now than patchew has a NetBSD job you can trigger a build RESENDing this patch.

This should probably work:

#ifdef __linux__

+#include <linux/limits.h>

#endif

  #include "hw/virtio/virtio.h"
  #include "qapi/error.h"
  #include "qemu/error-report.h"
--
2.13.2

Regards,

Phil.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]