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/*
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mpathadm.c : MP API CLI program
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <libintl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <mpapi.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "cmdparse.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "mpathadm_text.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "mpathadm.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/stat.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <unistd.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdlib.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <devid.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <fcntl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* helper functions */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *getExecBasename(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* object functions per subcommand */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int listFunc(int, char **, int, cmdOptions_t *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int showFunc(int, char **, int, cmdOptions_t *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int modifyFunc(int, char **, int, cmdOptions_t *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int enableFunc(int, char **, int, cmdOptions_t *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int disableFunc(int, char **, int, cmdOptions_t *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int failoverFunc(int, char **, int, cmdOptions_t *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int overrideFunc(int, char **, int, cmdOptions_t *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define VERSION_STRING_MAX_LEN 10
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OPTIONSTRING_NAME "name"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OPTIONSTRING_TPNAME "target-port name"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OPTIONSTRING_ONOFF "on/off"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OPTIONSTRING_LBTYPE "loadbalance type"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OPTIONSTRING_IPORT "initiator-port name"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OPTIONSTRING_LUNIT "logical-unit name"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OPTIONSTRING_CANCEL "cancel"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define OPTIONSTRING_VALUE "value"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Version number: (copied from iscsiadm)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * MAJOR - This should only change when there is an incompatible change made
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to the interfaces or the output.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * MINOR - This should change whenever there is a new command or new feature
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * with no incompatible change.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define VERSION_STRING_MAJOR "1"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define VERSION_STRING_MINOR "0"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* globals */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *cmdName;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * getExecBasename - copied from iscsiadm code
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * input:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * execFullName - exec name of program (argv[0])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Returns:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * command name portion of execFullName
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortegetExecBasename(char *execFullname)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *lastSlash, *execBasename;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* guard against '/' at end of command invocation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (;;) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lastSlash = strrchr(execFullname, '/');
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (lastSlash == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte execBasename = execFullname;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte execBasename = lastSlash + 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*execBasename == '\0') {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *lastSlash = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (execBasename);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Add new options here
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* tables set up based on cmdparse instructions */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteoptionTbl_t longOptions[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"inqname", required_arg, 'n', OPTIONSTRING_NAME},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"target-port", required_arg, 't', OPTIONSTRING_TPNAME},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"autofailback", required_arg, 'a', OPTIONSTRING_ONOFF},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"autoprobe", required_arg, 'p', OPTIONSTRING_ONOFF},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"loadbalance", required_arg, 'b', OPTIONSTRING_LBTYPE},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"initiator-port", required_arg, 'i', OPTIONSTRING_IPORT},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"logical-unit", required_arg, 'l', OPTIONSTRING_LUNIT},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"cancel", no_arg, 'c', OPTIONSTRING_CANCEL},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"vendor-id", required_arg, 'd', OPTIONSTRING_VALUE},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {NULL, 0, 0, 0}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Add new subcommands here
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesubcommand_t subcommands[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"list", LIST, listFunc},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"show", SHOW, showFunc},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"modify", MODIFY, modifyFunc},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"enable", ENABLE, enableFunc},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"disable", DISABLE, disableFunc},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"failover", FAILOVER, failoverFunc},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"override", OVERRIDE, overrideFunc},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {NULL, 0, NULL}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Add objects here
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteobject_t objects[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"mpath-support", MPATH_SUPPORT},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"logical-unit", LOGICAL_UNIT},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"LU", LOGICAL_UNIT},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"initiator-port", INITIATOR_PORT},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {"path", PATH},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {NULL, 0}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Rules for subcommands and objects
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * command
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * reqOpCmd -> subcommands that must have an operand
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * optOpCmd -> subcommands that may have an operand
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * noOpCmd -> subcommands that will have no operand
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * invCmd -> subcommands that are invalid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * multOpCmd -> subcommands that can accept multiple operands
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operandDefinition -> Usage definition for the operand of this object
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteobjectRules_t objectRules[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {MPATH_SUPPORT, SHOW|MODIFY|ADD, LIST|REMOVE, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ENABLE|DISABLE|FAILOVER|OVERRIDE, LIST|SHOW|MODIFY,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "mpath-support name"},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {INITIATOR_PORT, SHOW, LIST, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MODIFY|ENABLE|DISABLE|FAILOVER|OVERRIDE|ADD|REMOVE, LIST|SHOW,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "initiator-port name"},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {LOGICAL_UNIT, SHOW|MODIFY|FAILOVER, LIST, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ENABLE|DISABLE|OVERRIDE|ADD|REMOVE, LIST|SHOW|MODIFY,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "logical-unit name"},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {PATH, 0, 0, ENABLE|DISABLE|OVERRIDE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SHOW|LIST|MODIFY|FAILOVER|ADD|REMOVE, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "initiator-port name"},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {0, 0, 0, 0, 0, NULL}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * list of objects, subcommands, valid short options, required flag and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * exclusive option string
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If it's not here, there are no options for that object.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteoptionRules_t optionRules[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {LOGICAL_UNIT, LIST, "nt", B_FALSE, NULL},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {LOGICAL_UNIT, MODIFY, "apb", B_TRUE, NULL},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {MPATH_SUPPORT, MODIFY, "apb", B_TRUE, NULL},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {MPATH_SUPPORT, ADD, "d", B_TRUE, NULL},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {MPATH_SUPPORT, REMOVE, "d", B_TRUE, NULL},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {PATH, ENABLE, "itl", B_TRUE, NULL},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {PATH, DISABLE, "itl", B_TRUE, NULL},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {PATH, OVERRIDE, "itlc", B_TRUE, NULL},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte {0, 0, 0, 0, 0}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * listMpathSupport - mpathadm list mpath-support
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operandLen - number of operands user passed into the cli
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operand - pointer to operand list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortelistMpathSupport(int operandLen, char *operand[])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_PLUGIN_PROPERTIES pluginProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_OID_LIST *pPluginOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t shown = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* number of plugins listed */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh int i, op;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus = MP_GetPluginOidList(&pPluginOidList))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((NULL == pPluginOidList) || (pPluginOidList->oidCount < 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* loop through operands first */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (op = 0; (op < operandLen) |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((0 == operandLen) && (B_FALSE == shown)); op++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte shown = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pPluginOidList->oidCount; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&pluginProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_PLUGIN_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetPluginProperties(pPluginOidList->oids[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pluginProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == operandLen) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if no operands, list them all */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TEXT_LB_MPATH_SUPPORT),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.fileName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if there is an operand... */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ... compare and display if match */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strcmp(operand[op],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.fileName)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TEXT_LB_MPATH_SUPPORT),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.fileName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* begin back-up indentation */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* LINTED E_SEC_PRINTF_VAR_FMT */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) fprintf(stderr, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_CANT_FIND_MPATH_SUPPORT_WITH_NAME),
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh operand[op]);
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* end back-up indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * showMpathSupport - mpathadm show mpath-support <mpath-support name>, ...
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operandLen - number of operands user passed into the cli
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operand - pointer to operand list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteshowMpathSupport(int operandLen, char *operand[])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_PLUGIN_PROPERTIES pluginProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_OID_LIST *pPluginOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_OID_LIST *deviceOidListArray;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_DEVICE_PRODUCT_PROPERTIES devProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t bListIt = B_FALSE;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh int op, i, j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_LOAD_BALANCE_TYPE lb;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus = MP_GetPluginOidList(&pPluginOidList)) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((NULL == pPluginOidList) || (pPluginOidList->oidCount < 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (op = 0; op < operandLen; op++) {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh bListIt = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pPluginOidList->oidCount; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&pluginProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_PLUGIN_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetPluginProperties(pPluginOidList->oids[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pluginProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_STATUS_SUCCESS != mpstatus) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == operandLen) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if no operand, list it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bListIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* ... compare and display if match */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strcmp(operand[op],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.fileName)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bListIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_TRUE != bListIt) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_MPATH_SUPPORT),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.fileName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* display the info for this plugin */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s ", getTextString(TEXT_LB_VENDOR));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayWideArray(pluginProps.vendor,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (pluginProps.vendor));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t%s ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_DRIVER_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(pluginProps.driverName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (pluginProps.driverName));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t%s ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_DEFAULT_LB));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* don't ignore load balance type none. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pluginProps.defaultloadBalanceType == 0) {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) printf("%s",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_LBTYPE_NONE));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh displayLoadBalanceString(
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh pluginProps.defaultloadBalanceType);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s \n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_SUPPORTED_LB));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check each bit, display string if found set */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pluginProps.supportedLoadBalanceTypes == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s\n",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_LBTYPE_NONE));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh lb = 1;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh do {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh if (0 != (lb & pluginProps.
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh supportedLoadBalanceTypes)) {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) printf("\t\t");
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh displayLoadBalanceString(lb &
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh pluginProps.
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh supportedLoadBalanceTypes);
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) printf("\n");
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh }
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh lb = lb<<1;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh } while (lb < 0x80000000);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_ALLOWS_ACT_TPG),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (MP_TRUE == pluginProps.canSetTPGAccess)?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_YES):getTextString(TEXT_NO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_ALLOWS_PATH_OV),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (MP_TRUE == pluginProps.canOverridePaths)?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_YES):getTextString(TEXT_NO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_SUPP_AUTO_FB),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.autoFailbackSupport);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((MP_AUTOFAILBACK_SUPPORT_PLUGIN ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.autoFailbackSupport) |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (MP_AUTOFAILBACK_SUPPORT_PLUGINANDMPLU
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == pluginProps.autoFailbackSupport)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_AUTO_FB),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.pluginAutoFailbackEnabled?\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ON):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_OFF));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %d/%d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_FB_POLLING_RATE),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.currentFailbackPollingRate,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.failbackPollingRateMax);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_AUTO_FB),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_NA));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %s/%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_FB_POLLING_RATE),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_NA),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_NA));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_SUPP_AUTO_P),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.autoProbingSupport);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((MP_AUTOPROBING_SUPPORT_PLUGIN ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.autoProbingSupport) |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (MP_AUTOPROBING_SUPPORT_PLUGIN ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.autoProbingSupport)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_AUTO_PROB),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (MP_TRUE ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.pluginAutoProbingEnabled)?\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_YES):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_NO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %d/%d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_PR_POLLING_RATE),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.currentProbingPollingRate,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.probingPollingRateMax);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_AUTO_PROB),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_NA));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %s/%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_PR_POLLING_RATE),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_NA),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_NA));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_SUPP_DEVICES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_TRUE !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.onlySupportsSpecifiedProducts) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(getTextString(TEXT_ANY_DEVICE));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if only supports specific products, */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get device product properties supported */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_GetDeviceProductOidList(\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pPluginOidList->oids[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &deviceOidListArray);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_NO_SUPP_DEVICE_INFO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* can't get any more info, */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* so we're done with this one */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; j < deviceOidListArray->oidCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++) {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* begin backup indentation */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) memset(&devProps, 0,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh sizeof (MP_DEVICE_PRODUCT_PROPERTIES));
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* end backup indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetDeviceProductProperties(\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte deviceOidListArray->oids[j],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &devProps)) == MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TEXT_LB_VENDOR));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(devProps.vendor,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (devProps.vendor));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t\t%s ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TEXT_LB_PRODUCT));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(devProps.product,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (devProps.product));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t\t%s ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TEXT_LB_REVISION));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(devProps.revision,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (devProps.revision));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t\t%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TEXT_LB_SUPPORTED_LB));
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* begin back-up indentation */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh if (devProps.supportedLoadBalanceTypes == 0) {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) printf("\t\t\t%s\n",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_LBTYPE_NONE));
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh } else {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh lb = 1;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh do {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 != (lb &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devProps.supportedLoadBalanceTypes)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayLoadBalanceString(lb &
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh devProps.supportedLoadBalanceTypes);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lb = lb<<1;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh } while (lb < 0x80000000);
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh }
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* end back-up indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_NO_SUPP_DEVICE_INFO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for j */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* if only supports specified devices */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each plugin */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == bListIt) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_CANT_FIND_MPATH_SUPPORT_WITH_NAME),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte operand[op]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each operand */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * modifyMpathSupport -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mpathadm modify mpath-support [options] <mpath-support name>, ...
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operandLen - number of operands user passed into the cli
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operand - pointer to operand list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * options - pointer to option list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortemodifyMpathSupport(int operandLen, char *operand[], cmdOptions_t *options)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_STATUS mpstatus = MP_STATUS_SUCCESS;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_PLUGIN_PROPERTIES pluginProps;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_OID_LIST *pPluginOidList;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh boolean_t bFoundIt = B_FALSE;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_OID pluginOid;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh cmdOptions_t *optionList = options;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh char *cmdStr = getTextString(TEXT_UNKNOWN);
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh int op, i, lbValue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus = MP_GetPluginOidList(&pPluginOidList))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((NULL == pPluginOidList) || (pPluginOidList->oidCount < 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (op = 0; op < operandLen; op++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundIt = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (i < pPluginOidList->oidCount) && (B_TRUE != bFoundIt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&pluginProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_PLUGIN_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetPluginProperties(pPluginOidList->oids[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pluginProps)) == MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == strcmp(operand[op],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.fileName)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginOid = pPluginOidList->oids[i];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == bFoundIt) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* begin back-up indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* we found the plugin oid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* now change the options requested */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (optionList->optval) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'a':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* modify autofailback */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdStr = getTextString(TEXT_AUTO_FAILBACK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == strcasecmp(optionList->optarg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ON))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_EnableAutoFailback(pluginOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 ==
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh strcasecmp(optionList->optarg,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_OFF))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_DisableAutoFailback(pluginOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_CHANGE_OPTION_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ILLEGAL_ARGUMENT));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'p':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* modify autoprobing */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdStr = getTextString(TEXT_AUTO_PROBING);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == strcasecmp(optionList->optarg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ON))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_EnableAutoProbing(pluginOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 ==
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh strcasecmp(optionList->optarg,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_OFF))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_DisableAutoProbing(pluginOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_CHANGE_OPTION_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ILLEGAL_ARGUMENT));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'b':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* modify loadbalance type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdStr = getTextString(TEXT_LOAD_BALANCE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* user of the cli sends text string, we need the int */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* value to pass to the mpapi */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbValue = getLbValueFromString(optionList->optarg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_SetPluginLoadBalanceType(pluginOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbValue);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* switch */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_STATUS_SUCCESS != mpstatus) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_CHANGE_OPTION_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdStr, getMpStatusStr(mpstatus));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* end back-up indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each plugin */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == bFoundIt) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_CHANGE_OPTION_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_MPATH_SUPPORT_NOT_FOUND));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each operand */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * listLogicalUnit -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mpathadm list {logical-unit | LU} [options] [<logical-unit name>, ...]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operandLen - number of operands user passed into the cli
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operand - pointer to operand list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * options - pointer to option list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortelistLogicalUnit(int operandLen, char *operand[], cmdOptions_t *options)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_STATUS mpstatus = MP_STATUS_SUCCESS;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_PLUGIN_PROPERTIES pluginProps;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_TARGET_PORT_PROPERTIES tportProps;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_OID_LIST *pPluginOidList, *pLogicalUnitOidList,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh *pTpgOidListArray, *pTportOidListArray;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh boolean_t bListIt = B_FALSE, bFoundOperand = B_FALSE,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh *bFoundOption, bContinue = B_FALSE;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_OID luOid;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh cmdOptions_t *optionList = options;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh int opListCount = 0, i = 0, lu = 0, tpg = 0, opoffset = 0, j = 0,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh opStart = 0, opEnd = 0, opIndex;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* count number of options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (; optionList->optval; optionList++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opListCount++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundOption = malloc((sizeof (boolean_t)) * opListCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (NULL == bFoundOption) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_MEMORY_ALLOCATION));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* list to keep track of multiple options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte optionList = options;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (opIndex = 0; opIndex < opListCount; opIndex++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundOption[opIndex] = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte optionList = options;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if no operands or options, list everything we find */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((0 == operandLen) && (0 == opListCount)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus = MP_GetPluginOidList(&pPluginOidList))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((NULL == pPluginOidList) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pPluginOidList->oidCount < 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pPluginOidList->oidCount; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get properties so we can list the name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&pluginProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_PLUGIN_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetPluginProperties(pPluginOidList->oids[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pluginProps)) != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* attempt to find this logical unit */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_GetMultipathLus(pPluginOidList->oids[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pLogicalUnitOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_LU_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (lu = 0; lu < pLogicalUnitOidList->oidCount; lu++) {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* begin backup indentation */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* get lu properties so we can check the name */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) memset(&luProps, 0,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh sizeof (MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES));
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* end backup indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetMPLogicalUnitProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pLogicalUnitOidList->oids[lu],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &luProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte luOid = pLogicalUnitOidList->oids[lu];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (listIndividualLogicalUnit(luOid, luProps)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each LU */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each plugin */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else { /* we have operands and/or options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check if we have operands */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == operandLen) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* no operands */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opStart = -1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opEnd = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* operands */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opStart = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opEnd = operandLen;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus = MP_GetPluginOidList(&pPluginOidList))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((NULL == pPluginOidList) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pPluginOidList->oidCount < 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (opoffset = opStart; opoffset < opEnd; opoffset++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* loop through operands */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundOperand = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pPluginOidList->oidCount; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * loop through plugin, and get properties
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * so we can list the name
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&pluginProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_PLUGIN_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetPluginProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pPluginOidList->oids[i], &pluginProps))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* attempt to find this logical unit */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetMultipathLus(pPluginOidList->oids[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pLogicalUnitOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_LU_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (lu = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (lu < pLogicalUnitOidList->oidCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lu++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bListIt = B_FALSE;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* begin backup indentation */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* get lu props & check the name */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) memset(&luProps, 0,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh sizeof (MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES));
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* end backup indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetMPLogicalUnitProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pLogicalUnitOidList->oids[lu],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &luProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * compare operand - is it a match?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If so, continue
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bContinue = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (operandLen > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bContinue =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte compareLUName(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte operand[opoffset],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte luProps.deviceFileName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_TRUE == bContinue) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 != opListCount) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* begin backup indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteoptionList = options;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefor (opIndex = 0; optionList->optval; optionList++, opIndex++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteswitch (optionList->optval) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'n':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_TRUE ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte compareLUName(optionList->optarg, luProps.name)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bListIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundOperand = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundOption[opIndex] = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 't':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get TPG list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetAssociatedTPGOidList(pLogicalUnitOidList->oids[lu],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pTpgOidListArray);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_ASSOC_TPGS));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get target ports */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (tpg = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (NULL != pTpgOidListArray) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (tpg < pTpgOidListArray->oidCount) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (B_FALSE == bListIt); tpg++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetTargetPortOidList(pTpgOidListArray->oids[tpg],
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh &pTportOidListArray);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_ASSOC_TPORTS));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get target port properties for the name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = 0; (NULL != pTportOidListArray) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (j < pTportOidListArray->oidCount) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (B_FALSE == bListIt); j++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&tportProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_TARGET_PORT_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetTargetPortProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pTportOidListArray->oids[j], &tportProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check the name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == strcmp(optionList->optarg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tportProps.portID)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bListIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundOperand = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundOption[opIndex] = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each target port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each tpg */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* end switch */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* loop through options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* end back-up indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if no options,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * listit
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bListIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundOperand = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* end bContinue check */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bListIt) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_MPATH_SUPPORT),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps.fileName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte luOid = pLogicalUnitOidList->oids[lu];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (listIndividualLogicalUnit(luOid, luProps)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* end LU loop */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* end plugin loop */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((0 == opListCount) && (0 != operandLen)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == bFoundOperand) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* option/operand combo not found */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_LU_NOT_FOUND_WITH_MISSING_LU_STR),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte operand[opoffset]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte optionList = options;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (opIndex = 0; optionList->optval; optionList++,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte opIndex++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == bFoundOption[opIndex]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_LU_NOT_FOUND_WITH_MISSING_LU_STR),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte optionList->optarg);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* end loop through operands */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* we have operands and/or options */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * compareLUName -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * compare names directly and via devid if no match directly
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cmpString - first string to compare
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * deviceProperty - string from properties
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * sizeToCompare - size of deviceProperty
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * returns B_TRUE if the strings match either directly or via devid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * B_FALSE otherwise
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortecompareLUName(MP_CHAR *cmpString, MP_CHAR *deviceProperty)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t isSame = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fd1, fd2;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ddi_devid_t devid1 = NULL, devid2 = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == strcmp(cmpString, deviceProperty)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isSame = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* user input didn't match, try via devid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * I don't see a reason to print the error for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * any of these since they'll get the error at
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the end anyway
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim fd1 = fd2 = -1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((fd1 = open(cmpString, O_RDONLY|O_NDELAY)) >= 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((fd2 = open(deviceProperty, O_RDONLY|O_NDELAY)) >= 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (devid_get(fd1, &devid1) == 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (devid_get(fd2, &devid2) == 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((NULL != devid1) && (NULL != devid2))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (devid_compare(devid1, devid2))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte isSame = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (NULL != devid1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devid_free(devid1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (NULL != devid2) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devid_free(devid2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim if (fd1 >= 0) {
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim (void) close(fd1);
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim }
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim if (fd2 >= 0) {
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim (void) close(fd2);
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* compare */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (isSame);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * listIndivudualLogicalUnit -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used by list logical unit cli.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Displays info about an LU
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * luOid - LU to list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * luProps - properties of he LU to list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortelistIndividualLogicalUnit(MP_OID luOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_PATH_LOGICAL_UNIT_PROPERTIES pathProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_OID_LIST *pPathOidListArray;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh int numOperationalPaths, pa;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(luProps.deviceFileName, sizeof (luProps.deviceFileName));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_GetAssociatedPathOidList(luOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pPathOidListArray);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_LU_PATH_INFO_WITH_MISSING_LU_STR),
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getStringArray(luProps.deviceFileName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (luProps.deviceFileName)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_PATH_COUNT), pPathOidListArray->oidCount);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte numOperationalPaths = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (pa = 0; pa < pPathOidListArray->oidCount; pa++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&pathProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_PATH_LOGICAL_UNIT_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetPathLogicalUnitProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pPathOidListArray->oids[pa], &pathProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* cycle through and check status of each for */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* operation path count */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_PATH_STATE_OKAY == pathProps.pathState) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte numOperationalPaths++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_OP_PATH_COUNT), numOperationalPaths);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * showLogicalUnit -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mpathadm show {logical-unit | LU} <logical-unit name>, ...
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operandLen - number of operands user passed into the cli
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operand - pointer to operand list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteshowLogicalUnit(int operandLen, char *operand[])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_PLUGIN_PROPERTIES pluginProps;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_OID luOid, pluginOid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int op;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (op = 0; op < operandLen; op++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (op > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_TRUE == getLogicalUnitOid(operand[op], &luOid)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&luProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetMPLogicalUnitProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte luOid, &luProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetAssociatedPluginOid(luOid, &pluginOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetPluginProperties(pluginOid, &pluginProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (showIndividualLogicalUnit(luOid, luProps,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluginProps) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_LU_NOT_FOUND_WITH_MISSING_LU_STR),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte operand[op]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each operand */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * showIndivudualLogicalUnit -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used by show logical unit cli.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Displays info about an LU
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * luOid - LU to show
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * luProps - properties of he LU to show
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pluginProps - propertis of the plugin this LU belongs to
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteshowIndividualLogicalUnit(MP_OID luOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_PLUGIN_PROPERTIES pluginProps)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_PATH_LOGICAL_UNIT_PROPERTIES pathProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_TARGET_PORT_GROUP_PROPERTIES tpgProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_TARGET_PORT_PROPERTIES tportProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_INITIATOR_PORT_PROPERTIES initProps;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_OID_LIST *pPathOidListArray, *pTPGOidListArray,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh *pTportOidListArray;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t showTportLabel = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh int pa, tpg, tport;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s ", getTextString(TEXT_LB_LOGICAL_UNIT));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(luProps.deviceFileName, sizeof (luProps.deviceFileName));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s %s\n", getTextString(TEXT_LB_MPATH_SUPPORT),
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh pluginProps.fileName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s ", getTextString(TEXT_LB_VENDOR));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(luProps.vendor,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (luProps.vendor));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t%s ", getTextString(TEXT_LB_PRODUCT));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(luProps.product,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (luProps.product));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t%s ", getTextString(TEXT_LB_REVISION));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(luProps.revision,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (luProps.revision));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t%s ", getTextString(TEXT_LB_INQUIRY_NAME_TYPE));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayLogicalUnitNameTypeString(luProps.nameType);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t%s ", getTextString(TEXT_LB_INQUIRY_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(luProps.name, sizeof (luProps.name));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t%s %s\n", getTextString(TEXT_LB_ASYMMETRIC),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (MP_TRUE == luProps.asymmetric)?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_YES):getTextString(TEXT_NO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s ", getTextString(TEXT_LB_CURR_LOAD_BALANCE));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* don't ignore load balance type none. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (luProps.currentLoadBalanceType == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s", getTextString(TEXT_LBTYPE_NONE));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayLoadBalanceString(luProps.currentLoadBalanceType);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s ", getTextString(TEXT_LB_LU_GROUP_ID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0xffffffff == luProps.logicalUnitGroupID) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s\n", getTextString(TEXT_NA));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("0x%x\n", luProps.logicalUnitGroupID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s ", getTextString(TEXT_LB_AUTO_FB));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_FALSE == pluginProps.autoFailbackSupport) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s\n", getTextString(TEXT_NA));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s\n", (MP_TRUE == luProps.autoFailbackEnabled)?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ON):getTextString(TEXT_OFF));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s ", getTextString(TEXT_LB_AUTO_PROB));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_FALSE == pluginProps.autoProbingSupport) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s\n", getTextString(TEXT_NA));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s\n", (MP_TRUE == luProps.autoProbingEnabled)?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ON):getTextString(TEXT_OFF));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get path info */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_GetAssociatedPathOidList(luOid, &pPathOidListArray);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_LU_PATH_INFO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(luProps.deviceFileName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (luProps.deviceFileName));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t%s \n", getTextString(TEXT_LB_PATH_INFO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (pa = 0; pa < pPathOidListArray->oidCount; pa++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&pathProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_PATH_LOGICAL_UNIT_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_GetPathLogicalUnitProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pPathOidListArray->oids[pa], &pathProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_INIT_PORT_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetInitiatorPortProperties(pathProps.initiatorPortOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &initProps)) != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s\n", getTextString(TEXT_UNKNOWN));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(initProps.portID,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (initProps.portID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_TARGET_PORT_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetTargetPortProperties(pathProps.targetPortOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &tportProps)) != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s\n", getTextString(TEXT_UNKNOWN));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(tportProps.portID,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (tportProps.portID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s ", getTextString(TEXT_LB_OVERRIDE_PATH));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_FALSE == pluginProps.canOverridePaths) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s\n", getTextString(TEXT_NA));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (luProps.overridePath.objectSequenceNumber ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pPathOidListArray->oids[pa].objectSequenceNumber) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s\n", getTextString(TEXT_YES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s\n", getTextString(TEXT_NO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s %s\n", getTextString(TEXT_LB_PATH_STATE),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getPathStateStr(pathProps.pathState));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s %s\n\n", getTextString(TEXT_LB_DISABLED),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathProps.disabled?getTextString(TEXT_YES):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_NO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get tpg info */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_GetAssociatedTPGOidList(luOid, &pTPGOidListArray);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_ASSOC_TPGS));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* display tpg info only if is assymetric */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_TRUE == luProps.asymmetric) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s \n", getTextString(TEXT_LB_TPG_INFO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (tpg = 0; tpg < pTPGOidListArray->oidCount; tpg++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&tpgProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_TARGET_PORT_GROUP_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_GetTargetPortGroupProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pTPGOidListArray->oids[tpg], &tpgProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* display tpg info only if is assymetric */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (tpg > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_TRUE == luProps.asymmetric) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LB_ID),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tpgProps.tpgID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TEXT_LB_EXPLICIT_FAILOVER),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (MP_TRUE ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tpgProps.explicitFailover)?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_YES):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_NO));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TEXT_LB_ACCESS_STATE),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getAccessStateStr(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tpgProps.accessState));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* display label for each tpg. */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) printf("\t\t%s\n",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_TPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* display label once for symmetric. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_TRUE == showTportLabel) {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* begin back-up indentation */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) printf("\t%s\n",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_TPORT_LIST));
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh showTportLabel = B_FALSE;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* end back-up indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get target port info */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_GetTargetPortOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pTPGOidListArray->oids[tpg],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pTportOidListArray);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_ASSOC_TPORTS));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* begin back-up indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (tport = 0; tport < pTportOidListArray->oidCount; tport++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&tportProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_TARGET_PORT_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetTargetPortProperties(pTportOidListArray->oids[tport],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &tportProps)) != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_TRUE == luProps.asymmetric) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t\t%s ",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_LB_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(tportProps.portID,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh sizeof (tportProps.portID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t\t\t%s %d\n",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_LB_RELATIVE_ID),
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh tportProps.relativePortID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t\t%s ",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_LB_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(tportProps.portID,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh sizeof (tportProps.portID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t\t%s %d\n",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_LB_RELATIVE_ID),
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh tportProps.relativePortID);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* insert blank line if not the last target port. */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(tport == (pTportOidListArray->oidCount - 1))) {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each target port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* end back-up indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* else got target port props */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* else got TPG props */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each TPG */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* else got tpg list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * modifyLogicalUnit -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mpathadm modify {logical-unit | LU} [options] <logical-unit name>, ...
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operandLen - number of operands user passed into the cli
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operand - pointer to operand list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * options - pointer to option list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortemodifyLogicalUnit(int operandLen, char *operand[], cmdOptions_t *options)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_OID luOid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdOptions_t *optionList = options;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh char *cmdStr = getTextString(TEXT_UNKNOWN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int op;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (op = 0; op < operandLen; op++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_TRUE != getLogicalUnitOid(operand[op], &luOid)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_LU_NOT_FOUND_WITH_MISSING_LU_STR),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte operand[op]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* we found the lu oid, now change the options requested */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (optionList->optval) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'a':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* modify autofailback */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdStr = getTextString(TEXT_AUTO_FAILBACK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == strcasecmp(optionList->optarg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ON))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_EnableAutoFailback(luOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcasecmp(optionList->optarg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_OFF))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_DisableAutoFailback(luOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* begin back-up indentation */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* LINTED E_SEC_PRINTF_VAR_FMT */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) fprintf(stderr, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_CHANGE_OPTION_WITH_REASON),
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh cmdStr, getTextString(
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh TEXT_ILLEGAL_ARGUMENT));
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) printf("\n");
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh return (ERROR_CLI_FAILED);
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* start back-up indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'p':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* modify autoprobing */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdStr = getTextString(TEXT_AUTO_PROBING);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == strcasecmp(optionList->optarg,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ON))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_EnableAutoProbing(luOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcasecmp(optionList->optarg,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_OFF))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_DisableAutoProbing(luOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* begin back-up indentation */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* LINTED E_SEC_PRINTF_VAR_FMT */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) fprintf(stderr, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_CHANGE_OPTION_WITH_REASON),
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh cmdStr, getTextString(
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh TEXT_ILLEGAL_ARGUMENT));
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) printf("\n");
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh return (ERROR_CLI_FAILED);
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* end back-up indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'b':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* modify loadbalance type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdStr = getTextString(TEXT_LOAD_BALANCE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_SetLogicalUnitLoadBalanceType(luOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getLbValueFromString(optionList->optarg));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* switch */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_STATUS_SUCCESS != mpstatus) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_CHANGE_OPTION_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdStr, getMpStatusStr(mpstatus));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each operand */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * failoverLogicalUnit -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mpathadm failover {logical-unit | LU} <logical-unit name>, ...
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operand - pointer to operand list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortefailoverLogicalUnit(char *operand[])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_OID luOid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_TARGET_PORT_GROUP_PROPERTIES tpgProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_OID_LIST *pTpgOidListArray;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t bFoundIt = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_TPG_STATE_PAIR tpgStatePair;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int tpg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_TRUE != getLogicalUnitOid(operand[0], &luOid)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_LU_NOT_FOUND_WITH_MISSING_LU_STR),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte operand[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get LUN properties and check to be sure it's asymmetric */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&luProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetMPLogicalUnitProperties(luOid, &luProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_TRUE != luProps.asymmetric) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_LU_NOT_ASYMMETRIC));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get TPGs for this LUN */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetAssociatedTPGOidList(luOid, &pTpgOidListArray);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh cmdName, getTextString(ERR_NO_ASSOC_TPGS));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* pick a TPG whose state is active or standby, and change it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* to opposite via MP_SetTPGAccessState */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundIt = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (tpg = 0; tpg < pTpgOidListArray->oidCount; tpg++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&tpgProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_TARGET_PORT_GROUP_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetTargetPortGroupProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pTpgOidListArray->oids[tpg], &tpgProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_FALSE == tpgProps.explicitFailover) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh cmdName, getTextString(ERR_NO_FAILOVER_ALLOWED));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* find one that is standby */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((MP_ACCESS_STATE_STANDBY ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tpgProps.accessState) && (B_FALSE == bFoundIt)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tpgStatePair.tpgOid =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pTpgOidListArray->oids[tpg];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tpgStatePair.desiredState =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_ACCESS_STATE_ACTIVE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_SetTPGAccess(luOid, 1, &tpgStatePair);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_STATUS_SUCCESS != mpstatus) {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* begin back-up indentation */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* LINTED E_SEC_PRINTF_VAR_FMT */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) fprintf(stderr, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_FAILOVER_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getMpStatusStr(mpstatus));
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) printf("\n");
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh return (mpstatus);
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* end back-up indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each tpg */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == bFoundIt) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_LU_ACCESS_STATE_UNCHANGED));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * getLogicalUnitOid -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Search through all plugins and get the OID for specified logical unit
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * luFileName - file name of LU (specified by the user) to find
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pLuOid - OID to return
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortegetLogicalUnitOid(MP_CHAR *luFileName, MP_OID *pluOid)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_PLUGIN_PROPERTIES pluginProps;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_OID_LIST *pPluginOidList, *pLogicalUnitOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t foundIt = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh int i, lu;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int fd1, fd2;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh ddi_devid_t devid1, devid2;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (NULL == pluOid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* print some kind of error msg here - should never happen */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, getTextString(ERR_MEMORY_ALLOCATION));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluOid->objectSequenceNumber = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluOid->objectType = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluOid->ownerId = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus = MP_GetPluginOidList(&pPluginOidList))
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((NULL == pPluginOidList) || (pPluginOidList->oidCount < 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pPluginOidList->oidCount; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get properties so we can list the name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&pluginProps, 0, sizeof (MP_PLUGIN_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetPluginProperties(pPluginOidList->oids[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pluginProps)) != MP_STATUS_SUCCESS) {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) fprintf(stderr, "%s: %s\n",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh cmdName, getTextString(ERR_NO_PROPERTIES));
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* attempt to find this logical unit */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_GetMultipathLus(pPluginOidList->oids[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pLogicalUnitOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_LU_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (lu = 0; (lu < pLogicalUnitOidList->oidCount) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (B_FALSE == foundIt); lu++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get lu properties so we can check the name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&luProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetMPLogicalUnitProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pLogicalUnitOidList->oids[lu], &luProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh if (compareLUName(luFileName, luProps.deviceFileName)
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh == B_TRUE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte foundIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* user input didn't match, try via devid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * I don't see a reason to print the error for
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * any of these since they'll get the error at
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the end anyway
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim fd1 = fd2 = -1;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh devid1 = devid2 = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((fd1 = open(luFileName,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh O_RDONLY|O_NDELAY)) >= 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((fd2 = open(luProps.deviceFileName,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh O_RDONLY|O_NDELAY)) >= 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (devid_get(fd1, &devid1) == 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (devid_get(fd2, &devid2) == 0) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((NULL != devid1) && (NULL != devid2))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (devid_compare(devid1, devid2))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte foundIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (NULL != devid1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devid_free(devid1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (NULL != devid2) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte devid_free(devid2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim if (fd1 >= 0) {
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim (void) close(fd1);
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim }
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim if (fd2 >= 0) {
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim (void) close(fd2);
d3cfd299389905b5947a182ebffe96d3481b24e5Hyon Kim }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_TRUE == foundIt) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluOid->objectSequenceNumber =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pLogicalUnitOidList->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oids[lu].objectSequenceNumber;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluOid->objectType =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pLogicalUnitOidList->
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte oids[lu].objectType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pluOid->ownerId =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pLogicalUnitOidList->oids[lu].ownerId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (foundIt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * listInitiatorPort -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mpathadm list initiator-port [<initiator-port name>, ...]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operandLen - number of operands user passed into the cli
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operand - pointer to operand list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortelistInitiatorPort(int operandLen, char *operand[])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_INITIATOR_PORT_PROPERTIES initProps;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_OID_LIST *pPluginOidList, *pInitOidList;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t bListIt = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t *foundOp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh int ol, i, iport;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte foundOp = malloc((sizeof (boolean_t)) * operandLen);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (NULL == foundOp) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_MEMORY_ALLOCATION));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (ol = 0; ol < operandLen; ol++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte foundOp[ol] = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus = MP_GetPluginOidList(&pPluginOidList))
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((NULL == pPluginOidList) || (pPluginOidList->oidCount < 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pPluginOidList->oidCount; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetInitiatorPortOidList(pPluginOidList->oids[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pInitOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_INIT_PORT_LIST_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getMpStatusStr(mpstatus));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((NULL == pInitOidList) ||
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (pInitOidList->oidCount < 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_INIT_PORTS));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (iport = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iport < pInitOidList->oidCount; iport ++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bListIt = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetInitiatorPortProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pInitOidList->oids[iport],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &initProps)) != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if no operands listed, */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* list all we find */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == operandLen) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bListIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* check each operand */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Is it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* the one we want to list? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (ol = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ol < operandLen; ol++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strcmp(operand[ol],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte initProps.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portID)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bListIt =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte foundOp[ol] =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_TRUE == bListIt) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (listIndividualInitiatorPort(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte initProps) != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* list It */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each initiator port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* else found an init port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each plugin */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (ol = 0; ol < operandLen; ol++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == foundOp[ol]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_INIT_PORT_NOT_FOUND_WITH_MISSING_LU_STR),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte operand[ol]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * listIndividualInitiatorPort -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * used by listInitiatorPort to list info for one init port
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * initProps - properties of initiator port to list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortelistIndividualInitiatorPort(MP_INITIATOR_PORT_PROPERTIES initProps)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s ", getTextString(TEXT_LB_INITATOR_PORT));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(initProps.portID,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh sizeof (initProps.portID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * showInitiatorPort -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mpathadm show initiator-port <initiator-port name>, ...
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operandLen - number of operands user passed into the cli
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operand - pointer to operand list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteshowInitiatorPort(int operandLen, char *operand[])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_INITIATOR_PORT_PROPERTIES initProps;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_OID_LIST *pPluginOidList, *pInitOidList;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh boolean_t bListIt = B_FALSE, bFoundIt = B_FALSE;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh int op, i, iport;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus = MP_GetPluginOidList(&pPluginOidList))
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((NULL == pPluginOidList) || (pPluginOidList->oidCount < 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (op = 0; op < operandLen; op++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundIt = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pPluginOidList->oidCount; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetInitiatorPortOidList(pPluginOidList->oids[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pInitOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_NO_INIT_PORT_LIST_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getMpStatusStr(mpstatus));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((NULL == pInitOidList) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pInitOidList->oidCount < 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_INIT_PORTS));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (iport = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iport < pInitOidList->oidCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iport ++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bListIt = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetInitiatorPortProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pInitOidList->oids[iport],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &initProps))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != MP_STATUS_SUCCESS) {
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* begin back-up indentation */
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (void) fprintf(stderr,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_PROPERTIES));
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh /* end back-up indentation */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == strcmp(operand[op],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte initProps.portID)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bListIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_TRUE == bListIt) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh showIndividualInitiatorPort(
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh initProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 != mpstatus) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* list It */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each initiator port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* else found an init port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each plugin */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == bFoundIt) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* need temp string here since we need to fill in a */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* name in the error string */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_INIT_PORT_NOT_FOUND_WITH_MISSING_LU_STR),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte operand[op]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each operand */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * showIndividualInitiatorPort -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * used by showInitiatorPort to show info for one init port
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * initProps - properties of initiator port to show
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteshowIndividualInitiatorPort(MP_INITIATOR_PORT_PROPERTIES initProps)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s ", getTextString(TEXT_LB_INITATOR_PORT));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(initProps.portID,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (initProps.portID));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n\t%s ", getTextString(TEXT_LB_TRANSPORT_TYPE));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayTransportTypeString(initProps.portType);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\t%s ", getTextString(TEXT_LB_OS_DEVICE_FILE));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte displayArray(initProps.osDeviceFile,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (initProps.osDeviceFile));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * enablePath -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mpathadm enable path -i <initiator-port>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * -t <target-port name> -l <logical-unit name>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * options - pointer to option list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteenablePath(cmdOptions_t *options)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_OID pathOid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdOptions_t *optionList = options;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh boolean_t bHaveInit = B_FALSE, bHaveTarg = B_FALSE, bHaveLu = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (; optionList->optval; optionList++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (optionList->optval) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'i':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* have init port name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bHaveInit = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 't':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* have target port id */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bHaveTarg = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'l':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* have LU name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bHaveLu = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == bHaveInit) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_FAILED_TO_ENABLE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(MISSING_INIT_PORT_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (B_FALSE == bHaveTarg) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_FAILED_TO_ENABLE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(MISSING_TARGET_PORT_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (B_FALSE == bHaveLu) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_FAILED_TO_ENABLE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(MISSING_LU_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == getPathOid(options, &pathOid)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_FAILED_TO_ENABLE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(FAILED_TO_FIND_PATH));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* found the path, attempt to enable it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_EnablePath(pathOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_FAILED_TO_ENABLE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getMpStatusStr(mpstatus));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * disablePath -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mpathadm disable path -i <initiator-port>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * -t <target-port name> -l <logical-unit name>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * options - pointer to option list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortedisablePath(cmdOptions_t *options)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_OID pathOid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdOptions_t *optionList = options;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh boolean_t bHaveInit = B_FALSE, bHaveTarg = B_FALSE,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh bHaveLu = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (; optionList->optval; optionList++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (optionList->optval) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'i':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* have init port name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bHaveInit = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 't':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* have target port id */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bHaveTarg = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'l':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* have LU name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bHaveLu = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == bHaveInit) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_FAILED_TO_DISABLE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(MISSING_INIT_PORT_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (B_FALSE == bHaveTarg) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_FAILED_TO_DISABLE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(MISSING_TARGET_PORT_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (B_FALSE == bHaveLu) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_FAILED_TO_DISABLE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(MISSING_LU_NAME));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == getPathOid(options, &pathOid)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_FAILED_TO_DISABLE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(FAILED_TO_FIND_PATH));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* found the path, attempt to enable it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_DisablePath(pathOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_STATUS_SUCCESS != mpstatus) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_DISABLE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getMpStatusStr(mpstatus));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * overridePath -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mpathadm override path {-i <initiator-port>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * -t <target-port name> | -c} <logical-unit name>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * options - pointer to option list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteoverridePath(cmdOptions_t *options)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_OID pathOid, luOid;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t bCancelOverride = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_CHAR pLuDeviceFileName[256];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdOptions_t *optionList = options;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* First check to see if we have the cancel option, */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* May as well save off the lun while we're at it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (; optionList->optval; optionList++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (optionList->optval) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'c':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* we have a cancel */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bCancelOverride = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'l':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* we have a lun- save it while we're here */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memcpy(pLuDeviceFileName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte optionList->optarg, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_TRUE == bCancelOverride) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if we have the cancel option, */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (getLogicalUnitOid(pLuDeviceFileName, &luOid) == B_FALSE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_CANCEL_OVERRIDE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(LU_NOT_FOUND));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* cancel the override path for the specified LU */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_CancelOverridePath(luOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MP_STATUS_SUCCESS != mpstatus) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_CANCEL_OVERRIDE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getMpStatusStr(mpstatus));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* must be wanting to override the path */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (getLogicalUnitOid(pLuDeviceFileName, &luOid) == B_FALSE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_OVERRIDE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(LU_NOT_FOUND));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (B_FALSE == getPathOid(options, &pathOid)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_OVERRIDE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(FAILED_TO_FIND_PATH));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* attempt to set the override path */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_SetOverridePath(luOid, pathOid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_OVERRIDE_PATH_WITH_REASON),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getMpStatusStr(mpstatus));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (mpstatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * getPathOid -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Search through all plugins and get the OID for specified path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * operand - pointer to operand list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * options - pointer to option list from user
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortegetPathOid(cmdOptions_t *options, MP_OID *pPathOid)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_STATUS mpstatus = MP_STATUS_SUCCESS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES luProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_PATH_LOGICAL_UNIT_PROPERTIES pathProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_INITIATOR_PORT_PROPERTIES initProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_TARGET_PORT_PROPERTIES targProps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh MP_OID_LIST *pPluginOidList, *pLogicalUnitOidList,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh *pathOidListArray;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t bFoundIt = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_CHAR initPortID[256];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_CHAR targetPortID[256];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_CHAR luDeviceFileName[256];
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh boolean_t bHaveTarg = B_FALSE, bHaveLu = B_FALSE,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh bHaveInit = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdOptions_t *optionList = options;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh int i, lu, pa;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (NULL == pPathOid) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (; optionList->optval; optionList++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (optionList->optval) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'i':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* save init port name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memcpy(initPortID,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte optionList->optarg, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bHaveInit = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 't':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* save target port id */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memcpy(targetPortID,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte optionList->optarg, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bHaveTarg = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case 'l':
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* save LU name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memcpy(luDeviceFileName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte optionList->optarg, 256);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bHaveLu = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((B_FALSE == bHaveInit) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (B_FALSE == bHaveTarg) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (B_FALSE == bHaveLu)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if we don't have all three pieces, we can't find the path */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get the plugin ist */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((mpstatus = MP_GetPluginOidList(&pPluginOidList))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((NULL == pPluginOidList) || (pPluginOidList->oidCount < 1)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_MPATH_SUPPORT_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < pPluginOidList->oidCount; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get Logical Unit list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_GetMultipathLus(pPluginOidList->oids[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pLogicalUnitOidList);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_LU_LIST));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (lu = 0; (lu < pLogicalUnitOidList->oidCount) &&
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (B_FALSE == bFoundIt); lu++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get lu properties so we can check the name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset(&luProps, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (MP_MULTIPATH_LOGICAL_UNIT_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetMPLogicalUnitProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pLogicalUnitOidList->oids[lu], &luProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName, getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh if (compareLUName(luDeviceFileName,
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh luProps.deviceFileName) == B_TRUE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get paths for this LU and search from here */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetAssociatedPathOidList(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pLogicalUnitOidList->oids[lu],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pathOidListArray);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED E_SEC_PRINTF_VAR_FMT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_FAILED_TO_FIND_PATH));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (pa = 0;
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (pa < pathOidListArray->oidCount) &&
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh (B_FALSE == bFoundIt); pa++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetPathLogicalUnitProperties
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pathOidListArray->oids[pa],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &pathProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * get properties of iniator port and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * target port to see if we have the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * right path
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_GetInitiatorPortProperties(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathProps.initiatorPortOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &initProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == strcmp(initPortID, initProps.portID)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* lu and init port matches, check target port */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mpstatus = MP_GetTargetPortProperties(pathProps.targetPortOid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &targProps);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mpstatus != MP_STATUS_SUCCESS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_NO_PROPERTIES));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (B_FALSE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == strcmp(targetPortID, targProps.portID)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* we found our path */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pPathOid->objectSequenceNumber =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathOidListArray->oids[pa].objectSequenceNumber;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pPathOid->objectType =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathOidListArray->oids[pa].objectType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pPathOid->ownerId = pathOidListArray->oids[pa].ownerId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bFoundIt = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* init port matched */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each path associated with this lu */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* lu matched */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each lu */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* for each plugin */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (bFoundIt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * getLbValueFromString
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the MP_LOAD_BALANCE_TYPE specified load balance type string
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lbStr - load balance string defined in the .h file
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is what users will be required to feed into the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * modify lu command.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteMP_LOAD_BALANCE_TYPE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortegetLbValueFromString(char *lbStr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_LOAD_BALANCE_TYPE lbVal = MP_LOAD_BALANCE_TYPE_UNKNOWN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (0 == strcmp(lbStr, getTextString(TEXT_LBTYPE_ROUNDROBIN))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = MP_LOAD_BALANCE_TYPE_ROUNDROBIN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr, getTextString(TEXT_LBTYPE_LEASTBLOCKS))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = MP_LOAD_BALANCE_TYPE_LEASTBLOCKS;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr, getTextString(TEXT_LBTYPE_LEASTIO))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = MP_LOAD_BALANCE_TYPE_LEASTIO;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr, getTextString(TEXT_LBTYPE_DEVICEPROD))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = MP_LOAD_BALANCE_TYPE_DEVICE_PRODUCT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr, getTextString(TEXT_LBTYPE_LBAREGION))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = MP_LOAD_BALANCE_TYPE_LBA_REGION;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_FAILOVER_ONLY))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = MP_LOAD_BALANCE_TYPE_FAILOVER_ONLY;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr, getTextString(TEXT_LBTYPE_UNKNOWN))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = MP_LOAD_BALANCE_TYPE_UNKNOWN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr, getTextString(TEXT_LBTYPE_NONE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY1))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<16;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY2))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<17;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY3))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<18;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY4))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<19;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY5))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<20;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY6))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<21;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY7))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<22;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY8))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<23;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY9))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<24;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY10))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<25;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY11))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<26;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY12))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<27;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY13))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<28;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY14))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<29;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY15))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<30;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (0 == strcmp(lbStr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_LBTYPE_PROPRIETARY16))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbVal = ((MP_UINT32)0x00000001)<<31;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (lbVal);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* end getLbValueFromString */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * displayLogicalUnitNameTypeString
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Displays the text equivalent string for the MP_LOGICAL_UNIT_NAME_TYPE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specified load balance type
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * typeVal - load balance type defined in the MPAPI spec
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortedisplayLogicalUnitNameTypeString(MP_LOGICAL_UNIT_NAME_TYPE typeVal)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *typeString;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (typeVal) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_LU_NAME_TYPE_UNKNOWN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeString = getTextString(TEXT_NAME_TYPE_UNKNOWN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_LU_NAME_TYPE_VPD83_TYPE1:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeString = getTextString(TEXT_NAME_TYPE_VPD83_TYPE1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_LU_NAME_TYPE_VPD83_TYPE2:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeString = getTextString(TEXT_NAME_TYPE_VPD83_TYPE2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_LU_NAME_TYPE_VPD83_TYPE3:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeString = getTextString(TEXT_NAME_TYPE_VPD83_TYPE3);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_LU_NAME_TYPE_DEVICE_SPECIFIC:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeString =
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh getTextString(TEXT_NAME_TYPE_DEVICE_SPECIFIC);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typeString = getTextString(TEXT_UNKNOWN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s", typeString);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* end displayLogicalUnitNameTypeString */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * displayLoadBalanceString
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Displays the text equivalent string for the MP_LOAD_BALANCE_TYPE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specified load balance type
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lbVal - load balance type defined in the MPAPI spec
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortedisplayLoadBalanceString(MP_LOAD_BALANCE_TYPE lbVal)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *lbString;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (lbVal) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_LOAD_BALANCE_TYPE_UNKNOWN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_UNKNOWN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_LOAD_BALANCE_TYPE_ROUNDROBIN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_ROUNDROBIN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_LOAD_BALANCE_TYPE_LEASTBLOCKS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_LEASTBLOCKS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_LOAD_BALANCE_TYPE_LEASTIO:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_LEASTIO);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_LOAD_BALANCE_TYPE_DEVICE_PRODUCT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_DEVICEPROD);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_LOAD_BALANCE_TYPE_LBA_REGION:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_LBAREGION);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_LOAD_BALANCE_TYPE_FAILOVER_ONLY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_FAILOVER_ONLY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<16):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<17):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<18):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY3);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<19):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<20):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY5);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<21):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY6);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<22):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY7);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<23):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY8);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<24):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY9);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<25):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY10);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<26):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY11);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<27):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY12);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<28):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY13);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<29):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY14);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<30):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY15);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case (((MP_UINT32)0x00000001)<<31):
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_LBTYPE_PROPRIETARY16);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte lbString = getTextString(TEXT_UNKNOWN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s", lbString);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* end displayLoadBalanceString */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * displayTransportTypeString
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Displays the text equivalent string for the MP_PORT_TRANSPORT_TYPE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specified load balance type
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * transportTypeVal - transport type defined in the MPAPI spec
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortedisplayTransportTypeString(MP_PORT_TRANSPORT_TYPE transportTypeVal)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *ttypeString;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (transportTypeVal) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PORT_TRANSPORT_TYPE_MPNODE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ttypeString =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_TRANS_PORT_TYPE_MPNODE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PORT_TRANSPORT_TYPE_FC:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ttypeString = getTextString(TEXT_TRANS_PORT_TYPE_FC);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PORT_TRANSPORT_TYPE_SPI:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ttypeString = getTextString(TEXT_TRANS_PORT_TYPE_SPI);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PORT_TRANSPORT_TYPE_ISCSI:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ttypeString = getTextString(TEXT_TRANS_PORT_TYPE_ISCSI);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PORT_TRANSPORT_TYPE_IFB:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ttypeString = getTextString(TEXT_TRANS_PORT_TYPE_IFB);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ttypeString = getTextString(TEXT_UNKNOWN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%s", ttypeString);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* end displayTransportTypeString */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * getMpStatusStr
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the string description for the specified load balance type value
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * mpstatus - MP_STATUS value
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortegetMpStatusStr(MP_STATUS mpstatus)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *statString;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (mpstatus) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_SUCCESS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_SUCCESS);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_INVALID_PARAMETER:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_INV_PARAMETER);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_UNKNOWN_FN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_UNKNOWN_FN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_FAILED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_INSUFFICIENT_MEMORY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_INSUFF_MEMORY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_INVALID_OBJECT_TYPE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_INV_OBJ_TYPE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_UNSUPPORTED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_UNSUPPORTED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_OBJECT_NOT_FOUND:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_OBJ_NOT_FOUND);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_ACCESS_STATE_INVALID:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_UNSUPPORTED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_FN_REPLACED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_FN_REPLACED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_PATH_NONOPERATIONAL:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_PATH_NONOP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_TRY_AGAIN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_TRY_AGAIN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_STATUS_NOT_PERMITTED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_MPSTATUS_NOT_PERMITTED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte statString = getTextString(TEXT_UNKNOWN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (statString);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* end getMpStatusStr */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * GetPathStateStr
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the string description for the specified path state type value
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pathState - MP_PATH_STATE values
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortegetPathStateStr(MP_PATH_STATE pathState)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *pathString;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (pathState) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PATH_STATE_OKAY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathString = getTextString(TEXT_PATH_STATE_OKAY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PATH_STATE_PATH_ERR:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathString = getTextString(TEXT_PATH_STATE_PATH_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PATH_STATE_LU_ERR:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathString = getTextString(TEXT_PATH_STATE_LU_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PATH_STATE_RESERVED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathString = getTextString(TEXT_PATH_STATE_RESERVED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PATH_STATE_REMOVED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathString = getTextString(TEXT_PATH_STATE_REMOVED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PATH_STATE_TRANSITIONING:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathString =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_PATH_STATE_TRANSITIONING);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PATH_STATE_OPERATIONAL_CLOSED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathString =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_PATH_STATE_OPERATIONAL_CLOSED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PATH_STATE_INVALID_CLOSED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathString =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_PATH_STATE_INVALID_CLOSED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_PATH_STATE_OFFLINE_CLOSED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathString =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_PATH_STATE_OFFLINE_CLOSED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pathString = getTextString(TEXT_UNKNOWN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (pathString);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* end getPathStateStr */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * getAccessStateStr
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Gets the string description for the specified access state type value
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * accessState - MP_ACCESS_STATE_TYPE values
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortechar *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortegetAccessStateStr(MP_ACCESS_STATE_TYPE accessState)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *accessString;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (accessState) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_ACCESS_STATE_ACTIVE_OPTIMIZED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte accessString =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ACCESS_STATE_ACTIVE_OPTIMIZED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_ACCESS_STATE_ACTIVE_NONOPTIMIZED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte accessString =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte TEXT_ACCESS_STATE_ACTIVE_NONOPTIMIZED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_ACCESS_STATE_STANDBY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte accessString =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ACCESS_STATE_STANDBY);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_ACCESS_STATE_UNAVAILABLE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte accessString =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ACCESS_STATE_UNAVAILABLE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_ACCESS_STATE_TRANSITIONING:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte accessString =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_ACCESS_STATE_TRANSITIONING);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MP_ACCESS_STATE_ACTIVE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte accessString = getTextString(TEXT_ACCESS_STATE_ACTIVE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte accessString = getTextString(TEXT_UNKNOWN);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (accessString);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* end getAccessStateStr */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * displayArray
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Print out the specified array.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arrayToDisplay - array to display
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arraySize - size of array to display
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortedisplayArray(MP_CHAR *arrayToDisplay, int arraySize)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < arraySize; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ('\0' != arrayToDisplay[i]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%c", arrayToDisplay[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * getStringArray
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Return a null terminated array for the specified array as a string,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is used for inputting into the %s in formatted strings.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arrayToDisplay - array to display
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arraySize - size of array to display
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteMP_CHAR *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortegetStringArray(MP_CHAR *arrayToDisplay, int arraySize)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MP_CHAR *newStr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte newStr = malloc(((sizeof (MP_CHAR)) * arraySize) + 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (NULL == newStr) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(ERR_MEMORY_ALLOCATION));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < arraySize; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte newStr[i] = arrayToDisplay[i];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte newStr[arraySize] = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (newStr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * displayWideArray
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Print out the specified wide character array as a string,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * adding the null termination
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arrayToDisplay - array to display
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * arraySize - size of array to display
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortedisplayWideArray(MP_WCHAR *arrayToDisplay, int arraySize)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int numChars = arraySize/4;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < numChars; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (L'\0' != arrayToDisplay[i]) {
ad8ef92ae01ac09e533731f5a517162c634308b4Milan Jurik (void) fprintf(stdout, "%wc", (int)arrayToDisplay[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * listfunc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used by cmdparse for list clis
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortelistFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *addArgs)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ret = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (object) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MPATH_SUPPORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = listMpathSupport(operandLen, operand);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case LOGICAL_UNIT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = listLogicalUnit(operandLen, operand, options);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case INITIATOR_PORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = listInitiatorPort(operandLen, operand);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
4c06356b0f0fffb4fc1b6eccc8e5d8e2254a84d6dh cmdName, getTextString(TEXT_UNKNOWN_OBJECT));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ret);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * showFunc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * used bycmdparse for show clis
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteshowFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *addArgs)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ret = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (object) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MPATH_SUPPORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = showMpathSupport(operandLen, operand);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case LOGICAL_UNIT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = showLogicalUnit(operandLen, operand);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case INITIATOR_PORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = showInitiatorPort(operandLen, operand);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ret);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * modifyFunc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used by cmdparse for midify clis
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortemodifyFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *addArgs)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ret = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (object) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case MPATH_SUPPORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = modifyMpathSupport(operandLen, operand, options);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case LOGICAL_UNIT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = modifyLogicalUnit(operandLen, operand, options);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ret);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * enableFunc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used by cmdpars for enable clis
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteenableFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *addArgs)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ret = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (object) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PATH:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = enablePath(options);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ret);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * disableFunc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used by cmdpars for disable clis
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortedisableFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *addArgs)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ret = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (object) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PATH:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = disablePath(options);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ret);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * failoverFunc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used by cmdpars for failover clis
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn FortefailoverFunc(int operandLen, char *operand[], int object, cmdOptions_t *options,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *addArgs)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ret = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (object) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case LOGICAL_UNIT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = failoverLogicalUnit(operand);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ret);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * overrideFunc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Used by cmdpars for override clis
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * ****************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteoverrideFunc(int operandLen, char *operand[],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int object, cmdOptions_t *options,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *addArgs)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ret = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (object) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PATH:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = overridePath(options);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ret);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * *************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * main
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * *************************************************************************
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemain(int argc, char *argv[])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte synTables_t synTables;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char versionString[VERSION_STRING_MAX_LEN];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ret;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int funcRet;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *subcommandArgs = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set global command name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cmdName = getExecBasename(argv[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(versionString, "%2s.%2s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte VERSION_STRING_MAJOR, VERSION_STRING_MINOR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte synTables.versionString = versionString;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte synTables.longOptionTbl = &longOptions[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte synTables.subcommandTbl = &subcommands[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte synTables.objectTbl = &objects[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte synTables.objectRulesTbl = &objectRules[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte synTables.optionRulesTbl = &optionRules[0];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ret = cmdParse(argc, argv, /* SUB_COMMAND_ISSUED, */ synTables,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte subcommandArgs, &funcRet);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ret == 1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stdout, "%s %s(1M)\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getTextString(TEXT_MORE_INFO), cmdName);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ERROR_CLI_FAILED);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ret == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte perror(argv[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (funcRet != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argv[0], getTextString(TEXT_UNABLE_TO_COMPLETE));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* end main */