[Iprdd-commit] iprutils Makefile, 1.26, 1.27 iprconfig.c, 1.136, 1.137 iprconfig.h, 1.51, 1.52 iprd
Brought to you by:
brking
Update of /cvsroot/iprdd/iprutils In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv8442/iprutils Modified Files: Makefile iprconfig.c iprconfig.h iprdump.c iprinit.c iprlib.c iprlib.h iprupdate.c version.mk Log Message: A few more active/active updates and fixes, also support new kevent paths Index: iprlib.c =================================================================== RCS file: /cvsroot/iprdd/iprutils/iprlib.c,v retrieving revision 1.121 retrieving revision 1.122 diff -u -d -r1.121 -r1.122 --- iprlib.c 23 Oct 2008 17:11:20 -0000 1.121 +++ iprlib.c 20 Nov 2008 01:20:20 -0000 1.122 @@ -5087,6 +5087,8 @@ if (page24->dual_adapter_af == ENABLE_DUAL_IOA_ACTIVE_ACTIVE) { ioa->dual_raid_support = 1; ioa->asymmetric_access_enabled = 1; + } else { + ioa->asymmetric_access_enabled = 0; } } } @@ -6148,6 +6150,7 @@ /* FIXME - preferred_primary and active_active may change at the same * time. This code may need to change. */ + if (attr->preferred_primary != old_attr.preferred_primary) if (ipr_change_multi_adapter_assignment(ioa, attr->preferred_primary, IPR_PRESERVE_ASYMMETRIC_STATE)) return -EIO; @@ -6171,15 +6174,17 @@ if (attr->active_active) { if (ipr_set_active_active_mode(ioa)) return -EIO; + if (save) + ipr_save_ioa_attr(ioa, IPR_DUAL_ADAPTER_ACTIVE_ACTIVE, temp, 1); } else { + if (save) + ipr_save_ioa_attr(ioa, IPR_DUAL_ADAPTER_ACTIVE_ACTIVE, temp, 1); ipr_reset_adapter(ioa); if (ipr_change_multi_adapter_assignment(ioa, attr->preferred_primary, attr->active_active)) return -EIO; } - if (save) - ipr_save_ioa_attr(ioa, IPR_DUAL_ADAPTER_ACTIVE_ACTIVE, temp, 1); } get_dual_ioa_state(ioa); /* for preferred_primary */ @@ -8122,7 +8127,7 @@ } /** - * scsi_host_kevent - Start array protection for an array + * scsi_host_kevent - * @buf: data buffer * @func: funtion pointer * Index: iprconfig.c =================================================================== RCS file: /cvsroot/iprdd/iprutils/iprconfig.c,v retrieving revision 1.136 retrieving revision 1.137 diff -u -d -r1.136 -r1.137 --- iprconfig.c 23 Oct 2008 17:11:20 -0000 1.136 +++ iprconfig.c 20 Nov 2008 01:20:20 -0000 1.137 @@ -3551,7 +3551,7 @@ rc = is_array_in_use(ioa, cur_raid_cmd->array_id); if (rc != 0) { /* "Start Parity Protection failed." */ - rc = 19; + rc = RC_19_Create_Fail; syslog(LOG_ERR, _("Devices may have changed state. Command cancelled," " please issue commands again if RAID still desired %s.\n"), ioa->ioa.gen_name); @@ -3675,12 +3675,12 @@ if (done_bad) /* Start Parity Protection failed. */ - return 19; + return RC_19_Create_Fail; check_current_config(false); /* Start Parity Protection completed successfully */ - return 18; + return RC_18_Array_Created; } not_done = 0; sleep(1); @@ -5068,7 +5068,7 @@ start_row = i_con->y + 2; - num_menu_items = ipr_debug ? 3 : 2; + num_menu_items = 3; menu_item = malloc(sizeof(ITEM **) * (num_menu_items + 1)); userptr = malloc(sizeof(int) * num_menu_items); @@ -5084,13 +5084,11 @@ set_item_userptr(menu_item[menu_index], (char *)&userptr[menu_index]); - if (ipr_debug) { - menu_index++; - menu_item[menu_index] = new_item("Not Set",""); - userptr[menu_index] = 2; - set_item_userptr(menu_item[menu_index], - (char *)&userptr[menu_index]); - } + menu_index++; + menu_item[menu_index] = new_item("Not Set",""); + userptr[menu_index] = 2; + set_item_userptr(menu_item[menu_index], + (char *)&userptr[menu_index]); menu_index++; menu_item[menu_index] = NULL; @@ -5102,7 +5100,7 @@ sprintf(i_con->field_data, "Optimized"); else if (*new_state == IPR_ACTIVE_NON_OPTIMIZED) sprintf(i_con->field_data, "Non-Optimized"); - else if (ipr_debug && *new_state == IPR_ACTIVE_STANDBY) + else if (*new_state == IPR_ACTIVE_STANDBY) sprintf(i_con->field_data, "Not Set"); /* only issue the command if the state selection changed */ if (acd->dev->array_rcd->saved_asym_access_state != *new_state) @@ -5136,9 +5134,8 @@ * Returns: * 0 if success / non-zero on failure **/ -int configure_asym_access(i_container *i_con) +int configure_asym_access(struct array_cmd_data *acd) { - struct array_cmd_data *acd; i_container *new_i_con, *i_con_head_saved; int header_lines = 0; char pref_str[20]; @@ -5150,8 +5147,6 @@ i_con_head_saved = i_con_head; i_con_head = new_i_con = NULL; - acd = i_con->data; - body = body_init(n_change_array_asym_access.header, &header_lines); sprintf(buffer, "Array: %s", acd->dev->dev_name); body = add_line_to_body(body, buffer, NULL); @@ -5195,11 +5190,8 @@ state = IPR_ACTIVE_OPTIMIZED; else if (!strncmp(new_i_con->field_data, "Non-Optimized", 8)) state = IPR_ACTIVE_NON_OPTIMIZED; - else if (ipr_debug) - state = IPR_ACTIVE_STANDBY; else - /* We should never get here. */ - break; + state = IPR_ACTIVE_STANDBY; acd->dev->array_rcd->issue_cmd = 1; acd->dev->array_rcd->saved_asym_access_state = state; @@ -5229,7 +5221,7 @@ struct screen_output *s_out; int found = 0; int toggle = 1; - i_container *i_con, *temp_i_con; + i_container *i_con; char *input; int rc; struct array_cmd_data *acd; @@ -5240,7 +5232,7 @@ do { n_asym_access.body = buffer[toggle&1]; /* display array selection screen */ - s_out = screen_driver(&n_asym_access, header_lines, i_con); + s_out = screen_driver(&n_asym_access, header_lines, NULL); rc = s_out->rc; free(s_out); toggle++; @@ -5251,9 +5243,9 @@ found = 0; /* do one at a time */ - for_each_icon(temp_i_con) { - acd = temp_i_con->data; - input = temp_i_con->field_data; + for_each_icon(i_con) { + acd = i_con->data; + input = i_con->field_data; if (acd && strcmp(input, "1") == 0) { found++; @@ -5263,7 +5255,7 @@ if (found) { /* Go to asymmetric access selection screen */ - rc = configure_asym_access(temp_i_con); + rc = configure_asym_access(acd); /* Done on success or exit */ if (rc == RC_SUCCESS || rc & EXIT_FLAG) @@ -5275,7 +5267,6 @@ s_status.index = INVALID_OPTION_STATUS; } - check_current_config(false); return rc; } @@ -5301,11 +5292,13 @@ /* make sure the i_con list is empty */ i_con = free_i_con(i_con); + check_current_config(false); + rc = RC_SUCCESS; body_init_status(buffer, n_asym_access.header, &header_lines); - for_each_ioa(ioa) { + for_each_primary_ioa(ioa) { if (!ioa->asymmetric_access || !ioa->asymmetric_access_enabled) continue; for_each_vset(ioa, vset) { @@ -12196,7 +12189,11 @@ if (rc) return rc; - return raid_start_complete(); + rc = raid_start_complete(); + if (rc == RC_18_Array_Created) + return 0; + else + return -EIO; } /** @@ -15352,6 +15349,13 @@ return -EINVAL; } + /* Check that the adapter is a primary adapter. */ + if (vset->ioa->is_secondary) { + ioa_err(vset->ioa, "Asymmetric access commands must be issued " + "for arrays on the primary IOA"); + return -EINVAL; + } + /* Check that asymmetric access is supported by the adapter. */ if (!vset->ioa->asymmetric_access) { ioa_err(vset->ioa, "Asymmetric access is not supported."); Index: Makefile =================================================================== RCS file: /cvsroot/iprdd/iprutils/Makefile,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- Makefile 7 Dec 2005 23:27:50 -0000 1.26 +++ Makefile 20 Nov 2008 01:20:20 -0000 1.27 @@ -4,7 +4,7 @@ # materials are made available under the terms of the # Common Public License v1.0 which accompanies this distribution. -INCLUDEDIR = -I. +INCLUDEDIR = -I. -I/usr/include/ncurses CC = gcc include version.mk Index: iprupdate.c =================================================================== RCS file: /cvsroot/iprdd/iprutils/iprupdate.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- iprupdate.c 5 Jan 2006 20:20:48 -0000 1.22 +++ iprupdate.c 20 Nov 2008 01:20:20 -0000 1.23 @@ -1,7 +1,7 @@ /** * IBM IPR adapter microcode update utility * - * (C) Copyright 2000, 2004 + * (C) Copyright 2000, 2008 * International Business Machines Corporation and others. * All Rights Reserved. This program and the accompanying * materials are made available under the terms of the @@ -182,9 +182,11 @@ { polling_mode = 0; - if (!strncmp(buf, "change@/class/scsi_host", 23)) + if (!strncmp(buf, "change@/class/scsi_host", 23) || + (!strncmp(buf, "change@/devices/pci", 19) && strstr(buf, "scsi_host"))) scsi_host_kevent(buf, update_ioa); - else if (!strncmp(buf, "add@/class/scsi_generic", 23)) + else if (!strncmp(buf, "add@/class/scsi_generic", 23) || + (!strncmp(buf, "add@/devices/pci", 16) && strstr(buf, "scsi_generic"))) scsi_dev_kevent(buf, find_gen_dev, update_disk_fw); else if (!strncmp(buf, "add@/block/sd", 13)) scsi_dev_kevent(buf, find_blk_dev, update_disk_fw); Index: iprconfig.h =================================================================== RCS file: /cvsroot/iprdd/iprutils/iprconfig.h,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- iprconfig.h 23 Oct 2008 17:11:20 -0000 1.51 +++ iprconfig.h 20 Nov 2008 01:20:20 -0000 1.52 @@ -296,6 +296,11 @@ .header = { __("There are no arrays eligible for the selected operation " "due to one or more of the following reasons:\n\n"), + __("o Active/Active mode is not enabled on the IOAs.\n"), + __("o An IOA needs updated microcode in order to support " + "active/active configurations.\n"), + __("o None of the disk arrays in the system are capable of " + "changing asymmetric access attributes.\n"), __("o There are no disk arrays in the system.\n"), __("o An IOA is in a condition that makes the disks attached to " "it read/write protected. Examine the kernel messages log " @@ -304,10 +309,6 @@ "code to correct the problem, if necessary.\n"), __("o Not all disks attached to an advanced function IOA have " "reported to the system. Retry the operation.\n"), - __("o None of the disk arrays in the system are capable of " - "changing asymmetric access attributes.\n"), - __("o An IOA needs updated microcode in order to support " - "active/active configurations.\n"), "" } }; Index: version.mk =================================================================== RCS file: /cvsroot/iprdd/iprutils/version.mk,v retrieving revision 1.71 retrieving revision 1.72 diff -u -d -r1.71 -r1.72 --- version.mk 23 Oct 2008 17:11:20 -0000 1.71 +++ version.mk 20 Nov 2008 01:20:20 -0000 1.72 @@ -1,4 +1,4 @@ -# (C) Copyright 2000, 2001 +# (C) Copyright 2000, 2008 # International Business Machines Corporation and others. # All Rights Reserved. This program and the accompanying # materials are made available under the terms of the @@ -6,9 +6,9 @@ IPR_MAJOR_RELEASE=2 IPR_MINOR_RELEASE=2 -IPR_FIX_LEVEL=12 +IPR_FIX_LEVEL=13 IPR_RELEASE=1 -IPR_FIX_DATE=(October 23, 2008) +IPR_FIX_DATE=(November 17, 2008) IPR_VERSION_STR=$(IPR_MAJOR_RELEASE).$(IPR_MINOR_RELEASE).$(IPR_FIX_LEVEL) $(IPR_FIX_DATE) Index: iprinit.c =================================================================== RCS file: /cvsroot/iprdd/iprutils/iprinit.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- iprinit.c 7 Mar 2005 17:20:16 -0000 1.21 +++ iprinit.c 20 Nov 2008 01:20:20 -0000 1.22 @@ -1,7 +1,7 @@ /** * IBM IPR adapter initialization utility * - * (C) Copyright 2004 + * (C) Copyright 2004, 2008 * International Business Machines Corporation and others. * All Rights Reserved. This program and the accompanying * materials are made available under the terms of the @@ -41,9 +41,11 @@ { polling_mode = 0; - if (!strncmp(buf, "change@/class/scsi_host", 23)) + if (!strncmp(buf, "change@/class/scsi_host", 23) || + (!strncmp(buf, "change@/devices/pci", 19) && strstr(buf, "scsi_host"))) scsi_host_kevent(buf, ipr_init_ioa); - else if (!strncmp(buf, "add@/class/scsi_generic", 23)) + else if (!strncmp(buf, "add@/class/scsi_generic", 23) || + (!strncmp(buf, "add@/devices/pci", 16) && strstr(buf, "scsi_generic"))) scsi_dev_kevent(buf, find_gen_dev, ipr_init_dev); else if (!strncmp(buf, "add@/block/sd", 13)) scsi_dev_kevent(buf, find_blk_dev, ipr_init_dev); Index: iprlib.h =================================================================== RCS file: /cvsroot/iprdd/iprutils/iprlib.h,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -r1.104 -r1.105 --- iprlib.h 23 Oct 2008 17:11:20 -0000 1.104 +++ iprlib.h 20 Nov 2008 01:20:20 -0000 1.105 @@ -185,7 +185,7 @@ #define IPR_ACTIVE_NON_OPTIMIZED 0x1 #define IPR_ACTIVE_STANDBY 0x2 #define IPR_CLEAR_ASYMMETRIC_STATE 0x0 -#define IPR_PRESERVE_ASYMMETRIC_STATE 0x1 +#define IPR_PRESERVE_ASYMMETRIC_STATE 0x80 #define IPR_IS_DASD_DEVICE(std_inq_data) \ ((((std_inq_data).peri_dev_type) == TYPE_DISK) && !((std_inq_data).removeable_medium)) Index: iprdump.c =================================================================== RCS file: /cvsroot/iprdd/iprutils/iprdump.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- iprdump.c 8 Sep 2006 16:26:01 -0000 1.18 +++ iprdump.c 20 Nov 2008 01:20:20 -0000 1.19 @@ -53,6 +53,13 @@ static char *enable = "1\n"; static char *disable = "0\n"; +/** + * enable_dump - + * @ioa: ipr_ioa struct + * + * Returns: + * nothing + **/ static void enable_dump(struct ipr_ioa *ioa) { struct sysfs_class_device *class_device; @@ -92,6 +99,13 @@ sysfs_close_class_device(class_device); } +/** + * disable_dump - + * @ioa: ipr_ioa struct + * + * Returns: + * nothing + **/ static void disable_dump(struct ipr_ioa *ioa) { struct sysfs_class_device *class_device; @@ -128,6 +142,13 @@ sysfs_close_class_device(class_device); } +/** + * read_dump - + * @ioa: ipr_ioa struct + * + * Returns: + * number of items read + **/ static int read_dump(struct ipr_ioa *ioa) { struct sysfs_class_device *class_device; @@ -162,6 +183,13 @@ return count; } +/** + * select_dump_file - + * @dirent: dirent struct + * + * Returns: + * 1 if the string is found, else 0 + **/ static int select_dump_file(const struct dirent *dirent) { if (strstr(dirent->d_name, DUMP_PREFIX)) @@ -169,6 +197,14 @@ return 0; } +/** + * dump_sort - + * @a: void buffer + * @b: void buffer + * + * Returns: + * + **/ static int dump_sort(const void *a, const void *b) { const struct dirent **dumpa = (const struct dirent **)a; @@ -185,6 +221,12 @@ return alphasort(dumpa, dumpb); } +/** + * cleanup_old_dumps - + * + * Returns: + * Nothing + **/ static void cleanup_old_dumps() { struct dirent **dirent; @@ -205,6 +247,13 @@ } } +/** + * get_dump_fname - + * @fname: file name + * + * Returns: + * -EIO on error, else 0 + **/ static int get_dump_fname(char *fname) { struct dirent **dirent; @@ -235,6 +284,14 @@ return 0; } +/** + * write_dump - + * @ioa: ipr_ioa struct + * @count: size to write + * + * Returns: + * Nothing + **/ static void write_dump(struct ipr_ioa *ioa, int count) { int f_dump; @@ -256,6 +313,13 @@ ioa_err(ioa, "Dump of ipr IOA has completed to file: %s\n", dump_path); } +/** + * handle_signal - + * @signal: signal value + * + * Returns: + * Nothing + **/ static void handle_signal(int signal) { struct ipr_ioa *ioa; @@ -266,6 +330,13 @@ exit(0); } +/** + * select_dump_file - + * @ioa: ipr_ioa struct + * + * Returns: + * Nothing + **/ static void dump_ioa(struct ipr_ioa *ioa) { int count; @@ -278,6 +349,12 @@ enable_dump(ioa); } +/** + * poll_for_dump - + * + * Returns: + * Nothing + **/ static void poll_for_dump() { struct ipr_ioa *ioa; @@ -290,16 +367,27 @@ dump_ioa(ioa); } +/** + * kevent_handler - + * @buf: character buffer + * + * Returns: + * Nothing + **/ static void kevent_handler(char *buf) { struct ipr_ioa *ioa; int host, i; + char *index; - if (strncmp(buf, "change@/class/scsi_host", 23)) + if (!strncmp(buf, "change@/class/scsi_host", 23)) { + host = strtoul(&buf[28], NULL, 10); + } else if (!strncmp(buf, "change@/devices/pci", 19) && strstr(buf, "scsi_host")) { + index = strrchr(buf, '/'); + host = strtoul(index + 5, NULL, 10); + } else return; - host = strtoul(&buf[28], NULL, 10); - for (i = 0; i < 10; i++) { tool_init(0); ioa = find_ioa(host); @@ -317,6 +405,14 @@ dump_ioa(ioa); } +/** + * main - + * @argc: argument count + * @argv: argument string + * + * Returns: + * return value of handle_events() call + **/ int main(int argc, char *argv[]) { struct ipr_ioa *ioa; @@ -338,13 +434,15 @@ } else { printf("Usage: "TOOL_NAME" [options]\n"); printf(" Options: --version Print iprdump version\n"); + printf(" --daemon Run as a daemon\n"); printf(" --debug Print extra debugging information\n"); printf(" -d <usr_dir>\n"); exit(1); } } - ipr_daemonize(); + if (daemonize) + ipr_daemonize(); signal(SIGINT, handle_signal); signal(SIGQUIT, handle_signal); @@ -356,5 +454,3 @@ return handle_events(poll_for_dump, 60, kevent_handler); } - - |