summaryrefslogtreecommitdiff
path: root/hw/9pfs/virtio-9p-handle.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-11-18 17:35:38 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-21 14:58:49 -0600
commit930b588395b8f5864e10688075482e421af7b43d (patch)
tree27f37132c51bf5d3c8db17b36005f03ce59ab1d2 /hw/9pfs/virtio-9p-handle.c
parentf5654039497b7c5a2d3fe38d0fcf7898596b21f7 (diff)
downloadqemu-930b588395b8f5864e10688075482e421af7b43d.tar.gz
9p: pass dotl flags to the unlinkat method
AT_REMOVEDIR is not defined on all systems. Pass the raw flags from the 9p protocol, which are always there. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/9pfs/virtio-9p-handle.c')
-rw-r--r--hw/9pfs/virtio-9p-handle.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/hw/9pfs/virtio-9p-handle.c b/hw/9pfs/virtio-9p-handle.c
index 27889d877b..7644ae5ab9 100644
--- a/hw/9pfs/virtio-9p-handle.c
+++ b/hw/9pfs/virtio-9p-handle.c
@@ -65,6 +65,9 @@ struct rpl_file_handle {
};
#define file_handle rpl_file_handle
+#ifndef AT_REMOVEDIR
+#define AT_REMOVEDIR 0x200
+#endif
#ifndef AT_EMPTY_PATH
#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */
#endif
@@ -575,13 +578,20 @@ static int handle_unlinkat(FsContext *ctx, V9fsPath *dir,
{
int dirfd, ret;
struct handle_data *data = (struct handle_data *)ctx->private;
+ int rflags;
dirfd = open_by_handle(data->mountfd, dir->data, O_PATH);
if (dirfd < 0) {
return dirfd;
}
- ret = unlinkat(dirfd, name, flags);
+ rflags = 0;
+ if (flags & P9_DOTL_AT_REMOVEDIR) {
+ rflags |= AT_REMOVEDIR;
+ }
+
+ ret = unlinkat(dirfd, name, rflags);
+
close(dirfd);
return ret;
}