Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sysmon Retire the 'monitor' member of the envsys_dat...



details:   https://anonhg.NetBSD.org/src/rev/034cbcddeeaa
branches:  trunk
changeset: 753012:034cbcddeeaa
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Mar 14 18:03:15 2010 +0000

description:
Retire the 'monitor' member of the envsys_data_t.  It was only used in
one place, and functioned as a logical OR of the ENVSYS_FMON* flag bits.

diffstat:

 sys/dev/sysmon/sysmon_envsys.c    |  19 ++++++++++++-------
 sys/dev/sysmon/sysmon_envsysvar.h |   6 +-----
 sys/dev/sysmon/sysmonvar.h        |   5 +++--
 3 files changed, 16 insertions(+), 14 deletions(-)

diffs (120 lines):

diff -r b775e76040f0 -r 034cbcddeeaa sys/dev/sysmon/sysmon_envsys.c
--- a/sys/dev/sysmon/sysmon_envsys.c    Sun Mar 14 17:20:08 2010 +0000
+++ b/sys/dev/sysmon/sysmon_envsys.c    Sun Mar 14 18:03:15 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysmon_envsys.c,v 1.96 2010/02/15 22:32:04 pgoyette Exp $      */
+/*     $NetBSD: sysmon_envsys.c,v 1.97 2010/03/14 18:03:15 pgoyette Exp $      */
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.96 2010/02/15 22:32:04 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.97 2010/03/14 18:03:15 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -92,6 +92,8 @@
 static void sme_remove_userprops(void);
 static int sme_add_property_dictionary(struct sysmon_envsys *, prop_array_t,
                                       prop_dictionary_t);
+static sme_event_drv_t * sme_add_sensor_dictionary(struct sysmon_envsys *,
+       prop_array_t, prop_dictionary_t, envsys_data_t *);
 static void sme_initial_refresh(void *);
 static uint32_t sme_get_max_value(struct sysmon_envsys *,
      bool (*)(const envsys_data_t*), bool);
@@ -633,6 +635,7 @@
        prop_dictionary_t dict, dict2;
        envsys_data_t *edata = NULL;
        sme_event_drv_t *this_evdrv;
+       int nevent;
        int error = 0;
 
        KASSERT(sme != NULL);
@@ -756,13 +759,15 @@
         * and make an initial data refresh if was requested.
         */
        if (error == 0) {
+               nevent = 0;
                sysmon_task_queue_init();
                SLIST_FOREACH(evdv, &sme_evdrv_list, evdrv_head) {
                        sysmon_task_queue_sched(0,
                            sme_event_drvadd, evdv->evdrv);
+                       nevent++;
                }
-               DPRINTF(("%s: driver '%s' registered (nsens=%d)\n",
-                   __func__, sme->sme_name, sme->sme_nsensors));
+               DPRINTF(("%s: driver '%s' registered (nsens=%d nevent=%d)\n",
+                   __func__, sme->sme_name, sme->sme_nsensors, nevent));
 
                if (sme->sme_flags & SME_INIT_REFRESH)
                        sysmon_task_queue_sched(0, sme_initial_refresh, sme);
@@ -1184,7 +1189,7 @@
  *       to a sme_event_drv_t object if a monitoring flag was set
  *       (or NULL otherwise).
  */
-sme_event_drv_t *
+static sme_event_drv_t *
 sme_add_sensor_dictionary(struct sysmon_envsys *sme, prop_array_t array,
                          prop_dictionary_t dict, envsys_data_t *edata)
 {
@@ -1408,9 +1413,9 @@
        }
 
        /*
-        * Register a new event if a monitoring flag was set.
+        * Register new event(s) if any monitoring flag was set.
         */
-       if (edata->monitor) {
+       if (edata->flags & ENVSYS_FMONANY) {
                sme_evdrv_t = kmem_zalloc(sizeof(*sme_evdrv_t), KM_SLEEP);
                sme_evdrv_t->sed_sdict = dict;
                sme_evdrv_t->sed_edata = edata;
diff -r b775e76040f0 -r 034cbcddeeaa sys/dev/sysmon/sysmon_envsysvar.h
--- a/sys/dev/sysmon/sysmon_envsysvar.h Sun Mar 14 17:20:08 2010 +0000
+++ b/sys/dev/sysmon/sysmon_envsysvar.h Sun Mar 14 18:03:15 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsysvar.h,v 1.31 2010/02/14 23:06:02 pgoyette Exp $ */
+/* $NetBSD: sysmon_envsysvar.h,v 1.32 2010/03/14 18:03:15 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -109,10 +109,6 @@
 /* 
  * functions to handle sysmon envsys devices.
  */
-sme_event_drv_t *sme_add_sensor_dictionary(struct sysmon_envsys *,
-                                          prop_array_t,
-                                          prop_dictionary_t,
-                                          envsys_data_t *);
 int    sme_update_dictionary(struct sysmon_envsys *);
 int    sme_userset_dictionary(struct sysmon_envsys *,
                               prop_dictionary_t, prop_array_t);
diff -r b775e76040f0 -r 034cbcddeeaa sys/dev/sysmon/sysmonvar.h
--- a/sys/dev/sysmon/sysmonvar.h        Sun Mar 14 17:20:08 2010 +0000
+++ b/sys/dev/sysmon/sysmonvar.h        Sun Mar 14 18:03:15 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysmonvar.h,v 1.32 2010/02/28 20:04:04 pgoyette Exp $  */
+/*     $NetBSD: sysmonvar.h,v 1.33 2010/03/14 18:03:15 pgoyette Exp $  */
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -86,7 +86,6 @@
        int32_t         value_avg;      /* avg value */
        sysmon_envsys_lim_t limits;     /* thresholds for monitoring */
        int             upropset;       /* userland property set? */
-       bool            monitor;        /* monitoring enabled/disabled */
        char            desc[ENVSYS_DESCLEN];   /* sensor description */
 };
 
@@ -103,6 +102,8 @@
 #define ENVSYS_FMONCRITICAL    0x00000020      /* monitor a critical state */
 #define ENVSYS_FMONLIMITS      0x00000040      /* monitor limits/thresholds */
 #define ENVSYS_FMONSTCHANGED   0x00000400      /* monitor a battery/drive state */
+#define ENVSYS_FMONANY \
+       (ENVSYS_FMONCRITICAL | ENVSYS_FMONLIMITS | ENVSYS_FMONSTCHANGED)
 #define ENVSYS_FMONNOTSUPP     0x00000800      /* monitoring not supported */
 #define ENVSYS_FNEED_REFRESH   0x00001000      /* sensor needs refreshing */
 



Home | Main Index | Thread Index | Old Index