1fcf3ce44SJohn Forte /*
2fcf3ce44SJohn Forte  * CDDL HEADER START
3fcf3ce44SJohn Forte  *
4fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7fcf3ce44SJohn Forte  *
8fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11fcf3ce44SJohn Forte  * and limitations under the License.
12fcf3ce44SJohn Forte  *
13fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18fcf3ce44SJohn Forte  *
19fcf3ce44SJohn Forte  * CDDL HEADER END
20fcf3ce44SJohn Forte  */
21fcf3ce44SJohn Forte /*
224b31676fSsrivijitha dugganapalli  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
23fcf3ce44SJohn Forte  */
246ac72a9cSAlexander Stetsenko /*
25*61dfa509SRick McNeal  * Copyright 2016, Nexenta Systems, Inc. All rights reserved.
2609409df0SJeff Biseda  * Copyright (c) 2013 by Delphix. All rights reserved.
276ac72a9cSAlexander Stetsenko  */
28fcf3ce44SJohn Forte #ifndef	_STMF_STATE_H
29fcf3ce44SJohn Forte #define	_STMF_STATE_H
30fcf3ce44SJohn Forte 
31fcf3ce44SJohn Forte #ifdef	__cplusplus
32fcf3ce44SJohn Forte extern "C" {
33fcf3ce44SJohn Forte #endif
34fcf3ce44SJohn Forte 
35fcf3ce44SJohn Forte typedef struct stmf_state {
36fcf3ce44SJohn Forte 	kmutex_t		stmf_lock;
37fcf3ce44SJohn Forte 	kcondvar_t		stmf_cv;
38fcf3ce44SJohn Forte 	dev_info_t		*stmf_dip;
39fcf3ce44SJohn Forte 	stmf_i_lu_provider_t	*stmf_ilplist;
40fcf3ce44SJohn Forte 	stmf_i_port_provider_t	*stmf_ipplist;
41fcf3ce44SJohn Forte 	stmf_i_lu_t		*stmf_ilulist;
42fcf3ce44SJohn Forte 	stmf_i_local_port_t	*stmf_ilportlist;
43427fcaf8Stim szeto 	id_space_t		*stmf_ilport_inst_space;
44427fcaf8Stim szeto 	avl_tree_t		stmf_irportlist;
45427fcaf8Stim szeto 	id_space_t		*stmf_irport_inst_space;
46fcf3ce44SJohn Forte 	int			stmf_nlps;
47fcf3ce44SJohn Forte 	int			stmf_npps;
48fcf3ce44SJohn Forte 	int			stmf_nlus;
49fcf3ce44SJohn Forte 	int			stmf_nlports;
50fcf3ce44SJohn Forte 	uint8_t			stmf_service_running:1,
51fcf3ce44SJohn Forte 				stmf_inventory_locked:1,
52fcf3ce44SJohn Forte 				stmf_exclusive_open:1,
53fcf3ce44SJohn Forte 				stmf_opened:1,
54fcf3ce44SJohn Forte 				stmf_process_initial_luns:1,
55fcf3ce44SJohn Forte 				rsvd:3;
56fcf3ce44SJohn Forte 	uint8_t			stmf_config_state; /* See stmf_ioctl.h */
5745039663SJohn Forte 	uint8_t			stmf_alua_state;
5845039663SJohn Forte 	uint16_t		stmf_alua_node;
594b31676fSsrivijitha dugganapalli 	uint8_t			stmf_default_lu_state;
604b31676fSsrivijitha dugganapalli 	uint8_t			stmf_default_lport_state;
61fcf3ce44SJohn Forte 	ddi_taskq_t		*stmf_svc_taskq;
62fcf3ce44SJohn Forte 	uint32_t		stmf_svc_flags;
63fcf3ce44SJohn Forte 	stmf_i_lu_t		*stmf_svc_ilu_draining;
64fcf3ce44SJohn Forte 	stmf_i_lu_t		*stmf_svc_ilu_timing;
65*61dfa509SRick McNeal 	list_t			stmf_svc_list;
66fcf3ce44SJohn Forte 
67fcf3ce44SJohn Forte 	stmf_id_list_t		stmf_hg_list;
68fcf3ce44SJohn Forte 	stmf_id_list_t		stmf_tg_list;
69fcf3ce44SJohn Forte 	stmf_id_list_t		stmf_luid_list;
70fcf3ce44SJohn Forte 
71fcf3ce44SJohn Forte 	stmf_ver_tg_t		*stmf_ver_tg_head;
72fcf3ce44SJohn Forte 
73fcf3ce44SJohn Forte 	stmf_pp_data_t		*stmf_ppdlist;
74fcf3ce44SJohn Forte } stmf_state_t;
75fcf3ce44SJohn Forte 
76fcf3ce44SJohn Forte /*
77fcf3ce44SJohn Forte  * svc flags
78fcf3ce44SJohn Forte  */
79fcf3ce44SJohn Forte #define	STMF_SVC_STARTED		1
80fcf3ce44SJohn Forte #define	STMF_SVC_ACTIVE			2
81fcf3ce44SJohn Forte #define	STMF_SVC_TERMINATE		4
82fcf3ce44SJohn Forte 
83fcf3ce44SJohn Forte /*
84fcf3ce44SJohn Forte  * svc request. We probably have to modify it once more services (and probably
85fcf3ce44SJohn Forte  * different types of services) are added to the stmf_svc_thread.
86fcf3ce44SJohn Forte  */
87fcf3ce44SJohn Forte typedef struct stmf_svc_req {
88*61dfa509SRick McNeal 	list_node_t			svc_list_entry;
89fcf3ce44SJohn Forte 	int				svc_req_alloc_size;
90fcf3ce44SJohn Forte 	int				svc_cmd;
91fcf3ce44SJohn Forte 	void				*svc_obj;
92fcf3ce44SJohn Forte 	struct stmf_state_change_info	svc_info;
93fcf3ce44SJohn Forte } stmf_svc_req_t;
94fcf3ce44SJohn Forte 
95fcf3ce44SJohn Forte extern stmf_state_t stmf_state;
96fcf3ce44SJohn Forte 
97fcf3ce44SJohn Forte #ifdef	__cplusplus
98fcf3ce44SJohn Forte }
99fcf3ce44SJohn Forte #endif
100fcf3ce44SJohn Forte 
101fcf3ce44SJohn Forte #endif /* _STMF_STATE_H */
102