diff --git a/usr.sbin/mfiutil/Makefile b/usr.sbin/mfiutil/Makefile --- a/usr.sbin/mfiutil/Makefile +++ b/usr.sbin/mfiutil/Makefile @@ -1,10 +1,12 @@ # $FreeBSD$ PROG= mfiutil +LINKS= ${BINDIR}/mfiutil ${BINDIR}/mrsasutil SRCS= mfiutil.c mfi_bbu.c mfi_cmd.c mfi_config.c mfi_drive.c mfi_evt.c \ mfi_flash.c mfi_patrol.c mfi_show.c mfi_volume.c mfi_foreign.c \ mfi_properties.c MAN8= mfiutil.8 +MLINKS= mfiutil.8 mrsasutil.8 CFLAGS.gcc+= -fno-builtin-strftime diff --git a/usr.sbin/mfiutil/mfi_bbu.c b/usr.sbin/mfiutil/mfi_bbu.c --- a/usr.sbin/mfiutil/mfi_bbu.c +++ b/usr.sbin/mfiutil/mfi_bbu.c @@ -134,7 +134,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -171,7 +171,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); diff --git a/usr.sbin/mfiutil/mfi_cmd.c b/usr.sbin/mfiutil/mfi_cmd.c --- a/usr.sbin/mfiutil/mfi_cmd.c +++ b/usr.sbin/mfiutil/mfi_cmd.c @@ -209,16 +209,20 @@ * configuration of the mfi controller. */ int -mfi_reconfig_supported(void) +mfi_reconfig_supported(const char *name) { char mibname[64]; size_t len; int dummy; - len = sizeof(dummy); - snprintf(mibname, sizeof(mibname), "dev.mfi.%d.delete_busy_volumes", - mfi_unit); - return (sysctlbyname(mibname, &dummy, &len, NULL, 0) == 0); + if (strcmp(name, MRSAS_TYPE) == 0) + return (1); + else { + len = sizeof(dummy); + snprintf(mibname, sizeof(mibname), + "dev.mfi.%d.delete_busy_volumes", mfi_unit); + return (sysctlbyname(mibname, &dummy, &len, NULL, 0) == 0); + } } int @@ -304,11 +308,11 @@ } int -mfi_open(int unit, int acs) +mfi_open(const char *name, int unit, int acs) { char path[MAXPATHLEN]; - snprintf(path, sizeof(path), "/dev/mfi%d", unit); + snprintf(path, sizeof(path), "/dev/%s%d", name, unit); return (open(path, acs)); } diff --git a/usr.sbin/mfiutil/mfi_config.c b/usr.sbin/mfiutil/mfi_config.c --- a/usr.sbin/mfiutil/mfi_config.c +++ b/usr.sbin/mfiutil/mfi_config.c @@ -162,16 +162,16 @@ int ch, error, fd; u_int i; - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); return (error); } - if (!mfi_reconfig_supported()) { - warnx("The current mfi(4) driver does not support " - "configuration changes."); + if (!mfi_reconfig_supported(mfi_type)) { + warnx("The current %s(4) driver does not support " + "configuration changes.", mfi_type); close(fd); return (EOPNOTSUPP); } @@ -193,8 +193,8 @@ } printf( - "Are you sure you wish to clear the configuration on mfi%u? [y/N] ", - mfi_unit); + "Are you sure you wish to clear the configuration on %s%u? [y/N] ", + mfi_type, mfi_unit); ch = getchar(); if (ch != 'y' && ch != 'Y') { printf("\nAborting\n"); @@ -209,7 +209,7 @@ return (error); } - printf("mfi%d: Configuration cleared\n", mfi_unit); + printf("%s%d: Configuration cleared\n", mfi_type, mfi_unit); close(fd); return (0); @@ -587,16 +587,16 @@ narrays = 0; error = 0; - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); return (error); } - if (!mfi_reconfig_supported()) { - warnx("The current mfi(4) driver does not support " - "configuration changes."); + if (!mfi_reconfig_supported(mfi_type)) { + warnx("The current %s(4) driver does not support " + "configuration changes.", mfi_type); error = EOPNOTSUPP; goto error; } @@ -869,16 +869,16 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); return (error); } - if (!mfi_reconfig_supported()) { - warnx("The current mfi(4) driver does not support " - "configuration changes."); + if (!mfi_reconfig_supported(mfi_type)) { + warnx("The current %s(4) driver does not support " + "configuration changes.", mfi_type); close(fd); return (EOPNOTSUPP); } @@ -937,7 +937,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -1062,7 +1062,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -1120,7 +1120,7 @@ msg_prefix = "Configuration (Debug)"; printf( - "mfi%d %s: %d arrays, %d volumes, %d spares\n", mfi_unit, + "%s%d %s: %d arrays, %d volumes, %d spares\n", mfi_type, mfi_unit, msg_prefix, config->array_count, config->log_drv_count, config->spares_count); printf(" array size: %u\n", config->array_size); @@ -1211,7 +1211,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -1248,7 +1248,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); diff --git a/usr.sbin/mfiutil/mfi_drive.c b/usr.sbin/mfiutil/mfi_drive.c --- a/usr.sbin/mfiutil/mfi_drive.c +++ b/usr.sbin/mfiutil/mfi_drive.c @@ -74,7 +74,7 @@ else snprintf(buf, sizeof(buf), "%2u", device_id); - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { warn("mfi_open"); return (buf); @@ -388,7 +388,7 @@ uint8_t mbox[6]; int error, fd; - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -503,7 +503,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -560,7 +560,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -616,7 +616,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -682,7 +682,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -742,7 +742,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); diff --git a/usr.sbin/mfiutil/mfi_evt.c b/usr.sbin/mfiutil/mfi_evt.c --- a/usr.sbin/mfiutil/mfi_evt.c +++ b/usr.sbin/mfiutil/mfi_evt.c @@ -77,7 +77,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -91,7 +91,7 @@ return (error); } - printf("mfi%d Event Log Sequence Numbers:\n", mfi_unit); + printf("%s%d Event Log Sequence Numbers:\n", mfi_type, mfi_unit); printf(" Newest Seq #: %u\n", info.newest_seq_num); printf(" Oldest Seq #: %u\n", info.oldest_seq_num); printf(" Clear Seq #: %u\n", info.clear_seq_num); @@ -547,7 +547,7 @@ int ch, error, fd, num_events, verbose; u_int i; - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); diff --git a/usr.sbin/mfiutil/mfi_flash.c b/usr.sbin/mfiutil/mfi_flash.c --- a/usr.sbin/mfiutil/mfi_flash.c +++ b/usr.sbin/mfiutil/mfi_flash.c @@ -58,7 +58,7 @@ return (error); } - printf("mfi%d Pending Firmware Images:\n", mfi_unit); + printf("%s%d Pending Firmware Images:\n", mfi_type, mfi_unit); strcpy(header.name, "Name"); strcpy(header.version, "Version"); strcpy(header.build_date, "Date"); @@ -122,7 +122,7 @@ goto error; } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); diff --git a/usr.sbin/mfiutil/mfi_foreign.c b/usr.sbin/mfiutil/mfi_foreign.c --- a/usr.sbin/mfiutil/mfi_foreign.c +++ b/usr.sbin/mfiutil/mfi_foreign.c @@ -48,7 +48,7 @@ { int ch, error, fd; - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -74,7 +74,7 @@ return (error); } - printf("mfi%d: Foreign configuration cleared\n", mfi_unit); + printf("%s%d: Foreign configuration cleared\n", mfi_type, mfi_unit); close(fd); return (0); } @@ -86,7 +86,7 @@ struct mfi_foreign_scan_info info; int error, fd; - fd = mfi_open(mfi_unit, O_RDONLY); + fd = mfi_open(mfi_type, mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -101,7 +101,7 @@ return (error); } - printf("mfi%d: Found %d foreign configurations\n", mfi_unit, + printf("%s%d: Found %d foreign configurations\n", mfi_type, mfi_unit, info.count); close(fd); return (0); @@ -222,7 +222,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDONLY); + fd = mfi_open(mfi_type, mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -294,7 +294,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -355,11 +355,11 @@ } if (ac == 1) - printf("mfi%d: All foreign configurations imported\n", - mfi_unit); + printf("%s%d: All foreign configurations imported\n", + mfi_type, mfi_unit); else - printf("mfi%d: Foreign configuration %d imported\n", mfi_unit, - cfgidx); + printf("%s%d: Foreign configuration %d imported\n", + mfi_type, mfi_unit, cfgidx); close(fd); return (0); } diff --git a/usr.sbin/mfiutil/mfi_patrol.c b/usr.sbin/mfiutil/mfi_patrol.c --- a/usr.sbin/mfiutil/mfi_patrol.c +++ b/usr.sbin/mfiutil/mfi_patrol.c @@ -89,7 +89,7 @@ int error, fd; u_int i; - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -199,7 +199,7 @@ { int error, fd; - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -225,7 +225,7 @@ { int error, fd; - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -295,7 +295,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); diff --git a/usr.sbin/mfiutil/mfi_properties.c b/usr.sbin/mfiutil/mfi_properties.c --- a/usr.sbin/mfiutil/mfi_properties.c +++ b/usr.sbin/mfiutil/mfi_properties.c @@ -78,7 +78,7 @@ return(-1); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -130,7 +130,7 @@ return(-1); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); diff --git a/usr.sbin/mfiutil/mfi_show.c b/usr.sbin/mfiutil/mfi_show.c --- a/usr.sbin/mfiutil/mfi_show.c +++ b/usr.sbin/mfiutil/mfi_show.c @@ -66,7 +66,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDONLY); + fd = mfi_open(mfi_type, mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -79,7 +79,7 @@ close(fd); return (error); } - printf("mfi%d Adapter:\n", mfi_unit); + printf("%s%d Adapter:\n", mfi_type, mfi_unit); printf(" Product Name: %.80s\n", info.product_name); printf(" Serial Number: %.32s\n", info.serial_number); if (info.package_version[0] != '\0') @@ -155,7 +155,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDONLY); + fd = mfi_open(mfi_type, mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -170,7 +170,7 @@ return (error); } if (status == MFI_STAT_NO_HW_PRESENT) { - printf("mfi%d: No battery present\n", mfi_unit); + printf("%s%d: No battery present\n", mfi_type, mfi_unit); close(fd); return (0); } @@ -200,7 +200,7 @@ } show_props = (status == MFI_STAT_OK); - printf("mfi%d: Battery State:\n", mfi_unit); + printf("%s%d: Battery State:\n", mfi_type, mfi_unit); printf(" Manufacture Date: %d/%d/%d\n", design.mfg_date >> 5 & 0x0f, design.mfg_date & 0x1f, design.mfg_date >> 9 & 0xffff); printf(" Serial Number: %d\n", design.serial_number); @@ -357,7 +357,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDONLY); + fd = mfi_open(mfi_type, mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -373,8 +373,8 @@ } /* Dump out the configuration. */ - printf("mfi%d Configuration: %d arrays, %d volumes, %d spares\n", - mfi_unit, config->array_count, config->log_drv_count, + printf("%s%d Configuration: %d arrays, %d volumes, %d spares\n", + mfi_type, mfi_unit, config->array_count, config->log_drv_count, config->spares_count); p = (char *)config->array; @@ -458,7 +458,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDONLY); + fd = mfi_open(mfi_type, mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -474,7 +474,7 @@ } /* List the volumes. */ - printf("mfi%d Volumes:\n", mfi_unit); + printf("%s%d Volumes:\n", mfi_type, mfi_unit); state_len = strlen("State"); for (i = 0; i < list.ld_count; i++) { len = strlen(mfi_ldstate(list.ld_list[i].state)); @@ -541,7 +541,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDONLY); + fd = mfi_open(mfi_type, mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -576,7 +576,7 @@ } /* List the drives. */ - printf("mfi%d Physical Drives:\n", mfi_unit); + printf("%s%d Physical Drives:\n", mfi_type, mfi_unit); for (i = 0; i < list->count; i++) { /* Skip non-hard disks. */ @@ -621,7 +621,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDONLY); + fd = mfi_open(mfi_type, mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -636,9 +636,9 @@ } if (info.package_version[0] != '\0') - printf("mfi%d Firmware Package Version: %s\n", mfi_unit, - info.package_version); - printf("mfi%d Firmware Images:\n", mfi_unit); + printf("%s%d Firmware Package Version: %s\n", mfi_type, + mfi_unit, info.package_version); + printf("%s%d Firmware Images:\n", mfi_type, mfi_unit); strcpy(header.name, "Name"); strcpy(header.version, "Version"); strcpy(header.build_date, "Date"); @@ -681,7 +681,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDONLY); + fd = mfi_open(mfi_type, mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); @@ -776,7 +776,8 @@ close(fd); if (!busy) - printf("No activity in progress for adapter mfi%d\n", mfi_unit); + printf("No activity in progress for adapter %s%d\n", + mfi_type, mfi_unit); return (0); } diff --git a/usr.sbin/mfiutil/mfi_volume.c b/usr.sbin/mfiutil/mfi_volume.c --- a/usr.sbin/mfiutil/mfi_volume.c +++ b/usr.sbin/mfiutil/mfi_volume.c @@ -297,7 +297,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -406,7 +406,7 @@ return (ENOSPC); } - fd = mfi_open(mfi_unit, O_RDWR); + fd = mfi_open(mfi_type, mfi_unit, O_RDWR); if (fd < 0) { error = errno; warn("mfi_open"); @@ -457,7 +457,7 @@ return (EINVAL); } - fd = mfi_open(mfi_unit, O_RDONLY); + fd = mfi_open(mfi_type, mfi_unit, O_RDONLY); if (fd < 0) { error = errno; warn("mfi_open"); diff --git a/usr.sbin/mfiutil/mfiutil.h b/usr.sbin/mfiutil/mfiutil.h --- a/usr.sbin/mfiutil/mfiutil.h +++ b/usr.sbin/mfiutil/mfiutil.h @@ -39,6 +39,9 @@ #include +#define MRSAS_TYPE "mrsas" +#define MFI_TYPE "mfi" + /* 4.x compat */ #ifndef SET_DECLARE @@ -123,6 +126,7 @@ #define MFI_DNAME_HONOR_OPTS 0x8000 /* Allow cmd line to override default */ extern int mfi_unit; +extern const char *mfi_type; extern u_int mfi_opts; @@ -154,7 +158,7 @@ int mfi_lookup_volume(int fd, const char *name, uint8_t *target_id); int mfi_dcmd_command(int fd, uint32_t opcode, void *buf, size_t bufsize, uint8_t *mbox, size_t mboxlen, uint8_t *statusp); -int mfi_open(int unit, int acs); +int mfi_open(const char *name, int unit, int acs); int mfi_ctrl_get_info(int fd, struct mfi_ctrl_info *info, uint8_t *statusp); int mfi_ld_get_info(int fd, uint8_t target_id, struct mfi_ld_info *info, uint8_t *statusp); @@ -162,7 +166,7 @@ int mfi_pd_get_info(int fd, uint16_t device_id, struct mfi_pd_info *info, uint8_t *statusp); int mfi_pd_get_list(int fd, struct mfi_pd_list **listp, uint8_t *statusp); -int mfi_reconfig_supported(void); +int mfi_reconfig_supported(const char *name); 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); diff --git a/usr.sbin/mfiutil/mfiutil.8 b/usr.sbin/mfiutil/mfiutil.8 --- a/usr.sbin/mfiutil/mfiutil.8 +++ b/usr.sbin/mfiutil/mfiutil.8 @@ -31,26 +31,31 @@ .Dt MFIUTIL 8 .Os .Sh NAME -.Nm mfiutil +.Nm mfiutil, mrsasutil .Nd Utility for managing LSI MegaRAID SAS controllers .Sh SYNOPSIS .Nm .Cm version .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm show adapter .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm show battery .Nm .Op Fl d .Op Fl e +.Op Fl t Ar type .Op Fl u Ar unit .Cm show config .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm show drives .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm show events .Op Fl c Ar class @@ -59,67 +64,87 @@ .Op Fl v .Op Ar start Op Ar stop .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm show firmware .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm show foreign Op Ar volume .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm show logstate .Nm .Op Fl d .Op Fl e +.Op Fl t Ar type .Op Fl u Ar unit .Cm show patrol .Nm .Op Fl d .Op Fl e +.Op Fl t Ar type .Op Fl u Ar unit .Cm show progress .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm show volumes .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm fail Ar drive .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm good Ar drive .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm rebuild Ar drive .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm syspd Ar drive .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm drive progress Ar drive .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm drive clear Ar drive Brq "start | stop" .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm start rebuild Ar drive .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm abort rebuild Ar drive .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm locate Ar drive Brq "on | off" .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm cache Ar volume Op Ar setting Oo Ar value Oc Op ... .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm name Ar volume Ar name .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm volume progress Ar volume .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm clear .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm create Ar type .Op Fl v @@ -127,51 +152,67 @@ .Ar drive Ns Op \&, Ns Ar drive Ns Op ",..." .Op Ar drive Ns Op \&, Ns Ar drive Ns Op ",..." .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm delete Ar volume .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm add Ar drive Op Ar volume .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm remove Ar drive .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm start patrol .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm stop patrol .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm patrol Ar command Op Ar interval Op Ar start .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm foreign scan .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm foreign clear Op Ar config .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm foreign diag Op Ar config .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm foreign preview Op Ar config .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm foreign import Op Ar config .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm flash Ar file .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm start learn .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm bbu Ar setting Ar value .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm ctrlprop Ar rebuild Op Ar rate .Nm +.Op Fl t Ar type .Op Fl u Ar unit .Cm ctrlprop Ar alarm Op Ar 0/1 .Sh DESCRIPTION @@ -185,8 +226,13 @@ Commands may support additional optional or required arguments after the command. .Pp -Currently one global option is supported: +Currently two global option is supported: .Bl -tag -width indent +.It Fl t Ar type +.Ar unit +specifies the type of the controller to work with either mfi or mrsas +If no type is specified, +then the name of the invoked tool used for the type. .It Fl u Ar unit .Ar unit specifies the unit of the controller to work with. diff --git a/usr.sbin/mfiutil/mfiutil.c b/usr.sbin/mfiutil/mfiutil.c --- a/usr.sbin/mfiutil/mfiutil.c +++ b/usr.sbin/mfiutil/mfiutil.c @@ -45,7 +45,8 @@ MFI_TABLE(top, stop); MFI_TABLE(top, abort); -int mfi_unit; +int mfi_unit = 0; +const char *mfi_type = NULL; u_int mfi_opts; static int fw_name_width, fw_version_width, fw_date_width, fw_time_width; @@ -53,7 +54,7 @@ usage(void) { - fprintf(stderr, "usage: mfiutil [-de] [-u unit] ...\n\n"); + fprintf(stderr, "usage: mfiutil [-de] [-u unit] [-t type] ...\n\n"); fprintf(stderr, "Commands include:\n"); fprintf(stderr, " version\n"); fprintf(stderr, " show adapter - display controller information\n"); @@ -122,8 +123,16 @@ { struct mfiutil_command **cmd; int ch; + const char *pn; - while ((ch = getopt(ac, av, "deu:")) != -1) { + pn = getprogname(); + + if (strcmp(pn, "mrsasutil") == 0) + mfi_type = MRSAS_TYPE; + else + mfi_type = MFI_TYPE; + + while ((ch = getopt(ac, av, "deu:t:")) != -1) { switch (ch) { case 'd': mfi_opts |= MFI_DNAME_DEVICE_ID; @@ -134,6 +143,9 @@ case 'u': mfi_unit = atoi(optarg); break; + case 't': + mfi_type = optarg; + break; case '?': usage(); }