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.
This commit is contained in:
parent
2b476a8d95
commit
3fd06797df
@ -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
|
* Copyright (c) 1992, 1993
|
||||||
@ -91,9 +91,8 @@ struct kernfs_node {
|
|||||||
kfstype kfs_type; /* type of kernfs node */
|
kfstype kfs_type; /* type of kernfs node */
|
||||||
mode_t kfs_mode; /* mode bits for stat() */
|
mode_t kfs_mode; /* mode bits for stat() */
|
||||||
long kfs_fileno; /* unique file id */
|
long kfs_fileno; /* unique file id */
|
||||||
u_int32_t kfs_value; /* SA id or SP id (KFSint) */
|
|
||||||
const struct kern_target *kfs_kt;
|
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 */
|
long kfs_cookie; /* fileno cookie */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -133,11 +132,7 @@ void kernfs_hashinit(void);
|
|||||||
void kernfs_hashreinit(void);
|
void kernfs_hashreinit(void);
|
||||||
void kernfs_hashdone(void);
|
void kernfs_hashdone(void);
|
||||||
int kernfs_freevp(struct vnode *);
|
int kernfs_freevp(struct vnode *);
|
||||||
int kernfs_allocvp(struct mount *, struct vnode **, kfstype,
|
int kernfs_allocvp(struct mount *, struct vnode **, const struct kern_target *);
|
||||||
const struct kern_target *, u_int32_t);
|
|
||||||
|
|
||||||
void kernfs_revoke_sa(struct secasvar *);
|
|
||||||
void kernfs_revoke_sp(struct secpolicy *);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Data types for the kernfs file operations.
|
* Data types for the kernfs file operations.
|
||||||
|
@ -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
|
* Copyright (c) 1993
|
||||||
@ -73,7 +73,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -93,11 +93,11 @@ __KERNEL_RCSID(0, "$NetBSD: kernfs_subr.c,v 1.27 2014/04/08 17:56:10 christos Ex
|
|||||||
void kernfs_hashins(struct kernfs_node *);
|
void kernfs_hashins(struct kernfs_node *);
|
||||||
void kernfs_hashrem(struct kernfs_node *);
|
void kernfs_hashrem(struct kernfs_node *);
|
||||||
struct vnode *kernfs_hashget(kfstype, struct mount *,
|
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 LIST_HEAD(kfs_hashhead, kernfs_node) *kfs_hashtbl;
|
||||||
static u_long kfs_ihash; /* size of hash table - 1 */
|
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_hashlock;
|
||||||
static kmutex_t kfs_ihash_lock;
|
static kmutex_t kfs_ihash_lock;
|
||||||
@ -108,7 +108,7 @@ static kmutex_t kfs_ihash_lock;
|
|||||||
* allocate a kfsnode/vnode pair. the vnode is
|
* allocate a kfsnode/vnode pair. the vnode is
|
||||||
* referenced, and locked.
|
* 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
|
* identify a kfsnode. the mount point is needed
|
||||||
* because someone might mount this filesystem
|
* because someone might mount this filesystem
|
||||||
* twice.
|
* twice.
|
||||||
@ -131,19 +131,19 @@ static kmutex_t kfs_ihash_lock;
|
|||||||
* the vnode free list.
|
* the vnode free list.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
kernfs_allocvp(struct mount *mp, struct vnode **vpp, kfstype kfs_type,
|
kernfs_allocvp(struct mount *mp, struct vnode **vpp,
|
||||||
const struct kern_target *kt, u_int32_t value)
|
const struct kern_target *kt)
|
||||||
{
|
{
|
||||||
struct kernfs_node *kfs = NULL, *kfsp;
|
struct kernfs_node *kfs = NULL, *kfsp;
|
||||||
struct vnode *vp = NULL;
|
struct vnode *vp = NULL;
|
||||||
int error;
|
int error;
|
||||||
long *cookie;
|
long *cookie;
|
||||||
|
|
||||||
if ((*vpp = kernfs_hashget(kfs_type, mp, kt, value)) != NULL)
|
if ((*vpp = kernfs_hashget(kt->kt_tag, mp, kt)) != NULL)
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
mutex_enter(&kfs_hashlock);
|
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);
|
mutex_exit(&kfs_hashlock);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -184,18 +184,17 @@ again:
|
|||||||
else
|
else
|
||||||
TAILQ_INSERT_TAIL(&VFSTOKERNFS(mp)->nodelist, kfs, kfs_list);
|
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_vnode = vp;
|
||||||
kfs->kfs_fileno = KERNFS_FILENO(kt, kfs_type, kfs->kfs_cookie);
|
kfs->kfs_fileno = KERNFS_FILENO(kt, kt->kt_tag, kfs->kfs_cookie);
|
||||||
kfs->kfs_value = value;
|
|
||||||
kfs->kfs_kt = kt;
|
kfs->kfs_kt = kt;
|
||||||
kfs->kfs_mode = kt->kt_mode;
|
kfs->kfs_mode = kt->kt_mode;
|
||||||
vp->v_type = kt->kt_vtype;
|
vp->v_type = kt->kt_vtype;
|
||||||
|
|
||||||
if (kfs_type == KFSkern)
|
if (kt->kt_tag == KFSkern)
|
||||||
vp->v_vflag = VV_ROOT;
|
vp->v_vflag = VV_ROOT;
|
||||||
|
|
||||||
if (kfs_type == KFSdevice) {
|
if (kt->kt_tag == KFSdevice) {
|
||||||
spec_node_init(vp, *(dev_t *)kt->kt_data);
|
spec_node_init(vp, *(dev_t *)kt->kt_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +248,7 @@ kernfs_hashreinit(void)
|
|||||||
for (i = 0; i <= oldmask; i++) {
|
for (i = 0; i <= oldmask; i++) {
|
||||||
while ((pp = LIST_FIRST(&oldhash[i])) != NULL) {
|
while ((pp = LIST_FIRST(&oldhash[i])) != NULL) {
|
||||||
LIST_REMOVE(pp, kfs_hash);
|
LIST_REMOVE(pp, kfs_hash);
|
||||||
val = KFSVALUEHASH(pp->kfs_value);
|
val = KFSHASH(pp->kfs_type);
|
||||||
LIST_INSERT_HEAD(&hash[val], pp, kfs_hash);
|
LIST_INSERT_HEAD(&hash[val], pp, kfs_hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,7 +269,7 @@ kernfs_hashdone(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct vnode *
|
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 kfs_hashhead *ppp;
|
||||||
struct kernfs_node *pp;
|
struct kernfs_node *pp;
|
||||||
@ -278,11 +277,11 @@ kernfs_hashget(kfstype type, struct mount *mp, const struct kern_target *kt, u_i
|
|||||||
|
|
||||||
loop:
|
loop:
|
||||||
mutex_enter(&kfs_ihash_lock);
|
mutex_enter(&kfs_ihash_lock);
|
||||||
ppp = &kfs_hashtbl[KFSVALUEHASH(value)];
|
ppp = &kfs_hashtbl[KFSHASH(type)];
|
||||||
LIST_FOREACH(pp, ppp, kfs_hash) {
|
LIST_FOREACH(pp, ppp, kfs_hash) {
|
||||||
vp = KERNFSTOV(pp);
|
vp = KERNFSTOV(pp);
|
||||||
if (pp->kfs_type == type && vp->v_mount == mp &&
|
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_enter(vp->v_interlock);
|
||||||
mutex_exit(&kfs_ihash_lock);
|
mutex_exit(&kfs_ihash_lock);
|
||||||
if (vget(vp, LK_EXCLUSIVE))
|
if (vget(vp, LK_EXCLUSIVE))
|
||||||
@ -308,7 +307,7 @@ kernfs_hashins(struct kernfs_node *pp)
|
|||||||
KASSERT(error == 0);
|
KASSERT(error == 0);
|
||||||
|
|
||||||
mutex_enter(&kfs_ihash_lock);
|
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);
|
LIST_INSERT_HEAD(ppp, pp, kfs_hash);
|
||||||
mutex_exit(&kfs_ihash_lock);
|
mutex_exit(&kfs_ihash_lock);
|
||||||
}
|
}
|
||||||
|
@ -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
|
* Copyright (c) 1992, 1993, 1995
|
||||||
@ -39,7 +39,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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
|
#ifdef _KERNEL_OPT
|
||||||
#include "opt_compat_netbsd.h"
|
#include "opt_compat_netbsd.h"
|
||||||
@ -192,7 +192,7 @@ kernfs_root(struct mount *mp, struct vnode **vpp)
|
|||||||
{
|
{
|
||||||
|
|
||||||
/* setup "." */
|
/* setup "." */
|
||||||
return (kernfs_allocvp(mp, vpp, KFSkern, &kern_targets[0], 0));
|
return (kernfs_allocvp(mp, vpp, &kern_targets[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
|
@ -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
|
* Copyright (c) 1992, 1993
|
||||||
@ -39,7 +39,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#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/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -520,7 +520,7 @@ kernfs_lookup(void *v)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
found:
|
found:
|
||||||
error = kernfs_allocvp(dvp->v_mount, vpp, kt->kt_tag, kt, 0);
|
error = kernfs_allocvp(dvp->v_mount, vpp, kt);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
VOP_UNLOCK(*vpp);
|
VOP_UNLOCK(*vpp);
|
||||||
@ -828,14 +828,13 @@ kernfs_ioctl(void *v)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
kernfs_setdirentfileno_kt(struct dirent *d, const struct kern_target *kt,
|
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 kernfs_node *kfs;
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if ((error = kernfs_allocvp(ap->a_vp->v_mount, &vp, kt->kt_tag, kt,
|
if ((error = kernfs_allocvp(ap->a_vp->v_mount, &vp, kt)) != 0)
|
||||||
value)) != 0)
|
|
||||||
return error;
|
return error;
|
||||||
kfs = VTOKERN(vp);
|
kfs = VTOKERN(vp);
|
||||||
d->d_fileno = kfs->kfs_fileno;
|
d->d_fileno = kfs->kfs_fileno;
|
||||||
@ -863,7 +862,7 @@ kernfs_setdirentfileno(struct dirent *d, off_t entry,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ikt != thisdir_kfs->kfs_kt) {
|
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;
|
return error;
|
||||||
} else
|
} else
|
||||||
d->d_fileno = thisdir_kfs->kfs_fileno;
|
d->d_fileno = thisdir_kfs->kfs_fileno;
|
||||||
|
Loading…
Reference in New Issue
Block a user