This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
cluster: STABLE3 - cman/config: Change handle code to work with newcorosync API
- From: Christine Caulfield <chrissie at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Wed, 25 Feb 2009 11:47:50 +0000 (UTC)
- Subject: cluster: STABLE3 - cman/config: Change handle code to work with newcorosync API
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=a934a873dc5f2d28c4e0dd3e696177048aa8196a
Commit: a934a873dc5f2d28c4e0dd3e696177048aa8196a
Parent: c4c056a6c9ef5f8346fd9c1b871291f253791aa7
Author: Christine Caulfield <ccaulfie@redhat.com>
AuthorDate: Wed Feb 25 11:47:18 2009 +0000
Committer: Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Wed Feb 25 11:47:18 2009 +0000
cman/config: Change handle code to work with new corosync API
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
cman/daemon/ais.c | 8 ++--
cman/daemon/cman-preconfig.c | 62 +++++++++++++++++++-------------------
cman/daemon/cmanconfig.c | 18 +++++-----
cman/daemon/commands.c | 8 ++--
cman/daemon/daemon.c | 28 ++++++++--------
cman/daemon/nodelist.h | 22 +++++++-------
config/plugins/ldap/configldap.c | 14 ++++----
config/plugins/xml/config.c | 6 ++--
8 files changed, 83 insertions(+), 83 deletions(-)
diff --git a/cman/daemon/ais.c b/cman/daemon/ais.c
index 1ebac82..1fbbc76 100644
--- a/cman/daemon/ais.c
+++ b/cman/daemon/ais.c
@@ -50,14 +50,14 @@ int num_ais_nodes;
quorum_set_quorate_fn_t corosync_set_quorum;
struct memb_ring_id cman_ring_id;
extern unsigned int config_version;
-static unsigned int cluster_parent_handle;
+static hdb_handle_t cluster_parent_handle;
static int startup_pipe;
static unsigned int debug_mask;
static int first_trans = 1;
struct corosync_api_v1 *corosync;
-static cs_tpg_handle group_handle;
+static hdb_handle_t group_handle;
static struct corosync_tpg_group cman_group[1] = {
{ .group = "CMAN", .group_len = 4},
};
@@ -161,8 +161,8 @@ static void cman_quorum_init(struct corosync_api_v1 *api, quorum_set_quorate_fn_
static int cman_exec_init_fn(struct corosync_api_v1 *api)
{
- unsigned int object_handle;
- unsigned int find_handle;
+ hdb_handle_t object_handle;
+ hdb_handle_t find_handle;
char pipe_msg[256];
corosync = api;
diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index c1e7d1b..65a8494 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -48,7 +48,7 @@ static char *key_filename=NULL;
static char *mcast_name;
static char *cluster_name;
static char error_reason[1024] = { '\0' };
-static unsigned int cluster_parent_handle;
+static hdb_handle_t cluster_parent_handle;
/*
* Exports the interface for the service
@@ -200,8 +200,8 @@ static int address_family(char *addr, struct sockaddr_storage *ssaddr, int famil
*/
static unsigned int find_cman_logger(struct objdb_iface_ver0 *objdb, unsigned int object_handle)
{
- unsigned int subsys_handle;
- unsigned int find_handle;
+ hdb_handle_t subsys_handle;
+ hdb_handle_t find_handle;
char *str;
objdb->object_find_create(object_handle, "logger_subsys", strlen("logger_subsys"), &find_handle);
@@ -230,9 +230,9 @@ static unsigned int find_cman_logger(struct objdb_iface_ver0 *objdb, unsigned in
static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr, int portnum)
{
- unsigned int totem_object_handle;
- unsigned int find_handle;
- unsigned int interface_object_handle;
+ hdb_handle_t totem_object_handle;
+ hdb_handle_t find_handle;
+ hdb_handle_t interface_object_handle;
struct sockaddr_storage if_addr, localhost, mcast_addr;
char tmp[132];
int ret = 0;
@@ -343,8 +343,8 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
char *str, *dot = NULL;
struct ifaddrs *ifa, *ifa_list;
struct sockaddr *sa;
- unsigned int nodes_handle;
- unsigned int find_handle = 0;
+ hdb_handle_t nodes_handle;
+ hdb_handle_t find_handle = 0;
int error;
/* nodename is either from commandline or from uname */
@@ -507,10 +507,10 @@ static int get_env_overrides()
static int get_nodename(struct objdb_iface_ver0 *objdb)
{
char *nodeid_str = NULL;
- unsigned int object_handle;
- unsigned int find_handle;
- unsigned int node_object_handle;
- unsigned int alt_object;
+ hdb_handle_t object_handle;
+ hdb_handle_t find_handle;
+ hdb_handle_t node_object_handle;
+ hdb_handle_t alt_object;
int error;
if (!getenv("CMAN_NOCONFIG")) {
@@ -570,8 +570,8 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
if (objdb->object_find_next(find_handle, &object_handle) == 0) {
- unsigned int mcast_handle;
- unsigned int find_handle2;
+ hdb_handle_t mcast_handle;
+ hdb_handle_t find_handle2;
if (!mcast_name) {
@@ -638,11 +638,11 @@ out:
/* These are basically cman overrides to the totem config bits */
static void add_cman_overrides(struct objdb_iface_ver0 *objdb)
{
- unsigned int logger_object_handle;
+ hdb_handle_t logger_object_handle;
char *logstr;
char *logfacility;
- unsigned int object_handle;
- unsigned int find_handle;
+ hdb_handle_t object_handle;
+ hdb_handle_t find_handle;
char tmp[256];
/* "totem" key already exists, because we have added the interfaces by now */
@@ -841,8 +841,8 @@ static void add_cman_overrides(struct objdb_iface_ver0 *objdb)
static int set_noccs_defaults(struct objdb_iface_ver0 *objdb)
{
char tmp[255];
- unsigned int object_handle;
- unsigned int find_handle;
+ hdb_handle_t object_handle;
+ hdb_handle_t find_handle;
/* Enforce key */
key_filename = NOCCS_KEY_FILENAME;
@@ -949,9 +949,9 @@ static int set_noccs_defaults(struct objdb_iface_ver0 *objdb)
/* Move an object/key tree */
static int copy_config_tree(struct objdb_iface_ver0 *objdb, unsigned int source_object, unsigned int target_parent_object, int always_create)
{
- unsigned int object_handle;
- unsigned int new_object;
- unsigned int find_handle;
+ hdb_handle_t object_handle;
+ hdb_handle_t new_object;
+ hdb_handle_t find_handle;
char object_name[1024];
int object_name_len;
void *key_name;
@@ -1001,8 +1001,8 @@ static int copy_config_tree(struct objdb_iface_ver0 *objdb, unsigned int source_
*/
static int copy_tree_to_root(struct objdb_iface_ver0 *objdb, char *name, int always_create)
{
- unsigned int find_handle;
- unsigned int object_handle;
+ hdb_handle_t find_handle;
+ hdb_handle_t object_handle;
int res=0;
objdb->object_find_create(cluster_parent_handle, name, strlen(name), &find_handle);
@@ -1016,8 +1016,8 @@ static int copy_tree_to_root(struct objdb_iface_ver0 *objdb, char *name, int alw
static int get_cman_globals(struct objdb_iface_ver0 *objdb)
{
- unsigned int object_handle;
- unsigned int find_handle;
+ hdb_handle_t object_handle;
+ hdb_handle_t find_handle;
objdb_get_string(objdb, cluster_parent_handle, "name", &cluster_name);
@@ -1043,9 +1043,9 @@ static int get_cman_globals(struct objdb_iface_ver0 *objdb)
static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, char **error_string)
{
int ret = -1;
- unsigned int object_handle;
- unsigned int find_handle;
- unsigned int cluster_parent_handle_new;
+ hdb_handle_t object_handle;
+ hdb_handle_t find_handle;
+ hdb_handle_t cluster_parent_handle_new;
/* don't reload if we've been told to run configless */
if (getenv("CMAN_NOCONFIG")) {
@@ -1101,8 +1101,8 @@ err:
static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, char **error_string)
{
int ret = 0;
- unsigned int object_handle;
- unsigned int find_handle;
+ hdb_handle_t object_handle;
+ hdb_handle_t find_handle;
if (getenv("CMAN_PIPE"))
startup_pipe = atoi(getenv("CMAN_PIPE"));
diff --git a/cman/daemon/cmanconfig.c b/cman/daemon/cmanconfig.c
index cf0cfd2..eac221a 100644
--- a/cman/daemon/cmanconfig.c
+++ b/cman/daemon/cmanconfig.c
@@ -43,11 +43,11 @@ int read_cman_nodes(struct corosync_api_v1 *corosync, unsigned int *config_versi
unsigned int expected = 0;
unsigned int votes = 0;
int nodeid;
- unsigned int object_handle;
- unsigned int nodes_handle;
- unsigned int find_handle;
+ hdb_handle_t object_handle;
+ hdb_handle_t nodes_handle;
+ hdb_handle_t find_handle;
char *nodename;
- unsigned int cluster_parent_handle;
+ hdb_handle_t cluster_parent_handle;
corosync->object_find_create(OBJECT_PARENT_HANDLE,
"cluster", strlen("cluster"), &find_handle);
@@ -140,11 +140,11 @@ static int get_cman_join_info(struct corosync_api_v1 *corosync)
char *cname = NULL;
int error, vote_sum = 0, node_count = 0;
int votes=0;
- unsigned int object_handle;
- unsigned int node_object;
- unsigned int nodes_handle;
- unsigned int find_handle;
- unsigned int cluster_parent_handle;
+ hdb_handle_t object_handle;
+ hdb_handle_t node_object;
+ hdb_handle_t nodes_handle;
+ hdb_handle_t find_handle;
+ hdb_handle_t cluster_parent_handle;
corosync->object_find_create(OBJECT_PARENT_HANDLE,
"cluster", strlen("cluster"), &find_handle);
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index 5da3af3..1da6dcb 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -504,10 +504,10 @@ static int do_cmd_get_extrainfo(char *cmdbuf, char **retbuf, int retsize, int *r
int addrlen;
int uncounted = 0;
unsigned int num_interfaces;
- unsigned int totem_object_handle;
- unsigned int object_handle;
- unsigned int totem_find_handle;
- unsigned int iface_find_handle;
+ hdb_handle_t totem_object_handle;
+ hdb_handle_t object_handle;
+ hdb_handle_t totem_find_handle;
+ hdb_handle_t iface_find_handle;
char **status;
struct cluster_node *node;
struct sockaddr_storage *ss;
diff --git a/cman/daemon/daemon.c b/cman/daemon/daemon.c
index 6cef080..1de5964 100644
--- a/cman/daemon/daemon.c
+++ b/cman/daemon/daemon.c
@@ -49,11 +49,11 @@ static LIST_INIT(client_list);
volatile sig_atomic_t quit_threads=0;
int num_connections = 0;
-poll_handle ais_poll_handle;
+hdb_handle_t cs_poll_handle;
uint32_t max_outstanding_messages = DEFAULT_MAX_QUEUED;
-static int process_client(poll_handle handle, int fd, int revent, void *data);
-static void remove_client(poll_handle handle, struct connection *con);
+static int process_client(hdb_handle_t handle, int fd, int revent, void *data);
+static void remove_client(hdb_handle_t handle, struct connection *con);
/* Send it, or queue it for later if the socket is busy */
static int send_reply_message(struct connection *con, struct sock_header *msg)
@@ -79,7 +79,7 @@ static int send_reply_message(struct connection *con, struct sock_header *msg)
/* Have we exceeded the allowed number of queued messages ? */
if (con->num_write_msgs > max_outstanding_messages) {
P_DAEMON("Disconnecting. client has more that %d replies outstanding (%d)\n", max_outstanding_messages, con->num_write_msgs);
- remove_client(ais_poll_handle, con);
+ remove_client(cs_poll_handle, con);
return -1;
}
@@ -98,12 +98,12 @@ static int send_reply_message(struct connection *con, struct sock_header *msg)
list_add(&con->write_msgs, &qm->list);
con->num_write_msgs++;
P_DAEMON("queued last message, count is %d\n", con->num_write_msgs);
- poll_dispatch_modify(ais_poll_handle, con->fd, POLLIN | POLLOUT, process_client);
+ poll_dispatch_modify(cs_poll_handle, con->fd, POLLIN | POLLOUT, process_client);
}
return 0;
}
-static void remove_client(poll_handle handle, struct connection *con)
+static void remove_client(hdb_handle_t handle, struct connection *con)
{
struct list *tmp, *qmh;
struct queued_reply *qm;
@@ -158,12 +158,12 @@ static void send_queued_reply(struct connection *con)
if (list_empty(&con->write_msgs)) {
/* Remove POLLOUT callback */
P_DAEMON("Removing POLLOUT from fd %d\n", con->fd);
- poll_dispatch_modify(ais_poll_handle, con->fd, POLLIN, process_client);
+ poll_dispatch_modify(cs_poll_handle, con->fd, POLLIN, process_client);
}
}
/* Dispatch a request from a CLIENT or ADMIN socket */
-static int process_client(poll_handle handle, int fd, int revent, void *data)
+static int process_client(hdb_handle_t handle, int fd, int revent, void *data)
{
struct connection *con = data;
@@ -319,7 +319,7 @@ static int process_client(poll_handle handle, int fd, int revent, void *data)
/* Both client and admin rendezvous sockets use this */
-static int process_rendezvous(poll_handle handle, int fd, int revent, void *data)
+static int process_rendezvous(hdb_handle_t handle, int fd, int revent, void *data)
{
struct sockaddr_un socka;
struct connection *con = data;
@@ -350,7 +350,7 @@ static int process_rendezvous(poll_handle handle, int fd, int revent, void *data
return 0;
}
-static int open_local_sock(const char *name, int name_len, mode_t mode, poll_handle handle, int type)
+static int open_local_sock(const char *name, int name_len, mode_t mode, hdb_handle_t handle, int type)
{
int local_socket;
struct sockaddr_un sockaddr;
@@ -497,23 +497,23 @@ static void sigint_handler(int ignored)
quit_threads = 1;
}
-extern poll_handle aisexec_poll_handle;
+extern hdb_handle_t corosync_poll_handle;
int cman_init()
{
int fd;
struct sigaction sa;
- ais_poll_handle = aisexec_poll_handle;
+ cs_poll_handle = corosync_poll_handle;
barrier_init();
log_printf(LOG_INFO, "CMAN %s (built %s %s) started\n",
RELEASE_VERSION, __DATE__, __TIME__);
- fd = open_local_sock(CLIENT_SOCKNAME, sizeof(CLIENT_SOCKNAME), 0660, ais_poll_handle, CON_CLIENT);
+ fd = open_local_sock(CLIENT_SOCKNAME, sizeof(CLIENT_SOCKNAME), 0660, cs_poll_handle, CON_CLIENT);
if (fd < 0)
return -2;
- fd = open_local_sock(ADMIN_SOCKNAME, sizeof(ADMIN_SOCKNAME), 0600, ais_poll_handle, CON_ADMIN);
+ fd = open_local_sock(ADMIN_SOCKNAME, sizeof(ADMIN_SOCKNAME), 0600, cs_poll_handle, CON_ADMIN);
if (fd < 0)
return -2;
diff --git a/cman/daemon/nodelist.h b/cman/daemon/nodelist.h
index 02dfe17..b91382f 100644
--- a/cman/daemon/nodelist.h
+++ b/cman/daemon/nodelist.h
@@ -34,17 +34,17 @@ static inline void objdb_get_int(OBJDB_API *corosync, unsigned int object_servic
/* Helper functions for navigating the nodes list */
static inline unsigned int nodeslist_init(OBJDB_API *corosync,
- unsigned int cluster_parent_handle,
- unsigned int *find_handle)
+ hdb_handle_t cluster_parent_handle,
+ hdb_handle_t *find_handle)
{
- unsigned int object_handle;
- unsigned int find_handle1;
- unsigned int find_handle2;
+ hdb_handle_t object_handle;
+ hdb_handle_t find_handle1;
+ hdb_handle_t find_handle2;
corosync->object_find_create(cluster_parent_handle,"clusternodes", strlen("clusternodes"), &find_handle1);
if (corosync->object_find_next(find_handle1, &object_handle) == 0)
{
- unsigned int nodes_handle;
+ hdb_handle_t nodes_handle;
corosync->object_find_destroy(find_handle1);
corosync->object_find_create(object_handle,"clusternode", strlen("clusternode"), &find_handle2);
@@ -58,9 +58,9 @@ static inline unsigned int nodeslist_init(OBJDB_API *corosync,
return 0;
}
-static inline unsigned int nodeslist_next(OBJDB_API *corosync, unsigned int find_handle)
+static inline unsigned int nodeslist_next(OBJDB_API *corosync, hdb_handle_t find_handle)
{
- unsigned int nodes_handle;
+ hdb_handle_t nodes_handle;
if (corosync->object_find_next(find_handle, &nodes_handle) == 0)
return nodes_handle;
@@ -69,12 +69,12 @@ static inline unsigned int nodeslist_next(OBJDB_API *corosync, unsigned int find
}
static inline unsigned int nodelist_byname(OBJDB_API *corosync,
- unsigned int cluster_parent_handle,
+ hdb_handle_t cluster_parent_handle,
char *name)
{
char *nodename;
- unsigned int nodes_handle;
- unsigned int find_handle = 0;
+ hdb_handle_t nodes_handle;
+ hdb_handle_t find_handle = 0;
nodes_handle = nodeslist_init(corosync, cluster_parent_handle, &find_handle);
while (nodes_handle) {
diff --git a/config/plugins/ldap/configldap.c b/config/plugins/ldap/configldap.c
index 11a5250..aab8934 100644
--- a/config/plugins/ldap/configldap.c
+++ b/config/plugins/ldap/configldap.c
@@ -99,14 +99,14 @@ static void convert_dn_underscores(LDAPDN dn)
* Return the parent object of a DN.
* Actually, this returns the LAST parent with that name. which should (!) be correct.
*/
-static unsigned int find_parent(struct objdb_iface_ver0 *objdb, LDAPDN dn, int startdn, char *parent)
+static hdb_handle_t find_parent(struct objdb_iface_ver0 *objdb, LDAPDN dn, int startdn, char *parent)
{
int i=startdn;
int gotstart=0;
int start=0, end=startdn;
- unsigned int parent_handle = OBJECT_PARENT_HANDLE;
- unsigned int object_handle=0;
- unsigned int find_handle;
+ hdb_handle_t parent_handle = OBJECT_PARENT_HANDLE;
+ hdb_handle_t object_handle=0;
+ hdb_handle_t find_handle;
/*
* Find the start and end positions first.
@@ -138,15 +138,15 @@ static unsigned int find_parent(struct objdb_iface_ver0 *objdb, LDAPDN dn, int s
-static int read_config_for(LDAP *ld, struct objdb_iface_ver0 *objdb, unsigned int parent,
+static int read_config_for(LDAP *ld, struct objdb_iface_ver0 *objdb, hdb_handle_t parent,
char *object, char *sub_dn, int always_create)
{
char search_dn[4096];
int rc;
char *dn;
LDAPMessage *result, *e;
- unsigned int parent_handle = OBJECT_PARENT_HANDLE;
- unsigned int object_handle;
+ hdb_handle_t parent_handle = OBJECT_PARENT_HANDLE;
+ hdb_handle_t object_handle;
sprintf(search_dn, "%s,%s", sub_dn, ldap_basedn);
diff --git a/config/plugins/xml/config.c b/config/plugins/xml/config.c
index 9da448b..2fd346f 100644
--- a/config/plugins/xml/config.c
+++ b/config/plugins/xml/config.c
@@ -54,7 +54,7 @@ static void xml_comp_register(void)
};
static void addkeys(xmlAttrPtr tmpattr, struct objdb_iface_ver0 *objdb,
- unsigned int object_handle)
+ hdb_handle_t object_handle)
{
for (tmpattr = tmpattr; tmpattr; tmpattr = tmpattr->next) {
if (tmpattr->type == XML_ATTRIBUTE_NODE)
@@ -69,9 +69,9 @@ static void addkeys(xmlAttrPtr tmpattr, struct objdb_iface_ver0 *objdb,
}
static void xml2objdb(xmlNodePtr tmpnode, struct objdb_iface_ver0 *objdb,
- unsigned int parent)
+ hdb_handle_t parent)
{
- unsigned int object_handle = 0;
+ hdb_handle_t object_handle = 0;
for (tmpnode = tmpnode; tmpnode; tmpnode = tmpnode->next) {
if (tmpnode->type == XML_ELEMENT_NODE) {