Exemple #1
0
DAPL_LMR *dapl_lmr_alloc(IN DAPL_IA * ia,
			 IN DAT_MEM_TYPE mem_type,
			 IN DAT_REGION_DESCRIPTION region_desc,
			 IN DAT_VLEN length,
			 IN DAT_PZ_HANDLE pz_handle,
			 IN DAT_MEM_PRIV_FLAGS mem_priv)
{
	DAPL_LMR *lmr;

	/* Allocate LMR */
	lmr = (DAPL_LMR *) dapl_os_alloc(sizeof(DAPL_LMR));
	if (NULL == lmr) {
		return (NULL);
	}

	/* zero the structure */
	dapl_os_memzero(lmr, sizeof(DAPL_LMR));

	/*
	 * initialize the header
	 */
	lmr->header.provider = ia->header.provider;
	lmr->header.magic = DAPL_MAGIC_LMR;
	lmr->header.handle_type = DAT_HANDLE_TYPE_LMR;
	lmr->header.owner_ia = ia;
	lmr->header.user_context.as_64 = 0;
	lmr->header.user_context.as_ptr = NULL;
	dapl_llist_init_entry(&lmr->header.ia_list_entry);
	dapl_ia_link_lmr(ia, lmr);
	dapl_os_lock_init(&lmr->header.lock);

	/* 
	 * initialize the body 
	 */
	lmr->param.ia_handle = (DAT_IA_HANDLE) ia;
	lmr->param.mem_type = mem_type;
	lmr->param.region_desc = region_desc;
	lmr->param.length = length;
	lmr->param.pz_handle = pz_handle;
	lmr->param.mem_priv = mem_priv;
	dapl_os_atomic_set(&lmr->lmr_ref_count, 0);

	return (lmr);
}
Exemple #2
0
/*
 * dapl_cno_alloc
 *
 * alloc and initialize an EVD struct
 *
 * Input:
 *	ia
 *
 * Returns:
 *	cno_ptr, or null on failure.
 */
DAPL_CNO *
dapl_cno_alloc(
    IN DAPL_IA				*ia_ptr,
    IN DAT_OS_WAIT_PROXY_AGENT		wait_agent)
{
	DAPL_CNO *cno_ptr;

	cno_ptr = (DAPL_CNO *) dapl_os_alloc(sizeof (DAPL_CNO));
	if (!cno_ptr) {
		return (NULL);
	}

	/* zero the structure */
	(void) dapl_os_memzero(cno_ptr, sizeof (DAPL_CNO));

	/*
	 * Initialize the header.
	 */
	cno_ptr->header.provider	= ia_ptr->header.provider;
	cno_ptr->header.magic		= DAPL_MAGIC_CNO;
	cno_ptr->header.handle_type	= DAT_HANDLE_TYPE_CNO;
	cno_ptr->header.owner_ia	= ia_ptr;
	cno_ptr->header.user_context.as_64  = 0;
	cno_ptr->header.user_context.as_ptr = NULL;
	dapl_llist_init_entry(&cno_ptr->header.ia_list_entry);
	dapl_llist_init_head(&cno_ptr->evd_list_head);
	dapl_os_lock_init(&cno_ptr->header.lock);

	/*
	 * Initialize the body
	 */
	cno_ptr->cno_waiters = 0;
	cno_ptr->cno_ref_count = 0;
	cno_ptr->cno_state = DAPL_CNO_STATE_UNTRIGGERED;
	cno_ptr->cno_evd_triggered = NULL;
	cno_ptr->cno_wait_agent = wait_agent;
	(void) dapl_os_wait_object_init(&cno_ptr->cno_wait_object);

	return (cno_ptr);
}
Exemple #3
0
/*
 * dapl_sp_alloc
 *
 * alloc and initialize a PSP INFO struct
 *
 * Input:
 * 	IA INFO struct ptr
 *
 * Output:
 * 	sp_ptr
 *
 * Returns:
 * 	NULL
 *	pointer to sp info struct
 *
 */
DAPL_SP *
dapls_sp_alloc(
	IN DAPL_IA *ia_ptr,
	IN DAT_BOOLEAN is_psp)
{
	DAPL_SP *sp_ptr;

	/* Allocate EP */
	sp_ptr = (DAPL_SP *)dapl_os_alloc(sizeof (DAPL_SP));
	if (sp_ptr == NULL) {
		return (NULL);
	}

	/* zero the structure */
	(void) dapl_os_memzero(sp_ptr, sizeof (DAPL_SP));

	/*
	 * initialize the header
	 */
	sp_ptr->header.provider = ia_ptr->header.provider;
	if (is_psp) {
		sp_ptr->header.magic = DAPL_MAGIC_PSP;
		sp_ptr->header.handle_type = DAT_HANDLE_TYPE_PSP;
	} else {
		sp_ptr->header.magic = DAPL_MAGIC_RSP;
		sp_ptr->header.handle_type = DAT_HANDLE_TYPE_RSP;
	}
	sp_ptr->header.owner_ia = ia_ptr;
	sp_ptr->header.user_context.as_64 = 0;
	sp_ptr->header.user_context.as_ptr = NULL;
	dapl_llist_init_entry(&sp_ptr->header.ia_list_entry);
	dapl_os_lock_init(&sp_ptr->header.lock);

	/*
	 * Initialize the Body (set to NULL above)
	 */
	dapl_llist_init_head(&sp_ptr->cr_list_head);

	return (sp_ptr);
}