[openib-general] Re: [PATCH] kDAPL: remove the remaining typedef enums

James Lentini jlentini at netapp.com
Wed Jun 22 09:16:30 PDT 2005


Committed in revision 2672 with one minor change. I changed the 
DAPL_ASYNC_HANDLER_TYPE to be an enum dapl_async_handler_type for 
consistency.

On Thu, 16 Jun 2005, Tom Duffy wrote:

tduffy> This patch removes the last remaining typedef enums (minus bool
tduffy> which /might/ justify it).
tduffy> 
tduffy> Signed-off-by: Tom Duffy <tduffy at sun.com>
tduffy> 
tduffy> Index: linux-kernel/dat-provider/dapl_cookie.c
tduffy> ===================================================================
tduffy> --- linux-kernel/dat-provider/dapl_cookie.c	(revision 2640)
tduffy> +++ linux-kernel/dat-provider/dapl_cookie.c	(working copy)
tduffy> @@ -262,7 +262,8 @@ bail:
tduffy>   *	DAT_INSUFFICIENT_EMPTY
tduffy>   *
tduffy>   */
tduffy> -u32 dapl_dto_cookie_alloc(struct dapl_cookie_buffer *buffer, DAPL_DTO_TYPE type,
tduffy> +u32 dapl_dto_cookie_alloc(struct dapl_cookie_buffer *buffer,
tduffy> +			  enum dapl_dto_type type,
tduffy>  			  DAT_DTO_COOKIE user_cookie, 
tduffy>  			  struct dapl_cookie **cookie_ptr)
tduffy>  {
tduffy> Index: linux-kernel/dat-provider/dapl_openib_util.c
tduffy> ===================================================================
tduffy> --- linux-kernel/dat-provider/dapl_openib_util.c	(revision 2640)
tduffy> +++ linux-kernel/dat-provider/dapl_openib_util.c	(working copy)
tduffy> @@ -523,7 +523,7 @@ u32 dapl_ib_mw_unbind(struct dapl_rmr *r
tduffy>   *
tduffy>   */
tduffy>  u32 dapl_ib_setup_async_callback(struct dapl_ia *ia_ptr,
tduffy> -				 DAPL_ASYNC_HANDLER_TYPE handler_type,
tduffy> +				 enum async_handler_type handler_type,
tduffy>  				 ib_async_handler_t callback, void *context)
tduffy>  {
tduffy>  	int ib_status = 0;
tduffy> Index: linux-kernel/dat-provider/dapl_cookie.h
tduffy> ===================================================================
tduffy> --- linux-kernel/dat-provider/dapl_cookie.h	(revision 2640)
tduffy> +++ linux-kernel/dat-provider/dapl_cookie.h	(working copy)
tduffy> @@ -48,7 +48,8 @@ extern u32 dapl_rmr_cookie_alloc(struct 
tduffy>  				 struct dapl_cookie **cookie_ptr);
tduffy>  
tduffy>  extern u32 dapl_dto_cookie_alloc(struct dapl_cookie_buffer *buffer,
tduffy> -				 DAPL_DTO_TYPE type, DAT_DTO_COOKIE user_cookie,
tduffy> +				 enum dapl_dto_type type,
tduffy> +				 DAT_DTO_COOKIE user_cookie,
tduffy>  				 struct dapl_cookie **cookie_ptr);
tduffy>  
tduffy>  extern void dapl_cookie_dealloc(struct dapl_cookie_buffer *buffer,
tduffy> Index: linux-kernel/dat-provider/dapl_openib_util.h
tduffy> ===================================================================
tduffy> --- linux-kernel/dat-provider/dapl_openib_util.h	(revision 2640)
tduffy> +++ linux-kernel/dat-provider/dapl_openib_util.h	(working copy)
tduffy> @@ -36,11 +36,11 @@
tduffy>  #include "ib_verbs.h"
tduffy>  #include "ib_cm.h"
tduffy>  
tduffy> -typedef enum async_handler_type {
tduffy> +enum async_handler_type {
tduffy>  	DAPL_ASYNC_UNAFILIATED,
tduffy>  	DAPL_ASYNC_CQ_ERROR,
tduffy>  	DAPL_ASYNC_QP_ERROR
tduffy> -} DAPL_ASYNC_HANDLER_TYPE;
tduffy> +};
tduffy>  
tduffy>  /* alignment for the bus transfer from the HCA/IB chip to the main memory */
tduffy>  #define DAPL_OPTIMAL_ALIGNMENT   256
tduffy> @@ -76,7 +76,7 @@ u32 dapl_ib_accept_connection(struct dap
tduffy>  u32 dapl_ib_reject_connection(struct dapl_cm_ctx *cm_ctx);
tduffy>  
tduffy>  u32 dapl_ib_setup_async_callback(struct dapl_ia *ia,
tduffy> -				 DAPL_ASYNC_HANDLER_TYPE handler_type,
tduffy> +				 enum async_handler_type handler_type,
tduffy>  				 ib_async_handler_t callback, void *context);
tduffy>  
tduffy>  u32 dapl_ib_cq_alloc(struct dapl_ia *ia, struct dapl_evd *evd, int *cqlen, 
tduffy> Index: linux-kernel/dat-provider/dapl_ep.c
tduffy> ===================================================================
tduffy> --- linux-kernel/dat-provider/dapl_ep.c	(revision 2640)
tduffy> +++ linux-kernel/dat-provider/dapl_ep.c	(working copy)
tduffy> @@ -168,7 +168,7 @@ static u32 dapl_ep_post_send_req(struct 
tduffy>  				 DAT_DTO_COOKIE user_cookie,
tduffy>  				 const struct dat_rmr_triplet *remote_iov,
tduffy>  				 enum dat_completion_flags completion_flags,
tduffy> -				 DAPL_DTO_TYPE dto_type, 
tduffy> +				 enum dapl_dto_type dto_type, 
tduffy>  				 enum ib_wr_opcode op_type)
tduffy>  {
tduffy>  	struct dapl_ep *ep_ptr;
tduffy> Index: linux-kernel/dat-provider/dapl_util.c
tduffy> ===================================================================
tduffy> --- linux-kernel/dat-provider/dapl_util.c	(revision 2640)
tduffy> +++ linux-kernel/dat-provider/dapl_util.c	(working copy)
tduffy> @@ -36,7 +36,7 @@
tduffy>  
tduffy>  #ifdef DAPL_DBG
tduffy>  
tduffy> -void dapl_dbg_log(DAPL_DBG_TYPE type, const char *fmt, ...)
tduffy> +void dapl_dbg_log(enum dapl_dbg_type type, const char *fmt, ...)
tduffy>  {
tduffy>          char buf[1024];
tduffy>  	va_list args;
tduffy> Index: linux-kernel/dat-provider/dapl_evd.c
tduffy> ===================================================================
tduffy> --- linux-kernel/dat-provider/dapl_evd.c	(revision 2640)
tduffy> +++ linux-kernel/dat-provider/dapl_evd.c	(working copy)
tduffy> @@ -557,7 +557,7 @@ static void dapl_evd_wc_to_event(struct 
tduffy>  		/* We can not check the following assert for now */
tduffy>  		if (dto_status == DAT_DTO_SUCCESS) {
tduffy>  			enum ib_wc_opcode ib_opcode = wc->opcode;
tduffy> -			DAPL_DTO_TYPE dto_type = cookie->val.dto.type;
tduffy> +			enum dapl_dto_type dto_type = cookie->val.dto.type;
tduffy>  			dapl_os_assert((ib_opcode == IB_WC_SEND && 
tduffy>  					dto_type == DAPL_DTO_TYPE_SEND) ||
tduffy>  				       (ib_opcode == IB_WC_RECV && 
tduffy> @@ -877,7 +877,7 @@ void dapl_evd_connection_callback(struct
tduffy>  static void dapl_evd_dto_callback(struct ib_cq *cq, void *user_context)
tduffy>  {
tduffy>  	struct dapl_evd *evd;
tduffy> -	DAPL_EVD_STATE state;
tduffy> +	enum dapl_evd_state state;
tduffy>  	u32 status;
tduffy>  
tduffy>  	dapl_dbg_log(DAPL_DBG_TYPE_CALLBACK, "dapl_evd_dto_callback(%p, %p)\n",
tduffy> @@ -888,7 +888,7 @@ static void dapl_evd_dto_callback(struct
tduffy>  	dapl_os_assert(evd->cq == cq);
tduffy>  
tduffy>  	/* Read once.  */
tduffy> -	state = *(volatile DAPL_EVD_STATE *)&evd->evd_state;
tduffy> +	state = *(volatile enum dapl_evd_state *)&evd->evd_state;
tduffy>  
tduffy>  	dapl_dbg_log(DAPL_DBG_TYPE_EVD,
tduffy>  		     "dapl_evd_dto_callback: CQ %p, state %x\n",
tduffy> Index: linux-kernel/dat-provider/dapl_sp.c
tduffy> ===================================================================
tduffy> --- linux-kernel/dat-provider/dapl_sp.c	(revision 2640)
tduffy> +++ linux-kernel/dat-provider/dapl_sp.c	(working copy)
tduffy> @@ -624,7 +624,7 @@ u32 dapl_psp_free(struct dat_sp *dat_psp
tduffy>  {
tduffy>  	struct dapl_ia *ia;
tduffy>  	struct dapl_sp *sp;
tduffy> -	DAPL_SP_STATE save_state;
tduffy> +	enum dapl_sp_state save_state;
tduffy>  	u32 status = DAT_SUCCESS;
tduffy>  
tduffy>  	sp = (struct dapl_sp *)dat_psp;
tduffy> Index: linux-kernel/dat-provider/dapl_util.h
tduffy> ===================================================================
tduffy> --- linux-kernel/dat-provider/dapl_util.h	(revision 2640)
tduffy> +++ linux-kernel/dat-provider/dapl_util.h	(working copy)
tduffy> @@ -167,7 +167,7 @@ static inline long dapl_os_mod64(uint64_
tduffy>   * Use these bits to enable various tracing/debug options. Each bit
tduffy>   * represents debugging in a particular subsystem or area of the code.
tduffy>   */
tduffy> -typedef enum {
tduffy> +enum dapl_dbg_type {
tduffy>  	DAPL_DBG_TYPE_ERR = 0x0001,
tduffy>  	DAPL_DBG_TYPE_WARN = 0x0002,
tduffy>  	DAPL_DBG_TYPE_EVD = 0x0004,
tduffy> @@ -180,12 +180,12 @@ typedef enum {
tduffy>  	DAPL_DBG_TYPE_RTN = 0x0200,
tduffy>  	DAPL_DBG_TYPE_EXCEPTION = 0x0400,
tduffy>  	DAPL_DBG_TYPE_SRQ = 0x0800
tduffy> -} DAPL_DBG_TYPE;
tduffy> +};
tduffy>  
tduffy>  typedef int DAPL_DBG_MASK;
tduffy>  
tduffy>  #if defined(DAPL_DBG)
tduffy> -extern void dapl_dbg_log(DAPL_DBG_TYPE type, const char *fmt, ...);
tduffy> +extern void dapl_dbg_log(enum dapl_dbg_type type, const char *fmt, ...);
tduffy>  #else				/* !DAPL_DBG */
tduffy>  #define dapl_dbg_log(...)
tduffy>  #endif				/* DAPL_DBG */
tduffy> Index: linux-kernel/dat-provider/dapl.h
tduffy> ===================================================================
tduffy> --- linux-kernel/dat-provider/dapl.h	(revision 2640)
tduffy> +++ linux-kernel/dat-provider/dapl.h	(working copy)
tduffy> @@ -49,17 +49,17 @@
tduffy>   *                                                                   *
tduffy>   *********************************************************************/
tduffy>  
tduffy> -typedef enum dapl_evd_state {
tduffy> +enum dapl_evd_state {
tduffy>  	DAPL_EVD_STATE_OPEN,
tduffy>  	DAPL_EVD_STATE_DEAD = 0xDEAD
tduffy> -} DAPL_EVD_STATE;
tduffy> +};
tduffy>  
tduffy> -typedef enum dapl_evd_completion {
tduffy> +enum dapl_evd_completion {
tduffy>  	DAPL_EVD_STATE_INIT,
tduffy>  	DAPL_EVD_STATE_SOLICITED_WAIT,
tduffy>  	DAPL_EVD_STATE_THRESHOLD,
tduffy>  	DAPL_EVD_STATE_UNSIGNALLED
tduffy> -} DAPL_EVD_COMPLETION;
tduffy> +};
tduffy>  
tduffy>  /*********************************************************************
tduffy>   *                                                                   *
tduffy> @@ -161,7 +161,7 @@ struct dapl_evd {
tduffy>  	struct dat_evd		evd;
tduffy>  	struct dapl_common	common;
tduffy>  	struct list_head	list;
tduffy> -	DAPL_EVD_STATE		evd_state;
tduffy> +	enum dapl_evd_state	evd_state;
tduffy>  	enum dat_evd_flags	evd_flags;
tduffy>  
tduffy>  	/* Derived from evd_flags; see dapls_evd_internal_create.  */
tduffy> @@ -265,19 +265,19 @@ struct dapl_rmr {
tduffy>  };
tduffy>  
tduffy>  /* SP types, indicating the state and queue */
tduffy> -typedef enum dapl_sp_state {
tduffy> +enum dapl_sp_state {
tduffy>  	DAPL_SP_STATE_FREE,
tduffy>  	DAPL_SP_STATE_PSP_LISTENING,
tduffy>  	DAPL_SP_STATE_PSP_PENDING,
tduffy>  	DAPL_SP_STATE_RSP_LISTENING,
tduffy>  	DAPL_SP_STATE_RSP_PENDING
tduffy> -} DAPL_SP_STATE;
tduffy> +};
tduffy>  
tduffy>  struct dapl_sp {
tduffy>  	struct dat_sp sp;
tduffy>  	struct dapl_common common;
tduffy>  	struct list_head list;
tduffy> -	DAPL_SP_STATE state;	/* type and queue of the SP */
tduffy> +	enum dapl_sp_state state;	/* type and queue of the SP */
tduffy>  
tduffy>  	/* PSP/RSP PARAM fields */
tduffy>  	struct dat_ia *ia;
tduffy> @@ -313,22 +313,22 @@ struct dapl_cr {
tduffy>  	struct dapl_sp *sp;
tduffy>  };
tduffy>  
tduffy> -typedef enum dapl_dto_type {
tduffy> +enum dapl_dto_type {
tduffy>  	DAPL_DTO_TYPE_SEND,
tduffy>  	DAPL_DTO_TYPE_RECV,
tduffy>  	DAPL_DTO_TYPE_RDMA_WRITE,
tduffy>  	DAPL_DTO_TYPE_RDMA_READ,
tduffy> -} DAPL_DTO_TYPE;
tduffy> +};
tduffy>  
tduffy> -typedef enum dapl_cookie_type {
tduffy> +enum dapl_cookie_type {
tduffy>  	DAPL_COOKIE_TYPE_NULL,
tduffy>  	DAPL_COOKIE_TYPE_DTO,
tduffy>  	DAPL_COOKIE_TYPE_RMR,
tduffy> -} DAPL_COOKIE_TYPE;
tduffy> +};
tduffy>  
tduffy>  /* struct dapl_dto_cookie used as context for DTO WQEs */
tduffy>  struct dapl_dto_cookie {
tduffy> -	DAPL_DTO_TYPE type;
tduffy> +	enum dapl_dto_type type;
tduffy>  	DAT_DTO_COOKIE cookie;
tduffy>  	int size;		/* used for SEND and RDMA write */
tduffy>  };
tduffy> @@ -341,7 +341,7 @@ struct dapl_rmr_cookie {
tduffy>  
tduffy>  /* struct dapl_cookie used as context for WQEs */
tduffy>  struct dapl_cookie {
tduffy> -	DAPL_COOKIE_TYPE type;	/* Must be first, to define struct.  */
tduffy> +	enum dapl_cookie_type type;	/* Must be first, to define struct.  */
tduffy>  	struct dapl_ep *ep;
tduffy>  	int index;
tduffy>  	union {
tduffy> Index: linux-kernel/dat/core.c
tduffy> ===================================================================
tduffy> --- linux-kernel/dat/core.c	(revision 2640)
tduffy> +++ linux-kernel/dat/core.c	(working copy)
tduffy> @@ -43,7 +43,7 @@ static DAT_DBG_MASK g_dbg_mask = DAT_DBG
tduffy>  module_param_named(dbg_mask, g_dbg_mask, int, 0644);
tduffy>  MODULE_PARM_DESC(dbg_mask, "Bitmask to enable debug message types.");
tduffy>  
tduffy> -void dat_dbg_print(DAT_DBG_TYPE type, const char *fmt, ...)
tduffy> +void dat_dbg_print(enum dat_dbg_type type, const char *fmt, ...)
tduffy>  {
tduffy>  	static char buf[1024];
tduffy>  
tduffy> Index: linux-kernel/dat/core.h
tduffy> ===================================================================
tduffy> --- linux-kernel/dat/core.h	(revision 2640)
tduffy> +++ linux-kernel/dat/core.h	(working copy)
tduffy> @@ -45,17 +45,17 @@
tduffy>  
tduffy>  #define DAT_IS_BAD_POINTER(p) ( NULL == (p) )
tduffy>  
tduffy> -typedef enum {
tduffy> +enum dat_dbg_type {
tduffy>  	DAT_DBG_TYPE_ERROR        = (1 << 0),
tduffy>  	DAT_DBG_TYPE_GENERIC      = (1 << 1),
tduffy>  	DAT_DBG_TYPE_DR           = (1 << 2),
tduffy>  	DAT_DBG_TYPE_PROVIDER_API = (1 << 3),
tduffy>  	DAT_DBG_TYPE_CONSUMER_API = (1 << 4),
tduffy>  	DAT_DBG_TYPE_ALL          = 0x1f
tduffy> -} DAT_DBG_TYPE;
tduffy> +};
tduffy>  
tduffy>  typedef int DAT_DBG_MASK;
tduffy>  
tduffy> -extern void dat_dbg_print(DAT_DBG_TYPE type, const char *fmt, ...);
tduffy> +extern void dat_dbg_print(enum dat_dbg_type type, const char *fmt, ...);
tduffy>  
tduffy>  #endif /* CORE_H */
tduffy> 



More information about the general mailing list