From c98f1d4a8bb6f779313043d2490093451cf52065 Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" Date: Wed, 12 Oct 2011 20:59:18 +0530 Subject: 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 --- hw/9pfs/cofs.c | 2 +- hw/9pfs/virtio-9p-device.c | 1 - hw/9pfs/virtio-9p-local.c | 2 +- hw/9pfs/virtio-9p.c | 6 +++--- hw/9pfs/virtio-9p.h | 6 +++--- 5 files changed, 8 insertions(+), 9 deletions(-) (limited to 'hw') diff --git a/hw/9pfs/cofs.c b/hw/9pfs/cofs.c index 68745ad..83f125b 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 0724605..831cce9 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 ad2d841..0bb4cad 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 b0a87c8..aab3beb 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 e94041e..802f580 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); } } -- cgit v1.1