Module Name: src
Committed By: hannken
Date: Thu Jul 17 08:21:34 UTC 2014
Modified Files:
src/sys/miscfs/kernfs: kernfs.h kernfs_subr.c kernfs_vfsops.c
kernfs_vnops.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/miscfs/kernfs/kernfs.h
cvs rdiff -u -r1.27 -r1.28 src/sys/miscfs/kernfs/kernfs_subr.c
cvs rdiff -u -r1.93 -r1.94 src/sys/miscfs/kernfs/kernfs_vfsops.c
cvs rdiff -u -r1.151 -r1.152 src/sys/miscfs/kernfs/kernfs_vnops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/miscfs/kernfs/kernfs.h
diff -u src/sys/miscfs/kernfs/kernfs.h:1.37 src/sys/miscfs/kernfs/kernfs.h:1.38
--- src/sys/miscfs/kernfs/kernfs.h:1.37 Thu Mar 22 20:34:38 2012
+++ src/sys/miscfs/kernfs/kernfs.h Thu Jul 17 08:21:34 2014
@@ -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 @@ struct kernfs_node {
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_hashinit(void);
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.
Index: src/sys/miscfs/kernfs/kernfs_subr.c
diff -u src/sys/miscfs/kernfs/kernfs_subr.c:1.27 src/sys/miscfs/kernfs/kernfs_subr.c:1.28
--- src/sys/miscfs/kernfs/kernfs_subr.c:1.27 Tue Apr 8 17:56:10 2014
+++ src/sys/miscfs/kernfs/kernfs_subr.c Thu Jul 17 08:21:34 2014
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: kernfs_subr.
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 @@ static kmutex_t kfs_ihash_lock;
* 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 @@ static kmutex_t kfs_ihash_lock;
* 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 @@ again:
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 @@ kernfs_hashreinit(void)
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 @@ kernfs_hashdone(void)
}
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 @@ kernfs_hashget(kfstype type, struct moun
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 @@ kernfs_hashins(struct kernfs_node *pp)
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);
}
Index: src/sys/miscfs/kernfs/kernfs_vfsops.c
diff -u src/sys/miscfs/kernfs/kernfs_vfsops.c:1.93 src/sys/miscfs/kernfs/kernfs_vfsops.c:1.94
--- src/sys/miscfs/kernfs/kernfs_vfsops.c:1.93 Sun Mar 23 15:21:16 2014
+++ src/sys/miscfs/kernfs/kernfs_vfsops.c Thu Jul 17 08:21:34 2014
@@ -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 @@ kernfs_root(struct mount *mp, struct vno
{
/* setup "." */
- return (kernfs_allocvp(mp, vpp, KFSkern, &kern_targets[0], 0));
+ return (kernfs_allocvp(mp, vpp, &kern_targets[0]));
}
/*ARGSUSED*/
Index: src/sys/miscfs/kernfs/kernfs_vnops.c
diff -u src/sys/miscfs/kernfs/kernfs_vnops.c:1.151 src/sys/miscfs/kernfs/kernfs_vnops.c:1.152
--- src/sys/miscfs/kernfs/kernfs_vnops.c:1.151 Tue Apr 8 17:56:10 2014
+++ src/sys/miscfs/kernfs/kernfs_vnops.c Thu Jul 17 08:21:34 2014
@@ -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 @@ kernfs_lookup(void *v)
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 @@ kernfs_ioctl(void *v)
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 @@ kernfs_setdirentfileno(struct dirent *d,
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;