@@ -27,6 +27,39 @@
# include <sys/mount.h>
#endif
+#ifdef CONFIG_WIN32
+
+/* POSIX structure not defined in Windows */
+
+typedef uint32_t uid_t;
+typedef uint32_t gid_t;
+
+/* from http://man7.org/linux/man-pages/man2/statfs.2.html */
+typedef uint32_t __fsword_t;
+typedef uint32_t fsblkcnt_t;
+typedef uint32_t fsfilcnt_t;
+
+/* from linux/include/uapi/asm-generic/posix_types.h */
+typedef struct {
+ long __val[2];
+} fsid_t;
+
+struct statfs {
+ __fsword_t f_type;
+ __fsword_t f_bsize;
+ fsblkcnt_t f_blocks;
+ fsblkcnt_t f_bfree;
+ fsblkcnt_t f_bavail;
+ fsfilcnt_t f_files;
+ fsfilcnt_t f_ffree;
+ fsid_t f_fsid;
+ __fsword_t f_namelen;
+ __fsword_t f_frsize;
+ __fsword_t f_flags;
+};
+
+#endif /* CONFIG_WIN32 */
+
#define SM_LOCAL_MODE_BITS 0600
#define SM_LOCAL_DIR_MODE_BITS 0700
@@ -3,13 +3,24 @@
#include <dirent.h>
#include <utime.h>
+#ifndef CONFIG_WIN32
#include <sys/resource.h>
+#endif
#include "fsdev/file-op-9p.h"
#include "fsdev/9p-iov-marshal.h"
#include "qemu/thread.h"
#include "qemu/coroutine.h"
#include "qemu/qht.h"
+#ifdef CONFIG_WIN32
+#define NAME_MAX MAX_PATH
+
+/* macros required for build, values do not matter */
+#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links */
+#define AT_REMOVEDIR 0x200 /* Remove directory instead of file */
+#define O_DIRECTORY 02000000
+#endif
+
enum {
P9_TLERROR = 6,
P9_RLERROR,