void mess_up_truncate_log_rec(ocfs2_filesys *fs, enum fsck_type type, uint16_t slotnum) { uint64_t blkno; int i; switch (type) { case TRUNCATE_REC_START_RANGE: i = 0; break; case TRUNCATE_REC_WRAP: i = 1; break; case TRUNCATE_REC_RANGE: i = 2; break; default: break; } get_truncate_log(fs, slotnum, &blkno); create_truncate_log(fs, blkno, 10, 10); damage_truncate_log(fs, blkno, type, i); return; }
int main (int argc, char **argv) { ocfs2_filesys *fs = NULL; errcode_t ret = 1; initialize_ocfs_error_table(); #define INSTALL_SIGNAL(sig) \ do { \ if (signal(sig, handle_signal) == SIG_ERR) { \ printf("Could not set " #sig "\n"); \ goto bail; \ } \ } while (0) INSTALL_SIGNAL(SIGTERM); INSTALL_SIGNAL(SIGINT); memset(&options, 0, sizeof(options)); if (read_options(argc, argv)) { usage(progname); goto bail; } if (!device || !options.ops) goto bail; ret = ocfs2_open(device, OCFS2_FLAG_RW, 0, 0, &fs); if (ret) { com_err(progname, ret, "while opening \"%s\"", device); goto bail; } srand((unsigned long)fs); switch (options.ops) { case CREATE_LOCAL_ALLOC: ret = create_local_alloc(fs, options.slot); break; case CREATE_ORPHAN_FILE: ret = create_orphan_file(fs, options.slot); break; case CREATE_TRUNCATE_LOG: ret = create_truncate_log(fs, options.slot); break; } bail: if (fs) ocfs2_close(fs); return ret; }