summaryrefslogtreecommitdiff
path: root/sys/miscfs
diff options
context:
space:
mode:
authorSylvestre Gallon <syl@cvs.openbsd.org>2014-01-29 20:37:19 +0000
committerSylvestre Gallon <syl@cvs.openbsd.org>2014-01-29 20:37:19 +0000
commitc07b55e62baeff49586a8e0d58dc4f2de3093aa7 (patch)
tree53adb03ae24aa72fc51047765f99890e14fcd4bc /sys/miscfs
parent8bfde882b04ceaf280b8a7d0ff68a0a5ca998b02 (diff)
Add fuse support for IO_APPEND.
ok beck@
Diffstat (limited to 'sys/miscfs')
-rw-r--r--sys/miscfs/fuse/fuse_vnops.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/miscfs/fuse/fuse_vnops.c b/sys/miscfs/fuse/fuse_vnops.c
index 6d514bb203d..f5fb08a6dd5 100644
--- a/sys/miscfs/fuse/fuse_vnops.c
+++ b/sys/miscfs/fuse/fuse_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse_vnops.c,v 1.13 2014/01/16 09:31:44 syl Exp $ */
+/* $OpenBSD: fuse_vnops.c,v 1.14 2014/01/29 20:37:18 syl Exp $ */
/*
* Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -23,6 +23,7 @@
#include <sys/mount.h>
#include <sys/namei.h>
#include <sys/poll.h>
+#include <sys/proc.h>
#include <sys/specdev.h>
#include <sys/statvfs.h>
#include <sys/vnode.h>
@@ -1011,6 +1012,9 @@ fusefs_write(void *v)
struct vnode *vp = ap->a_vp;
struct uio *uio = ap->a_uio;
struct proc *p = uio->uio_procp;
+ struct ucred *cred = p->p_ucred;
+ struct vattr vattr;
+ int ioflag = ap->a_ioflag;
struct fusefs_node *ip;
struct fusefs_mnt *fmp;
struct fusebuf *fbuf = NULL;
@@ -1025,6 +1029,13 @@ fusefs_write(void *v)
if (uio->uio_resid == 0)
return (error);
+ if (ioflag & IO_APPEND) {
+ if ((error = VOP_GETATTR(vp, &vattr, cred, p)) != 0)
+ return (error);
+
+ uio->uio_offset = vattr.va_size;
+ }
+
while (uio->uio_resid > 0) {
len = MIN(uio->uio_resid, FUSEBUFMAXSIZE);
fbuf = fb_setup(len, ip->ufs_ino.i_number, FBT_WRITE, p);