diff options
author | jhb <jhb@FreeBSD.org> | 2014-05-18 15:28:25 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2014-05-18 15:28:25 +0000 |
commit | 4670db3f86733b03125d5881a2806efdd3defd14 (patch) | |
tree | 13cda8744aaf0cd7d4748ccd3a37e08959c361d6 /usr.sbin/mfiutil | |
parent | a7f85b6451b28d1eeec0045b8483305fd6296082 (diff) | |
download | FreeBSD-src-4670db3f86733b03125d5881a2806efdd3defd14.zip FreeBSD-src-4670db3f86733b03125d5881a2806efdd3defd14.tar.gz |
MFC 264765,264766:
- Don't claim the adapter is idle if it is clearing a drive.
- Fix an off by one error when checking for the stop event. This
resulted in not showing the most recent event by default.
- When the stop even is hit, break out of the outer loop to stop
fetching more events.
Diffstat (limited to 'usr.sbin/mfiutil')
-rw-r--r-- | usr.sbin/mfiutil/mfi_evt.c | 18 | ||||
-rw-r--r-- | usr.sbin/mfiutil/mfi_show.c | 2 |
2 files changed, 13 insertions, 7 deletions
diff --git a/usr.sbin/mfiutil/mfi_evt.c b/usr.sbin/mfiutil/mfi_evt.c index c9a1a6d..901c0bd 100644 --- a/usr.sbin/mfiutil/mfi_evt.c +++ b/usr.sbin/mfiutil/mfi_evt.c @@ -33,6 +33,7 @@ #include <sys/errno.h> #include <err.h> #include <fcntl.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <strings.h> @@ -534,6 +535,7 @@ show_events(int ac, char **av) struct mfi_evt_log_state info; struct mfi_evt_list *list; union mfi_evt filter; + bool first; long val; char *cp; ssize_t size; @@ -640,7 +642,9 @@ show_events(int ac, char **av) close(fd); return (ENOMEM); } - for (seq = start;;) { + first = true; + seq = start; + for (;;) { if (mfi_get_events(fd, list, num_events, filter, seq, &status) < 0) { error = errno; @@ -650,8 +654,6 @@ show_events(int ac, char **av) return (error); } if (status == MFI_STAT_NOT_FOUND) { - if (seq == start) - warnx("No matching events found"); break; } if (status != MFI_STAT_OK) { @@ -669,13 +671,14 @@ show_events(int ac, char **av) * the case that our stop point is earlier in * the buffer than our start point. */ - if (list->event[i].seq >= stop) { + if (list->event[i].seq > stop) { if (start <= stop) - break; + goto finish; else if (list->event[i].seq < start) - break; + goto finish; } mfi_decode_evt(fd, &list->event[i], verbose); + first = false; } /* @@ -686,6 +689,9 @@ show_events(int ac, char **av) seq = list->event[list->count - 1].seq + 1; } +finish: + if (first) + warnx("No matching events found"); free(list); close(fd); diff --git a/usr.sbin/mfiutil/mfi_show.c b/usr.sbin/mfiutil/mfi_show.c index f0f5bab..f541045 100644 --- a/usr.sbin/mfiutil/mfi_show.c +++ b/usr.sbin/mfiutil/mfi_show.c @@ -766,7 +766,7 @@ show_progress(int ac, char **av __unused) printf("drive %s ", mfi_drive_name(NULL, device_id, MFI_DNAME_DEVICE_ID|MFI_DNAME_HONOR_OPTS)); mfi_display_progress("Clear", &pinfo.prog_info.clear); - + busy = 1; } } |