Whamcloud - gitweb
LU-15317 libcfs: Remove D_TTY
[fs/lustre-release.git] / lustre / obdclass / llog_swab.c
index 3b35f42..67c0ce6 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * lustre/obdclass/llog_swab.c
  *
@@ -203,21 +202,28 @@ void lustre_swab_llog_rec(struct llog_rec_hdr *rec)
                 * Because the tail follows a variable-length structure we need
                 * to compute its location at runtime
                 */
-               tail = (struct llog_rec_tail *)((char *)&cr->cr +
-                                               changelog_rec_size(&cr->cr) +
-                                               cr->cr.cr_namelen);
+               tail = (struct llog_rec_tail *)((char *)rec +
+                                               rec->lrh_len - sizeof(*tail));
                break;
        }
 
        case CHANGELOG_USER_REC:
+       case CHANGELOG_USER_REC2:
        {
-               struct llog_changelog_user_rec *cur =
-                       (struct llog_changelog_user_rec *)rec;
+               struct llog_changelog_user_rec2 *cur =
+                       (struct llog_changelog_user_rec2 *)rec;
 
                __swab32s(&cur->cur_id);
                __swab64s(&cur->cur_endrec);
                __swab32s(&cur->cur_time);
-               tail = &cur->cur_tail;
+               if (cur->cur_hdr.lrh_type == CHANGELOG_USER_REC2) {
+                       __swab32s(&cur->cur_mask);
+                       BUILD_BUG_ON(offsetof(typeof(*cur), cur_padding1) == 0);
+                       BUILD_BUG_ON(offsetof(typeof(*cur), cur_padding2) == 0);
+                       BUILD_BUG_ON(offsetof(typeof(*cur), cur_padding3) == 0);
+               }
+               tail = (struct llog_rec_tail *)((char *)rec +
+                                               rec->lrh_len - sizeof(*tail));
                break;
        }
 
@@ -446,7 +452,7 @@ void lustre_swab_cfg_marker(struct cfg_marker *marker, int swab, int size)
                __u32 createtime, canceltime;
                /*
                 * There was a problem with the original declaration of
-                * cfg_marker on 32-bit systems because it used time_t as
+                * cfg_marker on 32-bit systems because it used 32 time as
                 * a wire protocol structure, and didn't verify this in
                 * wirecheck.  We now have to convert the offsets of the
                 * later fields in order to work on 32- and 64-bit systems.