Uses an inplicit AND operation between -d and -f filter options.

This commit is contained in:
Andrea Mazzoleni 2012-11-23 00:01:02 +01:00
parent 3df33b9aa7
commit 99223533eb
5 changed files with 38 additions and 8 deletions

4
TODO
View file

@ -19,6 +19,10 @@ integrity check of the existing ones.
It should restore only missing files, without recovering modified ones
or check validity of data of existing ones.
* Adds a log option, to save log files with the date in the name. This could
help to keep track of what happens during automated operations.
We must keep the log to stdout/err, and only save a copy to the log file.
* In fix an existing symlink with the same name of a file to be recovered may stop
the process making the create() operation to fail.

View file

@ -378,8 +378,15 @@ process the whole array.
.B \(hyd, \(hy\(hyfilter\(hydisk NAME
Filters the files to process in the \(a"check\(a" and \(a"fix\(a"
commands.
Only the files present in the specified disk are processed.
You must specify a disk name as named in the configuration
file.
If you combine \(hy\(hyfilter and \(hy\(hyfilter\(hydisk options, only files
matching both the two groups of rules are selected.
This option can be used many times.
This option can be used only with the \(a"check\(a" and \(a"fix\(a" commands.
Note that it cannot be used with \(a"sync\(a", because \(a"sync\(a" always
process the whole array.
.TP
.B \(hya, \(hy\(hyaudit\(hyonly
When checking, only verify the hash of the files, without

View file

@ -143,7 +143,8 @@ int main(int argc, char* argv[])
block_off_t blockstart;
block_off_t blockcount;
int ret;
tommy_list filterlist;
tommy_list filterlist_file;
tommy_list filterlist_disk;
char* e;
const char* command;
@ -164,7 +165,8 @@ int main(int argc, char* argv[])
test_skip_device = 0;
blockstart = 0;
blockcount = 0;
tommy_list_init(&filterlist);
tommy_list_init(&filterlist_file);
tommy_list_init(&filterlist_disk);
opterr = 0;
while ((c =
@ -184,7 +186,7 @@ int main(int argc, char* argv[])
fprintf(stderr, "Invalid filter specification '%s'\n", optarg);
exit(EXIT_FAILURE);
}
tommy_list_insert_tail(&filterlist, &filter->node, filter);
tommy_list_insert_tail(&filterlist_file, &filter->node, filter);
} break;
case 'd' : {
struct snapraid_filter* filter = filter_alloc_disk(1, optarg);
@ -192,7 +194,7 @@ int main(int argc, char* argv[])
fprintf(stderr, "Invalid filter specification '%s'\n", optarg);
exit(EXIT_FAILURE);
}
tommy_list_insert_tail(&filterlist, &filter->node, filter);
tommy_list_insert_tail(&filterlist_disk, &filter->node, filter);
} break;
case 's' :
blockstart = strtoul(optarg, &e, 0);
@ -307,7 +309,7 @@ int main(int argc, char* argv[])
case OPERATION_DRY :
break;
default:
if (!tommy_list_empty(&filterlist)) {
if (!tommy_list_empty(&filterlist_file) || !tommy_list_empty(&filterlist_disk)) {
fprintf(stderr, "You cannot filter with the '%s' command\n", command);
exit(EXIT_FAILURE);
}
@ -374,7 +376,8 @@ int main(int argc, char* argv[])
state_read(&state);
/* apply the command line filter */
state_filter(&state, &filterlist);
state_filter(&state, &filterlist_file);
state_filter(&state, &filterlist_disk);
/* intercept Ctrl+C */
signal(SIGINT, &signal_handler);
@ -388,7 +391,8 @@ int main(int argc, char* argv[])
state_read(&state);
/* apply the command line filter */
state_filter(&state, &filterlist);
state_filter(&state, &filterlist_file);
state_filter(&state, &filterlist_disk);
/* intercept Ctrl+C */
signal(SIGINT, &signal_handler);
@ -401,7 +405,8 @@ int main(int argc, char* argv[])
}
state_done(&state);
tommy_list_foreach(&filterlist, (tommy_foreach_func*)filter_free);
tommy_list_foreach(&filterlist_file, (tommy_foreach_func*)filter_free);
tommy_list_foreach(&filterlist_disk, (tommy_foreach_func*)filter_free);
os_done();

View file

@ -252,8 +252,15 @@ Options
-d, --filter-disk NAME
Filters the files to process in the "check" and "fix"
commands.
Only the files present in the specified disk are processed.
You must specify a disk name as named in the configuration
file.
If you combine --filter and --filter-disk options, only files
matching both the two groups of rules are selected.
This option can be used many times.
This option can be used only with the "check" and "fix" commands.
Note that it cannot be used with "sync", because "sync" always
process the whole array.
-a, --audit-only
When checking, only verify the hash of the files, without

View file

@ -281,8 +281,15 @@ SnapRAID provides the following options:
-d, --filter-disk NAME
Filters the files to process in the "check" and "fix"
commands.
Only the files present in the specified disk are processed.
You must specify a disk name as named in the configuration
file.
If you combine --filter and --filter-disk options, only files
matching both the two groups of rules are selected.
This option can be used many times.
This option can be used only with the "check" and "fix" commands.
Note that it cannot be used with "sync", because "sync" always
process the whole array.
-a, --audit-only
When checking, only verify the hash of the files, without