Commit 27f9aea3 authored by Bhumika Goyal's avatar Bhumika Goyal Committed by Greg Kroah-Hartman

Staging: lustre: lnet: Remove and rename struct typedefs

Remove typedefs from structures stt_timer_t and lst_ping_data_t as typedef
for a structure type is not preferred. The suffix '_t' and the typedefs
are removed using coccinelle.

Script 1:
//Drop typedefs and '_t'
@r1@
type T;
@@

typedef struct { ... } T;

@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_t":
  coccinelle.T2 = T[:-2];
  print T
else:
  coccinelle.T2=T;

@@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;

Script 2:
//Replacement
@@
typedef stt_timer_t;
typedef lst_ping_data_t;
@@
(
- stt_timer_t
+ struct stt_timer
|
- lst_ping_data_t
+ struct lst_ping_data
)
Signed-off-by: default avatarBhumika Goyal <bhumirks@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5210a63a
...@@ -1173,7 +1173,7 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist, ...@@ -1173,7 +1173,7 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist,
static void static void
lstcon_rpc_pinger(void *arg) lstcon_rpc_pinger(void *arg)
{ {
stt_timer_t *ptimer = (stt_timer_t *)arg; struct stt_timer *ptimer = (struct stt_timer *)arg;
lstcon_rpc_trans_t *trans; lstcon_rpc_trans_t *trans;
lstcon_rpc_t *crpc; lstcon_rpc_t *crpc;
srpc_msg_t *rep; srpc_msg_t *rep;
...@@ -1290,7 +1290,7 @@ lstcon_rpc_pinger(void *arg) ...@@ -1290,7 +1290,7 @@ lstcon_rpc_pinger(void *arg)
int int
lstcon_rpc_pinger_start(void) lstcon_rpc_pinger_start(void)
{ {
stt_timer_t *ptimer; struct stt_timer *ptimer;
int rc; int rc;
LASSERT(list_empty(&console_session.ses_rpc_freelist)); LASSERT(list_empty(&console_session.ses_rpc_freelist));
......
...@@ -153,7 +153,7 @@ struct lstcon_session { ...@@ -153,7 +153,7 @@ struct lstcon_session {
__u64 ses_id_cookie; /* batch id cookie */ __u64 ses_id_cookie; /* batch id cookie */
char ses_name[LST_NAME_SIZE];/* session name */ char ses_name[LST_NAME_SIZE];/* session name */
lstcon_rpc_trans_t *ses_ping; /* session pinger */ lstcon_rpc_trans_t *ses_ping; /* session pinger */
stt_timer_t ses_ping_timer; /* timer for pinger */ struct stt_timer ses_ping_timer; /* timer for pinger */
lstcon_trans_stat_t ses_trans_stat; /* transaction stats */ lstcon_trans_stat_t ses_trans_stat; /* transaction stats */
struct list_head ses_trans_list; /* global list of transaction */ struct list_head ses_trans_list; /* global list of transaction */
......
...@@ -160,7 +160,7 @@ static void ...@@ -160,7 +160,7 @@ static void
sfw_add_session_timer(void) sfw_add_session_timer(void)
{ {
sfw_session_t *sn = sfw_data.fw_session; sfw_session_t *sn = sfw_data.fw_session;
stt_timer_t *timer = &sn->sn_timer; struct stt_timer *timer = &sn->sn_timer;
LASSERT(!sfw_data.fw_shuttingdown); LASSERT(!sfw_data.fw_shuttingdown);
...@@ -261,7 +261,7 @@ static inline void ...@@ -261,7 +261,7 @@ static inline void
sfw_init_session(sfw_session_t *sn, lst_sid_t sid, sfw_init_session(sfw_session_t *sn, lst_sid_t sid,
unsigned features, const char *name) unsigned features, const char *name)
{ {
stt_timer_t *timer = &sn->sn_timer; struct stt_timer *timer = &sn->sn_timer;
memset(sn, 0, sizeof(sfw_session_t)); memset(sn, 0, sizeof(sfw_session_t));
INIT_LIST_HEAD(&sn->sn_list); INIT_LIST_HEAD(&sn->sn_list);
......
...@@ -48,12 +48,12 @@ static int ping_srv_workitems = SFW_TEST_WI_MAX; ...@@ -48,12 +48,12 @@ static int ping_srv_workitems = SFW_TEST_WI_MAX;
module_param(ping_srv_workitems, int, 0644); module_param(ping_srv_workitems, int, 0644);
MODULE_PARM_DESC(ping_srv_workitems, "# PING server workitems"); MODULE_PARM_DESC(ping_srv_workitems, "# PING server workitems");
typedef struct { struct lst_ping_data {
spinlock_t pnd_lock; /* serialize */ spinlock_t pnd_lock; /* serialize */
int pnd_counter; /* sequence counter */ int pnd_counter; /* sequence counter */
} lst_ping_data_t; };
static lst_ping_data_t lst_ping_data; static struct lst_ping_data lst_ping_data;
static int static int
ping_client_init(sfw_test_instance_t *tsi) ping_client_init(sfw_test_instance_t *tsi)
......
...@@ -1100,7 +1100,7 @@ srpc_client_rpc_expired(void *data) ...@@ -1100,7 +1100,7 @@ srpc_client_rpc_expired(void *data)
static void static void
srpc_add_client_rpc_timer(srpc_client_rpc_t *rpc) srpc_add_client_rpc_timer(srpc_client_rpc_t *rpc)
{ {
stt_timer_t *timer = &rpc->crpc_timer; struct stt_timer *timer = &rpc->crpc_timer;
if (!rpc->crpc_timeout) if (!rpc->crpc_timeout)
return; return;
......
...@@ -207,7 +207,7 @@ typedef struct srpc_client_rpc { ...@@ -207,7 +207,7 @@ typedef struct srpc_client_rpc {
int crpc_service; int crpc_service;
atomic_t crpc_refcount; atomic_t crpc_refcount;
int crpc_timeout; /* # seconds to wait for reply */ int crpc_timeout; /* # seconds to wait for reply */
stt_timer_t crpc_timer; struct stt_timer crpc_timer;
swi_workitem_t crpc_wi; swi_workitem_t crpc_wi;
lnet_process_id_t crpc_dest; lnet_process_id_t crpc_dest;
...@@ -328,7 +328,7 @@ typedef struct { ...@@ -328,7 +328,7 @@ typedef struct {
unsigned int sn_timeout; /* # seconds' inactivity to expire */ unsigned int sn_timeout; /* # seconds' inactivity to expire */
int sn_timer_active; int sn_timer_active;
unsigned int sn_features; unsigned int sn_features;
stt_timer_t sn_timer; struct stt_timer sn_timer;
struct list_head sn_batches; /* list of batches */ struct list_head sn_batches; /* list of batches */
char sn_name[LST_NAME_SIZE]; char sn_name[LST_NAME_SIZE];
atomic_t sn_refcount; atomic_t sn_refcount;
......
...@@ -67,7 +67,7 @@ static struct st_timer_data { ...@@ -67,7 +67,7 @@ static struct st_timer_data {
} stt_data; } stt_data;
void void
stt_add_timer(stt_timer_t *timer) stt_add_timer(struct stt_timer *timer)
{ {
struct list_head *pos; struct list_head *pos;
...@@ -81,7 +81,8 @@ stt_add_timer(stt_timer_t *timer) ...@@ -81,7 +81,8 @@ stt_add_timer(stt_timer_t *timer)
/* a simple insertion sort */ /* a simple insertion sort */
list_for_each_prev(pos, STTIMER_SLOT(timer->stt_expires)) { list_for_each_prev(pos, STTIMER_SLOT(timer->stt_expires)) {
stt_timer_t *old = list_entry(pos, stt_timer_t, stt_list); struct stt_timer *old = list_entry(pos, struct stt_timer,
stt_list);
if (timer->stt_expires >= old->stt_expires) if (timer->stt_expires >= old->stt_expires)
break; break;
...@@ -101,7 +102,7 @@ stt_add_timer(stt_timer_t *timer) ...@@ -101,7 +102,7 @@ stt_add_timer(stt_timer_t *timer)
* another CPU. * another CPU.
*/ */
int int
stt_del_timer(stt_timer_t *timer) stt_del_timer(struct stt_timer *timer)
{ {
int ret = 0; int ret = 0;
...@@ -124,10 +125,10 @@ static int ...@@ -124,10 +125,10 @@ static int
stt_expire_list(struct list_head *slot, time64_t now) stt_expire_list(struct list_head *slot, time64_t now)
{ {
int expired = 0; int expired = 0;
stt_timer_t *timer; struct stt_timer *timer;
while (!list_empty(slot)) { while (!list_empty(slot)) {
timer = list_entry(slot->next, stt_timer_t, stt_list); timer = list_entry(slot->next, struct stt_timer, stt_list);
if (timer->stt_expires > now) if (timer->stt_expires > now)
break; break;
......
...@@ -38,15 +38,15 @@ ...@@ -38,15 +38,15 @@
#ifndef __SELFTEST_TIMER_H__ #ifndef __SELFTEST_TIMER_H__
#define __SELFTEST_TIMER_H__ #define __SELFTEST_TIMER_H__
typedef struct { struct stt_timer {
struct list_head stt_list; struct list_head stt_list;
time64_t stt_expires; time64_t stt_expires;
void (*stt_func) (void *); void (*stt_func) (void *);
void *stt_data; void *stt_data;
} stt_timer_t; };
void stt_add_timer(stt_timer_t *timer); void stt_add_timer(struct stt_timer *timer);
int stt_del_timer(stt_timer_t *timer); int stt_del_timer(struct stt_timer *timer);
int stt_startup(void); int stt_startup(void);
void stt_shutdown(void); void stt_shutdown(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment