Source-Changes-HG archive

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

[src/trunk]: src Add "void *extra" argument to vcache_new() so a file system may



details:   https://anonhg.NetBSD.org/src/rev/04b4fa015e50
branches:  trunk
changeset: 995680:04b4fa015e50
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Jan 01 10:06:54 2019 +0000

description:
Add "void *extra" argument to vcache_new() so a file system may
pass more information about the file to create.

Welcome to 8.99.30

diffstat:

 share/man/man9/vfsops.9         |  10 +++++++---
 share/man/man9/vnode.9          |  10 +++++++---
 sys/fs/tmpfs/tmpfs_subr.c       |   8 ++++----
 sys/fs/tmpfs/tmpfs_vfsops.c     |   6 +++---
 sys/fs/udf/udf_subr.c           |   8 ++++----
 sys/kern/vfs_subr.c             |   8 ++++----
 sys/kern/vfs_vnode.c            |   8 ++++----
 sys/miscfs/deadfs/dead_vfsops.c |   6 +++---
 sys/sys/mount.h                 |  11 ++++++-----
 sys/sys/param.h                 |   4 ++--
 sys/sys/vnode.h                 |   4 ++--
 sys/ufs/ext2fs/ext2fs_vfsops.c  |   6 +++---
 sys/ufs/ext2fs/ext2fs_vnops.c   |   6 +++---
 sys/ufs/ffs/ffs_vfsops.c        |   6 +++---
 sys/ufs/ffs/ffs_wapbl.c         |   6 +++---
 sys/ufs/lfs/lfs_rfw.c           |   7 ++++---
 sys/ufs/lfs/lfs_vfsops.c        |   6 +++---
 sys/ufs/lfs/lfs_vnops.c         |   9 +++++----
 sys/ufs/ufs/ufs_vnops.c         |   9 +++++----
 19 files changed, 75 insertions(+), 63 deletions(-)

diffs (truncated from 586 to 300 lines):

diff -r db798dd793b6 -r 04b4fa015e50 share/man/man9/vfsops.9
--- a/share/man/man9/vfsops.9   Tue Jan 01 08:09:30 2019 +0000
+++ b/share/man/man9/vfsops.9   Tue Jan 01 10:06:54 2019 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: vfsops.9,v 1.48 2017/07/03 21:28:48 wiz Exp $
+.\"     $NetBSD: vfsops.9,v 1.49 2019/01/01 10:06:54 hannken Exp $
 .\"
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 12, 2015
+.Dd January 1, 2019
 .Dt VFSOPS 9
 .Os
 .Sh NAME
@@ -72,7 +72,7 @@
 .Ft int
 .Fn VFS_LOADVNODE "struct mount *mp" "struct vnode *vp" "const void *key" "size_t key_len" "const void **new_key"
 .Ft int
-.Fn VFS_NEWVNODE "struct mount *mp" "struct vnode *dvp" "struct vnode *vp" "struct vattr *vap" "kauth_cred_t cred" "size_t *key_len" "const void **new_key"
+.Fn VFS_NEWVNODE "struct mount *mp" "struct vnode *dvp" "struct vnode *vp" "struct vattr *vap" "kauth_cred_t cred" "void *extra" "size_t *key_len" "const void **new_key"
 .Ft int
 .Fn VFS_FHTOVP "struct mount *mp" "struct fid *fhp" "struct vnode **vpp"
 .Ft int
@@ -378,6 +378,10 @@
 .Fa cred
 holds the credentials for the file to create.
 .Pp
+The argument
+.Fa extra
+allows the caller to pass more information about the file to create.
+.Pp
 The key for the file is returned in the addresses specified by
 .Fa key_len
 and
diff -r db798dd793b6 -r 04b4fa015e50 share/man/man9/vnode.9
--- a/share/man/man9/vnode.9    Tue Jan 01 08:09:30 2019 +0000
+++ b/share/man/man9/vnode.9    Tue Jan 01 10:06:54 2019 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: vnode.9,v 1.81 2017/07/03 21:28:48 wiz Exp $
+.\"     $NetBSD: vnode.9,v 1.82 2019/01/01 10:06:54 hannken Exp $
 .\"
 .\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 28, 2017
+.Dd January 1, 2019
 .Dt VNODE 9
 .Os
 .Sh NAME
@@ -76,7 +76,7 @@
 .Ft int
 .Fn vcache_get "struct mount *mp" "const void *key" "size_t key_len" "struct vnode **vpp"
 .Ft int
-.Fn vcache_new "struct mount *mp" "struct vnode *dvp" "struct vattr *vap" "kauth_cred_t cred" "struct vnode **vpp"
+.Fn vcache_new "struct mount *mp" "struct vnode *dvp" "struct vattr *vap" "kauth_cred_t cred" "void *extra" "struct vnode **vpp"
 .Ft int
 .Fn vcache_rekey_enter "struct mount *mp" "struct vnode *vp" "const void *old_key" "size_t old_key_len" "const void *new_key" "size_t new_key_len"
 .Ft void
@@ -578,6 +578,10 @@
 .Fa cred
 holds the credentials for the file to create.
 .Pp
+The argument
+.Fa extra
+allows the caller to pass more information about the file to create.
+.Pp
 If a vnode is successfully created zero is returned, otherwise an
 appropriate error code is returned.
 .It Fn vcache_rekey_enter "mp" "vp" "old_key" "old_key_len" "new_key" "new_key_len"
diff -r db798dd793b6 -r 04b4fa015e50 sys/fs/tmpfs/tmpfs_subr.c
--- a/sys/fs/tmpfs/tmpfs_subr.c Tue Jan 01 08:09:30 2019 +0000
+++ b/sys/fs/tmpfs/tmpfs_subr.c Tue Jan 01 10:06:54 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_subr.c,v 1.103 2018/05/28 21:04:35 chs Exp $     */
+/*     $NetBSD: tmpfs_subr.c,v 1.104 2019/01/01 10:06:54 hannken Exp $ */
 
 /*
  * Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.103 2018/05/28 21:04:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.104 2019/01/01 10:06:54 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/cprng.h>
@@ -177,7 +177,7 @@
  */
 int
 tmpfs_newvnode(struct mount *mp, struct vnode *dvp, struct vnode *vp,
-    struct vattr *vap, kauth_cred_t cred,
+    struct vattr *vap, kauth_cred_t cred, void *extra,
     size_t *key_len, const void **new_key)
 {
        tmpfs_mount_t *tmp = VFS_TO_TMPFS(mp);
@@ -390,7 +390,7 @@
        }
 
        /* Allocate a vnode that represents the new file. */
-       error = vcache_new(dvp->v_mount, dvp, vap, cnp->cn_cred, vpp);
+       error = vcache_new(dvp->v_mount, dvp, vap, cnp->cn_cred, NULL, vpp);
        if (error) {
                if (slink != NULL)
                        tmpfs_strname_free(tmp, slink, ssize);
diff -r db798dd793b6 -r 04b4fa015e50 sys/fs/tmpfs/tmpfs_vfsops.c
--- a/sys/fs/tmpfs/tmpfs_vfsops.c       Tue Jan 01 08:09:30 2019 +0000
+++ b/sys/fs/tmpfs/tmpfs_vfsops.c       Tue Jan 01 10:06:54 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_vfsops.c,v 1.73 2018/08/09 08:43:56 christos Exp $       */
+/*     $NetBSD: tmpfs_vfsops.c,v 1.74 2019/01/01 10:06:54 hannken Exp $        */
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.73 2018/08/09 08:43:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.74 2019/01/01 10:06:54 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -205,7 +205,7 @@
        va.va_mode = args->ta_root_mode & ALLPERMS;
        va.va_uid = args->ta_root_uid;
        va.va_gid = args->ta_root_gid;
-       error = vcache_new(mp, NULL, &va, NOCRED, &vp);
+       error = vcache_new(mp, NULL, &va, NOCRED, NULL, &vp);
        if (error) {
                mp->mnt_data = NULL;
                tmpfs_mntmem_destroy(tmp);
diff -r db798dd793b6 -r 04b4fa015e50 sys/fs/udf/udf_subr.c
--- a/sys/fs/udf/udf_subr.c     Tue Jan 01 08:09:30 2019 +0000
+++ b/sys/fs/udf/udf_subr.c     Tue Jan 01 10:06:54 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.144 2018/10/14 17:37:40 jdolecek Exp $ */
+/* $NetBSD: udf_subr.c,v 1.145 2019/01/01 10:06:54 hannken Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.144 2018/10/14 17:37:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.145 2019/01/01 10:06:54 hannken Exp $");
 #endif /* not lint */
 
 
@@ -5779,7 +5779,7 @@
 
 int
 udf_newvnode(struct mount *mp, struct vnode *dvp, struct vnode *vp,
-    struct vattr *vap, kauth_cred_t cred,
+    struct vattr *vap, kauth_cred_t cred, void *extra,
     size_t *key_len, const void **new_key)
 {
        union dscrptr *dscr;
@@ -5938,7 +5938,7 @@
        struct udf_mount *ump = dir_node->ump;
        int error;
 
-       error = vcache_new(dvp->v_mount, dvp, vap, cnp->cn_cred, vpp);
+       error = vcache_new(dvp->v_mount, dvp, vap, cnp->cn_cred, NULL, vpp);
        if (error)
                return error;
 
diff -r db798dd793b6 -r 04b4fa015e50 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Tue Jan 01 08:09:30 2019 +0000
+++ b/sys/kern/vfs_subr.c       Tue Jan 01 10:06:54 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.470 2017/10/27 12:25:15 joerg Exp $     */
+/*     $NetBSD: vfs_subr.c,v 1.471 2019/01/01 10:06:54 hannken Exp $   */
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.470 2017/10/27 12:25:15 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.471 2019/01/01 10:06:54 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -351,7 +351,7 @@
        va.va_type = VBLK;
        va.va_rdev = dev;
 
-       return vcache_new(dead_rootmount, NULL, &va, NOCRED, vpp);
+       return vcache_new(dead_rootmount, NULL, &va, NOCRED, NULL, vpp);
 }
 
 /*
@@ -367,7 +367,7 @@
        va.va_type = VCHR;
        va.va_rdev = dev;
 
-       return vcache_new(dead_rootmount, NULL, &va, NOCRED, vpp);
+       return vcache_new(dead_rootmount, NULL, &va, NOCRED, NULL, vpp);
 }
 
 /*
diff -r db798dd793b6 -r 04b4fa015e50 sys/kern/vfs_vnode.c
--- a/sys/kern/vfs_vnode.c      Tue Jan 01 08:09:30 2019 +0000
+++ b/sys/kern/vfs_vnode.c      Tue Jan 01 10:06:54 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_vnode.c,v 1.100 2017/09/22 06:05:20 joerg Exp $    */
+/*     $NetBSD: vfs_vnode.c,v 1.101 2019/01/01 10:06:54 hannken Exp $  */
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -156,7 +156,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.100 2017/09/22 06:05:20 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.101 2019/01/01 10:06:54 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -1375,7 +1375,7 @@
  */
 int
 vcache_new(struct mount *mp, struct vnode *dvp, struct vattr *vap,
-    kauth_cred_t cred, struct vnode **vpp)
+    kauth_cred_t cred, void *extra, struct vnode **vpp)
 {
        int error;
        uint32_t hash;
@@ -1393,7 +1393,7 @@
        vp = VIMPL_TO_VNODE(vip);
 
        /* Create and load the fs node. */
-       error = VFS_NEWVNODE(mp, dvp, vp, vap, cred,
+       error = VFS_NEWVNODE(mp, dvp, vp, vap, cred, extra,
            &vip->vi_key.vk_key_len, &vip->vi_key.vk_key);
        if (error) {
                mutex_enter(&vcache_lock);
diff -r db798dd793b6 -r 04b4fa015e50 sys/miscfs/deadfs/dead_vfsops.c
--- a/sys/miscfs/deadfs/dead_vfsops.c   Tue Jan 01 08:09:30 2019 +0000
+++ b/sys/miscfs/deadfs/dead_vfsops.c   Tue Jan 01 10:06:54 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dead_vfsops.c,v 1.8 2017/08/21 08:56:45 hannken Exp $  */
+/*     $NetBSD: dead_vfsops.c,v 1.9 2019/01/01 10:06:54 hannken Exp $  */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dead_vfsops.c,v 1.8 2017/08/21 08:56:45 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dead_vfsops.c,v 1.9 2019/01/01 10:06:54 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -92,7 +92,7 @@
  */
 int
 dead_newvnode(struct mount *mp, struct vnode *dvp, struct vnode *vp,
-    struct vattr *vap, kauth_cred_t cred,
+    struct vattr *vap, kauth_cred_t cred, void *extra,
     size_t *key_len, const void **new_key)
 {
 
diff -r db798dd793b6 -r 04b4fa015e50 sys/sys/mount.h
--- a/sys/sys/mount.h   Tue Jan 01 08:09:30 2019 +0000
+++ b/sys/sys/mount.h   Tue Jan 01 10:06:54 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mount.h,v 1.233 2018/12/10 21:19:33 jdolecek Exp $     */
+/*     $NetBSD: mount.h,v 1.234 2019/01/01 10:06:54 hannken Exp $      */
 
 /*
  * Copyright (c) 1989, 1991, 1993
@@ -189,7 +189,7 @@
        int     (*vfs_loadvnode) (struct mount *, struct vnode *,
                                    const void *, size_t, const void **);
        int     (*vfs_newvnode) (struct mount *, struct vnode *, struct vnode *,
-                                   struct vattr *, kauth_cred_t,
+                                   struct vattr *, kauth_cred_t, void *,
                                    size_t *, const void **);
        int     (*vfs_fhtovp)   (struct mount *, struct fid *,
                                    struct vnode **);
@@ -215,8 +215,9 @@
 #define VFS_VGET(MP, INO, VPP)    (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
 #define VFS_LOADVNODE(MP, VP, KEY, KEY_LEN, NEW_KEY) \
        (*(MP)->mnt_op->vfs_loadvnode)(MP, VP, KEY, KEY_LEN, NEW_KEY)
-#define VFS_NEWVNODE(MP, DVP, VP, VAP, CRED, NEW_LEN, NEW_KEY) \
-       (*(MP)->mnt_op->vfs_newvnode)(MP, DVP, VP, VAP, CRED, NEW_LEN, NEW_KEY)
+#define VFS_NEWVNODE(MP, DVP, VP, VAP, CRED, EXTRA, NEW_LEN, NEW_KEY) \
+       (*(MP)->mnt_op->vfs_newvnode)(MP, DVP, VP, VAP, CRED, EXTRA, \



Home | Main Index | Thread Index | Old Index