From e6581008d8aa99688561da8200743d4d1368b11d Mon Sep 17 00:00:00 2001
From: girish <girish>
Date: Wed, 16 Jul 2008 18:55:38 +0000
Subject: [PATCH] Cleanup compiler warnings b=15981 i=adilger i=rread

---
 libcfs/libcfs/debug.c       |  4 +++-
 lustre/include/lustre_net.h |  3 +++
 lustre/ldlm/ldlm_request.c  |  2 +-
 lustre/lmv/lmv_obd.c        |  7 +++++--
 lustre/lmv/lmv_object.c     |  5 +++--
 lustre/mdt/mdt_handler.c    |  6 +++---
 lustre/obdclass/mea.c       |  1 -
 lustre/osc/osc_request.c    | 20 ++++++++++----------
 lustre/ptlrpc/client.c      |  2 +-
 lustre/ptlrpc/import.c      |  2 +-
 10 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/libcfs/libcfs/debug.c b/libcfs/libcfs/debug.c
index 096df429b6..d5b49ba112 100644
--- a/libcfs/libcfs/debug.c
+++ b/libcfs/libcfs/debug.c
@@ -101,7 +101,9 @@ char debug_file_path[1024] = "/r/tmp/lustre-log";
 #else
 char debug_file_path[1024] = "/tmp/lustre-log";
 #endif
-CFS_MODULE_PARM(debug_file_path, "s", charp, 0644,
+char *debug_file_path_p = &debug_file_path[0];
+
+CFS_MODULE_PARM(debug_file_path_p, "s", charp, 0644,
                 "Path for dumping debug logs, "
                 "set 'NONE' to prevent log dumping");
 
diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h
index 0ca4cc5b91..12bed02cb4 100644
--- a/lustre/include/lustre_net.h
+++ b/lustre/include/lustre_net.h
@@ -166,6 +166,9 @@
 #define OST_MAXREQSIZE  (5 * 1024)
 #define OST_MAXREPSIZE  (9 * 1024)
 
+/* Macro to hide a typecast. */
+#define ptlrpc_req_async_args(req) ((void *)&req->rq_async_args)
+
 struct ptlrpc_connection {
         struct list_head        c_link;
         struct hlist_node       c_hash;
diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c
index b1418db31a..32cfc160f2 100644
--- a/lustre/ldlm/ldlm_request.c
+++ b/lustre/ldlm/ldlm_request.c
@@ -2088,7 +2088,7 @@ static int replay_one_lock(struct obd_import *imp, struct ldlm_lock *lock)
 
         atomic_inc(&req->rq_import->imp_replay_inflight);
         CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args));
-        aa = (struct ldlm_async_args *)&req->rq_async_args;
+        aa = ptlrpc_req_async_args(req);
         aa->lock_handle = body->lock_handle[0];
         req->rq_interpret_reply = replay_lock_interpret;
         ptlrpcd_add_req(req);
diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c
index 82c33cd7c5..920a0ca7e5 100644
--- a/lustre/lmv/lmv_obd.c
+++ b/lustre/lmv/lmv_obd.c
@@ -1352,7 +1352,8 @@ int lmv_handle_split(struct obd_export *exp, const struct lu_fid *fid)
         else
                 lmv_obj_put(obj);
 
-        obd_free_memmd(exp, (struct lov_stripe_md **)&md.mea);
+        /* XXX LOV STACKING */
+        obd_free_memmd(exp, (void *)&md.mea);
 
         EXIT;
 cleanup:
@@ -2819,8 +2820,10 @@ int lmv_free_lustre_md(struct obd_export *exp, struct lustre_md *md)
         struct lmv_obd *lmv = &obd->u.lmv;
 
         ENTRY;
+
+        /* XXX LOV STACKING */
         if (md->mea)
-                obd_free_memmd(exp, (struct lov_stripe_md**)&md->mea);
+                obd_free_memmd(exp, (void *)&md->mea);
         RETURN(md_free_lustre_md(lmv->tgts[0].ltd_exp, md));
 }
 
diff --git a/lustre/lmv/lmv_object.c b/lustre/lmv/lmv_object.c
index 2c82ffe547..3854c33999 100644
--- a/lustre/lmv/lmv_object.c
+++ b/lustre/lmv/lmv_object.c
@@ -347,9 +347,10 @@ lmv_obj_create(struct obd_export *exp, const struct lu_fid *fid,
                        PFID(fid));
                 GOTO(cleanup, obj = ERR_PTR(-ENOMEM));
         }
-	
+
+        /* XXX LOV STACKING */
 	if (md.mea != NULL)
-		obd_free_memmd(exp, (struct lov_stripe_md **)&md.mea);
+		obd_free_memmd(exp, (void *)&md.mea);
 
 	EXIT;
 cleanup:
diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c
index 0f15c69580..ac2a19979a 100644
--- a/lustre/mdt/mdt_handler.c
+++ b/lustre/mdt/mdt_handler.c
@@ -927,8 +927,10 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
                 LDLM_LOCK_PUT(lock);
                 rc = 0;
         } else {
-                struct md_attr *ma = &info->mti_attr;
+                struct md_attr *ma;
 relock:
+                ma = &info->mti_attr;
+
                 mdt_lock_handle_init(lhc);
                 mdt_lock_reg_init(lhc, LCK_PR);
 
@@ -970,7 +972,6 @@ relock:
                 lock = ldlm_handle2lock(&lhc->mlh_reg_lh);
                 if (lock) {
                         struct mdt_body *repbody;
-                        struct lu_attr *ma;
 
                         /* Debugging code. */
                         res_id = &lock->l_resource->lr_name;
@@ -988,7 +989,6 @@ relock:
                          */
                         repbody = req_capsule_server_get(info->mti_pill,
                                                          &RMF_MDT_BODY);
-                        ma = &info->mti_attr.ma_attr;
                         if (lock->l_policy_data.l_inodebits.bits &
                             MDS_INODELOCK_UPDATE)
                                 mdt_pack_size2body(info, child);
diff --git a/lustre/obdclass/mea.c b/lustre/obdclass/mea.c
index a7bd3e4315..c2841beed2 100644
--- a/lustre/obdclass/mea.c
+++ b/lustre/obdclass/mea.c
@@ -137,7 +137,6 @@ static int mea_hash_segment(int count, const char *name, int namelen)
 #else
 static int mea_hash_segment(int count, char *name, int namelen)
 {
-#warning "fix for liblustre"
         return 0;
 }
 #endif
diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c
index e5f368cefa..a52db0d99b 100644
--- a/lustre/osc/osc_request.c
+++ b/lustre/osc/osc_request.c
@@ -248,7 +248,7 @@ static int osc_getattr_async(struct obd_export *exp, struct obd_info *oinfo,
         req->rq_interpret_reply = osc_getattr_interpret;
 
         CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args));
-        aa = (struct osc_async_args *)&req->rq_async_args;
+        aa = ptlrpc_req_async_args(req);
         aa->aa_oi = oinfo;
 
         ptlrpc_set_add_req(set, req);
@@ -397,7 +397,7 @@ static int osc_setattr_async(struct obd_export *exp, struct obd_info *oinfo,
                 req->rq_interpret_reply = osc_setattr_interpret;
 
                 CLASSERT (sizeof(*aa) <= sizeof(req->rq_async_args));
-                aa = (struct osc_async_args *)&req->rq_async_args;
+                aa = ptlrpc_req_async_args(req);
                 aa->aa_oi = oinfo;
 
                 ptlrpc_set_add_req(rqset, req);
@@ -551,7 +551,7 @@ static int osc_punch(struct obd_export *exp, struct obd_info *oinfo,
 
         req->rq_interpret_reply = osc_punch_interpret;
         CLASSERT (sizeof(*aa) <= sizeof(req->rq_async_args));
-        aa = (struct osc_async_args *)&req->rq_async_args;
+        aa = ptlrpc_req_async_args(req);
         aa->aa_oi = oinfo;
         ptlrpc_set_add_req(rqset, req);
 
@@ -1180,7 +1180,7 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,struct obdo *oa,
         ptlrpc_request_set_replen(req);
 
         CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args));
-        aa = (struct osc_brw_async_args *)&req->rq_async_args;
+        aa = ptlrpc_req_async_args(req);
         aa->aa_oa = oa;
         aa->aa_requested_nob = requested_nob;
         aa->aa_nio_count = niocount;
@@ -1501,7 +1501,7 @@ int osc_brw_redo_request(struct ptlrpc_request *request,
         new_req->rq_async_args = request->rq_async_args;
         new_req->rq_sent = cfs_time_current_sec() + aa->aa_resends;
 
-        new_aa = (struct osc_brw_async_args *)&new_req->rq_async_args;
+        new_aa = ptlrpc_req_async_args(new_req);
 
         CFS_INIT_LIST_HEAD(&new_aa->aa_oaps);
         list_splice(&aa->aa_oaps, &new_aa->aa_oaps);
@@ -1551,7 +1551,7 @@ static int async_internal(int cmd, struct obd_export *exp, struct obdo *oa,
         rc = osc_brw_prep_request(cmd, cli, oa, lsm, page_count, pga,
                                   &req, ocapa);
 
-        aa = (struct osc_brw_async_args *)&req->rq_async_args;
+        aa = ptlrpc_req_async_args(req);
         if (cmd == OBD_BRW_READ) {
                 lprocfs_oh_tally_log2(&cli->cl_read_page_hist, page_count);
                 lprocfs_oh_tally(&cli->cl_read_rpc_hist, cli->cl_r_in_flight);
@@ -2142,7 +2142,7 @@ static struct ptlrpc_request *osc_build_req(struct client_obd *cli,
                             OBD_MD_FLMTIME | OBD_MD_FLCTIME | OBD_MD_FLATIME);
 
         CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args));
-        aa = (struct osc_brw_async_args *)&req->rq_async_args;
+        aa = ptlrpc_req_async_args(req);
         CFS_INIT_LIST_HEAD(&aa->aa_oaps);
         list_splice(rpc_list, &aa->aa_oaps);
         CFS_INIT_LIST_HEAD(rpc_list);
@@ -2333,7 +2333,7 @@ static int osc_send_oap_rpc(struct client_obd *cli, struct lov_oinfo *loi,
                 RETURN(PTR_ERR(req));
         }
 
-        aa = (struct osc_brw_async_args *)&req->rq_async_args;
+        aa = ptlrpc_req_async_args(req);
 
         if (cmd == OBD_BRW_READ) {
                 lprocfs_oh_tally_log2(&cli->cl_read_page_hist, page_count);
@@ -3226,7 +3226,7 @@ static int osc_enqueue(struct obd_export *exp, struct obd_info *oinfo,
                 if (!rc) {
                         struct osc_enqueue_args *aa;
                         CLASSERT (sizeof(*aa) <= sizeof(req->rq_async_args));
-                        aa = (struct osc_enqueue_args *)&req->rq_async_args;
+                        aa = ptlrpc_req_async_args(req);
                         aa->oa_oi = oinfo;
                         aa->oa_ei = einfo;
                         aa->oa_exp = exp;
@@ -3386,7 +3386,7 @@ static int osc_statfs_async(struct obd_device *obd, struct obd_info *oinfo,
 
         req->rq_interpret_reply = osc_statfs_interpret;
         CLASSERT (sizeof(*aa) <= sizeof(req->rq_async_args));
-        aa = (struct osc_async_args *)&req->rq_async_args;
+        aa = ptlrpc_req_async_args(req);
         aa->aa_oi = oinfo;
 
         ptlrpc_set_add_req(rqset, req);
diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c
index 8fa9fff9a0..d2005cd835 100644
--- a/lustre/ptlrpc/client.c
+++ b/lustre/ptlrpc/client.c
@@ -2242,7 +2242,7 @@ int ptlrpc_replay_req(struct ptlrpc_request *req)
         LASSERT(req->rq_bulk == NULL);
 
         LASSERT (sizeof (*aa) <= sizeof (req->rq_async_args));
-        aa = (struct ptlrpc_replay_async_args *)&req->rq_async_args;
+        aa = ptlrpc_req_async_args(req);
         memset(aa, 0, sizeof *aa);
 
         /* Prepare request to be resent with ptlrpcd */
diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c
index 7214a054f8..dd09f3d645 100644
--- a/lustre/ptlrpc/import.c
+++ b/lustre/ptlrpc/import.c
@@ -567,7 +567,7 @@ int ptlrpc_connect_import(struct obd_import *imp, char *new_uuid)
         request->rq_interpret_reply = ptlrpc_connect_interpret;
 
         CLASSERT(sizeof (*aa) <= sizeof (request->rq_async_args));
-        aa = (struct ptlrpc_connect_async_args *)&request->rq_async_args;
+        aa = ptlrpc_req_async_args(request);
         memset(aa, 0, sizeof *aa);
 
         aa->pcaa_peer_committed = committed_before_reconnect;
-- 
GitLab