diff options
| author | Mark Johnston <markj@freebsd.org> | 2025-08-06 13:53:08 -0400 |
|---|---|---|
| committer | Christian Schoenebeck <qemu_oss@crudebyte.com> | 2025-09-18 21:21:29 +0200 |
| commit | 6657f3bb55edba8f068cbc9ac40bb230ea1d7a09 (patch) | |
| tree | c5d7a2bcc42ceb5aca6f17d48834ef705ab5aca4 /fsdev | |
| parent | e7c1e8043a69c5a8efa39d4f9d111f7c72c076e6 (diff) | |
| download | qemu-6657f3bb55edba8f068cbc9ac40bb230ea1d7a09.tar.gz qemu-6657f3bb55edba8f068cbc9ac40bb230ea1d7a09.zip | |
9pfs: Add FreeBSD support
This is largely derived from existing Darwin support. FreeBSD
apparently has better support for *at() system calls so doesn't require
workarounds for a missing mknodat(). The implementation has a couple of
warts however:
- The extattr(2) system calls don't support anything akin to
XATTR_CREATE or XATTR_REPLACE, so a racy workaround is implemented.
- Attribute names cannot begin with "user." or "system." on ZFS.
However FreeBSD's extattr(2) system calls support two dedicated
namespaces for these two. So "user." or "system." prefixes are
trimmed off from attribute names and instead EXTATTR_NAMESPACE_USER or
EXTATTR_NAMESPACE_SYSTEM are picked and passed to extattr system calls
accordingly.
The 9pfs tests were verified to pass on the UFS, ZFS and tmpfs
filesystems.
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Link: https://lore.kernel.org/qemu-devel/aJOWhHB2p-fbueAm@nuc
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Diffstat (limited to 'fsdev')
| -rw-r--r-- | fsdev/file-op-9p.h | 6 | ||||
| -rw-r--r-- | fsdev/meson.build | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h index b9dae8c84c..b85c9934de 100644 --- a/fsdev/file-op-9p.h +++ b/fsdev/file-op-9p.h @@ -21,9 +21,11 @@ #ifdef CONFIG_LINUX # include <sys/vfs.h> -#endif -#ifdef CONFIG_DARWIN +#elif defined(CONFIG_DARWIN) || defined(CONFIG_FREEBSD) # include <sys/param.h> +# ifdef CONFIG_FREEBSD +# undef MACHINE /* work around some unfortunate namespace pollution */ +# endif # include <sys/mount.h> #endif diff --git a/fsdev/meson.build b/fsdev/meson.build index c751d8cb62..95fe816604 100644 --- a/fsdev/meson.build +++ b/fsdev/meson.build @@ -5,6 +5,6 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files( '9p-marshal.c', 'qemu-fsdev.c', ), if_false: files('qemu-fsdev-dummy.c')) -if host_os in ['linux', 'darwin'] +if host_os in ['linux', 'darwin', 'freebsd'] system_ss.add_all(fsdev_ss) endif |
