int main(int argc, char *argv[]) { char *dbg = NULL; #ifdef ENABLE_CRYPTO int rnd; char *ckpasswd; char *p; #endif if (argc < 2) usage(argv[0]); debug=0; setvbuf(stdout, (char*)NULL, _IONBF, 0); get_opts(argc,argv); if ( NULL == chkoptions.configfile ) { usage(argv[0]); } if (-1 == r_env_cfg(chkoptions.configfile)) usage(argv[0]); parseconfig(0); dbg = getenv("DEBUG"); if (NULL != dbg) debug = atoi(dbg); if ( 0 == chkoptions.fast ) { printf("Running lessfsck on a mounted filesystem will corrupt the databases.\n"); printf("Press ctrl-c within 5 secondes when you are not sure that the filesystem is unmounted.\n"); sleep(5); } BLKSIZE=get_blocksize(); if ( NULL != config->blockdatabs ){ printf("**************************************************\n"); printf("* Running lessfsck on a tc data store. *\n"); printf("**************************************************\n"); lessfsck_tc(); } else { printf("**************************************************\n"); printf("* Running lessfsck on a file_io data store. *\n"); printf("**************************************************\n"); lessfsck_file_io(); } printf("\nDone.\n"); clear_dirty(); tc_close(0); #ifdef ENABLE_CRYPTO if (config->encryptdata) { free(config->passwd); free(config->iv); } #endif free(config); exit(0); }
static int save_file_page(struct filemap *fm, void *addr) { struct file *filp; unsigned long pos; int rc; filp = (struct file *) olock(fm->file, OBJECT_FILE); if (!filp) return -EBADF; pos = (char *) addr - fm->addr; rc = pwrite(filp, addr, PAGESIZE, fm->offset + pos); if (rc < 0) { orel(filp); return rc; } clear_dirty(addr); orel(filp); return 0; }