On 03/25/2013 04:16 AM, Zdenek Styblik wrote:
> On Fri, Mar 22, 2013 at 2:42 PM, Corey Minyard <[email protected]> wrote:
>> The event data and SDRs support assertions and deassertions for
>> threshold events as well as
>> discrete events. So print out assertion and deassertion on all events.
>>
> Corey,
>
> is it possible to change coding style to ``if (...) { ... } else { ...
> }''? I know you're keeping up with original version, no blame
> intended.
>
> Thanks,
> Z.
Easy enough to change, here's the new patch:
Index: lib/ipmi_sel.c
===================================================================
RCS file: /cvsroot/ipmitool/ipmitool/lib/ipmi_sel.c,v
retrieving revision 1.90
diff -u -r1.90 ipmi_sel.c
--- lib/ipmi_sel.c 16 Jan 2013 12:27:29 -0000 1.90
+++ lib/ipmi_sel.c 25 Mar 2013 15:56:51 -0000
@@ -1709,16 +1709,16 @@
free(description);
}
- if (evt->sel_type.standard_type.event_type == 0x6f) {
- if (csv_output)
- printf(",");
- else
- printf(" | ");
+ if (csv_output) {
+ printf(",");
+ } else {
+ printf(" | ");
+ }
- if (evt->sel_type.standard_type.event_dir)
- printf("Deasserted");
- else
- printf("Asserted");
+ if (evt->sel_type.standard_type.event_dir) {
+ printf("Deasserted");
+ } else {
+ printf("Asserted");
}
if (sdr != NULL && evt->sel_type.standard_type.event_type == 1) {
Index: src/ipmievd.c
===================================================================
RCS file: /cvsroot/ipmitool/ipmitool/src/ipmievd.c,v
retrieving revision 1.44
diff -u -r1.44 ipmievd.c
--- src/ipmievd.c 28 Sep 2012 18:47:01 -0000 1.44
+++ src/ipmievd.c 25 Mar 2013 15:56:51 -0000
@@ -278,11 +278,13 @@
sdr->record.full,
evt->sel_type.standard_type.event_data[2]);
}
- lprintf(LOG_NOTICE, "%s%s sensor %s %s (Reading %.*f %s
Threshold %.*f %s)",
+ lprintf(LOG_NOTICE, "%s%s sensor %s %s %s (Reading %.*f %s
Threshold %.*f %s)",
eintf->prefix,
type,
sdr->record.full->id_string,
desc ? : "",
+ (evt->sel_type.standard_type.event_dir
+ ? "Deasserted" : "Asserted"),
(trigger_reading==(int)trigger_reading) ? 0 : 2,
trigger_reading,
((evt->sel_type.standard_type.event_data[0] & 0xf) %
2) ? ">" : "<",
@@ -298,8 +300,11 @@
/*
* Discrete Event
*/
- lprintf(LOG_NOTICE, "%s%s sensor %s %s",
- eintf->prefix, type, sdr->record.full->id_string, desc
? : "");
+ lprintf(LOG_NOTICE, "%s%s sensor %s %s %s",
+ eintf->prefix, type,
+ sdr->record.full->id_string, desc ? : "",
+ (evt->sel_type.standard_type.event_dir
+ ? "Deasserted" : "Asserted"));
if (((evt->sel_type.standard_type.event_data[0] >> 6) & 3)
== 1) {
/* previous state and/or severity in event data byte 2 */
}
@@ -308,23 +313,20 @@
/*
* OEM Event
*/
- lprintf(LOG_NOTICE, "%s%s sensor %s %s",
- eintf->prefix, type, sdr->record.full->id_string, desc
? : "");
+ lprintf(LOG_NOTICE, "%s%s sensor %s %s %s",
+ eintf->prefix, type,
+ sdr->record.full->id_string, desc ? : "",
+ (evt->sel_type.standard_type.event_dir
+ ? "Deasserted" : "Asserted"));
}
break;
case SDR_RECORD_TYPE_COMPACT_SENSOR:
- if (evt->sel_type.standard_type.event_type == 0x6f) {
- lprintf(LOG_NOTICE, "%s%s sensor %s - %s %s",
- eintf->prefix,
- type, sdr->record.compact->id_string,
- desc ? : "",
- evt->sel_type.standard_type.event_dir ? "Deasserted" :
"Asserted");
- } else {
- lprintf(LOG_NOTICE, "%s%s sensor %s - %s",
- eintf->prefix, type,
- sdr->record.compact->id_string, desc ? : "");
- }
+ lprintf(LOG_NOTICE, "%s%s sensor %s - %s %s",
+ eintf->prefix, type,
+ sdr->record.compact->id_string, desc ? : "",
+ (evt->sel_type.standard_type.event_dir
+ ? "Deasserted" : "Asserted"));
break;
default:
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Ipmitool-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel