Implementing 9p for Windows host
Good day,
I'm using qemu on a Windows host. One thing I stumbled over was missing 9p support. I thought it was because of missing (x)attr, but Stefan Weil told me that 9p is supported only under Linux hosts.
I searched a bit and got following questions:
* are my following results right: The data structure for 9p is
9FSState, which has the element FileOperations ops. This is defined in fsdev\file-op-9p.h, whis is implemented in 4 ways from hw\p9fs\p9-*.c. These are registered by fsdev\qemu-fsdev.c.
* is the file hw\p9fs\p9-local.c the only cause 9p is working only
under Linux?
* 9p-synth makes only a virtual file system without any references to
a real directory tree - so this should already work under Windows? If not: Why not?
* How to implement the Windows support? I don't want to clutter the9p-local.c with #ifdefs all over the place, so my idea is to rename it to 9p-local-posix.c, create a new 9p-local-windows.c and let the build system include the right one?
* My first approach will be to skip all of the "fancy" things like
permissions (using faked ones), symlinks, special files and so on. Is this ok?
* Is already somebody else working on it or should I yust jump in?
* Is there any documentation I should read regarding 9p aside the
code itself, the user documentation and http://wiki.qemu.org/Documentation/GettingStartedDevelopers ?
* Is there a person which could mentor me a bit (as I'm completely
new to qemu source or should I just write to this mailing list or in irc's #qemu channel (I'm both in freenode and oftc)?
* Do I need care of any license agreement stuff? If I'm right all
files which I need to work with are GPL2, which is fine for me.
Best regards and thanks,
Michael Fritscher
Signature · 14 lines
ZfT - Zentrum für Telematik e.V. Michael Fritscher Magdalene-Schoch-Straße 5 97074 Würzburg Tel: +49 (931) 615 633 - 57 Fax: +49 (931) 615 633 - 11 Email: [email protected] Web: http://www.telematik-zentrum.de Vorstand: Prof. Dr. Klaus Schilling, Hans-Joachim Leistner Sitz: Gerbrunn USt.-ID Nr.: DE 257 244 580, Steuer-Nr.: 257/111/70203 Amtsgericht Würzburg, Vereinsregister-Nr.: VR 200 167
begin:vcard
fn:Michael Fritscher
n:Fritscher;Michael org;quoted-printable:Zentrum f=C3=BCr Telematik adr:;;Allesgrundweg 12;Gerbrunn;Bayern;97218;Deutschland email;internet:[email protected] tel;work:+49 (931) 3 29 29 54 - 21
tel;fax:+49 (931) 3 29 29 54 - 11 url:http://www.telematik-zentrum.de
version:2.1
end:vcard
Quoted 9 lines · On Thu, 7 Apr 2016 13:41:24 +0200 Michael Fritscher…
Good day,
I'm using qemu on a Windows host. One thing I stumbled over was missing 9p support. I thought it was because of missing (x)attr, but Stefan Weil told me that 9p is supported only under Linux hosts.
I searched a bit and got following questions:
* are my following results right: The data structure for 9p is
9FSState,
I guess you mean V9fsState defined in hw/9pfs/9p.h ?
Quoted 2 lines
which has the element FileOperations ops. This is defined in fsdev\file-op-9p.h,
Yes.
Quoted 1 line
whis is implemented in 4 ways from hw\p9fs\p9-*.c.
Yes there are currently 4 fs drivers:
hw/9pfs/9p-local.chw/9pfs/9p-handle.chw/9pfs/9p-proxy.chw/9pfs/9p-synth.c
Quoted 1 line
These are registered by fsdev\qemu-fsdev.c.
Yes, from the QEMU main() function.
vl.c: ret = qemu_fsdev_add(opts);
Quoted 2 lines
* is the file hw\p9fs\p9-local.c the only cause 9p is working only
under Linux?
I don't know much about QEMU on windows but the configure script says:
VirtFS is supported only on Linux and requires libcap-devel and libattr-devel
and we have quite some files that currently include the <sys/xattr.h> system header (or <attr/xattr.h> for older systems that have libattr), through the hw/9pfs/9p-xattr.h header.
[greg@bahia qemu-master]$ git grep 9p-xattr.h
hw/9pfs/9p-cephfs.c:#include "9p-xattr.h"
hw/9pfs/9p-handle.c:#include "9p-xattr.h"
hw/9pfs/9p-local.c:#include "9p-xattr.h"
hw/9pfs/9p-posix-acl.c:#include "9p-xattr.h"
hw/9pfs/9p-synth.c:#include "9p-xattr.h"
hw/9pfs/9p-xattr-user.c:#include "9p-xattr.h"
hw/9pfs/9p-xattr.c:#include "9p-xattr.h"
hw/9pfs/9p.c:#include "9p-xattr.h"
hw/9pfs/virtio-9p-device.c:#include "9p-xattr.h"
libcap is needed to build the virtfs-proxy-helper tool.
Quoted 3 lines
* 9p-synth makes only a virtual file system without any references to
a real directory tree - so this should already work under Windows? If
not: Why not?
Maybe but 9p-synth.c still includes 9p-xattr.h
Quoted 4 lines
* How to implement the Windows support? I don't want to clutter the
9p-local.cwith #ifdefs all over the place, so my idea is to rename it to9p-local-posix.c, create a new9p-local-windows.cand let the build system include the right one?
Hmmm... I'm not a big fan of code duplication, especially such a big file.
Quoted 3 lines
* My first approach will be to skip all of the "fancy" things like
permissions (using faked ones), symlinks, special files and so on. Is this ok?
It makes sense.
Quoted 1 line
* Is already somebody else working on it or should I yust jump in?
Please jump in ! (and I see you've done so :)
Quoted 3 lines
* Is there any documentation I should read regarding 9p aside the
code itself, the user documentation and
http://wiki.qemu.org/Documentation/GettingStartedDevelopers ?
google ? :)
Quoted 3 lines
* Is there a person which could mentor me a bit (as I'm completely
new to qemu source or should I just write to this mailing list or in irc's #qemu channel (I'm both in freenode and oftc)?
qemu-devel is the mentor you need :)
Quoted 3 lines
* Do I need care of any license agreement stuff? If I'm right all
files which I need to work with are GPL2, which is fine for me.
Yes you need to care. Please have a look at the LICENSE file.
Quoted 3 lines
Best regards and thanks,
Michael Fritscher
Cheers.
--
Greg
Hello Greg,
thanks for your answer! Yes, I already jumped in - I was surprised how fast it went. I was afraid of much bigger problems ;-) I've a already a V2 nearly ready :-) As a teaser: Fixed read/write support and the possibility to execute binaries from the mountpoint.
Yes, I decided not to copy the 9p-local.c, because I had to change not as many places I thought in the first place.
I'm wondering about the xattr stuff... Perhaps I try to remove the <sys/xattr.h> from hw/9pfs/9p-xattr.h and #ifdef the things which are broken afterwards. That would have the advantage that I don't have to have local function stubs in the 9p-local.c anymore.
To the licence: I asked because I know that other projects have a formal process to cope with this - like a written agreement to be bound to the license.
Best regards,
Michael
Signature · 14 lines
ZfT - Zentrum für Telematik e.V. Michael Fritscher Magdalene-Schoch-Straße 5 97074 Würzburg Tel: +49 (931) 615 633 - 57 Fax: +49 (931) 615 633 - 11 Email: [email protected] Web: http://www.telematik-zentrum.de Vorstand: Prof. Dr. Klaus Schilling, Hans-Joachim Leistner Sitz: Gerbrunn USt.-ID Nr.: DE 257 244 580, Steuer-Nr.: 257/111/70203 Amtsgericht Würzburg, Vereinsregister-Nr.: VR 200 167
begin:vcard
fn:Michael Fritscher
n:Fritscher;Michael org;quoted-printable:Zentrum f=C3=BCr Telematik adr:;;Allesgrundweg 12;Gerbrunn;Bayern;97218;Deutschland email;internet:[email protected] tel;work:+49 (931) 3 29 29 54 - 21
tel;fax:+49 (931) 3 29 29 54 - 11 url:http://www.telematik-zentrum.de
version:2.1
end:vcard
Quoted 7 lines · On Mon, 11 Apr 2016 16:37:11 +0200 Michael Fritscher…
Hello Greg,
thanks for your answer! Yes, I already jumped in - I was surprised how fast it went. I was afraid of much bigger problems ;-) I've a already a V2 nearly ready :-) As a teaser: Fixed read/write support and the possibility to execute binaries from the mountpoint.
I guess I'll wait for your V2 then :)
Quoted 3 lines
Yes, I decided not to copy the
9p-local.c, because I had to change not as many places I thought in the first place.
That's cool to hear as I was a bit afraid of the huge code duplication.
Quoted 5 lines
I'm wondering about the xattr stuff... Perhaps I try to remove the <
sys/xattr.h> fromhw/9pfs/9p-xattr.hand #ifdef the things which are broken afterwards. That would have the advantage that I don't have to have local function stubs in the9p-local.canymore.
It makes sense as I'm not sure all files really need to include this.
Quoted 4 lines
To the licence: I asked because I know that other projects have a formal process to cope with this - like a written agreement to be bound to the license.
I'm not aware of any such thing with QEMU.
Quoted 4 lines
Best regards,
Michael
Cheers.
--
Greg
Quoted 10 lines · Michael Fritscher
Hello Greg,
thanks for your answer! Yes, I already jumped in - I was surprised how fast it went. I was afraid of much bigger problems ;-) I've a already a V2 nearly ready :-) As a teaser: Fixed read/write support and the possibility to execute binaries from the mountpoint.
Yes, I decided not to copy the
9p-local.c, because I had to change not as many places I thought in the first place.
Quoted 8 lines
I'm wondering about the xattr stuff... Perhaps I try to remove the <
sys/xattr.h> fromhw/9pfs/9p-xattr.hand #ifdef the things which are broken afterwards. That would have the advantage that I don't have to have local function stubs in the9p-local.canymore.To the licence: I asked because I know that other projects have a formal process to cope with this - like a written agreement to be bound to the license.
We don't do formal CLAs. Instead, we follow the kernel's lead and require Signed-off-by.
http://wiki.qemu-project.org/Contribute/SubmitAPatch#Patch_emails_must_include_a_Signed-off-by:_line
Please stick to GPLv2+ for new work, unless you have a really good reason not to.
http://wiki.qemu-project.org/License