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

Pass handle by value instead of address.

(Logical change 1.140)


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@502 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 21 лет назад
Родитель
Сommit
037204a621
11 измененных файлов с 51 добавлено и 51 удалено
  1. 7 7
      include/evs.h
  2. 23 23
      lib/evs.c
  3. 1 1
      man/evs_dispatch.3
  4. 1 1
      man/evs_fd_get.3
  5. 1 1
      man/evs_finalize.3
  6. 1 1
      man/evs_join.3
  7. 1 1
      man/evs_leave.3
  8. 1 1
      man/evs_mcast_groups.3
  9. 1 1
      man/evs_mcast_joined.3
  10. 4 4
      test/evsbench.c
  11. 10 10
      test/testevs.c

+ 7 - 7
include/evs.h

@@ -97,21 +97,21 @@ evs_error_t evs_initialize (
  * Close the evs handle
  */
 evs_error_t evs_finalize (
-	evs_handle_t *handle);
+	evs_handle_t handle);
 
 /*
  * Get a file descriptor on which to poll.  evs_handle_t is NOT a
  * file descriptor and may not be used directly.
  */
 evs_error_t evs_fd_get (
-	evs_handle_t *handle,
+	evs_handle_t handle,
 	int *fd);
 
 /*
  * Dispatch messages and configuration changes
  */
 evs_error_t evs_dispatch (
-	evs_handle_t *handle,
+	evs_handle_t handle,
 	evs_dispatch_t dispatch_types);
 
 /*
@@ -121,7 +121,7 @@ evs_error_t evs_dispatch (
  * to a group that has been previously joined will be delivered in evs_dispatch
  */
 evs_error_t evs_join (
-	evs_handle_t *handle,
+	evs_handle_t handle,
 	struct evs_group *groups,
 	int group_cnt);
 
@@ -129,7 +129,7 @@ evs_error_t evs_join (
  * Leave one or more groups
  */
 evs_error_t evs_leave (
-	evs_handle_t *handle,
+	evs_handle_t handle,
 	struct evs_group *groups,
 	int group_cnt);
 
@@ -139,7 +139,7 @@ evs_error_t evs_leave (
  * the evs_join interface for handle.
  */
 evs_error_t evs_mcast_joined (
-	evs_handle_t *handle,
+	evs_handle_t handle,
 	evs_guarantee_t guarantee,
 	struct iovec *iovec,
 	int iov_len);
@@ -150,7 +150,7 @@ evs_error_t evs_mcast_joined (
  * that have been joined (unless they are in the groups parameter).
  */
 evs_error_t evs_mcast_groups (
-	evs_handle_t *handle,
+	evs_handle_t handle,
 	evs_guarantee_t guarantee,
 	struct evs_group *groups,
 	int group_cnt,

+ 23 - 23
lib/evs.c

@@ -148,12 +148,12 @@ error_no_destroy:
 }
 
 evs_error_t evs_finalize (
-	evs_handle_t *handle)
+	evs_handle_t handle)
 {
 	struct evs_inst *evs_inst;
 	SaErrorT error;
 
-	error = saHandleInstanceGet (&evs_handle_t_db, *handle, (void *)&evs_inst);
+	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
 	if (error != SA_OK) {
 		return (error);
 	}
@@ -162,7 +162,7 @@ evs_error_t evs_finalize (
 	 */
 	if (evs_inst->finalize) {
 		pthread_mutex_unlock (&evs_inst->mutex);
-		saHandleInstancePut (&evs_handle_t_db, *handle);
+		saHandleInstancePut (&evs_handle_t_db, handle);
 		return (EVS_ERR_BAD_HANDLE);
 	}
 
@@ -172,28 +172,28 @@ evs_error_t evs_finalize (
 
 	pthread_mutex_unlock (&evs_inst->mutex);
 
-	saHandleInstancePut (&evs_handle_t_db, *handle);
+	saHandleInstancePut (&evs_handle_t_db, handle);
 
-	saHandleDestroy (&evs_handle_t_db, *handle);
+	saHandleDestroy (&evs_handle_t_db, handle);
 
 	return (EVS_OK);
 }
 
 evs_error_t evs_fd_get (
-	evs_handle_t *handle,
+	evs_handle_t handle,
 	int *fd)
 {
 	SaErrorT error;
 	struct evs_inst *evs_inst;
 
-	error = saHandleInstanceGet (&evs_handle_t_db, *handle, (void *)&evs_inst);
+	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
 	if (error != SA_OK) {
 		return (error);
 	}
 
 	*fd = evs_inst->fd; 
 
-	saHandleInstancePut (&evs_handle_t_db, *handle);
+	saHandleInstancePut (&evs_handle_t_db, handle);
 
 	return (SA_OK);
 }
@@ -204,7 +204,7 @@ struct message_overlay {
 };
 
 evs_error_t evs_dispatch (
-	evs_handle_t *handle,
+	evs_handle_t handle,
 	evs_dispatch_t dispatch_types)
 {
 	struct pollfd ufds;
@@ -223,7 +223,7 @@ evs_error_t evs_dispatch (
 	struct res_header *msg = NULL;
 	int ignore_dispatch = 0;
 
-	error = saHandleInstanceGet (&evs_handle_t_db, *handle, (void *)&evs_inst);
+	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
 	if (error != SA_OK) {
 		return (error);
 	}
@@ -373,13 +373,13 @@ evs_error_t evs_dispatch (
 	} while (cont);
 
 error_unlock:
-	saHandleInstancePut (&evs_handle_t_db, *handle);
+	saHandleInstancePut (&evs_handle_t_db, handle);
 error_nounlock:
 	return (error);
 }
 
 evs_error_t evs_join (
-    evs_handle_t *handle,
+    evs_handle_t handle,
     struct evs_group *groups,
 	int group_entries)
 {
@@ -389,7 +389,7 @@ evs_error_t evs_join (
 	struct req_lib_evs_join req_lib_evs_join;
 	struct res_lib_evs_join res_lib_evs_join;
 
-	error = saHandleInstanceGet (&evs_handle_t_db, *handle, (void *)&evs_inst);
+	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
 	if (error != SA_OK) {
 		return (error);
 	}
@@ -417,13 +417,13 @@ evs_error_t evs_join (
 	error = res_lib_evs_join.header.error;
 
 error_exit:
-	saHandleInstancePut (&evs_handle_t_db, *handle);
+	saHandleInstancePut (&evs_handle_t_db, handle);
 
 	return (error);
 }
 
 evs_error_t evs_leave (
-    evs_handle_t *handle,
+    evs_handle_t handle,
     struct evs_group *groups,
 	int group_entries)
 {
@@ -433,7 +433,7 @@ evs_error_t evs_leave (
 	struct req_lib_evs_leave req_lib_evs_leave;
 	struct res_lib_evs_leave res_lib_evs_leave;
 
-	error = saHandleInstanceGet (&evs_handle_t_db, *handle, (void *)&evs_inst);
+	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
 	if (error != SA_OK) {
 		return (error);
 	}
@@ -461,13 +461,13 @@ evs_error_t evs_leave (
 	error = res_lib_evs_leave.header.error;
 
 error_exit:
-	saHandleInstancePut (&evs_handle_t_db, *handle);
+	saHandleInstancePut (&evs_handle_t_db, handle);
 
 	return (error);
 }
 
 evs_error_t evs_mcast_joined (
-	evs_handle_t *handle,
+	evs_handle_t handle,
 	evs_guarantee_t guarantee,
 	struct iovec *iovec,
 	int iov_len)
@@ -480,7 +480,7 @@ evs_error_t evs_mcast_joined (
 	struct res_lib_evs_mcast_joined res_lib_evs_mcast_joined;
 	int msg_len = 0;
 
-	error = saHandleInstanceGet (&evs_handle_t_db, *handle, (void *)&evs_inst);
+	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
 	if (error != SA_OK) {
 		return (error);
 	}
@@ -514,13 +514,13 @@ evs_error_t evs_mcast_joined (
 	error = res_lib_evs_mcast_joined.header.error;
 
 error_exit:
-	saHandleInstancePut (&evs_handle_t_db, *handle);
+	saHandleInstancePut (&evs_handle_t_db, handle);
 
 	return (error);
 }
 
 evs_error_t evs_mcast_groups (
-	evs_handle_t *handle,
+	evs_handle_t handle,
 	evs_guarantee_t guarantee,
 	struct evs_group *groups,
 	int group_entries,
@@ -535,7 +535,7 @@ evs_error_t evs_mcast_groups (
 	struct res_lib_evs_mcast_groups res_lib_evs_mcast_groups;
 	int msg_len = 0;
 
-	error = saHandleInstanceGet (&evs_handle_t_db, *handle, (void *)&evs_inst);
+	error = saHandleInstanceGet (&evs_handle_t_db, handle, (void *)&evs_inst);
 	if (error != SA_OK) {
 		return (error);
 	}
@@ -569,7 +569,7 @@ evs_error_t evs_mcast_groups (
 	error = res_lib_evs_mcast_groups.header.error;
 
 error_exit:
-	saHandleInstancePut (&evs_handle_t_db, *handle);
+	saHandleInstancePut (&evs_handle_t_db, handle);
 
 	return (error);
 }

+ 1 - 1
man/evs_dispatch.3

@@ -37,7 +37,7 @@ evs_dispatch \- Dispatches callbacks from the EVS service
 .SH SYNOPSIS
 .B #include <openais/evs.h>
 .sp
-.BI "int evs_dispatch(evs_handle_t *" handle ", evs_dispatch_t *" dispatch_types ");
+.BI "int evs_dispatch(evs_handle_t " handle ", evs_dispatch_t *" dispatch_types ");
 .SH DESCRIPTION
 The
 .B evs_dispatch

+ 1 - 1
man/evs_fd_get.3

@@ -37,7 +37,7 @@ evs_fd_get \- Dispatches callbacks from the EVS service
 .SH SYNOPSIS
 .B #include <openais/evs.h>
 .sp
-.BI "int evs_fd_get(evs_handle_t *" handle ", int *" fd ");
+.BI "int evs_fd_get(evs_handle_t " handle ", int *" fd ");
 .SH DESCRIPTION
 The
 .B evs_fd_get

+ 1 - 1
man/evs_finalize.3

@@ -37,7 +37,7 @@ evs_finalize \- Terminate a connection to the EVS service
 .SH SYNOPSIS
 .B #include <openais/evs.h>
 .sp
-.BI "int evs_finalize(evs_handle_t *" handle ");
+.BI "int evs_finalize(evs_handle_t " handle ");
 .SH DESCRIPTION
 The
 .B evs_finalize

+ 1 - 1
man/evs_join.3

@@ -37,7 +37,7 @@ evs_join \- Joins one or more groups in the EVS library
 .SH SYNOPSIS
 .B #include <openais/evs.h>
 .sp
-.BI "int evs_join(evs_handle_t *" handle ", evs_group_t *" groups ", int " group_entries ");
+.BI "int evs_join(evs_handle_t " handle ", evs_group_t *" groups ", int " group_entries ");
 .SH DESCRIPTION
 The
 .B evs_join

+ 1 - 1
man/evs_leave.3

@@ -37,7 +37,7 @@ evs_leave \- Leave one or more groups in the EVS library
 .SH SYNOPSIS
 .B #include <openais/evs.h>
 .sp
-.BI "int evs_leave(evs_handle_t *" handle ", evs_group_t *" groups ", int group_entries);
+.BI "int evs_leave(evs_handle_t " handle ", evs_group_t *" groups ", int group_entries);
 .SH DESCRIPTION
 The
 .B evs_leave

+ 1 - 1
man/evs_mcast_groups.3

@@ -38,7 +38,7 @@ evs_join \- Multicast a message to selected groups
 .B #include <sys/uio.h>
 .B #include <openais/evs.h>
 .sp
-.BI "int evs_mcast_gruops(evs_handle_t *" handle ", evs_guraantee_t " guarantee ", evs_group_t *" groups ", int group_entries, struct iovec *" iovec ", int " iov_len ");
+.BI "int evs_mcast_gruops(evs_handle_t " handle ", evs_guraantee_t " guarantee ", evs_group_t *" groups ", int group_entries, struct iovec *" iovec ", int " iov_len ");
 .SH DESCRIPTION
 The
 .B evs_mcast_groups(3)

+ 1 - 1
man/evs_mcast_joined.3

@@ -38,7 +38,7 @@ evs_join \- Multicasts to all groups joined to an handle
 .B #include <sys/uio.h>
 .B #include <openais/evs.h>
 .sp
-.BI "int evs_mcast_joined(evs_handle_t *" handle ", evs_guraantee_t " guarantee ", struct iovec *" iovec ", int " iov_len ");
+.BI "int evs_mcast_joined(evs_handle_t " handle ", evs_guraantee_t " guarantee ", struct iovec *" iovec ", int " iov_len ");
 .SH DESCRIPTION
 The
 .B evs_mcast_joined

+ 4 - 4
test/evsbench.c

@@ -118,13 +118,13 @@ void evs_benchmark (evs_handle_t handle,
 	do {
 		sprintf (buffer, "This is message %d\n", write_count);
 try_again:
-		result = evs_mcast_joined (&handle, EVS_TYPE_AGREED, &iov, 1);
+		result = evs_mcast_joined (handle, EVS_TYPE_AGREED, &iov, 1);
 		if (result == EVS_ERR_TRY_AGAIN) {
 			goto try_again;
 		} else {
 			write_count += 1;
 		}
-		result = evs_dispatch (&handle, EVS_DISPATCH_ALL);
+		result = evs_dispatch (handle, EVS_DISPATCH_ALL);
 	} while (alarm_notice == 0);
 	gettimeofday (&tv2, NULL);
 	timersub (&tv2, &tv1, &tv_elapsed);
@@ -156,9 +156,9 @@ int main (void) {
 
 	result = evs_initialize (&handle, &callbacks);
 	printf ("Init result %d\n", result);
-	result = evs_join (&handle, groups, 3);
+	result = evs_join (handle, groups, 3);
 	printf ("Join result %d\n", result);
-	result = evs_leave (&handle, &groups[0], 1);
+	result = evs_leave (handle, &groups[0], 1);
 	printf ("Leave result %d\n", result);
 
 	size = 1;

+ 10 - 10
test/testevs.c

@@ -105,9 +105,9 @@ int main (void)
 		exit (0);
 	}
 	printf ("Init result %d\n", result);
-	result = evs_join (&handle, groups, 3);
+	result = evs_join (handle, groups, 3);
 	printf ("Join result %d\n", result);
-	result = evs_leave (&handle, &groups[0], 1);
+	result = evs_leave (handle, &groups[0], 1);
 	printf ("Leave result %d\n", result);
 	delivery_string = "evs_mcast_joined";
 
@@ -123,16 +123,16 @@ int main (void)
 			i, i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i,  i);
 #endif
 try_again_one:
-		result = evs_mcast_joined (&handle, EVS_TYPE_AGREED,
+		result = evs_mcast_joined (handle, EVS_TYPE_AGREED,
 			&iov, 1);
 		if (result == EVS_ERR_TRY_AGAIN) {
 			goto try_again_one;
 		}
-		result = evs_dispatch (&handle, EVS_DISPATCH_ALL);
+		result = evs_dispatch (handle, EVS_DISPATCH_ALL);
 	}
 
 	do {
-		result = evs_dispatch (&handle, EVS_DISPATCH_ALL);
+		result = evs_dispatch (handle, EVS_DISPATCH_ALL);
 	} while (deliveries < 20);
 	/*
 	 * Demonstrate evs_mcast_joined
@@ -141,24 +141,24 @@ try_again_one:
 	for (i = 0; i < 500; i++) {
 		sprintf (buffer, "evs_mcast_groups: This is message %d", i);
 try_again_two:
-		result = evs_mcast_groups (&handle, EVS_TYPE_AGREED,
+		result = evs_mcast_groups (handle, EVS_TYPE_AGREED,
 			 &groups[1], 1, &iov, 1);
 		if (result == EVS_ERR_TRY_AGAIN) {
 			goto try_again_two;
 		}
 	
-		result = evs_dispatch (&handle, EVS_DISPATCH_ALL);
+		result = evs_dispatch (handle, EVS_DISPATCH_ALL);
 	}
 	/*
 	 * Flush any pending callbacks
 	 */
 	do {
-		result = evs_dispatch (&handle, EVS_DISPATCH_ALL);
+		result = evs_dispatch (handle, EVS_DISPATCH_ALL);
 	} while (deliveries < 900);
 
-	evs_fd_get (&handle, &fd);
+	evs_fd_get (handle, &fd);
 	
-	evs_finalize (&handle);
+	evs_finalize (handle);
 
 	return (0);
 }