diff options
| author | Jeff Darcy <jdarcy@fb.com> | 2017-06-29 06:50:56 -0700 | 
|---|---|---|
| committer | Niels de Vos <ndevos@redhat.com> | 2017-06-30 10:31:02 +0000 | 
| commit | 0be8e038d9bf90be94f3e3a7d6ea5bee88da9ecb (patch) | |
| tree | 2f23f3b205a9bdd386488cc00a3d4b1f23b4a076 | |
| parent | 50d72373fadf1174918e754e31bae3806aa4c214 (diff) | |
multiple: fix struct/typedef inconsistencies
The most common pattern, both in our code and elsewhere, is this:
   struct _xyz {
      ...
   };
   typedef struct _xyz xyz_t;
These exceptions - especially call_frame/call_stack - have been slowing
down code navigation for years.  By converging on a single pattern,
navigating from xyz_t in code to the actual definition of struct _xyz
(i.e. without having to visit the typedef first) might even be
automatable.
Change-Id: I0e5dd1f51f98e000173c62ef4ddc5b21d9ec44ed
Signed-off-by: Jeff Darcy <jdarcy@fb.com>
Reviewed-on: https://review.gluster.org/17650
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: Jeff Darcy <jeff@pl.atyp.us>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
| -rw-r--r-- | api/src/glfs-internal.h | 4 | ||||
| -rw-r--r-- | glusterfsd/src/glusterfsd.h | 4 | ||||
| -rw-r--r-- | libglusterfs/src/client_t.h | 2 | ||||
| -rw-r--r-- | libglusterfs/src/gf-dirent.h | 10 | ||||
| -rw-r--r-- | libglusterfs/src/refcount.h | 4 | ||||
| -rw-r--r-- | libglusterfs/src/stack.h | 12 | ||||
| -rw-r--r-- | libglusterfs/src/xlator.h | 8 | ||||
| -rw-r--r-- | rpc/rpc-lib/src/rpc-transport.h | 2 | ||||
| -rw-r--r-- | xlators/features/locks/src/locks.h | 8 | ||||
| -rw-r--r-- | xlators/features/upcall/src/upcall.h | 12 | ||||
| -rw-r--r-- | xlators/protocol/server/src/server-helpers.h | 6 | 
11 files changed, 36 insertions, 36 deletions
diff --git a/api/src/glfs-internal.h b/api/src/glfs-internal.h index 14268f4b3b2..b5d3f78bf7c 100644 --- a/api/src/glfs-internal.h +++ b/api/src/glfs-internal.h @@ -141,11 +141,11 @@  struct glfs; -struct _upcall_entry_t { +struct _upcall_entry {          struct list_head  upcall_list;          struct gf_upcall  upcall_data;  }; -typedef struct _upcall_entry_t upcall_entry; +typedef struct _upcall_entry upcall_entry;  typedef int (*glfs_init_cbk) (struct glfs *fs, int ret); diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h index bc3f2605466..3461d6d01f0 100644 --- a/glusterfsd/src/glusterfsd.h +++ b/glusterfsd/src/glusterfsd.h @@ -98,7 +98,7 @@ enum argp_option_keys {  #endif  }; -struct _gfd_vol_top_priv_t { +struct _gfd_vol_top_priv {          rpcsvc_request_t        *req;          gd1_mgmt_brick_op_req   xlator_req;          uint32_t                blk_count; @@ -107,7 +107,7 @@ struct _gfd_vol_top_priv_t {          double                  time;          int32_t                 ret;  }; -typedef struct _gfd_vol_top_priv_t gfd_vol_top_priv_t; +typedef struct _gfd_vol_top_priv gfd_vol_top_priv_t;  int glusterfs_mgmt_pmap_signout (glusterfs_ctx_t *ctx, char *brick_name);  int glusterfs_mgmt_pmap_signin (glusterfs_ctx_t *ctx); diff --git a/libglusterfs/src/client_t.h b/libglusterfs/src/client_t.h index b4546f36bea..7666f0132b6 100644 --- a/libglusterfs/src/client_t.h +++ b/libglusterfs/src/client_t.h @@ -20,7 +20,7 @@ struct client_ctx {          void     *ctx_value;  }; -typedef struct _client_t { +typedef struct _client {          struct {                  /* e.g. protocol/server stashes its ctx here */                  gf_lock_t            lock; diff --git a/libglusterfs/src/gf-dirent.h b/libglusterfs/src/gf-dirent.h index caa09c1728e..fa323396e92 100644 --- a/libglusterfs/src/gf-dirent.h +++ b/libglusterfs/src/gf-dirent.h @@ -27,20 +27,20 @@ uint64_t  gf_dirent_orig_offset (xlator_t *this, uint64_t offset); -struct _dir_entry_t { -        struct _dir_entry_t *next; +struct _dir_entry { +        struct _dir_entry   *next;  	char                *name;  	char                *link;  	struct iatt          buf;  }; -struct _gf_dirent_t { +struct _gf_dirent {  	union {  		struct list_head             list;  		struct { -			struct _gf_dirent_t *next; -			struct _gf_dirent_t *prev; +			struct _gf_dirent   *next; +			struct _gf_dirent   *prev;  		};  	};  	uint64_t                             d_ino; diff --git a/libglusterfs/src/refcount.h b/libglusterfs/src/refcount.h index 4ae37fecbfe..25f44258e42 100644 --- a/libglusterfs/src/refcount.h +++ b/libglusterfs/src/refcount.h @@ -26,7 +26,7 @@  typedef void (*gf_ref_release_t)(void *data); -struct _gf_ref_t { +struct _gf_ref {  #ifdef REFCOUNT_NEEDS_LOCK          gf_lock_t          lk;      /* lock for atomically adjust cnt */  #endif @@ -35,7 +35,7 @@ struct _gf_ref_t {          gf_ref_release_t   release; /* cleanup when cnt == 0 */          void              *data;    /* parameter passed to release() */  }; -typedef struct _gf_ref_t gf_ref_t; +typedef struct _gf_ref gf_ref_t;  /* _gf_ref_get -- increase the refcount diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h index 51698d16f55..20fbdfabff5 100644 --- a/libglusterfs/src/stack.h +++ b/libglusterfs/src/stack.h @@ -16,10 +16,10 @@  #ifndef _STACK_H  #define _STACK_H -struct _call_stack_t; -typedef struct _call_stack_t call_stack_t; -struct _call_frame_t; -typedef struct _call_frame_t call_frame_t; +struct _call_stack; +typedef struct _call_stack call_stack_t; +struct _call_frame; +typedef struct _call_frame call_frame_t;  struct call_pool;  typedef struct call_pool call_pool_t; @@ -61,7 +61,7 @@ struct call_pool {          struct mem_pool             *stack_mem_pool;  }; -struct _call_frame_t { +struct _call_frame {          call_stack_t *root;        /* stack root */          call_frame_t *parent;      /* previous BP */          struct list_head frames; @@ -84,7 +84,7 @@ struct _call_frame_t {  #define SMALL_GROUP_COUNT 128 -struct _call_stack_t { +struct _call_stack {          union {                  struct list_head      all_frames;                  struct { diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index 894785e7985..06e7241bb8e 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -43,10 +43,10 @@  struct _xlator;  typedef struct _xlator xlator_t; -struct _dir_entry_t; -typedef struct _dir_entry_t dir_entry_t; -struct _gf_dirent_t; -typedef struct _gf_dirent_t gf_dirent_t; +struct _dir_entry; +typedef struct _dir_entry dir_entry_t; +struct _gf_dirent; +typedef struct _gf_dirent gf_dirent_t;  struct _loc;  typedef struct _loc loc_t; diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h index ff6567c198e..33f474e42c6 100644 --- a/rpc/rpc-lib/src/rpc-transport.h +++ b/rpc/rpc-lib/src/rpc-transport.h @@ -180,7 +180,7 @@ struct rpc_transport {                                                */          void                      *private; -        struct _client_t          *xl_private; +        struct _client            *xl_private;          void                      *xl;       /* Used for THIS */          void                      *mydata;          pthread_mutex_t            lock; diff --git a/xlators/features/locks/src/locks.h b/xlators/features/locks/src/locks.h index 8eb35da44be..3d3b327f56c 100644 --- a/xlators/features/locks/src/locks.h +++ b/xlators/features/locks/src/locks.h @@ -100,14 +100,14 @@ struct __pl_inode_lock {  };  typedef struct __pl_inode_lock pl_inode_lock_t; -struct __pl_rw_req_t { +struct _pl_rw_req {          struct list_head      list;          call_stub_t          *stub;          posix_lock_t          region;  }; -typedef struct __pl_rw_req_t pl_rw_req_t; +typedef struct _pl_rw_req pl_rw_req_t; -struct __pl_dom_list_t { +struct _pl_dom_list {          struct list_head   inode_list;       /* list_head back to pl_inode_t */          const char        *domain;          struct list_head   entrylk_list;     /* List of entry locks */ @@ -115,7 +115,7 @@ struct __pl_dom_list_t {          struct list_head   inodelk_list;     /* List of inode locks */          struct list_head   blocked_inodelks; /* List of all blocked inodelks */  }; -typedef struct __pl_dom_list_t pl_dom_list_t; +typedef struct _pl_dom_list pl_dom_list_t;  struct __entry_lock {          struct list_head  domain_list;    /* list_head back to pl_dom_list_t */ diff --git a/xlators/features/upcall/src/upcall.h b/xlators/features/upcall/src/upcall.h index 159193f54e7..3e0d96cd001 100644 --- a/xlators/features/upcall/src/upcall.h +++ b/xlators/features/upcall/src/upcall.h @@ -44,7 +44,7 @@                  upcall_local_wipe (__xl, __local);         \  } while (0) -struct _upcall_private_t { +struct _upcall_private {          gf_boolean_t     cache_invalidation_enabled;          int32_t          cache_invalidation_timeout;          struct list_head inode_ctx_list; @@ -55,9 +55,9 @@ struct _upcall_private_t {          dict_t          *xattrs; /* list of xattrs registered by clients                                      for receiving invalidation */  }; -typedef struct _upcall_private_t upcall_private_t; +typedef struct _upcall_private upcall_private_t; -struct _upcall_client_t { +struct _upcall_client {          struct list_head client_list;          /* strdup to store client_uid, strdup. Free it explicitly */          char *client_uid; @@ -65,10 +65,10 @@ struct _upcall_client_t {          /* the amount of time which client can cache this entry */          uint32_t expire_time_attr;  }; -typedef struct _upcall_client_t upcall_client_t; +typedef struct _upcall_client upcall_client_t;  /* Upcall entries are maintained in inode_ctx */ -struct _upcall_inode_ctx_t { +struct _upcall_inode_ctx {          struct list_head inode_ctx_list;          struct list_head client_list;          pthread_mutex_t client_list_lock; /* mutex for clients list @@ -76,7 +76,7 @@ struct _upcall_inode_ctx_t {          int destroy;          uuid_t   gfid; /* gfid of the entry */  }; -typedef struct _upcall_inode_ctx_t upcall_inode_ctx_t; +typedef struct _upcall_inode_ctx upcall_inode_ctx_t;  struct upcall_local {          /* XXX: need to check if we can store diff --git a/xlators/protocol/server/src/server-helpers.h b/xlators/protocol/server/src/server-helpers.h index 02e092b9956..1f47bc9dff1 100644 --- a/xlators/protocol/server/src/server-helpers.h +++ b/xlators/protocol/server/src/server-helpers.h @@ -41,11 +41,11 @@ call_frame_t *  get_frame_from_request (rpcsvc_request_t *req);  int -server_connection_cleanup (xlator_t *this, struct _client_t *client, +server_connection_cleanup (xlator_t *this, struct _client *client,                             int32_t flags);  gf_boolean_t -server_cancel_grace_timer (xlator_t *this, struct _client_t *client); +server_cancel_grace_timer (xlator_t *this, struct _client *client);  int  server_build_config (xlator_t *this, server_conf_t *conf); @@ -55,7 +55,7 @@ int serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp);  int readdirp_rsp_cleanup (gfs3_readdirp_rsp *rsp);  int readdir_rsp_cleanup (gfs3_readdir_rsp *rsp);  int auth_set_username_passwd (dict_t *input_params, dict_t *config_params, -                              struct _client_t *client); +                              struct _client *client);  server_ctx_t *server_ctx_get (client_t *client, xlator_t *xlator);  int server_process_event_upcall (xlator_t *this, void *data);  | 
