sasinfo.c revision 9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bb
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * CDDL HEADER START
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * The contents of this file are subject to the terms of the
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Common Development and Distribution License (the "License").
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * You may not use this file except in compliance with the License.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * See the License for the specific language governing permissions
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * and limitations under the License.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * When distributing Covered Code, include this CDDL HEADER in each
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * If applicable, add the following below this CDDL HEADER, with the
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * fields enclosed by brackets "[]" replaced with your own identifying
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * information: Portions Copyright [yyyy] [name of copyright owner]
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * CDDL HEADER END
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Use is subject to license terms.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Version number:
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * MAJOR - This should only change when there is an incompatible change made
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * to the interfaces or the output.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * MINOR - This should change whenever there is a new command or new feature
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * with no incompatible change.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim/* globals */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kimstatic char *cmdName;
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim/* forward declarations */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kimstatic int listHbaFunc(int, char **, cmdOptions_t *, void *);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kimstatic int listHbaPortFunc(int, char **, cmdOptions_t *, void *);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kimstatic int listExpanderFunc(int, char **, cmdOptions_t *, void *);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kimstatic int listTargetPortFunc(int, char **, cmdOptions_t *, void *);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kimstatic int listLogicalUnitFunc(int, char **, cmdOptions_t *, void *);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kimstatic char *getExecBasename(char *);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Add new options here
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Optional option-arguments are not allowed by CLIP
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim {"hba-port", required_argument, 'p', "HBA Port Name"},
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Add new subcommands here
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim OPERAND_OPTIONAL_MULTIPLE, "Expander Device SAS Address"},
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim {"target-port", listTargetPortFunc, "sv", NULL, "sv",
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim OPERAND_OPTIONAL_MULTIPLE, "Target Port SAS Address"},
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim {"logical-unit", listLogicalUnitFunc, "v", NULL, NULL,
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Pass in options/arguments, rest of arguments
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim/*ARGSUSED*/
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon KimlistHbaFunc(int objects, char *argv[], cmdOptions_t *options, void *addArgs)
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim return (sas_util_list_hba(objects, argv, options));
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim/*ARGSUSED*/
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon KimlistHbaPortFunc(int objects, char *argv[], cmdOptions_t *options, void *addArgs)
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim return (sas_util_list_hbaport(objects, argv, options));
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Pass in options/arguments, rest of arguments
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim/*ARGSUSED*/
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon KimlistExpanderFunc(int objects, char *argv[], cmdOptions_t *options,
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim return (sas_util_list_expander(objects, argv, options));
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim/*ARGSUSED*/
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon KimlistTargetPortFunc(int objects, char *argv[], cmdOptions_t *options,
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim return (sas_util_list_targetport(objects, argv, options));
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * Pass in options/arguments, rest of arguments
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim/*ARGSUSED*/
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon KimlistLogicalUnitFunc(int objects, char *argv[], cmdOptions_t *options,
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim return (sas_util_list_logicalunit(objects, argv, options));
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * execFullName - exec name of program (argv[0])
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * command name portion of execFullName
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kimstatic char *
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* guard against '/' at end of command invocation */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * main calls a parser that checks syntax of the input command against
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * various rules tables.
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim * The return value from the function is placed in funcRet
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* to support locale */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim#define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* set global command name */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* check if is global zone */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim cmdName, gettext("does not support non-global zone."));
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim return (1);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim (void *) snprintf(versionString, sizeof (versionString), "%s.%s",
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim synTables.subCommandPropsTbl = &sasinfosubcommands[0];
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim /* call the CLI parser */
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim ret = cmdParse(argc, argv, synTables, subcommandArgs, &funcRet);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim gettext("For more information, please see"), cmdName);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim return (1);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim return (1);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim return (1);
9e86db79b7d1bbc5f2f04e99954cbd5eae0e22bbHyon Kim return (0);