Adds a the new -e, --filter-error option for fix and check.

This commit is contained in:
Andrea Mazzoleni 2013-08-18 19:24:55 +02:00
parent 746c829bec
commit 746901d0be
6 changed files with 75 additions and 12 deletions

27
elem.c
View file

@ -248,7 +248,32 @@ int filter_existence(int filter_missing, const char* dir, const char* sub)
exit(EXIT_FAILURE);
}
/* the file is presen, so we filter it out */
/* the file is present, so we filter it out */
return 1;
}
int filter_correctness(int filter_error, tommy_arrayof* infoarr, struct snapraid_file* file)
{
unsigned i;
if (!filter_error)
return 0;
/* check each block of the file */
for(i=0;i<file->blockmax;++i) {
struct snapraid_block* block;
snapraid_info info;
block = &file->blockvec[i];
info = info_get(infoarr, block->parity_pos);
/* if the file has a bad block, don't exclude it */
if (info_get_bad(info))
return 0;
}
/* the file is correct, so we filter it out */
return 1;
}