Commit 14455d58 authored by Philip Carns's avatar Philip Carns

add ability to reset old metadata when converting logs


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@824 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 6eb1b44d
......@@ -85,6 +85,7 @@ sub main()
"--obfuscate",
"--key=$hash_key",
"--annotate=$annotation",
"--reset-md",
"$logfile",
"$output_path/$year/$month/$day/$hashed_fname.bz2");
$rc = system(@args);
......
......@@ -29,20 +29,24 @@ int usage (char *exename)
fprintf(stderr, " --key <key> Key to use when obfuscating.\n");
fprintf(stderr, " --annotate <string> Additional metadata to add.\n");
fprintf(stderr, " --file <hash> Limit output to specified (hashed) file only.\n");
fprintf(stderr, " --reset-md Reset old metadata during conversion.\n");
exit(1);
}
void parse_args (int argc, char **argv, char **infile, char **outfile,
int *obfuscate, int *key, char **annotate, uint64_t* hash)
int *obfuscate, int *reset_md, int *key, char **annotate, uint64_t* hash)
{
int index;
int ret;
*reset_md = 0;
static struct option long_opts[] =
{
{"annotate", 1, NULL, 'a'},
{"obfuscate", 0, NULL, 'o'},
{"reset-md", 0, NULL, 'r'},
{"key", 1, NULL, 'k'},
{"file", 1, NULL, 'f'},
{"help", 0, NULL, 0},
......@@ -65,6 +69,9 @@ void parse_args (int argc, char **argv, char **infile, char **outfile,
case 'o':
*obfuscate = 1;
break;
case 'r':
*reset_md = 1;
break;
case 'k':
*key = atoi(optarg);
break;
......@@ -94,6 +101,12 @@ void parse_args (int argc, char **argv, char **infile, char **outfile,
return;
}
static void reset_md_job(struct darshan_job *job)
{
job->metadata[0] = '\0';
return;
}
void obfuscate_job(int key, struct darshan_job *job)
{
job->uid = (int64_t) darshan_hashlittle(&job->uid, sizeof(job->uid), key);
......@@ -189,8 +202,9 @@ int main(int argc, char **argv)
int key = 0;
char *annotation = NULL;
uint64_t hash;
int reset_md = 0;
parse_args(argc, argv, &infile_name, &outfile_name, &obfuscate, &key, &annotation, &hash);
parse_args(argc, argv, &infile_name, &outfile_name, &obfuscate, &reset_md, &key, &annotation, &hash);
infile = darshan_log_open(infile_name, "r");
if(!infile)
......@@ -223,6 +237,7 @@ int main(int argc, char **argv)
return(-1);
}
if (reset_md) reset_md_job(&job);
if (obfuscate) obfuscate_job(key, &job);
if (annotation) add_annotation(annotation, &job);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment