make all service handlers dynamically loadable or compilable statically
use the BUILD_DYNAMIC flag in the makefile to set dynamic loading or static
compile.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@914 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Steven Dake 2006-02-01 21:17:47 +00:00
parent 883b26d9ed
commit 43a36162b3
24 changed files with 1258 additions and 1055 deletions

View File

@ -31,20 +31,19 @@
# BUILD_DYNAMIC can be defined to 1 to build for dynamic loading of service
# handler modules. If the developer intends to debug, building without
# dynamic modules should provide an easier route.
BUILD_DYNAMIC=0
# Production mode flags
CFLAGS = -O3 -Wall
LDFLAGS = -lpthread -ldl
LDFLAGS = -lpthread
DESTDIR=/usr/local/openais
BUILD_DYNAMIC=1
# Debug mode flags
#CFLAGS = -g -DDEBUG
#LDFLAGS = -g
#BUILD_DYNAMIC=0
#CFLAGS = -g
#LDFLAGS = -g -lpthread
# Profile mode flags
#CFLAGS = -O3 -pg -DDEBUG
#CFLAGS = -O3 -pg
#LDFLAGS = -pg
ifeq (${BUILD_DYNAMIC}, 1)
@ -55,7 +54,7 @@ endif
all:
(cd lcr; echo ==== `pwd` ===; $(MAKE) all CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)");
(cd lib; echo ==== `pwd` ===; $(MAKE) all CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)");
(cd exec; echo ==== `pwd` ===; $(MAKE) all CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" BUILD_DYNAMIC="1");
(cd exec; echo ==== `pwd` ===; $(MAKE) all CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" BUILD_DYNAMIC="$(BUILD_DYNAMIC)");
(cd test; echo ==== `pwd` ===; $(MAKE) all CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)");
clean:

View File

@ -31,17 +31,15 @@
# BUILD_DYNAMIC can be defined to 1 to build for dynamic loading of service
# handler modules. If the developer intends to debug, building without
# dynamic modules should provide an easier route.
BUILD_DYNAMIC=1
# Production mode flags
#CFLAGS = -O3 -Wall -fomit-frame-pointer
#LDFLAGS = -lpthread
#BUILD_DYNAMIC=1
CFLAGS = -O3 -Wall -fomit-frame-pointer
LDFLAGS = -lpthread
# Debug mode flags
CFLAGS = -g -Wall
#-DDEBUG
LDFLAGS = -g -lpthread
BUILD_DYNAMIC=1
#CFLAGS = -g -Wall
#LDFLAGS = -g -lpthread
# Profile mode flags
#CFLAGS = -O3 -pg
@ -72,7 +70,7 @@ CFLAGS += -DBUILD_DYNAMIC=1 -fPIC
LDFLAGS += -ldl -rdynamic
EXEC_LIBS += ../lcr/lcr_ifact.o
all:libtotem_pg.a libtotem_pg.so.1.0 \
all:libtotem_pg.a libtotem_pg.so.1.0 ../lcr/lcr_ifact.o \
service_evs.lcrso service_clm.lcrso service_amf.lcrso \
service_ckpt.lcrso service_evt.lcrso service_lck.lcrso \
service_msg.lcrso service_cfg.lcrso \
@ -132,6 +130,9 @@ depend:
makedepend -Y -- $(CFLAGS) $(EXEC_SRC) $(TOTEM_SRC) > /dev/null 2>&1
# - fPIC rules required for service handler shared objects
../lcr/lcr_ifact.o: ../lcr/lcr_ifact.c
$(CC) $(CFLAGS) -I../lcr -c -o $@ ../lcr/lcr_ifact.c
evs.o: evs.c
$(CC) $(CFLAGS) -c -o $@ $(*F).c

View File

@ -134,39 +134,39 @@ static void amf_confchg_fn (
struct totem_ip_address *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id);
static int amf_lib_exit_fn (struct conn_info *conn_info);
static int amf_lib_exit_fn (void *conn);
static int amf_exec_init_fn (struct openais_config *);
static int amf_lib_init_fn (struct conn_info *conn_info);
static int amf_lib_init_fn (void *conn);
static void message_handler_req_lib_amf_componentregister (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_componentregister (void *conn, void *msg);
static void message_handler_req_lib_amf_componentunregister (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_componentunregister (void *conn, void *msg);
static void message_handler_req_lib_amf_pmstart (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_pmstart (void *conn, void *msg);
static void message_handler_req_lib_amf_pmstop (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_pmstop (void *conn, void *msg);
static void message_handler_req_lib_amf_healthcheckstart (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_healthcheckstart (void *conn, void *msg);
static void message_handler_req_lib_amf_healthcheckconfirm (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_healthcheckconfirm (void *conn, void *msg);
static void message_handler_req_lib_amf_healthcheckstop (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_healthcheckstop (void *conn, void *msg);
static void message_handler_req_lib_amf_hastateget (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_hastateget (void *conn, void *message);
static void message_handler_req_lib_amf_csiquiescingcomplete (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_csiquiescingcomplete (void *conn, void *msg);
static void message_handler_req_lib_amf_protectiongrouptrackstart (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_protectiongrouptrackstart (void *conn, void *msg);
static void message_handler_req_lib_amf_protectiongrouptrackstop (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_protectiongrouptrackstop (void *conn, void *msg);
static void message_handler_req_lib_amf_componenterrorreport (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_componenterrorreport (void *conn, void *msg);
static void message_handler_req_lib_amf_componenterrorclear (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_componenterrorclear (void *conn, void *msg);
static void message_handler_req_lib_amf_response (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_amf_response (void *conn, void *msg);
static void message_handler_req_exec_amf_operational_state_comp_set (
void *message,
@ -218,6 +218,25 @@ void comp_healthcheck_activate (struct amf_comp *comp);
void comp_healthcheck_deactivate (struct amf_comp *comp);
static void escalation_policy_restart (struct amf_comp *comp);
struct libamf_ci_trackentry {
int active;
SaUint8T trackFlags;
SaAmfProtectionGroupNotificationT *notificationBufferAddress;
SaNameT csiName;
};
struct amf_comp;
struct amf_pd {
struct amf_comp *comp;
struct list_head list;
/*
struct libamf_ci_trackentry *tracks;
int trackEntries;
int trackActive;
*/
};
struct clc_interface {
int (*instantiate) (struct amf_comp *comp);
int (*terminate) (struct amf_comp *comp);
@ -374,6 +393,7 @@ static struct openais_exec_handler amf_exec_handlers[] = {
struct openais_service_handler amf_service_handler = {
.name = (unsigned char *)"openais availability management framework B.01.01",
.id = AMF_SERVICE,
.private_data_size = sizeof (struct amf_pd),
.lib_init_fn = amf_lib_init_fn,
.lib_exit_fn = amf_lib_exit_fn,
.lib_handlers = amf_lib_handlers,
@ -700,7 +720,7 @@ int clc_terminate_callback (struct amf_comp *comp)
struct res_lib_amf_componentterminatecallback res_lib_amf_componentterminatecallback;
struct component_terminate_callback_data *component_terminate_callback_data;
printf ("clc_terminate_callback %p\n", comp->conn_info);
printf ("clc_terminate_callback %p\n", comp->conn);
if (comp->presence_state != OPENAIS_CFG_PRESENCESTATE_INSTANTIATED) {
printf ("component terminated but not instantiated %s - %d\n",
getSaNameT (&comp->name), comp->presence_state);
@ -731,8 +751,8 @@ printf ("component presence state %d\n", comp->presence_state);
printf ("Creating invocation %llu",
(unsigned long long)res_lib_amf_componentterminatecallback.invocation);
libais_send_response (
comp->conn_info->conn_info_partner,
openais_conn_send_response (
openais_conn_partner_get (comp->conn),
&res_lib_amf_componentterminatecallback,
sizeof (struct res_lib_amf_componentterminatecallback));
@ -823,16 +843,6 @@ int clc_cleanup (struct amf_comp *comp)
static int amf_exec_init_fn (struct openais_config *openais_config)
{
#ifdef TODO
int res;
res = totempg_recovery_plug_create (&amf_recovery_plug_handle);
if (res != 0) {
log_printf(LOG_LEVEL_ERROR,
"Could not create recovery plug for amf service.\n");
return (-1);
}
#endif
if (openais_config->amf_enabled) {
clc_instantiate_all ();
}
@ -877,14 +887,15 @@ static void amf_confchg_fn (
#endif
}
int amf_lib_exit_fn (struct conn_info *conn_info)
int amf_lib_exit_fn (void *conn)
{
struct amf_comp *comp;
struct amf_pd *amf_pd = (struct amf_pd *)openais_conn_private_data_get (conn);
comp = conn_info->ais_ci.u.libamf_ci.comp;
comp = amf_pd->comp;
if (comp) {
comp->conn_info = 0;
comp->conn = 0;
printf ("setting in exit fn to uninst for comp %p\n", comp);
presence_state_comp_set (
@ -900,11 +911,12 @@ printf ("setting in exit fn to uninst for comp %p\n", comp);
return (0);
}
static int amf_lib_init_fn (struct conn_info *conn_info)
static int amf_lib_init_fn (void *conn)
{
log_printf (LOG_LEVEL_DEBUG, "Got request to initalize availability management framework service.\n");
struct amf_pd *amf_pd = (struct amf_pd *)openais_conn_private_data_get (conn);
list_init (&conn_info->conn_list);
list_init (&amf_pd->list);
return (0);
}
@ -1173,10 +1185,10 @@ static void protectiongroup_notification_send (struct conn_info *conn_info,
&amfProtectionGroup->name, sizeof (SaNameT));
res_lib_amf_protectiongrouptrackcallback.notificationBufferAddress = notificationBufferAddress;
libais_send_response (conn_info, &res_lib_amf_protectiongrouptrackcallback,
openais_conn_send_response (conno, &res_lib_amf_protectiongrouptrackcallback,
sizeof (struct res_lib_amf_protectiongrouptrackcallback));
libais_send_response (conn_info, protectionGroupNotification,
openais_conn_send_response (conno, protectionGroupNotification,
sizeof (SaAmfProtectionGroupNotificationT) * notifyEntries);
mempool_free (protectionGroupNotification);
@ -1395,7 +1407,8 @@ void csi_comp_set_callback (
AMF_RESPONSE_CSISETCALLBACK,
csi_set_callback_data);
libais_send_response (comp->conn_info->conn_info_partner,
openais_conn_send_response (
openais_conn_partner_get (comp->conn),
&res_lib_amf_csisetcallback,
sizeof (struct res_lib_amf_csisetcallback));
}
@ -1467,7 +1480,8 @@ void csi_comp_remove_callback (struct amf_comp *comp, struct amf_csi *csi)
res_lib_amf_csiremovecallback.csiFlags = 0;
libais_send_response (comp->conn_info->conn_info_partner,
openais_conn_send_response (
openais_conn_partner_get (comp->conn),
&res_lib_amf_csiremovecallback,
sizeof (struct res_lib_amf_csiremovecallback));
@ -2127,7 +2141,8 @@ void healthcheck_activate (struct healthcheck_active *healthcheck_active)
&healthcheck_active->key,
sizeof (SaAmfHealthcheckKeyT));
libais_send_response (healthcheck_active->comp->conn_info->conn_info_partner,
openais_conn_send_response (
openais_conn_partner_get (healthcheck_active->comp->conn),
&res_lib_amf_healthcheckcallback,
sizeof (struct res_lib_amf_healthcheckcallback));
@ -2305,7 +2320,7 @@ static void message_handler_req_exec_amf_presence_state_comp_set (
}
if (req_exec_amf_presence_state_comp_set->presence_state == OPENAIS_CFG_PRESENCESTATE_UNINSTANTIATED) {
comp->conn_info = 0;
comp->conn = 0;
}
/*
@ -2382,12 +2397,15 @@ static void message_handler_req_exec_amf_administrative_state_group_set (
/*
* Library Interface Implementation
*/
static void message_handler_req_lib_amf_componentregister (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_componentregister (
void *conn,
void *msg)
{
struct req_lib_amf_componentregister *req_lib_amf_componentregister =
(struct req_lib_amf_componentregister *)message;
(struct req_lib_amf_componentregister *)msg;
struct res_lib_amf_componentregister res_lib_amf_componentregister;
struct amf_comp *comp;
struct amf_pd *amf_pd = (struct amf_pd *)openais_conn_private_data_get (conn);
SaAisErrorT error = SA_AIS_ERR_NOT_EXIST;
comp = find_comp (&req_lib_amf_componentregister->compName);
@ -2396,8 +2414,8 @@ static void message_handler_req_lib_amf_componentregister (struct conn_info *con
OPENAIS_CFG_PRESENCESTATE_INSTANTIATED);
operational_state_comp_set (comp,
OPENAIS_CFG_OPERATIONALSTATE_ENABLED);
comp->conn_info = conn_info;
comp->conn_info->ais_ci.u.libamf_ci.comp = comp;
comp->conn = conn;
amf_pd->comp = comp;
comp_healthcheck_activate (comp);
error = SA_AIS_OK;
}
@ -2405,11 +2423,13 @@ static void message_handler_req_lib_amf_componentregister (struct conn_info *con
res_lib_amf_componentregister.header.id = MESSAGE_RES_AMF_COMPONENTREGISTER;
res_lib_amf_componentregister.header.size = sizeof (struct res_lib_amf_componentregister);
res_lib_amf_componentregister.header.error = error;
libais_send_response (conn_info, &res_lib_amf_componentregister,
openais_conn_send_response (conn, &res_lib_amf_componentregister,
sizeof (struct res_lib_amf_componentregister));
}
static void message_handler_req_lib_amf_componentunregister (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_componentunregister (
void *conn,
void *msg)
{
#ifdef COMPILE_OUT
struct req_lib_amf_componentunregister *req_lib_amf_componentunregister = (struct req_lib_amf_componentunregister *)message;
@ -2441,17 +2461,22 @@ static void message_handler_req_lib_amf_componentunregister (struct conn_info *c
#endif
}
static void message_handler_req_lib_amf_pmstart (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_pmstart (
void *conn,
void *msg)
{
}
static void message_handler_req_lib_amf_pmstop (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_pmstop (
void *conn,
void *msg)
{
}
static void message_handler_req_lib_amf_healthcheckstart (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_healthcheckstart (
void *conn, void *msg)
{
struct req_lib_amf_healthcheckstart *req_lib_amf_healthcheckstart =
(struct req_lib_amf_healthcheckstart *)message;
(struct req_lib_amf_healthcheckstart *)msg;
struct res_lib_amf_healthcheckstart res_lib_amf_healthcheckstart;
struct amf_healthcheck *healthcheck;
struct healthcheck_active *healthcheck_active;
@ -2505,7 +2530,7 @@ fflush (stdout);
list_add_tail (&healthcheck_active->list, &comp->healthcheck_list);
if (comp->conn_info != 0) {
if (comp->conn != 0) {
printf ("Activating healthcheck for the first time %p\n", healthcheck_active);
healthcheck_activate (healthcheck_active);
}
@ -2525,18 +2550,22 @@ error_exit:
res_lib_amf_healthcheckstart.header.size = sizeof (struct res_lib_amf_healthcheckstart);
res_lib_amf_healthcheckstart.header.error = error;
libais_send_response (conn_info, &res_lib_amf_healthcheckstart,
openais_conn_send_response (conn, &res_lib_amf_healthcheckstart,
sizeof (struct res_lib_amf_healthcheckstart));
}
static void message_handler_req_lib_amf_healthcheckconfirm (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_healthcheckconfirm (
void *conn,
void *msg)
{
}
static void message_handler_req_lib_amf_healthcheckstop (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_healthcheckstop (
void *conn,
void *msg)
{
struct req_lib_amf_healthcheckstop *req_lib_amf_healthcheckstop =
(struct req_lib_amf_healthcheckstop *)message;
(struct req_lib_amf_healthcheckstop *)msg;
struct res_lib_amf_healthcheckstop res_lib_amf_healthcheckstop;
struct healthcheck_active *healthcheck_active;
struct amf_comp *comp;
@ -2568,14 +2597,16 @@ error_exit:
res_lib_amf_healthcheckstop.header.size = sizeof (struct res_lib_amf_healthcheckstop);
res_lib_amf_healthcheckstop.header.error = error;
libais_send_response (conn_info, &res_lib_amf_healthcheckstop,
openais_conn_send_response (conn, &res_lib_amf_healthcheckstop,
sizeof (struct res_lib_amf_healthcheckstop));
}
static void message_handler_req_lib_amf_hastateget (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_hastateget (
void *conn,
void *msg)
{
#ifdef COMPILE_OUT
struct req_lib_amf_hastateget *req_lib_amf_hastateget = (struct req_lib_amf_hastateget *)message;
struct req_lib_amf_hastateget *req_lib_amf_hastateget = (struct req_lib_amf_hastateget *)msg;
struct res_lib_amf_hastateget res_lib_amf_hastateget;
struct amf_comp *component;
@ -2594,11 +2625,13 @@ static void message_handler_req_lib_amf_hastateget (struct conn_info *conn_info,
&component->currentHAState, sizeof (SaAmfHAStateT));
res_lib_amf_hastateget.header.error = SA_AIS_OK;
}
libais_send_response (conn_info, &res_lib_amf_hastateget, sizeof (struct res_lib_amf_hastateget));
openais_conn_send_response (conn, &res_lib_amf_hastateget, sizeof (struct res_lib_amf_hastateget));
#endif
}
static void message_handler_req_lib_amf_protectiongrouptrackstart (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_protectiongrouptrackstart (
void *conn,
void *msg)
{
#ifdef COMPILE_OUT
struct req_lib_amf_protectiongrouptrackstart *req_lib_amf_protectiongrouptrackstart = (struct req_lib_amf_protectiongrouptrackstart *)message;
@ -2648,7 +2681,7 @@ static void message_handler_req_lib_amf_protectiongrouptrackstart (struct conn_i
if (amfProtectionGroup) {
res_lib_amf_protectiongrouptrackstart.header.error = SA_AIS_OK;
}
libais_send_response (conn_info, &res_lib_amf_protectiongrouptrackstart,
openais_conn_send_response (conn, &res_lib_amf_protectiongrouptrackstart,
sizeof (struct res_lib_amf_protectiongrouptrackstart));
if (amfProtectionGroup &&
@ -2666,11 +2699,15 @@ static void message_handler_req_lib_amf_protectiongrouptrackstart (struct conn_i
#endif
}
static void message_handler_req_lib_amf_csiquiescingcomplete (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_csiquiescingcomplete (
void *conn,
void *msg)
{
}
static void message_handler_req_lib_amf_protectiongrouptrackstop (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_protectiongrouptrackstop (
void *conn,
void *msg)
{
#ifdef COMPILE_OUT
struct req_lib_amf_protectiongrouptrackstop *req_lib_amf_protectiongrouptrackstop = (struct req_lib_amf_protectiongrouptrackstop *)message;
@ -2704,15 +2741,17 @@ static void message_handler_req_lib_amf_protectiongrouptrackstop (struct conn_in
if (track) {
res_lib_amf_protectiongrouptrackstop.header.error = SA_AIS_OK;
}
libais_send_response (conn_info, &res_lib_amf_protectiongrouptrackstop,
openais_conn_send_response (conn, &res_lib_amf_protectiongrouptrackstop,
sizeof (struct res_lib_amf_protectiongrouptrackstop));
#endif
}
static void message_handler_req_lib_amf_componenterrorreport (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_componenterrorreport (
void *conn,
void *msg)
{
struct req_lib_amf_componenterrorreport *req_lib_amf_componenterrorreport = (struct req_lib_amf_componenterrorreport *)message;
struct req_lib_amf_componenterrorreport *req_lib_amf_componenterrorreport = (struct req_lib_amf_componenterrorreport *)msg;
struct res_lib_amf_componenterrorreport res_lib_amf_componenterrorreport;
struct amf_comp *comp;
SaAisErrorT error = SA_AIS_ERR_NOT_EXIST;
@ -2731,14 +2770,14 @@ printf ("escalation policy terminate\n");
res_lib_amf_componenterrorreport.header.id = MESSAGE_RES_AMF_COMPONENTERRORREPORT;
res_lib_amf_componenterrorreport.header.error = error;
libais_send_response (
conn_info,
&res_lib_amf_componenterrorreport,
openais_conn_send_response (
conn, &res_lib_amf_componenterrorreport,
sizeof (struct res_lib_amf_componenterrorreport));
}
static void message_handler_req_lib_amf_componenterrorclear (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_amf_componenterrorclear (
void *conn,
void *msg)
{
#ifdef COMPILLE_OUT
struct req_lib_amf_componenterrorclear *req_lib_amf_componenterrorclear = (struct req_lib_amf_componenterrorclear *)message;
@ -2783,9 +2822,9 @@ void pg_comp_create (
list_add_tail (&pg_comp->list, &pg->pg_comp_head);
}
static void message_handler_req_lib_amf_response (struct conn_info *conn_info_nouse, void *message)
static void message_handler_req_lib_amf_response (void *conn, void *msg)
{
struct req_lib_amf_response *req_lib_amf_response = (struct req_lib_amf_response *)message;
struct req_lib_amf_response *req_lib_amf_response = (struct req_lib_amf_response *)msg;
struct res_lib_amf_response res_lib_amf_response;
struct conn_info *conn_info;
struct csi_set_callback_data *csi_set_callback_data;
@ -2871,8 +2910,7 @@ error_exit:
res_lib_amf_response.header.id = MESSAGE_RES_AMF_RESPONSE;
res_lib_amf_response.header.size = sizeof (struct res_lib_amf_response);
res_lib_amf_response.header.error = SA_AIS_OK;
libais_send_response (conn_info_nouse,
&res_lib_amf_response,
openais_conn_send_response (conn, &res_lib_amf_response,
sizeof (struct res_lib_amf_response));
}
@ -2975,7 +3013,7 @@ static void message_handler_req_exec_amf_componentregister (void *message, struc
res_lib_amf_componentregister.header.id = MESSAGE_RES_AMF_COMPONENTREGISTER;
res_lib_amf_componentregister.header.error = error;
libais_send_response (req_exec_amf_componentregister->source.conn_info,
openais_conn_send_response (req_exec_amf_componentregister->source.conn_info,
&res_lib_amf_componentregister,
sizeof (struct res_lib_amf_componentregister));
}
@ -3051,7 +3089,7 @@ static void message_handler_req_exec_amf_componentunregister (void *message, str
res_lib_amf_componentunregister.header.id = MESSAGE_RES_AMF_COMPONENTUNREGISTER;
res_lib_amf_componentunregister.header.error = error;
libais_send_response (req_exec_amf_componentunregister->source.conn_info,
openais_conn_send_response (req_exec_amf_componentunregister->source.conn_info,
&res_lib_amf_componentunregister, sizeof (struct res_lib_amf_componentunregister));
}
@ -3087,7 +3125,7 @@ static void message_handler_req_exec_amf_componenterrorreport (void *message, st
res_lib_amf_componenterrorreport.header.id = MESSAGE_RES_AMF_COMPONENTERRORREPORT;
res_lib_amf_componenterrorreport.header.error = error;
libais_send_response (req_exec_amf_componenterrorreport->source.conn_info,
openais_conn_send_response (req_exec_amf_componenterrorreport->source.conn_info,
&res_lib_amf_componenterrorreport, sizeof (struct res_lib_amf_componenterrorreport));
}
@ -3131,7 +3169,7 @@ static void message_handler_req_exec_amf_componenterrorclear (void *message, str
res_lib_amf_componenterrorclear.header.id = MESSAGE_RES_AMF_COMPONENTERRORCLEAR;
res_lib_amf_componenterrorclear.header.error = error;
libais_send_response (req_exec_amf_componenterrorclear->source.conn_info,
openais_conn_send_response (req_exec_amf_componenterrorclear->source.conn_info,
&res_lib_amf_componenterrorclear, sizeof (struct res_lib_amf_componenterrorclear));
}
@ -3333,7 +3371,7 @@ void ha_state_api_set (struct amf_comp *component, SaAmfHAStateT haState)
component->newHAState = haState;
libais_send_response (component->conn_info->conn_info_partner,
openais_conn_send_response (component->conn_info->conn_info_partner,
&res_lib_amf_csisetcallback,
sizeof (struct res_lib_amf_csisetcallback));
}
@ -3402,7 +3440,7 @@ void readiness_state_api_set (struct amf_comp *component,
log_printf (LOG_LEVEL_DEBUG, "Setting conn_info %p to readiness state %d\n", component->conn_info, readinessState);
libais_send_response (component->conn_info->conn_info_partner,
openais_conn_send_response (component->conn_info->conn_info_partner,
&res_lib_amf_readinessstatesetcallback,
sizeof (struct res_lib_amf_readinessstatesetcallback));
}
@ -4373,7 +4411,7 @@ static void message_handler_req_amf_readinessstateget (struct conn_info *conn_in
&component->currentReadinessState, sizeof (SaAmfReadinessStateT));
res_lib_amf_readinessstateget.header.error = SA_AIS_OK;
}
libais_send_response (conn_info, &res_lib_amf_readinessstateget, sizeof (struct res_lib_amf_readinessstateget));
openais_conn_send_response (conn_info, &res_lib_amf_readinessstateget, sizeof (struct res_lib_amf_readinessstateget));
return (0);
}
@ -4427,7 +4465,7 @@ static void message_handler_req_lib_amf_stoppingcomplete (struct conn_info *conn
if (amfProtectionGroup) {
res_lib_amf_protectiongrouptrackstart.header.error = SA_AIS_OK;
}
libais_send_response (conn_info, &res_lib_amf_protectiongrouptrackstart,
openais_conn_send_response (conn_info, &res_lib_amf_protectiongrouptrackstart,
sizeof (struct res_lib_amf_protectiongrouptrackstart));
if (amfProtectionGroup &&
@ -4478,7 +4516,7 @@ static void message_handler_req_amf_protectiongrouptrackstop (struct conn_info *
if (track) {
res_lib_amf_protectiongrouptrackstop.header.error = SA_AIS_OK;
}
libais_send_response (conn_info, &res_lib_amf_protectiongrouptrackstop,
openais_conn_send_response (conn_info, &res_lib_amf_protectiongrouptrackstop,
sizeof (struct res_lib_amf_protectiongrouptrackstop));
return (0);
@ -4589,7 +4627,7 @@ static void message_handler_req_lib_amf_componentcapabilitymodelget (struct conn
res_lib_amf_componentcapabilitymodelget.header.size = sizeof (struct res_lib_amf_componentcapabilitymodelget);
res_lib_amf_componentcapabilitymodelget.header.id = MESSAGE_RES_AMF_COMPONENTCAPABILITYMODELGET;
res_lib_amf_componentcapabilitymodelget.header.error = error;
libais_send_response (conn_info, &res_lib_amf_componentcapabilitymodelget,
openais_conn_send_response (conn_info, &res_lib_amf_componentcapabilitymodelget,
sizeof (struct res_lib_amf_componentcapabilitymodelget));
return (0);

View File

@ -40,23 +40,6 @@
#ifndef AMF_H_DEFINED
#define AMF_H_DEFINED
struct libamf_ci_trackentry {
int active;
SaUint8T trackFlags;
SaAmfProtectionGroupNotificationT *notificationBufferAddress;
SaNameT csiName;
};
struct amf_comp;
struct libamf_ci {
struct amf_comp *comp;
/*
struct libamf_ci_trackentry *tracks;
int trackEntries;
int trackActive;
*/
};
void amf_dump ();
extern struct openais_service_handler amf_service_handler;

View File

@ -163,7 +163,7 @@ enum clc_component_types {
struct amf_comp {
int registered;
int local;
struct conn_info *conn_info;
void *conn;
SaNameT name;
struct in_addr source_addr;
struct amf_comp *proxy_comp;

View File

@ -71,19 +71,19 @@ static void cfg_confchg_fn (
struct totem_ip_address *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id);
static int cfg_lib_exit_fn (struct conn_info *conn_info);
static int cfg_exec_init_fn (struct openais_config *);
static int cfg_lib_init_fn (struct conn_info *conn_info);
static int cfg_lib_init_fn (void *conn);
static void message_handler_req_lib_cfg_statetrackstart (struct conn_info *conn_info, void *message);
static int cfg_lib_exit_fn (void *conn);
static void message_handler_req_lib_cfg_statetrackstop (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_cfg_statetrackstart (void *conn, void *msg);
static void message_handler_req_lib_cfg_administrativestateset (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_cfg_statetrackstop (void *conn, void *msg);
static void message_handler_req_lib_cfg_administrativestateget (struct conn_info *conn_info, void *message);
static void message_handler_req_lib_cfg_administrativestateset (void *conn, void *msg);
static void message_handler_req_lib_cfg_administrativestateget (void *conn, void *msg);
/*
* Service Handler Definition
@ -134,6 +134,7 @@ static struct openais_exec_handler cfg_exec_handlers[] =
struct openais_service_handler cfg_service_handler = {
.name = (unsigned char*)"openais configuration service",
.id = CFG_SERVICE,
.private_data_size = 0,
.lib_init_fn = cfg_lib_init_fn,
.lib_exit_fn = cfg_lib_exit_fn,
.lib_handlers = cfg_lib_handlers,
@ -201,24 +202,24 @@ static void cfg_confchg_fn (
{
}
int cfg_lib_exit_fn (struct conn_info *conn_info)
int cfg_lib_exit_fn (void *conn)
{
return (0);
}
static int cfg_lib_init_fn (struct conn_info *conn_info)
static int cfg_lib_init_fn (void *conn)
{
log_printf (LOG_LEVEL_DEBUG, "Got request to initalize configuration service.\n");
// list_init (&conn_info->conn_list);
return (0);
}
/*
* Library Interface Implementation
*/
static void message_handler_req_lib_cfg_statetrackstart (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_cfg_statetrackstart (
void *conn,
void *msg)
{
// struct req_lib_cfg_statetrackstart *req_lib_cfg_statetrackstart = (struct req_lib_cfg_statetrackstart *)message;
@ -226,7 +227,9 @@ static void message_handler_req_lib_cfg_statetrackstart (struct conn_info *conn_
"Handle : message_handler_req_lib_cfg_statetrackstart()\n");
}
static void message_handler_req_lib_cfg_statetrackstop (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_cfg_statetrackstop (
void *conn,
void *msg)
{
// struct req_lib_cfg_statetrackstop *req_lib_cfg_statetrackstop = (struct req_lib_cfg_statetrackstop *)message;
@ -234,13 +237,17 @@ static void message_handler_req_lib_cfg_statetrackstop (struct conn_info *conn_i
"Handle : message_handler_req_lib_cfg_administrativestateget()\n");
}
static void message_handler_req_lib_cfg_administrativestateset (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_cfg_administrativestateset (
void *conn,
void *msg)
{
// struct req_lib_cfg_administrativestateset *req_lib_cfg_administrativestateset = (struct req_lib_cfg_administrativestateset *)message;
log_printf (LOG_LEVEL_FROM_LIB,
"Handle : message_handler_req_lib_cfg_administrativestateset()\n");
}
static void message_handler_req_lib_cfg_administrativestateget (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_cfg_administrativestateget (
void *conn,
void *msg)
{
// struct req_lib_cfg_administrativestateget *req_lib_cfg_administrativestateget = (struct req_lib_cfg_administrativestateget *)message;
log_printf (LOG_LEVEL_FROM_LIB,

View File

@ -39,6 +39,6 @@
#ifndef CFG_H_DEFINED
#define CFG_H_DEFINED
extern struct service_handler cfg_service_handler;
extern struct openais_service_handler cfg_service_handler;
#endif /* CFG_H_DEFINED */

File diff suppressed because it is too large Load Diff

View File

@ -39,49 +39,6 @@
#ifndef CKPT_H_DEFINED
#define CKPT_H_DEFINED
struct ckpt_refcnt {
int count;
struct totem_ip_address addr;
};
struct saCkptCheckpointSection {
struct list_head list;
SaCkptSectionDescriptorT sectionDescriptor;
void *sectionData;
poll_timer_handle expiration_timer;
};
struct saCkptCheckpoint {
struct list_head list;
SaNameT name;
SaCkptCheckpointCreationAttributesT checkpointCreationAttributes;
struct list_head checkpointSectionsListHead;
int referenceCount;
int unlinked;
poll_timer_handle retention_timer;
int expired;
int active_replica_set;
int sectionCount;
struct ckpt_refcnt ckpt_refcount[PROCESSOR_COUNT_MAX];
};
struct saCkptSectionIteratorEntry {
int active;
struct saCkptCheckpointSection *checkpointSection;
};
struct saCkptSectionIterator {
struct list_head list;
struct saCkptSectionIteratorEntry *sectionIteratorEntries;
int iteratorCount;
int iteratorPos;
};
struct libckpt_ci {
struct list_head checkpoint_list;
struct saCkptSectionIterator sectionIterator;
};
extern struct openais_service_handler ckpt_service_handler;
#endif /* CKPT_H_DEFINED */

View File

@ -124,9 +124,9 @@ static void clm_sync_abort (void);
static int clm_exec_init_fn (struct openais_config *);
static int clm_lib_init_fn (struct conn_info *conn_info);
static int clm_lib_init_fn (void *conn);
static int clm_lib_exit_fn (struct conn_info *conn_info);
static int clm_lib_exit_fn (void *conn);
static void message_handler_req_exec_clm_nodejoin (
void *message,
@ -134,17 +134,20 @@ static void message_handler_req_exec_clm_nodejoin (
static void exec_clm_nodejoin_endian_convert (void *msg);
static void message_handler_req_lib_clm_clustertrack (struct conn_info *conn_info,
void *message);
static void message_handler_req_lib_clm_clustertrack (void *conn, void *message);
static void message_handler_req_lib_clm_trackstop (struct conn_info *conn_info,
void *message);
static void message_handler_req_lib_clm_trackstop (void *conn, void *message);
static void message_handler_req_lib_clm_nodeget (struct conn_info *conn_info,
void *message);
static void message_handler_req_lib_clm_nodeget (void *conn, void *message);
static void message_handler_req_lib_clm_nodegetasync (struct conn_info *conn_info,
void *message);
static void message_handler_req_lib_clm_nodegetasync (void *conn, void *message);
struct clm_pd {
SaUint8T trackFlags;
int tracking_enabled;
struct list_head list;
void *conn;
};
/*
* Executive Handler Definition
@ -188,6 +191,7 @@ static struct openais_exec_handler clm_exec_handlers[] =
struct openais_service_handler clm_service_handler = {
.name = (unsigned char*)"openais cluster membership service B.01.01",
.id = CLM_SERVICE,
.private_data_size = sizeof (struct clm_pd),
.lib_init_fn = clm_lib_init_fn,
.lib_exit_fn = clm_lib_exit_fn,
.lib_handlers = clm_lib_handlers,
@ -282,10 +286,6 @@ static int clm_exec_init_fn (struct openais_config *openais_config)
thisClusterNode.bootTimestamp = ((SaTimeT)(current_time - s_info.uptime)) * 1000000000;
}
#ifdef DEBUG
printSaClmClusterNodeT ("this cluster node", &thisClusterNode);
#endif
memcpy (&clusterNodes[0], &thisClusterNode, sizeof (SaClmClusterNodeT));
clusterNodeEntries = 1;
@ -293,12 +293,14 @@ static int clm_exec_init_fn (struct openais_config *openais_config)
return (0);
}
static int clm_lib_exit_fn (struct conn_info *conn_info)
static int clm_lib_exit_fn (void *conn)
{
struct clm_pd *clm_pd = (struct clm_pd *)openais_conn_private_data_get (conn);
/*
* Delete track entry if there is one
*/
list_del (&conn_info->conn_list);
list_del (&clm_pd->list);
clm_pd->conn = conn;
return (0);
}
@ -307,7 +309,7 @@ static void library_notification_send (SaClmClusterNotificationT *cluster_notifi
int notify_entries)
{
struct res_lib_clm_clustertrack res_lib_clm_clustertrack;
struct conn_info *conn_info;
struct clm_pd *clm_pd;
struct list_head *list;
int i;
@ -324,12 +326,12 @@ static void library_notification_send (SaClmClusterNotificationT *cluster_notifi
list != &library_notification_send_listhead;
list = list->next) {
conn_info = list_entry (list, struct conn_info, conn_list);
clm_pd = list_entry (list, struct clm_pd, list);
/*
* Track current and changes
*/
if (conn_info->ais_ci.u.libclm_ci.trackFlags & SA_TRACK_CHANGES) {
if (clm_pd->trackFlags & SA_TRACK_CHANGES) {
/*
* Copy all cluster nodes
*/
@ -348,10 +350,11 @@ static void library_notification_send (SaClmClusterNotificationT *cluster_notifi
sizeof (SaClmClusterNotificationT) * notify_entries);
} else
/*
* Track only changes
*/
if (conn_info->ais_ci.u.libclm_ci.trackFlags & SA_TRACK_CHANGES_ONLY) {
if (clm_pd->trackFlags & SA_TRACK_CHANGES_ONLY) {
res_lib_clm_clustertrack.numberOfItems = notify_entries;
memcpy (&res_lib_clm_clustertrack.notification,
cluster_notification_entries,
@ -361,7 +364,8 @@ static void library_notification_send (SaClmClusterNotificationT *cluster_notifi
/*
* Send notifications to all CLM listeners
*/
libais_send_response (conn_info, &res_lib_clm_clustertrack,
openais_conn_send_response (clm_pd->conn,
&res_lib_clm_clustertrack,
sizeof (struct res_lib_clm_clustertrack));
}
}
@ -578,19 +582,21 @@ static void message_handler_req_exec_clm_nodejoin (
}
}
static int clm_lib_init_fn (struct conn_info *conn_info)
static int clm_lib_init_fn (void *conn)
{
log_printf (LOG_LEVEL_DEBUG, "Got request to initalize cluster membership service.\n");
struct clm_pd *clm_pd = (struct clm_pd *)openais_conn_private_data_get (conn);
list_init (&conn_info->conn_list);
list_init (&clm_pd->list);
return (0);
}
static void message_handler_req_lib_clm_clustertrack (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_clm_clustertrack (void *conn, void *msg)
{
struct req_lib_clm_clustertrack *req_lib_clm_clustertrack = (struct req_lib_clm_clustertrack *)message;
struct req_lib_clm_clustertrack *req_lib_clm_clustertrack = (struct req_lib_clm_clustertrack *)msg;
struct res_lib_clm_clustertrack res_lib_clm_clustertrack;
struct clm_pd *clm_pd = (struct clm_pd *)openais_conn_private_data_get (conn);
int i;
res_lib_clm_clustertrack.header.size = sizeof (struct res_lib_clm_clustertrack);
@ -615,53 +621,50 @@ static void message_handler_req_lib_clm_clustertrack (struct conn_info *conn_inf
if (req_lib_clm_clustertrack->trackFlags & SA_TRACK_CHANGES ||
req_lib_clm_clustertrack->trackFlags & SA_TRACK_CHANGES_ONLY) {
conn_info->conn_info_partner->ais_ci.u.libclm_ci.trackFlags =
req_lib_clm_clustertrack->trackFlags;
clm_pd->trackFlags = req_lib_clm_clustertrack->trackFlags;
clm_pd->tracking_enabled = 1;
conn_info->conn_info_partner->ais_ci.u.libclm_ci.tracking_enabled = 1;
list_add (&conn_info->conn_info_partner->conn_list,
&library_notification_send_listhead);
list_add (&clm_pd->list, &library_notification_send_listhead);
}
libais_send_response (conn_info, &res_lib_clm_clustertrack,
openais_conn_send_response (conn, &res_lib_clm_clustertrack,
sizeof (struct res_lib_clm_clustertrack));
if (req_lib_clm_clustertrack->return_in_callback) {
res_lib_clm_clustertrack.header.id = MESSAGE_RES_CLM_TRACKCALLBACK;
libais_send_response (conn_info->conn_info_partner,
openais_conn_send_response (
openais_conn_partner_get (conn),
&res_lib_clm_clustertrack,
sizeof (struct res_lib_clm_clustertrack));
}
}
static void message_handler_req_lib_clm_trackstop (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_clm_trackstop (void *conn, void *msg)
{
struct res_lib_clm_trackstop res_lib_clm_trackstop;
struct clm_pd *clm_pd = (struct clm_pd *)openais_conn_private_data_get (conn);
res_lib_clm_trackstop.header.size = sizeof (struct res_lib_clm_trackstop);
res_lib_clm_trackstop.header.id = MESSAGE_RES_CLM_TRACKSTOP;
if (conn_info->conn_info_partner->ais_ci.u.libclm_ci.tracking_enabled) {
if (clm_pd->tracking_enabled) {
res_lib_clm_trackstop.header.error = SA_AIS_OK;
clm_pd->tracking_enabled = 0;
} else {
res_lib_clm_trackstop.header.error = SA_AIS_ERR_NOT_EXIST;
}
conn_info->conn_info_partner->ais_ci.u.libclm_ci.trackFlags = 0;
conn_info->conn_info_partner->ais_ci.u.libclm_ci.tracking_enabled = 0;
list_del (&clm_pd->list);
list_del (&conn_info->conn_info_partner->conn_list);
libais_send_response (conn_info, &res_lib_clm_trackstop,
openais_conn_send_response (conn, &res_lib_clm_trackstop,
sizeof (struct res_lib_clm_trackstop));
}
static void message_handler_req_lib_clm_nodeget (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_clm_nodeget (void *conn, void *msg)
{
struct req_lib_clm_nodeget *req_lib_clm_nodeget = (struct req_lib_clm_nodeget *)message;
struct req_lib_clm_nodeget *req_lib_clm_nodeget = (struct req_lib_clm_nodeget *)msg;
struct res_clm_nodeget res_clm_nodeget;
SaClmClusterNodeT *clusterNode = 0;
int valid = 0;
@ -690,12 +693,12 @@ static void message_handler_req_lib_clm_nodeget (struct conn_info *conn_info, vo
if (valid) {
memcpy (&res_clm_nodeget.clusterNode, clusterNode, sizeof (SaClmClusterNodeT));
}
libais_send_response (conn_info, &res_clm_nodeget, sizeof (struct res_clm_nodeget));
openais_conn_send_response (conn, &res_clm_nodeget, sizeof (struct res_clm_nodeget));
}
static void message_handler_req_lib_clm_nodegetasync (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_clm_nodegetasync (void *conn, void *msg)
{
struct req_lib_clm_nodegetasync *req_lib_clm_nodegetasync = (struct req_lib_clm_nodegetasync *)message;
struct req_lib_clm_nodegetasync *req_lib_clm_nodegetasync = (struct req_lib_clm_nodegetasync *)msg;
struct res_clm_nodegetasync res_clm_nodegetasync;
struct res_clm_nodegetcallback res_clm_nodegetcallback;
SaClmClusterNodeT *clusterNode = 0;
@ -723,7 +726,8 @@ static void message_handler_req_lib_clm_nodegetasync (struct conn_info *conn_inf
res_clm_nodegetasync.header.size = sizeof (struct res_clm_nodegetasync);
res_clm_nodegetasync.header.id = MESSAGE_RES_CLM_NODEGETASYNC;
res_clm_nodegetasync.header.error = SA_AIS_OK;
libais_send_response (conn_info, &res_clm_nodegetasync,
openais_conn_send_response (conn, &res_clm_nodegetasync,
sizeof (struct res_clm_nodegetasync));
/*
@ -737,6 +741,7 @@ static void message_handler_req_lib_clm_nodegetasync (struct conn_info *conn_inf
memcpy (&res_clm_nodegetcallback.clusterNode, clusterNode,
sizeof (SaClmClusterNodeT));
}
libais_send_response (conn_info->conn_info_partner, &res_clm_nodegetcallback,
openais_conn_send_response (openais_conn_partner_get (conn),
&res_clm_nodegetcallback,
sizeof (struct res_clm_nodegetcallback));
}

View File

@ -40,11 +40,6 @@
#include <netinet/in.h>
struct libclm_ci {
SaUint8T trackFlags;
int tracking_enabled;
};
extern SaClmClusterNodeT *clm_get_by_nodeid (unsigned int node_id);
extern struct openais_service_handler clm_service_handler;

View File

@ -1,5 +1,5 @@
/*
* vi: set autoindent tabstop=4 shiftwidth=4 :
* vi: set autoindent ;
*
* Copyright (c) 2004-2006 MontaVista Software, Inc.
*
@ -75,24 +75,31 @@ enum evs_exec_message_req_types {
*/
static void evs_confchg_fn (
enum totem_configuration_type configuration_type,
struct totem_ip_address *member_list, int member_list_entries,
struct totem_ip_address *left_list, int left_list_entries,
struct totem_ip_address *joined_list, int joined_list_entries,
struct totem_ip_address *member_list, int member_list_entries,
struct totem_ip_address *left_list, int left_list_entries,
struct totem_ip_address *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id);
static void message_handler_req_exec_mcast (void *message, struct totem_ip_address *source_addr);
static void req_exec_mcast_endian_convert (void *msg);
static void message_handler_req_evs_join (struct conn_info *conn_info, void *message);
static void message_handler_req_evs_leave (struct conn_info *conn_info, void *message);
static void message_handler_req_evs_mcast_joined (struct conn_info *conn_info, void *message);
static void message_handler_req_evs_mcast_groups (struct conn_info *conn_info, void *message);
static void message_handler_req_evs_membership_get (struct conn_info *conn_info, void *message);
static void message_handler_req_evs_join (void *conn, void *msg);
static void message_handler_req_evs_leave (void *conn, void *msg);
static void message_handler_req_evs_mcast_joined (void *conn, void *msg);
static void message_handler_req_evs_mcast_groups (void *conn, void *msg);
static void message_handler_req_evs_membership_get (void *conn, void *msg);
static int evs_lib_init_fn (struct conn_info *conn_info);
static int evs_lib_exit_fn (struct conn_info *conn_info);
static int evs_lib_init_fn (void *conn);
static int evs_lib_exit_fn (void *conn);
struct evs_pd {
struct evs_group *groups;
int group_entries;
struct list_head list;
void *conn;
};
static struct openais_lib_handler evs_lib_handlers[] =
{
{ /* 0 */
@ -130,23 +137,24 @@ static struct openais_lib_handler evs_lib_handlers[] =
static struct openais_exec_handler evs_exec_handlers[] =
{
{
.exec_handler_fn = message_handler_req_exec_mcast,
.exec_handler_fn = message_handler_req_exec_mcast,
.exec_endian_convert_fn = req_exec_mcast_endian_convert
}
};
struct openais_service_handler evs_service_handler = {
.name = (unsigned char*)"openais extended virtual synchrony service",
.id = EVS_SERVICE,
.lib_init_fn = evs_lib_init_fn,
.lib_exit_fn = evs_lib_exit_fn,
.lib_handlers = evs_lib_handlers,
.lib_handlers_count = sizeof (evs_lib_handlers) / sizeof (struct openais_lib_handler),
.exec_handlers = evs_exec_handlers,
.exec_handlers_count = sizeof (evs_exec_handlers) / sizeof (struct openais_exec_handler),
.confchg_fn = evs_confchg_fn,
.exec_init_fn = NULL,
.exec_dump_fn = NULL
.name = (unsigned char*)"openais extended virtual synchrony service",
.id = EVS_SERVICE,
.private_data_size = sizeof (struct evs_pd),
.lib_init_fn = evs_lib_init_fn,
.lib_exit_fn = evs_lib_exit_fn,
.lib_handlers = evs_lib_handlers,
.lib_handlers_count = sizeof (evs_lib_handlers) / sizeof (struct openais_lib_handler),
.exec_handlers = evs_exec_handlers,
.exec_handlers_count = sizeof (evs_exec_handlers) / sizeof (struct openais_exec_handler),
.confchg_fn = evs_confchg_fn,
.exec_init_fn = NULL,
.exec_dump_fn = NULL
};
static DECLARE_LIST_INIT (confchg_notify);
@ -160,26 +168,26 @@ static DECLARE_LIST_INIT (confchg_notify);
struct openais_service_handler *evs_get_service_handler_ver0 (void);
struct openais_service_handler_iface_ver0 evs_service_handler_iface = {
.openais_get_service_handler_ver0 = evs_get_service_handler_ver0
.openais_get_service_handler_ver0 = evs_get_service_handler_ver0
};
struct lcr_iface openais_evs_ver0[1] = {
{
.name = "openais_evs",
.version = 0,
.versions_replace = 0,
.name = "openais_evs",
.version = 0,
.versions_replace = 0,
.versions_replace_count = 0,
.dependencies = 0,
.dependency_count = 0,
.constructor = NULL,
.destructor = NULL,
.interfaces = (void **)&evs_service_handler_iface,
.dependencies = 0,
.dependency_count = 0,
.constructor = NULL,
.destructor = NULL,
.interfaces = (void **)&evs_service_handler_iface,
}
};
struct lcr_comp evs_comp_ver0 = {
.iface_count = 1,
.ifaces = openais_evs_ver0
.iface_count = 1,
.ifaces = openais_evs_ver0
};
int lcr_comp_get (struct lcr_comp **component)
@ -207,7 +215,7 @@ static void evs_confchg_fn (
int i;
struct list_head *list;
struct conn_info *conn_info;
struct evs_pd *evs_pd;
/*
* Build configuration change message
@ -236,36 +244,46 @@ static void evs_confchg_fn (
* Send configuration change message to every EVS library user
*/
for (list = confchg_notify.next; list != &confchg_notify; list = list->next) {
conn_info = list_entry (list, struct conn_info, conn_list);
libais_send_response (conn_info, &res_evs_confchg_callback,
evs_pd = list_entry (list, struct evs_pd, list);
openais_conn_send_response (evs_pd->conn,
&res_evs_confchg_callback,
sizeof (res_evs_confchg_callback));
}
}
static int evs_lib_init_fn (struct conn_info *conn_info)
static int evs_lib_init_fn (void *conn)
{
log_printf (LOG_LEVEL_DEBUG, "Got request to initalize evs service.\n");
list_init (&conn_info->conn_list);
list_add (&conn_info->conn_list, &confchg_notify);
struct evs_pd *evs_pd = (struct evs_pd *)openais_conn_private_data_get (conn);
libais_send_response (conn_info, &res_evs_confchg_callback,
log_printf (LOG_LEVEL_DEBUG, "Got request to initalize evs service.\n");
evs_pd->groups = NULL;
evs_pd->group_entries = 0;
evs_pd->conn = conn;
list_init (&evs_pd->list);
list_add (&evs_pd->list, &confchg_notify);
openais_conn_send_response (conn, &res_evs_confchg_callback,
sizeof (res_evs_confchg_callback));
return (0);
}
static int evs_lib_exit_fn (struct conn_info *conn_info)
static int evs_lib_exit_fn (void *conn)
{
list_del (&conn_info->conn_list);
struct evs_pd *evs_pd = (struct evs_pd *)openais_conn_private_data_get (conn);
list_del (&evs_pd->list);
return (0);
}
static void message_handler_req_evs_join (struct conn_info *conn_info, void *message)
static void message_handler_req_evs_join (void *conn, void *msg)
{
evs_error_t error = EVS_OK;
struct req_lib_evs_join *req_lib_evs_join = (struct req_lib_evs_join *)message;
struct req_lib_evs_join *req_lib_evs_join = (struct req_lib_evs_join *)msg;
struct res_lib_evs_join res_lib_evs_join;
void *addr;
struct evs_pd *evs_pd = (struct evs_pd *)openais_conn_private_data_get (conn);
if (req_lib_evs_join->group_entries > 50) {
error = EVS_ERR_TOO_MANY_GROUPS;
@ -279,56 +297,53 @@ static void message_handler_req_evs_join (struct conn_info *conn_info, void *mes
}
}
#endif
addr = realloc (conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups,
sizeof (struct evs_group) *
(conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries +
req_lib_evs_join->group_entries));
addr = realloc (evs_pd->groups, sizeof (struct evs_group) *
(evs_pd->group_entries + req_lib_evs_join->group_entries));
if (addr == 0) {
error = SA_AIS_ERR_NO_MEMORY;
goto exit_error;
}
conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups = addr;
evs_pd->groups = addr;
memcpy (&conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups[conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries],
memcpy (&evs_pd->groups[evs_pd->group_entries],
req_lib_evs_join->groups,
sizeof (struct evs_group) * req_lib_evs_join->group_entries);
conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries += req_lib_evs_join->group_entries;
evs_pd->group_entries += req_lib_evs_join->group_entries;
exit_error:
res_lib_evs_join.header.size = sizeof (struct res_lib_evs_join);
res_lib_evs_join.header.id = MESSAGE_RES_EVS_JOIN;
res_lib_evs_join.header.error = error;
libais_send_response (conn_info, &res_lib_evs_join,
openais_conn_send_response (conn, &res_lib_evs_join,
sizeof (struct res_lib_evs_join));
}
static void message_handler_req_evs_leave (struct conn_info *conn_info, void *message)
static void message_handler_req_evs_leave (void *conn, void *msg)
{
struct req_lib_evs_leave *req_lib_evs_leave = (struct req_lib_evs_leave *)message;
struct req_lib_evs_leave *req_lib_evs_leave = (struct req_lib_evs_leave *)msg;
struct res_lib_evs_leave res_lib_evs_leave;
evs_error_t error = EVS_OK;
int error_index;
int i, j;
int found;
struct evs_pd *evs_pd = (struct evs_pd *)openais_conn_private_data_get (conn);
for (i = 0; i < req_lib_evs_leave->group_entries; i++) {
found = 0;
for (j = 0; j < conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries;) {
for (j = 0; j < evs_pd->group_entries;) {
if (memcmp (&req_lib_evs_leave->groups[i],
&conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups[j],
sizeof (struct evs_group)) == 0) {
&evs_pd->groups[j], sizeof (struct evs_group)) == 0) {
/*
* Delete entry
*/
memmove (&conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups[j],
&conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups[j + 1],
(conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries - j - 1) *
sizeof (struct evs_group));
memmove (&evs_pd->groups[j], &evs_pd->groups[j + 1],
(evs_pd->group_entries - j - 1) * sizeof (struct evs_group));
conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries -= 1;
evs_pd->group_entries -= 1;
found = 1;
break;
@ -343,44 +358,38 @@ static void message_handler_req_evs_leave (struct conn_info *conn_info, void *me
}
}
#ifdef DEBUG
for (i = 0; i < conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries; i++) {
printf ("Groups Left %s\n",
&conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups[i].key);
}
#endif
res_lib_evs_leave.header.size = sizeof (struct res_lib_evs_leave);
res_lib_evs_leave.header.id = MESSAGE_RES_EVS_LEAVE;
res_lib_evs_leave.header.error = error;
libais_send_response (conn_info, &res_lib_evs_leave,
openais_conn_send_response (conn, &res_lib_evs_leave,
sizeof (struct res_lib_evs_leave));
}
static void message_handler_req_evs_mcast_joined (struct conn_info *conn_info, void *message)
static void message_handler_req_evs_mcast_joined (void *conn, void *msg)
{
evs_error_t error = EVS_ERR_TRY_AGAIN;
struct req_lib_evs_mcast_joined *req_lib_evs_mcast_joined = (struct req_lib_evs_mcast_joined *)message;
struct req_lib_evs_mcast_joined *req_lib_evs_mcast_joined = (struct req_lib_evs_mcast_joined *)msg;
struct res_lib_evs_mcast_joined res_lib_evs_mcast_joined;
struct iovec req_exec_evs_mcast_iovec[3];
struct req_exec_evs_mcast req_exec_evs_mcast;
int send_ok = 0;
int res;
struct evs_pd *evs_pd = (struct evs_pd *)openais_conn_private_data_get (conn);
req_exec_evs_mcast.header.size = sizeof (struct req_exec_evs_mcast) +
conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries *
sizeof (struct evs_group) +
evs_pd->group_entries * sizeof (struct evs_group) +
req_lib_evs_mcast_joined->msg_len;
req_exec_evs_mcast.header.id =
SERVICE_ID_MAKE (EVS_SERVICE, MESSAGE_REQ_EXEC_EVS_MCAST);
req_exec_evs_mcast.msg_len = req_lib_evs_mcast_joined->msg_len;
req_exec_evs_mcast.group_entries = conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries;
req_exec_evs_mcast.group_entries = evs_pd->group_entries;
req_exec_evs_mcast_iovec[0].iov_base = &req_exec_evs_mcast;
req_exec_evs_mcast_iovec[0].iov_len = sizeof (req_exec_evs_mcast);
req_exec_evs_mcast_iovec[1].iov_base = conn_info->conn_info_partner->ais_ci.u.libevs_ci.groups;
req_exec_evs_mcast_iovec[1].iov_len = conn_info->conn_info_partner->ais_ci.u.libevs_ci.group_entries * sizeof (struct evs_group);
req_exec_evs_mcast_iovec[1].iov_base = evs_pd->groups;
req_exec_evs_mcast_iovec[1].iov_len = evs_pd->group_entries * sizeof (struct evs_group);
req_exec_evs_mcast_iovec[2].iov_base = &req_lib_evs_mcast_joined->msg;
req_exec_evs_mcast_iovec[2].iov_len = req_lib_evs_mcast_joined->msg_len;
// TODO this doesn't seem to work for some reason
@ -396,14 +405,14 @@ static void message_handler_req_evs_mcast_joined (struct conn_info *conn_info, v
res_lib_evs_mcast_joined.header.id = MESSAGE_RES_EVS_MCAST_JOINED;
res_lib_evs_mcast_joined.header.error = error;
libais_send_response (conn_info, &res_lib_evs_mcast_joined,
openais_conn_send_response (conn, &res_lib_evs_mcast_joined,
sizeof (struct res_lib_evs_mcast_joined));
}
static void message_handler_req_evs_mcast_groups (struct conn_info *conn_info, void *message)
static void message_handler_req_evs_mcast_groups (void *conn, void *msg)
{
evs_error_t error = EVS_ERR_TRY_AGAIN;
struct req_lib_evs_mcast_groups *req_lib_evs_mcast_groups = (struct req_lib_evs_mcast_groups *)message;
struct req_lib_evs_mcast_groups *req_lib_evs_mcast_groups = (struct req_lib_evs_mcast_groups *)msg;
struct res_lib_evs_mcast_groups res_lib_evs_mcast_groups;
struct iovec req_exec_evs_mcast_iovec[3];
struct req_exec_evs_mcast req_exec_evs_mcast;
@ -442,11 +451,11 @@ static void message_handler_req_evs_mcast_groups (struct conn_info *conn_info, v
res_lib_evs_mcast_groups.header.id = MESSAGE_RES_EVS_MCAST_GROUPS;
res_lib_evs_mcast_groups.header.error = error;
libais_send_response (conn_info, &res_lib_evs_mcast_groups,
openais_conn_send_response (conn, &res_lib_evs_mcast_groups,
sizeof (struct res_lib_evs_mcast_groups));
}
static void message_handler_req_evs_membership_get (struct conn_info *conn_info, void *message)
static void message_handler_req_evs_membership_get (void *conn, void *msg)
{
struct res_lib_evs_membership_get res_lib_evs_membership_get;
@ -462,7 +471,7 @@ static void message_handler_req_evs_membership_get (struct conn_info *conn_info,
res_lib_evs_membership_get.member_list_entries =
res_evs_confchg_callback.member_list_entries;
libais_send_response (conn_info, &res_lib_evs_membership_get,
openais_conn_send_response (conn, &res_lib_evs_membership_get,
sizeof (struct res_lib_evs_membership_get));
}
@ -470,15 +479,15 @@ static void req_exec_mcast_endian_convert (void *msg)
{
}
static void message_handler_req_exec_mcast (void *message, struct totem_ip_address *source_addr)
static void message_handler_req_exec_mcast (void *msg, struct totem_ip_address *source_addr)
{
struct req_exec_evs_mcast *req_exec_evs_mcast = (struct req_exec_evs_mcast *)message;
struct req_exec_evs_mcast *req_exec_evs_mcast = (struct req_exec_evs_mcast *)msg;
struct res_evs_deliver_callback res_evs_deliver_callback;
char *msg_addr;
struct conn_info *conn_info;
struct list_head *list;
int found = 0;
int i, j;
struct evs_pd *evs_pd;
res_evs_deliver_callback.header.size = sizeof (struct res_evs_deliver_callback) +
req_exec_evs_mcast->msg_len;
@ -491,12 +500,12 @@ static void message_handler_req_exec_mcast (void *message, struct totem_ip_addre
for (list = confchg_notify.next; list != &confchg_notify; list = list->next) {
found = 0;
conn_info = list_entry (list, struct conn_info, conn_list);
evs_pd = list_entry (list, struct evs_pd, list);
for (i = 0; i < conn_info->ais_ci.u.libevs_ci.group_entries; i++) {
for (i = 0; i < evs_pd->group_entries; i++) {
for (j = 0; j < req_exec_evs_mcast->group_entries; j++) {
if (memcmp (&conn_info->ais_ci.u.libevs_ci.groups[i],
&req_exec_evs_mcast->groups[j],
if (memcmp (&evs_pd->groups[i], &req_exec_evs_mcast->groups[j],
sizeof (struct evs_group)) == 0) {
found = 1;
@ -511,9 +520,9 @@ static void message_handler_req_exec_mcast (void *message, struct totem_ip_addre
if (found) {
totemip_copy((struct totem_ip_address *)&res_evs_deliver_callback.evs_address,
source_addr);
libais_send_response (conn_info, &res_evs_deliver_callback,
openais_conn_send_response (evs_pd->conn, &res_evs_deliver_callback,
sizeof (struct res_evs_deliver_callback));
libais_send_response (conn_info, msg_addr,
openais_conn_send_response (evs_pd->conn, msg_addr,
req_exec_evs_mcast->msg_len);
}
}

View File

@ -66,26 +66,50 @@
#define LOG_SERVICE LOG_SERVICE_EVT
#include "print.h"
/*
* event instance structure. Contains information about the
* active connection to the API library.
*
* esi_version: Version that the library is running.
* esi_open_chans: list of open channels associated with this
* instance. Used to clean up any data left
* allocated when the finalize is done.
* (event_svr_channel_open.eco_instance_entry)
* esi_events: list of pending events to be delivered on this
* instance (struct chan_event_list.cel_entry)
* esi_queue_blocked: non-zero if the delivery queue got too full
* and we're blocking new messages until we
* drain some of the queued messages.
* esi_nevents: Number of events in events lists to be sent.
* esi_hdb: Handle data base for open channels on this
* instance. Used for a quick lookup of
* open channel data from a lib api message.
*/
struct libevt_pd {
SaVersionT esi_version;
struct list_head esi_open_chans;
struct list_head esi_events[SA_EVT_LOWEST_PRIORITY+1];
int esi_nevents;
int esi_queue_blocked;
struct hdb_handle_database esi_hdb;
};
enum evt_message_req_types {
MESSAGE_REQ_EXEC_EVT_EVENTDATA = 0,
MESSAGE_REQ_EXEC_EVT_CHANCMD = 1,
MESSAGE_REQ_EXEC_EVT_RECOVERY_EVENTDATA = 2
};
static void lib_evt_open_channel(struct conn_info *conn_info, void *message);
static void lib_evt_open_channel_async(struct conn_info *conn_info,
void *message);
static void lib_evt_close_channel(struct conn_info *conn_info, void *message);
static void lib_evt_unlink_channel(struct conn_info *conn_info, void *message);
static void lib_evt_event_subscribe(struct conn_info *conn_info,
void *message);
static void lib_evt_event_unsubscribe(struct conn_info *conn_info,
void *message);
static void lib_evt_event_publish(struct conn_info *conn_info, void *message);
static void lib_evt_event_clear_retentiontime(struct conn_info *conn_info,
void *message);
static void lib_evt_event_data_get(struct conn_info *conn_info,
void *message);
static void lib_evt_open_channel(void *conn, void *message);
static void lib_evt_open_channel_async(void *conn, void *message);
static void lib_evt_close_channel(void *conn, void *message);
static void lib_evt_unlink_channel(void *conn, void *message);
static void lib_evt_event_subscribe(void *conn, void *message);
static void lib_evt_event_unsubscribe(void *conn, void *message);
static void lib_evt_event_publish(void *conn, void *message);
static void lib_evt_event_clear_retentiontime(void *conn, void *message);
static void lib_evt_event_data_get(void *conn, void *message);
static void evt_conf_change(
enum totem_configuration_type configuration_type,
@ -94,8 +118,8 @@ static void evt_conf_change(
struct totem_ip_address *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id);
static int evt_lib_init(struct conn_info *conn_info);
static int evt_lib_exit(struct conn_info *conn_info);
static int evt_lib_init(void *conn);
static int evt_lib_exit(void *conn);
static int evt_exec_init(struct openais_config *openais_config);
/*
@ -190,6 +214,7 @@ struct openais_service_handler evt_service_handler = {
.name =
(unsigned char*)"openais event service B.01.01",
.id = EVT_SERVICE,
.private_data_size = sizeof (struct libevt_pd),
.lib_init_fn = evt_lib_init,
.lib_exit_fn = evt_lib_exit,
.lib_handlers = evt_lib_handlers,
@ -206,7 +231,7 @@ struct openais_service_handler evt_service_handler = {
};
#ifdef BUILD_DYNAMIC
struct openais_service_handler *evt_get_handler_ver0 (void);
struct openais_service_handler *evt_get_handler_ver0(void);
struct openais_service_handler_iface_ver0 evt_service_handler_iface = {
.openais_get_service_handler_ver0 = evt_get_handler_ver0
@ -231,13 +256,13 @@ struct lcr_comp evt_comp_ver0 = {
.ifaces = openais_evt_ver0
};
extern int lcr_comp_get (struct lcr_comp **component)
extern int lcr_comp_get(struct lcr_comp **component)
{
*component = &evt_comp_ver0;
return (0);
}
struct openais_service_handler *evt_get_handler_ver0 (void)
struct openais_service_handler *evt_get_handler_ver0(void)
{
return (&evt_service_handler);
}
@ -262,13 +287,6 @@ static DECLARE_LIST_INIT(esc_head);
*/
static DECLARE_LIST_INIT(esc_unlinked_head);
/*
* list of all active event conn_info structs.
* struct conn_info
*/
static DECLARE_LIST_INIT(ci_head);
/*
* Track the state of event service recovery.
*
@ -356,7 +374,7 @@ static int processed_open_counts = 0;
* ocp_async: 1 for async open
* ocp_invocation: invocation for async open
* ocp_chan_name: requested channel
* ocp_conn_info: conn_info for returning to the library.
* ocp_conn: conn for returning to the library.
* ocp_open_flags: channel open flags
* ocp_timer_handle: timer handle for sync open
* ocp_serial_no: Identifier for the request
@ -366,7 +384,7 @@ struct open_chan_pending {
int ocp_async;
SaInvocationT ocp_invocation;
SaNameT ocp_chan_name;
struct conn_info *ocp_conn_info;
void *ocp_conn;
SaEvtChannelOpenFlagsT ocp_open_flag;
poll_timer_handle ocp_timer_handle;
uint64_t ocp_c_handle;
@ -391,12 +409,12 @@ static void chan_open_timeout(void *data);
/*
* Structure to track pending channel unlink requests.
* ucp_unlink_id: unlink ID of unlinked channel.
* ucp_conn_info: conn_info for returning to the library.
* ucp_conn: conn for returning to the library.
* ucp_entry: list entry for pending unlink list.
*/
struct unlink_chan_pending {
uint64_t ucp_unlink_id;
struct conn_info *ucp_conn_info;
void *ucp_conn;
struct list_head ucp_entry;
};
@ -408,12 +426,12 @@ static DECLARE_LIST_INIT(unlink_pending);
/*
* Structure to track pending retention time clear requests.
* rtc_event_id: event ID to clear.
* rtc_conn_info: conn_info for returning to the library.
* rtc_conn: conn for returning to the library.
* rtc_entry: list entry for pending clear list.
*/
struct retention_time_clear_pending {
SaEvtEventIdT rtc_event_id;
struct conn_info *rtc_conn_info;
void *rtc_conn;
struct list_head rtc_entry;
};
@ -573,7 +591,7 @@ struct chan_event_list {
* associated server instance.
* eco_subscr: head of list of sbuscriptions for this channel open.
* (event_svr_channel_subscr.ecs_entry)
* eco_conn_info: refrence to EvtInitialize who owns this open.
* eco_conn: refrence to EvtInitialize who owns this open.
*/
struct event_svr_channel_open {
uint8_t eco_flags;
@ -583,7 +601,7 @@ struct event_svr_channel_open {
struct list_head eco_entry;
struct list_head eco_instance_entry;
struct list_head eco_subscr;
struct conn_info *eco_conn_info;
void *eco_conn;
};
/*
@ -1161,7 +1179,7 @@ static SaAisErrorT evt_open_channel(SaNameT *cn, SaUint8T flgs)
*/
memset(&cpkt, 0, sizeof(cpkt));
cpkt.chc_head.id =
SERVICE_ID_MAKE (EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
SERVICE_ID_MAKE(EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
cpkt.chc_head.size = sizeof(cpkt);
cpkt.chc_op = EVT_OPEN_CHAN_OP;
cpkt.u.chc_chan.ocr_name = *cn;
@ -1169,7 +1187,8 @@ static SaAisErrorT evt_open_channel(SaNameT *cn, SaUint8T flgs)
chn_iovec.iov_base = &cpkt;
chn_iovec.iov_len = cpkt.chc_head.size;
log_printf(CHAN_OPEN_DEBUG, "evt_open_channel: Send open mcast\n");
res = totempg_groups_mcast_joined (openais_group_handle, &chn_iovec, 1, TOTEMPG_AGREED);
res = totempg_groups_mcast_joined(openais_group_handle,
&chn_iovec, 1, TOTEMPG_AGREED);
log_printf(CHAN_OPEN_DEBUG, "evt_open_channel: Open mcast result: %d\n",
res);
if (res != 0) {
@ -1199,14 +1218,15 @@ static SaAisErrorT evt_close_channel(SaNameT *cn, uint64_t unlink_id)
*/
memset(&cpkt, 0, sizeof(cpkt));
cpkt.chc_head.id =
SERVICE_ID_MAKE (EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
SERVICE_ID_MAKE(EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
cpkt.chc_head.size = sizeof(cpkt);
cpkt.chc_op = EVT_CLOSE_CHAN_OP;
cpkt.u.chcu.chcu_name = *cn;
cpkt.u.chcu.chcu_unlink_id = unlink_id;
chn_iovec.iov_base = &cpkt;
chn_iovec.iov_len = cpkt.chc_head.size;
res = totempg_groups_mcast_joined (openais_group_handle, &chn_iovec, 1, TOTEMPG_AGREED);
res = totempg_groups_mcast_joined(openais_group_handle,
&chn_iovec, 1, TOTEMPG_AGREED);
if (res != 0) {
ret = SA_AIS_ERR_LIBRARY;
}
@ -1674,11 +1694,12 @@ filter_undelivered_events(struct event_svr_channel_open *op_chan)
struct event_svr_channel_instance *eci;
struct event_svr_channel_subscr *ecs;
struct chan_event_list *cel;
struct libevt_ci *esip = &op_chan->eco_conn_info->ais_ci.u.libevt_ci;
struct libevt_pd *esip;
struct list_head *l, *nxt;
struct list_head *l1, *l2;
int i;
esip = (struct libevt_pd *)openais_conn_private_data_get(op_chan->eco_conn);
eci = op_chan->eco_channel;
/*
@ -1702,7 +1723,7 @@ filter_undelivered_events(struct event_svr_channel_open *op_chan)
* See if this channel open instance belongs
* to this evtinitialize instance
*/
if (eco->eco_conn_info != op_chan->eco_conn_info) {
if (eco->eco_conn != op_chan->eco_conn) {
continue;
}
@ -1751,30 +1772,34 @@ next_event:
/*
* Notify the library of a pending event
*/
static void __notify_event(struct conn_info *conn_info)
static void __notify_event(void *conn)
{
struct res_evt_event_data res;
struct libevt_ci *esip = &conn_info->ais_ci.u.libevt_ci;
struct libevt_pd *esip;
esip = (struct libevt_pd *)openais_conn_private_data_get(conn);
log_printf(LOG_LEVEL_DEBUG, "DELIVER: notify\n");
if (esip->esi_nevents != 0) {
res.evd_head.size = sizeof(res);
res.evd_head.id = MESSAGE_RES_EVT_AVAILABLE;
res.evd_head.error = SA_AIS_OK;
libais_send_response(conn_info->conn_info_partner, &res, sizeof(res));
openais_conn_send_response(openais_conn_partner_get(conn),
&res, sizeof(res));
}
}
inline void notify_event(struct conn_info *conn_info)
inline void notify_event(void *conn)
{
struct libevt_ci *esip = &conn_info->ais_ci.u.libevt_ci;
struct libevt_pd *esip;
esip = (struct libevt_pd *)openais_conn_private_data_get(conn);
/*
* Give the library a kick if there aren't already
* events queued for delivery.
*/
if (esip->esi_nevents++ == 0) {
__notify_event(conn_info);
__notify_event(conn);
}
}
@ -1787,12 +1812,14 @@ deliver_event(struct event_data *evt,
struct event_svr_channel_subscr *ecs)
{
struct chan_event_list *ep;
struct libevt_ci *esip = &eco->eco_conn_info->ais_ci.u.libevt_ci;
SaEvtEventPriorityT evt_prio = evt->ed_event.led_priority;
struct chan_event_list *cel;
int do_deliver_event = 0;
int do_deliver_warning = 0;
int i;
struct libevt_pd *esip;
esip = (struct libevt_pd *)openais_conn_private_data_get(eco->eco_conn);
if (evt_prio > SA_EVT_LOWEST_PRIORITY) {
evt_prio = SA_EVT_LOWEST_PRIORITY;
@ -1863,7 +1890,7 @@ deliver_event(struct event_data *evt,
ep->cel_event = evt;
list_add_tail(&ep->cel_entry, &esip->esi_events[evt_prio]);
evt_delivered(evt, eco);
notify_event(eco->eco_conn_info);
notify_event(eco->eco_conn);
}
/*
@ -1896,7 +1923,7 @@ deliver_event(struct event_data *evt,
list_init(&ep->cel_entry);
ep->cel_event = ed;
list_add_tail(&ep->cel_entry, &esip->esi_events[SA_EVT_HIGHEST_PRIORITY]);
notify_event(eco->eco_conn_info);
notify_event(eco->eco_conn);
}
}
@ -2037,7 +2064,7 @@ static struct event_svr_channel_subscr *find_subscr(
struct event_svr_channel_subscr *ecs;
struct event_svr_channel_open *eco;
struct list_head *l, *l1;
struct conn_info* conn_info = open_chan->eco_conn_info;
void *conn = open_chan->eco_conn;
eci = open_chan->eco_channel;
@ -2051,7 +2078,7 @@ static struct event_svr_channel_subscr *find_subscr(
* Don't bother with open channels associated with another
* EvtInitialize
*/
if (eco->eco_conn_info != conn_info) {
if (eco->eco_conn != conn) {
continue;
}
@ -2068,50 +2095,40 @@ static struct event_svr_channel_subscr *find_subscr(
/*
* Handler for saEvtInitialize
*/
static int evt_lib_init(struct conn_info *conn_info)
static int evt_lib_init(void *conn)
{
struct libevt_ci *libevt_ci;
struct conn_info *resp_conn_info;
struct libevt_pd *libevt_pd;
int i;
libevt_pd = (struct libevt_pd *)openais_conn_private_data_get(conn);
log_printf(LOG_LEVEL_DEBUG, "saEvtInitialize request.\n");
list_init (&conn_info->conn_list);
resp_conn_info = conn_info->conn_info_partner;
list_init (&resp_conn_info->conn_list);
libevt_ci = &resp_conn_info->ais_ci.u.libevt_ci;
/*
* Initailze event instance data
*/
memset(libevt_ci, 0, sizeof(*libevt_ci));
memset(libevt_pd, 0, sizeof(*libevt_pd));
/*
* list of channels open on this instance
*/
list_init(&libevt_ci->esi_open_chans);
list_init(&libevt_pd->esi_open_chans);
/*
* pending event lists for each piriority
*/
for (i = SA_EVT_HIGHEST_PRIORITY; i <= SA_EVT_LOWEST_PRIORITY; i++) {
list_init(&libevt_ci->esi_events[i]);
list_init(&libevt_pd->esi_events[i]);
}
/*
* Keep track of all event service connections
*/
list_add_tail(&resp_conn_info->conn_list, &ci_head);
return 0;
}
/*
* Handler for saEvtChannelOpen
*/
static void lib_evt_open_channel(struct conn_info *conn_info, void *message)
static void lib_evt_open_channel(void *conn, void *message)
{
SaAisErrorT error;
struct req_evt_channel_open *req;
@ -2153,7 +2170,7 @@ static void lib_evt_open_channel(struct conn_info *conn_info, void *message)
ocp->ocp_invocation = 0;
ocp->ocp_chan_name = req->ico_channel_name;
ocp->ocp_open_flag = req->ico_open_flag;
ocp->ocp_conn_info = conn_info;
ocp->ocp_conn = conn;
ocp->ocp_c_handle = req->ico_c_handle;
ocp->ocp_timer_handle = 0;
ocp->ocp_serial_no = open_serial_no;
@ -2180,14 +2197,13 @@ open_return:
res.ico_head.size = sizeof(res);
res.ico_head.id = MESSAGE_RES_EVT_OPEN_CHANNEL;
res.ico_head.error = error;
libais_send_response (conn_info, &res, sizeof(res));
openais_conn_send_response(conn, &res, sizeof(res));
}
/*
* Handler for saEvtChannelOpen
*/
static void lib_evt_open_channel_async(struct conn_info *conn_info,
void *message)
static void lib_evt_open_channel_async(void *conn, void *message)
{
SaAisErrorT error;
struct req_evt_channel_open *req;
@ -2228,7 +2244,7 @@ static void lib_evt_open_channel_async(struct conn_info *conn_info,
ocp->ocp_c_handle = req->ico_c_handle;
ocp->ocp_chan_name = req->ico_channel_name;
ocp->ocp_open_flag = req->ico_open_flag;
ocp->ocp_conn_info = conn_info;
ocp->ocp_conn = conn;
ocp->ocp_timer_handle = 0;
ocp->ocp_serial_no = open_serial_no;
list_init(&ocp->ocp_entry);
@ -2238,7 +2254,7 @@ open_return:
res.ico_head.size = sizeof(res);
res.ico_head.id = MESSAGE_RES_EVT_OPEN_CHANNEL;
res.ico_head.error = error;
libais_send_response (conn_info, &res, sizeof(res));
openais_conn_send_response(conn, &res, sizeof(res));
}
@ -2248,7 +2264,7 @@ open_return:
* when saEvtFinalize is called with channels open.
*/
static SaAisErrorT
common_chan_close(struct event_svr_channel_open *eco, struct libevt_ci *esip)
common_chan_close(struct event_svr_channel_open *eco, struct libevt_pd *esip)
{
struct event_svr_channel_subscr *ecs;
struct list_head *l, *nxt;
@ -2296,14 +2312,16 @@ common_chan_close(struct event_svr_channel_open *eco, struct libevt_ci *esip)
/*
* Handler for saEvtChannelClose
*/
static void lib_evt_close_channel(struct conn_info *conn_info, void *message)
static void lib_evt_close_channel(void *conn, void *message)
{
struct req_evt_channel_close *req;
struct res_evt_channel_close res;
struct event_svr_channel_open *eco;
struct libevt_ci *esip = &conn_info->ais_ci.u.libevt_ci;
unsigned int ret;
void *ptr;
struct libevt_pd *esip;
esip = (struct libevt_pd *)openais_conn_private_data_get(conn);
req = message;
@ -2329,13 +2347,13 @@ chan_close_done:
res.icc_head.size = sizeof(res);
res.icc_head.id = MESSAGE_RES_EVT_CLOSE_CHANNEL;
res.icc_head.error = ((ret == 0) ? SA_AIS_OK : SA_AIS_ERR_BAD_HANDLE);
libais_send_response (conn_info, &res, sizeof(res));
openais_conn_send_response(conn, &res, sizeof(res));
}
/*
* Handler for saEvtChannelUnlink
*/
static void lib_evt_unlink_channel(struct conn_info *conn_info, void *message)
static void lib_evt_unlink_channel(void *conn, void *message)
{
struct req_evt_channel_unlink *req;
struct res_evt_channel_unlink res;
@ -2371,7 +2389,7 @@ static void lib_evt_unlink_channel(struct conn_info *conn_info, void *message)
}
ucp->ucp_unlink_id = next_chan_unlink_id();
ucp->ucp_conn_info = conn_info;
ucp->ucp_conn = conn;
list_init(&ucp->ucp_entry);
list_add_tail(&ucp->ucp_entry, &unlink_pending);
@ -2381,14 +2399,15 @@ static void lib_evt_unlink_channel(struct conn_info *conn_info, void *message)
*/
memset(&cpkt, 0, sizeof(cpkt));
cpkt.chc_head.id =
SERVICE_ID_MAKE (EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
SERVICE_ID_MAKE(EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
cpkt.chc_head.size = sizeof(cpkt);
cpkt.chc_op = EVT_UNLINK_CHAN_OP;
cpkt.u.chcu.chcu_name = req->iuc_channel_name;
cpkt.u.chcu.chcu_unlink_id = ucp->ucp_unlink_id;
chn_iovec.iov_base = &cpkt;
chn_iovec.iov_len = cpkt.chc_head.size;
if (totempg_groups_mcast_joined (openais_group_handle, &chn_iovec, 1, TOTEMPG_AGREED) == 0) {
if (totempg_groups_mcast_joined(openais_group_handle,
&chn_iovec, 1, TOTEMPG_AGREED) == 0) {
return;
}
@ -2400,7 +2419,7 @@ evt_unlink_err:
res.iuc_head.size = sizeof(res);
res.iuc_head.id = MESSAGE_RES_EVT_UNLINK_CHANNEL;
res.iuc_head.error = error;
libais_send_response (conn_info, &res, sizeof(res));
openais_conn_send_response(conn, &res, sizeof(res));
}
/*
@ -2424,7 +2443,7 @@ static char *filter_types[] = {
/*
* saEvtEventSubscribe Handler
*/
static void lib_evt_event_subscribe(struct conn_info *conn_info, void *message)
static void lib_evt_event_subscribe(void *conn, void *message)
{
struct req_evt_event_subscribe *req;
struct res_evt_event_subscribe res;
@ -2434,11 +2453,13 @@ static void lib_evt_event_subscribe(struct conn_info *conn_info, void *message)
struct event_svr_channel_instance *eci;
struct event_svr_channel_subscr *ecs;
struct event_data *evt;
struct libevt_ci *esip = &conn_info->ais_ci.u.libevt_ci;
struct list_head *l;
void *ptr;
unsigned int ret;
int i;
struct libevt_pd *esip;
esip = (struct libevt_pd *)openais_conn_private_data_get(conn);
req = message;
@ -2503,7 +2524,7 @@ static void lib_evt_event_subscribe(struct conn_info *conn_info, void *message)
res.ics_head.size = sizeof(res);
res.ics_head.id = MESSAGE_RES_EVT_SUBSCRIBE;
res.ics_head.error = error;
libais_send_response (conn_info, &res, sizeof(res));
openais_conn_send_response(conn, &res, sizeof(res));
/*
* See if an existing event with a retention time
@ -2535,24 +2556,25 @@ subr_done:
res.ics_head.size = sizeof(res);
res.ics_head.id = MESSAGE_RES_EVT_SUBSCRIBE;
res.ics_head.error = error;
libais_send_response (conn_info, &res, sizeof(res));
openais_conn_send_response(conn, &res, sizeof(res));
}
/*
* saEvtEventUnsubscribe Handler
*/
static void lib_evt_event_unsubscribe(struct conn_info *conn_info,
void *message)
static void lib_evt_event_unsubscribe(void *conn, void *message)
{
struct req_evt_event_unsubscribe *req;
struct res_evt_event_unsubscribe res;
struct event_svr_channel_open *eco;
struct event_svr_channel_instance *eci;
struct event_svr_channel_subscr *ecs;
struct libevt_ci *esip = &conn_info->ais_ci.u.libevt_ci;
SaAisErrorT error = SA_AIS_OK;
unsigned int ret;
void *ptr;
struct libevt_pd *esip;
esip = (struct libevt_pd *)openais_conn_private_data_get(conn);
req = message;
@ -2601,17 +2623,16 @@ unsubr_done:
res.icu_head.size = sizeof(res);
res.icu_head.id = MESSAGE_RES_EVT_UNSUBSCRIBE;
res.icu_head.error = error;
libais_send_response (conn_info, &res, sizeof(res));
openais_conn_send_response(conn, &res, sizeof(res));
}
/*
* saEvtEventPublish Handler
*/
static void lib_evt_event_publish(struct conn_info *conn_info, void *message)
static void lib_evt_event_publish(void *conn, void *message)
{
struct lib_event_data *req;
struct res_evt_event_publish res;
struct libevt_ci *esip = &conn_info->ais_ci.u.libevt_ci;
struct event_svr_channel_open *eco;
struct event_svr_channel_instance *eci;
SaEvtEventIdT event_id = 0;
@ -2621,6 +2642,9 @@ static void lib_evt_event_publish(struct conn_info *conn_info, void *message)
void *ptr;
int result;
unsigned int ret;
struct libevt_pd *esip;
esip = (struct libevt_pd *)openais_conn_private_data_get(conn);
req = message;
@ -2647,7 +2671,7 @@ static void lib_evt_event_publish(struct conn_info *conn_info, void *message)
* processes.
*/
get_event_id(&event_id, &msg_id);
req->led_head.id = SERVICE_ID_MAKE (EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_EVENTDATA);
req->led_head.id = SERVICE_ID_MAKE(EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_EVENTDATA);
req->led_chan_name = eci->esc_channel_name;
req->led_event_id = event_id;
req->led_msg_id = msg_id;
@ -2660,7 +2684,7 @@ static void lib_evt_event_publish(struct conn_info *conn_info, void *message)
*/
pub_iovec.iov_base = req;
pub_iovec.iov_len = req->led_head.size;
result = totempg_groups_mcast_joined (openais_group_handle, &pub_iovec, 1, TOTEMPG_AGREED);
result = totempg_groups_mcast_joined(openais_group_handle, &pub_iovec, 1, TOTEMPG_AGREED);
if (result != 0) {
error = SA_AIS_ERR_LIBRARY;
}
@ -2671,14 +2695,13 @@ pub_done:
res.iep_head.id = MESSAGE_RES_EVT_PUBLISH;
res.iep_head.error = error;
res.iep_event_id = event_id;
libais_send_response (conn_info, &res, sizeof(res));
openais_conn_send_response(conn, &res, sizeof(res));
}
/*
* saEvtEventRetentionTimeClear handler
*/
static void lib_evt_event_clear_retentiontime(struct conn_info *conn_info,
void *message)
static void lib_evt_event_clear_retentiontime(void *conn, void *message)
{
struct req_evt_event_clear_retentiontime *req;
struct res_evt_event_clear_retentiontime res;
@ -2705,7 +2728,7 @@ static void lib_evt_event_clear_retentiontime(struct conn_info *conn_info,
goto evt_ret_clr_err;
}
rtc->rtc_event_id = req->iec_event_id;
rtc->rtc_conn_info = conn_info;
rtc->rtc_conn = conn;
list_init(&rtc->rtc_entry);
list_add_tail(&rtc->rtc_entry, &clear_pending);
@ -2714,13 +2737,14 @@ static void lib_evt_event_clear_retentiontime(struct conn_info *conn_info,
*/
memset(&cpkt, 0, sizeof(cpkt));
cpkt.chc_head.id =
SERVICE_ID_MAKE (EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
SERVICE_ID_MAKE(EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
cpkt.chc_head.size = sizeof(cpkt);
cpkt.chc_op = EVT_CLEAR_RET_OP;
cpkt.u.chc_event_id = req->iec_event_id;
rtn_iovec.iov_base = &cpkt;
rtn_iovec.iov_len = cpkt.chc_head.size;
ret = totempg_groups_mcast_joined (openais_group_handle, &rtn_iovec, 1, TOTEMPG_AGREED);
ret = totempg_groups_mcast_joined(openais_group_handle,
&rtn_iovec, 1, TOTEMPG_AGREED);
if (ret == 0) {
// TODO this should really assert
return;
@ -2735,20 +2759,22 @@ evt_ret_clr_err:
res.iec_head.size = sizeof(res);
res.iec_head.id = MESSAGE_RES_EVT_CLEAR_RETENTIONTIME;
res.iec_head.error = error;
libais_send_response (conn_info, &res, sizeof(res));
openais_conn_send_response(conn, &res, sizeof(res));
}
/*
* Send requested event data to the application
*/
static void lib_evt_event_data_get(struct conn_info *conn_info, void *message)
static void lib_evt_event_data_get(void *conn, void *message)
{
struct lib_event_data res;
struct libevt_ci *esip = &conn_info->ais_ci.u.libevt_ci;
struct chan_event_list *cel;
struct event_data *edp;
int i;
struct libevt_pd *esip;
esip = (struct libevt_pd *)openais_conn_private_data_get(conn);
/*
@ -2772,7 +2798,7 @@ static void lib_evt_event_data_get(struct conn_info *conn_info, void *message)
edp->ed_event.led_head.id = MESSAGE_RES_EVT_EVENT_DATA;
edp->ed_event.led_head.error = SA_AIS_OK;
free(cel);
libais_send_response(conn_info, &edp->ed_event,
openais_conn_send_response(conn, &edp->ed_event,
edp->ed_event.led_head.size);
free_event_data(edp);
goto data_get_done;
@ -2782,7 +2808,7 @@ static void lib_evt_event_data_get(struct conn_info *conn_info, void *message)
res.led_head.size = sizeof(res.led_head);
res.led_head.id = MESSAGE_RES_EVT_EVENT_DATA;
res.led_head.error = SA_AIS_ERR_NOT_EXIST;
libais_send_response(conn_info, &res, res.led_head.size);
openais_conn_send_response(conn, &res, res.led_head.size);
/*
* See if there are any events that the app doesn't know about
@ -2790,7 +2816,7 @@ static void lib_evt_event_data_get(struct conn_info *conn_info, void *message)
*/
data_get_done:
if (esip->esi_nevents) {
__notify_event(conn_info);
__notify_event(conn);
}
}
@ -2935,15 +2961,16 @@ static void evt_conf_change(
/*
* saEvtFinalize Handler
*/
static int evt_lib_exit(struct conn_info *conn_info)
static int evt_lib_exit(void *conn)
{
struct libevt_ci *esip = &conn_info->conn_info_partner->ais_ci.u.libevt_ci;
struct event_svr_channel_open *eco;
struct list_head *l, *nxt;
struct open_chan_pending *ocp;
struct unlink_chan_pending *ucp;
struct retention_time_clear_pending *rtc;
struct libevt_pd *esip =
openais_conn_private_data_get(openais_conn_partner_get(conn));
log_printf(LOG_LEVEL_DEBUG, "saEvtFinalize (Event exit request)\n");
log_printf(LOG_LEVEL_DEBUG, "saEvtFinalize %d evts on list\n",
@ -2965,7 +2992,7 @@ static int evt_lib_exit(struct conn_info *conn_info)
for (l = open_pending.next; l != &open_pending; l = nxt) {
nxt = l->next;
ocp = list_entry(l, struct open_chan_pending, ocp_entry);
if (esip == &ocp->ocp_conn_info->ais_ci.u.libevt_ci) {
if (esip == openais_conn_private_data_get(ocp->ocp_conn)) {
list_del(&ocp->ocp_entry);
free(ocp);
}
@ -2974,7 +3001,7 @@ static int evt_lib_exit(struct conn_info *conn_info)
for (l = unlink_pending.next; l != &unlink_pending; l = nxt) {
nxt = l->next;
ucp = list_entry(l, struct unlink_chan_pending, ucp_entry);
if (esip == &ucp->ucp_conn_info->ais_ci.u.libevt_ci) {
if (esip == openais_conn_private_data_get(ucp->ucp_conn)) {
list_del(&ucp->ucp_entry);
free(ucp);
}
@ -2984,17 +3011,12 @@ static int evt_lib_exit(struct conn_info *conn_info)
l != &clear_pending; l = nxt) {
nxt = l->next;
rtc = list_entry(l, struct retention_time_clear_pending, rtc_entry);
if (esip == &rtc->rtc_conn_info->ais_ci.u.libevt_ci) {
if (esip == openais_conn_private_data_get(rtc->rtc_conn)) {
list_del(&rtc->rtc_entry);
free(rtc);
}
}
/*
* Delete track entry if there is one
*/
list_del (&conn_info->conn_info_partner->conn_list);
return 0;
}
@ -3110,7 +3132,7 @@ static void evt_remote_evt(void *msg, struct totem_ip_address *source_addr)
* See where the message came from so that we can set the
* publishing node id in the message before delivery.
*/
cn = main_clm_get_by_nodeid (source_addr->nodeid);
cn = main_clm_get_by_nodeid(source_addr->nodeid);
if (!cn) {
/*
* Not sure how this can happen...
@ -3310,7 +3332,7 @@ static void chan_open_timeout(void *data)
res.ico_head.id = MESSAGE_RES_EVT_OPEN_CHANNEL;
res.ico_head.error = SA_AIS_ERR_TIMEOUT;
ocp->ocp_invocation = OPEN_TIMED_OUT;
libais_send_response (ocp->ocp_conn_info, &res, sizeof(res));
openais_conn_send_response(ocp->ocp_conn, &res, sizeof(res));
}
/*
@ -3320,13 +3342,15 @@ static void chan_open_timeout(void *data)
static void evt_chan_open_finish(struct open_chan_pending *ocp,
struct event_svr_channel_instance *eci)
{
uint32_t handle;
struct event_svr_channel_open *eco;
SaAisErrorT error = SA_AIS_OK;
struct libevt_ci *esip = &ocp->ocp_conn_info->ais_ci.u.libevt_ci;
unsigned int ret = 0;
unsigned int timer_del_status;
void *ptr;
unsigned int timer_del_status = 0;
void *ptr = 0;
uint32_t handle;
struct libevt_pd *esip;
esip = (struct libevt_pd *)openais_conn_private_data_get(ocp->ocp_conn);
log_printf(CHAN_OPEN_DEBUG, "Open channel finish %s\n",
getSaNameT(&ocp->ocp_chan_name));
@ -3382,7 +3406,7 @@ static void evt_chan_open_finish(struct open_chan_pending *ocp,
eco->eco_channel = eci;
eco->eco_lib_handle = ocp->ocp_c_handle;
eco->eco_my_handle = handle;
eco->eco_conn_info = ocp->ocp_conn_info;
eco->eco_conn = ocp->ocp_conn;
list_add_tail(&eco->eco_entry, &eci->esc_open_chans);
list_add_tail(&eco->eco_instance_entry, &esip->esi_open_chans);
@ -3404,7 +3428,7 @@ open_return:
resa.ica_channel_handle = handle;
resa.ica_c_handle = ocp->ocp_c_handle;
resa.ica_invocation = ocp->ocp_invocation;
libais_send_response (ocp->ocp_conn_info->conn_info_partner,
openais_conn_send_response(openais_conn_partner_get(ocp->ocp_conn),
&resa, sizeof(resa));
} else {
struct res_evt_channel_open res;
@ -3412,7 +3436,7 @@ open_return:
res.ico_head.id = MESSAGE_RES_EVT_OPEN_CHANNEL;
res.ico_head.error = (ret == 0 ? SA_AIS_OK : SA_AIS_ERR_BAD_HANDLE);
res.ico_channel_handle = handle;
libais_send_response (ocp->ocp_conn_info, &res, sizeof(res));
openais_conn_send_response(ocp->ocp_conn, &res, sizeof(res));
}
if (timer_del_status == 0) {
@ -3437,7 +3461,7 @@ static void evt_chan_unlink_finish(struct unlink_chan_pending *ucp)
res.iuc_head.size = sizeof(res);
res.iuc_head.id = MESSAGE_RES_EVT_UNLINK_CHANNEL;
res.iuc_head.error = SA_AIS_OK;
libais_send_response (ucp->ucp_conn_info, &res, sizeof(res));
openais_conn_send_response(ucp->ucp_conn, &res, sizeof(res));
free(ucp);
}
@ -3457,7 +3481,7 @@ static void evt_ret_time_clr_finish(struct retention_time_clear_pending *rtc,
res.iec_head.size = sizeof(res);
res.iec_head.id = MESSAGE_RES_EVT_CLEAR_RETENTIONTIME;
res.iec_head.error = ret;
libais_send_response (rtc->rtc_conn_info, &res, sizeof(res));
openais_conn_send_response(rtc->rtc_conn, &res, sizeof(res));
list_del(&rtc->rtc_entry);
free(rtc);
@ -4011,7 +4035,7 @@ static int evt_sync_process(void)
cpkt.u.chc_set_id.chc_last_id = md->mn_last_msg_id;
chn_iovec.iov_base = &cpkt;
chn_iovec.iov_len = cpkt.chc_head.size;
res = totempg_groups_mcast_joined (openais_group_handle,
res = totempg_groups_mcast_joined(openais_group_handle,
&chn_iovec, 1, TOTEMPG_AGREED);
if (res != 0) {
log_printf(RECOVERY_DEBUG,
@ -4071,14 +4095,14 @@ static int evt_sync_process(void)
eci = list_entry(next_chan, struct event_svr_channel_instance,
esc_entry);
cpkt.chc_head.id =
SERVICE_ID_MAKE (EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
SERVICE_ID_MAKE(EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
cpkt.chc_head.size = sizeof(cpkt);
cpkt.chc_op = EVT_OPEN_COUNT;
cpkt.u.chc_set_opens.chc_chan_name = eci->esc_channel_name;
cpkt.u.chc_set_opens.chc_open_count = eci->esc_local_opens;
chn_iovec.iov_base = &cpkt;
chn_iovec.iov_len = cpkt.chc_head.size;
res = totempg_groups_mcast_joined (openais_group_handle,
res = totempg_groups_mcast_joined(openais_group_handle,
&chn_iovec, 1, TOTEMPG_AGREED);
if (res != 0) {
@ -4090,12 +4114,13 @@ static int evt_sync_process(void)
}
memset(&cpkt, 0, sizeof(cpkt));
cpkt.chc_head.id =
SERVICE_ID_MAKE (EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
SERVICE_ID_MAKE(EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
cpkt.chc_head.size = sizeof(cpkt);
cpkt.chc_op = EVT_OPEN_COUNT_DONE;
chn_iovec.iov_base = &cpkt;
chn_iovec.iov_len = cpkt.chc_head.size;
res = totempg_groups_mcast_joined (openais_group_handle, &chn_iovec, 1,TOTEMPG_AGREED);
res = totempg_groups_mcast_joined(openais_group_handle,
&chn_iovec, 1,TOTEMPG_AGREED);
if (res != 0) {
/*
* Try again later.
@ -4140,10 +4165,11 @@ static int evt_sync_process(void)
log_printf(LOG_LEVEL_DEBUG, "Sending next retained event\n");
evt = list_entry(next_retained, struct event_data, ed_retained);
evt->ed_event.led_head.id =
SERVICE_ID_MAKE (EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_RECOVERY_EVENTDATA);
SERVICE_ID_MAKE(EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_RECOVERY_EVENTDATA);
chn_iovec.iov_base = &evt->ed_event;
chn_iovec.iov_len = evt->ed_event.led_head.size;
res = totempg_groups_mcast_joined (openais_group_handle, &chn_iovec, 1, TOTEMPG_AGREED);
res = totempg_groups_mcast_joined(openais_group_handle,
&chn_iovec, 1, TOTEMPG_AGREED);
if (res != 0) {
/*
@ -4166,12 +4192,13 @@ static int evt_sync_process(void)
log_printf(RECOVERY_DEBUG, "DONE Sending retained events\n");
memset(&cpkt, 0, sizeof(cpkt));
cpkt.chc_head.id =
SERVICE_ID_MAKE (EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
SERVICE_ID_MAKE(EVT_SERVICE, MESSAGE_REQ_EXEC_EVT_CHANCMD);
cpkt.chc_head.size = sizeof(cpkt);
cpkt.chc_op = EVT_CONF_DONE;
chn_iovec.iov_base = &cpkt;
chn_iovec.iov_len = cpkt.chc_head.size;
res = totempg_groups_mcast_joined (openais_group_handle, &chn_iovec, 1, TOTEMPG_AGREED);
res = totempg_groups_mcast_joined(openais_group_handle,
&chn_iovec, 1, TOTEMPG_AGREED);
recovery_phase = evt_wait_send_retained_events;
return 1;

View File

@ -33,41 +33,12 @@
#ifndef EVT_H
#define EVT_H
#include "../include/hdb.h"
#include "../include/list.h"
#include "../include/saAis.h"
#include "../include/saEvt.h"
#include "handlers.h"
extern struct openais_service_handler evt_service_handler;
/*
* event instance structure. Contains information about the
* active connection to the API library.
*
* esi_version: Version that the library is running.
* esi_open_chans: list of open channels associated with this
* instance. Used to clean up any data left
* allocated when the finalize is done.
* (event_svr_channel_open.eco_instance_entry)
* esi_events: list of pending events to be delivered on this
* instance (struct chan_event_list.cel_entry)
* esi_queue_blocked: non-zero if the delivery queue got too full
* and we're blocking new messages until we
* drain some of the queued messages.
* esi_nevents: Number of events in events lists to be sent.
* esi_hdb: Handle data base for open channels on this
* instance. Used for a quick lookup of
* open channel data from a lib api message.
*/
struct libevt_ci {
SaVersionT esi_version;
struct list_head esi_open_chans;
struct list_head esi_events[SA_EVT_LOWEST_PRIORITY+1];
int esi_nevents;
int esi_queue_blocked;
struct hdb_handle_database esi_hdb;
};
#endif
/*
* vi: set autoindent tabstop=4 shiftwidth=4 :

View File

@ -49,7 +49,7 @@ enum openais_flow_control {
};
struct openais_lib_handler {
void (*lib_handler_fn) (struct conn_info *conn_info, void *msg);
void (*lib_handler_fn) (void *conn, void *msg);
int response_size;
int response_id;
enum openais_flow_control flow_control;
@ -63,8 +63,9 @@ struct openais_exec_handler {
struct openais_service_handler {
unsigned char *name;
unsigned short id;
int (*lib_init_fn) (struct conn_info *conn_info);
int (*lib_exit_fn) (struct conn_info *conn_info);
unsigned int private_data_size;
int (*lib_init_fn) (void *conn);
int (*lib_exit_fn) (void *conn);
struct openais_lib_handler *lib_handlers;
int lib_handlers_count;
struct openais_exec_handler *exec_handlers;

View File

@ -110,9 +110,9 @@ DECLARE_LIST_INIT(resource_list_head);
static int lck_exec_init_fn (struct openais_config *);
static int lck_lib_exit_fn (struct conn_info *conn_info);
static int lck_lib_exit_fn (void *conn);
static int lck_lib_init_fn (struct conn_info *conn_info);
static int lck_lib_init_fn (void *conn);
static void message_handler_req_exec_lck_resourceopen (
void *message,
@ -139,36 +139,36 @@ static void message_handler_req_exec_lck_lockpurge (
struct totem_ip_address *source_addr);
static void message_handler_req_lib_lck_resourceopen (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_lck_resourceopenasync (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_lck_resourceclose (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_lck_resourcelock (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_lck_resourcelockasync (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_lck_resourceunlock (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_lck_resourceunlockasync (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_lck_lockpurge (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
#ifdef TODO
static void lck_sync_init (void);
@ -196,6 +196,12 @@ static void lck_confchg_fn (
struct totem_ip_address *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id);
struct lck_pd {
struct list_head resource_list;
struct list_head resource_cleanup_list;
};
/*
* Executive Handler Definition
*/
@ -276,6 +282,7 @@ static struct openais_exec_handler lck_exec_handlers[] = {
struct openais_service_handler lck_service_handler = {
.name = (unsigned char*)"openais distributed locking service B.01.01",
.id = LCK_SERVICE,
.private_data_size = sizeof (struct lck_pd),
.lib_init_fn = lck_lib_init_fn,
.lib_exit_fn = lck_lib_exit_fn,
.lib_handlers = lck_lib_handlers,
@ -464,16 +471,15 @@ static struct resource_lock *resource_lock_find (
}
struct resource_cleanup *lck_resource_cleanup_find (
struct conn_info *conn_info,
void *conn,
SaLckResourceHandleT resource_handle)
{
struct list_head *list;
struct resource_cleanup *resource_cleanup;
struct lck_pd *lck_pd = (struct lck_pd *)openais_conn_private_data_get (conn);
for (list = conn_info->ais_ci.u.liblck_ci.resource_cleanup_list.next;
list != &conn_info->ais_ci.u.liblck_ci.resource_cleanup_list;
list = list->next) {
for (list = lck_pd->resource_cleanup_list.next;
list != &lck_pd->resource_cleanup_list; list = list->next) {
resource_cleanup = list_entry (list, struct resource_cleanup, list);
if (resource_cleanup->resource_handle == resource_handle) {
@ -532,8 +538,6 @@ void resource_lock_orphan (struct resource_lock *resource_lock)
iovec.iov_len = sizeof (req_exec_lck_resourcelockorphan);
assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED) == 0);
// AAA
}
void lck_resource_cleanup_lock_remove (
@ -552,15 +556,16 @@ void lck_resource_cleanup_lock_remove (
}
void lck_resource_cleanup_remove (
struct conn_info *conn_info,
void *conn,
SaLckResourceHandleT resource_handle)
{
struct list_head *list;
struct resource_cleanup *resource_cleanup;
struct lck_pd *lck_pd = (struct lck_pd *)openais_conn_private_data_get (conn);
for (list = conn_info->ais_ci.u.liblck_ci.resource_cleanup_list.next;
list != &conn_info->ais_ci.u.liblck_ci.resource_cleanup_list;
for (list = lck_pd->resource_cleanup_list.next;
list != &lck_pd->resource_cleanup_list;
list = list->next) {
resource_cleanup = list_entry (list, struct resource_cleanup, list);
@ -581,24 +586,21 @@ static int lck_exec_init_fn (struct openais_config *openais_config)
return (0);
}
static int lck_lib_exit_fn (struct conn_info *conn_info)
static int lck_lib_exit_fn (void *conn)
{
struct resource_cleanup *resource_cleanup;
struct list_head *list;
struct list_head *cleanup_list;
struct lck_pd *lck_pd = (struct lck_pd *)openais_conn_private_data_get (conn);
if (conn_info->conn_info_partner->service != LCK_SERVICE) {
return 0;
}
log_printf(LOG_LEVEL_NOTICE, "lck_exit_fn conn_info = %p, with fd = %d\n", conn_info, conn_info->fd);
log_printf(LOG_LEVEL_NOTICE, "lck_exit_fn conn_info %p\n", conn);
/*
* close all resources opened on this fd
*/
list = conn_info->conn_info_partner->ais_ci.u.liblck_ci.resource_cleanup_list.next;
while (!list_empty(&conn_info->conn_info_partner->ais_ci.u.liblck_ci.resource_cleanup_list)) {
cleanup_list = lck_pd->resource_cleanup_list.next;
while (!list_empty(cleanup_list)) {
resource_cleanup = list_entry (list, struct resource_cleanup, list);
resource_cleanup = list_entry (cleanup_list, struct resource_cleanup, list);
if (resource_cleanup->resource->name.length > 0) {
lck_resource_cleanup_lock_remove (resource_cleanup);
@ -608,17 +610,18 @@ static int lck_lib_exit_fn (struct conn_info *conn_info)
list_del (&resource_cleanup->list);
free (resource_cleanup);
list = conn_info->conn_info_partner->ais_ci.u.liblck_ci.resource_cleanup_list.next;
cleanup_list = lck_pd->resource_cleanup_list.next;
}
return (0);
}
static int lck_lib_init_fn (struct conn_info *conn_info)
static int lck_lib_init_fn (void *conn)
{
list_init (&conn_info->conn_info_partner->ais_ci.u.liblck_ci.resource_list);
list_init (&conn_info->conn_info_partner->ais_ci.u.liblck_ci.resource_cleanup_list);
struct lck_pd *lck_pd = (struct lck_pd *)openais_conn_private_data_get (conn);
list_init (&lck_pd->resource_list);
list_init (&lck_pd->resource_cleanup_list);
return (0);
}
@ -632,6 +635,7 @@ static void message_handler_req_exec_lck_resourceopen (
struct resource *resource;
struct resource_cleanup *resource_cleanup;
SaAisErrorT error = SA_AIS_OK;
struct lck_pd *lck_pd = (struct lck_pd *)openais_conn_private_data_get (req_exec_lck_resourceopen->source.conn);
log_printf (LOG_LEVEL_NOTICE, "EXEC request: saLckResourceOpen %s\n",
getSaNameT (&req_exec_lck_resourceopen->resource_name));
@ -684,10 +688,11 @@ static void message_handler_req_exec_lck_resourceopen (
list_init (&resource_cleanup->list);
list_init (&resource_cleanup->resource_lock_list_head);
resource_cleanup->resource = resource;
printf ("resource is %p\n", resource);
resource_cleanup->resource_handle = req_exec_lck_resourceopen->resource_handle;
list_add (
&resource_cleanup->list,
&req_exec_lck_resourceopen->source.conn_info->ais_ci.u.liblck_ci.resource_cleanup_list);
&lck_pd->resource_cleanup_list);
}
resource->refcount += 1;
}
@ -714,12 +719,12 @@ error_exit:
&req_exec_lck_resourceopen->source,
sizeof (struct message_source));
libais_send_response (
req_exec_lck_resourceopen->source.conn_info,
openais_conn_send_response (
req_exec_lck_resourceopen->source.conn,
&res_lib_lck_resourceopenasync,
sizeof (struct res_lib_lck_resourceopenasync));
libais_send_response (
req_exec_lck_resourceopen->source.conn_info->conn_info_partner,
openais_conn_send_response (
openais_conn_partner_get (req_exec_lck_resourceopen->source.conn),
&res_lib_lck_resourceopenasync,
sizeof (struct res_lib_lck_resourceopenasync));
} else {
@ -733,7 +738,8 @@ error_exit:
&req_exec_lck_resourceopen->source,
sizeof (struct message_source));
libais_send_response (req_exec_lck_resourceopen->source.conn_info, &res_lib_lck_resourceopen,
openais_conn_send_response (req_exec_lck_resourceopen->source.conn,
&res_lib_lck_resourceopen,
sizeof (struct res_lib_lck_resourceopen));
}
}
@ -762,13 +768,14 @@ static void message_handler_req_exec_lck_resourceclose (
error_exit:
if (message_source_is_local(&req_exec_lck_resourceclose->source)) {
lck_resource_cleanup_remove (
req_exec_lck_resourceclose->source.conn_info,
req_exec_lck_resourceclose->source.conn,
req_exec_lck_resourceclose->resource_handle);
res_lib_lck_resourceclose.header.size = sizeof (struct res_lib_lck_resourceclose);
res_lib_lck_resourceclose.header.id = MESSAGE_RES_LCK_RESOURCECLOSE;
res_lib_lck_resourceclose.header.error = error;
libais_send_response (req_exec_lck_resourceclose->source.conn_info,
openais_conn_send_response (
req_exec_lck_resourceclose->source.conn,
&res_lib_lck_resourceclose, sizeof (struct res_lib_lck_resourceclose));
}
}
@ -794,8 +801,8 @@ void waiter_notification_send (struct resource_lock *resource_lock)
res_lib_lck_lockwaitercallback.mode_held = SA_LCK_PR_LOCK_MODE;
}
libais_send_response (
resource_lock->callback_source.conn_info->conn_info_partner,
openais_conn_send_response (
openais_conn_partner_get (resource_lock->callback_source.conn),
&res_lib_lck_lockwaitercallback,
sizeof (struct res_lib_lck_lockwaitercallback));
}
@ -830,7 +837,8 @@ void resource_lock_async_deliver (
res_lib_lck_resourcelockasync.lockStatus = resource_lock->lock_status;
res_lib_lck_resourcelockasync.invocation = resource_lock->invocation;
res_lib_lck_resourcelockasync.lockId = resource_lock->lock_id;
libais_send_response (source->conn_info->conn_info_partner,
openais_conn_send_response (
openais_conn_partner_get (source->conn),
&res_lib_lck_resourcelockasync,
sizeof (struct res_lib_lck_resourcelockasync));
}
@ -853,7 +861,7 @@ void lock_response_deliver (
res_lib_lck_resourcelock.header.error = error;
res_lib_lck_resourcelock.resource_lock = (void *)resource_lock;
res_lib_lck_resourcelock.lockStatus = resource_lock->lock_status;
libais_send_response (source->conn_info,
openais_conn_send_response (source->conn,
&res_lib_lck_resourcelock,
sizeof (struct res_lib_lck_resourcelock));
}
@ -1095,7 +1103,7 @@ static void message_handler_req_exec_lck_resourcelock (
*/
if (message_source_is_local (&req_exec_lck_resourcelock->source)) {
resource_cleanup = lck_resource_cleanup_find (
resource_lock->callback_source.conn_info,
resource_lock->callback_source.conn,
req_exec_lck_resourcelock->resource_handle);
assert (resource_cleanup);
@ -1124,14 +1132,15 @@ static void message_handler_req_exec_lck_resourcelock (
/*
* Deliver async response to library
*/
req_exec_lck_resourcelock->source.conn_info =
req_exec_lck_resourcelock->source.conn_info->conn_info_partner;
req_exec_lck_resourcelock->source.conn =
openais_conn_partner_get (req_exec_lck_resourcelock->source.conn);
resource_lock_async_deliver (
&req_exec_lck_resourcelock->source,
resource_lock,
SA_AIS_OK);
req_exec_lck_resourcelock->source.conn_info =
req_exec_lck_resourcelock->source.conn_info->conn_info_partner;
// TODO why is this twice ?
req_exec_lck_resourcelock->source.conn =
openais_conn_partner_get (req_exec_lck_resourcelock->source.conn);
}
error_exit:
@ -1175,19 +1184,19 @@ error_exit:
res_lib_lck_resourceunlockasync.invocation =
req_exec_lck_resourceunlock->invocation;
libais_send_response (
req_exec_lck_resourceunlock->source.conn_info,
openais_conn_send_response (
req_exec_lck_resourceunlock->source.conn,
&res_lib_lck_resourceunlockasync,
sizeof (struct res_lib_lck_resourceunlockasync));
libais_send_response (
resource_lock->callback_source.conn_info,
openais_conn_send_response (
resource_lock->callback_source.conn,
&res_lib_lck_resourceunlockasync,
sizeof (struct res_lib_lck_resourceunlockasync));
} else {
res_lib_lck_resourceunlock.header.size = sizeof (struct res_lib_lck_resourceunlock);
res_lib_lck_resourceunlock.header.id = MESSAGE_RES_LCK_RESOURCEUNLOCK;
res_lib_lck_resourceunlock.header.error = error;
libais_send_response (req_exec_lck_resourceunlock->source.conn_info,
openais_conn_send_response (req_exec_lck_resourceunlock->source.conn,
&res_lib_lck_resourceunlock, sizeof (struct res_lib_lck_resourceunlock));
}
}
@ -1220,10 +1229,10 @@ static void message_handler_req_exec_lck_resourcelockorphan (
}
static void message_handler_req_exec_lck_lockpurge (
void *message,
void *msg,
struct totem_ip_address *source_addr)
{
struct req_exec_lck_lockpurge *req_exec_lck_lockpurge = (struct req_exec_lck_lockpurge *)message;
struct req_exec_lck_lockpurge *req_exec_lck_lockpurge = (struct req_exec_lck_lockpurge *)msg;
struct res_lib_lck_lockpurge res_lib_lck_lockpurge;
struct resource *resource = 0;
SaAisErrorT error = SA_AIS_OK;
@ -1238,20 +1247,22 @@ static void message_handler_req_exec_lck_lockpurge (
error_exit:
if (message_source_is_local(&req_exec_lck_lockpurge->source)) {
// lck_resource_cleanup_remove (req_exec_lck_lockpurge->source.conn_info,
// lck_resource_cleanup_remove (req_exec_lck_lockpurge->source.conn,
// resource);
res_lib_lck_lockpurge.header.size = sizeof (struct res_lib_lck_lockpurge);
res_lib_lck_lockpurge.header.id = MESSAGE_RES_LCK_LOCKPURGE;
res_lib_lck_lockpurge.header.error = error;
libais_send_response (req_exec_lck_lockpurge->source.conn_info,
openais_conn_send_response (req_exec_lck_lockpurge->source.conn,
&res_lib_lck_lockpurge, sizeof (struct res_lib_lck_lockpurge));
}
}
static void message_handler_req_lib_lck_resourceopen (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_lck_resourceopen (
void *conn,
void *msg)
{
struct req_lib_lck_resourceopen *req_lib_lck_resourceopen = (struct req_lib_lck_resourceopen *)message;
struct req_lib_lck_resourceopen *req_lib_lck_resourceopen = (struct req_lib_lck_resourceopen *)msg;
struct req_exec_lck_resourceopen req_exec_lck_resourceopen;
struct iovec iovec;
@ -1263,7 +1274,7 @@ static void message_handler_req_lib_lck_resourceopen (struct conn_info *conn_inf
req_exec_lck_resourceopen.header.id =
SERVICE_ID_MAKE (LCK_SERVICE, MESSAGE_REQ_EXEC_LCK_RESOURCEOPEN);
message_source_set (&req_exec_lck_resourceopen.source, conn_info);
message_source_set (&req_exec_lck_resourceopen.source, conn);
memcpy (&req_exec_lck_resourceopen.resource_name,
&req_lib_lck_resourceopen->lockResourceName,
@ -1281,9 +1292,11 @@ static void message_handler_req_lib_lck_resourceopen (struct conn_info *conn_inf
assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED) == 0);
}
static void message_handler_req_lib_lck_resourceopenasync (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_lck_resourceopenasync (
void *conn,
void *msg)
{
struct req_lib_lck_resourceopen *req_lib_lck_resourceopen = (struct req_lib_lck_resourceopen *)message;
struct req_lib_lck_resourceopen *req_lib_lck_resourceopen = (struct req_lib_lck_resourceopen *)msg;
struct req_exec_lck_resourceopen req_exec_lck_resourceopen;
struct iovec iovec;
@ -1295,7 +1308,7 @@ static void message_handler_req_lib_lck_resourceopenasync (struct conn_info *con
req_exec_lck_resourceopen.header.id =
SERVICE_ID_MAKE (LCK_SERVICE, MESSAGE_REQ_EXEC_LCK_RESOURCEOPEN);
message_source_set (&req_exec_lck_resourceopen.source, conn_info);
message_source_set (&req_exec_lck_resourceopen.source, conn);
memcpy (&req_exec_lck_resourceopen.resource_name,
&req_lib_lck_resourceopen->lockResourceName,
@ -1313,8 +1326,11 @@ static void message_handler_req_lib_lck_resourceopenasync (struct conn_info *con
assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED) == 0);
}
static void message_handler_req_lib_lck_resourceclose (struct conn_info *conn_info, void *message) {
struct req_lib_lck_resourceclose *req_lib_lck_resourceclose = (struct req_lib_lck_resourceclose *)message;
static void message_handler_req_lib_lck_resourceclose (
void *conn,
void *msg)
{
struct req_lib_lck_resourceclose *req_lib_lck_resourceclose = (struct req_lib_lck_resourceclose *)msg;
struct req_exec_lck_resourceclose req_exec_lck_resourceclose;
struct iovec iovecs[2];
struct resource *resource;
@ -1330,7 +1346,7 @@ static void message_handler_req_lib_lck_resourceclose (struct conn_info *conn_in
req_exec_lck_resourceclose.header.id =
SERVICE_ID_MAKE (LCK_SERVICE, MESSAGE_REQ_EXEC_LCK_RESOURCECLOSE);
message_source_set (&req_exec_lck_resourceclose.source, conn_info);
message_source_set (&req_exec_lck_resourceclose.source, conn);
memcpy (&req_exec_lck_resourceclose.lockResourceName,
&req_lib_lck_resourceclose->lockResourceName, sizeof (SaNameT));
@ -1350,15 +1366,17 @@ static void message_handler_req_lib_lck_resourceclose (struct conn_info *conn_in
res_lib_lck_resourceclose.header.id = MESSAGE_RES_LCK_RESOURCECLOSE;
res_lib_lck_resourceclose.header.error = SA_AIS_ERR_NOT_EXIST;
libais_send_response (conn_info,
openais_conn_send_response (conn,
&res_lib_lck_resourceclose,
sizeof (struct res_lib_lck_resourceclose));
}
}
static void message_handler_req_lib_lck_resourcelock (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_lck_resourcelock (
void *conn,
void *msg)
{
struct req_lib_lck_resourcelock *req_lib_lck_resourcelock = (struct req_lib_lck_resourcelock *)message;
struct req_lib_lck_resourcelock *req_lib_lck_resourcelock = (struct req_lib_lck_resourcelock *)msg;
struct req_exec_lck_resourcelock req_exec_lck_resourcelock;
struct iovec iovecs[2];
@ -1370,7 +1388,7 @@ static void message_handler_req_lib_lck_resourcelock (struct conn_info *conn_inf
req_exec_lck_resourcelock.header.id =
SERVICE_ID_MAKE (LCK_SERVICE, MESSAGE_REQ_EXEC_LCK_RESOURCELOCK);
message_source_set (&req_exec_lck_resourcelock.source, conn_info);
message_source_set (&req_exec_lck_resourcelock.source, conn);
memcpy (&req_exec_lck_resourcelock.req_lib_lck_resourcelock,
req_lib_lck_resourcelock,
@ -1387,9 +1405,11 @@ static void message_handler_req_lib_lck_resourcelock (struct conn_info *conn_inf
assert (totempg_groups_mcast_joined (openais_group_handle, iovecs, 1, TOTEMPG_AGREED) == 0);
}
static void message_handler_req_lib_lck_resourcelockasync (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_lck_resourcelockasync (
void *conn,
void *msg)
{
struct req_lib_lck_resourcelock *req_lib_lck_resourcelock = (struct req_lib_lck_resourcelock *)message;
struct req_lib_lck_resourcelock *req_lib_lck_resourcelock = (struct req_lib_lck_resourcelock *)msg;
struct req_exec_lck_resourcelock req_exec_lck_resourcelock;
struct iovec iovecs[2];
@ -1401,7 +1421,7 @@ static void message_handler_req_lib_lck_resourcelockasync (struct conn_info *con
req_exec_lck_resourcelock.header.id =
SERVICE_ID_MAKE (LCK_SERVICE, MESSAGE_REQ_EXEC_LCK_RESOURCELOCK);
message_source_set (&req_exec_lck_resourcelock.source, conn_info);
message_source_set (&req_exec_lck_resourcelock.source, conn);
memcpy (&req_exec_lck_resourcelock.req_lib_lck_resourcelock,
req_lib_lck_resourcelock,
@ -1417,9 +1437,11 @@ static void message_handler_req_lib_lck_resourcelockasync (struct conn_info *con
assert (totempg_groups_mcast_joined (openais_group_handle, iovecs, 1, TOTEMPG_AGREED) == 0);
}
static void message_handler_req_lib_lck_resourceunlock (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_lck_resourceunlock (
void *conn,
void *msg)
{
struct req_lib_lck_resourceunlock *req_lib_lck_resourceunlock = (struct req_lib_lck_resourceunlock *)message;
struct req_lib_lck_resourceunlock *req_lib_lck_resourceunlock = (struct req_lib_lck_resourceunlock *)msg;
struct req_exec_lck_resourceunlock req_exec_lck_resourceunlock;
struct iovec iovec;
@ -1431,7 +1453,7 @@ static void message_handler_req_lib_lck_resourceunlock (struct conn_info *conn_i
req_exec_lck_resourceunlock.header.id =
SERVICE_ID_MAKE (LCK_SERVICE, MESSAGE_REQ_EXEC_LCK_RESOURCEUNLOCK);
message_source_set (&req_exec_lck_resourceunlock.source, conn_info);
message_source_set (&req_exec_lck_resourceunlock.source, conn);
memcpy (&req_exec_lck_resourceunlock.resource_name,
&req_lib_lck_resourceunlock->lockResourceName,
@ -1447,9 +1469,11 @@ static void message_handler_req_lib_lck_resourceunlock (struct conn_info *conn_i
assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED) == 0);
}
static void message_handler_req_lib_lck_resourceunlockasync (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_lck_resourceunlockasync (
void *conn,
void *msg)
{
struct req_lib_lck_resourceunlock *req_lib_lck_resourceunlock = (struct req_lib_lck_resourceunlock *)message;
struct req_lib_lck_resourceunlock *req_lib_lck_resourceunlock = (struct req_lib_lck_resourceunlock *)msg;
struct req_exec_lck_resourceunlock req_exec_lck_resourceunlock;
struct iovec iovec;
@ -1461,7 +1485,7 @@ static void message_handler_req_lib_lck_resourceunlockasync (struct conn_info *c
req_exec_lck_resourceunlock.header.id =
SERVICE_ID_MAKE (LCK_SERVICE, MESSAGE_REQ_EXEC_LCK_RESOURCEUNLOCK);
message_source_set (&req_exec_lck_resourceunlock.source, conn_info);
message_source_set (&req_exec_lck_resourceunlock.source, conn);
memcpy (&req_exec_lck_resourceunlock.resource_name,
&req_lib_lck_resourceunlock->lockResourceName,
@ -1477,9 +1501,11 @@ static void message_handler_req_lib_lck_resourceunlockasync (struct conn_info *c
assert (totempg_groups_mcast_joined (openais_group_handle, &iovec, 1, TOTEMPG_AGREED) == 0);
}
static void message_handler_req_lib_lck_lockpurge (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_lck_lockpurge (
void *conn,
void *msg)
{
struct req_lib_lck_lockpurge *req_lib_lck_lockpurge = (struct req_lib_lck_lockpurge *)message;
struct req_lib_lck_lockpurge *req_lib_lck_lockpurge = (struct req_lib_lck_lockpurge *)msg;
struct req_exec_lck_lockpurge req_exec_lck_lockpurge;
struct iovec iovecs[2];
@ -1491,7 +1517,7 @@ static void message_handler_req_lib_lck_lockpurge (struct conn_info *conn_info,
req_exec_lck_lockpurge.header.id =
SERVICE_ID_MAKE (LCK_SERVICE, MESSAGE_REQ_EXEC_LCK_LOCKPURGE);
message_source_set (&req_exec_lck_lockpurge.source, conn_info);
message_source_set (&req_exec_lck_lockpurge.source, conn);
memcpy (&req_exec_lck_lockpurge.req_lib_lck_lockpurge,
req_lib_lck_lockpurge,

View File

@ -39,11 +39,6 @@
#ifndef LCK_H_DEFINED
#define LCK_H_DEFINED
struct liblck_ci {
struct list_head resource_list;
struct list_head resource_cleanup_list;
};
extern struct openais_service_handler lck_service_handler;
#endif /* CKPT_H_DEFINED */

View File

@ -160,6 +160,32 @@ static struct openais_service_handler *ais_service_handlers[32];
static unsigned int service_handlers_count = 32;
struct outq_item {
void *msg;
size_t mlen;
};
enum conn_state {
CONN_STATE_ACTIVE,
CONN_STATE_DISCONNECTING,
CONN_STATE_DISCONNECTING_DELAYED
};
struct conn_info {
int fd; /* File descriptor */
enum conn_state state; /* State of this connection */
char *inb; /* Input buffer for non-blocking reads */
int inb_nextheader; /* Next message header starts here */
int inb_start; /* Start location of input buffer */
int inb_inuse; /* Bytes currently stored in input buffer */
struct queue outq; /* Circular queue for outgoing requests */
int byte_start; /* Byte to start sending from in head of queue */
enum service_types service;/* Type of service so dispatch knows how to route message */
int authenticated; /* Is this connection authenticated? */
void *private_data; /* library connection private data */
struct conn_info *conn_info_partner; /* partner connection dispatch<->response */
int should_exit_fn; /* Should call the exit function when closing this ipc */
};
SaClmClusterNodeT *(*main_clm_get_by_nodeid) (unsigned int node_id);
/*
@ -280,11 +306,17 @@ static int libais_disconnect (struct conn_info *conn_info)
res = ais_service_handlers[conn_info->service]->lib_exit_fn (conn_info);
}
/*
* Call library exit handler and free private data
*/
if (conn_info->conn_info_partner &&
conn_info->conn_info_partner->should_exit_fn &&
ais_service_handlers[conn_info->conn_info_partner->service]->lib_exit_fn) {
res = ais_service_handlers[conn_info->conn_info_partner->service]->lib_exit_fn (conn_info->conn_info_partner);
if (conn_info->private_data) {
free (conn_info->private_data);
}
}
/*
@ -416,8 +448,10 @@ retry_sendmsg:
return (0);
}
extern int libais_send_response (struct conn_info *conn_info,
void *msg, int mlen)
extern int openais_conn_send_response (
void *conn,
void *msg,
int mlen)
{
struct queue *outq;
char *cmsg;
@ -428,6 +462,7 @@ extern int libais_send_response (struct conn_info *conn_info,
struct msghdr msg_send;
struct iovec iov_send;
char *msg_addr;
struct conn_info *conn_info = (struct conn_info *)conn;
if (!libais_connection_active (conn_info)) {
return (-1);
@ -581,9 +616,6 @@ retry_accept:
poll_dispatch_add (aisexec_poll_handle, new_fd, POLLIN|POLLNVAL, conn_info,
poll_handler_libais_deliver, 0);
// TODO is this needed, or shouldn't it be in conn_info_create ?
memcpy (&conn_info->ais_ci.un_addr, &un_addr, sizeof (struct sockaddr_un));
return (0);
}
@ -602,24 +634,60 @@ static int dispatch_init_send_response (struct conn_info *conn_info, void *messa
msg_conn_info = (struct conn_info *)req_lib_dispatch_init->conn_info;
msg_conn_info->conn_info_partner = conn_info;
}
if (error == SA_AIS_OK) {
int private_data_size;
private_data_size = ais_service_handlers[req_lib_dispatch_init->resdis_header.service]->private_data_size;
if (private_data_size) {
conn_info->private_data = malloc (private_data_size);
conn_info->conn_info_partner->private_data = conn_info->private_data;
if (conn_info->private_data == NULL) {
error = SA_AIS_ERR_NO_MEMORY;
} else {
memset (conn_info->private_data, 0, private_data_size);
}
} else {
conn_info->private_data = NULL;
conn_info->conn_info_partner->private_data = NULL;
}
}
res_lib_dispatch_init.header.size = sizeof (struct res_lib_dispatch_init);
res_lib_dispatch_init.header.id = MESSAGE_RES_INIT;
res_lib_dispatch_init.header.error = error;
libais_send_response (conn_info, &res_lib_dispatch_init,
openais_conn_send_response (
conn_info,
&res_lib_dispatch_init,
sizeof (res_lib_dispatch_init));
if (error == SA_AIS_ERR_ACCESS) {
if (error != SA_AIS_OK) {
return (-1);
}
}
conn_info->should_exit_fn = 1;
ais_service_handlers[req_lib_dispatch_init->resdis_header.service]->lib_init_fn (conn_info);
return (0);
}
void *openais_conn_partner_get (void *conn)
{
struct conn_info *conn_info = (struct conn_info *)conn;
return ((void *)conn_info->conn_info_partner);
}
void *openais_conn_private_data_get (void *conn)
{
struct conn_info *conn_info = (struct conn_info *)conn;
return ((void *)conn_info->private_data);
}
static int response_init_send_response (struct conn_info *conn_info, void *message)
{
SaAisErrorT error = SA_AIS_ERR_ACCESS;
@ -635,7 +703,9 @@ static int response_init_send_response (struct conn_info *conn_info, void *messa
res_lib_response_init.header.error = error;
res_lib_response_init.conn_info = (unsigned long)conn_info;
libais_send_response (conn_info, &res_lib_response_init,
openais_conn_send_response (
conn_info,
&res_lib_response_init,
sizeof (res_lib_response_init));
if (error == SA_AIS_ERR_ACCESS) {
@ -804,7 +874,9 @@ retry_recv:
res_overlay.header.id =
ais_service_handlers[service]->lib_handlers[header->id].response_id;
res_overlay.header.error = SA_AIS_ERR_TRY_AGAIN;
libais_send_response (conn_info, &res_overlay,
openais_conn_send_response (
conn_info,
&res_overlay,
res_overlay.header.size);
}
}
@ -1089,10 +1161,12 @@ int message_source_is_local(struct message_source *source)
return ret;
}
void message_source_set (struct message_source *source, struct conn_info *conn_info)
void message_source_set (
struct message_source *source,
void *conn)
{
totemip_copy(&source->addr, this_ip);
source->conn_info = conn_info;
source->conn = conn;
}

View File

@ -59,64 +59,8 @@
#define SOCKET_SERVICE_INIT 254
struct aisexec_ci {
struct sockaddr_in in_addr; /* address of AF_INET socket, MUST BE FIRST IN STRUCTURE */
SaClmClusterNodeT clusterNode;
SaClmClusterChangesT lastChange;
unsigned char authentication_key[16];
int authenticated;
};
/*
* Connection information for AIS connections
*/
// TODO must make this dynamic
struct ais_ci {
struct sockaddr_un un_addr; /* address of AF_UNIX socket, MUST BE FIRST IN STRUCTURE */
union {
struct aisexec_ci aisexec_ci;
struct libevs_ci libevs_ci;
struct libclm_ci libclm_ci;
struct libamf_ci libamf_ci;
struct libckpt_ci libckpt_ci;
struct libevt_ci libevt_ci;
struct liblck_ci liblck_ci;
struct libmsg_ci libmsg_ci;
} u;
};
struct outq_item {
void *msg;
size_t mlen;
};
#define SIZEINB MESSAGE_SIZE_MAX
enum conn_state {
CONN_STATE_ACTIVE,
CONN_STATE_DISCONNECTING,
CONN_STATE_DISCONNECTING_DELAYED
};
struct conn_info {
int fd; /* File descriptor */
enum conn_state state; /* State of this connection */
char *inb; /* Input buffer for non-blocking reads */
int inb_nextheader; /* Next message header starts here */
int inb_start; /* Start location of input buffer */
int inb_inuse; /* Bytes currently stored in input buffer */
struct queue outq; /* Circular queue for outgoing requests */
int byte_start; /* Byte to start sending from in head of queue */
enum service_types service;/* Type of service so dispatch knows how to route message */
// struct saAmfComponent *component; /* Component for which this connection relates to TODO shouldn't this be in the ci structure */
int authenticated; /* Is this connection authenticated? */
struct list_head conn_list;
struct ais_ci ais_ci; /* libais connection information */
struct conn_info *conn_info_partner; /* partner connection dispatch<->response */
int should_exit_fn; /* Should call the exit function when closing this ipc */
};
extern struct totem_ip_address *this_ip;
extern struct totempg_group openais_group;
@ -125,12 +69,16 @@ extern totempg_groups_handle openais_group_handle;
poll_handle aisexec_poll_handle;
extern int libais_send_response (struct conn_info *conn_info, void *msg, int mlen);
extern int message_source_is_local(struct message_source *source);
extern void message_source_set(struct message_source *source, struct conn_info *conn_info);
extern void message_source_set(struct message_source *source, void *conn);
extern SaClmClusterNodeT *(*main_clm_get_by_nodeid) (unsigned int node_id);
extern void *openais_conn_partner_get (void *conn);
extern void *openais_conn_private_data_get (void *conn);
extern int openais_conn_send_response (void *conn, void *msg, int mlen);
#endif /* AIS_EXEC_H_DEFINED */

View File

@ -110,9 +110,9 @@ DECLARE_LIST_INIT(queue_group_list_head);
static int msg_exec_init_fn (struct openais_config *);
static int msg_lib_exit_fn (struct conn_info *conn_info);
static int msg_lib_exit_fn (void *conn);
static int msg_lib_init_fn (struct conn_info *conn_info);
static int msg_lib_init_fn (void *conn);
static void message_handler_req_exec_msg_queueopen (
void *message,
@ -175,76 +175,76 @@ static void message_handler_req_exec_msg_messagereply (
struct totem_ip_address *source_addr);
static void message_handler_req_lib_msg_queueopen (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_queueopenasync (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_queueclose (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_queuestatusget (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_queueunlink (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_queuegroupcreate (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_queuegroupinsert (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_queuegroupremove (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_queuegroupdelete (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_queuegrouptrack (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_queuegrouptrackstop (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_messagesend (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_messagesendasync (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_messageget (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_messagecancel (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_messagesendreceive (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_messagereply (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
static void message_handler_req_lib_msg_messagereplyasync (
struct conn_info *conn_info,
void *message);
void *conn,
void *msg);
#ifdef TODO
static void msg_sync_init (void);
@ -262,6 +262,12 @@ static void msg_confchg_fn (
struct totem_ip_address *joined_list, int joined_list_entries,
struct memb_ring_id *ring_id);
struct msg_pd {
struct list_head queue_list;
struct list_head queue_cleanup_list;
};
/*
* Executive Handler Definition
*/
@ -429,6 +435,7 @@ static struct openais_exec_handler msg_exec_handlers[] = {
struct openais_service_handler msg_service_handler = {
.name = (unsigned char *)"openais message service B.01.01",
.id = MSG_SERVICE,
.private_data_size = sizeof (struct msg_pd),
.lib_init_fn = msg_lib_init_fn,
.lib_exit_fn = msg_lib_exit_fn,
.lib_handlers = msg_lib_handlers,
@ -673,18 +680,16 @@ static int msg_exec_init_fn (struct openais_config *openais_config)
return (0);
}
static int msg_lib_exit_fn (struct conn_info *conn_info)
static int msg_lib_exit_fn (void *conn)
{
// struct msg_pd *msg_pd = (struct msg_pd *)openais_conn_private_data_get (conn);
#ifdef COMPILE_OUT
struct queue_cleanup *queue_cleanup;
struct list_head *list;
printf ("exit_fn\n");
if (conn_info->conn_info_partner->service != MSG_SERVICE) {
return 0;
}
log_printf(LOG_LEVEL_NOTICE, "msg_exit_fn conn_info = %#x, with fd = %d\n", conn_info, conn_info->fd);
log_printf(LOG_LEVEL_NOTICE, "msg_exit_fn conn_info = %p\n", conn);
/*
* close all queues opened on this fd
@ -711,11 +716,12 @@ printf ("queue cleanup %x\n", queue_cleanup);
return (0);
}
static int msg_lib_init_fn (struct conn_info *conn_info)
static int msg_lib_init_fn (void *conn)
{
list_init (&conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_list);
list_init (&conn_info->conn_info_partner->ais_ci.u.libmsg_ci.queue_cleanup_list);
struct msg_pd *msg_pd = (struct msg_pd *)openais_conn_private_data_get (conn);
list_init (&msg_pd->queue_list);
list_init (&msg_pd->queue_cleanup_list);
return (0);
}
@ -803,12 +809,12 @@ error_exit:
&req_exec_msg_queueopen->source,
sizeof (struct message_source));
libais_send_response (
req_exec_msg_queueopen->source.conn_info,
openais_conn_send_response (
req_exec_msg_queueopen->source.conn,
&res_lib_msg_queueopenasync,
sizeof (struct res_lib_msg_queueopenasync));
libais_send_response (
req_exec_msg_queueopen->source.conn_info->conn_info_partner,
openais_conn_send_response (
openais_conn_partner_get (req_exec_msg_queueopen->source.conn),
&res_lib_msg_queueopenasync,
sizeof (struct res_lib_msg_queueopenasync));
} else {
@ -822,7 +828,9 @@ error_exit:
&req_exec_msg_queueopen->source,
sizeof (struct message_source));
libais_send_response (req_exec_msg_queueopen->source.conn_info, &res_lib_msg_queueopen,
openais_conn_send_response (
req_exec_msg_queueopen->source.conn,
&res_lib_msg_queueopen,
sizeof (struct res_lib_msg_queueopen));
}
}
@ -859,7 +867,7 @@ error_exit:
res_lib_msg_queueclose.header.size = sizeof (struct res_lib_msg_queueclose);
res_lib_msg_queueclose.header.id = MESSAGE_RES_MSG_QUEUECLOSE;
res_lib_msg_queueclose.header.error = error;
libais_send_response (req_exec_msg_queueclose->source.conn_info,
openais_conn_send_response (req_exec_msg_queueclose->source.conn,
&res_lib_msg_queueclose, sizeof (struct res_lib_msg_queueclose));
}
}
@ -917,8 +925,8 @@ error_exit:
res_lib_msg_queuegroupcreate.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
res_lib_msg_queuegroupcreate.header.error = error;
libais_send_response (
req_exec_msg_queuegroupcreate->source.conn_info,
openais_conn_send_response (
req_exec_msg_queuegroupcreate->source.conn,
&res_lib_msg_queuegroupcreate,
sizeof (struct res_lib_msg_queuegroupcreate));
}
@ -964,8 +972,8 @@ error_exit:
res_lib_msg_queuegroupinsert.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
res_lib_msg_queuegroupinsert.header.error = error;
libais_send_response (
req_exec_msg_queuegroupinsert->source.conn_info,
openais_conn_send_response (
req_exec_msg_queuegroupinsert->source.conn,
&res_lib_msg_queuegroupinsert,
sizeof (struct res_lib_msg_queuegroupinsert));
}
@ -1008,8 +1016,8 @@ error_exit:
res_lib_msg_queuegroupremove.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
res_lib_msg_queuegroupremove.header.error = error;
libais_send_response (
req_exec_msg_queuegroupremove->source.conn_info,
openais_conn_send_response (
req_exec_msg_queuegroupremove->source.conn,
&res_lib_msg_queuegroupremove,
sizeof (struct res_lib_msg_queuegroupremove));
}
@ -1039,8 +1047,8 @@ static void message_handler_req_exec_msg_queuegroupdelete (
res_lib_msg_queuegroupdelete.header.id = MESSAGE_RES_MSG_QUEUEGROUPCREATE;
res_lib_msg_queuegroupdelete.header.error = error;
libais_send_response (
req_exec_msg_queuegroupdelete->source.conn_info,
openais_conn_send_response (
req_exec_msg_queuegroupdelete->source.conn,
&res_lib_msg_queuegroupdelete,
sizeof (struct res_lib_msg_queuegroupdelete));
}
@ -1110,9 +1118,11 @@ static void message_handler_req_exec_msg_messagereply (
}
static void message_handler_req_lib_msg_queueopen (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_msg_queueopen (
void *conn,
void *msg)
{
struct req_lib_msg_queueopen *req_lib_msg_queueopen = (struct req_lib_msg_queueopen *)message;
struct req_lib_msg_queueopen *req_lib_msg_queueopen = (struct req_lib_msg_queueopen *)msg;
struct req_exec_msg_queueopen req_exec_msg_queueopen;
struct iovec iovec;
@ -1124,7 +1134,7 @@ static void message_handler_req_lib_msg_queueopen (struct conn_info *conn_info,
req_exec_msg_queueopen.header.id =
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEOPEN);
message_source_set (&req_exec_msg_queueopen.source, conn_info);
message_source_set (&req_exec_msg_queueopen.source, conn);
memcpy (&req_exec_msg_queueopen.queue_name,
&req_lib_msg_queueopen->queueName, sizeof (SaNameT));
@ -1145,9 +1155,11 @@ static void message_handler_req_lib_msg_queueopen (struct conn_info *conn_info,
TOTEMPG_AGREED) == 0);
}
static void message_handler_req_lib_msg_queueopenasync (struct conn_info *conn_info, void *message)
static void message_handler_req_lib_msg_queueopenasync (
void *conn,
void *msg)
{
struct req_lib_msg_queueopen *req_lib_msg_queueopen = (struct req_lib_msg_queueopen *)message;
struct req_lib_msg_queueopen *req_lib_msg_queueopen = (struct req_lib_msg_queueopen *)msg;
struct req_exec_msg_queueopen req_exec_msg_queueopen;
struct iovec iovec;
@ -1159,7 +1171,7 @@ static void message_handler_req_lib_msg_queueopenasync (struct conn_info *conn_i
req_exec_msg_queueopen.header.id =
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEOPEN);
message_source_set (&req_exec_msg_queueopen.source, conn_info);
message_source_set (&req_exec_msg_queueopen.source, conn);
memcpy (&req_exec_msg_queueopen.queue_name,
&req_lib_msg_queueopen->queueName, sizeof (SaNameT));
@ -1181,8 +1193,11 @@ static void message_handler_req_lib_msg_queueopenasync (struct conn_info *conn_i
TOTEMPG_AGREED) == 0);
}
static void message_handler_req_lib_msg_queueclose (struct conn_info *conn_info, void *message) {
struct req_lib_msg_queueclose *req_lib_msg_queueclose = (struct req_lib_msg_queueclose *)message;
static void message_handler_req_lib_msg_queueclose (
void *conn,
void *msg)
{
struct req_lib_msg_queueclose *req_lib_msg_queueclose = (struct req_lib_msg_queueclose *)msg;
struct req_exec_msg_queueclose req_exec_msg_queueclose;
struct iovec iovec;
@ -1194,7 +1209,7 @@ static void message_handler_req_lib_msg_queueclose (struct conn_info *conn_info,
req_exec_msg_queueclose.header.id =
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUECLOSE);
message_source_set (&req_exec_msg_queueclose.source, conn_info);
message_source_set (&req_exec_msg_queueclose.source, conn);
memcpy (&req_exec_msg_queueclose.queue_name,
&req_lib_msg_queueclose->queueName, sizeof (SaNameT));
@ -1207,11 +1222,11 @@ static void message_handler_req_lib_msg_queueclose (struct conn_info *conn_info,
}
static void message_handler_req_lib_msg_queuestatusget (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_queuestatusget *req_lib_msg_queuestatusget =
(struct req_lib_msg_queuestatusget *)message;
(struct req_lib_msg_queuestatusget *)msg;
struct req_exec_msg_queuestatusget req_exec_msg_queuestatusget;
struct iovec iovec;
@ -1223,7 +1238,7 @@ static void message_handler_req_lib_msg_queuestatusget (
req_exec_msg_queuestatusget.header.id =
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUESTATUSGET);
message_source_set (&req_exec_msg_queuestatusget.source, conn_info);
message_source_set (&req_exec_msg_queuestatusget.source, conn);
memcpy (&req_exec_msg_queuestatusget.queue_name,
&req_lib_msg_queuestatusget->queueName, sizeof (SaNameT));
@ -1236,11 +1251,11 @@ static void message_handler_req_lib_msg_queuestatusget (
}
static void message_handler_req_lib_msg_queueunlink (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_queueunlink *req_lib_msg_queueunlink =
(struct req_lib_msg_queueunlink *)message;
(struct req_lib_msg_queueunlink *)msg;
struct req_exec_msg_queueunlink req_exec_msg_queueunlink;
struct iovec iovec;
@ -1252,7 +1267,7 @@ static void message_handler_req_lib_msg_queueunlink (
req_exec_msg_queueunlink.header.id =
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEUNLINK);
message_source_set (&req_exec_msg_queueunlink.source, conn_info);
message_source_set (&req_exec_msg_queueunlink.source, conn);
memcpy (&req_exec_msg_queueunlink.queue_name,
&req_lib_msg_queueunlink->queueName, sizeof (SaNameT));
@ -1265,11 +1280,11 @@ static void message_handler_req_lib_msg_queueunlink (
}
static void message_handler_req_lib_msg_queuegroupcreate (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_queuegroupcreate *req_lib_msg_queuegroupcreate =
(struct req_lib_msg_queuegroupcreate *)message;
(struct req_lib_msg_queuegroupcreate *)msg;
struct req_exec_msg_queuegroupcreate req_exec_msg_queuegroupcreate;
struct iovec iovec;
@ -1281,7 +1296,7 @@ static void message_handler_req_lib_msg_queuegroupcreate (
req_exec_msg_queuegroupcreate.header.id =
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPCREATE);
message_source_set (&req_exec_msg_queuegroupcreate.source, conn_info);
message_source_set (&req_exec_msg_queuegroupcreate.source, conn);
memcpy (&req_exec_msg_queuegroupcreate.queue_group_name,
&req_lib_msg_queuegroupcreate->queueGroupName, sizeof (SaNameT));
@ -1294,11 +1309,11 @@ static void message_handler_req_lib_msg_queuegroupcreate (
}
static void message_handler_req_lib_msg_queuegroupinsert (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_queuegroupinsert *req_lib_msg_queuegroupinsert =
(struct req_lib_msg_queuegroupinsert *)message;
(struct req_lib_msg_queuegroupinsert *)msg;
struct req_exec_msg_queuegroupinsert req_exec_msg_queuegroupinsert;
struct iovec iovec;
@ -1310,7 +1325,7 @@ static void message_handler_req_lib_msg_queuegroupinsert (
req_exec_msg_queuegroupinsert.header.id =
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_QUEUEGROUPINSERT);
message_source_set (&req_exec_msg_queuegroupinsert.source, conn_info);
message_source_set (&req_exec_msg_queuegroupinsert.source, conn);
memcpy (&req_exec_msg_queuegroupinsert.queue_name,
&req_lib_msg_queuegroupinsert->queueName, sizeof (SaNameT));
@ -1325,11 +1340,11 @@ static void message_handler_req_lib_msg_queuegroupinsert (
}
static void message_handler_req_lib_msg_queuegroupremove (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_queuegroupremove *req_lib_msg_queuegroupremove =
(struct req_lib_msg_queuegroupremove *)message;
(struct req_lib_msg_queuegroupremove *)msg;
struct req_exec_msg_queuegroupremove req_exec_msg_queuegroupremove;
struct iovec iovec;
@ -1341,7 +1356,7 @@ static void message_handler_req_lib_msg_queuegroupremove (
log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupRemove %s\n",
getSaNameT (&req_lib_msg_queuegroupremove->queueGroupName));
message_source_set (&req_exec_msg_queuegroupremove.source, conn_info);
message_source_set (&req_exec_msg_queuegroupremove.source, conn);
memcpy (&req_exec_msg_queuegroupremove.queue_name,
&req_lib_msg_queuegroupremove->queueName, sizeof (SaNameT));
@ -1356,11 +1371,11 @@ static void message_handler_req_lib_msg_queuegroupremove (
}
static void message_handler_req_lib_msg_queuegroupdelete (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_queuegroupdelete *req_lib_msg_queuegroupdelete =
(struct req_lib_msg_queuegroupdelete *)message;
(struct req_lib_msg_queuegroupdelete *)msg;
struct req_exec_msg_queuegroupdelete req_exec_msg_queuegroupdelete;
struct iovec iovec;
@ -1372,7 +1387,7 @@ static void message_handler_req_lib_msg_queuegroupdelete (
log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupDelete %s\n",
getSaNameT (&req_lib_msg_queuegroupdelete->queueGroupName));
message_source_set (&req_exec_msg_queuegroupdelete.source, conn_info);
message_source_set (&req_exec_msg_queuegroupdelete.source, conn);
memcpy (&req_exec_msg_queuegroupdelete.queue_group_name,
&req_lib_msg_queuegroupdelete->queueGroupName, sizeof (SaNameT));
@ -1385,11 +1400,11 @@ static void message_handler_req_lib_msg_queuegroupdelete (
}
static void message_handler_req_lib_msg_queuegrouptrack (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_queuegrouptrack *req_lib_msg_queuegrouptrack =
(struct req_lib_msg_queuegrouptrack *)message;
(struct req_lib_msg_queuegrouptrack *)msg;
struct req_exec_msg_queuegrouptrack req_exec_msg_queuegrouptrack;
struct iovec iovec;
@ -1401,7 +1416,7 @@ static void message_handler_req_lib_msg_queuegrouptrack (
log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupTrack %s\n",
getSaNameT (&req_lib_msg_queuegrouptrack->queueGroupName));
message_source_set (&req_exec_msg_queuegrouptrack.source, conn_info);
message_source_set (&req_exec_msg_queuegrouptrack.source, conn);
memcpy (&req_exec_msg_queuegrouptrack.queue_group_name,
&req_lib_msg_queuegrouptrack->queueGroupName, sizeof (SaNameT));
@ -1414,11 +1429,11 @@ static void message_handler_req_lib_msg_queuegrouptrack (
}
static void message_handler_req_lib_msg_queuegrouptrackstop (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_queuegrouptrackstop *req_lib_msg_queuegrouptrackstop =
(struct req_lib_msg_queuegrouptrackstop *)message;
(struct req_lib_msg_queuegrouptrackstop *)msg;
struct req_exec_msg_queuegrouptrackstop req_exec_msg_queuegrouptrackstop;
struct iovec iovec;
@ -1430,7 +1445,7 @@ static void message_handler_req_lib_msg_queuegrouptrackstop (
log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgQueueGroupTrackStop %s\n",
getSaNameT (&req_lib_msg_queuegrouptrackstop->queueGroupName));
message_source_set (&req_exec_msg_queuegrouptrackstop.source, conn_info);
message_source_set (&req_exec_msg_queuegrouptrackstop.source, conn);
memcpy (&req_exec_msg_queuegrouptrackstop.queue_group_name,
&req_lib_msg_queuegrouptrackstop->queueGroupName, sizeof (SaNameT));
@ -1443,11 +1458,11 @@ static void message_handler_req_lib_msg_queuegrouptrackstop (
}
static void message_handler_req_lib_msg_messagesend (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_messagesend *req_lib_msg_messagesend =
(struct req_lib_msg_messagesend *)message;
(struct req_lib_msg_messagesend *)msg;
struct req_exec_msg_messagesend req_exec_msg_messagesend;
struct iovec iovec;
@ -1460,7 +1475,7 @@ static void message_handler_req_lib_msg_messagesend (
log_printf (LOG_LEVEL_NOTICE, "LIB request: saMsgMessageSend %s\n",
getSaNameT (&req_lib_msg_messagesend->destination));
message_source_set (&req_exec_msg_messagesend.source, conn_info);
message_source_set (&req_exec_msg_messagesend.source, conn);
memcpy (&req_exec_msg_messagesend.destination,
&req_lib_msg_messagesend->destination, sizeof (SaNameT));
@ -1473,11 +1488,11 @@ static void message_handler_req_lib_msg_messagesend (
}
static void message_handler_req_lib_msg_messagesendasync (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_messagesend *req_lib_msg_messagesend =
(struct req_lib_msg_messagesend *)message;
(struct req_lib_msg_messagesend *)msg;
struct req_exec_msg_messagesend req_exec_msg_messagesend;
struct iovec iovec;
@ -1490,7 +1505,7 @@ static void message_handler_req_lib_msg_messagesendasync (
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGESEND);
req_exec_msg_messagesend.async_call = 1;
message_source_set (&req_exec_msg_messagesend.source, conn_info);
message_source_set (&req_exec_msg_messagesend.source, conn);
memcpy (&req_exec_msg_messagesend.destination,
&req_lib_msg_messagesend->destination, sizeof (SaNameT));
@ -1503,11 +1518,11 @@ static void message_handler_req_lib_msg_messagesendasync (
}
static void message_handler_req_lib_msg_messageget (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_messageget *req_lib_msg_messageget =
(struct req_lib_msg_messageget *)message;
(struct req_lib_msg_messageget *)msg;
struct req_exec_msg_messageget req_exec_msg_messageget;
struct iovec iovec;
@ -1519,7 +1534,7 @@ static void message_handler_req_lib_msg_messageget (
req_exec_msg_messageget.header.id =
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGEGET);
message_source_set (&req_exec_msg_messageget.source, conn_info);
message_source_set (&req_exec_msg_messageget.source, conn);
memcpy (&req_exec_msg_messageget.queue_name,
&req_lib_msg_messageget->queueName, sizeof (SaNameT));
@ -1532,11 +1547,11 @@ static void message_handler_req_lib_msg_messageget (
}
static void message_handler_req_lib_msg_messagecancel (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_messagecancel *req_lib_msg_messagecancel =
(struct req_lib_msg_messagecancel *)message;
(struct req_lib_msg_messagecancel *)msg;
struct req_exec_msg_messagecancel req_exec_msg_messagecancel;
struct iovec iovec;
@ -1548,7 +1563,7 @@ static void message_handler_req_lib_msg_messagecancel (
req_exec_msg_messagecancel.header.id =
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGECANCEL);
message_source_set (&req_exec_msg_messagecancel.source, conn_info);
message_source_set (&req_exec_msg_messagecancel.source, conn);
memcpy (&req_exec_msg_messagecancel.queue_name,
&req_lib_msg_messagecancel->queueName, sizeof (SaNameT));
@ -1561,11 +1576,11 @@ static void message_handler_req_lib_msg_messagecancel (
}
static void message_handler_req_lib_msg_messagesendreceive (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_messagesendreceive *req_lib_msg_messagesendreceive =
(struct req_lib_msg_messagesendreceive *)message;
(struct req_lib_msg_messagesendreceive *)msg;
struct req_exec_msg_messagesendreceive req_exec_msg_messagesendreceive;
struct iovec iovec;
@ -1577,7 +1592,7 @@ static void message_handler_req_lib_msg_messagesendreceive (
req_exec_msg_messagesendreceive.header.id =
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGESENDRECEIVE);
message_source_set (&req_exec_msg_messagesendreceive.source, conn_info);
message_source_set (&req_exec_msg_messagesendreceive.source, conn);
memcpy (&req_exec_msg_messagesendreceive.queue_name,
&req_lib_msg_messagesendreceive->queueName, sizeof (SaNameT));
@ -1590,11 +1605,11 @@ static void message_handler_req_lib_msg_messagesendreceive (
}
static void message_handler_req_lib_msg_messagereply (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_messagereply *req_lib_msg_messagereply =
(struct req_lib_msg_messagereply *)message;
(struct req_lib_msg_messagereply *)msg;
struct req_exec_msg_messagereply req_exec_msg_messagereply;
struct iovec iovec;
@ -1607,7 +1622,7 @@ static void message_handler_req_lib_msg_messagereply (
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGEREPLY);
req_exec_msg_messagereply.async_call = 0;
message_source_set (&req_exec_msg_messagereply.source, conn_info);
message_source_set (&req_exec_msg_messagereply.source, conn);
memcpy (&req_exec_msg_messagereply.queue_name,
&req_lib_msg_messagereply->queueName, sizeof (SaNameT));
@ -1620,11 +1635,11 @@ static void message_handler_req_lib_msg_messagereply (
}
static void message_handler_req_lib_msg_messagereplyasync (
struct conn_info *conn_info,
void *message)
void *conn,
void *msg)
{
struct req_lib_msg_messagereply *req_lib_msg_messagereply =
(struct req_lib_msg_messagereply *)message;
(struct req_lib_msg_messagereply *)msg;
struct req_exec_msg_messagereply req_exec_msg_messagereply;
struct iovec iovec;
@ -1637,7 +1652,7 @@ static void message_handler_req_lib_msg_messagereplyasync (
SERVICE_ID_MAKE (MSG_SERVICE, MESSAGE_REQ_EXEC_MSG_MESSAGEREPLY);
req_exec_msg_messagereply.async_call = 1;
message_source_set (&req_exec_msg_messagereply.source, conn_info);
message_source_set (&req_exec_msg_messagereply.source, conn);
memcpy (&req_exec_msg_messagereply.queue_name,
&req_lib_msg_messagereply->queueName, sizeof (SaNameT));

View File

@ -39,11 +39,6 @@
#ifndef MSG_H_DEFINED
#define MSG_H_DEFINED
struct libmsg_ci {
struct list_head queue_list;
struct list_head queue_cleanup_list;
};
extern struct openais_service_handler msg_service_handler;
#endif /* MSG_H_DEFINED */

View File

@ -203,7 +203,7 @@ char *getSaNameT (SaNameT *name)
return (ret_name);
}
#ifdef DEBUG
#ifdef DEBUGA
extern char *getSaClmNodeAddressT (SaClmNodeAddressT *nodeAddress) {
int i;
static char node_address[300];

View File

@ -113,8 +113,8 @@ struct res_lib_dispatch_init {
struct res_header header;
};
struct message_source {
struct conn_info *conn_info;
struct totem_ip_address addr;
void *conn;
} __attribute__((packed));
#endif /* IPC_GEN_H_DEFINED */

View File

@ -26,7 +26,7 @@
#LDFLAGS =
# Debug mode flags
CFLAGS = -g -DDEBUG -Wall
CFLAGS = -g -Wall
LDFLAGS = -g -L./
# Profile mode flags
@ -37,8 +37,7 @@ LDFLAGS = -g -L./
#CFLAGS = -ftest-coverage -fprofile-arcs
#LDFLAGS = -g
CFLAGS += -fPIC
LDFLAGS += -ldl
all:liblcr.a test uic libtest_a.lcrso libtest_b.lcrso
@ -46,10 +45,10 @@ liblcr.a: lcr_ifact.o
$(AR) -rc liblcr.a lcr_ifact.o
libtest_a.lcrso: libtest_a.o
$(CC) -shared -Wl,-soname,libtest_b.lcrso libtest_a.o -o $@
$(CC) $(CFLAGS) -shared -Wl,-soname,libtest_b.lcrso libtest_a.o -o $@
libtest_b.lcrso: libtest_b.o
$(CC) -shared -Wl,-soname,libtest_b.lcrso libtest_b.o -o $@
$(CC) $(CFLAGS) -shared -Wl,-soname,libtest_b.lcrso libtest_b.o -o $@
test: test.o uis.o lcr_ifact.o
$(CC) $(LDFLAGS) test.o lcr_ifact.o uis.o -lpthread -ldl -o test
@ -57,5 +56,11 @@ test: test.o uis.o lcr_ifact.o
uic: uic.o
$(CC) $(LDFLAGS) uic.o -o uic
libtest_a.o: libtest_a.c
$(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
libtest_b.o: libtest_b.c
$(CC) $(CFLAGS) -fPIC -c -o $@ $(*F).c
clean:
rm -f test libtest.so* *.o uic liblcr.so* liblcr.a *.lcrso *.da *.ba *.bb *.bbg