From b56bf714c1f22212700db50c057e4e47b99be739 Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Fri, 23 Nov 2018 12:14:59 +0200 Subject: rpc *.h fles: align structs Make an effort to slightly better align the structures. Change-Id: I6f80a451f2ffbf15adfb986cedc24c2799787b49 updates: bz#1193929 Signed-off-by: Yaniv Kaul --- rpc/rpc-lib/src/rpc-clnt.h | 2 +- rpc/rpc-lib/src/rpc-drc.h | 16 +++++------ rpc/rpc-lib/src/rpc-transport.h | 22 +++++++-------- rpc/rpc-lib/src/rpcsvc-common.h | 8 +++--- rpc/rpc-lib/src/rpcsvc.c | 4 +-- rpc/rpc-lib/src/rpcsvc.h | 62 ++++++++++++++++++++--------------------- 6 files changed, 56 insertions(+), 58 deletions(-) (limited to 'rpc/rpc-lib') diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h index d122382e446..d80df7f8b96 100644 --- a/rpc/rpc-lib/src/rpc-clnt.h +++ b/rpc/rpc-lib/src/rpc-clnt.h @@ -52,8 +52,8 @@ struct saved_frame { }; void *capital_this; void *frame; - struct timeval saved_at; struct rpc_req *rpcreq; + struct timeval saved_at; rpc_transport_rsp_t rsp; }; diff --git a/rpc/rpc-lib/src/rpc-drc.h b/rpc/rpc-lib/src/rpc-drc.h index 1fd1e5e24ef..89b7c87e756 100644 --- a/rpc/rpc-lib/src/rpc-drc.h +++ b/rpc/rpc-lib/src/rpc-drc.h @@ -19,18 +19,17 @@ /* per-client cache structure */ struct drc_client { - uint32_t ref; union gf_sock_union sock_union; /* pointers to the cache */ struct rb_table *rbtree; /* no. of ops currently cached */ uint32_t op_count; + uint32_t ref; struct list_head client_list; }; struct drc_cached_op { drc_op_state_t state; - uint32_t xid; int prognum; int progversion; int procnum; @@ -39,6 +38,7 @@ struct drc_cached_op { struct list_head client_list; struct list_head global_list; int32_t ref; + uint32_t xid; }; /* global drc definitions */ @@ -50,19 +50,19 @@ struct drc_globals { * it is used so in gf_libavl_allocator */ struct libavl_allocator allocator; - drc_type_t type; /* configurable size parameter */ - uint32_t global_cache_size; - drc_lru_factor_t lru_factor; gf_lock_t lock; - drc_status_t status; - uint32_t op_count; uint64_t cache_hits; uint64_t intransit_hits; struct mem_pool *mempool; struct list_head cache_head; - uint32_t client_count; struct list_head clients_head; + uint32_t op_count; + uint32_t client_count; + uint32_t global_cache_size; + drc_type_t type; + drc_lru_factor_t lru_factor; + drc_status_t status; }; int diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h index fd737d0c764..87ea3a28dfd 100644 --- a/rpc/rpc-lib/src/rpc-transport.h +++ b/rpc/rpc-lib/src/rpc-transport.h @@ -61,12 +61,12 @@ typedef struct rpc_transport rpc_transport_t; #include "rpcsvc-common.h" struct peer_info { - struct sockaddr_storage sockaddr; - socklen_t sockaddr_len; - char identifier[UNIX_PATH_MAX]; // OP-VERSION of clients uint32_t max_op_version; uint32_t min_op_version; + struct sockaddr_storage sockaddr; + socklen_t sockaddr_len; + char identifier[UNIX_PATH_MAX]; // Volume mounted by client char volname[NAME_MAX]; }; @@ -121,24 +121,24 @@ struct rpc_transport_rsp { typedef struct rpc_transport_rsp rpc_transport_rsp_t; struct rpc_transport_req { + struct rpc_req *rpc_req; rpc_transport_msg_t msg; rpc_transport_rsp_t rsp; - struct rpc_req *rpc_req; }; typedef struct rpc_transport_req rpc_transport_req_t; struct rpc_transport_reply { - rpc_transport_msg_t msg; void *private; + rpc_transport_msg_t msg; }; typedef struct rpc_transport_reply rpc_transport_reply_t; struct rpc_transport_data { - char is_request; union { rpc_transport_req_t req; rpc_transport_reply_t reply; } data; + char is_request; }; typedef struct rpc_transport_data rpc_transport_data_t; @@ -146,22 +146,22 @@ typedef struct rpc_transport_data rpc_transport_data_t; * rpc_request, hence these should be removed from request_info */ struct rpc_request_info { - uint32_t xid; int prognum; int progver; int procnum; void *rpc_req; /* struct rpc_req */ rpc_transport_rsp_t rsp; + uint32_t xid; }; typedef struct rpc_request_info rpc_request_info_t; struct rpc_transport_pollin { - struct iovec vector[MAX_IOVEC]; int count; - char vectored; void *private; struct iobref *iobref; + struct iovec vector[MAX_IOVEC]; char is_reply; + char vectored; }; typedef struct rpc_transport_pollin rpc_transport_pollin_t; @@ -182,9 +182,6 @@ struct rpc_transport { void *mydata; pthread_mutex_t lock; gf_atomic_t refcount; - - int32_t outstanding_rpc_count; - glusterfs_ctx_t *ctx; dict_t *options; char *name; @@ -202,6 +199,7 @@ struct rpc_transport { uint64_t total_bytes_read; uint64_t total_bytes_write; uint32_t xid; /* RPC/XID used for callbacks */ + int32_t outstanding_rpc_count; struct list_head list; int bind_insecure; diff --git a/rpc/rpc-lib/src/rpcsvc-common.h b/rpc/rpc-lib/src/rpcsvc-common.h index 6a36b1f1b9b..56200b38faa 100644 --- a/rpc/rpc-lib/src/rpcsvc-common.h +++ b/rpc/rpc-lib/src/rpcsvc-common.h @@ -50,10 +50,6 @@ typedef struct rpcsvc_state { /* Reference to the options */ dict_t *options; - /* Allow insecure ports. */ - gf_boolean_t allow_insecure; - gf_boolean_t register_portmap; - gf_boolean_t root_squash; uid_t anonuid; gid_t anongid; glusterfs_ctx_t *ctx; @@ -79,6 +75,10 @@ typedef struct rpcsvc_state { gf_boolean_t addr_namelookup; /* determine whether throttling is needed, by default OFF */ gf_boolean_t throttle; + /* Allow insecure ports. */ + gf_boolean_t allow_insecure; + gf_boolean_t register_portmap; + gf_boolean_t root_squash; } rpcsvc_t; /* DRC START */ diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c index d678bca43a8..8dcc2947b33 100644 --- a/rpc/rpc-lib/src/rpcsvc.c +++ b/rpc/rpc-lib/src/rpcsvc.c @@ -1369,9 +1369,9 @@ rpcsvc_transport_submit(rpc_transport_t *trans, struct iovec *rpchdr, int progpayloadcount, struct iobref *iobref, void *priv) { int ret = -1; - rpc_transport_reply_t reply = {{ + rpc_transport_reply_t reply = { 0, - }}; + }; if ((!trans) || (!rpchdr) || (!rpchdr->iov_base)) { goto out; diff --git a/rpc/rpc-lib/src/rpcsvc.h b/rpc/rpc-lib/src/rpcsvc.h index 8388dd404c5..d6260ca5028 100644 --- a/rpc/rpc-lib/src/rpcsvc.h +++ b/rpc/rpc-lib/src/rpcsvc.h @@ -171,11 +171,6 @@ struct rpcsvc_request { rpcsvc_program_t *prog; - /* The identifier for the call from client. - * Needed to pair the reply with the call. - */ - uint32_t xid; - int prognum; int progver; @@ -247,11 +242,6 @@ struct rpcsvc_request { * sent to the client. */ rpcsvc_auth_data_t verf; - - /* Execute this request's actor function in ownthread of program?*/ - gf_boolean_t ownthread; - - gf_boolean_t synctask; /* Container for a RPC program wanting to store a temp * request-specific item. */ @@ -275,6 +265,16 @@ struct rpcsvc_request { /* ctime: origin of time on the client side, ideally this is the one we should consider for time */ struct timespec ctime; + + /* The identifier for the call from client. + * Needed to pair the reply with the call. + */ + uint32_t xid; + + /* Execute this request's actor function in ownthread of program?*/ + gf_boolean_t ownthread; + + gf_boolean_t synctask; }; #define rpcsvc_request_program(req) ((rpcsvc_program_t *)((req)->prog)) @@ -391,21 +391,20 @@ struct rpcsvc_program { int prognum; int progver; /* FIXME */ - dict_t *options; /* An opaque dictionary - * populated by the program - * (probably from xl->options) - * which contain enough - * information for transport to - * initialize. As a part of - * cleanup, the members of - * options which are of interest - * to transport should be put - * into a structure for better - * readability and structure - * should replace options member - * here. - */ - uint16_t progport; /* Registered with portmap */ + dict_t *options; /* An opaque dictionary + * populated by the program + * (probably from xl->options) + * which contain enough + * information for transport to + * initialize. As a part of + * cleanup, the members of + * options which are of interest + * to transport should be put + * into a structure for better + * readability and structure + * should replace options member + * here. + */ #if 0 int progaddrfamily; /* AF_INET or AF_INET6 */ char *proghost; /* Bind host, can be NULL */ @@ -433,12 +432,6 @@ struct rpcsvc_program { */ int min_auth; - /* Execute actor function in program's own thread? This will reduce */ - /* the workload on poller threads */ - gf_boolean_t ownthread; - gf_boolean_t alive; - - gf_boolean_t synctask; /* list member to link to list of registered services with rpcsvc */ struct list_head program; rpcsvc_request_queue_t request_queue[EVENT_MAX_THREADS]; @@ -454,6 +447,13 @@ struct rpcsvc_program { * It is used to control the scaling of rpcsvc_request_handler threads */ int eventthreadcount; + uint16_t progport; /* Registered with portmap */ + /* Execute actor function in program's own thread? This will reduce */ + /* the workload on poller threads */ + gf_boolean_t ownthread; + gf_boolean_t alive; + + gf_boolean_t synctask; }; typedef struct rpcsvc_cbk_program { -- cgit