Whamcloud - gitweb
LU-10698 obdclass: allow specifying complex jobids
[fs/lustre-release.git] / lustre / ptlrpc / pack_generic.c
index 0338893..a66b6d4 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2016, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -90,13 +90,15 @@ int ptlrpc_buf_need_swab(struct ptlrpc_request *req, const int inout,
 }
 
 static inline int lustre_msg_check_version_v2(struct lustre_msg_v2 *msg,
-                                               __u32 version)
+                                             enum lustre_msg_version version)
 {
-        __u32 ver = lustre_msg_get_version(msg);
-        return (ver & LUSTRE_VERSION_MASK) != version;
+       enum lustre_msg_version ver = lustre_msg_get_version(msg);
+
+       return (ver & LUSTRE_VERSION_MASK) != version;
 }
 
-int lustre_msg_check_version(struct lustre_msg *msg, __u32 version)
+int lustre_msg_check_version(struct lustre_msg *msg,
+                            enum lustre_msg_version version)
 {
 #define LUSTRE_MSG_MAGIC_V1 0x0BD00BD0
        switch (msg->lm_magic) {
@@ -183,6 +185,7 @@ __u32 lustre_packed_msg_size(struct lustre_msg *msg)
                 return 0;
         }
 }
+EXPORT_SYMBOL(lustre_packed_msg_size);
 
 void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, __u32 *lens,
                         char **bufs)
@@ -800,7 +803,7 @@ static inline struct ptlrpc_body *lustre_msg_ptlrpc_body(struct lustre_msg *msg)
                                 sizeof(struct ptlrpc_body_v2));
 }
 
-__u32 lustre_msghdr_get_flags(struct lustre_msg *msg)
+enum lustre_msghdr lustre_msghdr_get_flags(struct lustre_msg *msg)
 {
        switch (msg->lm_magic) {
        case LUSTRE_MSG_MAGIC_V2:
@@ -954,7 +957,7 @@ __u32 lustre_msg_get_type(struct lustre_msg *msg)
 }
 EXPORT_SYMBOL(lustre_msg_get_type);
 
-__u32 lustre_msg_get_version(struct lustre_msg *msg)
+enum lustre_msg_version lustre_msg_get_version(struct lustre_msg *msg)
 {
        switch (msg->lm_magic) {
        case LUSTRE_MSG_MAGIC_V2: {
@@ -1510,9 +1513,9 @@ void lustre_msg_set_jobid(struct lustre_msg *msg, char *jobid)
                LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
 
                if (jobid != NULL)
-                       memcpy(pb->pb_jobid, jobid, LUSTRE_JOBID_SIZE);
+                       memcpy(pb->pb_jobid, jobid, sizeof(pb->pb_jobid));
                else if (pb->pb_jobid[0] == '\0')
-                       lustre_get_jobid(pb->pb_jobid);
+                       lustre_get_jobid(pb->pb_jobid, sizeof(pb->pb_jobid));
                return;
        }
        default:
@@ -1868,7 +1871,7 @@ void lustre_swab_mdt_body (struct mdt_body *b)
        __swab64s(&b->mbo_atime);
        __swab64s(&b->mbo_ctime);
        __swab64s(&b->mbo_blocks);
-       __swab64s(&b->mbo_ioepoch);
+       __swab64s(&b->mbo_version);
        __swab64s(&b->mbo_t_state);
        __swab32s(&b->mbo_fsuid);
        __swab32s(&b->mbo_fsgid);
@@ -1879,7 +1882,7 @@ void lustre_swab_mdt_body (struct mdt_body *b)
        __swab32s(&b->mbo_flags);
        __swab32s(&b->mbo_rdev);
        __swab32s(&b->mbo_nlink);
-       CLASSERT(offsetof(typeof(*b), mbo_unused2) != 0);
+       __swab32s(&b->mbo_layout_gen);
        __swab32s(&b->mbo_suppgid);
        __swab32s(&b->mbo_eadatasize);
        __swab32s(&b->mbo_aclsize);