Whamcloud - gitweb
LU-16000 utils: align updatelog parameters in llog_reader
[fs/lustre-release.git] / lustre / utils / llog_reader.c
index b03d5df..dc2ef05 100644 (file)
@@ -43,6 +43,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/param.h>
 #ifdef HAVE_ENDIAN_H
 # include <endian.h>
 #endif
@@ -876,6 +877,12 @@ char *buf2str(void *buf, unsigned int size)
        return string;
 }
 
+static inline size_t
+object_update_param_size(const struct object_update_param *param)
+{
+       return roundup(sizeof(*param) + param->oup_len, sizeof(__u64));
+}
+
 void print_update_rec(struct llog_update_record *lur)
 {
        struct update_records *rec = &lur->lur_update_rec;
@@ -909,8 +916,8 @@ void print_update_rec(struct llog_update_record *lur)
        for (i = 0; i < pm_count; i++) {
                printf("\tp_%d - %d/%s\n", i, pm->oup_len,
                       buf2str(pm->oup_buf, pm->oup_len));
-               pm = (struct object_update_param *)((char *)(pm + 1) +
-                    pm->oup_len);
+               pm = (struct object_update_param *)((char *)pm +
+                    object_update_param_size(pm));
        }
        printf("\n");
 
@@ -920,7 +927,7 @@ static void print_unlink_rec(struct llog_unlink_rec *lur)
 {
        printf("unlink record id:0x%x target %llx:%x:%x\n",
                __le32_to_cpu(lur->lur_hdr.lrh_id),
-               __le64_to_cpu(lur->lur_oid),
+               (unsigned long long)__le64_to_cpu(lur->lur_oid),
                __le32_to_cpu(lur->lur_oseq),
                __le32_to_cpu(lur->lur_count));
 }
@@ -937,7 +944,7 @@ static void print_setattr64_rec(struct llog_setattr64_rec *lsr)
        printf("setattr64 record id:0x%x target "DFID" valid %llx uid %u:%u gid %u:%u\n",
                __le32_to_cpu(lsr->lsr_hdr.lrh_id),
                PFID(&lsr->lsr_oi.oi_fid),
-               __le64_to_cpu(lsr->lsr_valid),
+               (unsigned long long)__le64_to_cpu(lsr->lsr_valid),
                __le32_to_cpu(lsr->lsr_uid_h),
                __le32_to_cpu(lsr->lsr_uid),
                __le32_to_cpu(lsr->lsr_gid_h),
@@ -949,7 +956,7 @@ static void print_setattr64_rec_v2(struct llog_setattr64_rec_v2 *lsr)
        printf("setattr64 v2 record id:0x%x target "DFID" valid %llx uid %u:%u gid %u:%u prj %u\n",
                __le32_to_cpu(lsr->lsr_hdr.lrh_id),
                PFID(&lsr->lsr_oi.oi_fid),
-               __le64_to_cpu(lsr->lsr_valid),
+               (unsigned long long)__le64_to_cpu(lsr->lsr_valid),
                __le32_to_cpu(lsr->lsr_uid_h),
                __le32_to_cpu(lsr->lsr_uid),
                __le32_to_cpu(lsr->lsr_gid_h),