Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_ini_stub.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2015, Emulex
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  * this list of conditions and the following disclaimer in the documentation
13  * and/or other materials provided with the distribution.
14  *
15  * 3. Neither the name of the copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  *
31  */
32 
33 #include "ocs.h"
34 
35 /*!
36  * @defgroup scsi_api_initiator SCSI Initiator
37  */
38 
39 /**
40  * @brief Initialize initiator client.
41  *
42  * @par Description
43  * Called by OS initialization code to initialize initiator
44  * client. This is called prior to any PCI device enumeration.
45  *
46  * @param initiator TRUE for initiator mode
47  *
48  * @return Returns 0 on success, or a negative error code value on failure.
49  */
50 int32_t
51 ocs_scsi_ini_driver_init(int32_t initiator)
52 {
53  return 0;
54 }
55 
56 /**
57  * @brief Initialize SCSI IO.
58  *
59  * @par Description
60  * Initialize SCSI IO, this function is called once per IO during IO pool
61  * allocation so that the initiator client may initialize any of its own private
62  * data.
63  *
64  * @param io Pointer to SCSI IO object.
65  *
66  * @return Returns 0 on success, a negative error code value on failure.
67  */
68 int32_t
69 ocs_scsi_ini_io_init(ocs_io_t *io)
70 {
71  return 0;
72 }
73 
74 /**
75  * @brief Uninitialize SCSI IO.
76  *
77  * @par Description
78  * Uninitialize initiator client private data in a SCSI io object.
79  *
80  * @param io Pointer to SCSI IO object.
81  *
82  * @return Returns 0 on success, a negative error code value on failure.
83  */
84 int32_t
85 ocs_scsi_ini_io_exit(ocs_io_t *io)
86 {
87  return 0;
88 }
89 
90 
91 /**
92  * @brief initiator client exit
93  *
94  * @par Description
95  * Called by OS driver-wide cleanup/exit code to cleanup
96  * initiator client.
97  *
98  * @param initiator TRUE for initiator mode
99  *
100  * @return returns 0 for success, a negative error code value for failure.
101  */
102 int32_t
103 ocs_scsi_ini_driver_exit(int32_t initiator)
104 {
105  return 0;
106 }
107 
108 /**
109  * @ingroup scsi_api_initiator
110  * @brief Initializes any initiator fields on the ocs structure.
111  *
112  * @par Description
113  * Called by OS initialization code when a new device is discovered.
114  *
115  * @param ocs pointer to ocs
116  *
117  * @return returns 0 for success, a negative error code value for failure.
118  */
119 
120 int32_t
122 {
123  return 0;
124 }
125 
126 /**
127  * @ingroup scsi_api_initiator
128  * @brief Tears down target members of ocs structure.
129  *
130  * @par Description
131  * Called by OS code when device is removed.
132  *
133  * @param ocs pointer to ocs
134  *
135  * @return returns 0 for success, a negative error code value for failure.
136  */
137 
138 int32_t
140 {
141  return 0;
142 }
143 
144 /**
145  * @ingroup scsi_api_initiator
146  * @brief accept new domain notification
147  *
148  * @par Description
149  * Called by base drive when new domain is discovered. An initiator-client
150  * will accept this call to prepare for new remote node notifications
151  * arising from ocs_scsi_new_target().
152  *
153  * The domain context has the element <b>ocs_scsi_ini_domain_t ini_domain</b> which is
154  * declared by the initiator-client code and is used for initiator-client private data.
155  *
156  * This function will only be called if the base-driver has been enabled for initiator
157  * capability.
158  *
159  * Note that this call is made to initiator-client backends, the ocs_scsi_tgt_new_domain()
160  * function is called to target-server backends.
161  *
162  * @param domain pointer to domain
163  *
164  * @return returns 0 for success, a negative error code value for failure.
165  */
166 int32_t ocs_scsi_ini_new_domain(ocs_domain_t *domain)
167 {
168  ocs_assert(domain, -1);
169  ocs_assert(domain->ocs, -1);
170  ocs_log_debug(domain->ocs, "ocs_scsi_ini_new_domain\n");
171  return 0;
172 }
173 
174 
176 {
177  return 0;
178 }
179 /**
180  * @ingroup scsi_api_initiator
181  * @brief accept domain lost notification
182  *
183  * @par Description
184  * Called by base-driver when a domain goes away. An initiator-client will
185  * use this call to clean up all domain scoped resources.
186  *
187  * This function will only be called if the base-driver has been enabled for initiator
188  * capability.
189  *
190  * Note that this call is made to initiator-client backends, the ocs_scsi_tgt_del_domain()
191  * function is called to target-server backends.
192  *
193  * @param domain pointer to domain
194  *
195  * @return returns 0 for success, a negative error code value for failure.
196  */
197 void ocs_scsi_ini_del_domain(ocs_domain_t *domain)
198 {
199  ocs_assert(domain);
200  ocs_assert(domain->ocs);
201 }
202 
203 int32_t ocs_scsi_ini_new_sport(ocs_sport_t *sport)
204 {
205  ocs_log_debug(sport->domain->ocs, "New SPORT: %s\n", sport->display_name);
206  return 0;
207 }
208 
209 void ocs_scsi_ini_del_sport(ocs_sport_t *sport)
210 {
211  ocs_log_debug(sport->domain->ocs, "Del SPORT: %s\n", sport->display_name);
212 }
213 
214 /**
215  * @ingroup scsi_api_initiator
216  * @brief receive notification of a new SCSI target node
217  *
218  * @par Description
219  * Sent by base driver to notify an initiator-client of the presense of a new
220  * remote target. The initiator-server may use this call to prepare for
221  * inbound IO from this node.
222  *
223  * This function is only called if the base driver is enabled for initiator capability.
224  *
225  * @param node pointer to new remote initiator node
226  *
227  * @return none
228  *
229  * @note
230  */
231 
232 int32_t ocs_scsi_new_target(ocs_node_t *node)
233 {
234  return 0;
235 }
236 
237 /**
238  * @ingroup scsi_api_initiator
239  * @brief Delete a SCSI target node
240  *
241  * @par Description
242  * Sent by base driver to notify a initiator-client that a remote target is now gone.
243  * The initiator-client should terminate and cleanup all I/O's associated with the node.
244  *
245  * The ocs_node_t structure has and elment of type ocs_scsi_ini_node_t named
246  * ni_node that is declared and used by a target-server for private
247  * information.
248  *
249  * This function is only called if the base driver is enabled for target capability.
250  *
251  * @param node pointer node being deleted
252  * @param reason reason for deleting the target
253  *
254  * @return Returns OCS_SCSI_CALL_ASYNC if target delete is queued for async completion
255  * and OCS_SCSI_CALL_COMPLETE if call completed or error.
256  *
257  */
258 int32_t ocs_scsi_del_target(ocs_node_t *node, ocs_scsi_del_target_reason_e reason)
259 {
262  ocs_log_debug(node->ocs, "ocs_scsi_del_target\n");
263  return OCS_SCSI_CALL_COMPLETE;
264 }
265 
267 {
268 }
int32_t ocs_scsi_host_update_supported_speed(ocs_t *ocs)
Definition: ocs_ini_stub.c:175
int32_t ocs_scsi_del_target(ocs_node_t *node, ocs_scsi_del_target_reason_e reason)
Delete a SCSI target node.
Definition: ocs_ini_stub.c:258
int32_t ocs_scsi_ini_driver_init(int32_t initiator)
Initialize initiator client.
Definition: ocs_ini_stub.c:51
ocs_scsi_ddump_type_e
Definition: ocs_scsi.h:366
int32_t ocs_scsi_ini_new_device(ocs_t *ocs)
Initializes any initiator fields on the ocs structure.
Definition: ocs_ini_stub.c:121
int32_t ocs_scsi_ini_io_exit(ocs_io_t *io)
Uninitialize SCSI IO.
Definition: ocs_ini_stub.c:85
int32_t ocs_scsi_ini_io_init(ocs_io_t *io)
Initialize SCSI IO.
Definition: ocs_ini_stub.c:69
int32_t ocs_scsi_new_target(ocs_node_t *node)
receive notification of a new SCSI target node
Definition: ocs_ini_stub.c:232
int32_t ocs_scsi_ini_new_domain(ocs_domain_t *domain)
accept new domain notification
Definition: ocs_ini_stub.c:166
void ocs_scsi_ini_del_sport(ocs_sport_t *sport)
Definition: ocs_ini_stub.c:209
int32_t ocs_scsi_ini_new_sport(ocs_sport_t *sport)
Definition: ocs_ini_stub.c:203
ocs_scsi_del_target_reason_e
Definition: ocs_scsi.h:343
int32_t ocs_scsi_ini_driver_exit(int32_t initiator)
initiator client exit
Definition: ocs_ini_stub.c:103
void ocs_scsi_ini_del_domain(ocs_domain_t *domain)
accept domain lost notification
Definition: ocs_ini_stub.c:197
int32_t ocs_scsi_ini_del_device(ocs_t *ocs)
Tears down target members of ocs structure.
Definition: ocs_ini_stub.c:139
#define ocs_assert(cond,...)
Definition: ocs_debug.h:176
#define OCS_SCSI_CALL_COMPLETE
Definition: ocs_scsi.h:249
void ocs_scsi_ini_ddump(ocs_textbuf_t *textbuf, ocs_scsi_ddump_type_e type, void *obj)
Definition: ocs_ini_stub.c:266