void gfs2_log_header_in(struct gfs2_log_header_host *lh, const void *buf) { const struct gfs2_log_header *str = buf; gfs2_meta_header_in(&lh->lh_header, buf); lh->lh_sequence = be64_to_cpu(str->lh_sequence); lh->lh_flags = be32_to_cpu(str->lh_flags); lh->lh_tail = be32_to_cpu(str->lh_tail); lh->lh_blkno = be32_to_cpu(str->lh_blkno); lh->lh_hash = be32_to_cpu(str->lh_hash); }
/** * gfs1_rgrp_in - read in a gfs1 rgrp */ static void gfs1_rgrp_in(struct gfs_rgrp *rgrp, struct gfs2_buffer_head *rbh) { struct gfs_rgrp *str = (struct gfs_rgrp *)rbh->b_data; gfs2_meta_header_in(&rgrp->rg_header, rbh); rgrp->rg_flags = be32_to_cpu(str->rg_flags); rgrp->rg_free = be32_to_cpu(str->rg_free); rgrp->rg_useddi = be32_to_cpu(str->rg_useddi); rgrp->rg_freedi = be32_to_cpu(str->rg_freedi); gfs2_inum_in(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list); rgrp->rg_usedmeta = be32_to_cpu(str->rg_usedmeta); rgrp->rg_freemeta = be32_to_cpu(str->rg_freemeta); memcpy(rgrp->rg_reserved, str->rg_reserved, 64); }
void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf) { const struct gfs2_sb *str = buf; gfs2_meta_header_in(&sb->sb_header, buf); sb->sb_fs_format = be32_to_cpu(str->sb_fs_format); sb->sb_multihost_format = be32_to_cpu(str->sb_multihost_format); sb->sb_bsize = be32_to_cpu(str->sb_bsize); sb->sb_bsize_shift = be32_to_cpu(str->sb_bsize_shift); gfs2_inum_in(&sb->sb_master_dir, (char *)&str->sb_master_dir); gfs2_inum_in(&sb->sb_root_dir, (char *)&str->sb_root_dir); memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN); memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN); }
int display_gfs2(struct gfs2_buffer_head *dbh) { struct gfs2_meta_header mh; struct gfs2_rgrp rg; struct gfs2_leaf lf; struct gfs_log_header lh1; struct gfs2_log_header lh; struct gfs2_log_descriptor ld; struct gfs2_quota_change qc; uint32_t magic; magic = be32_to_cpu(*(uint32_t *)dbh->b_data); switch (magic) { case GFS2_MAGIC: gfs2_meta_header_in(&mh, dbh); if (mh.mh_type > GFS2_METATYPE_QC) print_gfs2("Unknown metadata type"); else print_gfs2("%s:", block_type_str[mh.mh_type]); eol(0); switch (mh.mh_type) { case GFS2_METATYPE_SB: gfs2_sb_in(&sbd.sd_sb, dbh); gfs2_sb_print2(&sbd.sd_sb); break; case GFS2_METATYPE_RG: if (sbd.gfs1) { struct gfs_rgrp rg1; gfs1_rgrp_in(&rg1, dbh); gfs1_rgrp_print(&rg1); } else { gfs2_rgrp_in(&rg, dbh); gfs2_rgrp_print(&rg); } break; case GFS2_METATYPE_RB: gfs2_meta_header_print(&mh); break; case GFS2_METATYPE_DI: gfs2_dinode_print(&di); break; case GFS2_METATYPE_IN: gfs2_meta_header_print(&mh); break; case GFS2_METATYPE_LF: gfs2_leaf_in(&lf, dbh); gfs2_leaf_print(&lf); break; case GFS2_METATYPE_JD: gfs2_meta_header_print(&mh); break; case GFS2_METATYPE_LH: if (sbd.gfs1) { gfs_log_header_in(&lh1, dbh); gfs_log_header_print(&lh1); } else { gfs2_log_header_in(&lh, dbh); gfs2_log_header_print(&lh); } break; case GFS2_METATYPE_LD: gfs2_log_descriptor_in(&ld, dbh); gfs2_log_descriptor_print(&ld); break; case GFS2_METATYPE_EA: do_eattr_extended(dbh); break; case GFS2_METATYPE_ED: gfs2_meta_header_print(&mh); break; case GFS2_METATYPE_LB: gfs2_meta_header_print(&mh); break; case GFS2_METATYPE_QC: gfs2_quota_change_in(&qc, dbh); gfs2_quota_change_print(&qc); break; default: break; } break; default: print_gfs2("Unknown block type"); eol(0); break; }; return(0); }