summaryrefslogtreecommitdiff
path: root/hw/9pfs/codir.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-09-09 15:14:18 +0530
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-09-22 21:38:52 +0530
commit2289be19aecc290263ef1f3c1f4a0e9ea32aaad6 (patch)
treef9049e0b36dce4289995e8d3519b20255c4a4b7f /hw/9pfs/codir.c
parent02cb7f3a256517cbf3136caff2863fbafc57b540 (diff)
downloadqemu-2289be19aecc290263ef1f3c1f4a0e9ea32aaad6.tar.gz
hw/9pfs: Move fid pathname tracking to seperate data type.
This enables us to add handles to track fids later. The V9fsPath added is similar to V9fsString except that the size include the NULL byte also. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Diffstat (limited to 'hw/9pfs/codir.c')
-rw-r--r--hw/9pfs/codir.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/hw/9pfs/codir.c b/hw/9pfs/codir.c
index c9a88ecb60..2c50df84c3 100644
--- a/hw/9pfs/codir.c
+++ b/hw/9pfs/codir.c
@@ -70,29 +70,31 @@ int v9fs_co_mkdir(V9fsState *s, V9fsFidState *fidp, V9fsString *name,
{
int err;
FsCred cred;
- V9fsString fullname;
+ V9fsPath path;
cred_init(&cred);
cred.fc_mode = mode;
cred.fc_uid = uid;
cred.fc_gid = gid;
- v9fs_string_init(&fullname);
qemu_co_rwlock_rdlock(&s->rename_lock);
- v9fs_string_sprintf(&fullname, "%s/%s", fidp->path.data, name->data);
v9fs_co_run_in_worker(
{
- err = s->ops->mkdir(&s->ctx, fullname.data, &cred);
+ err = s->ops->mkdir(&s->ctx, &fidp->path, name->data, &cred);
if (err < 0) {
err = -errno;
} else {
- err = s->ops->lstat(&s->ctx, fullname.data, stbuf);
- if (err < 0) {
- err = -errno;
+ v9fs_path_init(&path);
+ err = v9fs_name_to_path(s, &fidp->path, name->data, &path);
+ if (!err) {
+ err = s->ops->lstat(&s->ctx, &path, stbuf);
+ if (err < 0) {
+ err = -errno;
+ }
}
+ v9fs_path_free(&path);
}
});
qemu_co_rwlock_unlock(&s->rename_lock);
- v9fs_string_free(&fullname);
return err;
}
@@ -103,7 +105,7 @@ int v9fs_co_opendir(V9fsState *s, V9fsFidState *fidp)
qemu_co_rwlock_rdlock(&s->rename_lock);
v9fs_co_run_in_worker(
{
- fidp->fs.dir = s->ops->opendir(&s->ctx, fidp->path.data);
+ fidp->fs.dir = s->ops->opendir(&s->ctx, &fidp->path);
if (!fidp->fs.dir) {
err = -errno;
} else {