* [Qemu-devel] [PATCH 1/2] Add opt_set_bool function
@ 2011-10-12 7:53 M. Mohan Kumar
2011-10-12 7:53 ` [Qemu-devel] [PATCH V4 2/2] hw/9pfs: Add readonly support for 9p export M. Mohan Kumar
2011-10-12 16:17 ` [Qemu-devel] [PATCH 1/2] Add opt_set_bool function Andreas Färber
0 siblings, 2 replies; 6+ messages in thread
From: M. Mohan Kumar @ 2011-10-12 7:53 UTC (permalink / raw)
To: qemu-devel
In addition to qemu_opt_set function, we need a function to set bool value
also.
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
---
qemu-option.c | 35 +++++++++++++++++++++++++++++++++++
qemu-option.h | 1 +
2 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/qemu-option.c b/qemu-option.c
index 105d760..d6bc908 100644
--- a/qemu-option.c
+++ b/qemu-option.c
@@ -636,6 +636,41 @@ int qemu_opt_set(QemuOpts *opts, const char *name, const char *value)
return 0;
}
+int qemu_opt_set_bool(QemuOpts *opts, const char *name, int val)
+{
+ QemuOpt *opt;
+ const QemuOptDesc *desc = opts->list->desc;
+ int i;
+
+ for (i = 0; desc[i].name != NULL; i++) {
+ if (strcmp(desc[i].name, name) == 0) {
+ break;
+ }
+ }
+ if (desc[i].name == NULL) {
+ if (i == 0) {
+ /* empty list -> allow any */;
+ } else {
+ qerror_report(QERR_INVALID_PARAMETER, name);
+ return -1;
+ }
+ }
+
+ opt = g_malloc0(sizeof(*opt));
+ opt->name = g_strdup(name);
+ opt->opts = opts;
+ QTAILQ_INSERT_TAIL(&opts->head, opt, next);
+ if (desc[i].name != NULL) {
+ opt->desc = desc+i;
+ }
+ opt->value.boolean = !!val;
+ if (qemu_opt_parse(opt) < 0) {
+ qemu_opt_del(opt);
+ return -1;
+ }
+ return 0;
+}
+
int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
int abort_on_failure)
{
diff --git a/qemu-option.h b/qemu-option.h
index b515813..af4d36b 100644
--- a/qemu-option.h
+++ b/qemu-option.h
@@ -109,6 +109,7 @@ int qemu_opt_get_bool(QemuOpts *opts, const char *name, int defval);
uint64_t qemu_opt_get_number(QemuOpts *opts, const char *name, uint64_t defval);
uint64_t qemu_opt_get_size(QemuOpts *opts, const char *name, uint64_t defval);
int qemu_opt_set(QemuOpts *opts, const char *name, const char *value);
+int qemu_opt_set_bool(QemuOpts *opts, const char *name, int val);
typedef int (*qemu_opt_loopfunc)(const char *name, const char *value, void *opaque);
int qemu_opt_foreach(QemuOpts *opts, qemu_opt_loopfunc func, void *opaque,
int abort_on_failure);
--
1.7.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH V4 2/2] hw/9pfs: Add readonly support for 9p export
2011-10-12 7:53 [Qemu-devel] [PATCH 1/2] Add opt_set_bool function M. Mohan Kumar
@ 2011-10-12 7:53 ` M. Mohan Kumar
2011-10-12 14:08 ` Aneesh Kumar K.V
2011-10-12 16:17 ` [Qemu-devel] [PATCH 1/2] Add opt_set_bool function Andreas Färber
1 sibling, 1 reply; 6+ messages in thread
From: M. Mohan Kumar @ 2011-10-12 7:53 UTC (permalink / raw)
To: qemu-devel
A new fsdev parameter "readonly" is introduced to control accessing 9p export.
readonly=on|off can be used to specify the access type. By default rw
access is given.
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
---
Changes from previous version V3:
* Use opt_set_bool function to set readonly option
* Change the flag from MS_READONLY to 9p specific
Change from previous version V2:
* QEMU_OPT_BOOL is used for readdonly parameter
Changes from previous version:
* Use "readonly" option instead of "access"
* Change function return type to boolean where its needed
fsdev/file-op-9p.h | 3 +-
fsdev/qemu-fsdev.c | 12 +++++++++-
fsdev/qemu-fsdev.h | 1 +
hw/9pfs/virtio-9p-device.c | 3 ++
hw/9pfs/virtio-9p.c | 46 ++++++++++++++++++++++++++++++++++++++++++++
qemu-config.c | 7 ++++++
vl.c | 2 +
7 files changed, 71 insertions(+), 3 deletions(-)
diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h
index 33fb07f..b75290d 100644
--- a/fsdev/file-op-9p.h
+++ b/fsdev/file-op-9p.h
@@ -58,7 +58,8 @@ typedef struct extended_ops {
} extended_ops;
/* FsContext flag values */
-#define PATHNAME_FSCONTEXT 0x1
+#define PATHNAME_FSCONTEXT 0x1
+#define P9_RDONLY_EXPORT 0x2
/* cache flags */
#define V9FS_WRITETHROUGH_CACHE 0x1
diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c
index d08ba9c..f8a8227 100644
--- a/fsdev/qemu-fsdev.c
+++ b/fsdev/qemu-fsdev.c
@@ -29,13 +29,13 @@ static FsTypeTable FsTypes[] = {
int qemu_fsdev_add(QemuOpts *opts)
{
struct FsTypeListEntry *fsle;
- int i;
+ int i, flags = 0;
const char *fsdev_id = qemu_opts_id(opts);
const char *fstype = qemu_opt_get(opts, "fstype");
const char *path = qemu_opt_get(opts, "path");
const char *sec_model = qemu_opt_get(opts, "security_model");
const char *cache = qemu_opt_get(opts, "cache");
-
+ int rdonly = qemu_opt_get_bool(opts, "readonly", 0);
if (!fsdev_id) {
fprintf(stderr, "fsdev: No id specified\n");
@@ -76,6 +76,14 @@ int qemu_fsdev_add(QemuOpts *opts)
fsle->fse.cache_flags = V9FS_WRITETHROUGH_CACHE;
}
}
+ if (rdonly) {
+ flags |= P9_RDONLY_EXPORT;
+ } else {
+ flags &= ~P9_RDONLY_EXPORT;
+ }
+
+ fsle->fse.flags = flags;
+
QTAILQ_INSERT_TAIL(&fstype_entries, fsle, next);
return 0;
}
diff --git a/fsdev/qemu-fsdev.h b/fsdev/qemu-fsdev.h
index 0f67880..2938eaf 100644
--- a/fsdev/qemu-fsdev.h
+++ b/fsdev/qemu-fsdev.h
@@ -44,6 +44,7 @@ typedef struct FsTypeEntry {
char *security_model;
int cache_flags;
FileOperations *ops;
+ int flags;
} FsTypeEntry;
typedef struct FsTypeListEntry {
diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index 1846e36..336292c 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -125,6 +125,9 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf)
s->tag_len = len;
s->ctx.uid = -1;
s->ctx.flags = 0;
+ if (fse->flags & P9_RDONLY_EXPORT) {
+ s->ctx.flags |= P9_RDONLY_EXPORT;
+ }
s->ops = fse->ops;
s->vdev.get_features = virtio_9p_get_features;
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index 47ed2f1..9f15787 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -1271,6 +1271,11 @@ static void v9fs_fix_path(V9fsPath *dst, V9fsPath *src, int len)
dst->size++;
}
+static inline bool is_ro_export(FsContext *fs_ctx)
+{
+ return fs_ctx->flags & P9_RDONLY_EXPORT;
+}
+
static void v9fs_version(void *opaque)
{
V9fsPDU *pdu = opaque;
@@ -1690,6 +1695,14 @@ static void v9fs_open(void *opaque)
} else {
flags = omode_to_uflags(mode);
}
+ if (is_ro_export(&s->ctx)) {
+ if (mode & O_WRONLY || mode & O_RDWR || mode & O_APPEND) {
+ err = -EROFS;
+ goto out;
+ } else {
+ flags |= O_NOATIME;
+ }
+ }
err = v9fs_co_open(pdu, fidp, flags);
if (err < 0) {
goto out;
@@ -3301,6 +3314,33 @@ static void v9fs_op_not_supp(void *opaque)
complete_pdu(pdu->s, pdu, -EOPNOTSUPP);
}
+static inline bool is_read_only_op(int id)
+{
+ switch (id) {
+ case P9_TREADDIR:
+ case P9_TSTATFS:
+ case P9_TGETATTR:
+ case P9_TXATTRWALK:
+ case P9_TLOCK:
+ case P9_TGETLOCK:
+ case P9_TREADLINK:
+ case P9_TVERSION:
+ case P9_TLOPEN:
+ case P9_TATTACH:
+ case P9_TSTAT:
+ case P9_TWALK:
+ case P9_TCLUNK:
+ case P9_TFSYNC:
+ case P9_TOPEN:
+ case P9_TREAD:
+ case P9_TAUTH:
+ case P9_TFLUSH:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
static void submit_pdu(V9fsState *s, V9fsPDU *pdu)
{
Coroutine *co;
@@ -3312,6 +3352,12 @@ static void submit_pdu(V9fsState *s, V9fsPDU *pdu)
} else {
handler = pdu_co_handlers[pdu->id];
}
+
+ if (is_ro_export(&s->ctx) && !is_read_only_op(pdu->id)) {
+ complete_pdu(s, pdu, -EROFS);
+ return;
+ }
+
co = qemu_coroutine_create(handler);
qemu_coroutine_enter(co, pdu);
}
diff --git a/qemu-config.c b/qemu-config.c
index b2ab0b2..5cad718 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -180,7 +180,11 @@ QemuOptsList qemu_fsdev_opts = {
}, {
.name = "cache",
.type = QEMU_OPT_STRING,
+ }, {
+ .name = "readonly",
+ .type = QEMU_OPT_BOOL,
},
+
{ /*End of list */ }
},
};
@@ -205,6 +209,9 @@ QemuOptsList qemu_virtfs_opts = {
}, {
.name = "cache",
.type = QEMU_OPT_STRING,
+ }, {
+ .name = "readonly",
+ .type = QEMU_OPT_BOOL,
},
{ /*End of list */ }
diff --git a/vl.c b/vl.c
index cab4002..04ffb26 100644
--- a/vl.c
+++ b/vl.c
@@ -2848,6 +2848,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",
--
1.7.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH V4 2/2] hw/9pfs: Add readonly support for 9p export
2011-10-12 7:53 ` [Qemu-devel] [PATCH V4 2/2] hw/9pfs: Add readonly support for 9p export M. Mohan Kumar
@ 2011-10-12 14:08 ` Aneesh Kumar K.V
2011-10-12 15:31 ` M. Mohan Kumar
0 siblings, 1 reply; 6+ messages in thread
From: Aneesh Kumar K.V @ 2011-10-12 14:08 UTC (permalink / raw)
To: M. Mohan Kumar, qemu-devel
On Wed, 12 Oct 2011 13:23:34 +0530, "M. Mohan Kumar" <mohan@in.ibm.com> wrote:
> A new fsdev parameter "readonly" is introduced to control accessing 9p export.
> readonly=on|off can be used to specify the access type. By default rw
> access is given.
>
> Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
> ---
> Changes from previous version V3:
> * Use opt_set_bool function to set readonly option
> * Change the flag from MS_READONLY to 9p specific
>
> Change from previous version V2:
> * QEMU_OPT_BOOL is used for readdonly parameter
>
> Changes from previous version:
> * Use "readonly" option instead of "access"
> * Change function return type to boolean where its needed
>
> fsdev/file-op-9p.h | 3 +-
> fsdev/qemu-fsdev.c | 12 +++++++++-
> fsdev/qemu-fsdev.h | 1 +
> hw/9pfs/virtio-9p-device.c | 3 ++
> hw/9pfs/virtio-9p.c | 46 ++++++++++++++++++++++++++++++++++++++++++++
> qemu-config.c | 7 ++++++
> vl.c | 2 +
> 7 files changed, 71 insertions(+), 3 deletions(-)
>
> diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h
> index 33fb07f..b75290d 100644
> --- a/fsdev/file-op-9p.h
> +++ b/fsdev/file-op-9p.h
> @@ -58,7 +58,8 @@ typedef struct extended_ops {
> } extended_ops;
>
> /* FsContext flag values */
> -#define PATHNAME_FSCONTEXT 0x1
> +#define PATHNAME_FSCONTEXT 0x1
why ?
> +#define P9_RDONLY_EXPORT 0x2
>
> /* cache flags */
> #define V9FS_WRITETHROUGH_CACHE 0x1
> diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c
> index d08ba9c..f8a8227 100644
> --- a/fsdev/qemu-fsdev.c
> +++ b/fsdev/qemu-fsdev.c
> @@ -29,13 +29,13 @@ static FsTypeTable FsTypes[] = {
> int qemu_fsdev_add(QemuOpts *opts)
> {
> struct FsTypeListEntry *fsle;
> - int i;
> + int i, flags = 0;
> const char *fsdev_id = qemu_opts_id(opts);
> const char *fstype = qemu_opt_get(opts, "fstype");
> const char *path = qemu_opt_get(opts, "path");
> const char *sec_model = qemu_opt_get(opts, "security_model");
> const char *cache = qemu_opt_get(opts, "cache");
> -
> + int rdonly = qemu_opt_get_bool(opts, "readonly", 0);
>
> if (!fsdev_id) {
> fprintf(stderr, "fsdev: No id specified\n");
> @@ -76,6 +76,14 @@ int qemu_fsdev_add(QemuOpts *opts)
> fsle->fse.cache_flags = V9FS_WRITETHROUGH_CACHE;
> }
> }
> + if (rdonly) {
> + flags |= P9_RDONLY_EXPORT;
> + } else {
> + flags &= ~P9_RDONLY_EXPORT;
> + }
> +
> + fsle->fse.flags = flags;
> +
> QTAILQ_INSERT_TAIL(&fstype_entries, fsle, next);
> return 0;
> }
> diff --git a/fsdev/qemu-fsdev.h b/fsdev/qemu-fsdev.h
> index 0f67880..2938eaf 100644
> --- a/fsdev/qemu-fsdev.h
> +++ b/fsdev/qemu-fsdev.h
> @@ -44,6 +44,7 @@ typedef struct FsTypeEntry {
> char *security_model;
> int cache_flags;
> FileOperations *ops;
> + int flags;
do we need extra flags ? Why not use cache_flags ? renaming that to
export_flags ?
> } FsTypeEntry;
>
> typedef struct FsTypeListEntry {
> diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
> index 1846e36..336292c 100644
> --- a/hw/9pfs/virtio-9p-device.c
> +++ b/hw/9pfs/virtio-9p-device.c
> @@ -125,6 +125,9 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf)
> s->tag_len = len;
> s->ctx.uid = -1;
> s->ctx.flags = 0;
> + if (fse->flags & P9_RDONLY_EXPORT) {
> + s->ctx.flags |= P9_RDONLY_EXPORT;
> + }
>
> s->ops = fse->ops;
> s->vdev.get_features = virtio_9p_get_features;
> diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
> index 47ed2f1..9f15787 100644
> --- a/hw/9pfs/virtio-9p.c
> +++ b/hw/9pfs/virtio-9p.c
> @@ -1271,6 +1271,11 @@ static void v9fs_fix_path(V9fsPath *dst, V9fsPath *src, int len)
> dst->size++;
> }
>
> +static inline bool is_ro_export(FsContext *fs_ctx)
> +{
> + return fs_ctx->flags & P9_RDONLY_EXPORT;
> +}
> +
> static void v9fs_version(void *opaque)
> {
> V9fsPDU *pdu = opaque;
> @@ -1690,6 +1695,14 @@ static void v9fs_open(void *opaque)
> } else {
> flags = omode_to_uflags(mode);
> }
> + if (is_ro_export(&s->ctx)) {
> + if (mode & O_WRONLY || mode & O_RDWR || mode & O_APPEND) {
> + err = -EROFS;
> + goto out;
> + } else {
> + flags |= O_NOATIME;
> + }
> + }
What about O_TRUNC ?
> err = v9fs_co_open(pdu, fidp, flags);
> if (err < 0) {
> goto out;
> @@ -3301,6 +3314,33 @@ static void v9fs_op_not_supp(void *opaque)
> complete_pdu(pdu->s, pdu, -EOPNOTSUPP);
> }
>
-aneesh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH V4 2/2] hw/9pfs: Add readonly support for 9p export
2011-10-12 14:08 ` Aneesh Kumar K.V
@ 2011-10-12 15:31 ` M. Mohan Kumar
0 siblings, 0 replies; 6+ messages in thread
From: M. Mohan Kumar @ 2011-10-12 15:31 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: qemu-devel
On Wednesday, October 12, 2011 07:38:25 PM Aneesh Kumar K.V wrote:
> On Wed, 12 Oct 2011 13:23:34 +0530, "M. Mohan Kumar" <mohan@in.ibm.com>
wrote:
> > A new fsdev parameter "readonly" is introduced to control accessing 9p
> > export. readonly=on|off can be used to specify the access type. By
> > default rw access is given.
> >
> > Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
> > ---
> > Changes from previous version V3:
> > * Use opt_set_bool function to set readonly option
> > * Change the flag from MS_READONLY to 9p specific
> >
> > Change from previous version V2:
> > * QEMU_OPT_BOOL is used for readdonly parameter
> >
> > Changes from previous version:
> > * Use "readonly" option instead of "access"
> > * Change function return type to boolean where its needed
> >
> > fsdev/file-op-9p.h | 3 +-
> > fsdev/qemu-fsdev.c | 12 +++++++++-
> > fsdev/qemu-fsdev.h | 1 +
> > hw/9pfs/virtio-9p-device.c | 3 ++
> > hw/9pfs/virtio-9p.c | 46
> > ++++++++++++++++++++++++++++++++++++++++++++ qemu-config.c
> > | 7 ++++++
> > vl.c | 2 +
> > 7 files changed, 71 insertions(+), 3 deletions(-)
> >
> > diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h
> > index 33fb07f..b75290d 100644
> > --- a/fsdev/file-op-9p.h
> > +++ b/fsdev/file-op-9p.h
> > @@ -58,7 +58,8 @@ typedef struct extended_ops {
> >
> > } extended_ops;
> >
> > /* FsContext flag values */
> >
> > -#define PATHNAME_FSCONTEXT 0x1
> > +#define PATHNAME_FSCONTEXT 0x1
>
> why ?
It was part of alignment change for above line
>
> > +#define P9_RDONLY_EXPORT 0x2
> >
> > /* cache flags */
> > #define V9FS_WRITETHROUGH_CACHE 0x1
> >
> > diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c
> > index d08ba9c..f8a8227 100644
> > --- a/fsdev/qemu-fsdev.c
> > +++ b/fsdev/qemu-fsdev.c
> > @@ -29,13 +29,13 @@ static FsTypeTable FsTypes[] = {
> >
> > int qemu_fsdev_add(QemuOpts *opts)
> > {
> >
> > struct FsTypeListEntry *fsle;
> >
> > - int i;
> > + int i, flags = 0;
> >
> > const char *fsdev_id = qemu_opts_id(opts);
> > const char *fstype = qemu_opt_get(opts, "fstype");
> > const char *path = qemu_opt_get(opts, "path");
> > const char *sec_model = qemu_opt_get(opts, "security_model");
> > const char *cache = qemu_opt_get(opts, "cache");
> >
> > -
> > + int rdonly = qemu_opt_get_bool(opts, "readonly", 0);
> >
> > if (!fsdev_id) {
> >
> > fprintf(stderr, "fsdev: No id specified\n");
> >
> > @@ -76,6 +76,14 @@ int qemu_fsdev_add(QemuOpts *opts)
> >
> > fsle->fse.cache_flags = V9FS_WRITETHROUGH_CACHE;
> >
> > }
> >
> > }
> >
> > + if (rdonly) {
> > + flags |= P9_RDONLY_EXPORT;
> > + } else {
> > + flags &= ~P9_RDONLY_EXPORT;
> > + }
> > +
> > + fsle->fse.flags = flags;
> > +
> >
> > QTAILQ_INSERT_TAIL(&fstype_entries, fsle, next);
> > return 0;
> >
> > }
> >
> > diff --git a/fsdev/qemu-fsdev.h b/fsdev/qemu-fsdev.h
> > index 0f67880..2938eaf 100644
> > --- a/fsdev/qemu-fsdev.h
> > +++ b/fsdev/qemu-fsdev.h
> > @@ -44,6 +44,7 @@ typedef struct FsTypeEntry {
> >
> > char *security_model;
> > int cache_flags;
> > FileOperations *ops;
> >
> > + int flags;
>
> do we need extra flags ? Why not use cache_flags ? renaming that to
> export_flags ?
Yes, we can use same variable.
>
> > } FsTypeEntry;
> >
> > typedef struct FsTypeListEntry {
> >
> > diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
> > index 1846e36..336292c 100644
> > --- a/hw/9pfs/virtio-9p-device.c
> > +++ b/hw/9pfs/virtio-9p-device.c
> > @@ -125,6 +125,9 @@ VirtIODevice *virtio_9p_init(DeviceState *dev,
> > V9fsConf *conf)
> >
> > s->tag_len = len;
> > s->ctx.uid = -1;
> > s->ctx.flags = 0;
> >
> > + if (fse->flags & P9_RDONLY_EXPORT) {
> > + s->ctx.flags |= P9_RDONLY_EXPORT;
> > + }
> >
> > s->ops = fse->ops;
> > s->vdev.get_features = virtio_9p_get_features;
> >
> > diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
> > index 47ed2f1..9f15787 100644
> > --- a/hw/9pfs/virtio-9p.c
> > +++ b/hw/9pfs/virtio-9p.c
> > @@ -1271,6 +1271,11 @@ static void v9fs_fix_path(V9fsPath *dst, V9fsPath
> > *src, int len)
> >
> > dst->size++;
> >
> > }
> >
> > +static inline bool is_ro_export(FsContext *fs_ctx)
> > +{
> > + return fs_ctx->flags & P9_RDONLY_EXPORT;
> > +}
> > +
> >
> > static void v9fs_version(void *opaque)
> > {
> >
> > V9fsPDU *pdu = opaque;
> >
> > @@ -1690,6 +1695,14 @@ static void v9fs_open(void *opaque)
> >
> > } else {
> >
> > flags = omode_to_uflags(mode);
> >
> > }
> >
> > + if (is_ro_export(&s->ctx)) {
> > + if (mode & O_WRONLY || mode & O_RDWR || mode & O_APPEND) {
> > + err = -EROFS;
> > + goto out;
> > + } else {
> > + flags |= O_NOATIME;
> > + }
> > + }
>
> What about O_TRUNC ?
Thanks, I will include the check for O_TRUNC
>
> > err = v9fs_co_open(pdu, fidp, flags);
> > if (err < 0) {
> >
> > goto out;
> >
> > @@ -3301,6 +3314,33 @@ static void v9fs_op_not_supp(void *opaque)
> >
> > complete_pdu(pdu->s, pdu, -EOPNOTSUPP);
> >
> > }
>
> -aneesh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] Add opt_set_bool function
2011-10-12 7:53 [Qemu-devel] [PATCH 1/2] Add opt_set_bool function M. Mohan Kumar
2011-10-12 7:53 ` [Qemu-devel] [PATCH V4 2/2] hw/9pfs: Add readonly support for 9p export M. Mohan Kumar
@ 2011-10-12 16:17 ` Andreas Färber
2011-10-14 4:24 ` M. Mohan Kumar
1 sibling, 1 reply; 6+ messages in thread
From: Andreas Färber @ 2011-10-12 16:17 UTC (permalink / raw)
To: M. Mohan Kumar; +Cc: qemu-devel
Am 12.10.2011 09:53, schrieb M. Mohan Kumar:
> In addition to qemu_opt_set function, we need a function to set bool value
> also.
>
> Signed-off-by: M. Mohan Kumar<mohan@in.ibm.com>
> ---
> qemu-option.c | 35 +++++++++++++++++++++++++++++++++++
> qemu-option.h | 1 +
> 2 files changed, 36 insertions(+), 0 deletions(-)
>
> diff --git a/qemu-option.c b/qemu-option.c
> index 105d760..d6bc908 100644
> --- a/qemu-option.c
> +++ b/qemu-option.c
> @@ -636,6 +636,41 @@ int qemu_opt_set(QemuOpts *opts, const char *name, const char *value)
> return 0;
> }
>
> +int qemu_opt_set_bool(QemuOpts *opts, const char *name, int val)
Might it make sense to let qemu_opt_{get,set}_bool() use bool type?
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746, AG Nürnberg
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 1/2] Add opt_set_bool function
2011-10-12 16:17 ` [Qemu-devel] [PATCH 1/2] Add opt_set_bool function Andreas Färber
@ 2011-10-14 4:24 ` M. Mohan Kumar
0 siblings, 0 replies; 6+ messages in thread
From: M. Mohan Kumar @ 2011-10-14 4:24 UTC (permalink / raw)
To: Andreas Färber; +Cc: qemu-devel
Andreas,
I will repost the patch with boolean type change.
--
Regards,
M. Mohan Kumar
On Wednesday, October 12, 2011 09:47:48 PM Andreas Färber wrote:
> Am 12.10.2011 09:53, schrieb M. Mohan Kumar:
> > In addition to qemu_opt_set function, we need a function to set bool
> > value also.
> >
> > Signed-off-by: M. Mohan Kumar<mohan@in.ibm.com>
> > ---
> >
> > qemu-option.c | 35 +++++++++++++++++++++++++++++++++++
> > qemu-option.h | 1 +
> > 2 files changed, 36 insertions(+), 0 deletions(-)
> >
> > diff --git a/qemu-option.c b/qemu-option.c
> > index 105d760..d6bc908 100644
> > --- a/qemu-option.c
> > +++ b/qemu-option.c
> > @@ -636,6 +636,41 @@ int qemu_opt_set(QemuOpts *opts, const char *name,
> > const char *value)
> >
> > return 0;
> >
> > }
> >
> > +int qemu_opt_set_bool(QemuOpts *opts, const char *name, int val)
>
> Might it make sense to let qemu_opt_{get,set}_bool() use bool type?
>
> Andreas
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-10-14 4:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-12 7:53 [Qemu-devel] [PATCH 1/2] Add opt_set_bool function M. Mohan Kumar
2011-10-12 7:53 ` [Qemu-devel] [PATCH V4 2/2] hw/9pfs: Add readonly support for 9p export M. Mohan Kumar
2011-10-12 14:08 ` Aneesh Kumar K.V
2011-10-12 15:31 ` M. Mohan Kumar
2011-10-12 16:17 ` [Qemu-devel] [PATCH 1/2] Add opt_set_bool function Andreas Färber
2011-10-14 4:24 ` M. Mohan Kumar
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).