/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sun_sas.h>
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
#include <libdevinfo.h>
/*
* structure for di_devlink_walk
*/
typedef struct walk_devlink {
char *path;
char **linkpp;
/*
* callback funtion for di_devlink_walk
* Find matching /dev link for the given path argument.
* devlink element and callback function argument.
* The input path is expected to not have "/devices".
*/
static int
{
/*
* When path is specified, it doesn't have minor
* name. Therefore, the ../.. prefixes needs to be stripped.
*/
/* make it sure the device path has minor name */
return (DI_WALK_CONTINUE);
}
}
return (DI_WALK_TERMINATE);
}
/*
* Convert /devices paths to /dev sym-link paths.
* The mapping buffer OSDeviceName paths will be
* converted to short names.
* mappings The target mappings data to convert to short names
*
* If no link is found, the long path is left as is.
* Note: The NumberOfEntries field MUST not be greater than the size
* of the array passed in.
*/
void
{
int j;
return;
}
for (j = 0; j < mappings->NumberOfEntries; j++) {
/* search link for minor node */
}
} else {
minor_path = NULL;
"/devices") != NULL) {
} else {
}
}
(void *)&warg, get_devlink);
"%s", devlinkp);
}
}
(void) di_devlink_fini(&hdl);
}
/*
* Finds controller path for a give device path.
*
* Return value: /dev link for dir and minor name.
*/
static HBA_STATUS
{
char *charptr;
int dirplen;
char *subpath;
"Unable to open %s to find controller number.", dir);
return (HBA_STATUS_ERROR);
}
"Invalid argument for storing the link.");
return (HBA_STATUS_ERROR);
}
/*
* dirplen is large enough to fit the largest path-
* struct dirent includes one byte (the terminator)
* so we don't add 1 to the calculation here.
*/
sizeof (struct dirent);
return (HBA_STATUS_ERROR);
}
continue;
}
/*
* set to another pointer since dirp->d_name length is 1
* that will store only the first char 'c' from the name.
*/
/*
* if device path has substring of path
* and exactally matching with :scsi suffix
*/
return (HBA_STATUS_OK);
}
}
}
}
return (HBA_STATUS_ERROR);
}
/*
* Finds controller path for a give device path.
*
* Return vale:i smp devlink.
*/
{
}
/*
* Finds smp devlink for a give smp path.
*
* Return vale: smp devlink.
*/
{
}