Adds the --find-by-name option to find files by path instead than by inode.

This commit is contained in:
Andrea Mazzoleni 2011-10-09 23:41:08 +02:00
parent 1dbd801dcb
commit 191dcdf3d4
14 changed files with 356 additions and 32 deletions

View file

@ -55,6 +55,7 @@ void usage(void)
printf("Options:\n");
printf(" " SWITCH_GETOPT_LONG("-c, --conf FILE ", "-c") " Configuration file (default " CONF ")\n");
printf(" " SWITCH_GETOPT_LONG("-f, --filter PATTERN", "-f") " Filter the files to processs\n");
printf(" " SWITCH_GETOPT_LONG("-N, --find-by-name ", "-N") " Find the file by name instead than by inode\n");
printf(" " SWITCH_GETOPT_LONG("-Z, --force-zero ", "-Z") " Force synching of files that get zero size\n");
printf(" " SWITCH_GETOPT_LONG("-E, --force-empty ", "-E") " Force synching of disks that get empty\n");
printf(" " SWITCH_GETOPT_LONG("-s, --start BLKSTART", "-s") " Start from the specified block number\n");
@ -78,6 +79,7 @@ struct option long_options[] = {
{ "count", 1, 0, 't' },
{ "force-zero", 0, 0, 'Z' },
{ "force-empty", 0, 0, 'E' },
{ "find-by-name", 0, 0, 'N' },
{ "speed-test", 0, 0, 'T' },
{ "verbose", 0, 0, 'v' },
{ "gui", 0, 0, 'G' }, /* undocumented GUI interface command */
@ -93,7 +95,7 @@ struct option long_options[] = {
};
#endif
#define OPTIONS "c:f:s:t:ZETvhVG"
#define OPTIONS "c:f:s:t:ZENTvhVG"
volatile int global_interrupt = 0;
@ -119,6 +121,7 @@ int main(int argc, char* argv[])
int gui;
int force_zero;
int force_empty;
int find_by_name;
int test_expect_unrecoverable;
int test_expect_recoverable;
int test_kill_after_sync;
@ -139,6 +142,7 @@ int main(int argc, char* argv[])
gui = 0;
force_zero = 0;
force_empty = 0;
find_by_name = 0;
test_expect_unrecoverable = 0;
test_expect_recoverable = 0;
test_kill_after_sync = 0;
@ -188,6 +192,9 @@ int main(int argc, char* argv[])
case 'E' :
force_empty = 1;
break;
case 'N' :
find_by_name = 1;
break;
case 'v' :
verbose = 1;
break;
@ -251,7 +258,7 @@ int main(int argc, char* argv[])
state_init(&state);
state_config(&state, conf, verbose, gui, force_zero, force_empty, test_expect_unrecoverable, test_expect_recoverable, test_skip_device);
state_config(&state, conf, verbose, gui, force_zero, force_empty, find_by_name, test_expect_unrecoverable, test_expect_recoverable, test_skip_device);
if (operation == OPERATION_DIFF) {
state_read(&state);