{ "btreeblks", FLDT_UINT32D, OI(OFF(btreeblks)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(uuid)), C1, 0, TYP_NONE },
{ "lsn", FLDT_UINT64X, OI(OFF(lsn)), C1, 0, TYP_NONE },
- { "crc", FLDT_UINT32X, OI(OFF(crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(OFF(crc)), C1, 0, TYP_NONE },
{ NULL }
};
{ "seqno", FLDT_AGNUMBER, OI(OFF(seqno)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(uuid)), C1, 0, TYP_NONE },
{ "lsn", FLDT_UINT64X, OI(OFF(lsn)), C1, 0, TYP_NONE },
- { "crc", FLDT_UINT32X, OI(OFF(crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(OFF(crc)), C1, 0, TYP_NONE },
{ "bno", FLDT_AGBLOCKNZ, OI(OFF(bno)), agfl_bno_size,
FLD_ARRAY|FLD_COUNT, TYP_DATA },
{ NULL }
CI(XFS_AGI_UNLINKED_BUCKETS), FLD_ARRAY, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(uuid)), C1, 0, TYP_NONE },
{ "lsn", FLDT_UINT64X, OI(OFF(lsn)), C1, 0, TYP_NONE },
- { "crc", FLDT_UINT32X, OI(OFF(crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(OFF(crc)), C1, 0, TYP_NONE },
{ NULL }
};
{ "lsn", FLDT_UINT64X, OI(OFF(u.l.bb_lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(u.l.bb_uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_INO, OI(OFF(u.l.bb_owner)), C1, 0, TYP_NONE },
- { "crc", FLDT_UINT32X, OI(OFF(u.l.bb_crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(OFF(u.l.bb_crc)), C1, 0, TYP_NONE },
{ "recs", FLDT_BMAPBTAREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_BMAPBTAKEY, btblock_key_offset, btblock_key_count,
{ "lsn", FLDT_UINT64X, OI(OFF(u.l.bb_lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(u.l.bb_uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_INO, OI(OFF(u.l.bb_owner)), C1, 0, TYP_NONE },
- { "crc", FLDT_UINT32X, OI(OFF(u.l.bb_crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(OFF(u.l.bb_crc)), C1, 0, TYP_NONE },
{ "recs", FLDT_BMAPBTDREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_BMAPBTDKEY, btblock_key_offset, btblock_key_count,
{ "lsn", FLDT_UINT64X, OI(OFF(u.s.bb_lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(u.s.bb_uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_AGNUMBER, OI(OFF(u.s.bb_owner)), C1, 0, TYP_NONE },
- { "crc", FLDT_UINT32X, OI(OFF(u.s.bb_crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(OFF(u.s.bb_crc)), C1, 0, TYP_NONE },
{ "recs", FLDT_INOBTREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_INOBTKEY, btblock_key_offset, btblock_key_count,
{ "lsn", FLDT_UINT64X, OI(OFF(u.s.bb_lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(u.s.bb_uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_AGNUMBER, OI(OFF(u.s.bb_owner)), C1, 0, TYP_NONE },
- { "crc", FLDT_UINT32X, OI(OFF(u.s.bb_crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(OFF(u.s.bb_crc)), C1, 0, TYP_NONE },
{ "recs", FLDT_BNOBTREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_BNOBTKEY, btblock_key_offset, btblock_key_count,
{ "lsn", FLDT_UINT64X, OI(OFF(u.s.bb_lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(u.s.bb_uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_AGNUMBER, OI(OFF(u.s.bb_owner)), C1, 0, TYP_NONE },
- { "crc", FLDT_UINT32X, OI(OFF(u.s.bb_crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(OFF(u.s.bb_crc)), C1, 0, TYP_NONE },
{ "recs", FLDT_CNTBTREC, btblock_rec_offset, btblock_rec_count,
FLD_ARRAY|FLD_ABASE1|FLD_COUNT|FLD_OFFSET, TYP_NONE },
{ "keys", FLDT_CNTBTKEY, btblock_key_offset, btblock_key_count,
#define DBH3OFF(f) bitize(offsetof(struct xfs_dir3_blk_hdr, f))
const field_t dir3_blkhdr_flds[] = {
{ "magic", FLDT_UINT32X, OI(DBH3OFF(magic)), C1, 0, TYP_NONE },
- { "crc", FLDT_UINT32X, OI(DBH3OFF(crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(DBH3OFF(crc)), C1, 0, TYP_NONE },
{ "bno", FLDT_DFSBNO, OI(DBH3OFF(blkno)), C1, 0, TYP_BMAPBTD },
{ "lsn", FLDT_UINT64X, OI(DBH3OFF(lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(DBH3OFF(uuid)), C1, 0, TYP_NONE },
#define DB3OFF(f) bitize(offsetof(struct xfs_da3_blkinfo, f))
const field_t da3_blkinfo_flds[] = {
{ "hdr", FLDT_DA_BLKINFO, OI(DB3OFF(hdr)), C1, 0, TYP_NONE },
- { "crc", FLDT_UINT32X, OI(DB3OFF(crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(DB3OFF(crc)), C1, 0, TYP_NONE },
{ "bno", FLDT_DFSBNO, OI(DB3OFF(blkno)), C1, 0, TYP_BMAPBTD },
{ "lsn", FLDT_UINT64X, OI(DB3OFF(lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(DB3OFF(uuid)), C1, 0, TYP_NONE },
{ "diskdq", FLDT_DISK_DQUOT, OI(DDOFF(diskdq)), C1, 0, TYP_NONE },
{ "fill", FLDT_CHARS, OI(DDOFF(fill)), CI(DDSZC(fill)), FLD_SKIPALL,
TYP_NONE },
- { "crc", FLDT_UINT32X, OI(DDOFF(crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(DDOFF(crc)), C1, 0, TYP_NONE },
{ "lsn", FLDT_UINT64X, OI(DDOFF(lsn)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(DDOFF(uuid)), C1, 0, TYP_NONE },
{ NULL }
0, fa_agblock, NULL },
{ FLDT_CNTBTREC, "cntbtrec", fp_sarray, (char *)cntbt_rec_flds,
SI(bitsz(xfs_alloc_rec_t)), 0, NULL, cntbt_rec_flds },
+
+/* CRC field */
+ { FLDT_CRC, "crc", fp_crc, "%#x (%s)", SI(bitsz(__uint32_t)),
+ 0, NULL, NULL },
+
{ FLDT_DEV, "dev", fp_num, "%#x", SI(bitsz(xfs_dev_t)), 0, NULL, NULL },
{ FLDT_DFILOFFA, "dfiloffa", fp_num, "%llu", SI(bitsz(xfs_dfiloff_t)),
0, fa_dfiloffa, NULL },
FLDT_CNTBTKEY,
FLDT_CNTBTPTR,
FLDT_CNTBTREC,
+
+ /* CRC field type */
+ FLDT_CRC,
+
FLDT_DEV,
FLDT_DFILOFFA,
FLDT_DFILOFFD,
#include "output.h"
#include "sig.h"
#include "malloc.h"
+#include "io.h"
int
fp_charns(
}
return 1;
}
+
+/*
+ * CRC is correct is the current buffer it is being pulled out
+ * of is not marked with a EFSCORRUPTED error.
+ */
+int
+fp_crc(
+ void *obj,
+ int bit,
+ int count,
+ char *fmtstr,
+ int size,
+ int arg,
+ int base,
+ int array)
+{
+ int bitpos;
+ int i;
+ __int64_t val;
+ char *ok;
+
+ ok = iocur_crc_valid() ? "correct" : "bad";
+
+ for (i = 0, bitpos = bit;
+ i < count && !seenint();
+ i++, bitpos += size) {
+ if (array)
+ dbprintf("%d:", i + base);
+ val = getbitval(obj, bitpos, size, BVUNSIGNED);
+ if (size > 32)
+ dbprintf(fmtstr, val, ok);
+ else
+ dbprintf(fmtstr, (__int32_t)val, ok);
+ if (i < count - 1)
+ dbprintf(" ");
+ }
+ return 1;
+}
int arg, int base, int array);
extern int fp_uuid(void *obj, int bit, int count, char *fmtstr, int size,
int arg, int base, int array);
+extern int fp_crc(void *obj, int bit, int count, char *fmtstr, int size,
+ int arg, int base, int array);
};
const field_t inode_v3_flds[] = {
- { "crc", FLDT_UINT32X, OI(COFF(crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(COFF(crc)), C1, 0, TYP_NONE },
{ "change_count", FLDT_UINT64D, OI(COFF(changecount)), C1, 0, TYP_NONE },
{ "lsn", FLDT_UINT64X, OI(COFF(lsn)), C1, 0, TYP_NONE },
{ "flags2", FLDT_UINT64X, OI(COFF(flags2)), C1, 0, TYP_NONE },
extern void set_cur(const struct typ *t, __int64_t d, int c, int ring_add,
bbmap_t *bbmap);
extern void ring_add(void);
+
+static inline bool
+iocur_crc_valid()
+{
+ return (iocur_top->bp && iocur_top->bp->b_error != EFSCORRUPTED);
+}
C1, 0, TYP_NONE },
{ "features_log_incompat", FLDT_UINT32X, OI(OFF(features_log_incompat)),
C1, 0, TYP_NONE },
- { "crc", FLDT_UINT32X, OI(OFF(crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(OFF(crc)), C1, 0, TYP_NONE },
{ "pquotino", FLDT_INO, OI(OFF(pquotino)), C1, 0, TYP_INODE },
{ "lsn", FLDT_UINT64X, OI(OFF(lsn)), C1, 0, TYP_NONE },
{ NULL }
{ "magic", FLDT_UINT32X, OI(OFF(magic)), C1, 0, TYP_NONE },
{ "offset", FLDT_UINT32D, OI(OFF(offset)), C1, 0, TYP_NONE },
{ "bytes", FLDT_UINT32D, OI(OFF(bytes)), C1, 0, TYP_NONE },
- { "crc", FLDT_UINT32X, OI(OFF(crc)), C1, 0, TYP_NONE },
+ { "crc", FLDT_CRC, OI(OFF(crc)), C1, 0, TYP_NONE },
{ "uuid", FLDT_UUID, OI(OFF(uuid)), C1, 0, TYP_NONE },
{ "owner", FLDT_INO, OI(OFF(owner)), C1, 0, TYP_NONE },
{ "bno", FLDT_DFSBNO, OI(OFF(blkno)), C1, 0, TYP_BMAPBTD },