dapl_evd_resize.c revision 9e39c5ba00a55fa05777cc94b148296af305e135
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
*
* MODULE: dapl_evd_resize.c
*
* PURPOSE: EVENT management
*
* Description: Interfaces in this file are completely defined in
* the uDAPL 1.1 API, Chapter 6, section 3
*
* $Id: dapl_evd_resize.c,v 1.4 2003/06/16 17:53:32 sjs2 Exp $
*/
#include "dapl_evd_util.h"
#include "dapl_ring_buffer_util.h"
#include "dapl_adapter_util.h"
#include "dapl.h"
#define DAPL_MIN_RESZ_QLEN 4096
/*
* dapl_evd_resize
*
* DAPL Requirements Version xxx, 6.3.2.5
*
* Modify the size fo the event queue of an Event Dispatcher
*
* Input:
* evd_handle
* evd_qlen
*
* Output:
* none
*
* Returns:
* DAT_SUCCESS
* DAT_INVALID_PARAMETER
* DAT_INSUFFICIENT_RESOURCES
* DAT_INVALID_STATE
*/
{
int i;
return (DAT_ERROR(DAT_INVALID_HANDLE, 0));
}
return (DAT_ERROR(DAT_INVALID_STATE, 0));
}
return (DAT_SUCCESS);
}
if (req_evd_qlen > max_evd_qlen) {
return (DAT_ERROR(DAT_INVALID_STATE, 0));
}
while (req_evd_qlen > evd_qlen) {
evd_qlen <<= 1;
if (evd_qlen > max_evd_qlen)
}
/* Allocate EVENTs */
if (!event_ptr) {
return (DAT_ERROR(DAT_INSUFFICIENT_RESOURCES,
}
/* allocate free event queue */
if (dat_status != DAT_SUCCESS) {
goto bail;
}
/* allocate pending event queue */
if (dat_status != DAT_SUCCESS) {
goto bail;
}
if (dat_status != DAT_SUCCESS)
goto bail;
}
/* add events to free event queue */
eventp++;
}
/*
* copy pending events from evd to the new pending event queue
*/
}
}
return (DAT_SUCCESS);
bail:
/*
* If we are here means event_ptr was allocd but something else
* failed
*/
return (dat_status);
}