diff -Nur mpt-status-1.2.0-RC4/Makefile mpt-status-1.2.0-RC5/Makefile --- mpt-status-1.2.0-RC4/Makefile 2006-04-23 20:26:46.000000000 +0200 +++ mpt-status-1.2.0-RC5/Makefile 2006-04-25 08:41:20.000000000 +0200 @@ -2,7 +2,7 @@ PREFIX := /usr KERNEL_PATH := /usr/src/linux CFLAGS := -Iincl -Wall -W -O2 -I${KERNEL_PATH}/drivers/message/fusion -DFLAGS := -DNEWSTYLE #-DSANITIZED_KERNEL_HEADERS #-DVAR_DIV +DFLAGS := -DNEWSTYLE #-DSANITIZED_KERNEL_HEADERS LDFLAGS := DESTDIR := CC := gcc diff -Nur mpt-status-1.2.0-RC4/mpt-status.c mpt-status-1.2.0-RC5/mpt-status.c --- mpt-status-1.2.0-RC4/mpt-status.c 2006-04-23 22:15:36.000000000 +0200 +++ mpt-status-1.2.0-RC5/mpt-status.c 2006-04-25 08:46:03.000000000 +0200 @@ -127,15 +127,18 @@ static void GetResyncPercentage(RaidVol0PhysDisk_t *, unsigned char *, int); static void print_information(void); static void do_init(void); +static void __print_volume_classic(RaidVolumePage0_t *); +static void __print_physdisk_classic(RaidPhysDiskPage0_t *); static void __check_endianess(void) { - test_endianess_t test; - test.u.foo = 0x01020304; - if (test.u.bar[0] != (test.u.foo & 0xFF)) + int i = 1; + + char *p = (char *) &i; + if (p[0] != 1) // Lowest address contains the least significant byte g_bigEndian = 1; } -static unsigned int cpu_to_le32 (unsigned int x) { +static unsigned int cpu_to_le32(unsigned int x) { if (g_bigEndian) { unsigned int y; y = (x & 0xFF00) << 8; @@ -171,7 +174,6 @@ return 1; mpiBlkPtr->dataOutBufPtr = (char *)&g_data; memset(mpiBlkPtr->dataOutBufPtr, 0, mpiBlkPtr->dataOutSize); - } else if (dir == DATA_DIR_IN) { if (mpiBlkPtr->dataInSize > (4*BIG)) return 1; @@ -258,11 +260,7 @@ struct mpt_ioctl_command *cmd = NULL; Config_t *config_request; ConfigReply_t *config_reply; -#ifdef VAR_DIV - unsigned short div = sizeof(char *); /* this is fishy */ -#else unsigned short div = 4; -#endif // VAR_DIV if (NULL == (in = calloc(REALLYBIG, 1))) { perror("calloc"); @@ -334,11 +332,76 @@ return in; } +static int __probe_scsi_id2(void) { + Config_t *ConfigRequest; + ConfigReply_t *pReply = NULL; + RaidVolumePage0_t *pRVP0 = NULL; + uint numBytes; + int status; + int id; + int scsi_id; + + for (scsi_id = 0; scsi_id < 16; scsi_id++) { + mpt_printf("Checking for SCSI ID:%d\n", scsi_id); + numBytes = (sizeof(Config_t) - sizeof(SGE_IO_UNION)) + + sizeof(SGESimple64_t); + if ((mpiBlkPtr = allocIoctlBlk(numBytes)) == NULL) { + return -1; + } + + ConfigRequest = (Config_t *) mpiBlkPtr->MF; + mpiBlkPtr->dataInSize = mpiBlkPtr->dataOutSize = 0; + mpiBlkPtr->dataInBufPtr = mpiBlkPtr->dataOutBufPtr = NULL; + mpiBlkPtr->dataSgeOffset = (sizeof (Config_t) - sizeof(SGE_IO_UNION))/4; + + pReply = (ConfigReply_t *)mpiBlkPtr->replyFrameBufPtr; + + ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_HEADER; + ConfigRequest->Function = MPI_FUNCTION_CONFIG; + ConfigRequest->MsgContext = -1; + ConfigRequest->Header.PageType = MPI_CONFIG_PAGETYPE_RAID_VOLUME; + ConfigRequest->Header.PageNumber = ioc_unit; + ConfigRequest->PageAddress = scsi_id; + + status = read_page2(MPT_FLAGS_KEEP_MEM); + if (status != 0) { + freeMem(); + return -1; + } else if (pReply->Header.PageLength == 0) { + freeMem(); + return -1; + } + mpiBlkPtr->dataInSize = pReply->Header.PageLength * 4; + if (allocDataFrame(DATA_DIR_IN)) { + mpt_printf("Increase data buffer size"); + freeMem(); + return -1; + } + + ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; + ConfigRequest->Header.PageVersion = pReply->Header.PageVersion; + ConfigRequest->Header.PageLength = pReply->Header.PageLength; + id = 0; // volume id: only one volume for now (vol_ids) + /* The following PageAddress does not make too much sense */ + ConfigRequest->PageAddress = scsi_id | id; + status = read_page2(MPT_FLAGS_KEEP_MEM); + pRVP0 = (RaidVolumePage0_t *) mpiBlkPtr->dataInBufPtr; + if ((status == 0) && (pRVP0->NumPhysDisks > 0)) { + /* We have found a Volume with some physical disks */ + freeMem(); + return scsi_id; + } + } + freeMem(); + return -1; +} + static int __probe_scsi_id(void) { int scsi_id; RaidVolumePage0_t *page; for (scsi_id = 0; scsi_id < 16; scsi_id++) { + printf("Checking for SCSI ID:%d\n", scsi_id); page = read_page(MPI_CONFIG_PAGETYPE_RAID_VOLUME, MPI_CONFIG_ACTION_PAGE_READ_CURRENT, ioc_unit, @@ -349,12 +412,10 @@ return scsi_id; } } - /* nothing found */ return -1; } static int read_page2(uint flags) { - // this is the IssueMptCommand MPIDefaultReply_t *pReply = NULL; int CmdBlkSize; int status = -1; @@ -362,9 +423,8 @@ CmdBlkSize = sizeof(mpiIoctlBlk_t) + ((mpiBlkPtr->dataSgeOffset)*4) + 8; mpiBlkPtr->hdr.iocnum = ioc_unit; mpiBlkPtr->hdr.port = 0; - if (ioctl(m, (unsigned long) MPTCOMMAND, (char *) mpiBlkPtr) != 0) { - perror("IOCTL failed"); + perror("ioctl"); mpt_exit(MPT_EXIT_UNKNOWN); } else { pReply = (MPIDefaultReply_t *) mpiBlkPtr->replyFrameBufPtr; @@ -383,6 +443,7 @@ return status; } +/* This function is only written to get the Volume 0 information */ static void GetVolumeInfo(void) { Config_t *ConfigRequest; ConfigReply_t *pReply = NULL; @@ -392,11 +453,9 @@ uint numBytes; int status; int ii, id; - uint vol_count = 0; int pdisk_cnt = 0; int resync_on = 0; - unsigned bus = 0; - unsigned char tmp; + unsigned bus = id_of_primary_device; numBytes = (sizeof(Config_t) - sizeof(SGE_IO_UNION)) + sizeof(SGESimple64_t); @@ -411,90 +470,44 @@ pReply = (ConfigReply_t *)mpiBlkPtr->replyFrameBufPtr; - /* Populate the Config Request - */ ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_HEADER; ConfigRequest->Function = MPI_FUNCTION_CONFIG; ConfigRequest->MsgContext = -1; ConfigRequest->Header.PageType = MPI_CONFIG_PAGETYPE_RAID_VOLUME; - ConfigRequest->PageAddress = cpu_to_le32((bus << 8) | 0); + // ioc_unit handler + ConfigRequest->Header.PageNumber = ioc_unit; + //orig: ConfigRequest->PageAddress = cpu_to_le32((bus << 8) | 0); + ConfigRequest->PageAddress = bus; status = read_page2(MPT_FLAGS_KEEP_MEM); - printf("Logical Volume Information:\n"); if (status != 0) { - printf("\tUnsupported.\n"); + printf("Logical Volume Information: unsupported\n"); freeMem(); return; } else if (pReply->Header.PageLength == 0) { - printf("\tNone.\n"); + printf("Logical Volume Information: none\n"); freeMem(); return; } mpiBlkPtr->dataInSize = pReply->Header.PageLength * 4; if (allocDataFrame(DATA_DIR_IN)) { - printf("Config: Unable to allocate data buffer."); + mpt_printf("Increase data buffer size"); freeMem(); return; } - ConfigRequest->Action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; ConfigRequest->Header.PageVersion = pReply->Header.PageVersion; ConfigRequest->Header.PageLength = pReply->Header.PageLength; id = 0; // volume id: only one volume for now (vol_ids) - ConfigRequest->PageAddress = cpu_to_le32((bus << 8) | id); + //orig: ConfigRequest->PageAddress = cpu_to_le32((bus << 8) | id); + /* Something is fishy here */ + ConfigRequest->PageAddress = bus | id; status = read_page2(MPT_FLAGS_KEEP_MEM); - - /* Kludge - IO FW 1.1.60 returns IOCSTATUS of GOOD to - * this call resulting in bad information. - * IM FW returns a status of 0x0022 - INVALID PAGE - */ pRVP0 = (RaidVolumePage0_t *) mpiBlkPtr->dataInBufPtr; if ((status == 0) && (pRVP0->NumPhysDisks > 0)){ - vol_count++; - printf("\tID=0x%x, Bus=0x%x, IOC=0x%x, %s(0x%x)", - pRVP0->VolumeID,pRVP0->VolumeBus, pRVP0->VolumeIOC, - VolumeTypes[pRVP0->VolumeType], pRVP0->VolumeType); - if (pRVP0->VolumeType == MPI_RAID_VOL_TYPE_IS) - printf(", Stripe Size=0x%x", pRVP0->StripeSize); - printf(", %d Physical Disks", pRVP0->NumPhysDisks); - printf("\n"); - - printf("\tStatus: "); - tmp = pRVP0->VolumeStatus.Flags; - printf("%s", tmp & MPI_RAIDVOL0_STATUS_FLAG_VOLUME_INACTIVE ? "Not Active" : "Active"); - - printf(", %s", tmp & MPI_RAIDVOL0_STATUS_FLAG_ENABLED ? "Enabled" : "Disabled"); - if (tmp & MPI_RAIDVOL0_STATUS_FLAG_QUIESCED) - printf(", Quiesced Phys Disk IOs"); - - if (tmp & MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS) { - printf(", Resync In Progress"); - resync_on = 1; - } - printf("\n"); - - /* - tmp = (pRVP0->VolumeStatus.State) & 0x03; - printf("\tState: %s\n", raid_status[tmp]); - */ - if (pRVP0->VolumeStatus.State == MPI_RAIDVOL0_STATUS_STATE_OPTIMAL) { - mpt_exit_mask |= MPT_EXIT_VOL_OPTIMAL; - mpt_printf(" OPTIMAL"); - } else if (pRVP0->VolumeStatus.State == - MPI_RAIDVOL0_STATUS_STATE_DEGRADED) { - mpt_exit_mask |= MPT_EXIT_VOL_DEGRADED; - mpt_printf(" DEGRADED"); - } else if (pRVP0->VolumeStatus.State == - MPI_RAIDVOL0_STATUS_STATE_FAILED) { - mpt_exit_mask |= MPT_EXIT_VOL_FAILED; - mpt_printf(" FAILED"); - } else { - mpt_exit_mask |= MPT_EXIT_UNKNOWN; - mpt_printf(" UNKNOWN"); - } - + __print_volume_classic(pRVP0); for (ii = pdisk_cnt; ii < pdisk_cnt + pRVP0->NumPhysDisks; ii++) { disk_num[ii].PhysDiskNum = pRVP0->PhysDisk[ii].PhysDiskNum; disk_num[ii].PhysDiskMap = pRVP0->PhysDisk[ii].PhysDiskMap; @@ -506,13 +519,10 @@ if (pdisk_cnt > 0) { GetPhysDiskInfo((RaidVol0PhysDisk_t *) &disk_num, pdisk_cnt); } - if (resync_on) + //if (resync_on) { GetResyncPercentage((RaidVol0PhysDisk_t *) &disk_num, (unsigned char *) &pdisk_vol, pdisk_cnt); - if (vol_count == 0) { - printf("\tNo Logical Volumes Found.\n"); - } - + //} return; } @@ -522,9 +532,6 @@ uint numBytes; int status; int ii; - unsigned char tmp; - - printf("\tPhysical Disk Information:\n"); numBytes = (sizeof(Config_t) - sizeof(SGE_IO_UNION)) + sizeof (SGESimple64_t); if ((mpiBlkPtr = allocIoctlBlk(numBytes)) == NULL) @@ -540,13 +547,15 @@ ConfigRequest->Function = MPI_FUNCTION_CONFIG; ConfigRequest->MsgContext = -1; ConfigRequest->Header.PageType = MPI_CONFIG_PAGETYPE_RAID_PHYSDISK; + // ioc_unit handler + ConfigRequest->Header.PageNumber = ioc_unit; ConfigRequest->PageAddress = cpu_to_le32((uint)pDisk[0].PhysDiskNum); status = read_page2(MPT_FLAGS_KEEP_MEM); if ((status == 0) && (pReply->Header.PageLength > 0)) { mpiBlkPtr->dataInSize = pReply->Header.PageLength * 4; if (allocDataFrame(DATA_DIR_IN)) { - printf ("Config: Unable to allocate data buffer."); + mpt_printf("Increase data buffer size"); freeMem(); return; } @@ -562,28 +571,16 @@ if (status == 0) { RaidPhysDiskPage0_t *pRPD0 = (RaidPhysDiskPage0_t *) mpiBlkPtr->dataInBufPtr; + __print_physdisk_classic(pRPD0); - printf("\t\tPhys Disk Num=%d at ID=%d", - pRPD0->PhysDiskNum, pRPD0->PhysDiskID); - tmp = pRPD0->PhysDiskStatus.Flags; - if (tmp & MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC) - printf(", Out of Sync"); - if (tmp & MPI_PHYSDISK0_STATUS_FLAG_QUIESCED) - printf(", Quiesced"); - tmp = pRPD0->PhysDiskStatus.State; - if (tmp & MPI_PHYSDISK0_STATUS_ONLINE) - printf(", Online"); - if (tmp & MPI_PHYSDISK0_STATUS_MISSING) - printf(", Missing"); - if (tmp & MPI_PHYSDISK0_STATUS_NOT_COMPATIBLE) - printf(", Not Compatible"); - if (tmp & MPI_PHYSDISK0_STATUS_FAILED) - printf(", Failed"); - if (tmp & MPI_PHYSDISK0_STATUS_INITIALIZING) - printf(", Initializing"); - if (tmp & MPI_PHYSDISK0_STATUS_FAILED_REQUESTED) - printf(", Failed Requested"); + /* + printf("S.M.A.R.T and ASC/Q information\n"); + printf("ASC = 0x%02x\n", pRPD0->ErrorData.ErrorASC); + printf("ASCQ = 0x%02x\n", pRPD0->ErrorData.ErrorASCQ); + printf("Smart ASC = 0x%02x\n", pRPD0->ErrorData.SmartASC); + printf("Smart ASCQ = 0x%02x\n", pRPD0->ErrorData.SmartASCQ); printf("\n"); + */ } else printf("\t\tNot Available.\n"); } @@ -616,7 +613,7 @@ ConfigRequest->MsgContext = -1; ConfigRequest->Header.PageNumber = 5; ConfigRequest->Header.PageType = MPI_CONFIG_PAGETYPE_IOC; - ConfigRequest->PageAddress = cpu_to_le32(0); + ConfigRequest->PageAddress = 0; status = read_page2(MPT_FLAGS_KEEP_MEM); printf("Hot Spare Information:\n"); @@ -632,7 +629,7 @@ mpiBlkPtr->dataInSize = pReply->Header.PageLength * 4; if (allocDataFrame(DATA_DIR_IN)) { - printf ("Config: Unable to allocate data buffer."); + mpt_printf("Increase data buffer size"); freeMem(); return; } @@ -678,7 +675,7 @@ if ((status == 0) && (pReply->Header.PageLength > 0)) { mpiBlkPtr->dataInSize = pReply->Header.PageLength * 4; if (allocDataFrame(DATA_DIR_IN)) { - printf ("Config: Unable to allocate data buffer."); + mpt_printf("Increase data buffer size"); freeMem(); return; } @@ -778,34 +775,7 @@ return; } -static void print_information(void) { - RaidVolumePage0_t *page; - RaidPhysDiskPage0_t *phys; - int i; - - page = read_page(MPI_CONFIG_PAGETYPE_RAID_VOLUME, - MPI_CONFIG_ACTION_PAGE_READ_CURRENT, - ioc_unit, - id_of_primary_device, - MPI_RAIDVOLPAGE0_PAGEVERSION); - if (0 == page->NumPhysDisks) { - if (probe_id > 0) { - id_of_primary_device = __probe_scsi_id(); - if (-1 == id_of_primary_device) { - mpt_printf("Nothing found, contact the author\n"); - mpt_exit(MPT_EXIT_UNKNOWN); - } else { - mpt_printf("Found SCSI id=%d, use ''mpt-status " - "-i %d`` to get more information.\n", - id_of_primary_device, - id_of_primary_device); - mpt_exit(MPT_EXIT_OKAY); - } - } else { - mpt_printf("%s\n", wrong_scsi_id); - mpt_exit(MPT_EXIT_UNKNOWN); - } - } +static void __print_volume_classic(RaidVolumePage0_t *page) { if (1 == print_status_only) { mpt_printf("vol_id:%d", page->VolumeID); } else { @@ -857,90 +827,127 @@ } mpt_printf("\n"); +} + +static void __print_physdisk_classic(RaidPhysDiskPage0_t *phys) { + int ret; + char *vendor = NULL; + char *productid = NULL; + char *rev = NULL; + + ret = asprintf(&vendor, (void *)phys->InquiryData.VendorID); + if (ret > 0) vendor[ret-1] = '\0'; + ret = asprintf(&productid, (void *)phys->InquiryData.ProductID); + if (ret > 0) productid[ret-1] = '\0'; + ret = asprintf(&rev, (void *)phys->InquiryData.ProductRevLevel); + if (ret > 0) rev[ret-1] = '\0'; + + if (1 == print_status_only) { + printf("phys_id:%d", phys->PhysDiskNum); + } else { + printf("ioc:%d phys_id:%d scsi_id:%d vendor:%s " + "product_id:%s revision:%s size(GB):%d", + phys->PhysDiskIOC, + phys->PhysDiskNum, + phys->PhysDiskID, + vendor, + productid, + rev, + phys->MaxLBA / (2 * 1024 * 1024)); + printf(" state:"); + } + if (phys->PhysDiskStatus.State == + MPI_PHYSDISK0_STATUS_ONLINE) { + mpt_exit_mask |= MPT_EXIT_OKAY; + printf(" ONLINE"); + } else if (phys->PhysDiskStatus.State == + MPI_PHYSDISK0_STATUS_MISSING) { + mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; + printf(" MISSING"); + } else if (phys->PhysDiskStatus.State == + MPI_PHYSDISK0_STATUS_NOT_COMPATIBLE) { + mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; + printf(" NOT_COMPATIBLE"); + } else if (phys->PhysDiskStatus.State == + MPI_PHYSDISK0_STATUS_FAILED) { + mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; + printf(" FAILED"); + } else if (phys->PhysDiskStatus.State == + MPI_PHYSDISK0_STATUS_INITIALIZING) { + mpt_exit_mask |= MPT_EXIT_PHYSDISK_WARN; + printf(" INITIALIZING"); + } else if (phys->PhysDiskStatus.State == + MPI_PHYSDISK0_STATUS_OFFLINE_REQUESTED) { + mpt_exit_mask |= MPT_EXIT_PHYSDISK_WARN; + printf(" OFFLINE_REQUESTED"); + } else if (phys->PhysDiskStatus.State == + MPI_PHYSDISK0_STATUS_FAILED_REQUESTED) { + mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; + printf(" FAILED_REQUESTED"); + } else if (phys->PhysDiskStatus.State == + MPI_PHYSDISK0_STATUS_OTHER_OFFLINE) { + mpt_exit_mask |= MPT_EXIT_PHYSDISK_WARN; + printf(" OTHER_OFFLINE"); + } else { + mpt_exit_mask |= MPT_EXIT_UNKNOWN; + mpt_printf(" UNKNOWN"); + } + if (1 != print_status_only) { + mpt_printf(" flags:"); + if (phys->PhysDiskStatus.Flags) { + if (phys->PhysDiskStatus.Flags & + MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC) + mpt_printf(" OUT_OF_SYNC"); + if (phys->PhysDiskStatus.Flags & + MPI_PHYSDISK0_STATUS_FLAG_QUIESCED) + mpt_printf(" QUIESCED"); + } else { + mpt_printf(" NONE"); + } + } + mpt_printf("\n"); + free(vendor); + free(productid); + free(rev); +} + +static void print_information(void) { + RaidVolumePage0_t *page; + RaidPhysDiskPage0_t *phys; + int i; + + page = read_page(MPI_CONFIG_PAGETYPE_RAID_VOLUME, + MPI_CONFIG_ACTION_PAGE_READ_CURRENT, + ioc_unit, + id_of_primary_device, + MPI_RAIDVOLPAGE0_PAGEVERSION); + if (0 == page->NumPhysDisks) { + if (probe_id > 0) { + id_of_primary_device = __probe_scsi_id(); + if (-1 == id_of_primary_device) { + mpt_printf("Nothing found, contact the author\n"); + mpt_exit(MPT_EXIT_UNKNOWN); + } else { + mpt_printf("Found SCSI id=%d, use ''mpt-status " + "-i %d`` to get more information.\n", + id_of_primary_device, + id_of_primary_device); + mpt_exit(MPT_EXIT_OKAY); + } + } else { + mpt_printf("%s\n", wrong_scsi_id); + mpt_exit(MPT_EXIT_UNKNOWN); + } + } + __print_volume_classic(page); /* go through all physical disk of a found array */ - for (i = 0; i < page->NumPhysDisks; ++i) { - int ret; - char *vendor = NULL; - char *productid = NULL; - char *rev = NULL; + for (i = 1; i < page->NumPhysDisks; ++i) { phys = read_page(MPI_CONFIG_PAGETYPE_RAID_PHYSDISK, MPI_CONFIG_ACTION_PAGE_READ_CURRENT, ioc_unit, page->PhysDisk[i].PhysDiskNum, MPI_RAIDPHYSDISKPAGE0_PAGEVERSION); - ret = asprintf(&vendor, (void *)phys->InquiryData.VendorID); - if (ret > 0) vendor[ret-1] = '\0'; - ret = asprintf(&productid, (void *)phys->InquiryData.ProductID); - if (ret > 0) productid[ret-1] = '\0'; - ret = asprintf(&rev, (void *)phys->InquiryData.ProductRevLevel); - if (ret > 0) rev[ret-1] = '\0'; - if (1 == print_status_only) { - printf("phys_id:%d", phys->PhysDiskNum); - } else { - printf("ioc:%d phys_id:%d scsi_id:%d vendor:%s " - "product_id:%s revision:%s size(GB):%d", - phys->PhysDiskIOC, - phys->PhysDiskNum, - phys->PhysDiskID, - vendor, - productid, - rev, - phys->MaxLBA / (2 * 1024 * 1024)); - printf(" state:"); - } - if (phys->PhysDiskStatus.State == - MPI_PHYSDISK0_STATUS_ONLINE) { - mpt_exit_mask |= MPT_EXIT_OKAY; - printf(" ONLINE"); - } else if (phys->PhysDiskStatus.State == - MPI_PHYSDISK0_STATUS_MISSING) { - mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; - printf(" MISSING"); - } else if (phys->PhysDiskStatus.State == - MPI_PHYSDISK0_STATUS_NOT_COMPATIBLE) { - mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; - printf(" NOT_COMPATIBLE"); - } else if (phys->PhysDiskStatus.State == - MPI_PHYSDISK0_STATUS_FAILED) { - mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; - printf(" FAILED"); - } else if (phys->PhysDiskStatus.State == - MPI_PHYSDISK0_STATUS_INITIALIZING) { - mpt_exit_mask |= MPT_EXIT_PHYSDISK_WARN; - printf(" INITIALIZING"); - } else if (phys->PhysDiskStatus.State == - MPI_PHYSDISK0_STATUS_OFFLINE_REQUESTED) { - mpt_exit_mask |= MPT_EXIT_PHYSDISK_WARN; - printf(" OFFLINE_REQUESTED"); - } else if (phys->PhysDiskStatus.State == - MPI_PHYSDISK0_STATUS_FAILED_REQUESTED) { - mpt_exit_mask |= MPT_EXIT_PHYSDISK_ERROR; - printf(" FAILED_REQUESTED"); - } else if (phys->PhysDiskStatus.State == - MPI_PHYSDISK0_STATUS_OTHER_OFFLINE) { - mpt_exit_mask |= MPT_EXIT_PHYSDISK_WARN; - printf(" OTHER_OFFLINE"); - } else { - mpt_exit_mask |= MPT_EXIT_UNKNOWN; - mpt_printf(" UNKNOWN"); - } - if (1 != print_status_only) { - mpt_printf(" flags:"); - if (phys->PhysDiskStatus.Flags) { - if (phys->PhysDiskStatus.Flags & - MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC) - mpt_printf(" OUT_OF_SYNC"); - if (phys->PhysDiskStatus.Flags & - MPI_PHYSDISK0_STATUS_FLAG_QUIESCED) - mpt_printf(" QUIESCED"); - } else { - mpt_printf(" NONE"); - } - } - mpt_printf("\n"); - free(vendor); - free(productid); - free(rev); + __print_physdisk_classic(phys); } } @@ -1029,8 +1036,11 @@ do_init(); #ifdef NEWSTYLE __check_endianess(); + if (probe_id > 0) { + id_of_primary_device = __probe_scsi_id2(); + } GetVolumeInfo(); - GetHotSpareInfo(); + //GetHotSpareInfo(); #else print_information(); #endif diff -Nur mpt-status-1.2.0-RC4/mpt-status.h mpt-status-1.2.0-RC5/mpt-status.h --- mpt-status-1.2.0-RC4/mpt-status.h 2006-04-23 22:12:00.000000000 +0200 +++ mpt-status-1.2.0-RC5/mpt-status.h 2006-04-25 08:41:20.000000000 +0200 @@ -26,7 +26,7 @@ #include "mptctl.h" #endif // SANITIZED_KERNEL_HEADERS -#define VERSION "1.2.0-RC4" +#define VERSION "1.2.0-RC5" #define BIG 1024 #define REALLYBIG 10240 @@ -59,13 +59,6 @@ "them on a different scsi_id. To get your SCSI id, run:\n\n" " mpt-status -p\n"; -typedef struct _test_endianness { - union { - u32 foo; - u8 bar[4]; - } u; -} test_endianess_t; - typedef struct mpt_ioctl_command mpiIoctlBlk_t; #endif /* End of mpt-status.h */