fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*LINTLIBRARY*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This module is part of the photon library
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * I18N message number ranges
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This file: 8500 - 8999
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Shared common messages: 1 - 1999
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* #define _POSIX_SOURCE 1 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Includes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdlib.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdio.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/file.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/stat.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/param.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <fcntl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <unistd.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <errno.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <string.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <time.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/scsi/scsi.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/vtoc.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <nl_types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <strings.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/ddi.h> /* for max */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <l_common.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stgcom.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <l_error.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <rom.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <a_state.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <a5k.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Global variables */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern uchar_t g_switch_to_alpa[];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern uchar_t g_sf_alpa_to_switch[];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This function checks if the passed char pointer has WWN_SIZE nulls (zeroes).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is only a convenience function.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * INPUT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * wwn_ptr - pointer to a character string of length WWN_SIZE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * It is expected to be holding the WWN
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Ex: A WWN like 508002000000ddc1 is expected to be stored as
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the following 8 bytes -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0x50, 0x80, 0x00, 0x20, ... etc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 - if there is atleast one of WWN_SIZE bytes is != '\0'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * non-zero - if all WWN_SIZE bytes are '\0'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteis_null_wwn(uchar_t *wwn_ptr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < WWN_SIZE; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wwn_ptr[i] != '\0' || wwn_ptr[i] != '0')
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This functions constructs a device path of the device/enclosure with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * given tid and, for public/fabric cases, on the same area and domain as
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the given ses_path.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * INPUT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ses_path - pointer to the ses_path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * tid - tid of the device/enclosure whose path is to be constructed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * map - pointer to the map
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dtype - dtype of the device whose path is to be constructed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * OUTPUT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dev_path - pointer to the device path of type dtype and with tid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * - Caller has to free this after use
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 - on success
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * non-zero - otherwise
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortel_make_node(char *ses_path, int tid, char *dev_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gfc_map_t *map, int dtype)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint len, i, err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint this_pid, ses_pid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar ssd[40], wwn[20];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_port_dev_info_t *dev_addr_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct stat stat_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteWWN_list *wwnlp, *wwn_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint found = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ses_path == NULL) || (dev_path == NULL) || (map == NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH_FORMAT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (map->hba_addr.port_topology) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_PRIVATE_LOOP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, dev_addr_ptr = map->dev_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i < map->count; i++, dev_addr_ptr++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dev_addr_ptr->gfc_port_dev.priv_port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_al_pa == g_switch_to_alpa[tid])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i >= map->count) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *dev_path = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_LOOP_MAP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Make sure that the port WWN is valid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (is_null_wwn(dev_addr_ptr->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte priv_port.sf_port_wwn)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *dev_path = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVLD_WWN_FORMAT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_ll_to_str(dev_addr_ptr->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte priv_port.sf_port_wwn, wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(ses_path, SCSI_VHCI) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_wwn_list(&wwn_list, 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (wwnlp = wwn_list, found = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwnlp != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwnlp = wwnlp->wwn_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(wwnlp->port_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte found = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (found) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(dev_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwnlp->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte len = strlen(ses_path) -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(strrchr(ses_path, '/'));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dtype != DTYPE_ESI) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(ssd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "/ssd@w%s,0:c", wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(ssd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "/ses@w%s,0:c", wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* TBD: Must find path, not just use :c */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strncpy(dev_path, ses_path, len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_path[len] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat(dev_path, ssd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_FABRIC:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_PUBLIC_LOOP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* First lets get the PA from the ses path passed in */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_pid_from_path(ses_path, map, &ses_pid)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Now we go through every entry in the map and match the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * area and domain ids with the PA of the passed ses path.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If we find a match, we then match the low order byte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, dev_addr_ptr = map->dev_addr; i < map->count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i++, dev_addr_ptr++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte this_pid = dev_addr_ptr->gfc_port_dev.pub_port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_did.port_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((this_pid & AREA_DOMAIN_ID) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ses_pid & AREA_DOMAIN_ID)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((uchar_t)(this_pid & 0xFF) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_switch_to_alpa[tid])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i >= map->count) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *dev_path = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_LOOP_MAP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Make sure that the port WWN is valid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (is_null_wwn(dev_addr_ptr->gfc_port_dev.pub_port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_pwwn.raw_wwn)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *dev_path = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVLD_WWN_FORMAT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_ll_to_str(dev_addr_ptr->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pub_port.dev_pwwn.raw_wwn, wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(ses_path, SCSI_VHCI) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_wwn_list(&wwn_list, 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (wwnlp = wwn_list, found = 0; wwnlp != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwnlp = wwnlp->wwn_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(wwnlp->port_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte found = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (found) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(dev_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwnlp->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte len = strlen(ses_path) -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(strrchr(ses_path, '/'));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dtype != DTYPE_ESI) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(ssd, "/ssd@w%s,0:c", wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(ssd, "/ses@w%s,0:c", wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* TBD: Must find path, not just use :c */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strncpy(dev_path, ses_path, len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_path[len] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat(dev_path, ssd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (stat(dev_path, &stat_buf) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_PT_PT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_PT_PT_FC_TOP_NOT_SUPPORTED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_UNEXPECTED_FC_TOPOLOGY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* End of switch on port_topology */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * checks for null wwn to a disk.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and returns -1 if found, 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * otherwise.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * OUTPUT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * char *ses_path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 if OK
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * non-zero otherwise
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortel_chk_null_wwn(Path_struct *path_struct, char *ses_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte L_state *l_state, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *ptr, boxname[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar node_wwn_s[WWN_SIZE * 2 + 1];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteBox_list *boxlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((path_struct == NULL) || (ses_path == NULL) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (l_state == NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH_FORMAT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * verify and continue only if the argv
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * has a format like box,{f/r}<slot #>.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Otherwise, return to the caller.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The only way to address null wwn disk
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * is using the box,{f/r}<slot#> format.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* add support for new {f/r/s}<slot#> support for DPM */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(boxname, path_struct->argv);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((ptr = strstr(boxname, ",")) != NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((*(ptr + 1) == 'f') || (*(ptr + 1) == 'r') ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*(ptr + 1) == 's'))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ptr = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get the list of enclosures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * connected to the system.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_get_box_list(&boxlist, verbose) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_NO_ENCL_LIST_FOUND);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *ses_path = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The following method is safer to get an ses path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the enclosure than calling l_get_ses_path(),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * with physical path to null WWN disk.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Because, l_get_ses_path uses the disk's
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * al_pa to get the box id and then ses path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the box. When a disk has null wwn, it may
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * not have a valid al_pa, and hard address.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * There is a possibility that l_get_ses_path()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * not returning ses path to the correct enclosure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (boxlist != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strcmp(boxname, (char *)boxlist->b_name) == 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(ses_path, boxlist->b_physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boxlist = boxlist->box_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* free the box list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_box_list(&boxlist);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ses_path != NULL) && (strstr(ses_path, "ses") != NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_get_status(ses_path, l_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte verbose) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_GET_STATUS_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (path_struct->f_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->drv_front[path_struct->slot].g_disk_state.node_wwn_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(node_wwn_s,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte l_state->drv_rear[path_struct->slot].g_disk_state.node_wwn_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte W_DPRINTF("Found ses path: %s\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "and Node WWN: %s\n", ses_path, node_wwn_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check for null WWN */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (is_null_wwn((uchar_t *)node_wwn_s) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0); /* Non-null wwn */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte W_DPRINTF("Found NULL WWN: %s\n", node_wwn_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If OVERALL_STATUS is sent as the "func",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the code pointer must be valid (non NULL).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Otherwise NULL is a valid input for the code pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 if OK
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * non-zero otherwise
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortel_encl_status_page_funcs(int func, char *code, int todo, char *ses_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct l_state_struct *l_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int f_flag, int slot, int verbose_flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t *page_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fd, front_index, rear_index, offset, err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteunsigned short page_len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct device_element *elem;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ses_path == NULL) || (l_state == NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH_FORMAT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((page_buf = (uchar_t *)g_zalloc(MAX_REC_DIAG_LENGTH)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fd = g_object_open(ses_path, O_NDELAY | O_RDWR)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_OPEN_PATH_FAIL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_envsen_page(fd, page_buf, MAX_REC_DIAG_LENGTH,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte L_PAGE_2, verbose_flag)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte page_len = (page_buf[2] << 8 | page_buf[3]) + HEADER_LEN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = l_get_disk_element_index(l_state, &front_index,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &rear_index)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Skip global element */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte front_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((strncmp((char *)l_state->ib_tbl.config.prod_id, DAK_OFF_NAME,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(DAK_OFF_NAME)) == 0) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (strncmp((char *)l_state->ib_tbl.config.prod_id, DAK_PROD_STR,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(DAK_OFF_NAME)) == 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rear_index += l_state->total_num_drv/2 + 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rear_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (f_flag) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = (8 + (front_index + slot)*4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte offset = (8 + (rear_index + slot)*4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem = (struct device_element *)(page_buf + offset);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (func) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case OVERALL_STATUS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (code == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_ARG);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (todo) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case INSERT_DEVICE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *code = (elem->code != S_OK) ? elem->code : 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case REMOVE_DEVICE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *code = (elem->code != S_NOT_INSTALLED) ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->code : 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* NOTREACHED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SET_RQST_INSRT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(elem, sizeof (struct device_element));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->select = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->rdy_to_ins = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SET_RQST_RMV:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(elem, sizeof (struct device_element));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->select = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->rmv = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->dev_off = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->en_bypass_a = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->en_bypass_b = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SET_FAULT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(elem, sizeof (struct device_element));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->select = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->fault_req = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->dev_off = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->en_bypass_a = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->en_bypass_b = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SET_DRV_ON:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(elem, sizeof (struct device_element));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elem->select = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte err = g_scsi_send_diag_cmd(fd, (uchar_t *)page_buf, page_len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(page_buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Finds whether device id (tid) exists in the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Arbitrated loop map or not.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * INPUT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ses_path - pointer to a ses path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * tid - the target id of the device we want to check on
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * - only the low order 8 bits has the tid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * map - pointer to a map of the system
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * verbose_flag - self explanatory
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * OUTPUT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dev_path - the device path of the device with "tid".
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Caller is responsible for freeing it
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1 if device present
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 otherwise
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortel_device_present(char *ses_path, int tid, gfc_map_t *map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int verbose_flag, char **dev_path)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar sf_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteuchar_t wwn[40], c;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint len, i, j, k, fnib, snib, this_pid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint fd, ses_pid, al_pa, err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar ssd[30];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegfc_port_dev_info_t *dev_addr_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteWWN_list *wwnlp, *wwn_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dev_path == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((ses_path == NULL) || (map == NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_NO_SES_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *dev_path = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (map->hba_addr.port_topology) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_PRIVATE_LOOP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, dev_addr_ptr = map->dev_addr; i < map->count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i++, dev_addr_ptr++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dev_addr_ptr->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte priv_port.sf_inq_dtype != DTYPE_ESI) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte al_pa = dev_addr_ptr->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte priv_port.sf_al_pa;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (tid == g_sf_alpa_to_switch[al_pa]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i >= map->count)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Make sure that the port WWN is valid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (is_null_wwn(dev_addr_ptr->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte priv_port.sf_port_wwn)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0, k = 0; j < WWN_SIZE; j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = dev_addr_ptr->gfc_port_dev.priv_port.sf_port_wwn[j];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fnib = (((int)(c & 0xf0)) >> 4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte snib = (c & 0x0f);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fnib >= 0 && fnib <= 9)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn[k++] = '0' + fnib;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (fnib >= 10 && fnib <= 15)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn[k++] = 'a' + fnib - 10;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (snib >= 0 && snib <= 9)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn[k++] = '0' + snib;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (snib >= 10 && snib <= 15)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn[k++] = 'a' + snib - 10;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn[k] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_PUBLIC_LOOP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_FABRIC:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get the phys address (port id) of this ses device
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = l_get_pid_from_path(ses_path, map, &ses_pid))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, dev_addr_ptr = map->dev_addr; i < map->count;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i++, dev_addr_ptr++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dev_addr_ptr->gfc_port_dev.pub_port.dev_dtype !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte DTYPE_ESI) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We have a device. First match the area and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * domain ids and if they match, then see if
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the 8bit tid matches the last 8 bits of
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 'this_pid'
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte this_pid = dev_addr_ptr->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pub_port.dev_did.port_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((this_pid & AREA_DOMAIN_ID) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (ses_pid & AREA_DOMAIN_ID)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (tid == g_sf_alpa_to_switch[
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte this_pid & 0xFF])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i >= map->count)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Make sure that the port WWN is valid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (is_null_wwn(dev_addr_ptr->gfc_port_dev.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pub_port.dev_pwwn.raw_wwn)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0, k = 0; j < WWN_SIZE; j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = dev_addr_ptr->gfc_port_dev.pub_port.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dev_pwwn.raw_wwn[j];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fnib = (((int)(c & 0xf0)) >> 4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte snib = (c & 0x0f);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (fnib >= 0 && fnib <= 9)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn[k++] = '0' + fnib;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (fnib >= 10 && fnib <= 15)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn[k++] = 'a' + fnib - 10;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (snib >= 0 && snib <= 9)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn[k++] = '0' + snib;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (snib >= 10 && snib <= 15)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn[k++] = 'a' + snib - 10;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn[k] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case FC_TOP_PT_PT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_PT_PT_FC_TOP_NOT_SUPPORTED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_UNEXPECTED_FC_TOPOLOGY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* End of switch on port_topology */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strstr(ses_path, SCSI_VHCI) != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (err = g_get_wwn_list(&wwn_list, 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (wwnlp = wwn_list; wwnlp != NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwnlp = wwnlp->wwn_next) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (memcmp(wwnlp->port_wwn_s, wwn, WWN_S_LEN) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wwnlp != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*dev_path = g_zalloc(MAXPATHLEN)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_free_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(*dev_path, wwnlp->physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte g_free_wwn_list(&wwn_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte len = strlen(ses_path) - strlen(strrchr(ses_path, '/'));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(ssd, "ssd@w%s,0", wwn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strncpy(sf_path, ses_path, len);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sf_path[len] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte P_DPRINTF(" l_device_present: wwn=%s, sf_path=%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wwn, sf_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((*dev_path = g_zalloc(MAXPATHLEN)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(*dev_path, "%s/%s", sf_path, ssd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte P_DPRINTF(" l_device_present: dev_path=%s\n", *dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcat(*dev_path, ":c");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fd = open(*dev_path, O_RDONLY)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(*dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *dev_path = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) close(fd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * onlines the given list of devices
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and free up the allocated memory.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * N/A
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteonline_dev(struct dlist *dl_head, int force_flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct dlist *dl, *dl1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (dl = dl_head; dl != NULL; ) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_online_drive(dl->multipath, force_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(dl->multipath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl1 = dl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl = dl->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dl1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * offlines all the disks in a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * SENA enclosure.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 0 if O.K.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * non-zero otherwise
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortel_offline_photon(struct hotplug_disk_list *hotplug_sena,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct wwn_list_struct *wwn_list,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int force_flag, int verbose_flag)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint i, err;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct dlist *dl_head, *dl_tail, *dl, *dl_ses;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *dev_path, ses_path[MAXPATHLEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_state *l_state = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (hotplug_sena == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_INVALID_PATH_FORMAT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl_head = dl_tail = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((l_state = (L_state *)calloc(1, sizeof (L_state))) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get global status for this Photon */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl_ses = hotplug_sena->seslist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (dl_ses) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(ses_path, dl_ses->dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (l_get_status(ses_path, l_state, verbose_flag) == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl_ses = dl_ses->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dl_ses == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_ENCL_INVALID_PATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < l_state->total_num_drv/2; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*l_state->drv_front[i].g_disk_state.physical_path) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((dev_path = g_zalloc(MAXPATHLEN)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) online_dev(dl_head, force_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(dev_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (char *)&l_state->drv_front[i].g_disk_state.physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((dl = g_zalloc(sizeof (struct dlist))) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) online_dev(dl_head, force_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl->dev_path = dev_path;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_multipath(dev_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &(dl->multipath), wwn_list, 0)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dl->multipath != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(dl->multipath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dl);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) online_dev(dl_head, force_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_offline_drive(dl->multipath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte force_flag)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(dl->multipath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dl);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) online_dev(dl_head, force_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dl_head == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl_head = dl_tail = dl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl_tail->next = dl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl->prev = dl_tail;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl_tail = dl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*l_state->drv_rear[i].g_disk_state.physical_path) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((dev_path = g_zalloc(MAXPATHLEN)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) online_dev(dl_head, force_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strcpy(dev_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (char *)&l_state->drv_rear[i].g_disk_state.physical_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((dl = g_zalloc(sizeof (struct dlist))) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) online_dev(dl_head, force_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (L_MALLOC_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl->dev_path = dev_path;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_get_multipath(dev_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &(dl->multipath), wwn_list, 0)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dl->multipath != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(dl->multipath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dl);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) online_dev(dl_head, force_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((err = g_offline_drive(dl->multipath,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte force_flag)) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_free_multipath(dl->multipath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dl);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) online_dev(dl_head, force_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (err);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (dl_head == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl_head = dl_tail = dl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl_tail->next = dl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl->prev = dl_tail;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dl_tail = dl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) g_destroy_data(dev_path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hotplug_sena->dlhead = dl_head;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) l_free_lstate(&l_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * prepares a char string
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * containing the name of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * device which will be hotplugged.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * N/A
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortel_get_drive_name(char *drive_name, int slot, int f_flag, char *box_name)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint enc_type = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteL_inquiry inq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *physpath;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortePath_struct *p_pathstruct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((drive_name == NULL) || (box_name == NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!l_convert_name(box_name, &physpath, &p_pathstruct, 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!g_get_inquiry(physpath, &inq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte enc_type = l_get_enc_type(inq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* If either of the above fail, we use the default value of 0 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(physpath);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte free(p_pathstruct);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (enc_type) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case DAK_ENC_TYPE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (f_flag != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(drive_name, MSGSTR(8502,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Drive in \"%s\" slot %d"), box_name, slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(drive_name, MSGSTR(8502,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Drive in \"%s\" slot %d"), box_name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte slot + (MAX_DRIVES_DAK/2));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (f_flag != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(drive_name, MSGSTR(8500,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Drive in \"%s\" front slot %d"), box_name, slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(drive_name, MSGSTR(8501,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Drive in \"%s\" rear slot %d"), box_name, slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}