Module Name: src
Committed By: matt
Date: Sat Dec 11 22:30:55 UTC 2010
Modified Files:
src/sys/kern: subr_evcnt.c
src/sys/sys: evcnt.h
Log Message:
Add evcnt_attach_dynamic_nozero, a version of evcnt_attach_dynamic, which
doesn't zero the evcnt before filling in things. This is needed when the
evcnt itself is being updated before evcnt_attach_dynamic can be called.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/subr_evcnt.c
cvs rdiff -u -r1.6 -r1.7 src/sys/sys/evcnt.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/subr_evcnt.c
diff -u src/sys/kern/subr_evcnt.c:1.6 src/sys/kern/subr_evcnt.c:1.7
--- src/sys/kern/subr_evcnt.c:1.6 Sun Mar 29 18:21:06 2009
+++ src/sys/kern/subr_evcnt.c Sat Dec 11 22:30:54 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.6 2009/03/29 18:21:06 pooka Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.7 2010/12/11 22:30:54 matt Exp $ */
/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.6 2009/03/29 18:21:06 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.7 2010/12/11 22:30:54 matt Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -147,17 +147,28 @@
* and string pointers and then act like it was statically initialized.
*/
void
-evcnt_attach_dynamic(struct evcnt *ev, int type, const struct evcnt *parent,
- const char *group, const char *name)
+evcnt_attach_dynamic_nozero(struct evcnt *ev, int type,
+ const struct evcnt *parent, const char *group, const char *name)
{
- memset(ev, 0, sizeof *ev);
ev->ev_type = type;
ev->ev_parent = parent;
ev->ev_group = group;
ev->ev_name = name;
evcnt_attach_static(ev);
}
+/*
+ * Attach a dynamically-initialized event. Zero it, set up the type
+ * and string pointers and then act like it was statically initialized.
+ */
+void
+evcnt_attach_dynamic(struct evcnt *ev, int type, const struct evcnt *parent,
+ const char *group, const char *name)
+{
+
+ memset(ev, 0, sizeof *ev);
+ evcnt_attach_dynamic_nozero(ev, type, parent, group, name);
+}
/*
* Detach an event.
Index: src/sys/sys/evcnt.h
diff -u src/sys/sys/evcnt.h:1.6 src/sys/sys/evcnt.h:1.7
--- src/sys/sys/evcnt.h:1.6 Sat Mar 21 13:06:39 2009
+++ src/sys/sys/evcnt.h Sat Dec 11 22:30:55 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: evcnt.h,v 1.6 2009/03/21 13:06:39 ad Exp $ */
+/* $NetBSD: evcnt.h,v 1.7 2010/12/11 22:30:55 matt Exp $ */
/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -129,6 +129,8 @@
void evcnt_init(void);
void evcnt_attach_static(struct evcnt *);
+void evcnt_attach_dynamic_nozero(struct evcnt *, int, const struct evcnt *,
+ const char *, const char *);
void evcnt_attach_dynamic(struct evcnt *, int, const struct evcnt *,
const char *, const char *);
void evcnt_detach(struct evcnt *);