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_pz_query.c
34  *
35  * PURPOSE: Memory management
36  * Description: Interfaces in this file are completely described in
37  *		the DAPL 1.1 API, Chapter 6, section 6
38  *
39  * $Id: dapl_pz_query.c,v 1.6 2003/07/30 18:13:40 hobie16 Exp $
40  */
41 
42 #include "dapl.h"
43 
44 /*
45  * dapl_pz_query
46  *
47  * DAPL Requirements Version xxx, 6.6.2.1
48  *
49  * Return the ia associated with the protection zone pz
50  *
51  * Input:
52  * 	pz_handle
53  *      pz_param_mask
54  *
55  * Output:
56  * 	pz_param
57  *
58  * Returns:
59  * 	DAT_SUCCESS
60  *      DAT_INVALID_HANDLE
61  * 	DAT_INVALID_PARAMETER
62  */
63 DAT_RETURN
dapl_pz_query(IN DAT_PZ_HANDLE pz_handle,IN DAT_PZ_PARAM_MASK pz_param_mask,OUT DAT_PZ_PARAM * pz_param)64 dapl_pz_query(
65 	IN	DAT_PZ_HANDLE		pz_handle,
66 	IN	DAT_PZ_PARAM_MASK	pz_param_mask,
67 	OUT	DAT_PZ_PARAM		*pz_param)
68 {
69 	DAPL_PZ		*pz;
70 	DAT_RETURN	dat_status;
71 
72 	dapl_dbg_log(DAPL_DBG_TYPE_API,
73 	    "dapl_pz_query (%p, %x, %p)\n",
74 	    pz_handle,
75 	    pz_param_mask,
76 	    pz_param);
77 
78 	dat_status = DAT_SUCCESS;
79 
80 	if (DAPL_BAD_HANDLE(pz_handle, DAPL_MAGIC_PZ)) {
81 		dat_status = DAT_ERROR(DAT_INVALID_HANDLE,
82 		    DAT_INVALID_HANDLE_PZ);
83 		goto bail;
84 	}
85 	if (NULL == pz_param) {
86 		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
87 		goto bail;
88 	}
89 	if (pz_param_mask & ~DAT_PZ_FIELD_ALL) {
90 		dat_status = DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG2);
91 		goto bail;
92 	}
93 
94 	pz = (DAPL_PZ *) pz_handle;
95 
96 	/* Since the DAT_PZ_ARGS values are easily accessible, */
97 	/* don't bother checking the DAT_PZ_ARGS_MASK value    */
98 	pz_param->ia_handle = (DAT_IA_HANDLE) pz->header.owner_ia;
99 
100 bail:
101 	return (dat_status);
102 }
103