Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jan 2013 12:21:50 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r245164 - head/sys/fs/fuse
Message-ID:  <201301081221.r08CLoSj055426@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Tue Jan  8 12:21:50 2013
New Revision: 245164
URL: http://svnweb.freebsd.org/changeset/base/245164

Log:
  Add support for IO_APPEND flag in fuse
  This make open(..., O_APPEND) actually works on fuse filesystem.
  
  Reviewed by:	attilio

Modified:
  head/sys/fs/fuse/fuse_io.c

Modified: head/sys/fs/fuse/fuse_io.c
==============================================================================
--- head/sys/fs/fuse/fuse_io.c	Tue Jan  8 09:05:09 2013	(r245163)
+++ head/sys/fs/fuse/fuse_io.c	Tue Jan  8 12:21:50 2013	(r245164)
@@ -113,7 +113,7 @@ fuse_write_directbackend(struct vnode *v
     struct ucred *cred, struct fuse_filehandle *fufh);
 static int 
 fuse_write_biobackend(struct vnode *vp, struct uio *uio,
-    struct ucred *cred, struct fuse_filehandle *fufh);
+    struct ucred *cred, struct fuse_filehandle *fufh, int ioflag);
 
 int
 fuse_io_dispatch(struct vnode *vp, struct uio *uio, int ioflag,
@@ -162,7 +162,7 @@ fuse_io_dispatch(struct vnode *vp, struc
 		} else {
 			FS_DEBUG("buffered write of vnode %ju\n", 
 			      (uintmax_t)VTOILLU(vp));
-			err = fuse_write_biobackend(vp, uio, cred, fufh);
+			err = fuse_write_biobackend(vp, uio, cred, fufh, ioflag);
 		}
 		break;
 	default:
@@ -371,7 +371,7 @@ fuse_write_directbackend(struct vnode *v
 
 static int
 fuse_write_biobackend(struct vnode *vp, struct uio *uio,
-    struct ucred *cred, struct fuse_filehandle *fufh)
+    struct ucred *cred, struct fuse_filehandle *fufh, int ioflag)
 {
 	struct fuse_vnode_data *fvdat = VTOFUD(vp);
 	struct buf *bp;
@@ -390,6 +390,8 @@ fuse_write_biobackend(struct vnode *vp, 
 		return (EINVAL);
 	if (uio->uio_resid == 0)
 		return (0);
+	if (ioflag & IO_APPEND)
+		uio_setoffset(uio, fvdat->filesize);
 
 	/*
          * Find all of this file's B_NEEDCOMMIT buffers.  If our writes



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301081221.r08CLoSj055426>