aboutsummaryrefslogtreecommitdiff
path: root/fsdev/qemu-fsdev.c
diff options
context:
space:
mode:
authorM. Mohan Kumar <mohan@in.ibm.com>2011-10-25 12:10:39 +0530
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-10-31 12:34:17 +0530
commit2c74c2cb4bedddbfa67628fbd5f9273b4e0e9903 (patch)
tree308232ce3bd97b8e9641c88b396ed3e9c5009d90 /fsdev/qemu-fsdev.c
parentf02b77c9bfc5c3ac93a89026f8c1d320f61f02c9 (diff)
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 <mohan@in.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Diffstat (limited to 'fsdev/qemu-fsdev.c')
-rw-r--r--fsdev/qemu-fsdev.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c
index 5977bcca4c..27d10cb3b3 100644
--- a/fsdev/qemu-fsdev.c
+++ b/fsdev/qemu-fsdev.c
@@ -35,7 +35,7 @@ int qemu_fsdev_add(QemuOpts *opts)
const char *path = qemu_opt_get(opts, "path");
const char *sec_model = qemu_opt_get(opts, "security_model");
const char *writeout = qemu_opt_get(opts, "writeout");
-
+ bool ro = qemu_opt_get_bool(opts, "readonly", 0);
if (!fsdev_id) {
fprintf(stderr, "fsdev: No id specified\n");
@@ -86,6 +86,11 @@ int qemu_fsdev_add(QemuOpts *opts)
fsle->fse.export_flags |= V9FS_IMMEDIATE_WRITEOUT;
}
}
+ if (ro) {
+ fsle->fse.export_flags |= V9FS_RDONLY;
+ } else {
+ fsle->fse.export_flags &= ~V9FS_RDONLY;
+ }
if (strcmp(fsdriver, "local")) {
goto done;