Module Name: src Committed By: pgoyette Date: Sun Feb 28 20:04:04 UTC 2010
Modified Files: src/sys/dev/sysmon: sysmonvar.h src/sys/sys: envsys.h Log Message: Move definitions of internal data structures and flag bits to avoid exposing them to user-land. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/dev/sysmon/sysmonvar.h cvs rdiff -u -r1.30 -r1.31 src/sys/sys/envsys.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/sysmon/sysmonvar.h diff -u src/sys/dev/sysmon/sysmonvar.h:1.31 src/sys/dev/sysmon/sysmonvar.h:1.32 --- src/sys/dev/sysmon/sysmonvar.h:1.31 Sun Feb 14 23:06:02 2010 +++ src/sys/dev/sysmon/sysmonvar.h Sun Feb 28 20:04:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: sysmonvar.h,v 1.31 2010/02/14 23:06:02 pgoyette Exp $ */ +/* $NetBSD: sysmonvar.h,v 1.32 2010/02/28 20:04:04 pgoyette Exp $ */ /*- * Copyright (c) 2000 Zembu Labs, Inc. @@ -59,6 +59,74 @@ * Environmental sensor support *****************************************************************************/ +/* + * Thresholds/limits that are being monitored + */ +struct sysmon_envsys_lim { + int32_t sel_critmax; + int32_t sel_warnmax; + int32_t sel_warnmin; + int32_t sel_critmin; +}; + +typedef struct sysmon_envsys_lim sysmon_envsys_lim_t; + +/* struct used by a sensor */ +struct envsys_data { + TAILQ_ENTRY(envsys_data) sensors_head; + uint32_t sensor; /* sensor number */ + uint32_t units; /* type of sensor */ + uint32_t state; /* sensor state */ + uint32_t flags; /* sensor flags */ + uint32_t rpms; /* for fans, nominal RPMs */ + int32_t rfact; /* for volts, factor x 10^4 */ + int32_t value_cur; /* current value */ + int32_t value_max; /* max value */ + int32_t value_min; /* min value */ + 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 */ +}; + +typedef struct envsys_data envsys_data_t; + +/* sensor flags */ +#define ENVSYS_FPERCENT 0x00000001 /* sensor wants a percentage */ +#define ENVSYS_FVALID_MAX 0x00000002 /* max value is ok */ +#define ENVSYS_FVALID_MIN 0x00000004 /* min value is ok */ +#define ENVSYS_FVALID_AVG 0x00000008 /* avg value is ok */ +#define ENVSYS_FCHANGERFACT 0x00000010 /* sensor can change rfact */ + +/* monitoring flags */ +#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_FMONNOTSUPP 0x00000800 /* monitoring not supported */ +#define ENVSYS_FNEED_REFRESH 0x00001000 /* sensor needs refreshing */ + +/* + * Properties that can be set in upropset (and in the event_limit's + * flags field) + */ +#define PROP_CRITMAX 0x0001 +#define PROP_CRITMIN 0x0002 +#define PROP_WARNMAX 0x0004 +#define PROP_WARNMIN 0x0008 +#define PROP_BATTCAP 0x0010 +#define PROP_BATTWARN 0x0020 +#define PROP_BATTHIGH 0x0040 +#define PROP_BATTMAX 0x0080 +#define PROP_DESC 0x0100 +#define PROP_RFACT 0x0200 + +#define PROP_DRIVER_LIMITS 0x8000 +#define PROP_CAP_LIMITS (PROP_BATTCAP | PROP_BATTWARN | \ + PROP_BATTHIGH | PROP_BATTMAX) +#define PROP_VAL_LIMITS (PROP_CRITMAX | PROP_CRITMIN | \ + PROP_WARNMAX | PROP_WARNMIN) +#define PROP_LIMITS (PROP_CAP_LIMITS | PROP_VAL_LIMITS) struct sme_event; struct sysmon_envsys { Index: src/sys/sys/envsys.h diff -u src/sys/sys/envsys.h:1.30 src/sys/sys/envsys.h:1.31 --- src/sys/sys/envsys.h:1.30 Mon Feb 15 22:32:04 2010 +++ src/sys/sys/envsys.h Sun Feb 28 20:04:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: envsys.h,v 1.30 2010/02/15 22:32:04 pgoyette Exp $ */ +/* $NetBSD: envsys.h,v 1.31 2010/02/28 20:04:04 pgoyette Exp $ */ /*- * Copyright (c) 1999, 2007 The NetBSD Foundation, Inc. @@ -47,39 +47,6 @@ #define ENVSYS_MAXSENSORS 512 #define ENVSYS_DESCLEN 32 -/* - * Thresholds/limits that are being monitored - */ -struct sysmon_envsys_lim { - int32_t sel_critmax; - int32_t sel_warnmax; - int32_t sel_warnmin; - int32_t sel_critmin; -}; - -typedef struct sysmon_envsys_lim sysmon_envsys_lim_t; - -/* struct used by a sensor */ -struct envsys_data { - TAILQ_ENTRY(envsys_data) sensors_head; - uint32_t sensor; /* sensor number */ - uint32_t units; /* type of sensor */ - uint32_t state; /* sensor state */ - uint32_t flags; /* sensor flags */ - uint32_t rpms; /* for fans, nominal RPMs */ - int32_t rfact; /* for volts, factor x 10^4 */ - int32_t value_cur; /* current value */ - int32_t value_max; /* max value */ - int32_t value_min; /* min value */ - 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 */ -}; - -typedef struct envsys_data envsys_data_t; - /* sensor units */ enum envsys_units { ENVSYS_STEMP = 0, /* Temperature */ @@ -138,20 +105,6 @@ ENVSYS_BATTERY_CAPACITY_LOW /* low cap in battery */ }; -/* sensor flags */ -#define ENVSYS_FPERCENT 0x00000001 /* sensor wants a percentage */ -#define ENVSYS_FVALID_MAX 0x00000002 /* max value is ok */ -#define ENVSYS_FVALID_MIN 0x00000004 /* min value is ok */ -#define ENVSYS_FVALID_AVG 0x00000008 /* avg value is ok */ -#define ENVSYS_FCHANGERFACT 0x00000010 /* sensor can change rfact */ - -/* monitoring flags */ -#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_FMONNOTSUPP 0x00000800 /* monitoring not supported */ -#define ENVSYS_FNEED_REFRESH 0x00001000 /* sensor needs refreshing */ - /* * IOCTLs */ @@ -160,28 +113,6 @@ #define ENVSYS_REMOVEPROPS _IOWR('E', 2, struct plistref) /* - * Properties that can be set in upropset (and in the event_limit's - * flags field) - */ -#define PROP_CRITMAX 0x0001 -#define PROP_CRITMIN 0x0002 -#define PROP_WARNMAX 0x0004 -#define PROP_WARNMIN 0x0008 -#define PROP_BATTCAP 0x0010 -#define PROP_BATTWARN 0x0020 -#define PROP_BATTHIGH 0x0040 -#define PROP_BATTMAX 0x0080 -#define PROP_DESC 0x0100 -#define PROP_RFACT 0x0200 - -#define PROP_DRIVER_LIMITS 0x8000 -#define PROP_CAP_LIMITS (PROP_BATTCAP | PROP_BATTWARN | \ - PROP_BATTHIGH | PROP_BATTMAX) -#define PROP_VAL_LIMITS (PROP_CRITMAX | PROP_CRITMIN | \ - PROP_WARNMAX | PROP_WARNMIN) -#define PROP_LIMITS (PROP_CAP_LIMITS | PROP_VAL_LIMITS) - -/* * Compatibility with old interface. Only ENVSYS_GTREDATA * and ENVSYS_GTREINFO ioctls are supported. */