4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
28 * mpapi-sun.c - Implements the Sun Extension to the Multipath Management
35 #include "mpapi-sun.h"
36 #include "mpapi-plugin.h"
38 extern MPPLUGININFO_T plugintable
[MP_MAX_NUM_PLUGINS
];
40 extern pthread_mutex_t mp_lib_mutex
;
41 extern MP_STATUS
validate_object(MP_OID obj
, MP_OBJECT_TYPE objType
,
44 MP_STATUS
Sun_MP_SendScsiCmd(
45 MP_OID pathOid
, struct uscsi_cmd
*cmd
)
47 Sun_MP_SendScsiCmdFn PassFunc
;
51 if ((status
= validate_object(pathOid
, MP_OBJECT_TYPE_PATH_LU
,
52 MP_OBJECT_TYPE_MATCH
)) != MP_STATUS_SUCCESS
) {
56 (void) pthread_mutex_lock(&mp_lib_mutex
);
58 index
= pathOid
.ownerId
- 1;
59 if (plugintable
[index
].hdlPlugin
!= NULL
) {
60 PassFunc
= (Sun_MP_SendScsiCmdFn
)
61 dlsym(plugintable
[index
].hdlPlugin
,
62 "Sun_MP_SendScsiCmd");
64 if (PassFunc
!= NULL
) {
65 status
= PassFunc(pathOid
, cmd
);
67 status
= MP_STATUS_UNSUPPORTED
;
70 status
= MP_STATUS_FAILED
;
73 (void) pthread_mutex_unlock(&mp_lib_mutex
);