Deleted Added
full compact
subr_kobj.c (121129) subr_kobj.c (148811)
1/*-
2 * Copyright (c) 2000,2003 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000,2003 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/kern/subr_kobj.c 121129 2003-10-16 09:16:28Z dfr $");
28__FBSDID("$FreeBSD: head/sys/kern/subr_kobj.c 148811 2005-08-07 02:20:35Z grehan $");
29
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/kobj.h>
33#include <sys/lock.h>
34#include <sys/malloc.h>
35#include <sys/mutex.h>
36#include <sys/sysctl.h>

--- 15 unchanged lines hidden (view full) ---

52SYSCTL_UINT(_kern, OID_AUTO, kobj_hits, CTLFLAG_RD,
53 &kobj_lookup_hits, 0, "");
54SYSCTL_UINT(_kern, OID_AUTO, kobj_misses, CTLFLAG_RD,
55 &kobj_lookup_misses, 0, "");
56
57#endif
58
59static struct mtx kobj_mtx;
29
30#include <sys/param.h>
31#include <sys/kernel.h>
32#include <sys/kobj.h>
33#include <sys/lock.h>
34#include <sys/malloc.h>
35#include <sys/mutex.h>
36#include <sys/sysctl.h>

--- 15 unchanged lines hidden (view full) ---

52SYSCTL_UINT(_kern, OID_AUTO, kobj_hits, CTLFLAG_RD,
53 &kobj_lookup_hits, 0, "");
54SYSCTL_UINT(_kern, OID_AUTO, kobj_misses, CTLFLAG_RD,
55 &kobj_lookup_misses, 0, "");
56
57#endif
58
59static struct mtx kobj_mtx;
60static int kobj_mutex_inited;
60static int kobj_next_id = 1;
61
62SYSCTL_UINT(_kern, OID_AUTO, kobj_methodcount, CTLFLAG_RD,
63 &kobj_next_id, 0, "");
64
65static void
66kobj_init_mutex(void *arg)
67{
61static int kobj_next_id = 1;
62
63SYSCTL_UINT(_kern, OID_AUTO, kobj_methodcount, CTLFLAG_RD,
64 &kobj_next_id, 0, "");
65
66static void
67kobj_init_mutex(void *arg)
68{
68
69 mtx_init(&kobj_mtx, "kobj", NULL, MTX_DEF);
69 if (!kobj_mutex_inited) {
70 mtx_init(&kobj_mtx, "kobj", NULL, MTX_DEF);
71 kobj_mutex_inited = 1;
72 }
70}
71
72SYSINIT(kobj, SI_SUB_LOCK, SI_ORDER_ANY, kobj_init_mutex, NULL);
73
73}
74
75SYSINIT(kobj, SI_SUB_LOCK, SI_ORDER_ANY, kobj_init_mutex, NULL);
76
77void
78kobj_machdep_init(void)
79{
80 kobj_init_mutex(NULL);
81}
82
74/*
75 * This method structure is used to initialise new caches. Since the
76 * desc pointer is NULL, it is guaranteed never to match any read
77 * descriptors.
78 */
79static struct kobj_method null_method = {
80 0, 0,
81};

--- 262 unchanged lines hidden ---
83/*
84 * This method structure is used to initialise new caches. Since the
85 * desc pointer is NULL, it is guaranteed never to match any read
86 * descriptors.
87 */
88static struct kobj_method null_method = {
89 0, 0,
90};

--- 262 unchanged lines hidden ---