diff options
| author | xtraeme <xtraeme@NetBSD.org> | 2007-08-31 22:44:39 +0000 |
|---|---|---|
| committer | xtraeme <xtraeme@NetBSD.org> | 2007-08-31 22:44:39 +0000 |
| commit | 63f1decdb24a6f8cd7ae0996362423fec5b44cd1 (patch) | |
| tree | 779efa8fc40e93158a9098a6805e62889f3af13e /sys/dev/sysmon | |
| parent | bb04fc71fb319d422afbdc560167dde1811a35f3 (diff) | |
- sme_unregister_all: there's no need to use a struct sysmon_envsys as
argument, just pass sme->sme_name to it.
- sysmon_envsys_register: drop the array in all cases, not just when
there's an error. The reference is stored in the dictionary anyway...
- Update some comments.
Diffstat (limited to 'sys/dev/sysmon')
| -rw-r--r-- | sys/dev/sysmon/sysmon_envsys.c | 33 | ||||
| -rw-r--r-- | sys/dev/sysmon/sysmon_envsys_events.c | 16 | ||||
| -rw-r--r-- | sys/dev/sysmon/sysmon_envsysvar.h | 4 |
3 files changed, 25 insertions, 28 deletions
diff --git a/sys/dev/sysmon/sysmon_envsys.c b/sys/dev/sysmon/sysmon_envsys.c index a8b6b892586..cb16cd1c66f 100644 --- a/sys/dev/sysmon/sysmon_envsys.c +++ b/sys/dev/sysmon/sysmon_envsys.c @@ -1,4 +1,4 @@ -/* $NetBSD: sysmon_envsys.c,v 1.51 2007/08/31 10:13:27 xtraeme Exp $ */ +/* $NetBSD: sysmon_envsys.c,v 1.52 2007/08/31 22:44:39 xtraeme Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.51 2007/08/31 10:13:27 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.52 2007/08/31 22:44:39 xtraeme Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -199,7 +199,7 @@ sysmonclose_envsys(dev_t dev, int flag, int mode, struct lwp *l) /* * sysmonioctl_envsys: * - * + Perform an envsys control request. + * + Perform a sysmon envsys control request. */ int sysmonioctl_envsys(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l) @@ -424,8 +424,8 @@ sysmonioctl_envsys(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l) /* * sysmon_envsys_register: * - * + Register an envsys device. - * + Create device dictionary. + * + Register a sysmon envsys device. + * + Create array of dictionaries for a device. */ int sysmon_envsys_register(struct sysmon_envsys *sme) @@ -586,17 +586,15 @@ out2: if (error) { DPRINTF(("%s: failed to register '%s' (%d)\n", __func__, sme->sme_name, error)); - prop_object_release(array); } + prop_object_release(array); return error; } /* * sysmon_envsys_unregister: * - * + Unregister an envsys device. - * + Unregister all events associated with this device. - * + Remove device dictionary. + * + Unregister a sysmon envsys device. */ void sysmon_envsys_unregister(struct sysmon_envsys *sme) @@ -623,7 +621,7 @@ sysmon_envsys_unregister(struct sysmon_envsys *sme) /* * Unregister all events associated with this device. */ - sme_event_unregister_all(sme); + sme_event_unregister_all(sme->sme_name); /* * Remove the device from the global dictionary. */ @@ -633,7 +631,7 @@ sysmon_envsys_unregister(struct sysmon_envsys *sme) /* * sysmon_envsys_find: * - * + Find an envsys device. + * + Find a sysmon envsys device. */ struct sysmon_envsys * sysmon_envsys_find(const char *name) @@ -661,7 +659,7 @@ again: /* * sysmon_envsys_release: * - * + Release an envsys device. + * + Release a sysmon envsys device. */ void sysmon_envsys_release(struct sysmon_envsys *sme) @@ -695,7 +693,7 @@ sysmon_envsys_find_40(u_int idx) /* * sme_register_sensorname: * - * + Registers a sensor name into the list maintained per device. + * + Register a sensor description into the list maintained per device. */ static int sme_register_sensorname(struct sysmon_envsys *sme, envsys_data_t *edata) @@ -733,9 +731,9 @@ sme_register_sensorname(struct sysmon_envsys *sme, envsys_data_t *edata) } /* - * sme_make_dictionary: + * sme_add_sensor_dictionary: * - * + Create sensor's dictionary in device's array. + * + Add the objects into the dictionary. */ void sme_add_sensor_dictionary(struct sysmon_envsys *sme, prop_array_t array, @@ -952,7 +950,6 @@ invalidate_sensor: * * + Update per-sensor dictionaries with new values if there were * changes, otherwise the object in dictionary is untouched. - * + Send a critical event if any sensor is in a critical condition. */ int sme_update_dictionary(struct sysmon_envsys *sme) @@ -1120,8 +1117,8 @@ sme_update_dictionary(struct sysmon_envsys *sme) /* * sme_userset_dictionary: * - * + Parses the userland dictionary and run the appropiate - * tasks that were requested. + * + Parse the userland dictionary and run the appropiate + * task that was requested. */ int sme_userset_dictionary(struct sysmon_envsys *sme, prop_dictionary_t udict, diff --git a/sys/dev/sysmon/sysmon_envsys_events.c b/sys/dev/sysmon/sysmon_envsys_events.c index 4ee8a0ca9ae..43117fd6027 100644 --- a/sys/dev/sysmon/sysmon_envsys_events.c +++ b/sys/dev/sysmon/sysmon_envsys_events.c @@ -1,4 +1,4 @@ -/* $NetBSD: sysmon_envsys_events.c,v 1.24 2007/08/31 10:13:27 xtraeme Exp $ */ +/* $NetBSD: sysmon_envsys_events.c,v 1.25 2007/08/31 22:44:39 xtraeme Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.24 2007/08/31 10:13:27 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.25 2007/08/31 22:44:39 xtraeme Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -266,29 +266,29 @@ sme_event_register(prop_dictionary_t sdict, envsys_data_t *edata, * sysmon envsys device. */ void -sme_event_unregister_all(struct sysmon_envsys *sme) +sme_event_unregister_all(const char *sme_name) { sme_event_t *see; int evcounter = 0; - KASSERT(sme != NULL); + KASSERT(sme_name != NULL); mutex_enter(&sme_event_mtx); LIST_FOREACH(see, &sme_events_list, see_list) { - if (strcmp(see->pes.pes_dvname, sme->sme_name) == 0) + if (strcmp(see->pes.pes_dvname, sme_name) == 0) evcounter++; } DPRINTF(("%s: total events %d (%s)\n", __func__, - evcounter, sme->sme_name)); + evcounter, sme_name)); while ((see = LIST_FIRST(&sme_events_list)) != NULL) { if (evcounter == 0) break; - if (strcmp(see->pes.pes_dvname, sme->sme_name) == 0) { + if (strcmp(see->pes.pes_dvname, sme_name) == 0) { DPRINTF(("%s: event %s %d removed (%s)\n", __func__, - see->pes.pes_sensname, see->type, sme->sme_name)); + see->pes.pes_sensname, see->type, sme_name)); while (see->see_flags & SME_EVENT_WORKING) cv_wait(&sme_event_cv, &sme_event_mtx); diff --git a/sys/dev/sysmon/sysmon_envsysvar.h b/sys/dev/sysmon/sysmon_envsysvar.h index a1b58378494..b6c9fc96549 100644 --- a/sys/dev/sysmon/sysmon_envsysvar.h +++ b/sys/dev/sysmon/sysmon_envsysvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sysmon_envsysvar.h,v 1.15 2007/08/31 10:13:27 xtraeme Exp $ */ +/* $NetBSD: sysmon_envsysvar.h,v 1.16 2007/08/31 22:44:39 xtraeme Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -118,7 +118,7 @@ int sme_userset_dictionary(struct sysmon_envsys *, int sme_event_register(prop_dictionary_t, envsys_data_t *, const char *, const char *, int32_t, int, int); int sme_event_unregister(const char *, int); -void sme_event_unregister_all(struct sysmon_envsys *); +void sme_event_unregister_all(const char *); void sme_event_drvadd(void *); int sme_events_init(void); void sme_events_destroy(void); |
