2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A * This file contains helper routines for the FP plugin 2N/A/* defines for nftw() */ 2N/A/* Function prototypes */ 2N/A * The string table contains most of the strings used by the fp cfgadm plugin. 2N/A * All strings which are to be internationalized must be in this table. 2N/A * Some strings which are not internationalized are also included here. 2N/A * Arguments to messages are NOT internationalized. 2N/A * The first element (ERR_UNKNOWN) MUST always be present in the array. 2N/A/* msg_code num_args, I18N msg_string */ 2N/A "Configuration successful, but Repository update failed"},
2N/A "Unconfiguration successful, but Repository update failed"},
2N/A "Operation partially successful. Some failures seen"},
2N/A "HBA load library failed"},
2N/A "No match HBA port found"},
2N/A "No Fibre Channel adpaters found"},
2N/A/* Errors with arguments */ 2N/A "failed to create device node... Device may be unconfigurable: "},
2N/A/* Fibre Channel operation Errors */ 2N/A "Failed to initialize device map for: "},
2N/A "\t-c configure -o force_update ap_id [ap_id..]\n" 2N/A "\t-c configure -o no_update ap_id [ap_id...]\n" 2N/A "\t-c unconfigure -o force_update ap_id [ap_id... ]\n" 2N/A "\t-c unconfigure -o no_update ap_id [ap_id... ]\n"},
2N/A/* hotplug messages */ 2N/A/* Hotplugging confirmation prompts */ 2N/A "This operation will suspend activity on FC bus: "},
2N/A "FC bus quiesced successfully.\n" 2N/A "It is now safe to proceed with hotplug operation." 2N/A "\nEnter y if operation is complete or n to abort"},
2N/A "WARNING: Disconnecting critical partitions may cause system hang." 2N/A/* Order is important. Earlier directories are searched first */ 2N/A * Routine to search the /dev directory or a subtree of /dev. 2N/A * If the entire /dev hierarchy is to be searched, the most likely directories 2N/A * are searched first. 2N/A * Search certain selected subdirectories first if basedir == "/dev". 2N/A * Ignore errors as some of these directories may not exist. 2N/A /* We want only VALID symlinks */ 2N/A /* terminate prematurely, but may not be error */ 2N/A * Removes duplicate slashes from a pathname and any trailing slashes. 2N/A * Returns "/" if input is "/" 2N/A /* Remove trailing slash except if it is the first char */ 2N/A /* Extract the base(hba) and dynamic(device) component if any */ 2N/A /* Remove the dynamic component from the base. */ 2N/A /* Get the path of dynamic attachment point if already configured. */ 2N/A /* Fix up path for di_init() */ 2N/A /* Remove dynamic component if any */ 2N/A /* Remove minor name if any */ 2N/A * If force_flag is set 2N/A * do di_init with DINFOFORCE flag and get to the input fp node 2N/A * from the device tree. 2N/A * In order to get the link between path_info node and scsi_vhci node 2N/A * it is required to take the snapshot of the whole device tree. 2N/A * this behavior of libdevinfo is inefficient. For a specific 2N/A * fca port DINFOPROP was sufficient on the fca path prior to 2N/A * scsi_vhci node support. 2N/A /* The string table index and the error id may or may not be same */ 2N/A * cfga_err() accepts a variable number of message IDs and constructs 2N/A * a corresponding error string which is returned via the errstring argument. 2N/A * cfga_err() calls dgettext() to internationalize proper messages. 2N/A * May be called with a NULL argument. 2N/A * Don't append a newline, the application (for example cfgadm) 2N/A * *errstring != NULL 2N/A * There was something in errstring prior to this call. 2N/A * So, concatenate the old and new strings 2N/A /* In case of error, retain only the earlier message */ 2N/A * This routine accepts a variable number of message IDs and constructs 2N/A * a corresponding message string which is printed via the message print 2N/A /* Append a newline after message */ 2N/A * Get internationalized string corresponding to message id 2N/A * Caller must free the memory allocated. 2N/A for (i = 0; i <= n; i++) {
2N/A }
else if (i == 0) {
2N/A len +=
1;
/* terminating NULL */ 2N/A * Fix up path for calling devctl. 2N/A /* Remove dynamic component if any */ 2N/A /* Remove minor name */ 2N/A /* Only getstate functions require a second argument */ 2N/A * Is device in a known state ? (One of BUSY, ONLINE, OFFLINE) 2N/A * BUSY --> One or more device special files are open. Implies online 2N/A * ONLINE --> driver attached 2N/A * OFFLINE --> CF1 with offline flag set. 2N/A * UNKNOWN --> None of the above 2N/A * CF1 without offline flag set is considered unknown state. 2N/A * We are in a known state if either CF2 (driver attached) or 2N/A * Obtain the devlink from a /devices path 2N/A * Search the /dev hierarchy starting at basedir. 2N/A /* Is this the physical path we are looking for */ 2N/A/* Compare HBA physical ap_id and device path */ 2N/A /* Remove dynamic component if any */ 2N/A /* Remove minor names */ 2N/A /* Check if HBA path is component of device path */ 2N/A /* devpath must have '/' and 1 char in addition to hba path */ 2N/A /* Separate out the minor names */ 2N/A * Compare minor names 2N/A * Returns non-zero on failure (aka, HBA_STATUS_ERROR_* 2N/A * Will handle retries if applicable. 2N/A /* Loop as long as we have a retryable error */ 2N/A * Returns non-zero on failure (aka, HBA_STATUS_ERROR_* 2N/A * Will handle retries if applicable. 2N/A /* Loop as long as we have a retryable error */ 2N/A /* The odds of this occuring are very slim, but possible. */ 2N/A * If we hit a stale data scenario, 2N/A * we'll just tell the user to try again. 2N/A * Returns non-zero on failure (aka, HBA_STATUS_ERROR_* 2N/A * Will handle retries if applicable. 2N/A /* Loop as long as we have a retryable error */ 2N/A /* The odds of this occuring are very slim, but possible. */ 2N/A * If we hit a stale data scenario, 2N/A * we'll just tell the user to try again. 2N/A * Returns non-zero on failure (aka, HBA_STATUS_ERROR_* 2N/A * Will handle retries if applicable. 2N/A /* Loop as long as we have a retryable error */ 2N/A /* The odds of this occuring are very slim, but possible. */ 2N/A * If we hit a stale data scenario, we'll just tell the 2N/A * user to try again. 2N/A * Find the Adapter port that matches the portPath. 2N/A * When the matching port is found the caller have to close handle 2N/A /* Loop over all HBAs */ 2N/A /* May have been DR'd */ 2N/A /* May have been DR'd */ 2N/A /* Should never happen */ 2N/A /* Loop over all HBA Ports */ 2N/A /* Need to refresh adapter */ 2N/A * check to see if OSDeviceName is a /dev/cfg link 2N/A * or the physical path 2N/A * make sure that the OSDeviceName is at least 2N/A * second 1 is to make sure there is somthing 2N/A /* get the /dev/cfg link from the portPath */ 2N/A /* compare logical ap_id */ 2N/A /* Got here. No mathcing adatper port found. */