diff --git a/sys/dev/sysmon/sysmon_envsys_tables.c b/sys/dev/sysmon/sysmon_envsys_tables.c index 61b71cbe70b3..ed4d823e4d84 100644 --- a/sys/dev/sysmon/sysmon_envsys_tables.c +++ b/sys/dev/sysmon/sysmon_envsys_tables.c @@ -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 -__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 @@ -129,3 +129,29 @@ sme_find_table_entry(enum sme_descr_type table_id, int key) 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 --git a/sys/dev/sysmon/sysmon_envsysvar.h b/sys/dev/sysmon/sysmon_envsysvar.h index 66eec06645fc..da534c8cdc23 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.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_upuint32(prop_dictionary_t, const char *, uint32_t); 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_ */