diff --git a/usr.sbin/mfiutil/mfi_flash.c b/usr.sbin/mfiutil/mfi_flash.c index 2b825291d3d6..d640cf75c814 100644 --- a/usr.sbin/mfiutil/mfi_flash.c +++ b/usr.sbin/mfiutil/mfi_flash.c @@ -42,34 +42,6 @@ #define FLASH_BUF_SIZE (64 * 1024) -static void -scan_firmware(struct mfi_info_component *comp) -{ - int len; - - len = strlen(comp->name); - if (fw_name_width < len) - fw_name_width = len; - len = strlen(comp->version); - if (fw_version_width < len) - fw_version_width = len; - len = strlen(comp->build_date); - if (fw_date_width < len) - fw_date_width = len; - len = strlen(comp->build_time); - if (fw_time_width < len) - fw_time_width = len; -} - -static void -display_firmware(struct mfi_info_component *comp) -{ - - printf("%-*s %-*s %-*s %-*s\n", fw_name_width, comp->name, - fw_version_width, comp->version, fw_date_width, comp->build_date, - fw_time_width, comp->build_time); -} - static int display_pending_firmware(int fd) { @@ -94,9 +66,9 @@ display_pending_firmware(int fd) info.pending_image_component_count = 8; for (i = 0; i < info.pending_image_component_count; i++) scan_firmware(&info.pending_image_component[i]); - display_firmware(&header); + display_firmware(&header, ""); for (i = 0; i < info.pending_image_component_count; i++) - display_firmware(&info.pending_image_component[i]); + display_firmware(&info.pending_image_component[i], ""); return (0); } diff --git a/usr.sbin/mfiutil/mfi_show.c b/usr.sbin/mfiutil/mfi_show.c index c8b4377a1d3e..be395bb11802 100644 --- a/usr.sbin/mfiutil/mfi_show.c +++ b/usr.sbin/mfiutil/mfi_show.c @@ -570,34 +570,6 @@ show_drives(int ac, char **av __unused) } MFI_COMMAND(show, drives, show_drives); -static void -scan_firmware(struct mfi_info_component *comp) -{ - int len; - - len = strlen(comp->name); - if (fw_name_width < len) - fw_name_width = len; - len = strlen(comp->version); - if (fw_version_width < len) - fw_version_width = len; - len = strlen(comp->build_date); - if (fw_date_width < len) - fw_date_width = len; - len = strlen(comp->build_time); - if (fw_time_width < len) - fw_time_width = len; -} - -static void -display_firmware(struct mfi_info_component *comp, const char *tag) -{ - - printf("%-*s %-*s %-*s %-*s %s\n", fw_name_width, comp->name, - fw_version_width, comp->version, fw_date_width, comp->build_date, - fw_time_width, comp->build_time, tag); -} - static int show_firmware(int ac, char **av __unused) { diff --git a/usr.sbin/mfiutil/mfiutil.c b/usr.sbin/mfiutil/mfiutil.c index b0b6353a779f..79c6a4b3ec9b 100644 --- a/usr.sbin/mfiutil/mfiutil.c +++ b/usr.sbin/mfiutil/mfiutil.c @@ -45,7 +45,7 @@ MFI_TABLE(top, abort); int mfi_unit; u_int mfi_opts; -int fw_name_width, fw_version_width, fw_date_width, fw_time_width; +static int fw_name_width, fw_version_width, fw_date_width, fw_time_width; static void usage(void) @@ -144,3 +144,31 @@ main(int ac, char **av) warnx("Unknown command %s.", av[0]); return (1); } + +void +scan_firmware(struct mfi_info_component *comp) +{ + int len; + + len = strlen(comp->name); + if (fw_name_width < len) + fw_name_width = len; + len = strlen(comp->version); + if (fw_version_width < len) + fw_version_width = len; + len = strlen(comp->build_date); + if (fw_date_width < len) + fw_date_width = len; + len = strlen(comp->build_time); + if (fw_time_width < len) + fw_time_width = len; +} + +void +display_firmware(struct mfi_info_component *comp, const char *tag) +{ + + printf("%-*s %-*s %-*s %-*s %s\n", fw_name_width, comp->name, + fw_version_width, comp->version, fw_date_width, comp->build_date, + fw_time_width, comp->build_time, tag); +} diff --git a/usr.sbin/mfiutil/mfiutil.h b/usr.sbin/mfiutil/mfiutil.h index c696a05dfd19..687bdd9fb8b9 100644 --- a/usr.sbin/mfiutil/mfiutil.h +++ b/usr.sbin/mfiutil/mfiutil.h @@ -121,8 +121,8 @@ struct mfiutil_command { #define MFI_DNAME_HONOR_OPTS 0x8000 /* Allow cmd line to override default */ extern int mfi_unit; + extern u_int mfi_opts; -extern int fw_name_width, fw_version_width, fw_date_width, fw_time_width; void mbox_store_ldref(uint8_t *mbox, union mfi_ld_ref *ref); void mbox_store_pdref(uint8_t *mbox, union mfi_pd_ref *ref); @@ -153,4 +153,7 @@ const char *mfi_status(u_int status_code); const char *mfi_drive_name(struct mfi_pd_info *pinfo, uint16_t device_id, uint32_t def); +void scan_firmware(struct mfi_info_component *comp); +void display_firmware(struct mfi_info_component *comp, const char *tag); + #endif /* !__MFIUTIL_H__ */