From 9c9a91be3d94e8be20c5e47881b3d6b9e13285f3 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Thu, 24 Jul 2008 09:12:07 +0000 Subject: [PATCH] Make external service engines (openais) work properly. Also fix up make install. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1606 fd59a12c-fef9-0310-b244-a6a79926bd2f --- corosync/Makefile | 4 ++-- corosync/exec/apidef.c | 1 + corosync/exec/ipc.c | 4 ++-- corosync/exec/service.c | 2 +- corosync/exec/totemip.c | 4 ++-- corosync/exec/totemip.h | 2 +- corosync/include/ais_util.h | 4 ++++ corosync/include/coroapi.h | 4 +++- corosync/include/ipc_gen.h | 6 +++++- corosync/include/mar_gen.h | 20 +++++++++++++++++++- corosync/lib/util.c | 4 ++-- 11 files changed, 42 insertions(+), 13 deletions(-) diff --git a/corosync/Makefile b/corosync/Makefile index 8e212b32..c9922f93 100644 --- a/corosync/Makefile +++ b/corosync/Makefile @@ -1,5 +1,5 @@ # Copyright (c) 2002-2006 MontaVista Software, Inc. -# Copyright (c) 2006 Red Hat, Inc. +# Copyright (c) 2006-2008 Red Hat, Inc. # # All rights reserved. # @@ -43,7 +43,7 @@ SBINDIR=$(PREFIX)/sbin INCLUDEDIR=$(PREFIX)/include/corosync INCLUDEDIR_TOTEM=$(PREFIX)/include/corosync/totem INCLUDEDIR_LCR=$(PREFIX)/include/corosync/lcr -INCLUDEDIR_ENGINE=$(PREFIX)/include/corosync/service +INCLUDEDIR_ENGINE=$(PREFIX)/include/corosync/engine MANDIR=$(PREFIX)/share/man ETCDIR=/etc ARCH=$(shell uname -p) diff --git a/corosync/exec/apidef.c b/corosync/exec/apidef.c index 2951f854..290bca0d 100644 --- a/corosync/exec/apidef.c +++ b/corosync/exec/apidef.c @@ -67,6 +67,7 @@ static struct corosync_api_v1 apidef_corosync_api_v1 = { .ipc_fc_create = openais_ipc_flow_control_create, .ipc_fc_destroy = openais_ipc_flow_control_destroy, .totem_nodeid_get = totempg_my_nodeid_get, + .totem_family_get = totempg_my_family_get, .totem_ring_reenable = totempg_ring_reenable, .totem_mcast = main_mcast, .totem_send_ok = main_send_ok, diff --git a/corosync/exec/ipc.c b/corosync/exec/ipc.c index 237cc066..ecfab7d4 100644 --- a/corosync/exec/ipc.c +++ b/corosync/exec/ipc.c @@ -590,9 +590,9 @@ retry_poll: #endif #if defined(OPENAIS_LINUX) -char *socketname = "libais.socket"; +char *socketname = "libcorosync.socket"; #else -char *socketname = "/var/run/libais.socket"; +char *socketname = "/var/run/libcorosync.socket"; #endif diff --git a/corosync/exec/service.c b/corosync/exec/service.c index 4e0354b0..3430ff65 100644 --- a/corosync/exec/service.c +++ b/corosync/exec/service.c @@ -219,7 +219,7 @@ static int openais_service_unlink_common ( service_name, service_version); if (ais_service[*service_id]->exec_exit_fn) { - ais_service[*service_id]->exec_exit_fn (api); + ais_service[*service_id]->exec_exit_fn (); } ais_service[*service_id] = NULL; diff --git a/corosync/exec/totemip.c b/corosync/exec/totemip.c index e49517ab..522dfc54 100644 --- a/corosync/exec/totemip.c +++ b/corosync/exec/totemip.c @@ -202,11 +202,11 @@ int totemip_localhost_check(struct totem_ip_address *addr) return totemip_equal(addr, &localhost); } -const char *totemip_print(struct totem_ip_address *addr) +char *totemip_print(struct totem_ip_address *addr) { static char buf[INET6_ADDRSTRLEN]; - return inet_ntop(addr->family, addr->addr, buf, sizeof(buf)); + return ((char *)inet_ntop(addr->family, addr->addr, buf, sizeof(buf))); } /* Make a totem_ip_address into a usable sockaddr_storage */ diff --git a/corosync/exec/totemip.h b/corosync/exec/totemip.h index 9e50bc40..36336372 100644 --- a/corosync/exec/totemip.h +++ b/corosync/exec/totemip.h @@ -67,7 +67,7 @@ extern void totemip_copy(struct totem_ip_address *addr1, struct totem_ip_address extern void totemip_copy_endian_convert(struct totem_ip_address *addr1, struct totem_ip_address *addr2); int totemip_localhost(int family, struct totem_ip_address *localhost); extern int totemip_localhost_check(struct totem_ip_address *addr); -extern const char *totemip_print(struct totem_ip_address *addr); +extern char *totemip_print(struct totem_ip_address *addr); extern int totemip_sockaddr_to_totemip_convert(struct sockaddr_storage *saddr, struct totem_ip_address *ip_addr); extern int totemip_totemip_to_sockaddr_convert(struct totem_ip_address *ip_addr, uint16_t port, struct sockaddr_storage *saddr, int *addrlen); diff --git a/corosync/include/ais_util.h b/corosync/include/ais_util.h index 0a3acb1d..728f2dad 100644 --- a/corosync/include/ais_util.h +++ b/corosync/include/ais_util.h @@ -38,7 +38,11 @@ #include #include +#ifdef COROSYNC_EXTERNAL_ENGINE +#include +#else #include +#endif /* Debug macro */ diff --git a/corosync/include/coroapi.h b/corosync/include/coroapi.h index c292e438..c929caf4 100644 --- a/corosync/include/coroapi.h +++ b/corosync/include/coroapi.h @@ -287,6 +287,8 @@ struct corosync_api_v1 { */ int (*totem_nodeid_get) (void); + int (*totem_family_get) (void); + int (*totem_ring_reenable) (void); int (*totem_mcast) (struct iovec *iovec, int iov_len, unsigned int gaurantee); @@ -348,7 +350,7 @@ struct corosync_service_engine { unsigned int private_data_size; enum corosync_lib_flow_control flow_control; int (*exec_init_fn) (struct corosync_api_v1 *); - int (*exec_exit_fn) (struct corosync_api_v1 *); + int (*exec_exit_fn) (void); void (*exec_dump_fn) (void); int (*lib_init_fn) (void *conn); int (*lib_exit_fn) (void *conn); diff --git a/corosync/include/ipc_gen.h b/corosync/include/ipc_gen.h index 67acd0aa..17a74e88 100644 --- a/corosync/include/ipc_gen.h +++ b/corosync/include/ipc_gen.h @@ -34,7 +34,11 @@ #ifndef IPC_GEN_H_DEFINED #define IPC_GEN_H_DEFINED -#include +#ifdef COROSYNC_EXTERNAL_SERVICE +#include +#else +#include "mar_gen.h" +#endif enum service_types { EVS_SERVICE = 0, diff --git a/corosync/include/mar_gen.h b/corosync/include/mar_gen.h index a577384f..09a839d2 100644 --- a/corosync/include/mar_gen.h +++ b/corosync/include/mar_gen.h @@ -44,7 +44,11 @@ #include #include -#include +#ifdef COROSYNC_EXTERNAL_ENGINE +#include +#else +#include "swab.h" +#endif typedef int8_t mar_int8_t; typedef int16_t mar_int16_t; @@ -101,6 +105,20 @@ typedef struct { mar_uint8_t value[SA_MAX_NAME_LENGTH] __attribute__((aligned(8))); } mar_name_t; +static inline char *get_mar_name_t (mar_name_t *name) { + return ((char *)name->value); +} + +static int mar_name_match(mar_name_t *name1, mar_name_t *name2) +{ + if (name1->length == name2->length) { + return ((strncmp ((char *)name1->value, (char *)name2->value, + name1->length)) == 0); + } + return 0; +} + + static inline void swab_mar_name_t (mar_name_t *to_swab) { swab_mar_uint16_t (&to_swab->length); diff --git a/corosync/lib/util.c b/corosync/lib/util.c index 81327f3f..597a498e 100644 --- a/corosync/lib/util.c +++ b/corosync/lib/util.c @@ -83,9 +83,9 @@ struct saHandle { #endif #ifdef OPENAIS_LINUX -static char *socketname = "libais.socket"; +static char *socketname = "libcorosync.socket"; #else -static char *socketname = "/var/run/libais.socket"; +static char *socketname = "/var/run/libcorosync.socket"; #endif #ifdef SO_NOSIGPIPE