This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-extents in repository gfs2-utils.
commit 534c6da9cd68931fa14603f35b08cc1af040fd82 Author: Andrew Price anprice@redhat.com AuthorDate: Wed Apr 21 15:31:40 2021 +0100
libgfs2: Add functions for printing struct gfs2_extent(_header)
It makes more sense to convert the big-endian values as we print them instead of having a separate conversion step, so provide new macros to simplify that.
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/libgfs2/libgfs2.h | 3 +++ gfs2/libgfs2/ondisk.c | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h index 65e1b8c8..ba556151 100644 --- a/gfs2/libgfs2/libgfs2.h +++ b/gfs2/libgfs2/libgfs2.h @@ -741,6 +741,9 @@ extern void gfs2_log_header_print(const struct gfs2_log_header *lh); extern void gfs2_log_descriptor_print(const struct gfs2_log_descriptor *ld); extern void gfs2_statfs_change_print(const struct gfs2_statfs_change *sc); extern void gfs2_quota_change_print(const struct gfs2_quota_change *qc); +/* These expect on-disk data instead of native-endian structs */ +extern void lgfs2_extent_header_print(void *ehp); +extern void lgfs2_extent_print(void *exp);
__END_DECLS
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c index 35a0b3db..e46073e3 100644 --- a/gfs2/libgfs2/ondisk.c +++ b/gfs2/libgfs2/ondisk.c @@ -16,6 +16,15 @@ print_it(" ", fmt, fmt2, struct->member); \ } while (0);
+#define printbe16(struct, member) do { \ + print_it(" "#member, "%"PRIu16, "0x%"PRIx16, be16_to_cpu(struct->member)); \ + } while(0) +#define printbe32(struct, member) do { \ + print_it(" "#member, "%"PRIu32, "0x%"PRIx32, be32_to_cpu(struct->member)); \ + } while(0) +#define printbe64(struct, member) do { \ + print_it(" "#member, "%"PRIu64, "0x%"PRIx64, be64_to_cpu(struct->member)); \ + } while(0)
#define CPIN_08(s1, s2, member, count) {memcpy((s1->member), (s2->member), (count));} #define CPOUT_08(s1, s2, member, count) {memcpy((s2->member), (s1->member), (count));} @@ -375,6 +384,23 @@ void gfs2_dinode_print(const struct gfs2_dinode *di) pv(di, di_eattr, "%"PRIu64, "0x%"PRIx64); }
+void lgfs2_extent_header_print(void *ehp) +{ + struct gfs2_extent_header *eh = ehp; + + printbe16(eh, eh_entries); +} + +void lgfs2_extent_print(void *exp) +{ + struct gfs2_extent *ex = exp; + + printbe64(ex, ex_start); + printbe64(ex, ex_addr); + printbe16(ex, ex_len); + printbe16(ex, ex_flags); +} + void gfs2_dirent_in(struct gfs2_dirent *de, char *buf) { struct gfs2_dirent *str = (struct gfs2_dirent *)buf;
cluster-commits@lists.fedorahosted.org