return 0;
}
+void
+xfs_dquot_set_crc(
+ struct xfs_buf *bp)
+{
+ ASSERT((iocur_top->dquot_buf));
+ ASSERT(iocur_top->bp == bp);
+
+ xfs_update_cksum(iocur_top->data, sizeof(struct xfs_dqblk),
+ XFS_DQUOT_CRC_OFF);
+}
+
void
dquot_init(void)
{
extern const struct field dqblk_flds[];
extern const struct field dqblk_hfld[];
+extern void xfs_dquot_set_crc(struct xfs_buf *);
extern void dquot_init(void);
return 0;
}
- if (invalid_data && iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF &&
- !iocur_top->ino_buf && !iocur_top->dquot_buf) {
+ if (invalid_data && iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF) {
dbprintf(_("Cannot recalculate CRCs on this type of object\n"));
return 0;
}
if (corrupt) {
local_ops.verify_write = xfs_dummy_verify;
dbprintf(_("Allowing fuzz of corrupted data and bad CRC\n"));
- } else if (iocur_top->ino_buf) {
- local_ops.verify_write = xfs_verify_recalc_inode_crc;
- dbprintf(_("Allowing fuzz of corrupted inode with good CRC\n"));
- } else if (iocur_top->dquot_buf) {
- local_ops.verify_write = xfs_verify_recalc_dquot_crc;
- dbprintf(_("Allowing fuzz of corrupted dquot with good CRC\n"));
} else if (iocur_top->typ->crc_off == TYP_F_CRC_FUNC) {
local_ops.verify_write = iocur_top->typ->set_crc;
dbprintf(_("Allowing fuzz of corrupted data with good CRC\n"));
/* track updated info in ring */
ring_add();
}
+
+void
+xfs_inode_set_crc(
+ struct xfs_buf *bp)
+{
+ ASSERT(iocur_top->ino_buf);
+ ASSERT(iocur_top->bp == bp);
+
+ libxfs_dinode_calc_crc(mp, iocur_top->data);
+ iocur_top->ino_crc_ok = 1;
+}
extern typnm_t inode_next_type(void);
extern int inode_size(void *obj, int startoff, int idx);
extern int inode_u_size(void *obj, int startoff, int idx);
+extern void xfs_inode_set_crc(struct xfs_buf *);
extern void set_cur_inode(xfs_ino_t ino);
#include "faddr.h"
#include "fprint.h"
#include "field.h"
+#include "dquot.h"
#include "inode.h"
#include "io.h"
#include "output.h"
return;
}
-void
-xfs_verify_recalc_inode_crc(
- struct xfs_buf *bp)
-{
- ASSERT(iocur_top->ino_buf);
- ASSERT(iocur_top->bp == bp);
-
- libxfs_dinode_calc_crc(mp, iocur_top->data);
- iocur_top->ino_crc_ok = 1;
-}
-
-void
-xfs_verify_recalc_dquot_crc(
- struct xfs_buf *bp)
-{
- ASSERT((iocur_top->dquot_buf));
- ASSERT(iocur_top->bp == bp);
-
- xfs_update_cksum(iocur_top->data, sizeof(struct xfs_dqblk),
- XFS_DQUOT_CRC_OFF);
-}
-
void
xfs_verify_recalc_crc(
struct xfs_buf *bp)
skip_crc = true;
if (!skip_crc) {
- if (iocur_top->ino_buf) {
- libxfs_dinode_calc_crc(mp, iocur_top->data);
- iocur_top->ino_crc_ok = 1;
- } else if (iocur_top->dquot_buf) {
- xfs_update_cksum(iocur_top->data,
- sizeof(struct xfs_dqblk),
- XFS_DQUOT_CRC_OFF);
- }
+ if (iocur_top->ino_buf)
+ xfs_inode_set_crc(iocur_top->bp);
+ else if (iocur_top->dquot_buf)
+ xfs_dquot_set_crc(iocur_top->bp);
}
if (iocur_top->bbmap)
write_cur_bbs();
extern void ring_add(void);
extern void set_iocur_type(const struct typ *type);
extern void xfs_dummy_verify(struct xfs_buf *bp);
-extern void xfs_verify_recalc_inode_crc(struct xfs_buf *bp);
-extern void xfs_verify_recalc_dquot_crc(struct xfs_buf *bp);
extern void xfs_verify_recalc_crc(struct xfs_buf *bp);
/*
{ TYP_DIR2, "dir3", handle_struct, dir3_hfld,
&xfs_dir3_db_buf_ops, TYP_F_CRC_FUNC, xfs_dir3_set_crc },
{ TYP_DQBLK, "dqblk", handle_struct, dqblk_hfld,
- &xfs_dquot_buf_ops, TYP_F_NO_CRC_OFF },
+ &xfs_dquot_buf_ops, TYP_F_CRC_FUNC, xfs_dquot_set_crc },
{ TYP_INOBT, "inobt", handle_struct, inobt_crc_hfld,
&xfs_inobt_buf_ops, XFS_BTREE_SBLOCK_CRC_OFF },
{ TYP_INODATA, "inodata", NULL, NULL, NULL, TYP_F_NO_CRC_OFF },
{ TYP_INODE, "inode", handle_struct, inode_crc_hfld,
- &xfs_inode_buf_ops, TYP_F_NO_CRC_OFF },
+ &xfs_inode_buf_ops, TYP_F_CRC_FUNC, xfs_inode_set_crc },
{ TYP_LOG, "log", NULL, NULL, NULL, TYP_F_NO_CRC_OFF },
{ TYP_RTBITMAP, "rtbitmap", NULL, NULL, NULL, TYP_F_NO_CRC_OFF },
{ TYP_RTSUMMARY, "rtsummary", NULL, NULL, NULL, TYP_F_NO_CRC_OFF },
{ TYP_DIR2, "dir3", handle_struct, dir3_hfld,
&xfs_dir3_db_buf_ops, TYP_F_CRC_FUNC, xfs_dir3_set_crc },
{ TYP_DQBLK, "dqblk", handle_struct, dqblk_hfld,
- &xfs_dquot_buf_ops, TYP_F_NO_CRC_OFF },
+ &xfs_dquot_buf_ops, TYP_F_CRC_FUNC, xfs_dquot_set_crc },
{ TYP_INOBT, "inobt", handle_struct, inobt_spcrc_hfld,
&xfs_inobt_buf_ops, XFS_BTREE_SBLOCK_CRC_OFF },
{ TYP_INODATA, "inodata", NULL, NULL, NULL, TYP_F_NO_CRC_OFF },
{ TYP_INODE, "inode", handle_struct, inode_crc_hfld,
- &xfs_inode_buf_ops, TYP_F_NO_CRC_OFF },
+ &xfs_inode_buf_ops, TYP_F_CRC_FUNC, xfs_inode_set_crc },
{ TYP_LOG, "log", NULL, NULL, NULL, TYP_F_NO_CRC_OFF },
{ TYP_RTBITMAP, "rtbitmap", NULL, NULL, NULL, TYP_F_NO_CRC_OFF },
{ TYP_RTSUMMARY, "rtsummary", NULL, NULL, NULL, TYP_F_NO_CRC_OFF },
}
if (invalid_data &&
- iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF &&
- !iocur_top->ino_buf &&
- !iocur_top->dquot_buf) {
+ iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF) {
dbprintf(_("Cannot recalculate CRCs on this type of object\n"));
return 0;
}
if (corrupt) {
local_ops.verify_write = xfs_dummy_verify;
dbprintf(_("Allowing write of corrupted data and bad CRC\n"));
- } else if (iocur_top->ino_buf) {
- local_ops.verify_write = xfs_verify_recalc_inode_crc;
- dbprintf(_("Allowing write of corrupted inode with good CRC\n"));
- } else if (iocur_top->dquot_buf) {
- local_ops.verify_write = xfs_verify_recalc_dquot_crc;
- dbprintf(_("Allowing write of corrupted dquot with good CRC\n"));
} else if (iocur_top->typ->crc_off == TYP_F_CRC_FUNC) {
local_ops.verify_write = iocur_top->typ->set_crc;
dbprintf(_("Allowing write of corrupted data with good CRC\n"));