[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH -V2 13/13] hw/9pfs: Use fs driver specific lstat
From: |
Aneesh Kumar K.V |
Subject: |
[Qemu-devel] [PATCH -V2 13/13] hw/9pfs: Use fs driver specific lstat |
Date: |
Tue, 11 Oct 2011 16:11:45 +0530 |
From: "M. Mohan Kumar" <address@hidden>
Use file system driver specific lstat instead of generic lstat.
Signed-off-by: M. Mohan Kumar <address@hidden>
Signed-off-by: Aneesh Kumar K.V <address@hidden>
---
hw/9pfs/virtio-9p-device.c | 33 +++++++++++++++++++++++----------
1 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c
index bc25af5..aac58ad 100644
--- a/hw/9pfs/virtio-9p-device.c
+++ b/hw/9pfs/virtio-9p-device.c
@@ -50,6 +50,7 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf)
int i, len;
struct stat stat;
FsTypeEntry *fse;
+ V9fsPath path;
s = (V9fsState *)virtio_common_init("virtio-9p",
VIRTIO_ID_9P,
@@ -107,14 +108,6 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf
*conf)
s->ctx.xops = none_xattr_ops;
}
- if (lstat(fse->path, &stat)) {
- fprintf(stderr, "share path %s does not exist\n", fse->path);
- exit(1);
- } else if (!S_ISDIR(stat.st_mode)) {
- fprintf(stderr, "share path %s is not a directory\n", fse->path);
- exit(1);
- }
-
s->ctx.cache_flags = fse->cache_flags;
s->ctx.fs_root = g_strdup(fse->path);
s->ctx.exops.get_st_gen = NULL;
@@ -134,8 +127,7 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf
*conf)
s->ops = fse->ops;
s->vdev.get_features = virtio_9p_get_features;
- s->config_size = sizeof(struct virtio_9p_config) +
- s->tag_len;
+ s->config_size = sizeof(struct virtio_9p_config) + s->tag_len;
s->vdev.get_config = virtio_9p_get_config;
s->fid_list = NULL;
qemu_co_rwlock_init(&s->rename_lock);
@@ -149,6 +141,27 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf
*conf)
fprintf(stderr, "worker thread initialization failed\n");
exit(1);
}
+
+ /*
+ * Check details of export path, We need to use fs driver
+ * call back to do that. Since we are in the init path, we don't
+ * use co-routines here.
+ */
+ v9fs_path_init(&path);
+ if (s->ops->name_to_path(&s->ctx, NULL, "/", &path) < 0) {
+ fprintf(stderr,
+ "error in converting name to path %s", strerror(errno));
+ exit(1);
+ }
+ if (s->ops->lstat(&s->ctx, &path, &stat)) {
+ fprintf(stderr, "share path %s does not exist\n", fse->path);
+ exit(1);
+ } else if (!S_ISDIR(stat.st_mode)) {
+ fprintf(stderr, "share path %s is not a directory\n", fse->path);
+ exit(1);
+ }
+ v9fs_path_free(&path);
+
return &s->vdev;
}
--
1.7.5.4
- [Qemu-devel] [PATCH V2 00/13] VirtFS update, Aneesh Kumar K.V, 2011/10/11
- [Qemu-devel] [PATCH -V2 01/13] hw/9pfs: Use ioeventfd for 9p, Aneesh Kumar K.V, 2011/10/11
- [Qemu-devel] [PATCH -V2 08/13] hw/9pfs: Add st_gen support in getattr reply, Aneesh Kumar K.V, 2011/10/11
- [Qemu-devel] [PATCH -V2 04/13] hw/9pfs: Fix build error on platform that don't support futimens, Aneesh Kumar K.V, 2011/10/11
- [Qemu-devel] [PATCH -V2 07/13] hw/9pfs: Add open flag mapping, Aneesh Kumar K.V, 2011/10/11
- [Qemu-devel] [PATCH -V2 12/13] scripts: Simpletrace log analysis script for pretty-printing 9p log., Aneesh Kumar K.V, 2011/10/11
- [Qemu-devel] [PATCH -V2 09/13] hw/9pfs: Add st_gen support for handle based fs driver, Aneesh Kumar K.V, 2011/10/11
- [Qemu-devel] [PATCH -V2 02/13] hw/9pfs: Add new virtfs option cache=writethrough to skip host page cache, Aneesh Kumar K.V, 2011/10/11
- [Qemu-devel] [PATCH -V2 13/13] hw/9pfs: Use fs driver specific lstat,
Aneesh Kumar K.V <=
- [Qemu-devel] [PATCH -V2 11/13] hw/9pfs: Remove virtio-9p-debug.* infra to be replaced by Qemu Tracing., Aneesh Kumar K.V, 2011/10/11
- [Qemu-devel] [PATCH -V2 05/13] virtio-9p: Use 9P specific Lock constants, Aneesh Kumar K.V, 2011/10/11
- [Qemu-devel] [PATCH -V2 06/13] hw/9pfs: Ensure an error is reported to user if 9pfs mount tag is too long, Aneesh Kumar K.V, 2011/10/11
- [Qemu-devel] [PATCH -V2 03/13] qemu-options.hx: Update virtfs command documentation, Aneesh Kumar K.V, 2011/10/11
- [Qemu-devel] [PATCH -V2 10/13] hw/9pfs: Introduce tracing for 9p pdu handlers, Aneesh Kumar K.V, 2011/10/11