Move the scan for max_keylen into route.c::route_init(),
and make max_keylen an argument for rn_init(). This removes an unnecessary dependency on domain.h from radix.c MFC after: 7 days
This commit is contained in:
parent
77ec83ced8
commit
614cb83990
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=200537
@ -40,7 +40,6 @@
|
||||
#include <sys/rwlock.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/domain.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <net/radix.h>
|
||||
#include "opt_mpath.h"
|
||||
@ -1163,16 +1162,11 @@ rn_inithead(head, off)
|
||||
}
|
||||
|
||||
void
|
||||
rn_init()
|
||||
rn_init(int maxk)
|
||||
{
|
||||
char *cp, *cplim;
|
||||
#ifdef _KERNEL
|
||||
struct domain *dom;
|
||||
|
||||
for (dom = domains; dom; dom = dom->dom_next)
|
||||
if (dom->dom_maxrtkey > max_keylen)
|
||||
max_keylen = dom->dom_maxrtkey;
|
||||
#endif
|
||||
max_keylen = maxk;
|
||||
if (max_keylen == 0) {
|
||||
log(LOG_ERR,
|
||||
"rn_init: radix functions require max_keylen be set\n");
|
||||
@ -1189,19 +1183,3 @@ rn_init()
|
||||
if (rn_inithead((void **)(void *)&mask_rnhead, 0) == 0)
|
||||
panic("rn_init 2");
|
||||
}
|
||||
|
||||
#ifndef _KERNEL
|
||||
/*
|
||||
* A simple function to make the code usable from userland.
|
||||
* A proper fix (maybe later) would be to change rn_init() so that it
|
||||
* takes maxkeylen as an argument, and move the scan of
|
||||
* domains into net/route.c::route_init().
|
||||
*/
|
||||
void rn_init2(int maxk);
|
||||
void
|
||||
rn_init2(int maxk)
|
||||
{
|
||||
max_keylen = maxk;
|
||||
rn_init();
|
||||
}
|
||||
#endif /* !_KERNEL */
|
||||
|
@ -160,7 +160,7 @@ struct radix_node_head {
|
||||
#define RADIX_NODE_HEAD_WLOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, RA_WLOCKED)
|
||||
#endif /* _KERNEL */
|
||||
|
||||
void rn_init(void);
|
||||
void rn_init(int);
|
||||
int rn_inithead(void **, int);
|
||||
int rn_refines(void *, void *);
|
||||
struct radix_node
|
||||
|
@ -171,13 +171,20 @@ rt_tables_get_rnh(int table, int fam)
|
||||
static void
|
||||
route_init(void)
|
||||
{
|
||||
struct domain *dom;
|
||||
int max_keylen = 0;
|
||||
|
||||
/* whack the tunable ints into line. */
|
||||
if (rt_numfibs > RT_MAXFIBS)
|
||||
rt_numfibs = RT_MAXFIBS;
|
||||
if (rt_numfibs == 0)
|
||||
rt_numfibs = 1;
|
||||
rn_init(); /* initialize all zeroes, all ones, mask table */
|
||||
|
||||
for (dom = domains; dom; dom = dom->dom_next)
|
||||
if (dom->dom_maxrtkey > max_keylen)
|
||||
max_keylen = dom->dom_maxrtkey;
|
||||
|
||||
rn_init(max_keylen); /* init all zeroes, all ones, mask table */
|
||||
}
|
||||
SYSINIT(route_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, route_init, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user