Debian Codegraph @

dat/udat/udat_api.c

raw
1 /*
2 * Copyright (c) 2002-2006, Network Appliance, Inc. All rights reserved.
3 *
4 * This Software is licensed under all of the following licenses:
5 *
6 * 1) under the terms of the "Common Public License 1.0" a copy of which is
7 * in the file LICENSE.txt in the root directory. The license is also
8 * available from the Open Source Initiative, see
9 * http://www.opensource.org/licenses/cpl.php.
10 *
11 * 2) under the terms of the "The BSD License" a copy of which is in the file
12 * LICENSE2.txt in the root directory. The license is also available from
13 * the Open Source Initiative, see
14 * http://www.opensource.org/licenses/bsd-license.php.
15 *
16 * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
17 * copy of which is in the file LICENSE3.txt in the root directory. The
18 * license is also available from the Open Source Initiative, see
19 * http://www.opensource.org/licenses/gpl-license.php.
20 *
21 * Licensee has the right to choose one of the above licenses.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions are
25 * met:
26 *
27 * Redistributions of source code must retain the above copyright
28 * notice and one of the license notices.
29 *
30 * Redistributions in binary form must reproduce both the above copyright
31 * notice, one of the license notices in the documentation
32 * and/or other materials provided with the distribution.
33 *
34 * Neither the name of Network Appliance, Inc. nor the names of other DAT
35 * Collaborative contributors may be used to endorse or promote
36 * products derived from this software without specific prior written
37 * permission.
38 */
39
40 /**********************************************************************
41 *
42 * MODULE: udat.c
43 *
44 * PURPOSE: DAT Provider and Consumer registry functions.
45 *
46 * $Id: udat_api.c 1301 2005-03-24 05:58:55Z jlentini $
47 **********************************************************************/
48
49 #include <dat2/udat.h>
50 #include <dat2/dat_registry.h>
51 #include "dat_osd.h"
52 #include "dat_init.h"
53
54 #define UDAT_IS_BAD_HANDLE(h) ( NULL == (p) )
55
56 DAT_RETURN DAT_API dat_lmr_create(IN DAT_IA_HANDLE ia_handle,
57 IN DAT_MEM_TYPE mem_type,
58 IN DAT_REGION_DESCRIPTION region_description,
59 IN DAT_VLEN length,
60 IN DAT_PZ_HANDLE pz_handle,
61 IN DAT_MEM_PRIV_FLAGS privileges,
62 IN DAT_VA_TYPE va_type,
63 OUT DAT_LMR_HANDLE * lmr_handle,
64 OUT DAT_LMR_CONTEXT * lmr_context,
65 OUT DAT_RMR_CONTEXT * rmr_context,
66 OUT DAT_VLEN * registered_length,
67 OUT DAT_VADDR * registered_address)
68 {
69 DAT_IA_HANDLE dapl_ia_handle;
70 DAT_RETURN dat_status;
71
72 dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
73 if (dat_status == DAT_SUCCESS) {
74 dat_status = DAT_LMR_CREATE(dapl_ia_handle,
75 mem_type,
76 region_description,
77 length,
78 pz_handle,
79 privileges,
80 va_type,
81 lmr_handle,
82 lmr_context,
83 rmr_context,
84 registered_length,
85 registered_address);
86 }
87
88 return dat_status;
89 }
90
91 DAT_RETURN DAT_API dat_evd_create(IN DAT_IA_HANDLE ia_handle,
92 IN DAT_COUNT evd_min_qlen,
93 IN DAT_CNO_HANDLE cno_handle,
94 IN DAT_EVD_FLAGS evd_flags,
95 OUT DAT_EVD_HANDLE * evd_handle)
96 {
97 DAT_IA_HANDLE dapl_ia_handle;
98 DAT_RETURN dat_status;
99
100 dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
101 if (dat_status == DAT_SUCCESS) {
102 dat_status = DAT_EVD_CREATE(dapl_ia_handle,
103 evd_min_qlen,
104 cno_handle, evd_flags, evd_handle);
105 }
106
107 return dat_status;
108 }
109
110 DAT_RETURN DAT_API dat_evd_modify_cno(IN DAT_EVD_HANDLE evd_handle,
111 IN DAT_CNO_HANDLE cno_handle)
112 {
113 if (evd_handle == NULL) {
114 return DAT_ERROR(DAT_INVALID_HANDLE,
115 DAT_INVALID_HANDLE_EVD_REQUEST);
116 }
117 return DAT_EVD_MODIFY_CNO(evd_handle, cno_handle);
118 }
119
120 DAT_RETURN DAT_API dat_cno_create(IN DAT_IA_HANDLE ia_handle,
121 IN DAT_OS_WAIT_PROXY_AGENT agent,
122 OUT DAT_CNO_HANDLE * cno_handle)
123 {
124 DAT_IA_HANDLE dapl_ia_handle;
125 DAT_RETURN dat_status;
126
127 dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
128 if (dat_status == DAT_SUCCESS) {
129 dat_status = DAT_CNO_CREATE(dapl_ia_handle, agent, cno_handle);
130 }
131
132 return dat_status;
133 }
134
135 DAT_RETURN DAT_API dat_cno_fd_create(IN DAT_IA_HANDLE ia_handle,
136 OUT DAT_FD * fd,
137 OUT DAT_CNO_HANDLE * cno_handle)
138 {
139 DAT_IA_HANDLE dapl_ia_handle;
140 DAT_RETURN dat_status;
141
142 dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
143 if (dat_status == DAT_SUCCESS) {
144 dat_status = DAT_CNO_FD_CREATE(dapl_ia_handle,
145 (DAT_FD *) fd, cno_handle);
146 }
147
148 return dat_status;
149 }
150
151 DAT_RETURN DAT_API dat_cno_modify_agent(IN DAT_CNO_HANDLE cno_handle,
152 IN DAT_OS_WAIT_PROXY_AGENT agent)
153 {
154 if (cno_handle == NULL) {
155 return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CNO);
156 }
157 return DAT_CNO_MODIFY_AGENT(cno_handle, agent);
158 }
159
160 DAT_RETURN DAT_API dat_cno_query(IN DAT_CNO_HANDLE cno_handle,
161 IN DAT_CNO_PARAM_MASK cno_param_mask,
162 OUT DAT_CNO_PARAM * cno_param)
163 {
164 if (cno_handle == NULL) {
165 return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CNO);
166 }
167 return DAT_CNO_QUERY(cno_handle, cno_param_mask, cno_param);
168 }
169
170 DAT_RETURN DAT_API dat_cno_free(IN DAT_CNO_HANDLE cno_handle)
171 {
172 if (cno_handle == NULL) {
173 return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CNO);
174 }
175 return DAT_CNO_FREE(cno_handle);
176 }
177
178 DAT_RETURN DAT_API dat_cno_wait(IN DAT_CNO_HANDLE cno_handle,
179 IN DAT_TIMEOUT timeout,
180 OUT DAT_EVD_HANDLE * evd_handle)
181 {
182 if (cno_handle == NULL) {
183 return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CNO);
184 }
185 return DAT_CNO_WAIT(cno_handle, timeout, evd_handle);
186 }
187
188 DAT_RETURN DAT_API dat_evd_enable(IN DAT_EVD_HANDLE evd_handle)
189 {
190 if (evd_handle == NULL) {
191 return DAT_ERROR(DAT_INVALID_HANDLE,
192 DAT_INVALID_HANDLE_EVD_REQUEST);
193 }
194 return DAT_EVD_ENABLE(evd_handle);
195 }
196
197 DAT_RETURN DAT_API dat_evd_wait(IN DAT_EVD_HANDLE evd_handle,
198 IN DAT_TIMEOUT Timeout,
199 IN DAT_COUNT Threshold,
200 OUT DAT_EVENT * event,
201 OUT DAT_COUNT * n_more_events)
202 {
203 if (evd_handle == NULL) {
204 return DAT_ERROR(DAT_INVALID_HANDLE,
205 DAT_INVALID_HANDLE_EVD_REQUEST);
206 }
207 return DAT_EVD_WAIT(evd_handle,
208 Timeout, Threshold, event, n_more_events);
209 }
210
211 DAT_RETURN DAT_API dat_evd_disable(IN DAT_EVD_HANDLE evd_handle)
212 {
213 if (evd_handle == NULL) {
214 return DAT_ERROR(DAT_INVALID_HANDLE,
215 DAT_INVALID_HANDLE_EVD_REQUEST);
216 }
217 return DAT_EVD_DISABLE(evd_handle);
218 }
219
220 DAT_RETURN DAT_API dat_evd_set_unwaitable(IN DAT_EVD_HANDLE evd_handle)
221 {
222 if (evd_handle == NULL) {
223 return DAT_ERROR(DAT_INVALID_HANDLE,
224 DAT_INVALID_HANDLE_EVD_REQUEST);
225 }
226 return DAT_EVD_SET_UNWAITABLE(evd_handle);
227 }
228
229 DAT_RETURN DAT_API dat_evd_clear_unwaitable(IN DAT_EVD_HANDLE evd_handle)
230 {
231 if (evd_handle == NULL) {
232 return DAT_ERROR(DAT_INVALID_HANDLE,
233 DAT_INVALID_HANDLE_EVD_REQUEST);
234 }
235 return DAT_EVD_CLEAR_UNWAITABLE(evd_handle);
236 }
237
238 DAT_RETURN DAT_API dat_cr_handoff(IN DAT_CR_HANDLE cr_handle,
239 IN DAT_CONN_QUAL handoff)
240 {
241 if (cr_handle == NULL) {
242 return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR);
243 }
244 return DAT_CR_HANDOFF(cr_handle, handoff);
245 }
246
247 DAT_RETURN DAT_API dat_lmr_query(IN DAT_LMR_HANDLE lmr_handle,
248 IN DAT_LMR_PARAM_MASK lmr_param_mask,
249 OUT DAT_LMR_PARAM * lmr_param)
250 {
251 if (lmr_handle == NULL) {
252 return DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_LMR);
253 }
254 return DAT_LMR_QUERY(lmr_handle, lmr_param_mask, lmr_param);
255 }
256
257 /*
258 * Local variables:
259 * c-indent-level: 4
260 * c-basic-offset: 4
261 * tab-width: 8
262 * End:
263 */