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 2003 Sun Microsystems, Inc. All rights reserved. 28 * Use is subject to license terms. 29 */ 30 31 /* 32 * 33 * MODULE: dapl_cno_create.c 34 * 35 * PURPOSE: Consumer Notification Object creation 36 * Description: Interfaces in this file are completely described in 37 * the DAPL 1.1 API, Chapter 6, section 3.2.1 38 * 39 * $Id: dapl_cno_create.c,v 1.5 2003/06/16 17:53:32 sjs2 Exp $ 40 */ 41 42 #include "dapl.h" 43 #include "dapl_cno_util.h" 44 #include "dapl_ia_util.h" 45 #include "dapl_adapter_util.h" 46 47 /* 48 * dapl_cno_create 49 * 50 * DAPL Requirements Version xxx, 6.3.4.1 51 * 52 * Create a consumer notification object instance 53 * 54 * Input: 55 * ia_handle 56 * wait_agent 57 * cno_handle 58 * 59 * Output: 60 * cno_handle 61 * 62 * Returns: 63 * DAT_SUCCESS 64 * DAT_INSUFFICIENT_RESOURCES 65 * DAT_INVALID_HANDLE 66 * DAT_INVALID_PARAMETER 67 */ 68 DAT_RETURN dapl_cno_create( 69 IN DAT_IA_HANDLE ia_handle, /* ia_handle */ 70 IN DAT_OS_WAIT_PROXY_AGENT wait_agent, /* agent */ 71 OUT DAT_CNO_HANDLE *cno_handle) /* cno_handle */ 72 73 { 74 DAPL_IA *ia_ptr; 75 DAPL_CNO *cno_ptr; 76 DAT_RETURN dat_status; 77 78 ia_ptr = (DAPL_IA *)ia_handle; 79 cno_ptr = NULL; 80 dat_status = DAT_SUCCESS; 81 82 if (DAPL_BAD_HANDLE(ia_handle, DAPL_MAGIC_IA)) { 83 dat_status = DAT_ERROR(DAT_INVALID_HANDLE, 84 DAT_INVALID_HANDLE_IA); 85 goto bail; 86 } 87 88 cno_ptr = dapl_cno_alloc(ia_ptr, wait_agent); 89 90 if (!cno_ptr) { 91 dat_status = DAT_ERROR(DAT_INSUFFICIENT_RESOURCES, 92 DAT_RESOURCE_MEMORY); 93 goto bail; 94 } 95 96 cno_ptr->cno_state = DAPL_CNO_STATE_UNTRIGGERED; 97 98 dat_status = dapls_ib_cno_alloc(ia_ptr, cno_ptr); 99 if (dat_status != DAT_SUCCESS) { 100 goto bail; 101 } 102 103 dapl_ia_link_cno(ia_ptr, cno_ptr); 104 105 *cno_handle = cno_ptr; 106 107 bail: 108 if (dat_status != DAT_SUCCESS && cno_ptr != NULL) { 109 dapl_cno_dealloc(cno_ptr); 110 } 111 return (dat_status); 112 } 113