Remove #ifdef KERNFS by using weak symbols. Notably, this approach

won't work when kernfs is a module.  But then again, kernfs as a
module (i.e. current situation) doesn't contain IPSEC support, so
it's not really any worse either.
This commit is contained in:
pooka 2010-03-03 01:13:26 +00:00
parent eb66a866ff
commit 8fcd8f95e1

View File

@ -1,4 +1,4 @@
/* $NetBSD: key.c,v 1.176 2010/01/31 00:43:37 hubertf Exp $ */
/* $NetBSD: key.c,v 1.177 2010/03/03 01:13:26 pooka Exp $ */
/* $KAME: key.c,v 1.310 2003/09/08 02:23:44 itojun Exp $ */
/*
@ -35,11 +35,10 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.176 2010/01/31 00:43:37 hubertf Exp $");
__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.177 2010/03/03 01:13:26 pooka Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
#include "fs_kernfs.h"
#include <sys/param.h>
#include <sys/systm.h>
@ -95,9 +94,7 @@ __KERNEL_RCSID(0, "$NetBSD: key.c,v 1.176 2010/01/31 00:43:37 hubertf Exp $");
#endif
#include <netinet6/ipcomp.h>
#ifdef KERNFS
#include <miscfs/kernfs/kernfs.h>
#endif
#include <machine/stdarg.h>
@ -119,6 +116,11 @@ __KERNEL_RCSID(0, "$NetBSD: key.c,v 1.176 2010/01/31 00:43:37 hubertf Exp $");
percpu_t *pfkeystat_percpu;
void kernfs_netkey_entangling_noodles(void *);
void kernfs_netkey_entangling_noodles(void *v) {}
__weak_alias(kernfs_revoke_sa,kernfs_netkey_entangling_noodles);
__weak_alias(kernfs_revoke_sp,kernfs_netkey_entangling_noodles);
/*
* Note on SA reference counting:
* - SAs that are not in DEAD state will have (total external reference + 1)
@ -963,9 +965,7 @@ key_delsav(struct secasvar *sav)
s = splsoftnet();
#ifdef KERNFS
kernfs_revoke_sa(sav);
#endif
if (__LIST_CHAINED(sav))
LIST_REMOVE(sav, chain);
@ -1032,9 +1032,7 @@ key_delsp(struct secpolicy *sp)
s = splsoftnet(); /*called from softclock()*/
#ifdef KERNFS
kernfs_revoke_sp(sp);
#endif
{
struct ipsecrequest *isr = sp->req, *nextisr;