aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/9pfs/9p.c28
-rw-r--r--hw/9pfs/9p.h18
2 files changed, 23 insertions, 23 deletions
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index dcaa602..225f31f 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -17,6 +17,11 @@
*/
#include "qemu/osdep.h"
+#ifdef CONFIG_LINUX
+#include <linux/limits.h>
+#else
+#include <limits.h>
+#endif
#include <glib/gprintf.h>
#include "hw/virtio/virtio.h"
#include "qapi/error.h"
@@ -33,11 +38,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;
@@ -3925,6 +3925,24 @@ out_nofid:
v9fs_string_free(&name);
}
+#if defined(CONFIG_LINUX)
+/* Currently, only Linux has XATTR_SIZE_MAX */
+#define P9_XATTR_SIZE_MAX XATTR_SIZE_MAX
+#elif defined(CONFIG_DARWIN)
+/*
+ * Darwin doesn't seem to define a maximum xattr size in its user
+ * space header, so manually configure it across platforms as 64k.
+ *
+ * Having no limit at all can lead to QEMU crashing during large g_malloc()
+ * calls. Because QEMU does not currently support macOS guests, the below
+ * preliminary solution only works due to its being a reflection of the limit of
+ * Linux guests.
+ */
+#define P9_XATTR_SIZE_MAX 65536
+#else
+#error Missing definition for P9_XATTR_SIZE_MAX for this host system
+#endif
+
static void coroutine_fn v9fs_xattrcreate(void *opaque)
{
int flags, rflags = 0;
diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h
index af2635f..994f952 100644
--- a/hw/9pfs/9p.h
+++ b/hw/9pfs/9p.h
@@ -479,22 +479,4 @@ struct V9fsTransport {
void (*push_and_notify)(V9fsPDU *pdu);
};
-#if defined(XATTR_SIZE_MAX)
-/* Linux */
-#define P9_XATTR_SIZE_MAX XATTR_SIZE_MAX
-#elif defined(CONFIG_DARWIN)
-/*
- * Darwin doesn't seem to define a maximum xattr size in its user
- * space header, so manually configure it across platforms as 64k.
- *
- * Having no limit at all can lead to QEMU crashing during large g_malloc()
- * calls. Because QEMU does not currently support macOS guests, the below
- * preliminary solution only works due to its being a reflection of the limit of
- * Linux guests.
- */
-#define P9_XATTR_SIZE_MAX 65536
-#else
-#error Missing definition for P9_XATTR_SIZE_MAX for this host system
-#endif
-
#endif