fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
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 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
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 * CDDL HEADER END
7b506e25917c371db526f76d85b9b1d17c8c5d39srivijitha dugganapalli * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
33f5ff17089e3a43e6e730bf80384c233123dbd9Milan Jurik * Copyright 2012 Milan Jurik. All rights reserved.
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetostatic char *getExecBasename(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint delete_lu(int argc, char *argv[], cmdOptions_t *options,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint create_lu(int argc, char *argv[], cmdOptions_t *options, void *callData);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint list_lus(int argc, char *argv[], cmdOptions_t *options, void *callData);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint modify_lu(int argc, char *argv[], cmdOptions_t *options, void *callData);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetoint import_lu(int argc, char *argv[], cmdOptions_t *options, void *callData);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetostatic int callModify(char *, stmfGuid *, uint32_t, const char *, const char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Size with <none>/k/m/g/t/p/e modifier" },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Dont delete view entries related to the LU" },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Full path of the file to initialize" },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OPERAND_MANDATORY_SINGLE, "GUID of the LU to deregister" },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte OPERAND_MANDATORY_SINGLE, "filename of the LU to import" },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Full path of the LU or GUID of a registered LU" },
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetocreate_lu(int argc, char *operands[], cmdOptions_t *options, void *callData)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto cmdName, gettext("Failure to create lu resource\n"));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto ret = stmfSetLuProp(hdl, STMF_LU_PROP_FILENAME, operands[0]);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (void) fprintf(stderr, "%s: filename %s: %s\n", cmdName,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetoimport_lu(int argc, char *operands[], cmdOptions_t *options, void *callData)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto ret = stmfImportLu(STMF_DISK, operands[0], &createdGuid);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (void) fprintf(stderr, "%s: filename %s: %s\n", cmdName,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodelete_lu(int operandLen, char *operands[], cmdOptions_t *options,
7b506e25917c371db526f76d85b9b1d17c8c5d39srivijitha dugganapalli boolean_t notValidHexNumber = B_FALSE;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /* Keep views for logical unit */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto for (i = 0; i < operandLen; i++) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto for (j = 0; j < GUID_INPUT; j++) {
7b506e25917c371db526f76d85b9b1d17c8c5d39srivijitha dugganapalli if ((notValidHexNumber == B_TRUE) ||
7b506e25917c371db526f76d85b9b1d17c8c5d39srivijitha dugganapalli (strlen(operands[i]) != GUID_INPUT)) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto &inGuid[12], &inGuid[13], &inGuid[14], &inGuid[15]);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto for (j = 0; j < sizeof (stmfGuid); j++) {
7b506e25917c371db526f76d85b9b1d17c8c5d39srivijitha dugganapalli /* check if viewEntryList is empty */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if ((!viewEntriesRemoved && noLunFound && !views) ||
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto noLunFound = viewEntriesRemoved = views = B_FALSE;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetomodify_lu(int operandLen, char *operands[], cmdOptions_t *options,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /* check input length */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (!fnameUsed && strlen(operands[0]) != GUID_INPUT) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (void) fprintf(stderr, "%s: %s: %s%d%s\n", cmdName, operands[0],
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /* convert to lower case for scan */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto for (i = 0; i < 32; i++)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto &guid[0], &guid[1], &guid[2], &guid[3], &guid[4], &guid[5],
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto &guid[6], &guid[7], &guid[8], &guid[9], &guid[10],
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto &guid[11], &guid[12], &guid[13], &guid[14], &guid[15]);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto for (i = 0; i < sizeof (stmfGuid); i++) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "size") != 0) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetocallModify(char *fname, stmfGuid *luGuid, uint32_t prop, const char *propVal,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto stmfRet = stmfModifyLuByFname(STMF_DISK, fname, prop,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (void) fprintf(stderr, "%s: %s: %s: %d\n", cmdName,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortelist_lus(int argc, char *argv[], cmdOptions_t *options, void *callData)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto stmfRet = stmfGetLogicalUnitProperties(&luList->guid[i],
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto stmfRet = stmfGetLogicalUnitProperties(&luList->guid[i],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " SOURCE\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("-------------------------------- -------------------"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " ----------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < 16; i++) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if ((stmfRet = stmfGetLuResource(guid, &hdl)) != STMF_STATUS_SUCCESS) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /* No error here */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto stmfRet = stmfGetLuProp(hdl, STMF_LU_PROP_SIZE, propVal,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto stmfRet = stmfGetLuProp(hdl, STMF_LU_PROP_FILENAME, propVal,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * execFullName - exec name of program (argv[0])
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * copied from usr/src/cmd/zoneadm/zoneadm.c in OS/Net
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * (changed name to lowerCamelCase to keep consistent with this file)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * command name portion of execFullName
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetostatic char *
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /* guard against '/' at end of command invocation */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /* set global command name */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (void) snprintf(versionString, VERSION_STRING_MAX_LEN, "%s.%s",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto ret = cmdParse(argc, argv, synTables, subcommandArgs, &funcRet);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (ret != 0) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto} /* end main */