mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 10:37:22 +00:00
ID 408 - fix sel list last X listing
The events can be removed as desired on certain machines so the only way to get the proper last X events is to traverse them all not outputting the first NR_EVENTS - X events. Signed-off-by: Boris Ranto <branto@redhat.com>
This commit is contained in:
parent
eb94a394ba
commit
ccfa5aec4f
@ -2255,7 +2255,7 @@ __ipmi_sel_savelist_entries(struct ipmi_intf * intf, int count, const char * sav
|
||||
|
||||
if (count < 0) {
|
||||
/** Show only the most recent 'count' records. */
|
||||
int delta;
|
||||
int i;
|
||||
uint16_t entries;
|
||||
|
||||
req.msg.cmd = IPMI_CMD_GET_SEL_INFO;
|
||||
@ -2273,15 +2273,20 @@ __ipmi_sel_savelist_entries(struct ipmi_intf * intf, int count, const char * sav
|
||||
if (-count > entries)
|
||||
count = -entries;
|
||||
|
||||
/* Get first record. */
|
||||
next_id = ipmi_sel_get_std_entry(intf, 0, &evt);
|
||||
|
||||
delta = next_id - evt.record_id;
|
||||
|
||||
/* Get last record. */
|
||||
next_id = ipmi_sel_get_std_entry(intf, 0xffff, &evt);
|
||||
|
||||
next_id = evt.record_id + count * delta + delta;
|
||||
for(i = 0; i < entries + count; i++) {
|
||||
next_id = ipmi_sel_get_std_entry(intf, next_id, &evt);
|
||||
if (next_id == 0) {
|
||||
/*
|
||||
* usually next_id of zero means end but
|
||||
* retry because some hardware has quirks
|
||||
* and will return 0 randomly.
|
||||
*/
|
||||
next_id = ipmi_sel_get_std_entry(intf, next_id, &evt);
|
||||
if (next_id == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (savefile != NULL) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user