Просмотр исходного кода

sync the rest of the code with previous header changes

* exec/coroipcs.c (coroipcs_response_send)
(coroipcs_dispatch_send):
* exec/coroipcs.h (handler_fn_get):
* include/corosync/cpg.h (cpg_deliver_fn_t, cpg_confchg_fn_t):
* test/cpgbench.c (cpg_bm_confchg_fn, cpg_bm_deliver_fn):
* test/testcpg.c (print_cpgname, DeliverCallback)
(ConfchgCallback):
* test/testcpg2.c (deliver, confch):

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2044 fd59a12c-fef9-0310-b244-a6a79926bd2f
Jim Meyering 17 лет назад
Родитель
Сommit
3df307a36d
6 измененных файлов с 37 добавлено и 33 удалено
  1. 2 2
      exec/coroipcs.c
  2. 3 3
      exec/coroipcs.h
  3. 2 2
      include/corosync/cpg.h
  4. 7 7
      test/cpgbench.c
  5. 16 12
      test/testcpg.c
  6. 7 7
      test/testcpg2.c

+ 2 - 2
exec/coroipcs.c

@@ -584,7 +584,7 @@ void *coroipcs_private_data_get (void *conn)
 	return (conn_info->private_data);
 	return (conn_info->private_data);
 }
 }
 
 
-int coroipcs_response_send (void *conn, const void *msg, int mlen)
+int coroipcs_response_send (void *conn, const void *msg, size_t mlen)
 {
 {
 	struct conn_info *conn_info = (struct conn_info *)conn;
 	struct conn_info *conn_info = (struct conn_info *)conn;
 	struct sembuf sop;
 	struct sembuf sop;
@@ -865,7 +865,7 @@ void coroipcs_refcount_dec (void *conn)
 	pthread_mutex_unlock (&conn_info->mutex);
 	pthread_mutex_unlock (&conn_info->mutex);
 }
 }
 
 
-int coroipcs_dispatch_send (void *conn, const void *msg, int mlen)
+int coroipcs_dispatch_send (void *conn, const void *msg, size_t mlen)
 {
 {
 	struct iovec iov;
 	struct iovec iov;
 
 

+ 3 - 3
exec/coroipcs.h

@@ -6,7 +6,7 @@
  * Author: Steven Dake (sdake@redhat.com)
  * Author: Steven Dake (sdake@redhat.com)
  *
  *
  * This software licensed under BSD license, the text of which follows:
  * This software licensed under BSD license, the text of which follows:
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
  * modification, are permitted provided that the following conditions are met:
  *
  *
@@ -77,12 +77,12 @@ extern void coroipcs_ipc_init (
 
 
 extern void *coroipcs_private_data_get (void *conn);
 extern void *coroipcs_private_data_get (void *conn);
 
 
-extern int coroipcs_response_send (void *conn, const void *msg, int mlen);
+extern int coroipcs_response_send (void *conn, const void *msg, size_t mlen);
 
 
 extern int coroipcs_response_iov_send (void *conn,
 extern int coroipcs_response_iov_send (void *conn,
 				       const struct iovec *iov, unsigned int iov_len);
 				       const struct iovec *iov, unsigned int iov_len);
 
 
-extern int coroipcs_dispatch_send (void *conn, const void *msg, int mlen);
+extern int coroipcs_dispatch_send (void *conn, const void *msg, size_t mlen);
 
 
 extern int coroipcs_dispatch_iov_send (void *conn,
 extern int coroipcs_dispatch_iov_send (void *conn,
 				       const struct iovec *iov, unsigned int iov_len);
 				       const struct iovec *iov, unsigned int iov_len);

+ 2 - 2
include/corosync/cpg.h

@@ -81,7 +81,7 @@ struct cpg_name {
 
 
 typedef void (*cpg_deliver_fn_t) (
 typedef void (*cpg_deliver_fn_t) (
 	cpg_handle_t handle,
 	cpg_handle_t handle,
-	struct cpg_name *group_name,
+	const struct cpg_name *group_name,
 	uint32_t nodeid,
 	uint32_t nodeid,
 	uint32_t pid,
 	uint32_t pid,
 	const void *msg,
 	const void *msg,
@@ -89,7 +89,7 @@ typedef void (*cpg_deliver_fn_t) (
 
 
 typedef void (*cpg_confchg_fn_t) (
 typedef void (*cpg_confchg_fn_t) (
 	cpg_handle_t handle,
 	cpg_handle_t handle,
-	struct cpg_name *group_name,
+	const struct cpg_name *group_name,
 	const struct cpg_address *member_list, size_t member_list_entries,
 	const struct cpg_address *member_list, size_t member_list_entries,
 	const struct cpg_address *left_list, size_t left_list_entries,
 	const struct cpg_address *left_list, size_t left_list_entries,
 	const struct cpg_address *joined_list, size_t joined_list_entries);
 	const struct cpg_address *joined_list, size_t joined_list_entries);

+ 7 - 7
test/cpgbench.c

@@ -71,10 +71,10 @@ static int alarm_notice;
 
 
 static void cpg_bm_confchg_fn (
 static void cpg_bm_confchg_fn (
 	cpg_handle_t handle,
 	cpg_handle_t handle,
-	struct cpg_name *group_name,
-	struct cpg_address *member_list, int member_list_entries,
-	struct cpg_address *left_list, int left_list_entries,
-	struct cpg_address *joined_list, int joined_list_entries)
+	const struct cpg_name *group_name,
+	const struct cpg_address *member_list, size_t member_list_entries,
+	const struct cpg_address *left_list, size_t left_list_entries,
+	const struct cpg_address *joined_list, size_t joined_list_entries)
 {
 {
 }
 }
 
 
@@ -82,11 +82,11 @@ static unsigned int write_count;
 
 
 static void cpg_bm_deliver_fn (
 static void cpg_bm_deliver_fn (
         cpg_handle_t handle,
         cpg_handle_t handle,
-        struct cpg_name *group_name,
+        const struct cpg_name *group_name,
         uint32_t nodeid,
         uint32_t nodeid,
         uint32_t pid,
         uint32_t pid,
-        void *msg,
-        int msg_len)
+        const void *msg,
+        size_t msg_len)
 {
 {
 	write_count++;
 	write_count++;
 }
 }

+ 16 - 12
test/testcpg.c

@@ -53,7 +53,7 @@
 static int quit = 0;
 static int quit = 0;
 static int show_ip = 0;
 static int show_ip = 0;
 
 
-static void print_cpgname (struct cpg_name *name)
+static void print_cpgname (const struct cpg_name *name)
 {
 {
 	int i;
 	int i;
 
 
@@ -64,29 +64,32 @@ static void print_cpgname (struct cpg_name *name)
 
 
 static void DeliverCallback (
 static void DeliverCallback (
 	cpg_handle_t handle,
 	cpg_handle_t handle,
-	struct cpg_name *groupName,
+	const struct cpg_name *groupName,
 	uint32_t nodeid,
 	uint32_t nodeid,
 	uint32_t pid,
 	uint32_t pid,
-	void *msg,
-	int msg_len)
+	const void *msg,
+	size_t msg_len)
 {
 {
 	if (show_ip) {
 	if (show_ip) {
 		struct in_addr saddr;
 		struct in_addr saddr;
 		saddr.s_addr = nodeid;
 		saddr.s_addr = nodeid;
-		printf("DeliverCallback: message (len=%d)from node/pid %s/%d: '%s'\n",
-		       msg_len, inet_ntoa(saddr), pid, (char *)msg);
+		printf("DeliverCallback: message (len=%lu)from node/pid %s/%d: '%s'\n",
+		       (unsigned long int) msg_len,
+		       inet_ntoa(saddr), pid, (const char *)msg);
 	}
 	}
 	else {
 	else {
-		printf("DeliverCallback: message (len=%d)from node/pid %d/%d: '%s'\n", msg_len, nodeid, pid, (char *)msg);
+		printf("DeliverCallback: message (len=%lu)from node/pid %d/%d: '%s'\n",
+		       (unsigned long int) msg_len, nodeid, pid,
+		       (const char *)msg);
 	}
 	}
 }
 }
 
 
 static void ConfchgCallback (
 static void ConfchgCallback (
 	cpg_handle_t handle,
 	cpg_handle_t handle,
-	struct cpg_name *groupName,
-	struct cpg_address *member_list, int member_list_entries,
-	struct cpg_address *left_list, int left_list_entries,
-	struct cpg_address *joined_list, int joined_list_entries)
+	const struct cpg_name *groupName,
+	const struct cpg_address *member_list, size_t member_list_entries,
+	const struct cpg_address *left_list, size_t left_list_entries,
+	const struct cpg_address *joined_list, size_t joined_list_entries)
 {
 {
 	int i;
 	int i;
 	struct in_addr saddr;
 	struct in_addr saddr;
@@ -122,7 +125,8 @@ static void ConfchgCallback (
 		}
 		}
 	}
 	}
 
 
-	printf("nodes in group now %d\n", member_list_entries);
+	printf("nodes in group now %lu\n",
+	       (unsigned long int) member_list_entries);
 	for (i=0; i<member_list_entries; i++) {
 	for (i=0; i<member_list_entries; i++) {
 		if (show_ip) {
 		if (show_ip) {
 			saddr.s_addr = member_list[i].nodeid;
 			saddr.s_addr = member_list[i].nodeid;

+ 7 - 7
test/testcpg2.c

@@ -45,21 +45,21 @@
 
 
 static void deliver(
 static void deliver(
 	cpg_handle_t handle,
 	cpg_handle_t handle,
-	struct cpg_name *group_name,
+	const struct cpg_name *group_name,
 	uint32_t nodeid,
 	uint32_t nodeid,
 	uint32_t pid,
 	uint32_t pid,
-	void *msg,
-	int msg_len)
+	const void *msg,
+	size_t msg_len)
 {
 {
     printf("self delivered nodeid: %x\n", nodeid);
     printf("self delivered nodeid: %x\n", nodeid);
 }
 }
 
 
 static void confch(
 static void confch(
 	cpg_handle_t handle,
 	cpg_handle_t handle,
-	struct cpg_name *group_name,
-	struct cpg_address *member_list, int member_list_entries,
-	struct cpg_address *left_list, int left_list_entries,
-	struct cpg_address *joined_list, int joined_list_entries)
+	const struct cpg_name *group_name,
+	const struct cpg_address *member_list, size_t member_list_entries,
+	const struct cpg_address *left_list, size_t left_list_entries,
+	const struct cpg_address *joined_list, size_t joined_list_entries)
 {
 {
 	printf("confchg nodeid %x\n", member_list[0].nodeid);
 	printf("confchg nodeid %x\n", member_list[0].nodeid);
 }
 }