From c07b55e62baeff49586a8e0d58dc4f2de3093aa7 Mon Sep 17 00:00:00 2001 From: Sylvestre Gallon Date: Wed, 29 Jan 2014 20:37:19 +0000 Subject: Add fuse support for IO_APPEND. ok beck@ --- sys/miscfs/fuse/fuse_vnops.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'sys/miscfs') 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 * @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -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); -- cgit v1.2.3