Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Add evcnt_attach_dynamic_nozero, a version of evcnt_atta...



details:   https://anonhg.NetBSD.org/src/rev/281bc8e24e12
branches:  trunk
changeset: 759505:281bc8e24e12
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Dec 11 22:30:54 2010 +0000

description:
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.

diffstat:

 sys/kern/subr_evcnt.c |  25 ++++++++++++++++++-------
 sys/sys/evcnt.h       |   4 +++-
 2 files changed, 21 insertions(+), 8 deletions(-)

diffs (69 lines):

diff -r bc77a14397bd -r 281bc8e24e12 sys/kern/subr_evcnt.c
--- a/sys/kern/subr_evcnt.c     Sat Dec 11 22:27:53 2010 +0000
+++ b/sys/kern/subr_evcnt.c     Sat Dec 11 22:30:54 2010 +0000
@@ -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,16 +147,27 @@
  * and string pointers and then act like it was statically initialized.
  */
 void
+evcnt_attach_dynamic_nozero(struct evcnt *ev, int type,
+    const struct evcnt *parent, const char *group, const char *name)
+{
+
+       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);
-       ev->ev_type = type;
-       ev->ev_parent = parent;
-       ev->ev_group = group;
-       ev->ev_name = name;
-       evcnt_attach_static(ev);
+       evcnt_attach_dynamic_nozero(ev, type, parent, group, name);
 }
 
 /*
diff -r bc77a14397bd -r 281bc8e24e12 sys/sys/evcnt.h
--- a/sys/sys/evcnt.h   Sat Dec 11 22:27:53 2010 +0000
+++ b/sys/sys/evcnt.h   Sat Dec 11 22:30:54 2010 +0000
@@ -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 *);



Home | Main Index | Thread Index | Old Index