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_cno_query.c
34 *
35 * PURPOSE: Return the consumer parameters of the CNO
36 * Description: Interfaces in this file are completely described in
37 *		the DAPL 1.1 API, Chapter 6, section 3.2.5
38 *
39 * $Id: dapl_cno_query.c,v 1.5 2003/06/16 17:53:32 sjs2 Exp $
40 */
41
42#include "dapl.h"
43
44/*
45 * dapl_cno_query
46 *
47 * DAPL Requirements Version xxx, 6.3.2.5
48 *
49 * Return the consumer parameters of the CNO
50 *
51 * Input:
52 *	cno_handle
53 *	cno_param_mask
54 *	cno_param
55 *
56 * Output:
57 *	cno_param
58 *
59 * Returns:
60 *	DAT_SUCCESS
61 *	DAT_INVALID_HANDLE
62 *	DAT_INVALID_PARAMETER
63 */
64DAT_RETURN
65dapl_cno_query(
66	IN	DAT_CNO_HANDLE		cno_handle,	/* cno_handle */
67	IN	DAT_CNO_PARAM_MASK	cno_param_mask,	/* cno_param_mask */
68	OUT	DAT_CNO_PARAM 		*cno_param)	/* cno_param */
69{
70	DAPL_CNO	 *cno_ptr;
71	DAT_RETURN   dat_status;
72
73	dat_status = DAT_SUCCESS;
74
75	if (DAPL_BAD_HANDLE(cno_handle, DAPL_MAGIC_CNO)) {
76		dat_status = DAT_ERROR(DAT_INVALID_HANDLE,
77		    DAT_INVALID_HANDLE_CNO);
78		goto bail;
79	}
80
81	/* check for invalid cno param mask */
82	if (cno_param_mask & ~DAT_CNO_FIELD_ALL) {
83		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);
84		goto bail;
85	}
86
87	if (NULL == cno_param) {
88		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
89		goto bail;
90	}
91
92	cno_ptr = (DAPL_CNO *)cno_handle;
93	cno_param->ia_handle = cno_ptr->header.owner_ia;
94	cno_param->agent = cno_ptr->cno_wait_agent;
95
96bail:
97	return (dat_status);
98}
99