Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 May 2019 00:01:36 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r348344 - projects/fuse2/sys/fs/fuse
Message-ID:  <201905290001.x4T01akA082610@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Wed May 29 00:01:36 2019
New Revision: 348344
URL: https://svnweb.freebsd.org/changeset/base/348344

Log:
  fusefs: raise protocol level to 7.10
  
  Protocol version 7.10 has only one new feature, and I'm choosing not to
  implement it, so this commit is basically a noop.  The sole new feature is
  the FOPEN_NONSEEKABLE flag, which a fuse file system can return to indicate
  that a certain file handle cannot be seeked.  However, I'm unaware of any
  file system in ports that uses this flag.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  projects/fuse2/sys/fs/fuse/fuse_file.h
  projects/fuse2/sys/fs/fuse/fuse_kernel.h
  projects/fuse2/sys/fs/fuse/fuse_node.c

Modified: projects/fuse2/sys/fs/fuse/fuse_file.h
==============================================================================
--- projects/fuse2/sys/fs/fuse/fuse_file.h	Wed May 29 00:00:52 2019	(r348343)
+++ projects/fuse2/sys/fs/fuse/fuse_file.h	Wed May 29 00:01:36 2019	(r348344)
@@ -134,7 +134,16 @@ struct fuse_filehandle {
 	/* The filehandle returned by FUSE_OPEN */
 	uint64_t fh_id;
 
-	/* flags returned by FUSE_OPEN */
+	/*
+	 * flags returned by FUSE_OPEN
+	 * Supported flags: FOPEN_DIRECT_IO, FOPEN_KEEP_CACHE
+	 * Unsupported:
+	 *     FOPEN_NONSEEKABLE: Adding support would require a new per-file
+	 *     or per-vnode attribute, which would have to be checked by
+	 *     kern_lseek (and others) for every file system.  The benefit is
+	 *     dubious, since I'm unaware of any file systems in ports that use
+	 *     this flag.
+	 */
 	uint32_t fuse_open_flags;
 
 	/* The access mode of the file handle */

Modified: projects/fuse2/sys/fs/fuse/fuse_kernel.h
==============================================================================
--- projects/fuse2/sys/fs/fuse/fuse_kernel.h	Wed May 29 00:00:52 2019	(r348343)
+++ projects/fuse2/sys/fs/fuse/fuse_kernel.h	Wed May 29 00:01:36 2019	(r348344)
@@ -45,6 +45,9 @@
  *  - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
  *  - add blksize field to fuse_attr
  *  - add file flags field to fuse_read_in and fuse_write_in
+ *
+ * 7.10
+ *  - add nonseekable open flag
  */
 
 #ifndef _FUSE_FUSE_KERNEL_H
@@ -64,7 +67,7 @@
 #define FUSE_KERNEL_VERSION 7
 
 /** Minor version number of this interface */
-#define FUSE_KERNEL_MINOR_VERSION 9
+#define FUSE_KERNEL_MINOR_VERSION 10
 
 /** The node ID of the root inode */
 #define FUSE_ROOT_ID 1
@@ -72,9 +75,6 @@
 /** The major number of the fuse character device */
 #define FUSE_MAJOR MISC_MAJOR
 
-/** The minor number of the fuse character device */
-#define FUSE_MINOR 229
-
 /* Make sure all structures are padded to 64bit boundary, so 32bit
    userspace works under 64bit kernels */
 
@@ -136,9 +136,11 @@ struct fuse_file_lock {
  *
  * FOPEN_DIRECT_IO: bypass page cache for this open file
  * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
+ * FOPEN_NONSEEKABLE: the file is not seekable
  */
 #define FOPEN_DIRECT_IO		(1 << 0)
 #define FOPEN_KEEP_CACHE	(1 << 1)
+#define FOPEN_NONSEEKABLE	(1 << 2)
 
 /**
  * INIT request/reply flags

Modified: projects/fuse2/sys/fs/fuse/fuse_node.c
==============================================================================
--- projects/fuse2/sys/fs/fuse/fuse_node.c	Wed May 29 00:00:52 2019	(r348343)
+++ projects/fuse2/sys/fs/fuse/fuse_node.c	Wed May 29 00:01:36 2019	(r348344)
@@ -312,30 +312,15 @@ fuse_vnode_get(struct mount *mp,
 	return 0;
 }
 
+/*
+ * Called for every fusefs vnode open to initialize the vnode (not
+ * fuse_filehandle) for use
+ */
 void
 fuse_vnode_open(struct vnode *vp, int32_t fuse_open_flags, struct thread *td)
 {
-	/*
-	 * Function is called for every vnode open.
-	 * Merge fuse_open_flags it may be 0
-	 */
-	/*
-	 * Ideally speaking, direct io should be enabled on
-	 * fd's but do not see of any way of providing that
-	 * this implementation.
-	 *
-	 * Also cannot think of a reason why would two
-	 * different fd's on same vnode would like
-	 * have DIRECT_IO turned on and off. But linux
-	 * based implementation works on an fd not an
-	 * inode and provides such a feature.
-	 *
-	 * XXXIP: Handle fd based DIRECT_IO
-	 */
-	if (vnode_vtype(vp) == VREG) {
-		/* XXXIP prevent getattr, by using cached node size */
+	if (vnode_vtype(vp) == VREG)
 		vnode_create_vobject(vp, 0, td);
-	}
 }
 
 int



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