Module Name: src Committed By: pgoyette Date: Thu Jul 19 13:31:06 UTC 2012
Modified Files: src/sys/dev/sysmon: sysmon_envsys.c Log Message: Make sure to re-add the sensor as an entropy source after user request to reset (via envstat -S) To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sys/dev/sysmon/sysmon_envsys.c 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/sysmon_envsys.c diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.121 src/sys/dev/sysmon/sysmon_envsys.c:1.122 --- src/sys/dev/sysmon/sysmon_envsys.c:1.121 Mon Jul 16 13:55:01 2012 +++ src/sys/dev/sysmon/sysmon_envsys.c Thu Jul 19 13:31:06 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: sysmon_envsys.c,v 1.121 2012/07/16 13:55:01 pgoyette Exp $ */ +/* $NetBSD: sysmon_envsys.c,v 1.122 2012/07/19 13:31:06 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.121 2012/07/16 13:55:01 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.122 2012/07/19 13:31:06 pgoyette Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -1062,6 +1062,7 @@ sme_remove_userprops(void) prop_dictionary_t sdict; envsys_data_t *edata = NULL; char tmp[ENVSYS_DESCLEN]; + char rnd_name[sizeof(edata->rnd_src.name)]; sysmon_envsys_lim_t lims; const struct sme_descr_entry *sdt_units; uint32_t props; @@ -1168,21 +1169,29 @@ sme_remove_userprops(void) sme_event_unregister(sme, edata->desc, PENVSYS_EVENT_LIMITS); + /* + * Find the correct units for this sensor. + */ + sdt_units = sme_find_table_entry(SME_DESC_UNITS, + edata->units); + if (props & PROP_LIMITS) { DPRINTF(("%s: install limits for %s %s\n", __func__, sme->sme_name, edata->desc)); - - /* - * Find the correct units for this sensor. - */ - sdt_units = sme_find_table_entry(SME_DESC_UNITS, - edata->units); - sme_event_register(sdict, edata, sme, &lims, props, PENVSYS_EVENT_LIMITS, sdt_units->crittype); } + if (edata->flags & ENVSYS_FHAS_ENTROPY) { + sme_event_register(sdict, edata, sme, + &lims, props, PENVSYS_EVENT_NULL, + sdt_units->crittype); + snprintf(rnd_name, sizeof(rnd_name), "%s-%s", + sme->sme_name, edata->desc); + rnd_attach_source(&edata->rnd_src, rnd_name, + RND_TYPE_ENV, 0); + } } /*