Change some initialization of static queues to compile time.
(xxx_INIT to xxx_HEAD_INITIALIZER). Drop code which inits non-auto (global or static) variables to 0 since that's already implied by being non-auto. Init some static/global cpu_simple_locks at compile time.
This commit is contained in:
parent
f4f95f573f
commit
11910619f7
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_auth.c,v 1.53 2007/11/07 00:23:20 ad Exp $ */
|
||||
/* $NetBSD: kern_auth.c,v 1.54 2007/11/11 23:22:23 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
|
||||
@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_auth.c,v 1.53 2007/11/07 00:23:20 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_auth.c,v 1.54 2007/11/11 23:22:23 matt Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -107,7 +107,8 @@ static int kauth_cred_ctor(void *, void *, int);
|
||||
static void kauth_cred_dtor(void *, void *);
|
||||
|
||||
/* List of scopes and its lock. */
|
||||
static SIMPLEQ_HEAD(, kauth_scope) scope_list;
|
||||
static SIMPLEQ_HEAD(, kauth_scope) scope_list =
|
||||
SIMPLEQ_HEAD_INITIALIZER(scope_list);
|
||||
|
||||
/* Built-in scopes: generic, process. */
|
||||
static kauth_scope_t kauth_builtin_scope_generic;
|
||||
@ -796,7 +797,6 @@ kauth_register_scope(const char *id, kauth_scope_callback_t callback,
|
||||
void
|
||||
kauth_init(void)
|
||||
{
|
||||
SIMPLEQ_INIT(&scope_list);
|
||||
rw_init(&kauth_lock);
|
||||
|
||||
kauth_cred_cache = pool_cache_init(sizeof(struct kauth_cred),
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_lwp.c,v 1.76 2007/11/07 00:23:21 ad Exp $ */
|
||||
/* $NetBSD: kern_lwp.c,v 1.77 2007/11/11 23:22:23 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001, 2006, 2007 The NetBSD Foundation, Inc.
|
||||
@ -205,7 +205,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.76 2007/11/07 00:23:21 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.77 2007/11/11 23:22:23 matt Exp $");
|
||||
|
||||
#include "opt_multiprocessor.h"
|
||||
#include "opt_lockdebug.h"
|
||||
@ -227,7 +227,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.76 2007/11/07 00:23:21 ad Exp $");
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
struct lwplist alllwp;
|
||||
struct lwplist alllwp = LIST_HEAD_INITIALIZER(alllwp);
|
||||
|
||||
POOL_INIT(lwp_pool, sizeof(struct lwp), MIN_LWP_ALIGNMENT, 0, 0, "lwppl",
|
||||
&pool_allocator_nointr, IPL_NONE);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_malloc.c,v 1.113 2007/11/06 19:13:49 ad Exp $ */
|
||||
/* $NetBSD: kern_malloc.c,v 1.114 2007/11/11 23:22:23 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1991, 1993
|
||||
@ -66,7 +66,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.113 2007/11/06 19:13:49 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.114 2007/11/11 23:22:23 matt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
@ -922,10 +922,6 @@ kmeminit(void)
|
||||
/* Attach all of the statically-linked malloc types. */
|
||||
__link_set_foreach(ksp, malloc_types)
|
||||
malloc_type_attach(*ksp);
|
||||
|
||||
#ifdef MALLOC_DEBUG
|
||||
debug_malloc_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DDB
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_malloc_debug.c,v 1.17 2007/03/12 18:18:33 ad Exp $ */
|
||||
/* $NetBSD: kern_malloc_debug.c,v 1.18 2007/11/11 23:22:23 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2000 Artur Grabowski <art@openbsd.org>
|
||||
@ -56,7 +56,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_malloc_debug.c,v 1.17 2007/03/12 18:18:33 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_malloc_debug.c,v 1.18 2007/11/11 23:22:23 matt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
@ -101,8 +101,10 @@ struct debug_malloc_entry {
|
||||
struct malloc_type *md_type;
|
||||
};
|
||||
|
||||
TAILQ_HEAD(,debug_malloc_entry) debug_malloc_freelist;
|
||||
TAILQ_HEAD(,debug_malloc_entry) debug_malloc_usedlist;
|
||||
TAILQ_HEAD(,debug_malloc_entry) debug_malloc_freelist =
|
||||
TAILQ_HEAD_INITIALIZER(debug_malloc_freelist);
|
||||
TAILQ_HEAD(,debug_malloc_entry) debug_malloc_usedlist =
|
||||
TAILQ_HEAD_INITIALIZER(debug_malloc_usedlist);
|
||||
|
||||
int debug_malloc_allocs;
|
||||
int debug_malloc_frees;
|
||||
@ -210,19 +212,6 @@ debug_free(void *addr, struct malloc_type *type)
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
debug_malloc_init(void)
|
||||
{
|
||||
|
||||
TAILQ_INIT(&debug_malloc_freelist);
|
||||
TAILQ_INIT(&debug_malloc_usedlist);
|
||||
|
||||
debug_malloc_allocs = 0;
|
||||
debug_malloc_frees = 0;
|
||||
debug_malloc_pages = 0;
|
||||
debug_malloc_chunks_on_freelist = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add one chunk to the freelist.
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_proc.c,v 1.123 2007/11/07 16:51:28 matt Exp $ */
|
||||
/* $NetBSD: kern_proc.c,v 1.124 2007/11/11 23:22:24 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2006, 2007 The NetBSD Foundation, Inc.
|
||||
@ -69,7 +69,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.123 2007/11/07 16:51:28 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.124 2007/11/11 23:22:24 matt Exp $");
|
||||
|
||||
#include "opt_kstack.h"
|
||||
#include "opt_maxuprc.h"
|
||||
@ -336,8 +336,6 @@ procinit(void)
|
||||
pid_alloc_lim = pid_tbl_mask - 1;
|
||||
#undef LINK_EMPTY
|
||||
|
||||
LIST_INIT(&alllwp);
|
||||
|
||||
uihashtbl =
|
||||
hashinit(maxproc / 16, HASH_LIST, M_PROC, M_WAITOK, &uihash);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_verifiedexec.c,v 1.101 2007/07/09 21:10:54 ad Exp $ */
|
||||
/* $NetBSD: kern_verifiedexec.c,v 1.102 2007/11/11 23:22:24 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
|
||||
@ -29,7 +29,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.101 2007/07/09 21:10:54 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_verifiedexec.c,v 1.102 2007/11/11 23:22:24 matt Exp $");
|
||||
|
||||
#include "opt_veriexec.h"
|
||||
|
||||
@ -107,15 +107,16 @@ struct veriexec_table_entry {
|
||||
static int veriexec_verbose;
|
||||
int veriexec_strict;
|
||||
|
||||
static char *veriexec_fp_names;
|
||||
static size_t veriexec_name_max;
|
||||
static char *veriexec_fp_names = NULL;
|
||||
static size_t veriexec_name_max = 0;
|
||||
|
||||
static const struct sysctlnode *veriexec_count_node;
|
||||
|
||||
static fileassoc_t veriexec_hook;
|
||||
static specificdata_key_t veriexec_mountspecific_key;
|
||||
|
||||
static LIST_HEAD(, veriexec_fpops) veriexec_fpops_list;
|
||||
static LIST_HEAD(, veriexec_fpops) veriexec_fpops_list =
|
||||
LIST_HEAD_INITIALIZER(veriexec_fpops_list);
|
||||
|
||||
static int veriexec_raw_cb(kauth_cred_t, kauth_action_t, void *,
|
||||
void *, void *, void *, void *);
|
||||
@ -308,10 +309,6 @@ veriexec_init(void)
|
||||
if (error)
|
||||
panic("Veriexec: Can't create mountspecific key");
|
||||
|
||||
LIST_INIT(&veriexec_fpops_list);
|
||||
veriexec_fp_names = NULL;
|
||||
veriexec_name_max = 0;
|
||||
|
||||
#define FPOPS_ADD(a, b, c, d, e, f) \
|
||||
veriexec_fpops_add(a, b, c, (veriexec_fpop_init_t)d, \
|
||||
(veriexec_fpop_update_t)e, (veriexec_fpop_final_t)f)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr_autoconf.c,v 1.120 2007/09/24 18:47:56 joerg Exp $ */
|
||||
/* $NetBSD: subr_autoconf.c,v 1.121 2007/11/11 23:22:24 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 2000 Christopher G. Demetriou
|
||||
@ -77,7 +77,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.120 2007/09/24 18:47:56 joerg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.121 2007/11/11 23:22:24 matt Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
@ -147,7 +147,7 @@ extern const struct cfattachinit cfattachinit[];
|
||||
* List of cfdata tables. We always have one such list -- the one
|
||||
* built statically when the kernel was configured.
|
||||
*/
|
||||
struct cftablelist allcftables;
|
||||
struct cftablelist allcftables = TAILQ_HEAD_INITIALIZER(allcftables);
|
||||
static struct cftable initcftable;
|
||||
|
||||
#define ROOT ((device_t)NULL)
|
||||
@ -177,8 +177,10 @@ struct deferred_config {
|
||||
|
||||
TAILQ_HEAD(deferred_config_head, deferred_config);
|
||||
|
||||
struct deferred_config_head deferred_config_queue;
|
||||
struct deferred_config_head interrupt_config_queue;
|
||||
struct deferred_config_head deferred_config_queue =
|
||||
TAILQ_HEAD_INITIALIZER(deferred_config_queue);
|
||||
struct deferred_config_head interrupt_config_queue =
|
||||
TAILQ_HEAD_INITIALIZER(interrupt_config_queue);
|
||||
|
||||
static void config_process_deferred(struct deferred_config_head *, device_t);
|
||||
|
||||
@ -188,11 +190,12 @@ struct finalize_hook {
|
||||
int (*f_func)(device_t);
|
||||
device_t f_dev;
|
||||
};
|
||||
static TAILQ_HEAD(, finalize_hook) config_finalize_list;
|
||||
static TAILQ_HEAD(, finalize_hook) config_finalize_list =
|
||||
TAILQ_HEAD_INITIALIZER(config_finalize_list);
|
||||
static int config_finalize_done;
|
||||
|
||||
/* list of all devices */
|
||||
struct devicelist alldevs;
|
||||
struct devicelist alldevs = TAILQ_HEAD_INITIALIZER(alldevs);
|
||||
|
||||
volatile int config_pending; /* semaphore for mountroot */
|
||||
|
||||
@ -341,15 +344,9 @@ config_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
TAILQ_INIT(&allcftables);
|
||||
initcftable.ct_cfdata = cfdata;
|
||||
TAILQ_INSERT_TAIL(&allcftables, &initcftable, ct_list);
|
||||
|
||||
TAILQ_INIT(&deferred_config_queue);
|
||||
TAILQ_INIT(&interrupt_config_queue);
|
||||
TAILQ_INIT(&config_finalize_list);
|
||||
TAILQ_INIT(&alldevs);
|
||||
|
||||
config_initialized = 1;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr_lockdebug.c,v 1.12 2007/11/06 00:42:43 ad Exp $ */
|
||||
/* $NetBSD: subr_lockdebug.c,v 1.13 2007/11/11 23:22:24 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.12 2007/11/06 00:42:43 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.13 2007/11/11 23:22:24 matt Exp $");
|
||||
|
||||
#include "opt_multiprocessor.h"
|
||||
#include "opt_ddb.h"
|
||||
@ -103,16 +103,16 @@ typedef struct lockdebug {
|
||||
|
||||
typedef _TAILQ_HEAD(lockdebuglist, struct lockdebug, volatile) lockdebuglist_t;
|
||||
|
||||
lockdebuglk_t ld_sleeper_lk;
|
||||
lockdebuglk_t ld_spinner_lk;
|
||||
lockdebuglk_t ld_free_lk;
|
||||
lockdebuglk_t ld_sleeper_lk = { .lk_lock = SIMPLELOCK_INITIALIZER };
|
||||
lockdebuglk_t ld_spinner_lk = { .lk_lock = SIMPLELOCK_INITIALIZER };
|
||||
lockdebuglk_t ld_free_lk = { .lk_lock = SIMPLELOCK_INITIALIZER };
|
||||
lockdebuglk_t ld_mem_lk[LD_MLOCKS];
|
||||
|
||||
lockdebuglist_t ld_mem_list[LD_MLISTS];
|
||||
lockdebuglist_t ld_sleepers;
|
||||
lockdebuglist_t ld_spinners;
|
||||
lockdebuglist_t ld_free;
|
||||
lockdebuglist_t ld_all;
|
||||
lockdebuglist_t ld_sleepers = TAILQ_HEAD_INITIALIZER(ld_sleepers);
|
||||
lockdebuglist_t ld_spinners = TAILQ_HEAD_INITIALIZER(ld_spinners);
|
||||
lockdebuglist_t ld_free = TAILQ_HEAD_INITIALIZER(ld_free);
|
||||
lockdebuglist_t ld_all = TAILQ_HEAD_INITIALIZER(ld_all);
|
||||
int ld_nfree;
|
||||
int ld_freeptr;
|
||||
int ld_recurse;
|
||||
@ -200,15 +200,6 @@ lockdebug_init(void)
|
||||
lockdebug_t *ld;
|
||||
int i;
|
||||
|
||||
__cpu_simple_lock_init(&ld_sleeper_lk.lk_lock);
|
||||
__cpu_simple_lock_init(&ld_spinner_lk.lk_lock);
|
||||
__cpu_simple_lock_init(&ld_free_lk.lk_lock);
|
||||
|
||||
TAILQ_INIT(&ld_free);
|
||||
TAILQ_INIT(&ld_all);
|
||||
TAILQ_INIT(&ld_sleepers);
|
||||
TAILQ_INIT(&ld_spinners);
|
||||
|
||||
ld = ld_prime;
|
||||
ld_table[0] = ld;
|
||||
for (i = 1, ld++; i < LD_BATCH; i++, ld++) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sys_mqueue.c,v 1.3 2007/10/09 18:27:00 rmind Exp $ */
|
||||
/* $NetBSD: sys_mqueue.c,v 1.4 2007/11/11 23:22:24 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007, Mindaugas Rasiukevicius <rmind at NetBSD org>
|
||||
@ -44,7 +44,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sys_mqueue.c,v 1.3 2007/10/09 18:27:00 rmind Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sys_mqueue.c,v 1.4 2007/11/11 23:22:24 matt Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
@ -80,7 +80,8 @@ static u_int mq_def_maxmsg = 32;
|
||||
|
||||
static kmutex_t mqlist_mtx;
|
||||
static struct pool mqmsg_poll;
|
||||
static LIST_HEAD(, mqueue) mqueue_head;
|
||||
static LIST_HEAD(, mqueue) mqueue_head =
|
||||
LIST_HEAD_INITIALIZER(mqueue_head);
|
||||
|
||||
static int mq_close_fop(struct file *, struct lwp *);
|
||||
|
||||
@ -99,7 +100,6 @@ mqueue_sysinit(void)
|
||||
pool_init(&mqmsg_poll, MQ_DEF_MSGSIZE, 0, 0, 0,
|
||||
"mqmsg_poll", &pool_allocator_nointr, IPL_NONE);
|
||||
mutex_init(&mqlist_mtx, MUTEX_DEFAULT, IPL_NONE);
|
||||
LIST_INIT(&mqueue_head);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vfs_cache.c,v 1.71 2007/11/07 00:23:25 ad Exp $ */
|
||||
/* $NetBSD: vfs_cache.c,v 1.72 2007/11/11 23:22:25 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.71 2007/11/07 00:23:25 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.72 2007/11/11 23:22:25 matt Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_revcache.h"
|
||||
@ -83,7 +83,8 @@ LIST_HEAD(ncvhashhead, namecache) *ncvhashtbl;
|
||||
u_long ncvhash; /* size of hash table - 1 */
|
||||
#define NCVHASH(vp) (((uintptr_t)(vp) >> 3) & ncvhash)
|
||||
|
||||
TAILQ_HEAD(, namecache) nclruhead; /* LRU chain */
|
||||
TAILQ_HEAD(, namecache) nclruhead = /* LRU chain */
|
||||
TAILQ_HEAD_INITIALIZER(nclruhead);
|
||||
struct nchstats nchstats; /* cache effectiveness statistics */
|
||||
|
||||
static pool_cache_t namecache_cache;
|
||||
@ -535,7 +536,6 @@ nchinit(void)
|
||||
KASSERT(namecache_cache != NULL);
|
||||
|
||||
mutex_init(&namecache_lock, MUTEX_DEFAULT, IPL_NONE);
|
||||
TAILQ_INIT(&nclruhead);
|
||||
nchashtbl =
|
||||
hashinit(desiredvnodes, HASH_LIST, M_CACHE, M_WAITOK, &nchash);
|
||||
ncvhashtbl =
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: malloc.h,v 1.98 2007/03/12 16:48:50 ad Exp $ */
|
||||
/* $NetBSD: malloc.h,v 1.99 2007/11/11 23:22:25 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993
|
||||
@ -109,7 +109,6 @@ void free(void *, struct malloc_type *);
|
||||
#ifdef MALLOC_DEBUG
|
||||
int debug_malloc(unsigned long, struct malloc_type *, int, void **);
|
||||
int debug_free(void *, struct malloc_type *);
|
||||
void debug_malloc_init(void);
|
||||
|
||||
void debug_malloc_print(void);
|
||||
void debug_malloc_printit(void (*)(const char *, ...), vaddr_t);
|
||||
|
Loading…
Reference in New Issue
Block a user