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