Module Name:    src
Committed By:   manu
Date:           Sat Aug 16 16:25:44 UTC 2014

Modified Files:
        src/lib/libpuffs: dispatcher.c puffs.h puffs_ops.3

Log Message:
Add an open2 method, like open but with an additionnal oflags used
by the filesystem to send back information about the file.
This is used to implement PUFFS_OPEN_IO_DIRECT by which the filesystem
tells the kernel that read/write should bypass the page cache.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/lib/libpuffs/dispatcher.c
cvs rdiff -u -r1.124 -r1.125 src/lib/libpuffs/puffs.h
cvs rdiff -u -r1.36 -r1.37 src/lib/libpuffs/puffs_ops.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpuffs/dispatcher.c
diff -u src/lib/libpuffs/dispatcher.c:1.46 src/lib/libpuffs/dispatcher.c:1.47
--- src/lib/libpuffs/dispatcher.c:1.46	Wed Nov  6 19:56:38 2013
+++ src/lib/libpuffs/dispatcher.c	Sat Aug 16 16:25:44 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dispatcher.c,v 1.46 2013/11/06 19:56:38 christos Exp $	*/
+/*	$NetBSD: dispatcher.c,v 1.47 2014/08/16 16:25:44 manu Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007, 2008 Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: dispatcher.c,v 1.46 2013/11/06 19:56:38 christos Exp $");
+__RCSID("$NetBSD: dispatcher.c,v 1.47 2014/08/16 16:25:44 manu Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -412,6 +412,14 @@ dispatch(struct puffs_cc *pcc)
 			struct puffs_vnmsg_open *auxt = auxbuf;
 			PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
 
+			if (pops->puffs_node_open2 != NULL) {
+				error = pops->puffs_node_open2(pu,
+				    opcookie, auxt->pvnr_mode, pcr, 
+				    &auxt->pvnr_oflags);
+
+				break;
+			}
+
 			if (pops->puffs_node_open == NULL) {
 				error = 0;
 				break;

Index: src/lib/libpuffs/puffs.h
diff -u src/lib/libpuffs/puffs.h:1.124 src/lib/libpuffs/puffs.h:1.125
--- src/lib/libpuffs/puffs.h:1.124	Thu Aug 16 09:25:44 2012
+++ src/lib/libpuffs/puffs.h	Sat Aug 16 16:25:44 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs.h,v 1.124 2012/08/16 09:25:44 manu Exp $	*/
+/*	$NetBSD: puffs.h,v 1.125 2014/08/16 16:25:44 manu Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -250,6 +250,8 @@ struct puffs_ops {
 	    uint8_t *, off_t, size_t *, const struct puffs_cred *, int, int);
 	int (*puffs_node_reclaim2)(struct puffs_usermount *,
 	    puffs_cookie_t, int);
+	int (*puffs_node_open2)(struct puffs_usermount *,
+	    puffs_cookie_t, int, const struct puffs_cred *, int *);
 
 	void *puffs_ops_spare[28];
 };
@@ -410,7 +412,9 @@ enum {
 	    puffs_cookie_t, uint8_t *, off_t, size_t *,			\
 	    const struct puffs_cred *, int, int);			\
 	int fsname##_node_reclaim2(struct puffs_usermount *,		\
-	    puffs_cookie_t, int);
+	    puffs_cookie_t, int);					\
+	int fsname##_node_open2(struct puffs_usermount *,		\
+	    puffs_cookie_t, int, const struct puffs_cred *, int *);
 
 
 #define PUFFSOP_INIT(ops)						\

Index: src/lib/libpuffs/puffs_ops.3
diff -u src/lib/libpuffs/puffs_ops.3:1.36 src/lib/libpuffs/puffs_ops.3:1.37
--- src/lib/libpuffs/puffs_ops.3:1.36	Thu Aug 16 11:28:38 2012
+++ src/lib/libpuffs/puffs_ops.3	Sat Aug 16 16:25:44 2014
@@ -1,4 +1,4 @@
-.\"	$NetBSD: puffs_ops.3,v 1.36 2012/08/16 11:28:38 wiz Exp $
+.\"	$NetBSD: puffs_ops.3,v 1.37 2014/08/16 16:25:44 manu Exp $
 .\"
 .\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\"
@@ -83,6 +83,11 @@
 .Fa "const struct puffs_cred *pcr"
 .Fc
 .Ft int
+.Fo puffs_node_open2
+.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int modep"
+.Fa "const struct puffs_cred *pcr" "int *oflags"
+.Fc
+.Ft int
 .Fo puffs_node_close
 .Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "int flags"
 .Fa "const struct puffs_cred *pcr"
@@ -481,6 +486,7 @@ file, directory and device special file,
 In case of mknod, the device identifier can be found in
 .Fa va-\*[Gt]va_rdev .
 .It Fn puffs_node_open "pu" "opc" "mode" "pcr"
+.It Fn puffs_node_open2 "pu" "opc" "mode" "pcr" "oflags"
 Open the node denoted by the cookie
 .Fa opc .
 The parameter
@@ -491,6 +497,12 @@ was called with, e.g.
 .Dv O_APPEND
 and
 .Dv O_NONBLOCK .
+.Fn puffs_node_open2
+allows the filesystem to pass back information for the file in
+.Fa oflags .
+The only implemented flag for now is
+.Dv PUFFS_OPEN_IO_DIRECT
+that cause file read/write to bypass the page cache.
 .It Fn puffs_node_close "pu" "opc" "flags" "pcr"
 Close a node.
 The parameter

Reply via email to