Codebase list cciss-vol-status / 5798c87
Imported Upstream version 1.09 Christian Hofstaedtler 12 years ago
4 changed file(s) with 51 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
8888 * Factor out format_phys_drive_location()
8989 * Report S.M.A.R.T. predictive failures
9090
91 Changes since 1.07:
92
93 2010/12/02 09:35:54
94 * Added examples to man page of S.M.A.R.T predictive failure reporting.
95 * make it compile on freebsd
96 * Fix a file descriptor leak
97
13201320 /* Given a IDENTIFY LOGICAL DRIVE data, find the matching /dev/sd* */
13211321 /* note. "Matching" means, the one with the same serial number. */
13221322 static char *unknown_scsi_device = "/dev/???";
1323 static void find_scsi_device_node(char *unique_volume_id, char **scsi_device_node)
1323 static void find_scsi_device_node(unsigned char *unique_volume_id, char **scsi_device_node)
13241324 {
13251325 struct dirent **namelist = NULL;
13261326 int nents, rc, i, fd;
13991399 int tolerance_type = -1;
14001400 char *scsi_device_node;
14011401
1402 memset(&drive_id, 0, sizeof(drive_id));
14021403 rc = msa1000_passthru_ioctl(fd, ID_LOGICAL_DRIVE, &drive_id,
14031404 sizeof(drive_id), logical_drive);
14041405 if (rc == 0)
14051406 tolerance_type = drive_id.tolerance_type;
14061407
1408 memset(&ldstatus, 0, sizeof(ldstatus));
14071409 rc = msa1000_passthru_ioctl(fd, ID_LSTATUS, &ldstatus,
14081410 sizeof(ldstatus), logical_drive);
14091411 if (rc < 0) {
14521454 int status;
14531455
14541456 memset(&cmd, 0, sizeof(cmd));
1457 memset(cdb, 0, sizeof(cdb));
14551458 cdb[0] = 0x12; /* inquiry */
14561459 cdb[1] = inquiry_page ? 1 : 0;
14571460 cdb[2] = inquiry_page;
15541557 int ctlrtype;
15551558
15561559 memset(&cciss_to_bmic, 0, sizeof(cciss_to_bmic));
1557 memset(&controller_lun_list, 0, sizeof(controller_lun_list));
1558 num_controllers = 0;
1560 memset(lunlist, 0, sizeof(lunlist));
1561 memset(physlunlist, 0, sizeof(physlunlist));
1562 memset(missed_drive, 0, sizeof(missed_drive));
15591563
15601564 /* Do report LOGICAL LUNs to get a list of all logical drives */
15611565 rc = do_report_luns(file, fd, &luncount, (unsigned char *) lunlist, 0);
18431847 unsigned char lunaddr[], unsigned char bus,
18441848 sense_bus_param *bus_param)
18451849 {
1846 memset(c, 0, sizeof(c));
1850 memset(c, 0, sizeof(*c));
18471851 memcpy(&c->LUN_info, lunaddr, 8);
18481852 c->Request.CDBLen = 10;
18491853 c->Request.Type.Type = TYPE_CMD;
18601864 c->buf = (unsigned char *) bus_param;
18611865 }
18621866
1867 static void print_error_info(IOCTL_Command_struct *c)
1868 {
1869 int i;
1870 printf("Error info:\n");
1871 printf("CDB = ");
1872 for (i = 0; i < 16; i++)
1873 printf("%02x ", c->Request.CDB[i]);
1874 printf("\n");
1875 printf("CommandStatus = %d\n", c->error_info.CommandStatus);
1876 printf("ScsiStatus = %d\n", c->error_info.ScsiStatus);
1877 printf("SenseLen = %d\n", c->error_info.SenseLen);
1878 printf("ResidualCnt = %d\n", c->error_info.ResidualCnt);
1879 printf("SenseInfo = ");
1880 if (c->error_info.SenseLen > SENSEINFOBYTES)
1881 c->error_info.SenseLen = SENSEINFOBYTES;
1882 for (i = 0; i < c->error_info.SenseLen; i++)
1883 printf("%02x ", c->error_info.SenseInfo[i]);
1884 printf("\n\n");
1885 }
1886
18631887 int do_sense_bus_parameters(char *file, int fd, unsigned char lunaddr[],
18641888 int ctlr, unsigned char bus, sense_bus_param *bus_param)
18651889 {
18831907 /* This happens when we query busses that don't exist. */
18841908 if (c.error_info.CommandStatus == 4) /* 4 means "invalid command" */
18851909 return -1;
1910
1911 if (c.error_info.CommandStatus == 1)
1912 print_error_info(&c);
18861913
18871914 if (c.error_info.CommandStatus != 0) {
18881915 fprintf(stderr, "Error getting status for %s "
19792006
19802007 /* Construct command to get logical drive status */
19812008 memset(&c, 0, sizeof(c));
2009 memset(&ldstatus, 0, sizeof(ldstatus));
19822010 memcpy(&c.LUN_info, cciss_to_bmic.addr[volume_number].controller_lun, 8);
19832011 c.Request.CDBLen = 10;
19842012 c.Request.Type.Type = TYPE_CMD;
20492077 return bmic_next_disk_bits((uint8_t *) id->big_drive_present_map, 128, bmic_drive_number);
20502078 else
20512079 return bmic_next_disk_bits((uint8_t *) &id->drive_present_bit_map, 32, bmic_drive_number);
2052 uint16_t big_drive_present_bit_map[8];
2053 uint16_t big_ext_drive_map[8];
2054 uint16_t big_non_disk_map[8];
20552080 }
20562081
20572082 static inline int bmic_next_ext_phy_disk(struct identify_controller *id, int bmic_drive_number)
20712096 }
20722097
20732098 static void check_physical_drive(char *file, int fd,
2074 char *controller_lun, struct identify_controller *id,
2099 unsigned char *controller_lun, struct identify_controller *id,
20752100 int bmic_drive_number)
20762101 {
20772102 int rc = 0, bus, target;
21412166 static void check_physical_drives(char *file, int fd)
21422167 {
21432168 int i;
2144 unsigned char *controller_lun;
21452169
21462170 if (!check_smart_data)
21472171 return;
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.64 for cciss_vol_status 1.08.
2 # Generated by GNU Autoconf 2.64 for cciss_vol_status 1.09.
33 #
44 # Report bugs to <smcameron@users.sourceforge.net>.
55 #
548548 # Identity of this package.
549549 PACKAGE_NAME='cciss_vol_status'
550550 PACKAGE_TARNAME='cciss_vol_status'
551 PACKAGE_VERSION='1.08'
552 PACKAGE_STRING='cciss_vol_status 1.08'
551 PACKAGE_VERSION='1.09'
552 PACKAGE_STRING='cciss_vol_status 1.09'
553553 PACKAGE_BUGREPORT='smcameron@users.sourceforge.net'
554554 PACKAGE_URL=''
555555
12291229 # Omit some internal or obsolete options to make the list less imposing.
12301230 # This message is too long to be a string in the A/UX 3.1 sh.
12311231 cat <<_ACEOF
1232 \`configure' configures cciss_vol_status 1.08 to adapt to many kinds of systems.
1232 \`configure' configures cciss_vol_status 1.09 to adapt to many kinds of systems.
12331233
12341234 Usage: $0 [OPTION]... [VAR=VALUE]...
12351235
12961296
12971297 if test -n "$ac_init_help"; then
12981298 case $ac_init_help in
1299 short | recursive ) echo "Configuration of cciss_vol_status 1.08:";;
1299 short | recursive ) echo "Configuration of cciss_vol_status 1.09:";;
13001300 esac
13011301 cat <<\_ACEOF
13021302
13831383 test -n "$ac_init_help" && exit $ac_status
13841384 if $ac_init_version; then
13851385 cat <<\_ACEOF
1386 cciss_vol_status configure 1.08
1386 cciss_vol_status configure 1.09
13871387 generated by GNU Autoconf 2.64
13881388
13891389 Copyright (C) 2009 Free Software Foundation, Inc.
17541754 This file contains any messages produced by compilers while
17551755 running configure, to aid debugging if configure makes a mistake.
17561756
1757 It was created by cciss_vol_status $as_me 1.08, which was
1757 It was created by cciss_vol_status $as_me 1.09, which was
17581758 generated by GNU Autoconf 2.64. Invocation command line was
17591759
17601760 $ $0 $@
25662566
25672567 # Define the identity of the package.
25682568 PACKAGE='cciss_vol_status'
2569 VERSION='1.08'
2569 VERSION='1.09'
25702570
25712571
25722572 cat >>confdefs.h <<_ACEOF
47554755 # report actual input values of CONFIG_FILES etc. instead of their
47564756 # values after options handling.
47574757 ac_log="
4758 This file was extended by cciss_vol_status $as_me 1.08, which was
4758 This file was extended by cciss_vol_status $as_me 1.09, which was
47594759 generated by GNU Autoconf 2.64. Invocation command line was
47604760
47614761 CONFIG_FILES = $CONFIG_FILES
48194819 _ACEOF
48204820 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
48214821 ac_cs_version="\\
4822 cciss_vol_status config.status 1.08
4822 cciss_vol_status config.status 1.09
48234823 configured by $0, generated by GNU Autoconf 2.64,
48244824 with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
48254825
11 # Process this file with autoconf to produce a configure script.
22
33 AC_PREREQ(2.59)
4 AC_INIT(cciss_vol_status, 1.08, smcameron@users.sourceforge.net)
4 AC_INIT(cciss_vol_status, 1.09, smcameron@users.sourceforge.net)
55 AC_CONFIG_SRCDIR([cciss_vol_status.c])
66 AC_CONFIG_HEADER([config.h])
77