/*
* 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
*/
/*
*/
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <syslog.h>
#include <errno.h>
#include <wchar.h>
#include <widec.h>
#include <libsysevent.h>
#include <fcntl.h>
#include <stdio.h>
#include <time.h>
#include <libdevinfo.h>
#include <netdb.h>
#include <sys/iscsi_protocol.h>
#include <ima.h>
#include <libsun_ima.h>
/* Forward declaration */
/* OK */
#define DISC_ADDR_OK 0
/* Incorrect IP address */
/* Error converting text IP address to numeric binary form */
/* Currently not defined in IMA_TARGET_DISCOVERY_METHOD enum */
#define IMA_TARGET_DISCOVERY_METHOD_UNKNOWN 0
/*
* Custom struct to allow tgpt to be specified.
*/
typedef struct _SUN_IMA_DISC_ADDRESS_KEY
{
/*
* Custom struct to allow tgpt to be specified.
*/
typedef struct _SUN_IMA_DISC_ADDRESS_KEY_PROPERTIES
{
/*
* Custom struct to allow tgpt to be specified.
*/
typedef struct _SUN_IMA_DISC_ADDR_PROP_LIST
{
const IMA_AUTHMETHOD *pMethodList);
IMA_OID_LIST **ppList);
);
);
void InitLibrary();
{
}
static void
{
IMA_UINT i;
const char *visibility_subclasses[] = {
};
/* Make sure our event class matches what we are looking for */
return;
}
/* Check for object property changes */
if ((strncmp(ESC_ISCSI_PROP_CHANGE,
strlen(ESC_ISCSI_PROP_CHANGE)) == 0)) {
if (pObjectPropertyCallback != NULL)
} else {
i = 0;
while (visibility_subclasses[i] != NULL) {
if ((strncmp(visibility_subclasses[i],
strlen(visibility_subclasses[i])) == 0) &&
tmpOid);
}
i++;
}
}
}
const char *subclass_list[] = {
};
/* Bind event handler and create subscriber handle */
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
return (IMA_STATUS_SUCCESS);
}
void Terminate() {
}
}
void InitLibrary() {
}
{
}
/*ARGSUSED*/
)
{
int fd;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
} else {
} else {
}
}
sizeof (IMA_WCHAR) * IMA_NODE_ALIAS_LEN);
} else {
}
}
return (IMA_STATUS_SUCCESS);
}
const IMA_NODE_NAME newName
)
{
int fd;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_PARAM_SET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
const IMA_NODE_ALIAS newAlias
)
{
int fd;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/* newAlias = NULL specifies that the alias should be deleted. */
else
L"", ISCSI_MAX_NAME_LEN);
"ISCSI_PARAM_SET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
)
{
/* Always return the same object ID for the lhba */
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
&lhbaObjectId, sizeof (lhbaObjectId));
return (IMA_STATUS_SUCCESS);
}
/*
* Get the discovery properties of the LHBA
*/
/*ARGSUSED*/
)
{
int fd;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_DISCOVERY_PROPS ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* Set the iSNS discovery method - The IMA specification indicates
* this field is valid only if iSNS discovery is enabled.
*/
switch (discoveryProps.iSNSDiscoveryMethod) {
break;
case iSNSDiscoveryMethodDHCP:
break;
case iSNSDiscoveryMethodSLP:
break;
default:
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
void *pMemory
)
{
return (IMA_STATUS_SUCCESS);
}
)
{
return (IMA_ERROR_INVALID_PARAMETER);
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
return (IMA_STATUS_SUCCESS);
}
)
{
}
)
{
}
)
{
}
/*ARGSUSED*/
const void *pInputBuffer,
void *pOutputBuffer,
)
{
return (IMA_ERROR_NOT_SUPPORTED);
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
)
{
}
/*ARGSUSED*/
)
{
return (IMA_ERROR_NOT_SUPPORTED);
}
/*ARGSUSED*/
)
{
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* Issue ioctl to obtain the number of targets.
*/
"ISCSI_DISCOVERY_ADDR_LIST_GET ioctl %d failed, errno: %d",
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
addr_list_size = sizeof (iscsi_addr_list_t);
addr_list_size += (sizeof (iscsi_addr_list_t) *
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* Issue the same ioctl again to obtain the OIDs. */
"ISCSI_TARGET_OID_LIST_GET ioctl %d failed, errno: %d",
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
for (i = 0; i < idlp->al_out_cnt; i++) {
}
return (IMA_STATUS_SUCCESS);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
}
/* ARGSUSED */
)
{
}
/*ARGSUSED*/
const IMA_HOST_ID *iSnsHost
)
{
/* XXX need to set discovery Method and domaineName */
}
/* ARGSUSED */
)
{
}
/* ARGSUSED */
)
{
}
/* ARGSUSED */
)
{
}
/*ARGSUSED*/
)
{
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* Issue ioctl to obtain the number of discovery address.
*/
"ISCSI_DISCOVERY_ADDR_LIST_GET ioctl %d failed, errno: %d",
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
if (al_info.al_out_cnt == 0) {
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
addr_list_size = sizeof (iscsi_addr_list_t);
addr_list_size += (sizeof (iscsi_addr_list_t) *
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* Issue the same ioctl again to obtain the OIDs. */
"ISCSI_TARGET_OID_LIST_GET ioctl %d failed, errno: %d",
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
for (i = 0; i < idlp->al_out_cnt; i++) {
continue;
}
if (matched_addr == NULL) {
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
} else {
/* Should not happen */
"ISCSI_STATIC_GET returned bad address");
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_DISCOVERY_ADDR_CLEAR ioctl failed, errno: %d",
errno);
return (IMA_ERROR_LU_IN_USE);
} else {
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
/*ARGSUSED*/
)
{
int fd;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
DISC_ADDR_OK) {
return (IMA_ERROR_INVALID_PARAMETER);
}
"ISCSI_DISCOVERY_ADDR_SET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
)
{
/* LINTED */
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_STATIC_GET ioctl failed, errno: %d", status);
return (IMA_ERROR_OBJECT_NOT_FOUND);
} else {
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
sizeof (struct in_addr)) {
/* IPv4 */
sizeof (struct in_addr));
sizeof (struct in6_addr)) {
/* IPv6 */
sizeof (struct in6_addr));
} else {
/* Should not happen */
"ISCSI_STATIC_GET returned bad address");
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
/*ARGSUSED*/
)
{
int fd;
int i;
int addr_list_size;
/* LINTED */
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* Issue ioctl to obtain the number of discovery addresses.
*/
"ISCSI_DISCOVERY_ADDR_LIST_GET ioctl %d failed, errno: %d",
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
if (al_info.al_out_cnt == 0) {
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
addr_list_size = sizeof (iscsi_addr_list_t);
addr_list_size += (sizeof (iscsi_addr_list_t) *
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* Issue the same ioctl again to obtain the OIDs. */
"ISCSI_TARGET_OID_LIST_GET ioctl %d failed, errno: %d",
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
for (i = 0; i < idlp->al_out_cnt; i++) {
continue;
}
if (matched_addr == NULL) {
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
} else {
/* Should not happen */
"ISCSI_STATIC_GET returned bad address");
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
)
{
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_STATIC_CLEAR ioctl failed, errno: %d", errno);
return (IMA_ERROR_LU_IN_USE);
} else {
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
/*ARGSUSED*/
)
{
int fd;
int target_in_addr_size;
int target_port;
union {
} target_in;
int error_num;
const unsigned char *p = NULL;
int n;
/*
* staticConfig.address may come in with port number at its trailer.
* Parse it to separate the IP address and port number.
* Also translate the hostname to IP address if needed.
*/
IMA_TRUE) {
(void) wcstombs(tmp_target_str,
/* Get the target ip address with node name */
/* Try IPv6 */
&error_num);
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
target_in_addr_size = sizeof (struct in6_addr);
} else {
target_in_addr_size = sizeof (struct in_addr);
}
/* IPv6 address */
p[0], p[1], p[2], p[3]);
(void) sprintf(&target_addr_str[n],
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
p[4], p[5], p[6], p[7], p[8], p[9], p[10],
p[11], p[12], p[13], p[14], p[15]);
return (IMA_ERROR_INVALID_PARAMETER);
}
target_in_addr_size = sizeof (struct in6_addr);
} else {
/* IPv4 address */
p[0], p[1], p[2], p[3]);
return (IMA_ERROR_INVALID_PARAMETER);
}
target_in_addr_size = sizeof (struct in_addr);
}
} else {
}
} else {
}
sizeof (struct in6_addr));
} else {
/* Should not happen */
"ISCSI_STATIC_GET returned bad address");
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* Encountered problem setting the IP address and port for
* the target just added.
*/
"ISCSI_STATIC_SET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
if (pTargetOid != NULL) {
}
return (IMA_STATUS_SUCCESS);
}
)
{
}
)
{
int fd;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_TARGET_PROPS_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
sizeof (IMA_WCHAR) * IMA_NODE_ALIAS_LEN);
if (prop.p_alias_len > 0) {
}
/* Initialize the discovery method to unknown method. */
}
}
}
}
return (IMA_STATUS_SUCCESS);
}
/*ARGSUSED*/
)
{
return (IMA_ERROR_NOT_SUPPORTED);
}
)
{
int i;
} else {
}
if (!IMA_SUCCESS(status)) {
return (status);
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
for (i = 0; i < pLunList->ll_out_cnt; i++) {
}
return (IMA_STATUS_SUCCESS);
}
)
{
int i;
if (!IMA_SUCCESS(status)) {
return (status);
}
for (i = 0; i < pLunList->ll_out_cnt; i++) {
return (IMA_STATUS_SUCCESS);
}
}
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
)
{
}
)
{
int j;
int fd;
return (IMA_ERROR_INCORRECT_OBJECT_TYPE);
}
/*
* get list of lun oids for all targets
*/
if (!IMA_SUCCESS(status)) {
return (status);
}
for (j = 0; j < pLunList->ll_out_cnt; j++) {
/*
* for each lun, check if match is found
*/
/*
* match found, break out of lun loop
*/
break;
}
}
}
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/*
* get lun properties
*/
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_LUN_PROPS_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* set property values
*/
sizeof (pProps->timeExposedToOs));
/* add minor device delimiter */
/*
* modify returned pathname to obtain the 2nd slice
* of the raw disk
*/
}
/*
* Pathname returned by driver is the physical device path.
* This name needs to be converted to the OS device name.
*/
/* OS device name synchronously made */
} else {
}
(void) di_devlink_fini(&hdl);
} else {
}
} else {
}
return (IMA_STATUS_SUCCESS);
}
/*ARGSUSED*/
)
{
return (IMA_ERROR_NOT_SUPPORTED);
}
/*ARGSUSED*/
)
{
return (IMA_ERROR_NOT_SUPPORTED);
}
)
{
int fd;
cmdblk[0] = SCMD_INQUIRY;
if (*pOutputBufferLength > MAX_INQUIRY_BUFFER_LEN) {
} else {
}
/* iu_oid is a session oid in the driver */
} else {
/*
* Get LU properties and associated session oid
* for this lun(deviceId) and put in uscsi.iu_oid
*/
if (status != IMA_STATUS_SUCCESS) {
return (status);
}
}
*pSenseBufferLength : 0;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_TARGET_PROPS_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
if (pSenseBufferLength != NULL) {
}
return (IMA_ERROR_SCSI_STATUS_CHECK_CONDITION);
}
return (IMA_STATUS_SUCCESS);
}
)
{
/* CDB_GROUP4 size is safe for both 10 and 16 byte CDBs */
int fd;
if (cdbLength == CDB_GROUP1) {
/* Read Capacity (10) command. */
cmdblk[0] = SCMD_READ_CAPACITY;
} else if (cdbLength == CDB_GROUP4) {
/*
* Read Capacity (16) is a Service Action In command. One
* command byte (0x9E) is overloaded for multiple operations,
* with the second CDB byte specifying the desired operation.
*/
cmdblk[0] = SCMD_SVC_ACTION_IN_G4;
} else {
}
} else {
/* only 10 and 16 byte CDB are supported */
return (IMA_ERROR_NOT_SUPPORTED);
}
/* iu_oid is a session oid in the driver */
} else {
/*
* Get LU properties and associated session oid
* for this lun(deviceId) and put in uscsi.iu_oid
*/
if (status != IMA_STATUS_SUCCESS) {
return (status);
}
}
*pSenseBufferLength : 0;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_TARGET_PROPS_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
if (pSenseBufferLength != NULL) {
}
return (IMA_ERROR_SCSI_STATUS_CHECK_CONDITION);
}
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
cmdblk[0] = SCMD_REPORT_LUNS;
} else {
}
/* iu_oid is a session oid in the driver */
if (sendToWellKnownLun == IMA_TRUE) {
/* this optional feature is not supported now */
return (IMA_ERROR_NOT_SUPPORTED);
}
} else {
/*
* Get LU properties and associated session oid
* for this lun(deviceId) and put in uscsi.iu_oid
*/
if (status != IMA_STATUS_SUCCESS) {
return (status);
}
}
*pSenseBufferLength : 0;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_TARGET_PROPS_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
if (pSenseBufferLength != NULL) {
}
return (IMA_ERROR_SCSI_STATUS_CHECK_CONDITION);
}
return (IMA_STATUS_SUCCESS);
}
/*ARGSUSED*/
)
{
return (IMA_ERROR_NOT_SUPPORTED);
}
/*ARGSUSED*/
)
{
return (IMA_ERROR_NOT_SUPPORTED);
}
)
{
int i, j, addressKeyCount = 0;
int addressKeyIdx = 0;
if (status != IMA_STATUS_SUCCESS) {
return (status);
}
if (status != IMA_STATUS_SUCCESS) {
return (status);
}
/* Get the number of addresses to allocate */
for (i = 0; i < discAddressList->discAddrCount; i++) {
&pList);
}
}
(void) IMA_FreeMemory(pList);
}
addressKeyCount * sizeof (IMA_ADDRESS_KEY));
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
addressKeyIdx = 0;
for (i = 0; i < discAddressList->discAddrCount; i++) {
&pList);
continue;
}
ipAddress), sizeof (IMA_IP_ADDRESS));
}
(void) IMA_FreeMemory(pList);
}
return (IMA_STATUS_SUCCESS);
}
if (status != IMA_STATUS_SUCCESS)
return (IMA_FALSE);
for (i = 0; i < supportedCount; i++) {
if (method == supportedList[i]) {
}
}
return (supported);
}
IMA_UINT i, j;
if (pMethodList == NULL) {
return (IMA_FALSE);
}
/* Check list for duplicates */
for (i = 0; i < methodCount; i++) {
for (j = i + 1; j < methodCount; j++) {
if (pMethodList[i] == pMethodList[j]) {
return (IMA_FALSE);
}
}
return (IMA_FALSE);
}
}
return (IMA_TRUE);
}
)
{
}
/*ARGSUSED*/
)
{
if (pMethodList == NULL) {
*pMethodCount = 0;
return (IMA_STATUS_SUCCESS);
}
if (*pMethodCount > 1) {
}
return (IMA_STATUS_SUCCESS);
}
)
{
}
/*ARGSUSED*/
)
{
int fd;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
if (method == IMA_AUTHMETHOD_CHAP) {
"ISCSI_CHAP_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
} else {
return (IMA_ERROR_INVALID_PARAMETER);
}
return (IMA_STATUS_SUCCESS);
}
const IMA_AUTHMETHOD *pMethodList
)
{
methodCount) == IMA_FALSE)
return (IMA_ERROR_INVALID_PARAMETER);
}
/*
* This function only sets CHAP params since we only support CHAP for now.
*/
const IMA_INITIATOR_AUTHPARMS *pParms
)
{
int fd;
if (method != IMA_AUTHMETHOD_CHAP)
return (IMA_ERROR_INVALID_PARAMETER);
return (IMA_ERROR_INVALID_PARAMETER);
}
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
if (method == IMA_AUTHMETHOD_CHAP) {
"ISCSI_CHAP_SET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
/* A helper function to obtain iSCSI node parameters. */
static IMA_STATUS
int paramType,
void *pProps,
)
{
int fd;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_PARAM_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
switch (paramType) {
case MIN_MAX_PARAM:
break;
case BOOL_PARAM:
break;
default:
break;
}
return (IMA_STATUS_SUCCESS);
}
/* A helper function to set iSCSI node parameters. */
static IMA_STATUS
int paramType,
void *pProp,
)
{
int fd;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
switch (paramType) {
case MIN_MAX_PARAM:
break;
case BOOL_PARAM:
break;
default:
break;
}
"ISCSI_PARAM_SET ioctl failed, errno: %d", errno);
switch (tmpErrno) {
case ENOTSUP :
return (IMA_ERROR_NOT_SUPPORTED);
default :
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
static int
)
{
IMA_FALSE) {
} else {
}
return (DISC_ADDR_OK);
}
)
{
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_DISCOVERY_CLEAR ioctl failed, errno: %d",
status);
return (IMA_ERROR_LU_IN_USE);
} else {
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
} else {
/* Set the discovery method */
"ISCSI_DISCOVERY_SET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
}
{
int fd;
int i;
int target_list_size;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* Issue ioctl to obtain the number of targets.
*/
"ISCSI_TARGET_OID_LIST_GET ioctl %d failed, errno: %d",
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
target_list_size = sizeof (iscsi_target_list_t);
target_list_size += (sizeof (uint32_t) *
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* Issue the same ioctl again to obtain the OIDs. */
"ISCSI_TARGET_OID_LIST_GET ioctl %d failed, errno: %d",
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
for (i = 0; i < idlp->tl_out_cnt; i++) {
else
}
return (IMA_STATUS_SUCCESS);
}
{
int fd;
int lun_list_size;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/* get lun oid list for all targets */
} else {
/* get lun oid list for single target */
}
/*
* Issue ioctl to obtain the number of target LUNs.
*/
"ISCSI_LUN_LIST_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
lun_list_size = sizeof (iscsi_lun_list_t);
lun_list_size += (sizeof (iscsi_if_lun_t) *
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* Issue the same ioctl again to get the target LUN list */
"ISCSI_LUN_LIST_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
/* A helper function to set authentication method. */
static IMA_STATUS
const IMA_AUTHMETHOD *pMethodList
)
{
int fd;
int i;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/* First do a get because other data fields may exist */
/* EMPTY */
/* It is fine if there is no other data fields. */
}
for (i = 0; i < *pMethodCount; i++) {
switch (pMethodList[i]) {
case IMA_AUTHMETHOD_CHAP:
break;
default:
break;
}
}
"ISCSI_AUTH_SET failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_STATUS_SUCCESS);
}
/* A helper function to get authentication method. */
static IMA_STATUS
)
{
int fd, i;
if (pMethodList == NULL) {
*pMethodCount = 0;
return (IMA_STATUS_SUCCESS);
}
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_AUTH_GET failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
i = 0;
pMethodList[i++] = IMA_AUTHMETHOD_NONE;
pMethodList[i++] = IMA_AUTHMETHOD_CHAP;
}
*pMethodCount = i;
return (IMA_STATUS_SUCCESS);
}
)
{
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
return (IMA_STATUS_SUCCESS);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
)
{
/*
* Always return the same object ID for the pnp as the spec
* states that this function will always return a list of at least
* one element
*/
(1* sizeof (IMA_OID)));
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
return (IMA_STATUS_SUCCESS);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
)
{
status = init_sysevents();
if (status != IMA_STATUS_SUCCESS)
return (status);
}
return (IMA_STATUS_SUCCESS);
}
/* ARGSUSED */
)
{
return (IMA_STATUS_SUCCESS);
}
)
{
status = init_sysevents();
if (status != IMA_STATUS_SUCCESS)
return (status);
}
return (IMA_STATUS_SUCCESS);
}
/* ARGSUSED */
)
{
return (IMA_STATUS_SUCCESS);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
const IMA_IP_ADDRESS NewIpAddress
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_NOT_SUPPORTED);
}
/* ARGSUSED */
)
{
return (IMA_STATUS_SUCCESS);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_INVALID_PARAMETER);
}
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
pProps->staleDataSize = 0;
return (IMA_STATUS_SUCCESS);
}
)
{
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
return (IMA_STATUS_SUCCESS);
}
/* ARGSUSED */
)
{
return (IMA_ERROR_OBJECT_NOT_FOUND);
}
static int
{
strlen(IMA_DISK_DEVICE_NAME_PREFIX)) == 0) ||
strlen(IMA_TAPE_DEVICE_NAME_PREFIX)) == 0)) {
return (DI_WALK_TERMINATE);
}
return (DI_WALK_CONTINUE);
}
/* ARGSUSED */
)
{
return (IMA_STATUS_SUCCESS);
}
)
{
int fd;
int i;
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* Issue ISCSI_DISCOVERY_ADDR_LIST_GET ioctl to obtain the number of
* discovery addresses.
*/
"ISCSI_DISCOVERY_ADDR_LIST_GET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
discovery_addr_list_size = sizeof (iscsi_addr_list_t);
discovery_addr_list_size += (sizeof (iscsi_addr_t) *
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/*
* Issue ISCSI_DISCOVERY_ADDR_LIST_GET ioctl again to obtain the
* discovery addresses.
*/
"ISCSI_DISCOVERY_ADDR_LIST_GET ioctl failed, errno: %d",
errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
for (i = 0; i < ialp->al_out_cnt; i++) {
sizeof (struct in_addr)) {
sizeof (struct in6_addr)) {
} else {
/* Should not happen */
"ISCSI_STATIC_GET returned bad address");
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
/* ARGSUSED */
)
{
char *colonPos;
int fd;
int ctr;
int stl_sz;
sizeof (iscsi_sendtgts_entry_t));
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
/* IPv4 */
} else {
/* IPv6 */
}
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/*
* Issue ioctl to obtain the SendTargets list
*/
"ISCSI_SENDTGTS_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
/* check if all targets received */
sizeof (iscsi_sendtgts_entry_t));
stl_hdr = (iscsi_sendtgts_list_t *)
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
goto retry_sendtgts;
} else {
/*
* don't retry after 2 attempts. The target list
* shouldn't continue to growing. Justs continue
* on and display what was found.
*/
"ISCSI_SENDTGTS_GET overflow: "
"failed to obtain all targets");
}
}
/* allocate for caller return buffer */
sizeof (SUN_IMA_DISC_ADDRESS_KEY_PROPERTIES) +
return (IMA_ERROR_INSUFFICIENT_MEMORY);
}
sizeof (struct in_addr)) {
sizeof (struct in6_addr)) {
} else {
"ISCSI_STATIC_GET returned bad address");
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}
{
int fd;
switch (param->tunable_objectType) {
case ISCSI_RX_TIMEOUT_VALUE:
break;
default:
return (IMA_ERROR_INVALID_PARAMETER);
}
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
"ISCSI_TUNABLE_PARAM_GET ioctl failed, errno: %d", errno);
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
} else {
long long value;
/* default value */
return (IMA_STATUS_SUCCESS);
}
} else {
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
switch (param->tunable_objectType) {
case ISCSI_RX_TIMEOUT_VALUE:
break;
break;
break;
default:
break;
}
}
return (IMA_STATUS_SUCCESS);
}
{
int fd;
while (*ptr != '\0') {
return (IMA_ERROR_INVALID_PARAMETER);
}
ptr ++;
}
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
errno = 0;
switch (param->tunable_objectType) {
long tmp;
case ISCSI_RX_TIMEOUT_VALUE:
NULL, 10);
return (IMA_ERROR_INVALID_PARAMETER);
}
if ((tmp < ISCSI_TUNABLE_MIN) ||
(tmp > ISCSI_TUNABLE_MAX)) {
/* input value exceed (0~3600) */
return (IMA_ERROR_INVALID_PARAMETER);
}
break;
default:
return (IMA_ERROR_INVALID_PARAMETER);
}
"ISCSI_TUNABLE_PARAM_SET ioctl failed, errno: %d", errno);
switch (tmpErrno) {
case ENOTSUP :
return (IMA_ERROR_NOT_SUPPORTED);
default:
return (IMA_ERROR_UNEXPECTED_OS_ERROR);
}
}
return (IMA_STATUS_SUCCESS);
}