Currently when the type command is run, we simply change the type
associated with the buffer, but don't verify it. This results in
unchecked CRCs being displayed. Hence when changing the type, run
the verifier associated with the type to determine if the buffer
contents is valid or not.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
ring_add();
}
+void
+set_iocur_type(
+ const typ_t *t)
+{
+ struct xfs_buf *bp = iocur_top->bp;
+
+ iocur_top->typ = t;
+
+ /* verify the buffer if the type has one. */
+ if (!bp)
+ return;
+ if (!t->bops) {
+ bp->b_ops = NULL;
+ bp->b_flags |= LIBXFS_B_UNCHECKED;
+ return;
+ }
+ if (!(bp->b_flags & LIBXFS_B_UPTODATE))
+ return;
+ bp->b_error = 0;
+ bp->b_ops = t->bops;
+ bp->b_ops->verify_read(bp);
+ bp->b_flags &= ~LIBXFS_B_UNCHECKED;
+}
+
static void
stack_help(void)
{
extern void set_cur(const struct typ *t, __int64_t d, int c, int ring_add,
bbmap_t *bbmap);
extern void ring_add(void);
+extern void set_iocur_type(const struct typ *t);
/*
* returns -1 for unchecked, 0 for bad and 1 for good
if (tt == NULL) {
dbprintf(_("no such type %s\n"), argv[1]);
} else {
- if (iocur_top->typ == NULL) {
- dbprintf(_("no current object\n"));
- } else {
- iocur_top->typ = cur_typ = tt;
+ if (iocur_top->typ == NULL)
+ dbprintf(_("no current object\n"));
+ else {
+ cur_typ = tt;
+ set_iocur_type(tt);
}
}
}