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.
35 MP_EnableAutoFailbackPlugin(void)
37 mp_iocdata_t mp_ioctl
;
41 MP_STATUS mpStatus
= MP_STATUS_SUCCESS
;
46 log(LOG_INFO
, "MP_EnableAutoFailbackPlugin()", " - enter");
49 if (g_scsi_vhci_fd
< 0) {
50 log(LOG_INFO
, "MP_EnableAutoFailbackPlugin()",
51 "invalid driver file handle");
52 log(LOG_INFO
, "MP_EnableAutoFailbackPlugin()", " - error exit");
53 return (MP_STATUS_FAILED
);
56 (void) memset(&mp_ioctl
, 0, sizeof (mp_iocdata_t
));
57 (void) memset(&chBuffer
, 0, 256);
59 mp_ioctl
.mp_cmd
= MP_ENABLE_AUTO_FAILBACK
;
60 mp_ioctl
.mp_ibuf
= (caddr_t
)&chBuffer
[0];
61 mp_ioctl
.mp_xfer
= MP_XFER_WRITE
;
63 log(LOG_INFO
, "MP_EnableAutoFailbackPlugin()",
64 "mp_ioctl.mp_cmd (MP_ENABLE_AUTO_FAILBACK) : %d",
67 ioctlStatus
= ioctl(g_scsi_vhci_fd
, MP_CMD
, &mp_ioctl
);
69 log(LOG_INFO
, "MP_EnableAutoFailbackPlugin()",
70 " IOCTL call returned: %d", ioctlStatus
);
72 if (ioctlStatus
< 0) {
76 if (ioctlStatus
!= 0) {
77 log(LOG_INFO
, "MP_EnableAutoFailbackPlugin()",
78 "IOCTL call failed. IOCTL error is: %d",
80 log(LOG_INFO
, "MP_EnableAutoFailbackPlugin()",
81 "IOCTL call failed. IOCTL error is: %s",
82 strerror(ioctlStatus
));
83 log(LOG_INFO
, "MP_EnableAutoFailbackPlugin()",
84 "IOCTL call failed. mp_ioctl.mp_errno: %x",
87 if (ENOTSUP
== ioctlStatus
) {
88 mpStatus
= MP_STATUS_UNSUPPORTED
;
89 } else if (0 == mp_ioctl
.mp_errno
) {
90 mpStatus
= MP_STATUS_FAILED
;
92 mpStatus
= getStatus4ErrorCode(mp_ioctl
.mp_errno
);
95 log(LOG_INFO
, "MP_EnableAutoFailbackPlugin()",
102 log(LOG_INFO
, "MP_EnableAutoFailbackPlugin()", " - exit");
104 return (MP_STATUS_SUCCESS
);