<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>
GitLab
</title>
</head>
<body>
<style type="text/css">
img {
max-width: 100%; height: auto;
}
</style>
<div class="content">
<h3>
Shane Snyder pushed to branch master
at <a href="https://xgitlab.cels.anl.gov/darshan/darshan">darshan / darshan</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/1eb2a5e4d71f390269143c7147a34f1d0a8377a3">1eb2a5e4</a></strong>
<div>
<span>by Shane Snyder</span>
<i>at 2016-04-26T23:02:21-05:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap">modify darshan-logutils to sort mount info
mount information is now sorted in order of descending mount
point lengths to fix a bug in matching file names to mount
points. the longest mount point string which matches the file
name is the corresponding mount. this change requires slight
changes to the darshan-logutils API, but does not modify the
log file format</pre>
</li>
</ul>
<h4>4 changed files:</h4>
<ul>
<li class="file-stats">
<a href="#620f2ecad2bb6f74b2fcd0134963a841" style="text-decoration: none">
darshan-util/darshan-convert.c
</a>
</li>
<li class="file-stats">
<a href="#ad29afc395839758d41094872298bd0d" style="text-decoration: none">
darshan-util/darshan-logutils.c
</a>
</li>
<li class="file-stats">
<a href="#c0b0bf6d71bc5fc7e6d50d69c8aa2413" style="text-decoration: none">
darshan-util/darshan-logutils.h
</a>
</li>
<li class="file-stats">
<a href="#2ace16276b68c7d5aef163bb260bd9f7" style="text-decoration: none">
darshan-util/darshan-parser.c
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id="620f2ecad2bb6f74b2fcd0134963a841">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/1eb2a5e4d71f390269143c7147a34f1d0a8377a3#diff-0">
<strong>
darshan-util/darshan-convert.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-util/darshan-convert.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-util/darshan-convert.c
</span><span style="color: #aaaaaa">@@ -230,8 +230,7 @@ int main(int argc, char **argv)
</span> darshan_fd outfile;
int i;
int mount_count;
<span style="background: #ffdddd; color: #000000">- char** mnt_pts;
- char** fs_types;
</span><span style="background: #ddffdd; color: #000000">+ struct darshan_mnt_info *mnt_data_array;
</span> struct darshan_record_ref *rec_hash = NULL;
struct darshan_record_ref *ref, *tmp;
char mod_buf[DEF_MOD_BUF_SIZE];
<span style="color: #aaaaaa">@@ -299,7 +298,7 @@ int main(int argc, char **argv)
</span> return(-1);
}
<span style="background: #ffdddd; color: #000000">- ret = darshan_log_getmounts(infile, &mnt_pts, &fs_types, &mount_count);
</span><span style="background: #ddffdd; color: #000000">+ ret = darshan_log_getmounts(infile, &mnt_data_array, &mount_count);
</span> if(ret < 0)
{
darshan_log_close(infile);
<span style="color: #aaaaaa">@@ -308,7 +307,7 @@ int main(int argc, char **argv)
</span> return(-1);
}
<span style="background: #ffdddd; color: #000000">- ret = darshan_log_putmounts(outfile, mnt_pts, fs_types, mount_count);
</span><span style="background: #ddffdd; color: #000000">+ ret = darshan_log_putmounts(outfile, mnt_data_array, mount_count);
</span> if(ret < 0)
{
darshan_log_close(infile);
<span style="color: #aaaaaa">@@ -389,16 +388,8 @@ int main(int argc, char **argv)
</span> darshan_log_close(infile);
darshan_log_close(outfile);
<span style="background: #ffdddd; color: #000000">- for(i=0; i<mount_count; i++)
- {
- free(mnt_pts[i]);
- free(fs_types[i]);
- }
</span> if(mount_count > 0)
<span style="background: #ffdddd; color: #000000">- {
- free(mnt_pts);
- free(fs_types);
- }
</span><span style="background: #ddffdd; color: #000000">+ free(mnt_data_array);
</span>
HASH_ITER(hlink, rec_hash, ref, tmp)
{
</code></pre>
<br>
</li>
<li id="ad29afc395839758d41094872298bd0d">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/1eb2a5e4d71f390269143c7147a34f1d0a8377a3#diff-1">
<strong>
darshan-util/darshan-logutils.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-util/darshan-logutils.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-util/darshan-logutils.c
</span><span style="color: #aaaaaa">@@ -66,6 +66,7 @@ struct darshan_fd_int_state
</span> struct darshan_dz_state dz;
};
<span style="background: #ddffdd; color: #000000">+static int darshan_mnt_info_cmp(const void *a, const void *b);
</span> static int darshan_log_getheader(darshan_fd fd);
static int darshan_log_putheader(darshan_fd fd);
static int darshan_log_seek(darshan_fd fd, off_t offset);
<span style="color: #aaaaaa">@@ -374,14 +375,14 @@ int darshan_log_putexe(darshan_fd fd, char *buf)
</span>
/* darshan_log_getmounts()
*
<span style="background: #ffdddd; color: #000000">- * retrieves mount table information from the log. Note that mnt_pts and
- * fs_types are arrays that will be allocated by the function and must be
- * freed by the caller. count will indicate the size of the arrays
</span><span style="background: #ddffdd; color: #000000">+ * retrieves mount table information from the log. Note that mnt_data_array
+ * is an array that will be allocated by the function and must be
+ * freed by the caller. count will indicate the size of the array
</span> *
* returns 0 on success, -1 on failure
*/
<span style="background: #ffdddd; color: #000000">-int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts,
- char*** fs_types, int* count)
</span><span style="background: #ddffdd; color: #000000">+int darshan_log_getmounts(darshan_fd fd, struct darshan_mnt_info **mnt_data_array,
+ int* count)
</span> {
struct darshan_fd_int_state *state = fd->state;
char *pos;
<span style="color: #aaaaaa">@@ -416,34 +417,27 @@ int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts,
</span> }
/* allocate output arrays */
<span style="background: #ffdddd; color: #000000">- *mnt_pts = malloc((*count)*sizeof(char*));
- assert(*mnt_pts);
- *fs_types = malloc((*count)*sizeof(char*));
- assert(*fs_types);
</span><span style="background: #ddffdd; color: #000000">+ *mnt_data_array = malloc((*count)*sizeof(**mnt_data_array));
+ assert(*mnt_data_array);
</span>
<span style="background: #ffdddd; color: #000000">- /* work backwards through the table and parse each line (except for
</span><span style="background: #ddffdd; color: #000000">+ /* work through the table and parse each line (except for
</span> * first, which holds command line information)
*/
<span style="background: #ffdddd; color: #000000">- while((pos = strrchr(state->exe_mnt_data, '\n')) != NULL)
</span><span style="background: #ddffdd; color: #000000">+ pos = state->exe_mnt_data;
+ while((pos = strchr(pos, '\n')) != NULL)
</span> {
<span style="background: #ffdddd; color: #000000">- /* overestimate string lengths */
- (*mnt_pts)[array_index] = malloc(DARSHAN_EXE_LEN);
- assert((*mnt_pts)[array_index]);
- (*fs_types)[array_index] = malloc(DARSHAN_EXE_LEN);
- assert((*fs_types)[array_index]);
-
- ret = sscanf(++pos, "%s\t%s", (*fs_types)[array_index],
- (*mnt_pts)[array_index]);
</span><span style="background: #ddffdd; color: #000000">+ ret = sscanf(++pos, "%s\t%s", (*mnt_data_array)[array_index].mnt_type,
+ (*mnt_data_array)[array_index].mnt_path);
</span> if(ret != 2)
{
fprintf(stderr, "Error: poorly formatted mount table in darshan log file.\n");
return(-1);
}
<span style="background: #ffdddd; color: #000000">- pos--;
- *pos = '\0';
</span> array_index++;
}
<span style="background: #ddffdd; color: #000000">+ qsort(*mnt_data_array, *count, sizeof(**mnt_data_array), darshan_mnt_info_cmp);
+
</span> return(0);
}
<span style="color: #aaaaaa">@@ -456,7 +450,8 @@ int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts,
</span> *
* returns 0 on success, -1 on failure
*/
<span style="background: #ffdddd; color: #000000">-int darshan_log_putmounts(darshan_fd fd, char** mnt_pts, char** fs_types, int count)
</span><span style="background: #ddffdd; color: #000000">+int darshan_log_putmounts(darshan_fd fd, struct darshan_mnt_info *mnt_data_array,
+ int count)
</span> {
struct darshan_fd_int_state *state = fd->state;
int i;
<span style="color: #aaaaaa">@@ -472,7 +467,7 @@ int darshan_log_putmounts(darshan_fd fd, char** mnt_pts, char** fs_types, int co
</span> tmp = mnt_dat;
for(i=count-1; i>=0; i--)
{
<span style="background: #ffdddd; color: #000000">- sprintf(line, "\n%s\t%s", fs_types[i], mnt_pts[i]);
</span><span style="background: #ddffdd; color: #000000">+ sprintf(line, "\n%s\t%s", mnt_data_array[i].mnt_type, mnt_data_array[i].mnt_path);
</span>
memcpy(tmp, line, strlen(line));
tmp += strlen(line);
<span style="color: #aaaaaa">@@ -827,6 +822,19 @@ void darshan_log_close(darshan_fd fd)
</span>
/* **************************************************** */
<span style="background: #ddffdd; color: #000000">+static int darshan_mnt_info_cmp(const void *a, const void *b)
+{
+ struct darshan_mnt_info *m_a = (struct darshan_mnt_info *)a;
+ struct darshan_mnt_info *m_b = (struct darshan_mnt_info *)b;
+
+ if(strlen(m_a->mnt_path) > strlen(m_b->mnt_path))
+ return(-1);
+ else if(strlen(m_a->mnt_path) < strlen(m_b->mnt_path))
+ return(1);
+ else
+ return(0);
+}
+
</span> /* read the header of the darshan log and set internal fd data structures
* NOTE: this is the only portion of the darshan log that is uncompressed
*
</code></pre>
<br>
</li>
<li id="c0b0bf6d71bc5fc7e6d50d69c8aa2413">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/1eb2a5e4d71f390269143c7147a34f1d0a8377a3#diff-2">
<strong>
darshan-util/darshan-logutils.h
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-util/darshan-logutils.h
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-util/darshan-logutils.h
</span><span style="color: #aaaaaa">@@ -47,6 +47,12 @@ struct darshan_record_ref
</span> UT_hash_handle hlink;
};
<span style="background: #ddffdd; color: #000000">+struct darshan_mnt_info
+{
+ char mnt_type[DARSHAN_EXE_LEN];
+ char mnt_path[DARSHAN_EXE_LEN];
+};
+
</span> /* functions to be implemented by each module for integration with
* darshan log file utilities (e.g., parser & convert tools)
*/
<span style="color: #aaaaaa">@@ -115,10 +121,10 @@ int darshan_log_getjob(darshan_fd fd, struct darshan_job *job);
</span> int darshan_log_putjob(darshan_fd fd, struct darshan_job *job);
int darshan_log_getexe(darshan_fd fd, char *buf);
int darshan_log_putexe(darshan_fd fd, char *buf);
<span style="background: #ffdddd; color: #000000">-int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts,
- char*** fs_types, int* count);
-int darshan_log_putmounts(darshan_fd fd, char** mnt_pts,
- char** fs_types, int count);
</span><span style="background: #ddffdd; color: #000000">+int darshan_log_getmounts(darshan_fd fd, struct darshan_mnt_info **mnt_data_array,
+ int* count);
+int darshan_log_putmounts(darshan_fd fd, struct darshan_mnt_info *mnt_data_array,
+ int count);
</span> int darshan_log_gethash(darshan_fd fd, struct darshan_record_ref **hash);
int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash);
int darshan_log_getmod(darshan_fd fd, darshan_module_id mod_id,
</code></pre>
<br>
</li>
<li id="2ace16276b68c7d5aef163bb260bd9f7">
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/1eb2a5e4d71f390269143c7147a34f1d0a8377a3#diff-3">
<strong>
darshan-util/darshan-parser.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="background: #ffdddd; color: #000000">--- a/darshan-util/darshan-parser.c
</span><span style="background: #ddffdd; color: #000000">+++ b/darshan-util/darshan-parser.c
</span><span style="color: #aaaaaa">@@ -205,8 +205,7 @@ int main(int argc, char **argv)
</span> struct darshan_record_ref *rec_hash = NULL;
struct darshan_record_ref *ref, *tmp_ref;
int mount_count;
<span style="background: #ffdddd; color: #000000">- char** mnt_pts;
- char** fs_types;
</span><span style="background: #ddffdd; color: #000000">+ struct darshan_mnt_info *mnt_data_array;
</span> time_t tmp_time = 0;
char *token;
char *save;
<span style="color: #aaaaaa">@@ -248,7 +247,7 @@ int main(int argc, char **argv)
</span> }
/* get the mount information for this log */
<span style="background: #ffdddd; color: #000000">- ret = darshan_log_getmounts(fd, &mnt_pts, &fs_types, &mount_count);
</span><span style="background: #ddffdd; color: #000000">+ ret = darshan_log_getmounts(fd, &mnt_data_array, &mount_count);
</span> if(ret < 0)
{
darshan_log_close(fd);
<span style="color: #aaaaaa">@@ -318,7 +317,8 @@ int main(int argc, char **argv)
</span> printf("# -------------------------------------------------------\n");
for(i=0; i<mount_count; i++)
{
<span style="background: #ffdddd; color: #000000">- printf("# mount entry:\t%s\t%s\n", mnt_pts[i], fs_types[i]);
</span><span style="background: #ddffdd; color: #000000">+ printf("# mount entry:\t%s\t%s\n", mnt_data_array[i].mnt_path,
+ mnt_data_array[i].mnt_type);
</span> }
if(mask & OPTION_BASE)
<span style="color: #aaaaaa">@@ -417,10 +417,11 @@ int main(int argc, char **argv)
</span> /* get mount point and fs type associated with this record */
for(j=0; j<mount_count; j++)
{
<span style="background: #ffdddd; color: #000000">- if(strncmp(mnt_pts[j], ref->rec.name, strlen(mnt_pts[j])) == 0)
</span><span style="background: #ddffdd; color: #000000">+ if(strncmp(mnt_data_array[j].mnt_path, ref->rec.name,
+ strlen(mnt_data_array[j].mnt_path)) == 0)
</span> {
<span style="background: #ffdddd; color: #000000">- mnt_pt = mnt_pts[j];
- fs_type = fs_types[j];
</span><span style="background: #ddffdd; color: #000000">+ mnt_pt = mnt_data_array[j].mnt_path;
+ fs_type = mnt_data_array[j].mnt_type;
</span> break;
}
}
<span style="color: #aaaaaa">@@ -633,15 +634,9 @@ cleanup:
</span> }
/* free mount info */
<span style="background: #ffdddd; color: #000000">- for(i=0; i<mount_count; i++)
- {
- free(mnt_pts[i]);
- free(fs_types[i]);
- }
</span> if(mount_count > 0)
{
<span style="background: #ffdddd; color: #000000">- free(mnt_pts);
- free(fs_types);
</span><span style="background: #ddffdd; color: #000000">+ free(mnt_data_array);
</span> }
return(ret);
</code></pre>
<br>
</li>
</div>
<div class="footer" style="margin-top: 10px">
<p style="color: #777; font-size: small">
—
<br>
<a href="https://xgitlab.cels.anl.gov/darshan/darshan/commit/1eb2a5e4d71f390269143c7147a34f1d0a8377a3">View it on GitLab</a>.
<br>
You're receiving this email because of your account on xgitlab.cels.anl.gov.
If you'd like to receive fewer emails, you can
adjust your notification settings.
</p>
</div>
</body>
</html>