From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqmlP-000097-89 for qemu-devel@nongnu.org; Thu, 14 Apr 2016 15:17:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aqmlL-0003Kp-NM for qemu-devel@nongnu.org; Thu, 14 Apr 2016 15:17:15 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:42686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqmlL-0003Kl-Aa for qemu-devel@nongnu.org; Thu, 14 Apr 2016 15:17:11 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Apr 2016 20:17:08 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id BA008219004D for ; Thu, 14 Apr 2016 20:16:44 +0100 (BST) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u3EJH6VH50397222 for ; Thu, 14 Apr 2016 19:17:06 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u3EJH58v016536 for ; Thu, 14 Apr 2016 15:17:05 -0400 Date: Thu, 14 Apr 2016 21:17:01 +0200 From: Greg Kurz Message-ID: <20160414211701.5f4a4315@bahia.huguette.org> In-Reply-To: <1460447520-12499-1-git-send-email-michael@fritscher.net> References: <1460447520-12499-1-git-send-email-michael@fritscher.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2] [WIP] [RFC ]Add initial 9pfs support for Windows hosts v2 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Fritscher Cc: sw@weilnetz.de, aneesh.kumar@linux.vnet.ibm.com, mst@redhat.com, qemu-devel@nongnu.org Hi Michael, I have some more comments that should end up in a preliminary patch. Cheers. -- Greg On Tue, 12 Apr 2016 09:52:00 +0200 Michael Fritscher wrote: > It was tested on Windows & Linux hosts, on the later no obvious regressio= ns could be found. The guest was a Knoppix 7.6.0 live cd. >=20 > This is WIP and a RFC - it isn't meant to be upstreamed yet. The error_pr= intf are only for debugging and will be deleted in the final patch. >=20 > There are some comments with "mifritscher" - I'm not quite sure how to ha= ndle these problems (e.g. on mingw, this in 32 bit, while on Linux this is = 16 bit and so on). Additionally, some places from which I suspect problems = are marked with a #warning. >=20 > Changes against v1: > * fixed open (added binary flag) -> read/write is fine now, file > creation was fixed as well > * added inode calculation using own crude hash algorithm > * fixed xattr returning -1 + EOPNOTSUP -> fixes e.g. executing files > * fixed unlinkat / remove f=C3=BCr directories by trying rmdir as well > * prepend 777 mode on files (for executing) >=20 > What does work: > * reading/writing "big" files (5MB, verified with md5sum) > * creating files > * executing files > * mkdir > * rm / rmdir > * cp files > * running gcc > * cp first 250 files & directories from /etc > * tar it from and to the 9p mount > * create a 100 MB swap file and do a mkswap on it >=20 > What does not work: > * swapon - no real surprise (doesn't work on Linux as well - with the s= ame error message) ;-) (swapon returns -1 EINVAL) > * link / symlink (there is no real aequivalent for this on windows) > * mknod (dito) > * chown (dito - prepend success for compatibility) >=20 > State of v1: > What works: > * mount > * stat > * chdir > * readdir (aka ls) > * read of small files (<10k) > * overwrite >=20 > What does not work: > * create new files (in 90% problems with path handling (old path occur= s) > * read / probably write big files >=20 >=20 > Signed-off-by: Michael Fritscher > --- > On https://github.com/mifritscher/qemu/tree/9pfs_windows is a git tree wi= th the patch. >=20 > I gave a shot at xattr (try to include xattr stuff) but it ended up even = more #ifdefs. So I gave up at this. > Now I'm waiting on comments etc. If there are no big objections, I'll rem= ove the debug output and make a patch which is meant for upstreaming. >=20 > Thanks to everybody which helped me! >=20 > Makefile.objs | 1 + > configure | 15 ++- > fsdev/9p-iov-marshal.c | 2 + > fsdev/9p-marshal.c | 4 +- > fsdev/file-op-9p.h | 35 ++++- > fsdev/qemu-fsdev.c | 2 + > hw/9pfs/9p-local.c | 326 +++++++++++++++++++++++++++++++++++++++= ++---- > hw/9pfs/9p-synth.c | 10 +- > hw/9pfs/9p.c | 102 +++++++++++++- > hw/9pfs/9p.h | 70 +++++++++- > hw/9pfs/Makefile.objs | 7 +- > hw/9pfs/codir.c | 31 +++++ > hw/9pfs/cofile.c | 15 +++ > hw/9pfs/cofs.c | 15 +++ > hw/9pfs/coxattr.c | 6 + > hw/9pfs/virtio-9p-device.c | 4 +- > 16 files changed, 600 insertions(+), 45 deletions(-) >=20 > diff --git a/Makefile.objs b/Makefile.objs > index 8f705f6..6fd02bc 100644 > --- a/Makefile.objs > +++ b/Makefile.objs > @@ -48,6 +48,7 @@ common-obj-$(CONFIG_WIN32) +=3D os-win32.o > common-obj-$(CONFIG_POSIX) +=3D os-posix.o >=20 > common-obj-$(CONFIG_LINUX) +=3D fsdev/ > +common-obj-$(CONFIG_WIN32) +=3D fsdev/ >=20 > common-obj-y +=3D migration/ > common-obj-y +=3D qemu-char.o #aio.o > diff --git a/configure b/configure > index 5db29f0..a4797c3 100755 > --- a/configure > +++ b/configure > @@ -4566,12 +4566,21 @@ if test "$want_tools" =3D "yes" ; then > fi > if test "$softmmu" =3D yes ; then > if test "$virtfs" !=3D no ; then > - if test "$cap" =3D yes && test "$linux" =3D yes && test "$attr" =3D = yes ; then > + if test "$linux" =3D yes ; then > + if test "$cap" =3D yes && test "$attr" =3D yes ; then > + virtfs=3Dyes > + tools=3D"$tools fsdev/virtfs-proxy-helper\$(EXESUF)" > + else > + if test "$virtfs" =3D yes; then > + error_exit "VirtFS requires libcap-devel and libattr-devel on = Linux" > + fi > + virtfs=3Dno > + fi > + elif test "$mingw32" =3D yes; then > virtfs=3Dyes > - tools=3D"$tools fsdev/virtfs-proxy-helper\$(EXESUF)" > else > if test "$virtfs" =3D yes; then > - error_exit "VirtFS is supported only on Linux and requires libca= p-devel and libattr-devel" > + error_exit "VirtFS is only supported on Linux or Windows" > fi > virtfs=3Dno > fi > diff --git a/fsdev/9p-iov-marshal.c b/fsdev/9p-iov-marshal.c > index fb40bdf..1a292c6 100644 > --- a/fsdev/9p-iov-marshal.c > +++ b/fsdev/9p-iov-marshal.c > @@ -15,7 +15,9 @@ > #include > #include > #include > +#ifndef _WIN32 > #include > +#endif >=20 > #include "9p-iov-marshal.h" > #include "qemu/bswap.h" > diff --git a/fsdev/9p-marshal.c b/fsdev/9p-marshal.c > index 183d366..081cb88 100644 > --- a/fsdev/9p-marshal.c > +++ b/fsdev/9p-marshal.c > @@ -16,7 +16,9 @@ > #include > #include > #include > -#include > +#ifndef WIN32 > + #include > +#endif >=20 > #include "9p-marshal.h" >=20 > diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h > index b8c2602..446c6a5 100644 > --- a/fsdev/file-op-9p.h > +++ b/fsdev/file-op-9p.h > @@ -14,12 +14,43 @@ > #define _FILEOP_H > #include > #include > -#include > -#include > +#ifndef _WIN32 > + #include > + #include This should be included by include/sysemu/os-posix.h, and you just need to = add a=20 forward declaration for struct statfs before struct FileOperations somewher= e below. > +#endif >=20 > #define SM_LOCAL_MODE_BITS 0600 > #define SM_LOCAL_DIR_MODE_BITS 0700 >=20 > +#ifdef _WIN32 > +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; > +}; All this block belongs to include/sysemu/os-win32.h. > +#endif > +