Commit 48888ae5 authored by Philip Carns's avatar Philip Carns

experimental fix for problem reported by Zhe Zhang; file system with a large

device id value shows up as UNKNOWN in the parser output, likely because of
a type casting mismatch in the header and file record


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/branches/darshan-1.1@254 3b7491f3-a168-0410-bf4b-c445ed680a29
parent b9555790
......@@ -15,7 +15,7 @@
const char *insert_job_fmt = "insert into %s values('%d','%s','%s','%s',\
'%d','%d','%d','%d')";
const char *insert_mnt_fmt = "insert into %s values('%d','%d','%d','%s','%s')";
const char *insert_mnt_fmt = "insert into %s values('%d','%d','%lld','%s','%s')";
const char *insert_file_fmt = "insert into %s values('%d','%d','%lld','%d',\
'%s',\
'%lld','%lld','%lld','%lld','%lld','%lld','%lld','%lld','%lld','%lld',\
......@@ -55,7 +55,7 @@ int tree_walk (const char *fpath, const struct stat *sb, int typeflag)
char *sqlstmt;
int count;
int i;
int *devs;
int64_t *devs;
char **mnts;
char **fstypes;
regex_t regex;
......@@ -170,7 +170,7 @@ int tree_walk (const char *fpath, const struct stat *sb, int typeflag)
for (i=0; (i<count); i++)
{
snprintf(sqlstmt,MAXSQL,insert_mnt_fmt, "darshan_mountpoints_surveyor",
atoi(jobid), job.start_time, devs[i], mnts[i], fstypes[i]);
atoi(jobid), job.start_time, lld(devs[i]), mnts[i], fstypes[i]);
if (debug) printf("sql: %s\n", sqlstmt);
ret = mysql_query(mysql, sqlstmt);
......
......@@ -379,7 +379,7 @@ int darshan_log_getfile(darshan_fd fd, struct darshan_job *job, struct darshan_f
* 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, int** devs, char*** mnt_pts, char***
int darshan_log_getmounts(darshan_fd fd, int64_t** devs, char*** mnt_pts, char***
fs_types, int* count, int *flag)
{
int ret;
......@@ -416,7 +416,7 @@ int darshan_log_getmounts(darshan_fd fd, int** devs, char*** mnt_pts, char***
}
/* allocate output arrays */
*devs = malloc((*count)*sizeof(int));
*devs = malloc((*count)*sizeof(int64_t));
assert(*devs);
*mnt_pts = malloc((*count)*sizeof(char*));
assert(*mnt_pts);
......@@ -434,8 +434,16 @@ int darshan_log_getmounts(darshan_fd fd, int** devs, char*** mnt_pts, char***
(*fs_types)[array_index] = malloc(CP_EXE_LEN);
assert((*fs_types)[array_index]);
ret = sscanf(++pos, "%d\t%s\t%s", &(*devs)[array_index],
#if SIZEOF_LONG_INT == 4
ret = sscanf(++pos, "%lld\t%s\t%s", &(*devs)[array_index],
(*fs_types)[array_index], (*mnt_pts)[array_index]);
#elif SIZEOF_LONG_INT == 8
ret = sscanf(++pos, "%ld\t%s\t%s", &(*devs)[array_index],
(*fs_types)[array_index], (*mnt_pts)[array_index]);
#else
# error Unexpected sizeof(long int)
#endif
if(ret != 3)
{
fprintf(stderr, "Error: poorly formatted mount table in log file.\n");
......
......@@ -18,7 +18,7 @@ int darshan_log_getfile(darshan_fd fd,
struct darshan_job* job,
struct darshan_file *file);
int darshan_log_getexe(darshan_fd fd, char *buf, int *flag);
int darshan_log_getmounts(darshan_fd fd, int** devs, char*** mnt_pts, char***
int darshan_log_getmounts(darshan_fd fd, int64_t** devs, char*** mnt_pts, char***
fs_types, int* count, int *flag);
void darshan_log_close(darshan_fd file);
void darshan_log_print_version_warnings(struct darshan_job *job);
......
......@@ -26,7 +26,7 @@ int main(int argc, char **argv)
darshan_fd file;
int i;
int mount_count;
int* devs;
int64_t* devs;
char** mnt_pts;
char** fs_types;
int last_rank = 0;
......@@ -86,7 +86,7 @@ int main(int argc, char **argv)
printf("# -------------------------------------------------------\n");
for(i=0; i<mount_count; i++)
{
printf("# mount entry: %d\t%s\t%s\n", devs[i], mnt_pts[i], fs_types[i]);
printf("# mount entry: %lld\t%s\t%s\n", lld(devs[i]), mnt_pts[i], fs_types[i]);
}
if(no_files_flag)
......
......@@ -1756,16 +1756,18 @@ static char* darshan_get_exe_and_mounts(struct darshan_job_runtime* final_job)
ret = stat(entry->mnt_dir, &statbuf);
if(ret == 0)
{
int64_t tmp_st_dev = statbuf.st_dev;
/* record hash of mount point and id */
if(mnt_array_index < CP_MAX_MNTS)
{
mnt_hash_array[mnt_array_index] =
hash((void*)entry->mnt_dir, strlen(entry->mnt_dir), 0);
mnt_id_array[mnt_array_index] = statbuf.st_dev;
mnt_id_array[mnt_array_index] = tmp_st_dev;
mnt_array_index++;
}
ret = snprintf(tmp_mnt, 256, "\n%d\t%s\t%s", (int)statbuf.st_dev,
ret = snprintf(tmp_mnt, 256, "\n%lld\t%s\t%s", lld(tmp_st_dev),
entry->mnt_type, entry->mnt_dir);
if(ret >= 256)
{
......@@ -1778,8 +1780,8 @@ static char* darshan_get_exe_and_mounts(struct darshan_job_runtime* final_job)
space_left -= strlen(tmp_mnt);
}
#if 0
printf("dev: %d, mnt_pt: %s, type: %s\n",
(int)statbuf.st_dev, entry->mnt_dir, entry->mnt_type);
printf("dev: %lld, mnt_pt: %s, type: %s\n",
lld(tmp_st_dev), entry->mnt_dir, entry->mnt_type);
#endif
}
}
......
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