Commit 2de80622 authored by Shane Snyder's avatar Shane Snyder

No longer store unique hash with mount info

parent 7b412204
......@@ -42,7 +42,6 @@ static int nprocs = -1;
#define DARSHAN_MAX_MNT_TYPE 32
struct mnt_data
{
int64_t hash; /* TODO: should it be possible for these to be negative? */
int64_t block_size;
char path[DARSHAN_MAX_MNT_PATH];
char type[DARSHAN_MAX_MNT_TYPE];
......@@ -778,9 +777,6 @@ static void add_entry(char* trailing_data, int* space_left, struct mntent *entry
DARSHAN_MAX_MNT_PATH-1);
strncpy(mnt_data_array[mnt_data_count].type, entry->mnt_type,
DARSHAN_MAX_MNT_TYPE-1);
mnt_data_array[mnt_data_count].hash =
darshan_hash((void*)mnt_data_array[mnt_data_count].path,
strlen(mnt_data_array[mnt_data_count].path), 0);
/* NOTE: we now try to detect the preferred block size for each file
* system using fstatfs(). On Lustre we assume a size of 1 MiB
* because fstatfs() reports 4 KiB.
......@@ -797,8 +793,7 @@ static void add_entry(char* trailing_data, int* space_left, struct mntent *entry
mnt_data_array[mnt_data_count].block_size = 4096;
/* store mount information for use in header of darshan log */
ret = snprintf(tmp_mnt, 256, "\n%" PRId64 "\t%s\t%s",
mnt_data_array[mnt_data_count].hash,
ret = snprintf(tmp_mnt, 256, "\n%s\t%s",
entry->mnt_type, entry->mnt_dir);
if(ret < 256 && strlen(tmp_mnt) <= (*space_left))
{
......
......@@ -243,11 +243,11 @@ int darshan_log_getexe(darshan_fd fd, char *buf)
/* darshan_log_getmounts()
*
* retrieves mount table information from the log. Note that devs, 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
* 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
*/
int darshan_log_getmounts(darshan_fd fd, int64_t** devs, char*** mnt_pts,
int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts,
char*** fs_types, int* count)
{
int ret;
......@@ -274,8 +274,6 @@ int darshan_log_getmounts(darshan_fd fd, int64_t** devs, char*** mnt_pts,
}
/* allocate output arrays */
*devs = malloc((*count)*sizeof(int64_t));
assert(*devs);
*mnt_pts = malloc((*count)*sizeof(char*));
assert(*mnt_pts);
*fs_types = malloc((*count)*sizeof(char*));
......@@ -292,10 +290,9 @@ int darshan_log_getmounts(darshan_fd fd, int64_t** devs, char*** mnt_pts,
(*fs_types)[array_index] = malloc(CP_EXE_LEN);
assert((*fs_types)[array_index]);
ret = sscanf(++pos, "%" PRId64 "\t%s\t%s", &(*devs)[array_index],
(*fs_types)[array_index], (*mnt_pts)[array_index]);
if(ret != 3)
ret = sscanf(++pos, "%s\t%s", (*fs_types)[array_index],
(*mnt_pts)[array_index]);
if(ret != 2)
{
fprintf(stderr, "Error: poorly formatted mount table in log file.\n");
return(-1);
......
......@@ -24,7 +24,7 @@ int darshan_log_getjob(darshan_fd file, struct darshan_job *job);
int darshan_log_gethash(darshan_fd file, struct darshan_record_ref **hash);
int darshan_log_getfile(darshan_fd fd, struct darshan_posix_file *file);
int darshan_log_getexe(darshan_fd fd, char *buf);
int darshan_log_getmounts(darshan_fd fd, int64_t** devs, char*** mnt_pts,
int darshan_log_getmounts(darshan_fd fd, char*** mnt_pts,
char*** fs_types, int* count);
void darshan_log_close(darshan_fd file);
......
......@@ -30,7 +30,6 @@ int main(int argc, char **argv)
struct darshan_record_ref *rec_hash = NULL;
struct darshan_record_ref *ref, *tmp;
int mount_count;
int64_t* devs;
char** mnt_pts;
char** fs_types;
struct darshan_posix_file next_rec;
......@@ -117,7 +116,7 @@ int main(int argc, char **argv)
}
/* get the mount information for this log */
ret = darshan_log_getmounts(file, &devs, &mnt_pts, &fs_types, &mount_count);
ret = darshan_log_getmounts(file, &mnt_pts, &fs_types, &mount_count);
if(ret < 0)
{
fprintf(stderr, "darshan_log_getmounts() failed to read mount information.\n");
......@@ -126,11 +125,11 @@ int main(int argc, char **argv)
}
/* print table of mounted file systems */
printf("\n# mounted file systems (device, mount point, and fs type)\n");
printf("\n# mounted file systems (mount point and fs type)\n");
printf("# -------------------------------------------------------\n");
for(i=0; i<mount_count; i++)
{
printf("# mount entry: %" PRId64 "\t%s\t%s\n", devs[i], mnt_pts[i], fs_types[i]);
printf("# mount entry:\t%s\t%s\n", mnt_pts[i], fs_types[i]);
}
/* read hash of darshan records */
......@@ -176,6 +175,18 @@ int main(int argc, char **argv)
i++;
} while((ret = darshan_log_getfile(file, &next_rec)) == 1);
/* free mount info */
for(i=0; i<mount_count; i++)
{
free(mnt_pts[i]);
free(fs_types[i]);
}
if(mount_count > 0)
{
free(mnt_pts);
free(fs_types);
}
darshan_log_close(file);
return(0);
......
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