aboutsummaryrefslogtreecommitdiffstats
path: root/hw/virtio-9p.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2010-08-26 11:15:23 +0530
committerAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2010-09-08 22:56:42 +0530
commit9ed3ef26e6503c39ca8b68fb8894c62824e4f3b9 (patch)
tree0bbe569bfccb3616f59c1bbe7026d3084ee92238 /hw/virtio-9p.c
parent783f04e1d419f730639755e6bd4e7026ad6f2a3f (diff)
virtio-9p: Add support for removing xattr
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Diffstat (limited to 'hw/virtio-9p.c')
-rw-r--r--hw/virtio-9p.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c
index a53b2225e..eb7ae01af 100644
--- a/hw/virtio-9p.c
+++ b/hw/virtio-9p.c
@@ -286,6 +286,14 @@ static int v9fs_do_lsetxattr(V9fsState *s, V9fsString *path,
xattr_name->data, value, size, flags);
}
+static int v9fs_do_lremovexattr(V9fsState *s, V9fsString *path,
+ V9fsString *xattr_name)
+{
+ return s->ops->lremovexattr(&s->ctx, path->data,
+ xattr_name->data);
+}
+
+
static void v9fs_string_init(V9fsString *str)
{
str->data = NULL;
@@ -456,10 +464,14 @@ static int v9fs_xattr_fid_clunk(V9fsState *s, V9fsFidState *fidp)
retval = -EINVAL;
goto free_out;
}
- retval = v9fs_do_lsetxattr(s, &fidp->path, &fidp->fs.xattr.name,
- fidp->fs.xattr.value,
- fidp->fs.xattr.len,
- fidp->fs.xattr.flags);
+ if (fidp->fs.xattr.len) {
+ retval = v9fs_do_lsetxattr(s, &fidp->path, &fidp->fs.xattr.name,
+ fidp->fs.xattr.value,
+ fidp->fs.xattr.len,
+ fidp->fs.xattr.flags);
+ } else {
+ retval = v9fs_do_lremovexattr(s, &fidp->path, &fidp->fs.xattr.name);
+ }
free_out:
v9fs_string_free(&fidp->fs.xattr.name);
free_value:
@@ -3392,7 +3404,10 @@ static void v9fs_xattrcreate(V9fsState *s, V9fsPDU *pdu)
vs->xattr_fidp->fs.xattr.flags = flags;
v9fs_string_init(&vs->xattr_fidp->fs.xattr.name);
v9fs_string_copy(&vs->xattr_fidp->fs.xattr.name, &vs->name);
- vs->xattr_fidp->fs.xattr.value = qemu_malloc(vs->size);
+ if (vs->size)
+ vs->xattr_fidp->fs.xattr.value = qemu_malloc(vs->size);
+ else
+ vs->xattr_fidp->fs.xattr.value = NULL;
out:
complete_pdu(s, vs->pdu, err);