Re: [PATCH 1/3] corotypes: drop deprecated EVS_ defines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




Revieweed-by: Steven Dake <sdake@xxxxxxxxxx>

On 02/08/2012 03:44 AM, Fabio M. Di Nitto wrote:
> From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx>
> 
> none of our current dependencies use it.
> 
> Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx>
> ---
>  include/corosync/corotypes.h |   18 ------------------
>  lib/evs.c                    |   42 +++++++++++++++++++++---------------------
>  man/evs_context_get.3        |    2 +-
>  man/evs_context_set.3        |    2 +-
>  man/evs_dispatch.3           |   16 ++++++++--------
>  man/evs_fd_get.3             |    2 +-
>  man/evs_finalize.3           |    2 +-
>  man/evs_initialize.3         |    2 +-
>  man/evs_join.3               |    2 +-
>  man/evs_leave.3              |    2 +-
>  man/evs_mcast_groups.3       |    2 +-
>  man/evs_mcast_joined.3       |    2 +-
>  test/testevsth.c             |   14 +++++++-------
>  13 files changed, 45 insertions(+), 63 deletions(-)
> 
> diff --git a/include/corosync/corotypes.h b/include/corosync/corotypes.h
> index c67bf29..3ec7ab2 100644
> --- a/include/corosync/corotypes.h
> +++ b/include/corosync/corotypes.h
> @@ -214,24 +214,6 @@ static inline cs_error_t qb_to_cs_error (int result)
>  /*
>   * DEPRECATED
>   */
> -#define EVS_DISPATCH_ONE			CS_DISPATCH_ONE
> -#define EVS_DISPATCH_ALL			CS_DISPATCH_ALL
> -#define EVS_DISPATCH_BLOCKING		CS_DISPATCH_BLOCKING
> -#define EVS_OK						CS_OK
> -#define EVS_ERR_LIBRARY				CS_ERR_LIBRARY
> -#define EVS_ERR_TIMEOUT				CS_ERR_TIMEOUT
> -#define EVS_ERR_TRY_AGAIN			CS_ERR_TRY_AGAIN
> -#define EVS_ERR_INVALID_PARAM		CS_ERR_INVALID_PARAM
> -#define EVS_ERR_NO_MEMORY			CS_ERR_NO_MEMORY
> -#define EVS_ERR_BAD_HANDLE			CS_ERR_BAD_HANDLE
> -#define EVS_ERR_ACCESS				CS_ERR_ACCESS
> -#define EVS_ERR_NOT_EXIST			CS_ERR_NOT_EXIST
> -#define EVS_ERR_EXIST				CS_ERR_EXIST
> -#define EVS_ERR_NOT_SUPPORTED		CS_ERR_NOT_SUPPORTED
> -#define EVS_ERR_SECURITY			CS_ERR_SECURITY
> -#define EVS_ERR_TOO_MANY_GROUPS		CS_ERR_TOO_MANY_GROUPS
> -#define evs_error_t cs_error_t
> -
>  #define CPG_DISPATCH_ONE			CS_DISPATCH_ONE
>  #define CPG_DISPATCH_ALL			CS_DISPATCH_ALL
>  #define CPG_DISPATCH_BLOCKING		CS_DISPATCH_BLOCKING
> diff --git a/lib/evs.c b/lib/evs.c
> index 0f9daf1..a5003ad 100644
> --- a/lib/evs.c
> +++ b/lib/evs.c
> @@ -82,9 +82,9 @@ DECLARE_HDB_DATABASE (evs_handle_t_db,NULL);
>   * test
>   * @param handle The handle of evs initialize
>   * @param callbacks The callbacks for evs_initialize
> - * @returns EVS_OK
> + * @returns CS_OK
>   */
> -evs_error_t evs_initialize (
> +cs_error_t evs_initialize (
>  	evs_handle_t *handle,
>  	evs_callbacks_t *callbacks)
>  {
> @@ -123,7 +123,7 @@ error_no_destroy:
>  	return (error);
>  }
>  
> -evs_error_t evs_finalize (
> +cs_error_t evs_finalize (
>  	evs_handle_t handle)
>  {
>  	struct evs_inst *evs_inst;
> @@ -139,7 +139,7 @@ evs_error_t evs_finalize (
>  	 */
>  	if (evs_inst->finalize) {
>  		hdb_handle_put (&evs_handle_t_db, handle);
> -		return (EVS_ERR_BAD_HANDLE);
> +		return (CS_ERR_BAD_HANDLE);
>  	}
>  
>  	evs_inst->finalize = 1;
> @@ -150,10 +150,10 @@ evs_error_t evs_finalize (
>  
>  	hdb_handle_put (&evs_handle_t_db, handle);
>  
> -	return (EVS_OK);
> +	return (CS_OK);
>  }
>  
> -evs_error_t evs_fd_get (
> +cs_error_t evs_fd_get (
>  	evs_handle_t handle,
>  	int *fd)
>  {
> @@ -172,7 +172,7 @@ evs_error_t evs_fd_get (
>  	return (CS_OK);
>  }
>  
> -evs_error_t evs_context_get (
> +cs_error_t evs_context_get (
>  	evs_handle_t handle,
>  	void **context)
>  {
> @@ -210,7 +210,7 @@ cs_error_t evs_context_set (
>  	return (CS_OK);
>  }
>  
> -evs_error_t evs_dispatch (
> +cs_error_t evs_dispatch (
>  	evs_handle_t handle,
>  	cs_dispatch_flags_t dispatch_types)
>  {
> @@ -233,7 +233,7 @@ evs_error_t evs_dispatch (
>  	 * Timeout instantly for CS_DISPATCH_ONE or CS_DISPATCH_ALL and
>  	 * wait indefinately for CS_DISPATCH_BLOCKING
>  	 */
> -	if (dispatch_types == EVS_DISPATCH_ALL) {
> +	if (dispatch_types == CS_DISPATCH_ALL) {
>  		timeout = 0;
>  	}
>  
> @@ -250,7 +250,7 @@ evs_error_t evs_dispatch (
>  		}
>  		if (error == CS_ERR_TRY_AGAIN) {
>  			error = CS_OK;
> -			if (dispatch_types == CPG_DISPATCH_ALL) {
> +			if (dispatch_types == CS_DISPATCH_ALL) {
>  				break; /* exit do while cont is 1 loop */
>  			} else {
>  				continue; /* next poll */
> @@ -320,19 +320,19 @@ error_put:
>  	return (error);
>  }
>  
> -evs_error_t evs_join (
> +cs_error_t evs_join (
>      evs_handle_t handle,
>      const struct evs_group *groups,
>      size_t group_entries)
>  {
> -	evs_error_t error;
> +	cs_error_t error;
>  	struct evs_inst *evs_inst;
>  	struct iovec iov[2];
>  	struct req_lib_evs_join req_lib_evs_join;
>  	struct res_lib_evs_join res_lib_evs_join;
>  
>  	error = hdb_error_to_cs(hdb_handle_get (&evs_handle_t_db, handle, (void *)&evs_inst));
> -	if (error != EVS_OK) {
> +	if (error != CS_OK) {
>  		return (error);
>  	}
>  
> @@ -361,12 +361,12 @@ error_exit:
>  	return (error);
>  }
>  
> -evs_error_t evs_leave (
> +cs_error_t evs_leave (
>      evs_handle_t handle,
>      const struct evs_group *groups,
>      size_t group_entries)
>  {
> -	evs_error_t error;
> +	cs_error_t error;
>  	struct evs_inst *evs_inst;
>  	struct iovec iov[2];
>  	struct req_lib_evs_leave req_lib_evs_leave;
> @@ -402,14 +402,14 @@ error_exit:
>  	return (error);
>  }
>  
> -evs_error_t evs_mcast_joined (
> +cs_error_t evs_mcast_joined (
>  	evs_handle_t handle,
>  	evs_guarantee_t guarantee,
>  	const struct iovec *iovec,
>  	unsigned int iov_len)
>  {
>  	int i;
> -	evs_error_t error;
> +	cs_error_t error;
>  	struct evs_inst *evs_inst;
>  	struct iovec iov[64];
>  	struct req_lib_evs_mcast_joined req_lib_evs_mcast_joined;
> @@ -453,7 +453,7 @@ error_exit:
>  	return (error);
>  }
>  
> -evs_error_t evs_mcast_groups (
> +cs_error_t evs_mcast_groups (
>  	evs_handle_t handle,
>  	evs_guarantee_t guarantee,
>  	const struct evs_group *groups,
> @@ -462,7 +462,7 @@ evs_error_t evs_mcast_groups (
>  	unsigned int iov_len)
>  {
>  	int i;
> -	evs_error_t error;
> +	cs_error_t error;
>  	struct evs_inst *evs_inst;
>  	struct iovec iov[64]; /* FIXME: what if iov_len > 62 ?  use malloc */
>  	struct req_lib_evs_mcast_groups req_lib_evs_mcast_groups;
> @@ -506,13 +506,13 @@ error_exit:
>  	return (error);
>  }
>  
> -evs_error_t evs_membership_get (
> +cs_error_t evs_membership_get (
>  	evs_handle_t handle,
>  	unsigned int *local_nodeid,
>  	unsigned int *member_list,
>  	size_t *member_list_entries)
>  {
> -	evs_error_t error;
> +	cs_error_t error;
>  	struct evs_inst *evs_inst;
>  	struct iovec iov;
>  	struct req_lib_evs_membership_get req_lib_evs_membership_get;
> diff --git a/man/evs_context_get.3 b/man/evs_context_get.3
> index 8712336..9ef4d3a 100644
> --- a/man/evs_context_get.3
> +++ b/man/evs_context_get.3
> @@ -44,7 +44,7 @@ The
>  function is used to retrieve the context variable previously stored using
>  .B evs_context_set(3)
>  .SH RETURN VALUE
> -This call returns the EVS_OK value if successful, otherwise an error is returned.
> +This call returns the CS_OK value if successful, otherwise an error is returned.
>  .PP
>  .SH ERRORS
>  The errors are undocumented.
> diff --git a/man/evs_context_set.3 b/man/evs_context_set.3
> index a4c40b8..19d279f 100644
> --- a/man/evs_context_set.3
> +++ b/man/evs_context_set.3
> @@ -46,7 +46,7 @@ meaning insire libevs itself and will not be touched by the library. It can
>  be retrieved using
>  .B evs_context_get(3)
>  .SH RETURN VALUE
> -This call returns the EVS_OK value if successful, otherwise an error is returned.
> +This call returns the CS_OK value if successful, otherwise an error is returned.
>  .PP
>  .SH ERRORS
>  The errors are undocumented.
> diff --git a/man/evs_dispatch.3 b/man/evs_dispatch.3
> index fce509f..e6e7af0 100644
> --- a/man/evs_dispatch.3
> +++ b/man/evs_dispatch.3
> @@ -60,10 +60,10 @@ defined by the structure:
>  .nf
>  .ta 4n 30n 33n
>  typedef enum {
> -        EVS_DISPATCH_ONE,
> -        EVS_DISPATCH_ALL,
> -        EVS_DISPATCH_BLOCKING
> -} evs_dispatch_t;
> +        CS_DISPATCH_ONE,
> +        CS_DISPATCH_ALL,
> +        CS_DISPATCH_BLOCKING
> +} cs_dispatch_flags_t;
>  .ta
>  .fi
>  .RE
> @@ -72,19 +72,19 @@ typedef enum {
>  .PP
>  The dispatch values have the following meanings:
>  .TP
> -.B EVS_DISPATCH_ONE
> +.B CS_DISPATCH_ONE
>  Dispatch atleast one callback, blocking until the callback is dispatched.
>  .TP
> -.B EVS_DISPATCH_ALL
> +.B CS_DISPATCH_ALL
>  Dispatch all waiting callbacks without blocking to wait for any callbacks.
>  .TP
> -.B EVS_DISPATCH_BLOCKING
> +.B CS_DISPATCH_BLOCKING
>  Dispatch all callbacks blocking indefinately.  This is used in a threaded
>  program where a thread is created, and then evs_dispatch() is called immediately
>  from the created thread to execute callbacks.
>  
>  .SH RETURN VALUE
> -This call returns the EVS_OK value if successful, otherwise an error is returned.
> +This call returns the CS_OK value if successful, otherwise an error is returned.
>  .PP
>  .SH ERRORS
>  The errors are undocumented.
> diff --git a/man/evs_fd_get.3 b/man/evs_fd_get.3
> index bf48c58..ece9036 100644
> --- a/man/evs_fd_get.3
> +++ b/man/evs_fd_get.3
> @@ -51,7 +51,7 @@ argument may not be used directly with
>  because it is not the file descriptor, but instead an internal identifier used
>  by the EVS library.
>  .SH RETURN VALUE
> -This call returns the EVS_OK value if successful, otherwise an error is returned.
> +This call returns the CS_OK value if successful, otherwise an error is returned.
>  .PP
>  .SH ERRORS
>  The errors are undocumented.
> diff --git a/man/evs_finalize.3 b/man/evs_finalize.3
> index c6f1549..cc2c697 100644
> --- a/man/evs_finalize.3
> +++ b/man/evs_finalize.3
> @@ -47,7 +47,7 @@ No more callbacks will be dispatched from the
>  .B evs_dispatch function.
>  .PP
>  .SH RETURN VALUE
> -This call returns the EVS_OK value if successful, otherwise an error is returned.
> +This call returns the CS_OK value if successful, otherwise an error is returned.
>  .PP
>  .SH ERRORS
>  The errors are undocumented.
> diff --git a/man/evs_initialize.3 b/man/evs_initialize.3
> index fb17651..c5bd4dd 100644
> --- a/man/evs_initialize.3
> +++ b/man/evs_initialize.3
> @@ -102,7 +102,7 @@ is called.  If a delivery of a message occurs,
>  is called.
>  
>  .SH RETURN VALUE
> -This call returns the EVS_OK value if successful, otherwise an error is returned.
> +This call returns the CS_OK value if successful, otherwise an error is returned.
>  .PP
>  .SH ERRORS
>  The errors are undocumented.
> diff --git a/man/evs_join.3 b/man/evs_join.3
> index 65091fa..e6338d4 100644
> --- a/man/evs_join.3
> +++ b/man/evs_join.3
> @@ -86,7 +86,7 @@ typedef struct {
>  .PP
>  .PP
>  .SH RETURN VALUE
> -This call returns the EVS_OK value if successful, otherwise an error is returned.
> +This call returns the CS_OK value if successful, otherwise an error is returned.
>  .PP
>  .SH ERRORS
>  The errors are undocumented.
> diff --git a/man/evs_leave.3 b/man/evs_leave.3
> index 396c42a..09ffe8e 100644
> --- a/man/evs_leave.3
> +++ b/man/evs_leave.3
> @@ -81,7 +81,7 @@ typedef struct {
>  .IP
>  .PP
>  .SH RETURN VALUE
> -This call returns the EVS_OK value if successful, otherwise an error is returned.
> +This call returns the CS_OK value if successful, otherwise an error is returned.
>  .PP
>  .SH ERRORS
>  The errors are undocumented.
> diff --git a/man/evs_mcast_groups.3 b/man/evs_mcast_groups.3
> index 2706eb3..4bb5c00 100644
> --- a/man/evs_mcast_groups.3
> +++ b/man/evs_mcast_groups.3
> @@ -145,7 +145,7 @@ argument describes the number of entires in the
>  argument.
>  
>  .SH RETURN VALUE
> -This call returns the EVS_OK value if successful, otherwise an error is returned.
> +This call returns the CS_OK value if successful, otherwise an error is returned.
>  .PP
>  .SH ERRORS
>  The errors are undocumented.
> diff --git a/man/evs_mcast_joined.3 b/man/evs_mcast_joined.3
> index 9f748d1..4d7d78e 100644
> --- a/man/evs_mcast_joined.3
> +++ b/man/evs_mcast_joined.3
> @@ -118,7 +118,7 @@ argument describes the number of entires in the
>  argument.
>  
>  .SH RETURN VALUE
> -This call returns the EVS_OK value if successful, otherwise an error is returned.
> +This call returns the CS_OK value if successful, otherwise an error is returned.
>  .PP
>  .SH ERRORS
>  The errors are undocumented.
> diff --git a/test/testevsth.c b/test/testevsth.c
> index 9f8e5f6..14da44f 100644
> --- a/test/testevsth.c
> +++ b/test/testevsth.c
> @@ -103,11 +103,11 @@ struct iovec iov = {
>  
>  void *th_dispatch (void *arg)
>  {
> -	evs_error_t result;
> +	cs_error_t result;
>  	evs_handle_t handle = *(evs_handle_t *)arg;
>  
>  	printf ("THREAD DISPATCH starting.\n");
> -	result = evs_dispatch (handle, EVS_DISPATCH_BLOCKING);
> +	result = evs_dispatch (handle, CS_DISPATCH_BLOCKING);
>  	printf ("THREAD DISPATCH return result is %d\n", result);
>  	return (0);
>  }
> @@ -119,13 +119,13 @@ static struct sched_param sched_param = {
>  int main (void)
>  {
>  	evs_handle_t handle;
> -	evs_error_t result;
> +	cs_error_t result;
>  	int i = 0;
>  	pthread_t dispatch_thread;
>  	pthread_attr_t dispatch_thread_attribute;
>  
>  	result = evs_initialize (&handle, &callbacks);
> -	if (result != EVS_OK) {
> +	if (result != CS_OK) {
>  		printf ("Couldn't initialize EVS service %d\n", result);
>  		exit (0);
>  	}
> @@ -150,10 +150,10 @@ int main (void)
>  		sprintf (buffer, "evs_mcast_joined: This is message %d", i);
>  try_again_one:
>  		result = evs_mcast_joined (handle, EVS_TYPE_AGREED, &iov, 1);
> -		if (result == EVS_ERR_TRY_AGAIN) {
> +		if (result == CS_ERR_TRY_AGAIN) {
>  			goto try_again_one;
>  		} else
> -		if (result != EVS_OK) {
> +		if (result != CS_OK) {
>  			printf ("Got error result, exiting %d\n", result);
>  			exit (1);
>  		}
> @@ -168,7 +168,7 @@ try_again_one:
>  try_again_two:
>  		result = evs_mcast_groups (handle, EVS_TYPE_AGREED,
>  			 &groups[1], 1, &iov, 1);
> -		if (result == EVS_ERR_TRY_AGAIN) {
> +		if (result == CS_ERR_TRY_AGAIN) {
>  			goto try_again_two;
>  		}
>  	}

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Corosync Project]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Add to Google Powered by Linux