1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
/* -*- linux-c -*-
*
* (C) Copyright IBM Corp. 2005
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This
* file and program are licensed under a BSD style license. See
* the Copying file included with the OpenHPI distribution for
* full licensing terms.
*
* Author(s):
* Renier Morales <renier@openhpi.org>
*/
#include <rtas.h>
void *rtas_open(GHashTable *handler_config, unsigned int hid, oh_evt_queue *eventq)
{
struct oh_handler_state *h = NULL;
char *entity_root = NULL;
if (!handler_config) {
err("No configuration passed.");
return NULL;
} else if (!hid) {
err("Bad handler id passed.");
return NULL;
} else if (!eventq) {
err("No event queue was passed.");
return NULL;
}
entity_root = (char *)g_hash_table_lookup(handler_config, "entity_root");
if (!entity_root) {
err("Cannot find \"entity_root\" configuration parameter.");
return NULL;
}
h = (struct oh_handler_state *)g_malloc0(sizeof(struct oh_handler_state));
h->config = handler_config;
h->rptcache = (RPTable *)g_malloc0(sizeof(RPTable));
oh_init_rpt(h->rptcache);
h->elcache = oh_el_create(0);
h->elcache->gentimestamp = FALSE;
h->hid = hid;
h->eventq = eventq;
return h;
}
void rtas_close(void *hnd)
{
return;
}
/* Function ABI aliases */
void * oh_open (GHashTable *, unsigned int, oh_evt_queue *) __attribute__ ((weak, alias("rtas_open")));
void * oh_close (void *) __attribute__ ((weak, alias("rtas_close")));
|