aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVenkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>2011-05-09 11:47:28 -0700
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-08-22 09:44:35 +0530
commitffd668764cb2db02606d74f68c7b59d0585e9d3c (patch)
treeff89a4f733394846de9483fea80ff6a2132cd73d
parentc6c069b0c5fdfc748008d8a4879f3d41c1d32702 (diff)
hw/9pfs: Update v9fs_link to use coroutines
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
-rw-r--r--hw/9pfs/virtio-9p.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index 203c0315a7..fdfe58216d 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -117,11 +117,6 @@ static int v9fs_do_chmod(V9fsState *s, V9fsString *path, mode_t mode)
return s->ops->chmod(&s->ctx, path->data, &cred);
}
-static int v9fs_do_link(V9fsState *s, V9fsString *oldpath, V9fsString *newpath)
-{
- return s->ops->link(&s->ctx, oldpath->data, newpath->data);
-}
-
static int v9fs_do_truncate(V9fsState *s, V9fsString *path, off_t size)
{
return s->ops->truncate(&s->ctx, path->data, size);
@@ -2029,9 +2024,8 @@ static void v9fs_create(void *opaque)
err = -EINVAL;
goto out;
}
- err = v9fs_do_link(pdu->s, &nfidp->path, &fullname);
+ err = v9fs_co_link(pdu->s, &nfidp->path, &fullname);
if (err < 0) {
- err = -errno;
goto out;
}
} else if (perm & P9_STAT_MODE_DEVICE) {
@@ -2169,21 +2163,20 @@ static void v9fs_link(void *opaque)
dfidp = lookup_fid(s, dfid);
if (dfidp == NULL) {
- err = -errno;
+ err = -ENOENT;
goto out;
}
oldfidp = lookup_fid(s, oldfid);
if (oldfidp == NULL) {
- err = -errno;
+ err = -ENOENT;
goto out;
}
v9fs_string_sprintf(&fullname, "%s/%s", dfidp->path.data, name.data);
- err = offset;
- err = v9fs_do_link(s, &oldfidp->path, &fullname);
- if (err) {
- err = -errno;
+ err = v9fs_co_link(s, &oldfidp->path, &fullname);
+ if (!err) {
+ err = offset;
}
v9fs_string_free(&fullname);