Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/sysmon Add routine to lookup description tables by d...
details: https://anonhg.NetBSD.org/src/rev/22ba65c6556e
branches: trunk
changeset: 766233:22ba65c6556e
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Sun Jun 19 03:09:43 2011 +0000
description:
Add routine to lookup description tables by description instead of by
type.
diffstat:
sys/dev/sysmon/sysmon_envsys_tables.c | 30 ++++++++++++++++++++++++++++--
sys/dev/sysmon/sysmon_envsysvar.h | 4 +++-
2 files changed, 31 insertions(+), 3 deletions(-)
diffs (65 lines):
diff -r f1361bd91ee1 -r 22ba65c6556e sys/dev/sysmon/sysmon_envsys_tables.c
--- a/sys/dev/sysmon/sysmon_envsys_tables.c Sun Jun 19 02:42:53 2011 +0000
+++ b/sys/dev/sysmon/sysmon_envsys_tables.c Sun Jun 19 03:09:43 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsys_tables.c,v 1.6 2010/12/15 17:17:17 pgoyette Exp $ */
+/* $NetBSD: sysmon_envsys_tables.c,v 1.7 2011/06/19 03:09:43 pgoyette Exp $ */
/*-
* Copyright (c) 2007 Juan Romero Pardines.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_tables.c,v 1.6 2010/12/15 17:17:17 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_tables.c,v 1.7 2011/06/19 03:09:43 pgoyette Exp $");
#include <sys/types.h>
@@ -129,3 +129,29 @@
return table;
}
+const struct sme_descr_entry *
+sme_find_table_desc(enum sme_descr_type table_id, const char *str)
+{
+ const struct sme_descr_entry *table = NULL;
+
+ switch (table_id) {
+ case SME_DESC_UNITS:
+ table = sme_units_description;
+ break;
+ case SME_DESC_STATES:
+ table = sme_state_description;
+ break;
+ case SME_DESC_DRIVE_STATES:
+ table = sme_drivestate_description;
+ break;
+ case SME_DESC_BATTERY_CAPACITY:
+ table = sme_batterycap_description;
+ break;
+ }
+
+ for (; table->type != -1; table++)
+ if (strcmp(table->desc, str) == 0)
+ break;
+ return table;
+}
+
diff -r f1361bd91ee1 -r 22ba65c6556e sys/dev/sysmon/sysmon_envsysvar.h
--- a/sys/dev/sysmon/sysmon_envsysvar.h Sun Jun 19 02:42:53 2011 +0000
+++ b/sys/dev/sysmon/sysmon_envsysvar.h Sun Jun 19 03:09:43 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsysvar.h,v 1.39 2011/06/08 18:22:24 pgoyette Exp $ */
+/* $NetBSD: sysmon_envsysvar.h,v 1.40 2011/06/19 03:09:43 pgoyette Exp $ */
/*-
* Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -145,5 +145,7 @@
int sme_sensor_upstring(prop_dictionary_t, const char *, const char *);
const struct sme_descr_entry *sme_find_table_entry(enum sme_descr_type, int);
+const struct sme_descr_entry * sme_find_table_desc(enum sme_descr_type,
+ const char *);
#endif /* _DEV_SYSMON_ENVSYSVAR_H_ */
Home |
Main Index |
Thread Index |
Old Index