Whamcloud - gitweb
LU-6486 ptlrpc: export lustre_swab_lov_mds_md
[fs/lustre-release.git] / lustre / ptlrpc / pack_generic.c
index dcab780..c92db1f 100644 (file)
@@ -1034,6 +1034,25 @@ __u64 lustre_msg_get_last_xid(struct lustre_msg *msg)
                 return 0;
         }
 }
+EXPORT_SYMBOL(lustre_msg_get_last_xid);
+
+__u16 lustre_msg_get_tag(struct lustre_msg *msg)
+{
+       switch (msg->lm_magic) {
+       case LUSTRE_MSG_MAGIC_V2: {
+               struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
+               if (!pb) {
+                       CERROR("invalid msg %p: no ptlrpc body!\n", msg);
+                       return 0;
+               }
+               return pb->pb_tag;
+       }
+       default:
+               CERROR("incorrect message magic: %08x\n", msg->lm_magic);
+               return 0;
+       }
+}
+EXPORT_SYMBOL(lustre_msg_get_tag);
 
 __u64 lustre_msg_get_last_committed(struct lustre_msg *msg)
 {
@@ -1390,6 +1409,22 @@ void lustre_msg_set_last_xid(struct lustre_msg *msg, __u64 last_xid)
                 LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic);
         }
 }
+EXPORT_SYMBOL(lustre_msg_set_last_xid);
+
+void lustre_msg_set_tag(struct lustre_msg *msg, __u16 tag)
+{
+       switch (msg->lm_magic) {
+       case LUSTRE_MSG_MAGIC_V2: {
+               struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
+               LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
+               pb->pb_tag = tag;
+               return;
+       }
+       default:
+               LASSERTF(0, "incorrect message magic: %08x\n", msg->lm_magic);
+       }
+}
+EXPORT_SYMBOL(lustre_msg_set_tag);
 
 void lustre_msg_set_last_committed(struct lustre_msg *msg, __u64 last_committed)
 {
@@ -1623,7 +1658,7 @@ void lustre_swab_ptlrpc_body(struct ptlrpc_body *b)
         __swab32s (&b->pb_opc);
         __swab32s (&b->pb_status);
         __swab64s (&b->pb_last_xid);
-        __swab64s (&b->pb_last_seen);
+       __swab16s (&b->pb_tag);
         __swab64s (&b->pb_last_committed);
         __swab64s (&b->pb_transno);
         __swab32s (&b->pb_flags);
@@ -1637,7 +1672,9 @@ void lustre_swab_ptlrpc_body(struct ptlrpc_body *b)
         __swab64s (&b->pb_pre_versions[1]);
         __swab64s (&b->pb_pre_versions[2]);
         __swab64s (&b->pb_pre_versions[3]);
-        CLASSERT(offsetof(typeof(*b), pb_padding) != 0);
+       CLASSERT(offsetof(typeof(*b), pb_padding0) != 0);
+       CLASSERT(offsetof(typeof(*b), pb_padding1) != 0);
+       CLASSERT(offsetof(typeof(*b), pb_padding) != 0);
        /* While we need to maintain compatibility between
         * clients and servers without ptlrpc_body_v2 (< 2.3)
         * do not swab any fields beyond pb_jobid, as we are
@@ -2184,6 +2221,7 @@ void lustre_swab_lov_mds_md(struct lov_mds_md *lmm)
        __swab16s(&lmm->lmm_layout_gen);
        EXIT;
 }
+EXPORT_SYMBOL(lustre_swab_lov_mds_md);
 
 void lustre_swab_lov_user_md_objects(struct lov_user_ost_data *lod,
                                      int stripe_count)