Module Name:    src
Committed By:   matt
Date:           Fri Jan  7 01:13:05 UTC 2011

Modified Files:
        src/sys/kern [matt-nb5-pq3]: subr_evcnt.c
        src/sys/sys [matt-nb5-pq3]: evcnt.h

Log Message:
Add evcnt_attach_dynamic_nozero which doesn't zero it's contents.  This is
needed if the evcnt starts counting before it's attached (otherwise the
count would be zeroed and those events lost).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.98.1 src/sys/kern/subr_evcnt.c
cvs rdiff -u -r1.5 -r1.5.32.1 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.4 src/sys/kern/subr_evcnt.c:1.4.98.1
--- src/sys/kern/subr_evcnt.c:1.4	Sun Dec 11 12:24:30 2005
+++ src/sys/kern/subr_evcnt.c	Fri Jan  7 01:13:04 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_evcnt.c,v 1.4 2005/12/11 12:24:30 christos Exp $ */
+/* $NetBSD: subr_evcnt.c,v 1.4.98.1 2011/01/07 01:13:04 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.4 2005/12/11 12:24:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_evcnt.c,v 1.4.98.1 2011/01/07 01:13:04 matt Exp $");
 
 #include "opt_ddb.h"
 
@@ -143,17 +143,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.5 src/sys/sys/evcnt.h:1.5.32.1
--- src/sys/sys/evcnt.h:1.5	Sun Dec 16 20:45:59 2007
+++ src/sys/sys/evcnt.h	Fri Jan  7 01:13:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: evcnt.h,v 1.5 2007/12/16 20:45:59 dyoung Exp $	*/
+/*	$NetBSD: evcnt.h,v 1.5.32.1 2011/01/07 01:13:04 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 *);

Reply via email to