Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpuffs Add an open2 method, like open but with an addi...



details:   https://anonhg.NetBSD.org/src/rev/14774b6ee83e
branches:  trunk
changeset: 801756:14774b6ee83e
user:      manu <manu%NetBSD.org@localhost>
date:      Sat Aug 16 16:25:44 2014 +0000

description:
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.

diffstat:

 lib/libpuffs/dispatcher.c |  12 ++++++++++--
 lib/libpuffs/puffs.h      |   8 ++++++--
 lib/libpuffs/puffs_ops.3  |  14 +++++++++++++-
 3 files changed, 29 insertions(+), 5 deletions(-)

diffs (104 lines):

diff -r 1088433ed3d7 -r 14774b6ee83e lib/libpuffs/dispatcher.c
--- a/lib/libpuffs/dispatcher.c Sat Aug 16 16:22:21 2014 +0000
+++ b/lib/libpuffs/dispatcher.c Sat Aug 16 16:25:44 2014 +0000
@@ -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 @@
                        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;
diff -r 1088433ed3d7 -r 14774b6ee83e lib/libpuffs/puffs.h
--- a/lib/libpuffs/puffs.h      Sat Aug 16 16:22:21 2014 +0000
+++ b/lib/libpuffs/puffs.h      Sat Aug 16 16:25:44 2014 +0000
@@ -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 @@
            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 @@
            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)                                              \
diff -r 1088433ed3d7 -r 14774b6ee83e lib/libpuffs/puffs_ops.3
--- a/lib/libpuffs/puffs_ops.3  Sat Aug 16 16:22:21 2014 +0000
+++ b/lib/libpuffs/puffs_ops.3  Sat Aug 16 16:25:44 2014 +0000
@@ -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 @@
 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 @@
 .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



Home | Main Index | Thread Index | Old Index