[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-trivial] [PULL 16/23] virtfs: allow a device id to be specified in
From: |
Michael Tokarev |
Subject: |
[Qemu-trivial] [PULL 16/23] virtfs: allow a device id to be specified in the -virtfs option |
Date: |
Sun, 7 May 2017 10:02:19 +0300 |
From: Chris Webb <address@hidden>
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: 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>
Signed-off-by: Michael Tokarev <address@hidden>
---
qemu-options.hx | 2 +-
vl.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/qemu-options.hx b/qemu-options.hx
index a24fef2107..a5b0589cb7 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -876,7 +876,7 @@ ETEXI
DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs,
"-virtfs
local,path=path,mount_tag=tag,security_model=[mapped-xattr|mapped-file|passthrough|none]\n"
- "
[,writeout=immediate][,readonly][,socket=socket|sock_fd=sock_fd]\n",
+ "
[,id=id][,writeout=immediate][,readonly][,socket=socket|sock_fd=sock_fd]\n",
QEMU_ARCH_ALL)
STEXI
diff --git a/vl.c b/vl.c
index 42d4bce439..10f3afd860 100644
--- a/vl.c
+++ b/vl.c
@@ -3524,10 +3524,11 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
fsdev = qemu_opts_create(qemu_find_opts("fsdev"),
+ qemu_opts_id(opts) ?:
qemu_opt_get(opts, "mount_tag"),
1, NULL);
if (!fsdev) {
- error_report("duplicate fsdev id: %s",
+ error_report("duplicate or invalid fsdev id: %s",
qemu_opt_get(opts, "mount_tag"));
exit(1);
}
@@ -3565,7 +3566,7 @@ int main(int argc, char **argv, char **envp)
&error_abort);
qemu_opt_set(device, "driver", "virtio-9p-pci", &error_abort);
qemu_opt_set(device, "fsdev",
- qemu_opt_get(opts, "mount_tag"), &error_abort);
+ qemu_opts_id(fsdev), &error_abort);
qemu_opt_set(device, "mount_tag",
qemu_opt_get(opts, "mount_tag"), &error_abort);
break;
--
2.11.0
- [Qemu-trivial] [PULL 02/23] ppc_booke: drop useless assignment, (continued)
- [Qemu-trivial] [PULL 02/23] ppc_booke: drop useless assignment, Michael Tokarev, 2017/05/07
- [Qemu-trivial] [PULL 07/23] device_tree: fix compiler warnings (clang 5), Michael Tokarev, 2017/05/07
- [Qemu-trivial] [PULL 18/23] scripts: Switch to more portable Perl shebang, Michael Tokarev, 2017/05/07
- [Qemu-trivial] [PULL 22/23] MAINTAINERS: Update paths for AioContext implementation, Michael Tokarev, 2017/05/07
- [Qemu-trivial] [PULL 10/23] block: Make 'replication_state' an enum, Michael Tokarev, 2017/05/07
- [Qemu-trivial] [PULL 17/23] scripts/qemu-binfmt-conf.sh: Fix shell portability issue, Michael Tokarev, 2017/05/07
- [Qemu-trivial] [PULL 05/23] tests: Ignore more test executables, Michael Tokarev, 2017/05/07
- [Qemu-trivial] [PULL 03/23] doc: fix function spelling, Michael Tokarev, 2017/05/07
- [Qemu-trivial] [PULL 20/23] jazz_led: fix bad snprintf, Michael Tokarev, 2017/05/07
- [Qemu-trivial] [PULL 21/23] MAINTAINERS: Update paths for main loop, Michael Tokarev, 2017/05/07
- [Qemu-trivial] [PULL 16/23] virtfs: allow a device id to be specified in the -virtfs option,
Michael Tokarev <=
- Re: [Qemu-trivial] [Qemu-devel] [PULL 00/23] Trivial patches for 2017-05-07, no-reply, 2017/05/07
- Re: [Qemu-trivial] [Qemu-devel] [PULL 00/23] Trivial patches for 2017-05-07, Stefan Hajnoczi, 2017/05/08