1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-30 08:19:09 +00:00
freebsd/sys/dev/virtio
Doug Rabson e97ad33a89 Add an implementation of the 9P filesystem
This is derived from swills@ fork of the Juniper virtfs with many
changes by me including bug fixes, style improvements, clearer layering
and more consistent logging. The filesystem is renamed to p9fs to better
reflect its function and to prevent possible future confusion with
virtio-fs.

Several updates and fixes from Juniper have been integrated into this
version by Val Packett and these contributions along with the original
Juniper authors are credited below.

To use this with bhyve, add 'virtio_p9fs_load=YES' to loader.conf. The
bhyve virtio-9p device allows access from the guest to files on the host
by mapping a 'sharename' to a host path. It is possible to use p9fs as a
root filesystem by adding this to /boot/loader.conf:

	vfs.root.mountfrom="p9fs:sharename"

for non-root filesystems add something like this to /etc/fstab:

	sharename /mnt p9fs rw 0 0

In both examples, substitute the share name used on the bhyve command
line.

The 9P filesystem protocol relies on stateful file opens which map
protocol-level FIDs to host file descriptors. The FreeBSD vnode
interface doesn't really support this and we use heuristics to guess the
right FID to use for file operations.  This can be confused by privilege
lowering and does not guarantee that the FID created for a given file
open is always used for file operations, even if the calling process is
using the file descriptor from the original open call. Improving this
would involve changes to the vnode interface which is out-of-scope for
this import.

Differential Revision: https://reviews.freebsd.org/D41844
Reviewed by: kib, emaste, dch
MFC after: 3 months
Co-authored-by: Val Packett <val@packett.cool>
Co-authored-by: Ka Ho Ng <kahon@juniper.net>
Co-authored-by: joyu <joyul@juniper.net>
Co-authored-by: Kumara Babu Narayanaswamy <bkumara@juniper.net>
2024-06-19 13:12:04 +01:00
..
balloon sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
block sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
console virtio(4): Fix two typos in KASSERT messages 2024-06-16 18:02:46 +02:00
gpu vtgpu: Fix the physical memory size 2023-09-21 11:50:29 +01:00
mmio sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
network vtnet: use CURVNET_SET() instead of CURVNET_SET_QUIET() 2024-04-18 07:58:00 -07:00
p9fs Add an implementation of the 9P filesystem 2024-06-19 13:12:04 +01:00
pci virtio: Use device_set_descf() 2024-06-02 19:38:41 -04:00
random sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
scmi vtscmi: Add a virtio-scmi driver 2024-04-11 09:58:56 +00:00
scsi sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
virtio_bus_if.m virtio: remove virtio_alloc_virtqueues' flags arg 2023-09-18 22:03:31 +02:00
virtio_config.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
virtio_endian.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
virtio_ids.h vtscmi: Add a virtio-scmi driver 2024-04-11 09:58:56 +00:00
virtio_if.m sys: Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:54:58 -06:00
virtio_ring.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
virtio.c vtscmi: Add a virtio-scmi driver 2024-04-11 09:58:56 +00:00
virtio.h virtio: remove virtio_alloc_virtqueues' flags arg 2023-09-18 22:03:31 +02:00
virtqueue.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
virtqueue.h virtio: use bool for boolean functions 2023-09-18 22:03:26 +02:00