[Openais] [PATCH corosync/trunk] allow coroipcs to work without calling stats initialization.

Steven Dake sdake at redhat.com
Mon Oct 12 14:35:06 PDT 2009


good for merge

regards
-steve

On Tue, 2009-10-13 at 10:36 +1300, angus salkeld wrote:
> On Mon, 2009-10-12 at 13:52 -0700, Steven Dake wrote:
> > see attached
> > 
> > allows coroipcs to work without calling stats initialization.
> 
> Thanks Steve.
> 
> Also update the prototype in main.c
> 
> Angus
> 
> Index: include/corosync/coroipcs.h
> ===================================================================
> --- include/corosync/coroipcs.h	(revision 2517)
> +++ include/corosync/coroipcs.h	(working copy)
> @@ -77,10 +77,10 @@
>  
>  struct coroipcs_init_stats_state {
>  	hdb_handle_t (*stats_create_connection) (const char* name,
> -			const pid_t pid, const int fd);
> +		pid_t pid, int fd);
>  	void (*stats_destroy_connection) (hdb_handle_t handle);
>  	void (*stats_update_value) (hdb_handle_t handle,
> -			const char* name, const void* value, const size_t value_len);
> +		const char *name, const void *value, size_t value_len);
>  	void (*stats_increment_value) (hdb_handle_t handle, const char* name);
>  };
>  
> Index: exec/coroipcs.c
> ===================================================================
> --- exec/coroipcs.c	(revision 2517)
> +++ exec/coroipcs.c	(working copy)
> @@ -173,6 +173,40 @@
>  static void msg_send (void *conn, const struct iovec *iov, unsigned int
> iov_len,
>  		      int locked);
>  
> +static hdb_handle_t dummy_stats_create_connection (
> +	const char *name,
> +	pid_t pid,
> +	int fd)
> +{
> +	return (0ULL);
> +}
> +
> +static void dummy_stats_destroy_connection (
> +	hdb_handle_t handle)
> +{
> +}
> +
> +static void dummy_stats_update_value (
> +	hdb_handle_t handle,
> +	const char *name,
> +	const void *value,
> +	size_t value_size)
> +{
> +}
> +
> +static void dummy_stats_increment_value (
> +	hdb_handle_t handle,
> +	const char *name)
> +{
> +}
> +
> +static struct coroipcs_init_stats_state dummy_init_stats_state = {
> +	.stats_create_connection	= dummy_stats_create_connection,
> +	.stats_destroy_connection	= dummy_stats_destroy_connection,
> +	.stats_update_value			= dummy_stats_update_value,
> +	.stats_increment_value		= dummy_stats_increment_value
> +};
> +
>  static void sem_post_exit_thread (struct conn_info *conn_info)
>  {
>  #if _POSIX_THREAD_PROCESS_SHARED < 1
> @@ -892,6 +926,8 @@
>  
>  	api = init_state;
>  
> +	stats_api = &dummy_init_stats_state;
> +
>  	/*
>  	 * Create socket for IPC clients, name socket, listen for connections
>  	 */
> @@ -1377,7 +1413,7 @@
>  	return (0);
>  }
>  
> -static char * pid_to_name (pid_t pid, char* out_name, size_t name_len)
> +static char * pid_to_name (pid_t pid, char *out_name, size_t name_len)
>  {
>  	char *name;
>  	char *rest;
> @@ -1422,7 +1458,7 @@
>  }
>  
>  static void coroipcs_init_conn_stats (
> -       struct conn_info * conn)
> +	struct conn_info *conn)
>  {
>  	char conn_name[42];
>  	char proc_name[32];
> Index: exec/main.c
> ===================================================================
> --- exec/main.c	(revision 2517)
> +++ exec/main.c	(working copy)
> @@ -1017,7 +1017,7 @@
>  
>  static void corosync_stats_update_value (hdb_handle_t handle,
>  										 const char *name, const void *value,
> -										 const size_t value_len)
> +										 size_t value_len)
>  {
>  	objdb->object_key_replace (handle,
>  		name, strlen(name),
> 
> 
> NOTICE: This message contains privileged and confidential
> information intended only for the use of the addressee
> named above. If you are not the intended recipient of
> this message you are hereby notified that you must not
> disseminate, copy or take any action in reliance on it.
> If you have received this message in error please
> notify Allied Telesis Labs Ltd immediately.
> Any views expressed in this message are those of the
> individual sender, except where the sender has the
> authority to issue and specifically states them to
> be the views of Allied Telesis Labs.



More information about the Openais mailing list