add command line argument for raid0

git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@3794 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe
This commit is contained in:
sears 2012-02-24 21:32:45 +00:00
parent b52dbe0636
commit b0dfa21af1

View file

@ -74,8 +74,28 @@ LSMServerHandler(int argc, char **argv)
} else if(!strcmp(argv[i], "--expiry-delta")) {
i++;
expiry_delta = atoi(argv[i]);
} else if(!strcmp(argv[i], "--raid0")) {
i++;
char * saveptr;
const char * delim = ",";
char * arg = strdup(argv[i]);
int toks = 0;
for(char * tok = strtok_r(arg, delim, &saveptr); tok; tok = strtok_r(0,delim,&saveptr)) {
toks++;
}
free(arg);
arg = strdup(argv[i]);
char ** tok = (char**)malloc(sizeof(tok[0]) * (1+toks));
int j = 0;
for(char * t = strtok_r(arg, delim, &saveptr); t; t = strtok_r(0,delim,&saveptr)) {
tok[j] = t;
j++;
}
tok[toks] = 0;
stasis_handle_raid0_filenames = tok;
stasis_handle_factory = stasis_handle_raid0_factory;
} else {
fprintf(stderr, "Usage: %s [--test|--benchmark|--benchmark-small] [--log-mode <int>] [--expiry-delta <int>]", argv[0]);
fprintf(stderr, "Usage: %s [--test|--benchmark|--benchmark-small] [--log-mode <int>] [--expiry-delta <int>] [--raid0 file1,file2,...]", argv[0]);
abort();
}
}