From 2c74c2cb4bedddbfa67628fbd5f9273b4e0e9903 Mon Sep 17 00:00:00 2001 From: "M. Mohan Kumar" Date: Tue, 25 Oct 2011 12:10:39 +0530 Subject: hw/9pfs: Read-only support for 9p export A new fsdev parameter "readonly" is introduced to control accessing 9p export. "readonly" can be used to specify the access type. By default "rw" access is given to 9p export. Signed-off-by: M. Mohan Kumar Signed-off-by: Aneesh Kumar K.V --- vl.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'vl.c') diff --git a/vl.c b/vl.c index 1ddb17b..c51a740 100644 --- a/vl.c +++ b/vl.c @@ -2707,6 +2707,8 @@ int main(int argc, char **argv, char **envp) qemu_opt_set(fsdev, "security_model", qemu_opt_get(opts, "security_model")); + qemu_opt_set_bool(fsdev, "readonly", + 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", -- cgit v1.1 From 9db221ae73a18e0bd2b1ee6c7dc1904ed06fb464 Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" Date: Tue, 25 Oct 2011 12:10:40 +0530 Subject: hw/9pfs: Add synthetic file system support using 9p This patch create a synthetic file system with mount tag v_synth when -virtfs_synth command line option is specified in qemu. The synthetic file system can be mounted in guest using 9p using the below command line mount -t 9p -oversion=9p2000.L,trans=virtio v_synth Synthetic file system enabled different qemu subsystem to register callbacks for read and write events from guest. The subsystem can create directories and files in the synthetic file system as show in ex below qemu_v9fs_synth_mkdir(NULL, 0777, "test2", &node); qemu_v9fs_synth_add_file(node, 0777, "testfile", my_test_read, NULL, NULL); Signed-off-by: Aneesh Kumar K.V --- vl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'vl.c') diff --git a/vl.c b/vl.c index c51a740..37a79e5 100644 --- a/vl.c +++ b/vl.c @@ -2717,6 +2717,24 @@ int main(int argc, char **argv, char **envp) qemu_opt_get(opts, "mount_tag")); break; } + case QEMU_OPTION_virtfs_synth: { + QemuOpts *fsdev; + QemuOpts *device; + + fsdev = qemu_opts_create(qemu_find_opts("fsdev"), "v_synth", 1); + if (!fsdev) { + fprintf(stderr, "duplicate option: %s\n", "virtfs_synth"); + exit(1); + } + qemu_opt_set(fsdev, "fsdriver", "synth"); + qemu_opt_set(fsdev, "path", "/"); /* ignored */ + + device = qemu_opts_create(qemu_find_opts("device"), NULL, 0); + qemu_opt_set(device, "driver", "virtio-9p-pci"); + qemu_opt_set(device, "fsdev", "v_synth"); + qemu_opt_set(device, "mount_tag", "v_synth"); + break; + } case QEMU_OPTION_serial: add_device_config(DEV_SERIAL, optarg); default_serial = 0; -- cgit v1.1