From: Chris Webb <chris@arachsys.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>,
"Venkateswararao Jujjuri (JV)" <jvrao@linux.vnet.ibm.com>,
Chris Webb <chris@arachsys.com>
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 [thread overview]
Message-ID: <8a28dca8b6a0b0528763388f80f3bd06c492494a.1322150640.git.chris@arachsys.com> (raw)
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 <chris@arachsys.com>
---
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
-@item -virtfs @var{fsdriver},path=@var{path},mount_tag=@var{mount_tag},security_model=@var{security_model}[,writeout=@var{writeout}][,readonly]
+@item -virtfs @var{fsdriver}[,id=@var{id}],path=@var{path},mount_tag=@var{mount_tag},security_model=@var{security_model}[,writeout=@var{writeout}][,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
next reply other threads:[~2011-11-24 16:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-24 16:04 Chris Webb [this message]
2011-11-24 16:41 ` [Qemu-devel] [PATCH] virtfs: allow a device id to be specified in the -virtfs option Peter Maydell
2011-11-24 17:08 ` Chris Webb
-- strict thread matches above, loose matches on Subject: below --
2017-04-24 14:32 Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8a28dca8b6a0b0528763388f80f3bd06c492494a.1322150640.git.chris@arachsys.com \
--to=chris@arachsys.com \
--cc=aliguori@us.ibm.com \
--cc=jvrao@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).