This patch essentially allows the passing of the scheduling policy in
addition to the parameters for the ipc threads.  It also removes a
private define from the global header file.  It also reformats the
global header file in a style consistent with the rest of the project.
Finally it constifies a void *msg which is constant in this case.

Regards
-steve
Index: include/corosync/coroipc_ipc.h
===================================================================
--- include/corosync/coroipc_ipc.h	(revision 2131)
+++ include/corosync/coroipc_ipc.h	(working copy)
@@ -109,6 +109,8 @@
 	uint64_t server_address;
 };
 
+#define SOCKET_SERVICE_INIT	0xFFFFFFFF
+
 #define ZC_ALLOC_HEADER		0xFFFFFFFF
 #define ZC_FREE_HEADER		0xFFFFFFFE
 #define ZC_EXECUTE_HEADER	0xFFFFFFFD
Index: include/corosync/coroipcs.h
===================================================================
--- include/corosync/coroipcs.h	(revision 2131)
+++ include/corosync/coroipcs.h	(working copy)
@@ -37,8 +37,6 @@
 
 #include <stdlib.h>
 
-#define SOCKET_SERVICE_INIT 0xFFFFFFFF
-
 struct iovec;
 
 typedef int (*coroipcs_init_fn_lvalue) (void *conn);
@@ -47,7 +45,8 @@
 
 struct coroipcs_init_state {
 	const char *socket_name;
-	int sched_priority;
+	int sched_policy;
+	const struct sched_param *sched_param;
 	void *(*malloc) (size_t size);
 	void (*free) (void *ptr);
         void (*log_printf) (
@@ -61,7 +60,7 @@
 	int (*response_size_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,
-		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 (*poll_accept_add)(int fd);
 	void (*poll_dispatch_add)(int fd, void *context);
@@ -77,15 +76,25 @@
 
 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);
 
@@ -93,8 +102,14 @@
 
 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 */
Index: exec/coroipcs.c
===================================================================
--- exec/coroipcs.c	(revision 2131)
+++ exec/coroipcs.c	(working copy)
@@ -522,11 +522,9 @@
 	int send_ok;
 	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 (;;) {
Index: exec/main.c
===================================================================
--- exec/main.c	(revision 2131)
+++ exec/main.c	(working copy)
@@ -568,7 +568,7 @@
 static int corosync_sending_allowed (
 	unsigned int service,
 	unsigned int id,
-	void *msg,
+	const void *msg,
 	void *sending_allowed_private_data)
 {
 	struct sending_allowed_private_data_struct *pd =
@@ -667,6 +667,8 @@
 
 struct coroipcs_init_state ipc_init_state = {
 	.socket_name			= COROSYNC_SOCKET_NAME,
+	.sched_policy			= SCHED_RR,
+	.sched_param			= &global_sched_param,
 	.malloc				= malloc,
 	.free				= free,
 	.log_printf			= ipc_log_printf,
@@ -964,8 +966,6 @@
 		corosync_exit_error (AIS_DONE_INIT_SERVICES);
 	}
 
-	ipc_init_state.sched_priority = sched_priority;
-
 	coroipcs_ipc_init (&ipc_init_state);
 
 	/*
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to