Exemple #1
0
static void *ESIF_CALLCONV EsifEventMgr_EventQueueThread(void *ctxPtr)
{
	EsifEventQueueItemPtr queueEventPtr = NULL;

	UNREFERENCED_PARAMETER(ctxPtr);

	while(!g_EsifEventMgr.eventQueueExitFlag) {
		queueEventPtr = esif_queue_pull(g_EsifEventMgr.eventQueuePtr);

		if (NULL == queueEventPtr) {
			continue;
		}

		ESIF_TRACE_INFO("Dequeuing %s event for Part. %u Dom. 0x%04X\n",
			esif_event_type_str(queueEventPtr->eventType),
			queueEventPtr->participantId,
			queueEventPtr->domainId);

		EsifEventMgr_ProcessEvent(queueEventPtr->participantId,
			queueEventPtr->domainId,
			queueEventPtr->eventType,
			&queueEventPtr->eventData);

		esif_ccb_free(queueEventPtr->eventData.buf_ptr);
		esif_ccb_free(queueEventPtr);
	}
	return 0;
}
Exemple #2
0
// Uninitialize Pathname List
void esif_pathlist_exit(void)
{
	int j;
	for (j = 0; g_pathlist.pathlist != NULL && j < g_pathlist.num_paths; j++) {
		esif_ccb_free(g_pathlist.pathlist[j]);
	}
	esif_ccb_free(g_pathlist.pathlist);
	memset(&g_pathlist, 0, sizeof(g_pathlist));
}
Exemple #3
0
static void EsifEventMgr_QueueDestroyCallback(void *ctxPtr)
{
	EsifEventQueueItemPtr queueEventPtr = (EsifEventQueueItemPtr)ctxPtr;

	if(queueEventPtr != NULL) {
		esif_ccb_free(queueEventPtr->eventData.buf_ptr);
		esif_ccb_free(queueEventPtr);
	}
}
Exemple #4
0
static void EsifDataLogCleanup()
{
	if (dataLogContextPtr != NULL) {
		esif_ccb_timer_kill(dataLogContextPtr->dataLogScheduleTimer);
		esif_ccb_free(dataLogContextPtr->dataLogScheduleTimer);
		esif_ccb_free(dataLogContextPtr->dataLogParticipantList);
		esif_ccb_free(dataLogContextPtr);
		dataLogContextPtr = NULL;
	}
}
Exemple #5
0
// Read a Registry Key Value into a specified memory buffer
static eEsifError DataVault_ReadRegistry (
	DataVaultPtr self,
	esif_string keyname,
	void * *buffer,
	UInt32 *buf_size
	)
{
	eEsifError rc   = ESIF_E_UNSPECIFIED;
	HKEY hKey       = 0;
	DWORD dwFlags   = RRF_RT_ANY;
	DWORD dwError   = 0;
	DWORD dwSize    = 0;
	char *regkey    = 0;
	char *valuename = 0;
	u32 j;

	UNREFERENCED_PARAMETER(self);

	// Format: HKLM\Subkey\Path\ValueName
	for (j = 0; HKeyList[j].name; j++) {
		size_t namelen = esif_ccb_strlen(HKeyList[j].name, 30);
		if (esif_ccb_strnicmp(HKeyList[j].name, keyname, namelen) == 0 && keyname[namelen] == '\\') {
			hKey     = HKeyList[j].hkey;
			keyname += esif_ccb_strlen(HKeyList[j].name, 30) + 1;
			break;
		}
	}
	if (!hKey) {
		return rc;
	}

	regkey = esif_ccb_strdup(keyname);
	if ((valuename = strrchr(regkey, '\\')) == 0) {
		esif_ccb_free(regkey);
		return rc;
	}
	*valuename++ = 0;

	// Get Data Size from Registry and copy into buffer if found
	if ((dwError = RegGetValueA(hKey, regkey, valuename, dwFlags, NULL, 0, &dwSize)) == 0) {
		void *reg_buf = esif_ccb_malloc(dwSize);
		dwError = RegGetValueA(hKey, regkey, valuename, dwFlags, NULL, reg_buf, &dwSize);
		if (dwError == 0) {
			*buffer   = reg_buf;
			*buf_size = dwSize;
			rc = ESIF_OK;
		} else {
			esif_ccb_free(reg_buf);
		}
	} else {
		rc = ESIF_E_NOT_FOUND;
	}
	esif_ccb_free(regkey);
	return rc;
}
Exemple #6
0
void esif_dsp_table_destroy()
{
	UInt8 i;
	ESIF_TRACE_INFO("Destroy DSP Table");
	for (i = 0; i < g_dm.dme_count; i++) {
		esif_dsp_destroy(g_dm.dme[i].dsp_ptr);
		esif_ccb_free(g_dm.dme[i].file_ptr);
		esif_ccb_free(g_dm.dme[i].fpc_ptr);
		esif_ccb_memset(&g_dm.dme[i], 0, sizeof(g_dm.dme[i]));
	}
	g_dm.dme_count = 0;
}
Exemple #7
0
static void esif_ws_http_process_post (const char *buffer)
{
	char *begPtr;
	char *endPtr;
	char *namebox;
	char *nameboxVal     = NULL;
	char *passwordbox;
	char *passwordboxVal = NULL;
	size_t namebox_size;
	size_t passwordbox_size;

	printf("buffer from POST: %s\n", buffer);

	namebox = strstr(buffer, "namebox");
	if (namebox) {
		begPtr = strchr((const char*)namebox, '=');
		begPtr++;
		endPtr = strchr(begPtr, '&');
		namebox_size = endPtr - begPtr;
		nameboxVal   = (char*)esif_ccb_malloc(namebox_size + 1);
		if (NULL == nameboxVal) {
			exit(1);
		}
		esif_ccb_memcpy(nameboxVal, namebox + 8, namebox_size + 1);
		nameboxVal[namebox_size] = 0;
		printf("name: %s ", nameboxVal);
	}

	passwordbox = strstr(buffer, "passwordbox");

	if (passwordbox) {
		begPtr = strchr((const char*)passwordbox, '=');
		begPtr++;
		endPtr = strchr(begPtr, '&');
		passwordbox_size = endPtr - begPtr;
		passwordboxVal   = (char*)esif_ccb_malloc(passwordbox_size + 1);
		if (NULL == passwordboxVal) {
			exit(1);
		}
		esif_ccb_memcpy(passwordboxVal, passwordbox + 12, passwordbox_size + 1);
		passwordboxVal[passwordbox_size] = 0;
		printf("password: %s\n", passwordboxVal);
	}

	if (nameboxVal) {
		esif_ccb_free(nameboxVal);
	}

	if (passwordboxVal) {
		esif_ccb_free(passwordboxVal);
	}
}
Exemple #8
0
void esif_ws_protocol_initialize(ProtocolPtr protPtr)
{
	esif_ccb_free(protPtr->hostField);
	esif_ccb_free(protPtr->originField);
	esif_ccb_free(protPtr->webpage);
	esif_ccb_free(protPtr->keyField);
	esif_ccb_free(protPtr->web_socket_field);
	protPtr->hostField   = NULL;
	protPtr->originField = NULL;
	protPtr->webpage     = NULL;
	protPtr->keyField    = NULL;
	protPtr->web_socket_field = NULL;
	protPtr->frameType = EMPTY_FRAME;
}
Exemple #9
0
/* Destroy Hash Table */
void esif_ht_destroy(
    struct esif_ht *self,
    item_destroy_func item_destroy_fptr
)
{
    u32 index = 0;

    if ((self == NULL) || (self->table == NULL)) {
        ESIF_TRACE_ERROR("Hash table ptr NULL\n");
        goto exit;
    }

    ESIF_TRACE_DYN_VERB("Destroying hash table %p\n", self);

    for (index = 0; index < self->size; ++index) {
        if (self->table[index] == NULL)
            continue;

        ESIF_TRACE_DYN_VERB("Destroy linked list %d\n", index);

        esif_destroy_ht_nodes(self->table[index], item_destroy_fptr);
        esif_link_list_destroy(self->table[index]);
        self->table[index] = NULL;
    }

    esif_ccb_free(self->table);
    esif_ccb_mempool_free(ESIF_MEMPOOL_TYPE_HASH2, self);
exit:
    return;
}
Exemple #10
0
/* This should only be called when shutting down */
static eEsifError EsifUpManagerDestroyParticipants(void)
{
	eEsifError rc = ESIF_OK;
	EsifUpManagerEntryPtr entry_ptr = NULL;
	UInt8 i = 0;

	esif_ccb_write_lock(&g_uppMgr.fLock);

	for (i = 0; i < MAX_PARTICIPANT_ENTRY; i++) {
		entry_ptr = &g_uppMgr.fEntries[i];

		if (entry_ptr->fState > ESIF_PM_PARTICIPANT_REMOVED) {
			g_uppMgr.fEntryCount--;
		}
		entry_ptr->fState = ESIF_PM_PARTICIPANT_STATE_AVAILABLE;

		if (NULL != entry_ptr->fUpPtr) {
			esif_ccb_free(entry_ptr->fUpPtr);
			entry_ptr->fUpPtr = NULL;
		}
	}

	esif_ccb_write_unlock(&g_uppMgr.fLock);

	ESIF_TRACE_INFO("The participants are destroyed in ESIF UF participant manager\n");
	return rc;
}
Exemple #11
0
int EsifLogFile_Open(EsifLogType type, const char *filename, int append)
{
	int rc=0;
	char fullpath[MAX_PATH]={0};
	char mode[3] = {(append ? 'a' : 'w'), 0, 0};

	esif_ccb_write_lock(&g_EsifLogFile[type].lock);
	if (g_EsifLogFile[type].handle != NULL)
		esif_ccb_fclose(g_EsifLogFile[type].handle);

	EsifLogFile_GetFullPath(fullpath, sizeof(fullpath), filename);
#ifdef ESIF_ATTR_OS_WINDOWS
	mode[1] = 'c';
	g_EsifLogFile[type].handle = _fsopen(fullpath, mode, _SH_DENYWR);
	if (g_EsifLogFile[type].handle == NULL)
		rc = errno;
#else
	rc = esif_ccb_fopen(&g_EsifLogFile[type].handle, fullpath, mode);
#endif
	if (rc == 0) {
		esif_ccb_free(g_EsifLogFile[type].filename);
		g_EsifLogFile[type].filename = esif_ccb_strdup((char *)fullpath);
	}
	esif_ccb_write_unlock(&g_EsifLogFile[type].lock);
	return rc;
}
Exemple #12
0
void EsifActMgrExit()
{
	u8 i = 0;
	EsifActPtr a_act_ptr = NULL;

	ESIF_TRACE_ENTRY_INFO();

	/* Call before destroying action manager */
	EsifActExit();

	if (NULL != g_actMgr.fActTypes) {
		esif_link_list_destroy(g_actMgr.fActTypes);
		g_actMgr.fActTypes = NULL;  //set to null so that it will be caught if mid-execution
	}

	esif_ccb_read_lock(&g_actMgr.fLock);
	for (i = 0; i < ESIF_MAX_ACTIONS; i++) {
		a_act_ptr = &g_actMgr.fEnrtries[i];
		esif_ccb_free(a_act_ptr->fLibNamePtr);
		esif_ccb_library_unload(a_act_ptr->fLibHandle);
		esif_ccb_memset(a_act_ptr, 0, sizeof(*a_act_ptr));
	}
	esif_ccb_read_unlock(&g_actMgr.fLock);

	esif_ccb_lock_uninit(&g_actMgr.fLock);

	ESIF_TRACE_EXIT_INFO();
}
Exemple #13
0
void EsifAppMgrExit()
{
	u8 i = 0;
	EsifAppPtr a_app_ptr = NULL;

	ESIF_TRACE_ENTRY_INFO();

	EsifEventMgr_UnregisterEventByType(ESIF_EVENT_PARTICIPANT_SUSPEND, EVENT_MGR_MATCH_ANY, EVENT_MGR_DOMAIN_D0, EsifAppMgr_EventCallback, NULL);
	EsifEventMgr_UnregisterEventByType(ESIF_EVENT_PARTICIPANT_RESUME, EVENT_MGR_MATCH_ANY, EVENT_MGR_DOMAIN_D0, EsifAppMgr_EventCallback, NULL);

	EsifAppExit();
	ESIF_TRACE_DEBUG("Exit Action Manager (APPMGR)");

	esif_ccb_read_lock(&g_appMgr.fLock);
	for (i = 0; i < ESIF_MAX_APPS; i++) {
		a_app_ptr = &g_appMgr.fEntries[i];

		// Attempt to gracefully shutdown App before forcing library unload
		if (a_app_ptr->fLibNamePtr != NULL) {
			EsifAppStop(a_app_ptr);
		}
		if (a_app_ptr->fLibNamePtr != NULL) {
			esif_ccb_library_unload(a_app_ptr->fLibHandle);
			esif_ccb_free(a_app_ptr->fLibNamePtr);
			esif_ccb_memset(a_app_ptr, 0, sizeof(*a_app_ptr));
		}
	}
	esif_ccb_read_unlock(&g_appMgr.fLock);

	esif_ccb_lock_uninit(&g_appMgr.fLock);

	ESIF_TRACE_EXIT_INFO();
}
Exemple #14
0
void EsifAct_DestroyAction(
	EsifActPtr self
	)
{
	if (NULL == self) {
		goto exit;
	}

	self->markedForDelete = ESIF_TRUE;
	EsifAct_PutRef(self);

	ESIF_TRACE_INFO("Destroy action %d : waiting for delete event...\n", self->type);
	esif_ccb_event_wait(&self->deleteEvent);

	EsifAct_UnregisterEvents(self);

	EsifAct_CallIfaceDestroy(self);

	esif_ccb_event_uninit(&self->deleteEvent);
	esif_ccb_lock_uninit(&self->objLock);

	esif_ccb_free(self);
exit:
	return;
}
Exemple #15
0
static eEsifError EsifEventMgr_DumpGarbage()
{
	eEsifError rc = ESIF_OK;
	EsifLinkListPtr listPtr = g_EsifEventMgr.garbageList;
	EsifLinkListNodePtr nodePtr = NULL;
	EventMgrEntryPtr entryPtr = NULL;

	if (NULL == listPtr) {
		rc = ESIF_E_UNSPECIFIED;
		goto exit;
	}

	esif_ccb_write_lock(&g_EsifEventMgr.listLock);
	nodePtr = listPtr->head_ptr;
	while(nodePtr) {
		entryPtr = nodePtr->data_ptr;

		/* remove the node first so that it isn't considered active while we disable events */
		esif_link_list_node_remove(listPtr, nodePtr); 
		esif_ccb_write_unlock(&g_EsifEventMgr.listLock);
		EsifEventMgr_DisableEvent(entryPtr);
		esif_ccb_free(entryPtr);
		esif_ccb_write_lock(&g_EsifEventMgr.listLock);

		nodePtr = listPtr->head_ptr;
	}
	esif_ccb_write_unlock(&g_EsifEventMgr.listLock);

exit:
	return rc;
}
Exemple #16
0
/* IOCTL */
static int esif_ipc_ioctl(struct esif_ipc *ipc_user_ptr)
{
	int rc = 0;
	struct esif_ipc *ipc_req_ptr = esif_ipc_user_to_kernel(ipc_user_ptr);
	struct esif_ipc *ipc_rsp_ptr = NULL;

	if (NULL == ipc_req_ptr)
		return -ENOMEM;

	ESIF_TRACE_DYN_IPC("linux_%s: user %p kernel %p\n",
			   __func__,
			   ipc_user_ptr,
			   ipc_req_ptr);
	ipc_rsp_ptr = esif_ipc_process(ipc_req_ptr);

	if (NULL != ipc_rsp_ptr) {
		esif_ipc_kernel_to_user((struct esif_ipc *)ipc_user_ptr,
					ipc_rsp_ptr);
		ESIF_TRACE_DYN_IPC("linux_%s: user %p kernel %p\n",
				   __func__,
				   ipc_user_ptr,
				   ipc_rsp_ptr);
		if (ipc_req_ptr != ipc_rsp_ptr)
			esif_ipc_free(ipc_rsp_ptr);
	} else {
		rc = -EINVAL;
	}
	esif_ccb_free(ipc_req_ptr);
	return rc;
}
Exemple #17
0
/* IOCTL */
static ssize_t esif_file_ipc(
	struct file *fp,
	char __user *buf,
	size_t count,
	loff_t *ppos
	)
{
	u32 len = 0;
	struct esif_ipc *ipc_req_ptr = esif_ipc_user_to_kernel(
			(struct esif_ipc *)buf);
	struct esif_ipc *ipc_rsp_ptr = NULL;

	if (count < sizeof(struct esif_ipc))
		return -EINVAL;

	if (NULL == ipc_req_ptr)
		return -ENOMEM;

	ESIF_TRACE_DYN_IPC("linux_%s: user %p kernel %p count %d\n",
			   __func__, buf, ipc_req_ptr, (int)count);

	ipc_rsp_ptr = esif_ipc_process(ipc_req_ptr);

	if (NULL != ipc_rsp_ptr) {
		len = esif_ipc_kernel_to_user((struct esif_ipc *)buf,
						ipc_rsp_ptr);
		ESIF_TRACE_DYN_IPC("linux_%s: user %p kernel %p count = %d\n",
				   __func__, buf, ipc_rsp_ptr, (int)count);

		if (ipc_req_ptr != ipc_rsp_ptr)
			esif_ipc_free(ipc_rsp_ptr);
	}
	esif_ccb_free(ipc_req_ptr);
	return len;
}
Exemple #18
0
void ESIF_INLINE IString_dtor (IStringPtr self)
{
	ESIF_ASSERT(self);
	if (self->buf_len) {
		esif_ccb_free(self->buf_ptr);
	}
	WIPEPTR(self);
}
Exemple #19
0
static void EsifActMgr_DestroyEntry(
	EsifActMgrEntryPtr entryPtr
	)
{
	if (NULL == entryPtr) {
		goto exit;
	}

	EsifAct_DestroyAction(entryPtr->actPtr);

	EsifActMgr_UnloadAction(entryPtr);

	esif_ccb_free(entryPtr->libName);
	esif_ccb_free(entryPtr);
exit:
	return;
}
Exemple #20
0
// Automatically Load all Static DataVaults and *.dv files in the current folder into the DataBank
eEsifError DataBank_LoadDataVaults (DataBankPtr self)
{
	eEsifError rc = ESIF_OK;
	esif_ccb_file_find_handle find_handle = INVALID_HANDLE_VALUE;
	char file_path[MAX_PATH] = {0};
	char file_pattern[MAX_PATH] = {0};
	struct esif_ccb_file *ffd_ptr;
	UInt32 idx;

	ASSERT(self);

	// Import all Static DataVaults into ReadOnly DataVaults
	for (idx = 0; g_StaticDataVaults[idx].name; idx++) {
		DataVaultPtr DB = DataBank_OpenNameSpace(self, g_StaticDataVaults[idx].name);
		if (DB) {
			IOStream_SetMemory(DB->stream, g_StaticDataVaults[idx].buffer, g_StaticDataVaults[idx].buf_len);
			DB->flags |= (ESIF_SERVICE_CONFIG_READONLY | ESIF_SERVICE_CONFIG_NOCACHE);
			DataVault_ReadVault(DB);
		}
	}

	// Create DataVault Directory if it doesn't exit
	esif_build_path(file_path, sizeof(file_path), ESIF_PATHTYPE_DV, NULL, NULL);
	esif_ccb_makepath(file_path);

	// Import all matching *.dv files into ReadWrite DataVaults
	esif_ccb_sprintf(MAX_PATH, file_pattern, "*%s", ESIFDV_FILEEXT);
	ffd_ptr   = (struct esif_ccb_file*)esif_ccb_malloc(sizeof(*ffd_ptr));
	if (NULL == ffd_ptr) {
		rc = ESIF_E_NO_MEMORY;
	}

	if (rc == ESIF_OK) {
		find_handle = esif_ccb_file_enum_first(file_path, file_pattern, ffd_ptr);
	}
	if (INVALID_HANDLE_VALUE != find_handle) {
		do {
			struct esif_ccb_file dv_file = {0};
			DataVaultPtr DB = 0;

			// Read DataVault File, unless it's already been loaded as a Static DataVault
			if (esif_ccb_strlen(ffd_ptr->filename, MAX_PATH) > sizeof(ESIFDV_FILEEXT)) {
				ffd_ptr->filename[esif_ccb_strlen(ffd_ptr->filename, MAX_PATH) - (sizeof(ESIFDV_FILEEXT) - 1)] = 0;	// Truncate ".dv" extension
				if (DataBank_GetNameSpace(self, ffd_ptr->filename) == NULL) {
					DB = DataBank_OpenNameSpace(self, ffd_ptr->filename);
					if (DB) {
						esif_build_path(dv_file.filename, sizeof(dv_file.filename), ESIF_PATHTYPE_DV, DB->name, ESIFDV_FILEEXT);
						IOStream_SetFile(DB->stream, dv_file.filename, "rb");
						DataVault_ReadVault(DB);
					}
				}
			}
		} while (esif_ccb_file_enum_next(find_handle, file_pattern, ffd_ptr));
		esif_ccb_file_enum_close(find_handle);
	}
	esif_ccb_free(ffd_ptr);
	return rc;
}
Exemple #21
0
void EsifLogMgrExit(void)
{
	int j;

	ESIF_TRACE_ENTRY_INFO();

	for (j=0; j < MAX_ESIFLOG; j++) {
		if (g_EsifLogFile[j].handle != NULL) {
			esif_ccb_fclose(g_EsifLogFile[j].handle);
		}
		esif_ccb_free(g_EsifLogFile[j].name);
		esif_ccb_free(g_EsifLogFile[j].filename);
		esif_ccb_lock_uninit(&g_EsifLogFile[j].lock);
	}
	esif_ccb_memset(g_EsifLogFile, 0, sizeof(g_EsifLogFile));

	ESIF_TRACE_EXIT_INFO();
}
Exemple #22
0
// Close an nameSpace Iterator
void EsifConfigFindClose(
	EsifConfigFindContextPtr context
	)
{
	if (context) {
		esif_ccb_free(*context);
		*context = NULL;
	}
}
Exemple #23
0
void DataBank_Destroy (DataBankPtr self)
{
	UInt32 idx;
	for (idx = 0; idx < self->size; idx++)
		DataVault_dtor(&self->elements[idx]);
	self->size = 0;
	esif_ccb_lock_uninit(&self->lock);
	esif_ccb_free(self);
}
Exemple #24
0
static void esif_ws_cgi_parse_query (
    char *query,
    const char *beg_parms_loc_in_query,
    int fd,
    char *cgi_dir
)
{
    char *cgi_script;
    char *cgi_script_buf;
    // char *cgi_dir;
    char cgiParms[100];
    size_t cgi_script_size;
#define MAX_SIZE 100

    cgi_script_size = query - beg_parms_loc_in_query;
    cgi_script = (char*)esif_ccb_malloc(cgi_script_size + 1);
    if (cgi_script == NULL) {
        exit(1);
    }
    // cgi_dir = (char*)esif_ccb_malloc(esif_ccb_strlen(cgi_dir, MAX_SIZE) + cgi_script_size);
    // if (cgi_dir == NULL)
    // exit(1);

    esif_ccb_memcpy(cgi_script, beg_parms_loc_in_query, cgi_script_size);
    // esif_ccb_memcpy(cgi_dir, DIRECTORY, esif_ccb_strlen(DIRECTORY, MAX_SIZE));

    cgi_script[cgi_script_size] = '\0';
    // cgi_dir[esif_ccb_strlen(DIRECTORY, MAX_SIZE)]='\0';
    printf("cgi_script 1: %s\n", cgi_script);
    query++;

    cgi_script_buf = cgi_script;

#ifdef ESIF_ATTR_OS_WINDOWS

    cgi_script_buf = (char*)strrchr(cgi_script_buf, '/');
    cgi_script_buf++;
    cgi_script_buf[esif_ccb_strlen(cgi_script_buf, MAX_SIZE)] = '\0';
#endif


    esif_ccb_strcpy(cgiParms, query, esif_ccb_strlen(query, MAX_SIZE));

    printf("cgi_dir: %s\n", cgi_dir);

    printf("cgiParms 1: %s\n", cgiParms);

    esif_ccb_strcat(cgi_dir, cgi_script_buf, sizeof(cgi_dir));


    esif_ws_cgi_redirect_output(cgi_dir, fd);
    if (cgi_script) {
        esif_ccb_free(cgi_script);
    }
    // if (cgi_dir)
    // esif_ccb_free(cgi_dir);
}
Exemple #25
0
static void EsifEventMgr_LLEntryDestroyCallback(
	void *dataPtr
	)
{
	esif_ccb_write_unlock(&g_EsifEventMgr.listLock);
	EsifEventMgr_DisableEvent((EventMgrEntryPtr)dataPtr);
	esif_ccb_free(dataPtr);
	esif_ccb_write_lock(&g_EsifEventMgr.listLock);
}
Exemple #26
0
/* This does not delete the item_ptr */
static void esif_destroy_ht_node(
    struct esif_ht_node *ht_node
)
{
    ESIF_ASSERT(ht_node != NULL);

    if (ht_node->key_ptr)
        esif_ccb_free(ht_node->key_ptr);

    /* TODO: If needed */
    /* We can call the callback destroy func here so that
     * the caller does not have to destroy the item. Right
     * now this is done before coming into this function
     * for HT destroy only.
     */
    esif_ccb_free(ht_node);

    return;
}
Exemple #27
0
// destructor
void StringList_dtor (StringListPtr self)
{
	if (self) {
		int i;
		for (i = 0; i < self->items; i++)
			String_Destroy(self->list[i]);
		esif_ccb_free(self->list);
		WIPEPTR(self);
	}
}
Exemple #28
0
static struct esif_ht_node *esif_alloc_ht_node(
    u8 *key_ptr,
    u32 key_length,
    void *item_ptr
)
{
    enum esif_rc rc = ESIF_OK;
    struct esif_ht_node *ht_node_ptr = NULL;

    ESIF_ASSERT(key_ptr != NULL);

    ht_node_ptr =
        (struct esif_ht_node *)esif_ccb_malloc(sizeof(*ht_node_ptr));
    if (ht_node_ptr == NULL) {
        ESIF_TRACE_ERROR("Unable to allocate HT node\n");
        rc = ESIF_E_NO_MEMORY;
        goto exit;
    }

    ht_node_ptr->key_ptr = esif_ccb_malloc(key_length);
    if (ht_node_ptr->key_ptr == NULL) {
        ESIF_TRACE_ERROR("Unable to allocate HT node key ptr\n");
        rc = ESIF_E_NO_MEMORY;
        goto exit;
    }

    esif_ccb_memcpy(ht_node_ptr->key_ptr, key_ptr, key_length);
    ht_node_ptr->key_length = key_length;
    ht_node_ptr->item_ptr = item_ptr;
exit:
    if (rc != ESIF_OK) {
        if (ht_node_ptr) {
            if (ht_node_ptr->key_ptr)
                esif_ccb_free(ht_node_ptr->key_ptr);

            esif_ccb_free(ht_node_ptr);
            ht_node_ptr = NULL;
        }
    }

    return ht_node_ptr;
}
Exemple #29
0
/* Free DSP Upper Instance */
static void esif_dsp_destroy(EsifDspPtr dspPtr)
{
	if (NULL == dspPtr) {
		return;
	}
	esif_ht_destroy(dspPtr->ht_ptr, NULL);
	esif_link_list_destroy(dspPtr->algo_ptr);
	esif_link_list_destroy(dspPtr->domain_ptr);
	esif_link_list_destroy(dspPtr->cap_ptr);
	esif_link_list_destroy(dspPtr->evt_ptr);
	esif_ccb_free(dspPtr);
}
Exemple #30
0
/* CPC Free */
void esif_cpc_free(struct esif_lp_dsp *dsp_ptr)
{
	ESIF_TRACE_DYN_CPC("%s: START\n", ESIF_FUNC);

	if (NULL == dsp_ptr || NULL == dsp_ptr->cpc_ptr)
		return;

	esif_ccb_free(dsp_ptr->cpc_ptr);
	dsp_ptr->cpc_ptr = NULL;

	ESIF_TRACE_DYN_CPC("%s: STOP\n", ESIF_FUNC);
}