public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: master - cman: forward port build warning fixes
@ 2009-06-24  3:54 Fabio M. Di Nitto
  0 siblings, 0 replies; only message in thread
From: Fabio M. Di Nitto @ 2009-06-24  3:54 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=a977cbca172502b5d25e8d2ed915a2e39266f17c
Commit:        a977cbca172502b5d25e8d2ed915a2e39266f17c
Parent:        9c9118674780ed3e2f37313839dcf55e7cc3c879
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Wed Jun 24 05:53:43 2009 +0200
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Wed Jun 24 05:53:43 2009 +0200

cman: forward port build warning fixes

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 cman/cman_tool/main.c              |    4 +-
 cman/config/cman-preconfig.c       |   61 ++++++++++++++++++++---------------
 cman/config/nodelist.h             |    4 +-
 cman/services/cman/services/cman.c |   12 +++---
 cman/tests/client.c                |    4 +-
 cman/tests/sysmand.c               |   26 ++++++++--------
 6 files changed, 60 insertions(+), 51 deletions(-)

diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
index ddc2326..4985e76 100644
--- a/cman/cman_tool/main.c
+++ b/cman/cman_tool/main.c
@@ -321,6 +321,8 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
 {
 	char member_type;
 	int i,j,k;
+	int numaddrs;
+	struct cman_node_address addrs[MAX_INTERFACES];
 
 	if (comline->num_nodenames > 0) {
 		if (node_filter(comline, node->cn_name) == 0) {
@@ -348,8 +350,6 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
 		       node->cn_nodeid, member_type,
 		       node->cn_name);
 	}
-	int numaddrs;
-	struct cman_node_address addrs[MAX_INTERFACES];
 
 	if (comline->addresses_opt || comline->format_opts) {
 		if (!cman_get_node_addrs(h, node->cn_nodeid, MAX_INTERFACES, &numaddrs, addrs) &&
diff --git a/cman/config/cman-preconfig.c b/cman/config/cman-preconfig.c
index af31834..b164080 100644
--- a/cman/config/cman-preconfig.c
+++ b/cman/config/cman-preconfig.c
@@ -140,7 +140,7 @@ static int ipaddr_equal(struct sockaddr_storage *addr1, struct sockaddr_storage
 /* Build a localhost ip_address */
 static int get_localhost(int family, struct sockaddr_storage *localhost)
 {
-	char *addr_text;
+	const char *addr_text;
 	struct addrinfo *ainfo;
 	struct addrinfo ahints;
 	int ret;
@@ -241,7 +241,7 @@ static int sum_expected(struct objdb_iface_ver0 *objdb)
 	return vote_sum;
 }
 
-static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr, int portnum, int broadcast)
+static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr, int port, int broadcast)
 {
 	hdb_handle_t totem_object_handle;
 	hdb_handle_t find_handle;
@@ -297,7 +297,7 @@ static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr,
 			objdb->object_key_create(interface_object_handle, "mcastaddr", strlen("mcastaddr"),
 						 mcast, strlen(mcast)+1);
 
-		sprintf(tmp, "%d", portnum);
+		sprintf(tmp, "%d", port);
 		objdb->object_key_create(interface_object_handle, "mcastport", strlen("mcastport"),
 					 tmp, strlen(tmp)+1);
 
@@ -319,7 +319,7 @@ static uint16_t generate_cluster_id(char *name)
 	return value & 0xFFFF;
 }
 
-static char *default_mcast(char *nodename, uint16_t cluster_id)
+static char *default_mcast(char *node, uint16_t clusterid)
 {
         struct addrinfo *ainfo;
         struct addrinfo ahints;
@@ -331,9 +331,9 @@ static char *default_mcast(char *nodename, uint16_t cluster_id)
 
         /* Lookup the the nodename address and use it's IP type to
 	   default a multicast address */
-        ret = getaddrinfo(nodename, NULL, &ahints, &ainfo);
+        ret = getaddrinfo(node, NULL, &ahints, &ainfo);
 	if (ret) {
-		sprintf(error_reason, "Can't determine address family of nodename %s\n", nodename);
+		sprintf(error_reason, "Can't determine address family of nodename %s\n", node);
 		return NULL;
 	}
 
@@ -341,18 +341,18 @@ static char *default_mcast(char *nodename, uint16_t cluster_id)
 	freeaddrinfo(ainfo);
 
 	if (family == AF_INET) {
-		snprintf(addr, sizeof(addr), "239.192.%d.%d", cluster_id >> 8, cluster_id % 0xFF);
+		snprintf(addr, sizeof(addr), "239.192.%d.%d", clusterid >> 8, clusterid % 0xFF);
 		return addr;
 	}
 	if (family == AF_INET6) {
-		snprintf(addr, sizeof(addr), "ff15::%x", cluster_id);
+		snprintf(addr, sizeof(addr), "ff15::%x", clusterid);
 		return addr;
 	}
 
 	return NULL;
 }
 
-static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
+static int verify_nodename(struct objdb_iface_ver0 *objdb, char *node)
 {
 	char nodename2[MAX_CLUSTER_MEMBER_NAME_LEN+1];
 	char nodename3[MAX_CLUSTER_MEMBER_NAME_LEN+1];
@@ -364,17 +364,17 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
 	int error;
 
 	/* nodename is either from commandline or from uname */
-	if (nodelist_byname(objdb, cluster_parent_handle, nodename))
+	if (nodelist_byname(objdb, cluster_parent_handle, node))
 		return 0;
 
 	/* If nodename was from uname, try a domain-less version of it */
-	strcpy(nodename2, nodename);
+	strcpy(nodename2, node);
 	dot = strchr(nodename2, '.');
 	if (dot) {
 		*dot = '\0';
 
 		if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
-			strcpy(nodename, nodename2);
+			strcpy(node, nodename2);
 			return 0;
 		}
 	}
@@ -400,7 +400,7 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
 
 		if (strlen(nodename2) == len &&
 		    !strncmp(nodename2, nodename3, len)) {
-			strcpy(nodename, str);
+			strcpy(node, str);
 			return 0;
 		}
 		nodes_handle = nodeslist_next(objdb, find_handle);
@@ -416,10 +416,10 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
 		return -1;
 
 	for (ifa = ifa_list; ifa; ifa = ifa->ifa_next) {
-		socklen_t salen;
+		socklen_t salen = 0;
 
 		/* Restore this */
-		strcpy(nodename2, nodename);
+		strcpy(nodename2, node);
 		sa = ifa->ifa_addr;
 		if (!sa)
 			continue;
@@ -436,7 +436,7 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
 		if (!error) {
 
 			if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
-				strcpy(nodename, nodename2);
+				strcpy(node, nodename2);
 				goto out;
 			}
 
@@ -446,7 +446,7 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
 				*dot = '\0';
 
 				if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
-					strcpy(nodename, nodename2);
+					strcpy(node, nodename2);
 					goto out;
 				}
 			}
@@ -459,7 +459,7 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
 			continue;
 
 		if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
-			strcpy(nodename, nodename2);
+			strcpy(node, nodename2);
 			goto out;
 		}
 	}
@@ -471,7 +471,7 @@ static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
 }
 
 /* Get any environment variable overrides */
-static int get_env_overrides()
+static int get_env_overrides(void)
 {
 	if (getenv("CMAN_CLUSTER_NAME")) {
 		cluster_name = strdup(getenv("CMAN_CLUSTER_NAME"));
@@ -649,10 +649,10 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
 	objdb->object_find_create(node_object_handle,"altname", strlen("altname"), &find_handle);
 	while (objdb->object_find_next(find_handle, &alt_object) == 0) {
 		unsigned int port;
-		char *nodename;
+		char *node;
 		char *mcast;
 
-		if (objdb_get_string(objdb, alt_object, "name", &nodename)) {
+		if (objdb_get_string(objdb, alt_object, "name", &node)) {
 			continue;
 		}
 
@@ -662,7 +662,7 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
 			mcast = mcast_name;
 		}
 
-		if (add_ifaddr(objdb, mcast, nodename, portnum, broadcast))
+		if (add_ifaddr(objdb, mcast, node, portnum, broadcast))
 			return -1;
 
 		num_nodenames++;
@@ -919,10 +919,19 @@ static int set_noccs_defaults(struct objdb_iface_ver0 *objdb)
 	hdb_handle_t object_handle;
 
 	/* Enforce key */
-	key_filename = NOCCS_KEY_FILENAME;
+	key_filename = strdup(NOCCS_KEY_FILENAME);
+	if (!key_filename) {
+		sprintf(error_reason, "cannot allocate memory for key file name");
+		return -1;
+	}
 
 	if (!cluster_name)
-		cluster_name = DEFAULT_CLUSTER_NAME;
+		cluster_name = strdup(DEFAULT_CLUSTER_NAME);
+
+	if (!cluster_name) {
+		sprintf(error_reason, "cannot allocate memory for cluster_name");
+		return -1;
+	}
 
 	if (!cluster_id)
 		cluster_id = generate_cluster_id(cluster_name);
@@ -1048,7 +1057,7 @@ static int copy_config_tree(struct objdb_iface_ver0 *objdb, hdb_handle_t source_
 	/* Create sub-objects */
 	res = objdb->object_find_create(source_object, NULL, 0, &find_handle);
 	if (res) {
-		sprintf(error_reason, "error resetting object iterator for object %lld: %d\n", source_object, res);
+		sprintf(error_reason, "error resetting object iterator for object "HDB_X_FORMAT": %d\n", source_object, res);
 		return -1;
 	}
 
@@ -1066,7 +1075,7 @@ static int copy_config_tree(struct objdb_iface_ver0 *objdb, hdb_handle_t source_
  * Copy trees from /cluster where they live in cluster.conf, into the root
  * of the config tree where corosync expects to find them.
  */
-static int copy_tree_to_root(struct objdb_iface_ver0 *objdb, char *name, int always_create)
+static int copy_tree_to_root(struct objdb_iface_ver0 *objdb, const char *name, int always_create)
 {
 	hdb_handle_t find_handle;
 	hdb_handle_t object_handle;
diff --git a/cman/config/nodelist.h b/cman/config/nodelist.h
index 76c8349..f004145 100644
--- a/cman/config/nodelist.h
+++ b/cman/config/nodelist.h
@@ -1,6 +1,6 @@
 /* These just make the access a little neater */
 static inline int objdb_get_string(OBJDB_API *corosync, hdb_handle_t object_service_handle,
-				   char *key, char **value)
+				   const char *key, char **value)
 {
 	int res;
 
@@ -17,7 +17,7 @@ static inline int objdb_get_string(OBJDB_API *corosync, hdb_handle_t object_serv
 }
 
 static inline void objdb_get_int(OBJDB_API *corosync, hdb_handle_t object_service_handle,
-				 char *key, unsigned int *intvalue, unsigned int default_value)
+				 const char *key, unsigned int *intvalue, unsigned int default_value)
 {
 	char *value = NULL;
 
diff --git a/cman/services/cman/services/cman.c b/cman/services/cman/services/cman.c
index 7e96bd5..c96f813 100644
--- a/cman/services/cman/services/cman.c
+++ b/cman/services/cman/services/cman.c
@@ -377,12 +377,12 @@ static void cman_confchg_fn(enum totem_configuration_type configuration_type,
 }
 
 
-static void cman_deliver_fn(unsigned int nodeid, const void *buf, unsigned int buf_len,
+static void cman_deliver_fn(unsigned int nodeid, const void *msg, unsigned int buf_len,
 			    int endian_conversion_required)
 {
-	const struct cman_protheader *inheader = buf;
+	const struct cman_protheader *inheader = msg;
 	struct cman_protheader header;
-	const char *charbuf = buf;
+	const char *buf = msg;
 
 	if (endian_conversion_required) {
 		header.srcid = swab32(inheader->srcid);
@@ -414,14 +414,14 @@ static void cman_deliver_fn(unsigned int nodeid, const void *buf, unsigned int b
 		buf += sizeof(struct cman_protheader);
 		node = find_node(header.tgtid, 1);
 
-		switch (*charbuf) {
+		switch (*buf) {
 		case CLUSTER_MSG_PORTOPENED:
 			if (node) {
 				if (!(node->flags & NODE_FLAG_PORTS_VALID)) {
 					char reqmsg = CLUSTER_MSG_PORTENQ;
 					cman_send_message(0,0, nodeid, &reqmsg, 1);
 				}
-				set_port_bit(node, charbuf[2]);
+				set_port_bit(node, buf[2]);
 			}
 			break;
 		case CLUSTER_MSG_PORTCLOSED:
@@ -430,7 +430,7 @@ static void cman_deliver_fn(unsigned int nodeid, const void *buf, unsigned int b
 					char reqmsg = CLUSTER_MSG_PORTENQ;
 					cman_send_message(0,0, nodeid, &reqmsg, 1);
 				}
-				clear_port_bit(node, charbuf[2]);
+				clear_port_bit(node, buf[2]);
 			}
 			break;
 		case CLUSTER_MSG_PORTENQ:
diff --git a/cman/tests/client.c b/cman/tests/client.c
index 0950a7b..3eabb6d 100644
--- a/cman/tests/client.c
+++ b/cman/tests/client.c
@@ -20,13 +20,13 @@
 static cman_handle_t handle;
 static void get_members(void);
 
-static void event_callback(cman_handle_t handle, void *private, int reason, int arg)
+static void event_callback(cman_handle_t callback_handle, void *private, int reason, int arg)
 {
 	get_members();
 }
 
 
-static void data_callback(cman_handle_t handle, void *private,
+static void data_callback(cman_handle_t callback_handle, void *private,
 			  char *buf, int len, uint8_t port, int nodeid)
 {
 	printf("Received from node %d port %d: '%s'\n", nodeid, port, buf);
diff --git a/cman/tests/sysmand.c b/cman/tests/sysmand.c
index 05a5572..03591fa 100644
--- a/cman/tests/sysmand.c
+++ b/cman/tests/sysmand.c
@@ -220,24 +220,24 @@ int main(int argc, char *argv[])
 		    case LOCAL_RENDEZVOUS:
 		    {
 			struct sockaddr_un socka;
-			struct read_fd *newfd;
+			struct read_fd *rendfd;
 			socklen_t sl = sizeof(socka);
 			int client_fd = accept(local_sock, (struct sockaddr *)&socka, &sl);
 
 			if (client_fd >= 0)
 			{
-			    newfd = malloc(sizeof(struct read_fd));
-			    if (!newfd)
+			    rendfd = malloc(sizeof(struct read_fd));
+			    if (!rendfd)
 			    {
 				close(client_fd);
 				break;
 			    }
-			    newfd->fd    = client_fd;
-			    newfd->type  = LOCAL_SOCK;
-			    newfd->next  = thisfd->next;
-			    newfd->nodes_done = 0;
-			    newfd->start_time = time(NULL);
-			    thisfd->next = newfd;
+			    rendfd->fd    = client_fd;
+			    rendfd->type  = LOCAL_SOCK;
+			    rendfd->next  = thisfd->next;
+			    rendfd->nodes_done = 0;
+			    rendfd->start_time = time(NULL);
+			    thisfd->next = rendfd;
 			}
 		    }
 		    break;
@@ -442,7 +442,7 @@ static void remove_sock(struct read_fd *deadfd)
 
 static int exec_command(char *cmd, char *reply, int *len)
 {
-    FILE *pipe;
+    FILE *exec_pipe;
     int readlen;
     int avail = PIPE_BUF-sizeof(struct sysman_header)-1;
     char realcmd[strlen(cmd)+25];
@@ -451,12 +451,12 @@ static int exec_command(char *cmd, char *reply, int *len)
     snprintf(realcmd, sizeof(realcmd), "%s </dev/null 2>&1", cmd);
 
     *len = 0;
-    pipe = popen(realcmd, "r");
+    exec_pipe = popen(realcmd, "r");
 
     /* Fill the buffer as full as possible */
     do
     {
-	readlen = fread(reply + *len, 1, avail, pipe);
+	readlen = fread(reply + *len, 1, avail, exec_pipe);
 	if (readlen > 0)
 	{
 	    *len += readlen;
@@ -468,5 +468,5 @@ static int exec_command(char *cmd, char *reply, int *len)
     reply[*len] ='\0';
 
     /* Return completion status of command */
-    return pclose(pipe);
+    return pclose(exec_pipe);
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-06-24  3:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-24  3:54 cluster: master - cman: forward port build warning fixes Fabio M. Di Nitto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).