Staging: lustre: lnet: Remove and rename struct typedefs
authorBhumika Goyal <bhumirks@gmail.com>
Wed, 2 Mar 2016 19:16:37 +0000 (00:46 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Mar 2016 23:28:13 +0000 (15:28 -0800)
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: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/selftest/conrpc.c
drivers/staging/lustre/lnet/selftest/console.h
drivers/staging/lustre/lnet/selftest/framework.c
drivers/staging/lustre/lnet/selftest/ping_test.c
drivers/staging/lustre/lnet/selftest/rpc.c
drivers/staging/lustre/lnet/selftest/selftest.h
drivers/staging/lustre/lnet/selftest/timer.c
drivers/staging/lustre/lnet/selftest/timer.h

index 736efce8b02f1dc65ba5626ea8486c59434fd9b2..e6376a01e7a18ce144c1fe84c00ae6e75f15cdaf 100644 (file)
@@ -1173,7 +1173,7 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist,
 static void
 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_t *crpc;
        srpc_msg_t *rep;
@@ -1290,7 +1290,7 @@ lstcon_rpc_pinger(void *arg)
 int
 lstcon_rpc_pinger_start(void)
 {
-       stt_timer_t *ptimer;
+       struct stt_timer *ptimer;
        int rc;
 
        LASSERT(list_empty(&console_session.ses_rpc_freelist));
index c9d1081d9f3892af3568f91db3615282837b8352..5421311ce6e874f92a761571218edabb5a9f3a57 100644 (file)
@@ -153,7 +153,7 @@ struct lstcon_session {
        __u64               ses_id_cookie;    /* batch id cookie */
        char                ses_name[LST_NAME_SIZE];/* session name */
        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 */
 
        struct list_head    ses_trans_list;   /* global list of transaction */
index e4a9724db68a5d536d6a1f46bf2190c648665e44..dbd2c615eb059399034d96053b96ce95835545f1 100644 (file)
@@ -160,7 +160,7 @@ static void
 sfw_add_session_timer(void)
 {
        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);
 
@@ -261,7 +261,7 @@ static inline void
 sfw_init_session(sfw_session_t *sn, lst_sid_t sid,
                 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));
        INIT_LIST_HEAD(&sn->sn_list);
index 9d27e395cba2ff7b965277c61073eb06df1792ff..6d44126db163e60e15cb1fde9cec263e3fe32b63 100644 (file)
@@ -48,12 +48,12 @@ static int ping_srv_workitems = SFW_TEST_WI_MAX;
 module_param(ping_srv_workitems, int, 0644);
 MODULE_PARM_DESC(ping_srv_workitems, "# PING server workitems");
 
-typedef struct {
+struct lst_ping_data {
        spinlock_t      pnd_lock;       /* serialize */
        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
 ping_client_init(sfw_test_instance_t *tsi)
index 1b76933b6df7359df7cb629f9ab2667d0c5e0ca5..129fa021aab4e828c875fa01ba6ab7b8e699ba08 100644 (file)
@@ -1100,7 +1100,7 @@ srpc_client_rpc_expired(void *data)
 static void
 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)
                return;
index f6c82447226897ac92cd29af8d68918fd267d905..4ca274f1798f5ad4e5207bff018c24771a28eac1 100644 (file)
@@ -207,7 +207,7 @@ typedef struct srpc_client_rpc {
        int               crpc_service;
        atomic_t          crpc_refcount;
        int               crpc_timeout;   /* # seconds to wait for reply */
-       stt_timer_t       crpc_timer;
+       struct stt_timer       crpc_timer;
        swi_workitem_t    crpc_wi;
        lnet_process_id_t crpc_dest;
 
@@ -328,7 +328,7 @@ typedef struct {
        unsigned int     sn_timeout; /* # seconds' inactivity to expire */
        int              sn_timer_active;
        unsigned int     sn_features;
-       stt_timer_t      sn_timer;
+       struct stt_timer      sn_timer;
        struct list_head sn_batches; /* list of batches */
        char             sn_name[LST_NAME_SIZE];
        atomic_t         sn_refcount;
index c89137182eee3df742562355867e47e0028606bb..f9f37baa131135b7a7f91c20746ecf15a536cfd6 100644 (file)
@@ -67,7 +67,7 @@ static struct st_timer_data {
 } stt_data;
 
 void
-stt_add_timer(stt_timer_t *timer)
+stt_add_timer(struct stt_timer *timer)
 {
        struct list_head *pos;
 
@@ -81,7 +81,8 @@ stt_add_timer(stt_timer_t *timer)
 
        /* a simple insertion sort */
        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)
                        break;
@@ -101,7 +102,7 @@ stt_add_timer(stt_timer_t *timer)
  * another CPU.
  */
 int
-stt_del_timer(stt_timer_t *timer)
+stt_del_timer(struct stt_timer *timer)
 {
        int ret = 0;
 
@@ -124,10 +125,10 @@ static int
 stt_expire_list(struct list_head *slot, time64_t now)
 {
        int expired = 0;
-       stt_timer_t *timer;
+       struct stt_timer *timer;
 
        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)
                        break;
index 03e2ee294c1c3cf3122b3a1810d0df0cdf335d46..2affecf27bb947985f08e939fffd8a97a81560e5 100644 (file)
 #ifndef __SELFTEST_TIMER_H__
 #define __SELFTEST_TIMER_H__
 
-typedef struct {
+struct stt_timer {
        struct list_head stt_list;
        time64_t         stt_expires;
        void             (*stt_func) (void *);
        void             *stt_data;
-} stt_timer_t;
+};
 
-void stt_add_timer(stt_timer_t *timer);
-int stt_del_timer(stt_timer_t *timer);
+void stt_add_timer(struct stt_timer *timer);
+int stt_del_timer(struct stt_timer *timer);
 int stt_startup(void);
 void stt_shutdown(void);