Add FM_EREPORT_TIME when event is posted

Previously I was adding the FM_EREPORT_TIME time when the nvlist
was constructed.  However, with the update to onnv_141 these
ereport nvlists are now constructed in several places and it
doesn't make sense for each of them to have to add this common
bit of info.  To handle this the FM_EREPORT_TIME is now only
added once when the event is posted.
This commit is contained in:
Brian Behlendorf 2010-07-21 12:45:53 -07:00
parent 5951864035
commit f275e82de9
1 changed files with 10 additions and 9 deletions

View File

@ -496,9 +496,19 @@ fm_zevent_insert(zevent_t *ev)
void
fm_zevent_post(nvlist_t *nvl, nvlist_t *detector, zevent_cb_t *cb)
{
int64_t tv_array[2];
timestruc_t tv;
size_t nvl_size = 0;
zevent_t *ev;
gethrestime(&tv);
tv_array[0] = tv.tv_sec;
tv_array[1] = tv.tv_nsec;
if (nvlist_add_int64_array(nvl, FM_EREPORT_TIME, tv_array, 2)) {
atomic_add_64(&erpt_kstat_data.erpt_set_failed.value.ui64, 1);
return;
}
(void) nvlist_size(nvl, &nvl_size, NV_ENCODE_NATIVE);
if (nvl_size > ERPT_DATA_SZ || nvl_size == 0) {
atomic_add_64(&erpt_kstat_data.erpt_dropped.value.ui64, 1);
@ -892,8 +902,6 @@ fm_ereport_set(nvlist_t *ereport, int version, const char *erpt_class,
{
char ereport_class[FM_MAX_CLASS];
const char *name;
timestruc_t tv;
int64_t tv_array[2];
va_list ap;
int ret;
@ -925,13 +933,6 @@ fm_ereport_set(nvlist_t *ereport, int version, const char *erpt_class,
if (ret)
atomic_add_64(&erpt_kstat_data.erpt_set_failed.value.ui64, 1);
gethrestime(&tv);
tv_array[0] = tv.tv_sec;
tv_array[1] = tv.tv_nsec;
if (nvlist_add_int64_array(ereport, FM_EREPORT_TIME, tv_array, 2)) {
atomic_add_64(&erpt_kstat_data.erpt_set_failed.value.ui64, 1);
}
}
/*