5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _SYS_MDI_IMPLDEFS_H
27 #define _SYS_MDI_IMPLDEFS_H
28
29
30 #include <sys/note.h>
31 #include <sys/types.h>
32 #include <sys/sunmdi.h>
33 #include <sys/modhash.h>
34 #include <sys/callb.h>
35 #include <sys/devctl.h>
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40
41 #ifdef _KERNEL
42
43 /*
44 * Multipath Driver Interfaces
568 #define MDI_CLIENT_STABLE(ct) { \
569 (ct)->ct_unstable--; \
570 if ((ct)->ct_unstable == 0) { \
571 cv_broadcast(&(ct)->ct_unstable_cv); \
572 } \
573 }
574
575 /*
576 * Client driver instance state definitions:
577 */
578 #define MDI_CLIENT_FLAGS_OFFLINE 0x00000001
579 #define MDI_CLIENT_FLAGS_SUSPEND 0x00000002
580 #define MDI_CLIENT_FLAGS_POWER_DOWN 0x00000004
581 #define MDI_CLIENT_FLAGS_DETACH 0x00000008
582 #define MDI_CLIENT_FLAGS_FAILOVER 0x00000010
583 #define MDI_CLIENT_FLAGS_REPORT_DEV 0x00000020
584 #define MDI_CLIENT_FLAGS_PATH_FREE_IN_PROGRESS 0x00000040
585 #define MDI_CLIENT_FLAGS_ASYNC_FREE 0x00000080
586 #define MDI_CLIENT_FLAGS_DEV_NOT_SUPPORTED 0x00000100
587 #define MDI_CLIENT_FLAGS_POWER_TRANSITION 0x00000200
588
589 #define MDI_CLIENT_SET_OFFLINE(ct) {\
590 ASSERT(MDI_CLIENT_LOCKED(ct)); \
591 (ct)->ct_flags |= MDI_CLIENT_FLAGS_OFFLINE; }
592 #define MDI_CLIENT_SET_ONLINE(ct) {\
593 ASSERT(MDI_CLIENT_LOCKED(ct)); \
594 (ct)->ct_flags &= ~MDI_CLIENT_FLAGS_OFFLINE; }
595 #define MDI_CLIENT_IS_OFFLINE(ct) \
596 ((ct)->ct_flags & MDI_CLIENT_FLAGS_OFFLINE)
597
598 #define MDI_CLIENT_SET_SUSPEND(ct) {\
599 ASSERT(MDI_CLIENT_LOCKED(ct)); \
600 (ct)->ct_flags |= MDI_CLIENT_FLAGS_SUSPEND; }
601 #define MDI_CLIENT_SET_RESUME(ct) {\
602 ASSERT(MDI_CLIENT_LOCKED(ct)); \
603 (ct)->ct_flags &= ~MDI_CLIENT_FLAGS_SUSPEND; }
604 #define MDI_CLIENT_IS_SUSPENDED(ct) \
605 ((ct)->ct_flags & MDI_CLIENT_FLAGS_SUSPEND)
606
607 #define MDI_CLIENT_SET_POWER_DOWN(ct) {\
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25 /*
26 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
27 */
28
29 #ifndef _SYS_MDI_IMPLDEFS_H
30 #define _SYS_MDI_IMPLDEFS_H
31
32
33 #include <sys/note.h>
34 #include <sys/types.h>
35 #include <sys/sunmdi.h>
36 #include <sys/modhash.h>
37 #include <sys/callb.h>
38 #include <sys/devctl.h>
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 #ifdef _KERNEL
45
46 /*
47 * Multipath Driver Interfaces
571 #define MDI_CLIENT_STABLE(ct) { \
572 (ct)->ct_unstable--; \
573 if ((ct)->ct_unstable == 0) { \
574 cv_broadcast(&(ct)->ct_unstable_cv); \
575 } \
576 }
577
578 /*
579 * Client driver instance state definitions:
580 */
581 #define MDI_CLIENT_FLAGS_OFFLINE 0x00000001
582 #define MDI_CLIENT_FLAGS_SUSPEND 0x00000002
583 #define MDI_CLIENT_FLAGS_POWER_DOWN 0x00000004
584 #define MDI_CLIENT_FLAGS_DETACH 0x00000008
585 #define MDI_CLIENT_FLAGS_FAILOVER 0x00000010
586 #define MDI_CLIENT_FLAGS_REPORT_DEV 0x00000020
587 #define MDI_CLIENT_FLAGS_PATH_FREE_IN_PROGRESS 0x00000040
588 #define MDI_CLIENT_FLAGS_ASYNC_FREE 0x00000080
589 #define MDI_CLIENT_FLAGS_DEV_NOT_SUPPORTED 0x00000100
590 #define MDI_CLIENT_FLAGS_POWER_TRANSITION 0x00000200
591 #define MDI_CLIENT_FLAGS_NO_EVENT 0x10000000
592
593 #define MDI_CLIENT_SET_OFFLINE(ct) {\
594 ASSERT(MDI_CLIENT_LOCKED(ct)); \
595 (ct)->ct_flags |= MDI_CLIENT_FLAGS_OFFLINE; }
596 #define MDI_CLIENT_SET_ONLINE(ct) {\
597 ASSERT(MDI_CLIENT_LOCKED(ct)); \
598 (ct)->ct_flags &= ~MDI_CLIENT_FLAGS_OFFLINE; }
599 #define MDI_CLIENT_IS_OFFLINE(ct) \
600 ((ct)->ct_flags & MDI_CLIENT_FLAGS_OFFLINE)
601
602 #define MDI_CLIENT_SET_SUSPEND(ct) {\
603 ASSERT(MDI_CLIENT_LOCKED(ct)); \
604 (ct)->ct_flags |= MDI_CLIENT_FLAGS_SUSPEND; }
605 #define MDI_CLIENT_SET_RESUME(ct) {\
606 ASSERT(MDI_CLIENT_LOCKED(ct)); \
607 (ct)->ct_flags &= ~MDI_CLIENT_FLAGS_SUSPEND; }
608 #define MDI_CLIENT_IS_SUSPENDED(ct) \
609 ((ct)->ct_flags & MDI_CLIENT_FLAGS_SUSPEND)
610
611 #define MDI_CLIENT_SET_POWER_DOWN(ct) {\
|