Source-Changes-HG archive

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

[src/netbsd-6]: src/lib Pull up following revision(s) (requested by manu in t...



details:   https://anonhg.NetBSD.org/src/rev/daafeaf74d6f
branches:  netbsd-6
changeset: 774304:daafeaf74d6f
user:      riz <riz%NetBSD.org@localhost>
date:      Thu Jul 05 17:26:14 2012 +0000

description:
Pull up following revision(s) (requested by manu in ticket #392):
        lib/libpuffs/puffs_ops.3: revision 1.32
        lib/libperfuse/ops.c: revision 1.58
        lib/libpuffs/puffs.h: revision 1.122
        lib/libpuffs/dispatcher.c: revision 1.41
        lib/libperfuse/perfuse_priv.h: revision 1.30
Pass the FAF flag to handlers:
- setattr_ttl is updated to add a flag argument. Since it was not
present in
  a previous release, we can change its API
- write2 is introduced, this is write with an extra flag for FAF.
- fsync already has the FAF information in a flag and needs no change
- for other operations, FAF is unconditional
Fix the build by adding (unused) flags argument to
perfuse_node_setattr_ttl

diffstat:

 lib/libperfuse/ops.c          |   6 +++---
 lib/libperfuse/perfuse_priv.h |   4 ++--
 lib/libpuffs/dispatcher.c     |  33 +++++++++++++++++++++++++--------
 lib/libpuffs/puffs.h          |  19 +++++++++++++++----
 lib/libpuffs/puffs_ops.3      |  33 +++++++++++++++++++++++++++------
 5 files changed, 72 insertions(+), 23 deletions(-)

diffs (251 lines):

diff -r 81db88452aa0 -r daafeaf74d6f lib/libperfuse/ops.c
--- a/lib/libperfuse/ops.c      Thu Jul 05 17:22:02 2012 +0000
+++ b/lib/libperfuse/ops.c      Thu Jul 05 17:26:14 2012 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.50.2.4 2012/06/24 16:07:12 jdc Exp $ */
+/*  $NetBSD: ops.c,v 1.50.2.5 2012/07/05 17:26:14 riz Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -1680,13 +1680,13 @@
        const struct vattr *vap, const struct puffs_cred *pcr)
 {
        return perfuse_node_setattr_ttl(pu, opc, 
-                                       __UNCONST(vap), pcr, NULL);
+                                       __UNCONST(vap), pcr, NULL, 0);
 }
 
 int
 perfuse_node_setattr_ttl(struct puffs_usermount *pu, puffs_cookie_t opc,
        struct vattr *vap, const struct puffs_cred *pcr,
-       struct timespec *va_ttl)
+       struct timespec *va_ttl, int flags)
 {
        perfuse_msg_t *pm;
        uint64_t fh;
diff -r 81db88452aa0 -r daafeaf74d6f lib/libperfuse/perfuse_priv.h
--- a/lib/libperfuse/perfuse_priv.h     Thu Jul 05 17:22:02 2012 +0000
+++ b/lib/libperfuse/perfuse_priv.h     Thu Jul 05 17:26:14 2012 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: perfuse_priv.h,v 1.25.2.2 2012/04/23 16:48:59 riz Exp $ */
+/*  $NetBSD: perfuse_priv.h,v 1.25.2.3 2012/07/05 17:26:14 riz Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -259,7 +259,7 @@
     struct timespec *);
 int perfuse_node_setattr_ttl(struct puffs_usermount *,
     puffs_cookie_t, struct vattr *, const struct puffs_cred *,
-    struct timespec *);
+    struct timespec *, int flags);
 
 struct perfuse_trace *perfuse_trace_begin(struct perfuse_state *, 
     puffs_cookie_t, perfuse_msg_t *);
diff -r 81db88452aa0 -r daafeaf74d6f lib/libpuffs/dispatcher.c
--- a/lib/libpuffs/dispatcher.c Thu Jul 05 17:22:02 2012 +0000
+++ b/lib/libpuffs/dispatcher.c Thu Jul 05 17:26:14 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dispatcher.c,v 1.38.2.1 2012/04/23 16:48:57 riz Exp $  */
+/*     $NetBSD: dispatcher.c,v 1.38.2.2 2012/07/05 17:26:14 riz 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.38.2.1 2012/04/23 16:48:57 riz Exp $");
+__RCSID("$NetBSD: dispatcher.c,v 1.38.2.2 2012/07/05 17:26:14 riz Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -467,14 +467,19 @@
                        PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
 
                        if (PUFFS_USE_FS_TTL(pu)) {
+                               int xflag = 0;
+
                                if (pops->puffs_node_setattr_ttl == NULL) {
                                        error = EOPNOTSUPP;
                                        break;
                                }
 
+                               if (!PUFFSOP_WANTREPLY(preq->preq_opclass))
+                                       xflag |= PUFFS_SETATTR_FAF;
+
                                error = pops->puffs_node_setattr_ttl(pu,
                                    opcookie, &auxt->pvnr_va, pcr,
-                                   &auxt->pvnr_va_ttl);
+                                   &auxt->pvnr_va_ttl, xflag);
                        } else {
                                if (pops->puffs_node_setattr == NULL) {
                                        error = EOPNOTSUPP;
@@ -913,15 +918,27 @@
                        struct puffs_vnmsg_write *auxt = auxbuf;
                        PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
 
-                       if (pops->puffs_node_write == NULL) {
+                       if (pops->puffs_node_write2 != NULL) {
+                               int xflag = 0;
+
+                               if (!PUFFSOP_WANTREPLY(preq->preq_opclass))
+                                       xflag |= PUFFS_SETATTR_FAF;
+
+                               error = pops->puffs_node_write2(pu,
+                                   opcookie, auxt->pvnr_data,
+                                   auxt->pvnr_offset, &auxt->pvnr_resid,
+                                   pcr, auxt->pvnr_ioflag, xflag);
+
+                       } else if (pops->puffs_node_write != NULL) {
+                               error = pops->puffs_node_write(pu,
+                                   opcookie, auxt->pvnr_data,
+                                   auxt->pvnr_offset, &auxt->pvnr_resid,
+                                   pcr, auxt->pvnr_ioflag);
+                       } else {
                                error = EIO;
                                break;
                        }
 
-                       error = pops->puffs_node_write(pu,
-                           opcookie, auxt->pvnr_data,
-                           auxt->pvnr_offset, &auxt->pvnr_resid,
-                           pcr, auxt->pvnr_ioflag);
 
                        /* don't need to move data back to the kernel */
                        preq->preq_buflen = sizeof(struct puffs_vnmsg_write);
diff -r 81db88452aa0 -r daafeaf74d6f lib/libpuffs/puffs.h
--- a/lib/libpuffs/puffs.h      Thu Jul 05 17:22:02 2012 +0000
+++ b/lib/libpuffs/puffs.h      Thu Jul 05 17:26:14 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs.h,v 1.119.4.1 2012/04/23 16:48:58 riz Exp $      */
+/*     $NetBSD: puffs.h,v 1.119.4.2 2012/07/05 17:26:14 riz Exp $      */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -111,6 +111,12 @@
 #define PUFFS_FSYNC_DATAONLY 0x0002
 #define PUFFS_FSYNC_CACHE    0x0100
 
+/*
+ * xflags for setattr_ttl and write2
+ */
+#define PUFFS_SETATTR_FAF    0x1
+#define PUFFS_WRITE_FAF      0x1
+
 #define PUFFS_EXTATTR_LIST_LENPREFIX 1
 /*
  * Magic constants
@@ -238,9 +244,11 @@
            struct timespec *);
        int (*puffs_node_setattr_ttl)(struct puffs_usermount *,
            puffs_cookie_t, struct vattr *, const struct puffs_cred *,
-           struct timespec *);
+           struct timespec *, int);
+       int (*puffs_node_write2)(struct puffs_usermount *, puffs_cookie_t,
+           uint8_t *, off_t, size_t *, const struct puffs_cred *, int, int);
 
-       void *puffs_ops_spare[30];
+       void *puffs_ops_spare[29];
 };
 
 typedef        int (*pu_pathbuild_fn)(struct puffs_usermount *,
@@ -393,7 +401,10 @@
            struct timespec *);                                         \
        int fsname##_node_setattr_ttl(struct puffs_usermount *,         \
            puffs_cookie_t, struct vattr *, const struct puffs_cred *,  \
-           struct timespec *);
+           struct timespec *, int);                                    \
+       int fsname##_node_write2(struct puffs_usermount *,              \
+           puffs_cookie_t, uint8_t *, off_t, size_t *,                 \
+           const struct puffs_cred *, int, int);
 
 
 #define PUFFSOP_INIT(ops)                                              \
diff -r 81db88452aa0 -r daafeaf74d6f lib/libpuffs/puffs_ops.3
--- a/lib/libpuffs/puffs_ops.3  Thu Jul 05 17:22:02 2012 +0000
+++ b/lib/libpuffs/puffs_ops.3  Thu Jul 05 17:26:14 2012 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: puffs_ops.3,v 1.29.4.1 2012/04/23 16:48:57 riz Exp $
+.\"    $NetBSD: puffs_ops.3,v 1.29.4.2 2012/07/05 17:26:14 riz Exp $
 .\"
 .\" Copyright (c) 2007 Antti Kantee.  All rights reserved.
 .\"
@@ -110,7 +110,7 @@
 .Ft int
 .Fo puffs_node_setattr_ttl
 .Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "const struct vattr *vap"
-.Fa "const struct puffs_cred *pcr" "struct timespec *va_ttl"
+.Fa "const struct puffs_cred *pcr" "struct timespec *va_ttl" "int xflag"
 .Fc
 .Ft int
 .Fo puffs_node_poll
@@ -187,6 +187,12 @@
 .Fa "off_t offset" "size_t *resid" "const struct puffs_cred *pcr" "int ioflag"
 .Fc
 .Ft int
+.Fo puffs_node_write2
+.Fa "struct puffs_usermount *pu" "puffs_cookie_t opc" "uint8_t *buf"
+.Fa "off_t offset" "size_t *resid" "const struct puffs_cred *pcr" "int ioflag"
+.Fa "int xflag"
+.Fc
+.Ft int
 .Fo puffs_node_abortop
 .Fa "struct puffs_usermount *pu" "puffs_cookie_t opc"
 .Fa "const struct puffs_cn *pcn"
@@ -241,6 +247,7 @@
 .Fn puffs_newinfo_setvattl "struct puffs_newinfo *pni" "struct timespec *va_ttl"
 .Ft void
 .Fn puffs_newinfo_setcnttl "struct puffs_newinfo *pni" "struct timespec *cn_ttl"
+.Fc
 .Sh DESCRIPTION
 The operations
 .Nm puffs
@@ -521,11 +528,15 @@
 which contain a value different from
 .Dv PUFFS_VNOVAL
 (typecast to the field's type!) contain a valid value.
-.It Fn puffs_node_setattr_ttl "pu" "opc" "va" "pcr" "va_ttl"
+.It Fn puffs_node_setattr_ttl "pu" "opc" "va" "pcr" "va_ttl" "xflag"
 Same as
 .Fn puffs_node_setattr
 with cached attribute time to live specified in
-.Fa va_ttl
+.Fa va_ttl .
+.Dv PUFFS_SETATTR_FAF
+will be set in 
+.Fa xflag
+for Fire-And-Forget operations.
 .It Fn puffs_node_poll "pu" "opc" "events"
 Poll for events on node
 .Ar opc .
@@ -749,8 +760,10 @@
 should be set to indicate the amount of request NOT completed.
 In the normal case this should be 0.
 .It Fn puffs_node_write "pu" "opc" "buf" "offset" "resid" "pcr" "ioflag"
+.It Fn puffs_node_write2 "pu" "opc" "buf" "offset" "resid" "pcr" "ioflag" \
+"xflag"
 .Fn puffs_node_write
-Write data to a file
+writes data to a file
 .Fa opc
 at
 .Fa offset
@@ -759,9 +772,17 @@
 .Fa resid ;
 everything must be written or an error will be generated.
 The parameter must be set to indicate the amount of data NOT written.
-In case the flag
+In case the ioflag
 .Dv PUFFS_IO_APPEND
 is specified, the data should be appended to the end of the file.
+.Fn puffs_node_write2
+serves the same purpose as
+.Fn puffs_node_write
+with an additional 
+.Fa xflag
+in which
+.Dv PUFFS_WRITE_FAF
+is set for Fire-And-Forget operations.
 .It Fn puffs_node_print "pu" "opc"
 Print information about node.
 This is used only for kernel-initiated diagnostic purposes.



Home | Main Index | Thread Index | Old Index