xref: /titanic_50/usr/src/lib/udapl/udapl_tavor/common/dapl_cr_query.c (revision 9e39c5ba00a55fa05777cc94b148296af305e135)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
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: dapl_cr_query.c
34  *
35  * PURPOSE: Connection management
36  * Description: Interfaces in this file are completely described in
37  *		the DAPL 1.1 API, Chapter 6, section 4
38  *
39  * $Id: dapl_cr_query.c,v 1.8 2003/08/20 13:22:05 sjs2 Exp $
40  */
41 
42 #include "dapl.h"
43 #include "dapl_adapter_util.h"
44 
45 /*
46  * dapl_cr_query
47  *
48  * DAPL Requirements Version xxx, 6.4.2.1
49  *
50  * Return Connection Request args
51  *
52  * Input:
53  *	cr_handle
54  *	cr_param_mask
55  *
56  * Output:
57  *	cr_param
58  *
59  * Returns:
60  *	DAT_SUCCESS
61  *	DAT_INVALID_PARAMETER
62  *	DAT_INVALID_HANDLE
63  */
64 
65 DAT_RETURN
dapl_cr_query(IN DAT_CR_HANDLE cr_handle,IN DAT_CR_PARAM_MASK cr_param_mask,OUT DAT_CR_PARAM * cr_param)66 dapl_cr_query(
67 	IN DAT_CR_HANDLE cr_handle,
68 	IN DAT_CR_PARAM_MASK cr_param_mask,
69 	OUT DAT_CR_PARAM *cr_param)
70 {
71 	DAPL_CR	*cr_ptr;
72 	DAT_RETURN dat_status;
73 
74 	dapl_dbg_log(DAPL_DBG_TYPE_API, "dapl_cr_query (%p, %x, %p)\n",
75 	    cr_handle, cr_param_mask, cr_param);
76 
77 	dat_status = DAT_SUCCESS;
78 	if (DAPL_BAD_HANDLE(cr_handle, DAPL_MAGIC_CR)) {
79 		dat_status = DAT_ERROR(DAT_INVALID_HANDLE,
80 		    DAT_INVALID_HANDLE_CR);
81 		goto bail;
82 	}
83 
84 	if (NULL == cr_param) {
85 		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER,
86 		    DAT_INVALID_ARG3);
87 		goto bail;
88 	}
89 
90 	cr_ptr = (DAPL_CR *) cr_handle;
91 
92 	/* since the arguments are easily accessible, ignore the mask */
93 	(void) dapl_os_memcpy(cr_param, &cr_ptr->param, sizeof (DAT_CR_PARAM));
94 
95 bail:
96 	return (dat_status);
97 }
98