1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved. 24 */ 25 26 /* 27 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 28 * Use is subject to license terms. 29 */ 30 31 /* 32 * 33 * MODULE: udat_api.c 34 * 35 * PURPOSE: DAT Provider and Consumer registry functions. 36 * 37 */ 38 39 #include "dat_osd.h" 40 #include <dat/dat_registry.h> 41 42 DAT_RETURN dat_lmr_create( 43 IN DAT_IA_HANDLE ia_handle, 44 IN DAT_MEM_TYPE mem_type, 45 IN DAT_REGION_DESCRIPTION region_description, 46 IN DAT_VLEN length, 47 IN DAT_PZ_HANDLE pz_handle, 48 IN DAT_MEM_PRIV_FLAGS privileges, 49 OUT DAT_LMR_HANDLE *lmr_handle, 50 OUT DAT_LMR_CONTEXT *lmr_context, 51 OUT DAT_RMR_CONTEXT *rmr_context, 52 OUT DAT_VLEN *registered_length, 53 OUT DAT_VADDR *registered_address) 54 { 55 if (DAT_BAD_HANDLE(ia_handle)) { 56 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 57 } 58 return DAT_LMR_CREATE(ia_handle, 59 mem_type, 60 region_description, 61 length, 62 pz_handle, 63 privileges, 64 lmr_handle, 65 lmr_context, 66 rmr_context, 67 registered_length, 68 registered_address); 69 } 70 71 72 DAT_RETURN dat_evd_create( 73 IN DAT_IA_HANDLE ia_handle, 74 IN DAT_COUNT evd_min_qlen, 75 IN DAT_CNO_HANDLE cno_handle, 76 IN DAT_EVD_FLAGS evd_flags, 77 OUT DAT_EVD_HANDLE *evd_handle) 78 { 79 if (DAT_BAD_HANDLE(ia_handle)) { 80 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 81 } 82 return DAT_EVD_CREATE(ia_handle, 83 evd_min_qlen, 84 cno_handle, 85 evd_flags, 86 evd_handle); 87 } 88 89 90 DAT_RETURN dat_evd_modify_cno( 91 IN DAT_EVD_HANDLE evd_handle, 92 IN DAT_CNO_HANDLE cno_handle) 93 { 94 if (DAT_BAD_HANDLE(evd_handle)) { 95 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 96 } 97 return DAT_EVD_MODIFY_CNO(evd_handle, 98 cno_handle); 99 } 100 101 102 DAT_RETURN dat_cno_create( 103 IN DAT_IA_HANDLE ia_handle, 104 IN DAT_OS_WAIT_PROXY_AGENT agent, 105 OUT DAT_CNO_HANDLE *cno_handle) 106 { 107 if (DAT_BAD_HANDLE(ia_handle)) { 108 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 109 } 110 return DAT_CNO_CREATE(ia_handle, 111 agent, 112 cno_handle); 113 } 114 115 116 DAT_RETURN dat_cno_modify_agent( 117 IN DAT_CNO_HANDLE cno_handle, 118 IN DAT_OS_WAIT_PROXY_AGENT agent) 119 { 120 if (DAT_BAD_HANDLE(cno_handle)) { 121 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CNO)); 122 } 123 return DAT_CNO_MODIFY_AGENT(cno_handle, 124 agent); 125 } 126 127 128 DAT_RETURN dat_cno_query( 129 IN DAT_CNO_HANDLE cno_handle, 130 IN DAT_CNO_PARAM_MASK cno_param_mask, 131 OUT DAT_CNO_PARAM *cno_param) 132 { 133 if (DAT_BAD_HANDLE(cno_handle)) { 134 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CNO)); 135 } 136 return DAT_CNO_QUERY(cno_handle, 137 cno_param_mask, 138 cno_param); 139 } 140 141 142 DAT_RETURN dat_cno_free( 143 IN DAT_CNO_HANDLE cno_handle) 144 { 145 if (DAT_BAD_HANDLE(cno_handle)) { 146 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CNO)); 147 } 148 return (DAT_CNO_FREE(cno_handle)); 149 } 150 151 152 DAT_RETURN dat_cno_wait( 153 IN DAT_CNO_HANDLE cno_handle, 154 IN DAT_TIMEOUT timeout, 155 OUT DAT_EVD_HANDLE *evd_handle) 156 { 157 if (DAT_BAD_HANDLE(cno_handle)) { 158 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CNO)); 159 } 160 return DAT_CNO_WAIT(cno_handle, 161 timeout, 162 evd_handle); 163 } 164 165 166 DAT_RETURN dat_evd_enable( 167 IN DAT_EVD_HANDLE evd_handle) 168 { 169 if (DAT_BAD_HANDLE(evd_handle)) { 170 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 171 } 172 return (DAT_EVD_ENABLE(evd_handle)); 173 } 174 175 176 DAT_RETURN dat_evd_wait( 177 IN DAT_EVD_HANDLE evd_handle, 178 IN DAT_TIMEOUT Timeout, 179 IN DAT_COUNT Threshold, 180 OUT DAT_EVENT *event, 181 OUT DAT_COUNT *n_more_events) 182 { 183 if (DAT_BAD_HANDLE(evd_handle)) { 184 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 185 } 186 return DAT_EVD_WAIT(evd_handle, 187 Timeout, 188 Threshold, 189 event, 190 n_more_events); 191 } 192 193 194 DAT_RETURN dat_evd_disable( 195 IN DAT_EVD_HANDLE evd_handle) 196 { 197 if (DAT_BAD_HANDLE(evd_handle)) { 198 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 199 } 200 return (DAT_EVD_DISABLE(evd_handle)); 201 } 202 203 204 DAT_RETURN dat_evd_set_unwaitable( 205 IN DAT_EVD_HANDLE evd_handle) 206 { 207 if (DAT_BAD_HANDLE(evd_handle)) { 208 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 209 } 210 return (DAT_EVD_SET_UNWAITABLE(evd_handle)); 211 } 212 213 DAT_RETURN dat_evd_clear_unwaitable( 214 IN DAT_EVD_HANDLE evd_handle) 215 { 216 if (DAT_BAD_HANDLE(evd_handle)) { 217 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 218 } 219 return (DAT_EVD_CLEAR_UNWAITABLE(evd_handle)); 220 } 221 222 DAT_RETURN dat_cr_handoff( 223 IN DAT_CR_HANDLE cr_handle, 224 IN DAT_CONN_QUAL handoff) 225 { 226 if (DAT_BAD_HANDLE(cr_handle)) { 227 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_CR)); 228 } 229 return DAT_CR_HANDOFF(cr_handle, 230 handoff); 231 } 232 233 234 DAT_RETURN dat_psp_create_any( 235 IN DAT_IA_HANDLE ia_handle, 236 OUT DAT_CONN_QUAL *conn_qual, 237 IN DAT_EVD_HANDLE evd_handle, 238 IN DAT_PSP_FLAGS psp_flags, 239 OUT DAT_PSP_HANDLE *psp_handle) 240 { 241 if (DAT_BAD_HANDLE(ia_handle)) { 242 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 243 } 244 return DAT_PSP_CREATE_ANY(ia_handle, 245 conn_qual, 246 evd_handle, 247 psp_flags, 248 psp_handle); 249 } 250 251 252 DAT_RETURN dat_ia_query( 253 IN DAT_IA_HANDLE ia_handle, 254 OUT DAT_EVD_HANDLE *async_evd_handle, 255 IN DAT_IA_ATTR_MASK ia_attr_mask, 256 OUT DAT_IA_ATTR *ia_attr, 257 IN DAT_PROVIDER_ATTR_MASK provider_attr_mask, 258 OUT DAT_PROVIDER_ATTR *provider_attr) 259 { 260 if (DAT_BAD_HANDLE(ia_handle)) { 261 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA)); 262 } 263 return DAT_IA_QUERY(ia_handle, 264 async_evd_handle, 265 ia_attr_mask, 266 ia_attr, 267 provider_attr_mask, 268 provider_attr); 269 } 270 271 272 DAT_RETURN dat_evd_query( 273 IN DAT_EVD_HANDLE evd_handle, 274 IN DAT_EVD_PARAM_MASK evd_param_mask, 275 OUT DAT_EVD_PARAM *evd_param) 276 { 277 if (DAT_BAD_HANDLE(evd_handle)) { 278 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE1)); 279 } 280 return DAT_EVD_QUERY(evd_handle, 281 evd_param_mask, 282 evd_param); 283 } 284 285 286 DAT_RETURN dat_lmr_query( 287 IN DAT_LMR_HANDLE lmr_handle, 288 IN DAT_LMR_PARAM_MASK lmv_param_mask, 289 OUT DAT_LMR_PARAM *lmr_param) 290 { 291 if (DAT_BAD_HANDLE(lmr_handle)) { 292 return (DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_LMR)); 293 } 294 return DAT_LMR_QUERY(lmr_handle, 295 lmv_param_mask, 296 lmr_param); 297 } 298