Re: [PATCH 2/5] move hdb_error_to_cs to common_lib

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




This looks good

On 02/07/2012 05:43 PM, Angus Salkeld wrote:
> Note the previous inconsistent implementation.
> 
> Signed-off-by: Angus Salkeld <asalkeld@xxxxxxxxxx>
> ---
>  common_lib/error_conversion.c |   17 +++++++++++++++++
>  exec/util.h                   |   21 +--------------------
>  lib/util.h                    |    2 +-
>  3 files changed, 19 insertions(+), 21 deletions(-)
> 
> diff --git a/common_lib/error_conversion.c b/common_lib/error_conversion.c
> index 7b2b6ef..d3383c0 100644
> --- a/common_lib/error_conversion.c
> +++ b/common_lib/error_conversion.c
> @@ -77,4 +77,21 @@ cs_error_t qb_to_cs_error (int result)
>  	return err;
>  }
>  
> +cs_error_t hdb_error_to_cs (int res)
> +{
> +	if (res == 0) {
> +		return (CS_OK);
> +	} else {
> +		if (res == -EBADF) {
> +			return (CS_ERR_BAD_HANDLE);
> +		} else if (res == -ENOMEM) {
> +			return (CS_ERR_NO_MEMORY);
> +		} else 	if (res == -EMFILE) {
> +			return (CS_ERR_NO_RESOURCES);
> +		} else	if (res == -EACCES) {
> +			return (CS_ERR_ACCESS);
> +		}
> +		return (CS_ERR_LIBRARY);
> +	}
> +}
>  
> diff --git a/exec/util.h b/exec/util.h
> index 78777ed..9f418bb 100644
> --- a/exec/util.h
> +++ b/exec/util.h
> @@ -67,26 +67,7 @@ enum e_corosync_done {
>  	COROSYNC_DONE_SERVICE_ENGINE_INIT = 20
>  };
>  
> -static inline cs_error_t hdb_error_to_cs (int res)		\
> -{								\
> -	if (res == 0) {						\
> -		return (CS_OK);					\
> -	} else {						\
> -		if (res == -EBADF) {				\
> -			return (CS_ERR_BAD_HANDLE);		\
> -		} else						\
> -		if (res == -ENOMEM) {				\
> -			return (CS_ERR_NO_MEMORY);		\
> -		} else						\
> -		if (res == -EMFILE) {				\
> -			return (CS_ERR_NO_RESOURCES);		\
> -		} else						\
> -		if (res == -EACCES) {				\
> -			return (CS_ERR_ACCESS);			\
> -		}						\
> -		return (CS_ERR_LIBRARY);			\
> -	}							\
> -}
> +cs_error_t hdb_error_to_cs (int res);
>  
>  /**
>   * Compare two names.  returns non-zero on match.
> diff --git a/lib/util.h b/lib/util.h
> index 1d812fa..fd8e484 100644
> --- a/lib/util.h
> +++ b/lib/util.h
> @@ -38,7 +38,7 @@
>  
>  #include <corosync/corotypes.h>
>  
> -#define hdb_error_to_cs(_result_) qb_to_cs_error(_result_)
> +cs_error_t hdb_error_to_cs (int res);
>  
>  #ifdef HAVE_SMALL_MEMORY_FOOTPRINT
>  #define IPC_REQUEST_SIZE        1024*64

_______________________________________________
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