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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to