diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2011-10-12 20:59:18 +0530 |
---|---|---|
committer | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2011-10-15 15:30:27 +0530 |
commit | c98f1d4a8bb6f779313043d2490093451cf52065 (patch) | |
tree | 8d3f2ad4619bac60cea15c1bc1e28b73011dcd97 | |
parent | 7cca27dfde6435a7846d88e8a1fa927d0ab99919 (diff) |
hw/9pfs: Use export_flag for indicating whether fs driver use path names.
This allows us to remove another member from the struct
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
-rw-r--r-- | fsdev/file-op-9p.h | 7 | ||||
-rw-r--r-- | hw/9pfs/cofs.c | 2 | ||||
-rw-r--r-- | hw/9pfs/virtio-9p-device.c | 1 | ||||
-rw-r--r-- | hw/9pfs/virtio-9p-local.c | 2 | ||||
-rw-r--r-- | hw/9pfs/virtio-9p.c | 6 | ||||
-rw-r--r-- | hw/9pfs/virtio-9p.h | 6 |
6 files changed, 10 insertions, 14 deletions
diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h index d6705c03a1..272f018efb 100644 --- a/fsdev/file-op-9p.h +++ b/fsdev/file-op-9p.h @@ -57,15 +57,12 @@ typedef struct extended_ops { mode_t, uint64_t *); } extended_ops; -/* FsContext flag values */ -#define PATHNAME_FSCONTEXT 0x1 - /* export flags */ -#define V9FS_IMMEDIATE_WRITEOUT 0x1 +#define V9FS_IMMEDIATE_WRITEOUT 0x00000001 +#define V9FS_PATHNAME_FSCONTEXT 0x00000002 typedef struct FsContext { - int flags; char *fs_root; SecModel fs_sm; uid_t uid; diff --git a/hw/9pfs/cofs.c b/hw/9pfs/cofs.c index 68745add1e..83f125bd47 100644 --- a/hw/9pfs/cofs.c +++ b/hw/9pfs/cofs.c @@ -323,7 +323,7 @@ int v9fs_co_name_to_path(V9fsPDU *pdu, V9fsPath *dirpath, int err; V9fsState *s = pdu->s; - if (s->ctx.flags & PATHNAME_FSCONTEXT) { + if (s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT) { err = s->ops->name_to_path(&s->ctx, dirpath, name, path); if (err < 0) { err = -errno; diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c index 0724605a8d..831cce9374 100644 --- a/hw/9pfs/virtio-9p-device.c +++ b/hw/9pfs/virtio-9p-device.c @@ -123,7 +123,6 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf) memcpy(s->tag, conf->tag, len); s->tag_len = len; s->ctx.uid = -1; - s->ctx.flags = 0; s->ops = fse->ops; s->vdev.get_features = virtio_9p_get_features; diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c index ad2d84153f..0bb4cad5b1 100644 --- a/hw/9pfs/virtio-9p-local.c +++ b/hw/9pfs/virtio-9p-local.c @@ -702,7 +702,7 @@ static int local_init(FsContext *ctx) int err; struct statfs stbuf; - ctx->flags |= PATHNAME_FSCONTEXT; + ctx->export_flags |= V9FS_PATHNAME_FSCONTEXT; err = statfs(ctx->fs_root, &stbuf); if (!err) { switch (stbuf.f_type) { diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c index b0a87c806d..aab3bebcc7 100644 --- a/hw/9pfs/virtio-9p.c +++ b/hw/9pfs/virtio-9p.c @@ -2493,7 +2493,7 @@ static void v9fs_remove(void *opaque) goto out_nofid; } /* if fs driver is not path based, return EOPNOTSUPP */ - if (!pdu->s->ctx.flags & PATHNAME_FSCONTEXT) { + if (!(pdu->s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) { err = -EOPNOTSUPP; goto out_err; } @@ -2640,7 +2640,7 @@ static void v9fs_rename(void *opaque) } BUG_ON(fidp->fid_type != P9_FID_NONE); /* if fs driver is not path based, return EOPNOTSUPP */ - if (!pdu->s->ctx.flags & PATHNAME_FSCONTEXT) { + if (!(pdu->s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT)) { err = -EOPNOTSUPP; goto out; } @@ -2713,7 +2713,7 @@ static int v9fs_complete_renameat(V9fsPDU *pdu, int32_t olddirfid, if (err < 0) { goto out; } - if (s->ctx.flags & PATHNAME_FSCONTEXT) { + if (s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT) { /* Only for path based fid we need to do the below fixup */ v9fs_fix_fid_paths(pdu, &olddirfidp->path, old_name, &newdirfidp->path, new_name); diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h index e94041e4f8..802f5809d1 100644 --- a/hw/9pfs/virtio-9p.h +++ b/hw/9pfs/virtio-9p.h @@ -422,21 +422,21 @@ static inline size_t do_pdu_unpack(void *dst, struct iovec *sg, int sg_count, static inline void v9fs_path_write_lock(V9fsState *s) { - if (s->ctx.flags & PATHNAME_FSCONTEXT) { + if (s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT) { qemu_co_rwlock_wrlock(&s->rename_lock); } } static inline void v9fs_path_read_lock(V9fsState *s) { - if (s->ctx.flags & PATHNAME_FSCONTEXT) { + if (s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT) { qemu_co_rwlock_rdlock(&s->rename_lock); } } static inline void v9fs_path_unlock(V9fsState *s) { - if (s->ctx.flags & PATHNAME_FSCONTEXT) { + if (s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT) { qemu_co_rwlock_unlock(&s->rename_lock); } } |