diff options
Diffstat (limited to 'fsdev')
-rw-r--r-- | fsdev/file-op-9p.h | 4 | ||||
-rw-r--r-- | fsdev/qemu-fsdev.c | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h index 908e2a5edc..5788ff911c 100644 --- a/fsdev/file-op-9p.h +++ b/fsdev/file-op-9p.h @@ -56,10 +56,12 @@ typedef struct extended_ops { * On failure ignore the error. */ #define V9FS_SM_NONE 0x00000010 - +#define V9FS_RDONLY 0x00000020 #define V9FS_SEC_MASK 0x0000001C + + typedef struct FsContext { uid_t uid; 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; |