Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs/kernfs Finish KAME IPSEC removal:



details:   https://anonhg.NetBSD.org/src/rev/bc174c96ae34
branches:  trunk
changeset: 330659:bc174c96ae34
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Jul 17 08:21:34 2014 +0000

description:
Finish KAME IPSEC removal:
- Remove field kfs_value, it is always zero. Compute the hash from kt_tag.
- Remove stray definitions kernfs_revoke_sa and kernfs_revoke_sp.

While here, remove kfs_type from allocvp(), it is always kt->kt_tag.

diffstat:

 sys/miscfs/kernfs/kernfs.h        |  11 +++--------
 sys/miscfs/kernfs/kernfs_subr.c   |  37 ++++++++++++++++++-------------------
 sys/miscfs/kernfs/kernfs_vfsops.c |   6 +++---
 sys/miscfs/kernfs/kernfs_vnops.c  |  13 ++++++-------
 4 files changed, 30 insertions(+), 37 deletions(-)

diffs (242 lines):

diff -r e797f1b835a6 -r bc174c96ae34 sys/miscfs/kernfs/kernfs.h
--- a/sys/miscfs/kernfs/kernfs.h        Thu Jul 17 08:16:12 2014 +0000
+++ b/sys/miscfs/kernfs/kernfs.h        Thu Jul 17 08:21:34 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernfs.h,v 1.37 2012/03/22 20:34:38 drochner Exp $     */
+/*     $NetBSD: kernfs.h,v 1.38 2014/07/17 08:21:34 hannken Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -91,9 +91,8 @@
        kfstype         kfs_type;       /* type of kernfs node */
        mode_t          kfs_mode;       /* mode bits for stat() */
        long            kfs_fileno;     /* unique file id */
-       u_int32_t       kfs_value;      /* SA id or SP id (KFSint) */
        const struct kern_target *kfs_kt;
-       void            *kfs_v;         /* pointer to secasvar/secpolicy/mbuf */
+       void            *kfs_v;         /* dynamic node private data */
        long            kfs_cookie;     /* fileno cookie */
 };
 
@@ -133,11 +132,7 @@
 void kernfs_hashreinit(void);
 void kernfs_hashdone(void);
 int kernfs_freevp(struct vnode *);
-int kernfs_allocvp(struct mount *, struct vnode **, kfstype,
-       const struct kern_target *, u_int32_t);
-
-void kernfs_revoke_sa(struct secasvar *);
-void kernfs_revoke_sp(struct secpolicy *);
+int kernfs_allocvp(struct mount *, struct vnode **, const struct kern_target *);
 
 /*
  * Data types for the kernfs file operations.
diff -r e797f1b835a6 -r bc174c96ae34 sys/miscfs/kernfs/kernfs_subr.c
--- a/sys/miscfs/kernfs/kernfs_subr.c   Thu Jul 17 08:16:12 2014 +0000
+++ b/sys/miscfs/kernfs/kernfs_subr.c   Thu Jul 17 08:21:34 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernfs_subr.c,v 1.27 2014/04/08 17:56:10 christos Exp $        */
+/*     $NetBSD: kernfs_subr.c,v 1.28 2014/07/17 08:21:34 hannken Exp $ */
 
 /*
  * Copyright (c) 1993
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kernfs_subr.c,v 1.27 2014/04/08 17:56:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_subr.c,v 1.28 2014/07/17 08:21:34 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -93,11 +93,11 @@
 void kernfs_hashins(struct kernfs_node *);
 void kernfs_hashrem(struct kernfs_node *);
 struct vnode *kernfs_hashget(kfstype, struct mount *,
-    const struct kern_target *, u_int32_t);
+    const struct kern_target *);
 
 static LIST_HEAD(kfs_hashhead, kernfs_node) *kfs_hashtbl;
 static u_long  kfs_ihash;      /* size of hash table - 1 */
-#define KFSVALUEHASH(v)        ((v) & kfs_ihash)
+#define KFSHASH(v)     ((v) & kfs_ihash)
 
 static kmutex_t kfs_hashlock;
 static kmutex_t kfs_ihash_lock;
@@ -108,7 +108,7 @@
  * allocate a kfsnode/vnode pair.  the vnode is
  * referenced, and locked.
  *
- * the kfs_type, kfs_value and mount point uniquely
+ * the kfs_type and mount point uniquely
  * identify a kfsnode.  the mount point is needed
  * because someone might mount this filesystem
  * twice.
@@ -131,19 +131,19 @@
  * the vnode free list.
  */
 int
-kernfs_allocvp(struct mount *mp, struct vnode **vpp, kfstype kfs_type,
-    const struct kern_target *kt, u_int32_t value)
+kernfs_allocvp(struct mount *mp, struct vnode **vpp,
+    const struct kern_target *kt)
 {
        struct kernfs_node *kfs = NULL, *kfsp;
        struct vnode *vp = NULL;
        int error;
        long *cookie;
 
-       if ((*vpp = kernfs_hashget(kfs_type, mp, kt, value)) != NULL)
+       if ((*vpp = kernfs_hashget(kt->kt_tag, mp, kt)) != NULL)
                return (0);
 
        mutex_enter(&kfs_hashlock);
-       if ((*vpp = kernfs_hashget(kfs_type, mp, kt, value)) != NULL) {
+       if ((*vpp = kernfs_hashget(kt->kt_tag, mp, kt)) != NULL) {
                mutex_exit(&kfs_hashlock);
                return (0);
        }
@@ -184,18 +184,17 @@
        else
                TAILQ_INSERT_TAIL(&VFSTOKERNFS(mp)->nodelist, kfs, kfs_list);
 
-       kfs->kfs_type = kfs_type;
+       kfs->kfs_type = kt->kt_tag;
        kfs->kfs_vnode = vp;
-       kfs->kfs_fileno = KERNFS_FILENO(kt, kfs_type, kfs->kfs_cookie);
-       kfs->kfs_value = value;
+       kfs->kfs_fileno = KERNFS_FILENO(kt, kt->kt_tag, kfs->kfs_cookie);
        kfs->kfs_kt = kt;
        kfs->kfs_mode = kt->kt_mode;
        vp->v_type = kt->kt_vtype;
 
-       if (kfs_type == KFSkern)
+       if (kt->kt_tag == KFSkern)
                vp->v_vflag = VV_ROOT;
 
-       if (kfs_type == KFSdevice) {
+       if (kt->kt_tag == KFSdevice) {
                spec_node_init(vp, *(dev_t *)kt->kt_data);
        }
 
@@ -249,7 +248,7 @@
        for (i = 0; i <= oldmask; i++) {
                while ((pp = LIST_FIRST(&oldhash[i])) != NULL) {
                        LIST_REMOVE(pp, kfs_hash);
-                       val = KFSVALUEHASH(pp->kfs_value);
+                       val = KFSHASH(pp->kfs_type);
                        LIST_INSERT_HEAD(&hash[val], pp, kfs_hash);
                }
        }
@@ -270,7 +269,7 @@
 }
 
 struct vnode *
-kernfs_hashget(kfstype type, struct mount *mp, const struct kern_target *kt, u_int32_t value)
+kernfs_hashget(kfstype type, struct mount *mp, const struct kern_target *kt)
 {
        struct kfs_hashhead *ppp;
        struct kernfs_node *pp;
@@ -278,11 +277,11 @@
 
  loop:
        mutex_enter(&kfs_ihash_lock);
-       ppp = &kfs_hashtbl[KFSVALUEHASH(value)];
+       ppp = &kfs_hashtbl[KFSHASH(type)];
        LIST_FOREACH(pp, ppp, kfs_hash) {
                vp = KERNFSTOV(pp);
                if (pp->kfs_type == type && vp->v_mount == mp &&
-                   pp->kfs_kt == kt && pp->kfs_value == value) {
+                   pp->kfs_kt == kt) {
                        mutex_enter(vp->v_interlock);
                        mutex_exit(&kfs_ihash_lock);
                        if (vget(vp, LK_EXCLUSIVE))
@@ -308,7 +307,7 @@
        KASSERT(error == 0);
 
        mutex_enter(&kfs_ihash_lock);
-       ppp = &kfs_hashtbl[KFSVALUEHASH(pp->kfs_value)];
+       ppp = &kfs_hashtbl[KFSHASH(pp->kfs_type)];
        LIST_INSERT_HEAD(ppp, pp, kfs_hash);
        mutex_exit(&kfs_ihash_lock);
 }
diff -r e797f1b835a6 -r bc174c96ae34 sys/miscfs/kernfs/kernfs_vfsops.c
--- a/sys/miscfs/kernfs/kernfs_vfsops.c Thu Jul 17 08:16:12 2014 +0000
+++ b/sys/miscfs/kernfs/kernfs_vfsops.c Thu Jul 17 08:21:34 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernfs_vfsops.c,v 1.93 2014/03/23 15:21:16 hannken Exp $       */
+/*     $NetBSD: kernfs_vfsops.c,v 1.94 2014/07/17 08:21:34 hannken Exp $       */
 
 /*
  * Copyright (c) 1992, 1993, 1995
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.93 2014/03/23 15:21:16 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.94 2014/07/17 08:21:34 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -192,7 +192,7 @@
 {
 
        /* setup "." */
-       return (kernfs_allocvp(mp, vpp, KFSkern, &kern_targets[0], 0));
+       return (kernfs_allocvp(mp, vpp, &kern_targets[0]));
 }
 
 /*ARGSUSED*/
diff -r e797f1b835a6 -r bc174c96ae34 sys/miscfs/kernfs/kernfs_vnops.c
--- a/sys/miscfs/kernfs/kernfs_vnops.c  Thu Jul 17 08:16:12 2014 +0000
+++ b/sys/miscfs/kernfs/kernfs_vnops.c  Thu Jul 17 08:21:34 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernfs_vnops.c,v 1.151 2014/04/08 17:56:10 christos Exp $      */
+/*     $NetBSD: kernfs_vnops.c,v 1.152 2014/07/17 08:21:34 hannken Exp $       */
 
 /*
  * Copyright (c) 1992, 1993
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.151 2014/04/08 17:56:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.152 2014/07/17 08:21:34 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -520,7 +520,7 @@
                break;
 
        found:
-               error = kernfs_allocvp(dvp->v_mount, vpp, kt->kt_tag, kt, 0);
+               error = kernfs_allocvp(dvp->v_mount, vpp, kt);
                if (error)
                        return error;
                VOP_UNLOCK(*vpp);
@@ -828,14 +828,13 @@
 
 static int
 kernfs_setdirentfileno_kt(struct dirent *d, const struct kern_target *kt,
-    u_int32_t value, struct vop_readdir_args *ap)
+    struct vop_readdir_args *ap)
 {
        struct kernfs_node *kfs;
        struct vnode *vp;
        int error;
 
-       if ((error = kernfs_allocvp(ap->a_vp->v_mount, &vp, kt->kt_tag, kt,
-           value)) != 0)
+       if ((error = kernfs_allocvp(ap->a_vp->v_mount, &vp, kt)) != 0)
                return error;
        kfs = VTOKERN(vp);
        d->d_fileno = kfs->kfs_fileno;
@@ -863,7 +862,7 @@
                break;
        }
        if (ikt != thisdir_kfs->kfs_kt) {
-               if ((error = kernfs_setdirentfileno_kt(d, ikt, 0, ap)) != 0)
+               if ((error = kernfs_setdirentfileno_kt(d, ikt, ap)) != 0)
                        return error;
        } else
                d->d_fileno = thisdir_kfs->kfs_fileno;



Home | Main Index | Thread Index | Old Index