Răsfoiți Sursa

coroipcs.h cleanup.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2132 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 17 ani în urmă
părinte
comite
589d2ae1af
4 a modificat fișierele cu 35 adăugiri și 20 ștergeri
  1. 3 5
      exec/coroipcs.c
  2. 3 3
      exec/main.c
  3. 2 0
      include/corosync/coroipc_ipc.h
  4. 27 12
      include/corosync/coroipcs.h

+ 3 - 5
exec/coroipcs.c

@@ -522,11 +522,9 @@ static void *pthread_ipc_consumer (void *conn)
 	int send_ok;
 	int send_ok;
 	unsigned int new_message;
 	unsigned int new_message;
 
 
-	if (api->sched_priority != 0) {
-		struct sched_param sched_param;
-
-		sched_param.sched_priority = api->sched_priority;
-		res = pthread_setschedparam (conn_info->thread, SCHED_RR, &sched_param);
+	if (api->sched_policy != 0) {
+		res = pthread_setschedparam (conn_info->thread,
+			api->sched_policy, api->sched_param);
 	}
 	}
 
 
 	for (;;) {
 	for (;;) {

+ 3 - 3
exec/main.c

@@ -568,7 +568,7 @@ struct sending_allowed_private_data_struct {
 static int corosync_sending_allowed (
 static int corosync_sending_allowed (
 	unsigned int service,
 	unsigned int service,
 	unsigned int id,
 	unsigned int id,
-	void *msg,
+	const void *msg,
 	void *sending_allowed_private_data)
 	void *sending_allowed_private_data)
 {
 {
 	struct sending_allowed_private_data_struct *pd =
 	struct sending_allowed_private_data_struct *pd =
@@ -667,6 +667,8 @@ static void corosync_poll_dispatch_modify (
 
 
 struct coroipcs_init_state ipc_init_state = {
 struct coroipcs_init_state ipc_init_state = {
 	.socket_name			= COROSYNC_SOCKET_NAME,
 	.socket_name			= COROSYNC_SOCKET_NAME,
+	.sched_policy			= SCHED_RR,
+	.sched_param			= &global_sched_param,
 	.malloc				= malloc,
 	.malloc				= malloc,
 	.free				= free,
 	.free				= free,
 	.log_printf			= ipc_log_printf,
 	.log_printf			= ipc_log_printf,
@@ -964,8 +966,6 @@ int main (int argc, char **argv)
 		corosync_exit_error (AIS_DONE_INIT_SERVICES);
 		corosync_exit_error (AIS_DONE_INIT_SERVICES);
 	}
 	}
 
 
-	ipc_init_state.sched_priority = sched_priority;
-
 	coroipcs_ipc_init (&ipc_init_state);
 	coroipcs_ipc_init (&ipc_init_state);
 
 
 	/*
 	/*

+ 2 - 0
include/corosync/coroipc_ipc.h

@@ -109,6 +109,8 @@ struct coroipcs_zc_header {
 	uint64_t server_address;
 	uint64_t server_address;
 };
 };
 
 
+#define SOCKET_SERVICE_INIT	0xFFFFFFFF
+
 #define ZC_ALLOC_HEADER		0xFFFFFFFF
 #define ZC_ALLOC_HEADER		0xFFFFFFFF
 #define ZC_FREE_HEADER		0xFFFFFFFE
 #define ZC_FREE_HEADER		0xFFFFFFFE
 #define ZC_EXECUTE_HEADER	0xFFFFFFFD
 #define ZC_EXECUTE_HEADER	0xFFFFFFFD

+ 27 - 12
include/corosync/coroipcs.h

@@ -37,8 +37,6 @@
 
 
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-#define SOCKET_SERVICE_INIT 0xFFFFFFFF
-
 struct iovec;
 struct iovec;
 
 
 typedef int (*coroipcs_init_fn_lvalue) (void *conn);
 typedef int (*coroipcs_init_fn_lvalue) (void *conn);
@@ -47,7 +45,8 @@ typedef void (*coroipcs_handler_fn_lvalue) (void *conn, const void *msg);
 
 
 struct coroipcs_init_state {
 struct coroipcs_init_state {
 	const char *socket_name;
 	const char *socket_name;
-	int sched_priority;
+	int sched_policy;
+	const struct sched_param *sched_param;
 	void *(*malloc) (size_t size);
 	void *(*malloc) (size_t size);
 	void (*free) (void *ptr);
 	void (*free) (void *ptr);
         void (*log_printf) (
         void (*log_printf) (
@@ -61,7 +60,7 @@ struct coroipcs_init_state {
 	int (*response_size_get)(unsigned int service, unsigned int id);
 	int (*response_size_get)(unsigned int service, unsigned int id);
 	int (*response_id_get)(unsigned int service, unsigned int id);
 	int (*response_id_get)(unsigned int service, unsigned int id);
 	int (*sending_allowed)(unsigned int service, unsigned int id,
 	int (*sending_allowed)(unsigned int service, unsigned int id,
-		void *msg, void *sending_allowed_private_data);
+		const void *msg, void *sending_allowed_private_data);
 	void (*sending_allowed_release)(void *sending_allowed_private_data);
 	void (*sending_allowed_release)(void *sending_allowed_private_data);
 	void (*poll_accept_add)(int fd);
 	void (*poll_accept_add)(int fd);
 	void (*poll_dispatch_add)(int fd, void *context);
 	void (*poll_dispatch_add)(int fd, void *context);
@@ -77,15 +76,25 @@ 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, size_t mlen);
+extern int coroipcs_response_send (
+	void *conn,
+	const void *msg,
+	size_t mlen);
 
 
-extern int coroipcs_response_iov_send (void *conn,
-				       const struct iovec *iov, unsigned int iov_len);
+extern int coroipcs_response_iov_send (
+	void *conn,
+	const struct iovec *iov,
+	unsigned int iov_len);
 
 
-extern int coroipcs_dispatch_send (void *conn, const void *msg, size_t mlen);
+extern int coroipcs_dispatch_send (
+	void *conn,
+	const void *msg,
+	size_t mlen);
 
 
-extern int coroipcs_dispatch_iov_send (void *conn,
-				       const struct iovec *iov, unsigned int iov_len);
+extern int coroipcs_dispatch_iov_send (
+	void *conn,
+	const struct iovec *iov,
+	unsigned int iov_len);
 
 
 extern void coroipcs_refcount_inc (void *conn);
 extern void coroipcs_refcount_inc (void *conn);
 
 
@@ -93,8 +102,14 @@ extern void coroipcs_refcount_dec (void *conn);
 
 
 extern void coroipcs_ipc_exit (void);
 extern void coroipcs_ipc_exit (void);
 
 
-extern int coroipcs_handler_accept (int fd, int revent, void *context);
+extern int coroipcs_handler_accept (
+	int fd,
+	int revent,
+	void *context);
 
 
-extern int coroipcs_handler_dispatch (int fd, int revent, void *context);
+extern int coroipcs_handler_dispatch (
+	int fd,
+	int revent,
+	void *context);
 
 
 #endif /* COROIPCS_H_DEFINED */
 #endif /* COROIPCS_H_DEFINED */