tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
File sharing over virtio-9p
Hi,
The following two patches enables a NetBSD guest running
on a Linux KVM to share files with its host over virtio-9p.
https://www.netbsd.org/~ozaki-r/vio9p.diff
https://www.netbsd.org/~ozaki-r/mount_9p-cdev.diff
The first patch exports a 9p endpoint of virtio-9p via a character
device (e.g., /dev/vio9p0) and the second one extends mount_9p
(puffs) to talk with a 9p server inside qemu via the character device.
[Usage]
Export a directory of a host via virtio-9p. The below XML is part of
a libvirt domain configuration. It exports "/var/lib/libvirt/export"
directory with a tag "test". If it is the first entry, it will have
minor number 0 and /dev/vio9p0 is assigned to it typically.
<filesystem type='mount' accessmode='mapped'>
<source dir='/var/lib/libvirt/export'/>
<target dir='test'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03'
function='0x0'/>
</filesystem>
A boot log of vio9p looks like this:
virtio0 at pci0 dev 3 function 0
virtio0: Virtio 9P Transport Device (rev. 0x00)
vio9p0 at virtio0: Features: 0x10000000<INDIRECT_DESC>
virtio0: allocated 12288 byte for virtqueue 0 for vio9p, size 128
virtio0: using 4096 byte (256 entries) indirect descriptors
vio9p0: tagged as test
virtio0: interrupting at ioapic0 pin 11
A NetBSD guest can mount the exported directory with mount_9p.
mount_9p -cu /dev/vio9p0 /mnt/9p
-c tells mount_9p to interpret the first argument as a character
device file to talk with.
Have fun,
ozaki-r
Home |
Main Index |
Thread Index |
Old Index