[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] virtfs: allow a device id to be specified in the -v
From: |
Chris Webb |
Subject: |
[Qemu-devel] [PATCH] virtfs: allow a device id to be specified in the -virtfs option |
Date: |
Thu, 24 Nov 2011 16:04:00 +0000 |
When using a virtfs root filesystem, the mount_tag needs to be set to
/dev/root. This can be done long-hand as
-fsdev local,id=root,path=/path/to/rootfs,...
-device virtio-9p-pci,fsdev=root,mount_tag=/dev/root
but the -virtfs shortcut cannot be used as it hard-codes the device identifier
to match the mount_tag, and device identifiers may not contain '/':
$ qemu-system-x86_64 -virtfs
local,path=/foo,mount_tag=/dev/root,security_model=passthrough
qemu-system-x86_64: -virtfs
local,path=/foo,mount_tag=/dev/root,security_model=passthrough: Parameter 'id'
expects an identifier
Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.
duplicate fsdev id: /dev/root
To support this case using -virtfs, we allow the device identifier to be
specified explicitly when the mount_tag is not suitable:
-virtfs local,id=root,path=/path/to/rootfs,mount_tag=/dev/root,...
Signed-off-by: Chris Webb <address@hidden>
---
qemu-options.hx | 4 ++--
vl.c | 16 +++++++++++-----
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index 681eaf1..865e3a2 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -588,13 +588,13 @@ DEFHEADING()
DEFHEADING(Virtual File system pass-through options:)
DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs,
- "-virtfs
local,path=path,mount_tag=tag,security_model=[mapped|passthrough|none]\n"
+ "-virtfs
local[,id=id],path=path,mount_tag=tag,security_model=[mapped|passthrough|none]\n"
" [,writeout=immediate][,readonly]\n",
QEMU_ARCH_ALL)
STEXI
address@hidden -virtfs
@var{fsdriver},address@hidden,address@hidden,address@hidden,address@hidden,readonly]
address@hidden -virtfs
@var{fsdriver}[,address@hidden,address@hidden,address@hidden,address@hidden,address@hidden,readonly]
@findex -virtfs
The general form of a Virtual File system pass-through options are:
diff --git a/vl.c b/vl.c
index f5afed4..b17af09 100644
--- a/vl.c
+++ b/vl.c
@@ -2689,10 +2689,17 @@ int main(int argc, char **argv, char **envp)
"mount_tag=tag.\n");
exit(1);
}
- fsdev = qemu_opts_create(qemu_find_opts("fsdev"),
- qemu_opt_get(opts, "mount_tag"), 1);
+
+ if (qemu_opts_id(opts)) {
+ fsdev = qemu_opts_create(qemu_find_opts("fsdev"),
+ qemu_opts_id(opts), 1);
+ } else {
+ fsdev = qemu_opts_create(qemu_find_opts("fsdev"),
+ qemu_opt_get(opts, "mount_tag"), 1);
+ }
+
if (!fsdev) {
- fprintf(stderr, "duplicate fsdev id: %s\n",
+ fprintf(stderr, "duplicate or invalid fsdev id: %s\n",
qemu_opt_get(opts, "mount_tag"));
exit(1);
}
@@ -2716,8 +2723,7 @@ int main(int argc, char **argv, char **envp)
qemu_opt_get_bool(opts, "readonly", 0));
device = qemu_opts_create(qemu_find_opts("device"), NULL, 0);
qemu_opt_set(device, "driver", "virtio-9p-pci");
- qemu_opt_set(device, "fsdev",
- qemu_opt_get(opts, "mount_tag"));
+ qemu_opt_set(device, "fsdev", qemu_opts_id(fsdev));
qemu_opt_set(device, "mount_tag",
qemu_opt_get(opts, "mount_tag"));
break;
--
1.7.5.4
- [Qemu-devel] [PATCH] virtfs: allow a device id to be specified in the -virtfs option,
Chris Webb <=