Change the remaining typedefs in LNet core to proper structures.
Several other style changes to fix checkpatch issues with code
impacted by typedef change.
Test-Parameters: trivial
Change-Id: Ic72b31698d1b1e7c612181a50aa7fa921fd417d7
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/29847
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Doug Oucharek <dougso@me.com>
Reviewed-by: Sonia Sharma <sonia.sharma@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
extern int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp,
struct libcfs_ioctl_hdr __user *uparam);
extern int lnet_get_peer_list(__u32 *countp, __u32 *sizep,
- lnet_process_id_t __user *ids);
+ struct lnet_process_id __user *ids);
void lnet_router_debugfs_init(void);
void lnet_router_debugfs_fini(void);
return false;
}
-void lnet_incr_stats(struct lnet_element_stats *stats, lnet_msg_type_t msg_type,
+void lnet_incr_stats(struct lnet_element_stats *stats,
+ enum lnet_msg_type msg_type,
enum lnet_stats_type stats_type);
__u32 lnet_sum_stats(struct lnet_element_stats *stats,
/* forward refs */
struct lnet_libmd;
-typedef struct lnet_msg {
+struct lnet_msg {
struct list_head msg_activelist;
struct list_head msg_list; /* Q for credits/MD */
struct lnet_event msg_ev;
struct lnet_hdr msg_hdr;
-} lnet_msg_t;
+};
-typedef struct lnet_libhandle {
+struct lnet_libhandle {
struct list_head lh_hash_chain;
__u64 lh_cookie;
-} lnet_libhandle_t;
+};
#define lh_entry(ptr, type, member) \
((type *)((char *)(ptr)-(char *)(&((type *)0)->member)))
-typedef struct lnet_eq {
+struct lnet_eq {
struct list_head eq_list;
struct lnet_libhandle eq_lh;
unsigned long eq_enq_seq;
lnet_eq_handler_t eq_callback;
struct lnet_event *eq_events;
int **eq_refs; /* percpt refcount for EQ */
-} lnet_eq_t;
+};
-typedef struct lnet_me {
+struct lnet_me {
struct list_head me_list;
struct lnet_libhandle me_lh;
struct lnet_process_id me_match_id;
__u64 me_ignore_bits;
enum lnet_unlink me_unlink;
struct lnet_libmd *me_md;
-} lnet_me_t;
+};
-typedef struct lnet_libmd {
+struct lnet_libmd {
struct list_head md_list;
struct lnet_libhandle md_lh;
struct lnet_me *md_me;
struct kvec iov[LNET_MAX_IOV];
lnet_kiov_t kiov[LNET_MAX_IOV];
} md_iov;
-} lnet_libmd_t;
+};
#define LNET_MD_FLAG_ZOMBIE (1 << 0)
#define LNET_MD_FLAG_AUTO_UNLINK (1 << 1)
#define LNET_MD_FLAG_ABORTED (1 << 2)
-typedef struct lnet_test_peer {
+struct lnet_test_peer {
/* info about peers we are trying to fail */
struct list_head tp_list; /* ln_test_peers */
lnet_nid_t tp_nid; /* matching nid */
unsigned int tp_threshold; /* # failures to simulate */
-} lnet_test_peer_t;
+};
#define LNET_COOKIE_TYPE_MD 1
#define LNET_COOKIE_TYPE_ME 2
struct lnet_ni; /* forward ref */
struct socket;
-typedef struct lnet_lnd {
+struct lnet_lnd {
/* fields managed by portals */
struct list_head lnd_list; /* stash in the LND table */
int lnd_refcount; /* # active instances */
/* accept a new connection */
int (*lnd_accept)(struct lnet_ni *ni, struct socket *sock);
-} lnd_t;
+};
struct lnet_tx_queue {
int tq_credits; /* # tx credits free */
enum lnet_net_state net_state;
};
-typedef struct lnet_ni {
+struct lnet_ni {
/* chain on the lnet_net structure */
struct list_head ni_netlist;
*/
char *ni_interfaces[LNET_INTERFACES_NUM];
struct net *ni_net_ns; /* original net namespace */
-} lnet_ni_t;
+};
#define LNET_PROTO_PING_MATCHBITS 0x8000000000000000LL
container_of((PINFO), struct lnet_ping_buffer, pb_info)
/* router checker data, per router */
-typedef struct lnet_rc_data {
+struct lnet_rc_data {
/* chain on the_lnet.ln_zombie_rcd or ln_deathrow_rcd */
struct list_head rcd_list;
struct lnet_handle_md rcd_mdh; /* ping buffer MD */
struct lnet_peer_ni *rcd_gateway; /* reference to gateway */
struct lnet_ping_buffer *rcd_pingbuffer;/* ping buffer */
int rcd_nnis; /* desired size of buffer */
-} lnet_rc_data_t;
+};
struct lnet_peer_ni {
/* chain on lpn_peer_nis */
struct lnet_ping_buffer *lp_data;
/* MD handle for ping in progress */
- lnet_handle_md_t lp_ping_mdh;
+ struct lnet_handle_md lp_ping_mdh;
/* MD handle for push in progress */
- lnet_handle_md_t lp_push_mdh;
+ struct lnet_handle_md lp_push_mdh;
/* number of NIDs for sizing push data */
int lp_data_nnis;
((lp)->lpni_net) && \
(lp)->lpni_net->net_tunables.lct_peer_timeout > 0)
-typedef struct lnet_route {
+struct lnet_route {
struct list_head lr_list; /* chain on net */
struct list_head lr_gwlist; /* chain on gateway */
struct lnet_peer_ni *lr_gateway; /* router node */
unsigned int lr_downis; /* number of down NIs */
__u32 lr_hops; /* how far I am */
unsigned int lr_priority; /* route priority */
-} lnet_route_t;
+};
#define LNET_REMOTE_NETS_HASH_DEFAULT (1U << 7)
#define LNET_REMOTE_NETS_HASH_MAX (1U << 16)
#define LNET_REMOTE_NETS_HASH_SIZE (1 << the_lnet.ln_remote_nets_hbits)
-typedef struct lnet_remotenet {
+struct lnet_remotenet {
/* chain on ln_remote_nets_hash */
struct list_head lrn_list;
/* routes to me */
struct list_head lrn_routes;
/* my net number */
__u32 lrn_net;
-} lnet_remotenet_t;
+};
/** lnet message has credit and can be submitted to lnd for send/receive */
#define LNET_CREDIT_OK 0
/** lnet message is waiting for discovery */
#define LNET_DC_WAIT 2
-typedef struct lnet_rtrbufpool {
+struct lnet_rtrbufpool {
/* my free buffer pool */
struct list_head rbp_bufs;
/* messages blocking for a buffer */
int rbp_credits;
/* low water mark */
int rbp_mincredits;
-} lnet_rtrbufpool_t;
+};
-typedef struct lnet_rtrbuf {
+struct lnet_rtrbuf {
struct list_head rb_list; /* chain on rbp_bufs */
struct lnet_rtrbufpool *rb_pool; /* owning pool */
lnet_kiov_t rb_kiov[0]; /* the buffer space */
-} lnet_rtrbuf_t;
+};
#define LNET_PEER_HASHSIZE 503 /* prime! */
/* dispatch routed PUT message by hashing source NID for wildcard portals */
#define LNET_PTL_ROTOR_HASH_RT 3
-typedef struct lnet_portal {
+struct lnet_portal {
spinlock_t ptl_lock;
unsigned int ptl_index; /* portal ID, reserved */
/* flags on this portal: lazy, unique... */
int ptl_mt_nmaps;
/* array of active entries' cpu-partition-id */
int ptl_mt_maps[0];
-} lnet_portal_t;
+};
#define LNET_LH_HASH_BITS 12
#define LNET_LH_HASH_SIZE (1ULL << LNET_LH_HASH_BITS)
#define LNET_STATE_RUNNING 1 /* started up OK */
#define LNET_STATE_STOPPING 2 /* telling thread to stop */
-typedef struct lnet {
+struct lnet {
/* CPU partition table of LNet */
struct cfs_cpt_table *ln_cpt_table;
/* number of CPTs in ln_cpt_table */
* buffer may linger a while after it has been unlinked, in
* which case the event handler cleans up.
*/
- lnet_handle_eq_t ln_push_target_eq;
- lnet_handle_md_t ln_push_target_md;
+ struct lnet_handle_eq ln_push_target_eq;
+ struct lnet_handle_md ln_push_target_md;
struct lnet_ping_buffer *ln_push_target;
int ln_push_target_nnis;
/* discovery event queue handle */
- lnet_handle_eq_t ln_dc_eqh;
+ struct lnet_handle_eq ln_dc_eqh;
/* discovery requests */
struct list_head ln_dc_request;
/* discovery working list */
* the list, the router checker will sleep on this queue. when
* routes are added the thread will wake up */
wait_queue_head_t ln_rc_waitq;
-} lnet_t;
+};
#endif
__u32 ping_count;
__u32 ping_flags;
bool mr_info;
- lnet_process_id_t ping_id;
- lnet_process_id_t __user *ping_buf;
+ struct lnet_process_id ping_id;
+ struct lnet_process_id __user *ping_buf;
};
struct lnet_ioctl_config_data {
#define WIRE_ATTR __attribute__((packed))
/* Packed version of struct lnet_process_id to transfer via network */
-typedef struct lnet_process_id_packed {
+struct lnet_process_id_packed {
lnet_nid_t nid;
lnet_pid_t pid; /* node id / process id */
-} WIRE_ATTR lnet_process_id_packed;
+} WIRE_ATTR;
/* The wire handle's interface cookie only matches one network interface in
* one epoch (i.e. new cookie when the interface restarts or the node
* reboots). The object cookie only matches one object on that interface
* during that object's lifetime (i.e. no cookie re-use). */
-typedef struct lnet_handle_wire {
+struct lnet_handle_wire {
__u64 wh_interface_cookie;
__u64 wh_object_cookie;
-} WIRE_ATTR lnet_handle_wire_t;
+} WIRE_ATTR;
-typedef enum lnet_msg_type {
+enum lnet_msg_type {
LNET_MSG_ACK = 0,
LNET_MSG_PUT,
LNET_MSG_GET,
LNET_MSG_REPLY,
LNET_MSG_HELLO,
-} lnet_msg_type_t;
+};
/* The variant fields of the portals message header are aligned on an 8
* byte boundary in the message header. Note that all types used in these
__u32 type;
} WIRE_ATTR;
-typedef struct lnet_hdr {
+struct lnet_hdr {
lnet_nid_t dest_nid;
lnet_nid_t src_nid;
lnet_pid_t dest_pid;
struct lnet_reply reply;
struct lnet_hello hello;
} msg;
-} WIRE_ATTR lnet_hdr_t;
+} WIRE_ATTR;
/* A HELLO message contains a magic number and protocol version
* code in the header's dest_nid, the peer's NID in the src_nid, and
* exchange HELLO messages when a connection is first established. Individual
* LNDs can put whatever else they fancy in lnet_hdr::msg.
*/
-typedef struct lnet_magicversion {
+struct lnet_magicversion {
__u32 magic; /* LNET_PROTO_TCP_MAGIC */
__u16 version_major; /* increment on incompatible change */
__u16 version_minor; /* increment on compatible change */
-} WIRE_ATTR lnet_magic_version_t;
+} WIRE_ATTR;
/* PROTO MAGIC for LNDs */
#define LNET_PROTO_IB_MAGIC 0x0be91b91
#define LNET_PROTO_TCP_VERSION_MINOR 0
/* Acceptor connection request */
-typedef struct lnet_acceptor_connreq {
+struct lnet_acceptor_connreq {
__u32 acr_magic; /* PTL_ACCEPTOR_PROTO_MAGIC */
__u32 acr_version; /* protocol version */
__u64 acr_nid; /* target NID */
-} WIRE_ATTR lnet_acceptor_connreq_t;
+} WIRE_ATTR;
#define LNET_PROTO_ACCEPTOR_VERSION 1
-typedef struct lnet_counters {
+struct lnet_counters {
__u32 msgs_alloc;
__u32 msgs_max;
__u32 errors;
__u64 recv_length;
__u64 route_length;
__u64 drop_length;
-} WIRE_ATTR lnet_counters_t;
+} WIRE_ATTR;
#define LNET_NI_STATUS_UP 0x15aac0de
#define LNET_NI_STATUS_DOWN 0xdeadface
*/
#define LNET_WIRE_HANDLE_COOKIE_NONE (-1)
-typedef struct lnet_handle_eq {
+struct lnet_handle_eq {
__u64 cookie;
-} lnet_handle_eq_t;
+};
/**
* Invalidate eq handle \a h.
return (LNET_WIRE_HANDLE_COOKIE_NONE == h.cookie);
}
-typedef struct lnet_handle_md {
+struct lnet_handle_md {
__u64 cookie;
-} lnet_handle_md_t;
+};
/**
* Invalidate md handle \a h.
return (LNET_WIRE_HANDLE_COOKIE_NONE == h.cookie);
}
-typedef struct lnet_handle_me {
+struct lnet_handle_me {
__u64 cookie;
-} lnet_handle_me_t;
+};
/**
* Global process ID.
*/
-typedef struct lnet_process_id {
+struct lnet_process_id {
/** node id */
lnet_nid_t nid;
/** process id */
lnet_pid_t pid;
-} lnet_process_id_t;
+};
/** @} lnet_addr */
/** \addtogroup lnet_me
* Specifies whether the match entry or memory descriptor should be unlinked
* automatically (LNET_UNLINK) or not (LNET_RETAIN).
*/
-typedef enum lnet_unlink {
+enum lnet_unlink {
LNET_RETAIN = 0,
LNET_UNLINK
-} lnet_unlink_t;
+};
/**
* Values of the type enum lnet_ins_pos are used to control where a new match
* LNET_INS_AFTER is used to insert the new entry after the current entry
* or after the last item in the list.
*/
-typedef enum lnet_ins_pos {
+enum lnet_ins_pos {
/** insert ME before current position or head of the list */
LNET_INS_BEFORE,
/** insert ME after current position or tail of the list */
LNET_INS_AFTER,
/** attach ME at tail of local CPU partition ME list */
LNET_INS_LOCAL
-} lnet_ins_pos;
+};
/** @} lnet_me */
* Defines the visible parts of a memory descriptor. Values of this type
* are used to initialize memory descriptors.
*/
-typedef struct lnet_md {
+struct lnet_md {
/**
* Specify the memory region associated with the memory descriptor.
* If the options field has:
* if the LNET_MD_BULK_HANDLE option is set.
*/
struct lnet_handle_md bulk_handle;
-} lnet_md_t;
+};
/* Max Transfer Unit (minimum supported everywhere).
* CAVEAT EMPTOR, with multinet (i.e. routers forwarding between networks)
/**
* Six types of events can be logged in an event queue.
*/
-typedef enum lnet_event_kind {
+enum lnet_event_kind {
/** An incoming GET operation has completed on the MD. */
LNET_EVENT_GET = 1,
/**
* \see LNetMDUnlink
*/
LNET_EVENT_UNLINK,
-} lnet_event_kind_t;
+};
#define LNET_SEQ_GT(a, b) (((signed long)((a) - (b))) > 0)
/**
* Information about an event on a MD.
*/
-typedef struct lnet_event {
+struct lnet_event {
/** The identifier (nid, pid) of the target. */
struct lnet_process_id target;
/** The identifier (nid, pid) of the initiator. */
* to each event.
*/
volatile unsigned long sequence;
-} lnet_event_t;
+};
/**
* Event queue handler function type.
* \see struct lnet_md::options for the discussion on LNET_MD_ACK_DISABLE
* by which acknowledgments can be disabled for a MD.
*/
-typedef enum lnet_ack_req {
+enum lnet_ack_req {
/** Request an acknowledgment */
LNET_ACK_REQ,
/** Request that no acknowledgment should be generated. */
LNET_NOACK_REQ
-} lnet_ack_req_t;
+};
/** @} lnet_data */
/** @} lnet */
static int lnet_ping(struct lnet_process_id id, signed long timeout,
struct lnet_process_id __user *ids, int n_ids);
-static int lnet_discover(lnet_process_id_t id, __u32 force,
- lnet_process_id_t __user *ids, int n_ids);
+static int lnet_discover(struct lnet_process_id id, __u32 force,
+ struct lnet_process_id __user *ids, int n_ids);
static int
discovery_set(const char *val, struct kernel_param *kp)
/* Resize the push target. */
int lnet_push_target_resize(void)
{
- lnet_process_id_t id = { LNET_NID_ANY, LNET_PID_ANY };
- lnet_md_t md = { NULL };
- lnet_handle_me_t meh;
- lnet_handle_md_t mdh;
- lnet_handle_md_t old_mdh;
+ struct lnet_process_id id = { LNET_NID_ANY, LNET_PID_ANY };
+ struct lnet_md md = { NULL };
+ struct lnet_handle_me meh;
+ struct lnet_handle_md mdh;
+ struct lnet_handle_md old_mdh;
struct lnet_ping_buffer *pbuf;
struct lnet_ping_buffer *old_pbuf;
int nnis = the_lnet.ln_push_target_nnis;
mutex_lock(&the_lnet.ln_api_mutex);
rc = lnet_get_peer_list(&cfg->prcfg_count, &cfg->prcfg_size,
- (lnet_process_id_t __user *)cfg->prcfg_bulk);
+ (struct lnet_process_id __user *)cfg->prcfg_bulk);
mutex_unlock(&the_lnet.ln_api_mutex);
return rc;
}
}
static int
-lnet_discover(lnet_process_id_t id, __u32 force, lnet_process_id_t __user *ids,
- int n_ids)
+lnet_discover(struct lnet_process_id id, __u32 force,
+ struct lnet_process_id __user *ids, int n_ids)
{
struct lnet_peer_ni *lpni;
struct lnet_peer_ni *p;
struct lnet_peer *lp;
- lnet_process_id_t *buf;
+ struct lnet_process_id *buf;
int cpt;
int i;
int rc;
return NULL;
}
-void lnet_incr_stats(struct lnet_element_stats *stats, lnet_msg_type_t msg_type,
+void lnet_incr_stats(struct lnet_element_stats *stats,
+ enum lnet_msg_type msg_type,
enum lnet_stats_type stats_type)
{
struct lnet_comm_count *counts = get_stats_counts(stats, stats_type);
}
/* Call with the ln_api_mutex held */
-int
-lnet_get_peer_list(__u32 *countp, __u32 *sizep, lnet_process_id_t __user *ids)
+int lnet_get_peer_list(u32 *countp, u32 *sizep, struct lnet_process_id __user *ids)
{
- lnet_process_id_t id;
+ struct lnet_process_id id;
struct lnet_peer_table *ptable;
struct lnet_peer *lp;
__u32 count = 0;
* Called with lnet_res_lock(cpt) held. The cpt is the
* lnet_cpt_of_cookie() of the md handle cookie.
*/
-static void lnet_discovery_event_handler(lnet_event_t *event)
+static void lnet_discovery_event_handler(struct lnet_event *event)
{
struct lnet_peer *lp = event->md.user_ptr;
struct lnet_ping_buffer *pbuf;
static int
lnet_peer_set_primary_data(struct lnet_peer *lp, struct lnet_ping_buffer *pbuf)
{
- lnet_handle_md_t mdh;
+ struct lnet_handle_md mdh;
/* Queue lp for discovery, and force it on the request queue. */
lnet_net_lock(LNET_LOCK_EX);
static int lnet_peer_ping_failed(struct lnet_peer *lp)
__must_hold(&lp->lp_lock)
{
- lnet_handle_md_t mdh;
+ struct lnet_handle_md mdh;
int rc;
mdh = lp->lp_ping_mdh;
static int lnet_peer_send_ping(struct lnet_peer *lp)
__must_hold(&lp->lp_lock)
{
- lnet_md_t md = { NULL };
- lnet_process_id_t id;
+ struct lnet_md md = { NULL };
+ struct lnet_process_id id;
struct lnet_ping_buffer *pbuf;
int nnis;
int rc;
static int lnet_peer_push_failed(struct lnet_peer *lp)
__must_hold(&lp->lp_lock)
{
- lnet_handle_md_t mdh;
+ struct lnet_handle_md mdh;
int rc;
mdh = lp->lp_push_mdh;
__must_hold(&lp->lp_lock)
{
struct lnet_ping_buffer *pbuf;
- lnet_process_id_t id;
- lnet_md_t md;
+ struct lnet_process_id id;
+ struct lnet_md md;
int cpt;
int rc;
LIBCFS_FREE(rcd, sizeof(*rcd));
}
-static lnet_rc_data_t *
+static struct lnet_rc_data *
lnet_update_rc_data_locked(struct lnet_peer_ni *gateway)
{
struct lnet_handle_md mdh;
struct lnet_ioctl_ping_data ping;
struct cYAML *root = NULL, *ping_node = NULL, *item = NULL,
*first_seq = NULL, *tmp = NULL, *peer_ni = NULL;
- lnet_process_id_t id;
+ struct lnet_process_id id;
char err_str[LNET_MAX_STR_LEN] = {0};
char *sep, *token, *end;
char buf[6];
int i;
bool flag = false;
- len = (sizeof(lnet_process_id_t) * LNET_INTERFACES_MAX_DEFAULT);
+ len = (sizeof(struct lnet_process_id) * LNET_INTERFACES_MAX_DEFAULT);
data = calloc(1, len);
if (data == NULL)
*first_seq = NULL, *peer_root = NULL, *tmp = NULL,
*msg_statistics = NULL, *statistics = NULL;
char err_str[LNET_MAX_STR_LEN];
- lnet_process_id_t *list = NULL;
+ struct lnet_process_id *list = NULL;
void *data = NULL;
void *lpni_data;
goto out;
count = 1000;
- size = count * sizeof(lnet_process_id_t);
+ size = count * sizeof(struct lnet_process_id);
list = malloc(size);
if (list == NULL) {
l_errno = ENOMEM;
int l_errno = 0;
struct cYAML *root = NULL, *list_root = NULL, *first_seq = NULL;
char err_str[LNET_MAX_STR_LEN];
- lnet_process_id_t *list = NULL;
+ struct lnet_process_id *list = NULL;
snprintf(err_str, sizeof(err_str),
"\"out of memory\"");
goto out;
count = 1000;
- size = count * sizeof(lnet_process_id_t);
+ size = count * sizeof(struct lnet_process_id);
list = malloc(size);
if (list == NULL) {
l_errno = ENOMEM;
}
static int
-check_write_checksum(struct obdo *oa, const lnet_process_id_t *peer,
+check_write_checksum(struct obdo *oa, const struct lnet_process_id *peer,
__u32 client_cksum, __u32 server_cksum,
struct osc_brw_async_args *aa)
{
static int check_read_checksum(struct niobuf_local *local_nb, int npages,
struct obd_export *exp, struct obdo *oa,
- const lnet_process_id_t *peer,
+ const struct lnet_process_id *peer,
__u32 client_cksum, __u32 server_cksum,
enum cksum_types server_cksum_type)
{