[Darshan-commits] [Git][darshan/darshan][master] 4 commits: prepend file system mount point to hashed file name to retain file system info for obfuscated files

Shane Snyder xgitlab at cels.anl.gov
Fri Sep 9 16:39:54 CDT 2016


Shane Snyder pushed to branch master at darshan / darshan


Commits:
0d1f6e80 by Glenn K. Lockwood at 2016-08-16T13:26:33-07:00
prepend file system mount point to hashed file name to retain file system info for obfuscated files

- - - - -
6e75dade by Glenn K. Lockwood at 2016-08-24T09:57:37-07:00
Merge branch 'master' into gkl/obfuscate-fs-fix to pull in fix from d4dc84f

- - - - -
eadbecfd by Glenn K. Lockwood at 2016-08-24T10:00:07-07:00
fix wrong struct type (inconsequential as it may be in the given context)

- - - - -
7f05cf73 by Shane Snyder at 2016-09-09T16:39:48-05:00
Merge branch 'gkl/obfuscate-fs-fix' into 'master'

gkl/obfuscate fs fix: prepend file path to hashed file name to retain fs info

Prepends the file system path to the hashed file name generated by `darshan-convert --obfuscate` so that darshan-parser can still link obfuscated file records to the mounts table.

See merge request !1
- - - - -


2 changed files:

- darshan-util/darshan-convert.c
- darshan-util/darshan-logutils.c


Changes:

=====================================
darshan-util/darshan-convert.c
=====================================
--- a/darshan-util/darshan-convert.c
+++ b/darshan-util/darshan-convert.c
@@ -138,19 +138,41 @@ void obfuscate_exe(int key, char *exe)
     return;
 }
 
-void obfuscate_filenames(int key, struct darshan_name_record_ref *name_hash)
+void obfuscate_filenames(int key, struct darshan_name_record_ref *name_hash, struct darshan_mnt_info *mnt_data_array, int mount_count )
 {
     struct darshan_name_record_ref *ref, *tmp;
     uint32_t hashed;
-    char tmp_string[128] = {0};
+    char tmp_string[PATH_MAX+128] = {0};
     darshan_record_id tmp_id;
 
     HASH_ITER(hlink, name_hash, ref, tmp)
     {
+        /* find file system */
+        int j;
+        char *mnt_pt = NULL;
+
+        /* get mount point and fs type associated with this record */
+        for(j=0; j<mount_count; j++)
+        {
+            if(strncmp(mnt_data_array[j].mnt_path, ref->name_record->name,
+                strlen(mnt_data_array[j].mnt_path)) == 0)
+            {
+                mnt_pt = mnt_data_array[j].mnt_path;
+                break;
+            }
+        }
+
         tmp_id = ref->name_record->id;
         hashed = darshan_hashlittle(ref->name_record->name,
             strlen(ref->name_record->name), key);
-        sprintf(tmp_string, "%u", hashed);
+        if ( mnt_pt != NULL ) 
+        {
+            sprintf(tmp_string, "%s/%u", mnt_pt, hashed);
+        }
+        else 
+        {
+            sprintf(tmp_string, "%u", hashed);
+        }
         free(ref->name_record);
         ref->name_record = malloc(sizeof(struct darshan_name_record) +
             strlen(tmp_string));
@@ -330,7 +352,7 @@ int main(int argc, char **argv)
     /* NOTE: obfuscating filepaths breaks the ability to map files
      * to the corresponding FS & mount info maintained by darshan
      */
-    if(obfuscate) obfuscate_filenames(key, name_hash);
+    if(obfuscate) obfuscate_filenames(key, name_hash, mnt_data_array, mount_count );
     if(hash) remove_hash_recs(&name_hash, hash);
 
     ret = darshan_log_put_namehash(outfile, name_hash);


=====================================
darshan-util/darshan-logutils.c
=====================================
--- a/darshan-util/darshan-logutils.c
+++ b/darshan-util/darshan-logutils.c
@@ -586,7 +586,7 @@ int darshan_log_put_namehash(darshan_fd fd, struct darshan_name_record_ref *hash
 {
     struct darshan_fd_int_state *state = fd->state;
     struct darshan_name_record_ref *ref, *tmp;
-    struct darshan_name_record_ref *name_rec;
+    struct darshan_name_record *name_rec;
     int name_rec_len;
     int wrote;
 



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/df34ba2b01936ec028e972b336c89daeda70aeea...7f05cf73ed3acde94f88533d3734187e4cfe26c0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20160909/c48660cb/attachment-0001.html>


More information about the Darshan-commits mailing list