Commit ec026e0a authored by Philip Carns's avatar Philip Carns
Browse files

bug fix to exe parsing for legacy log format


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@273 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 216291e7
...@@ -182,6 +182,7 @@ int (*getjob_internal)(darshan_fd file, struct darshan_job *job); ...@@ -182,6 +182,7 @@ int (*getjob_internal)(darshan_fd file, struct darshan_job *job);
int (*getfile_internal)(darshan_fd fd, int (*getfile_internal)(darshan_fd fd,
struct darshan_job *job, struct darshan_job *job,
struct darshan_file *file); struct darshan_file *file);
#define JOB_SIZE_124 28
/* internal routines for parsing different file versions */ /* internal routines for parsing different file versions */
static int getjob_internal_200(darshan_fd file, struct darshan_job *job); static int getjob_internal_200(darshan_fd file, struct darshan_job *job);
...@@ -241,27 +242,32 @@ int darshan_log_getjob(darshan_fd file, struct darshan_job *job) ...@@ -241,27 +242,32 @@ int darshan_log_getjob(darshan_fd file, struct darshan_job *job)
{ {
getjob_internal = getjob_internal_200; getjob_internal = getjob_internal_200;
getfile_internal = getfile_internal_200; getfile_internal = getfile_internal_200;
file->job_struct_size = sizeof(*job);
} }
else if(strcmp(file->version, "1.24") == 0) else if(strcmp(file->version, "1.24") == 0)
{ {
getjob_internal = getjob_internal_124; getjob_internal = getjob_internal_124;
getfile_internal = getfile_internal_124; getfile_internal = getfile_internal_124;
file->job_struct_size = JOB_SIZE_124;
} }
else if(strcmp(file->version, "1.23") == 0) else if(strcmp(file->version, "1.23") == 0)
{ {
/* same as 1.24, except that mnt points may be incorrect */ /* same as 1.24, except that mnt points may be incorrect */
getjob_internal = getjob_internal_124; getjob_internal = getjob_internal_124;
getfile_internal = getfile_internal_124; getfile_internal = getfile_internal_124;
file->job_struct_size = JOB_SIZE_124;
} }
else if(strcmp(file->version, "1.22") == 0) else if(strcmp(file->version, "1.22") == 0)
{ {
getjob_internal = getjob_internal_124; getjob_internal = getjob_internal_124;
getfile_internal = getfile_internal_122; getfile_internal = getfile_internal_122;
file->job_struct_size = JOB_SIZE_124;
} }
else if(strcmp(file->version, "1.21") == 0) else if(strcmp(file->version, "1.21") == 0)
{ {
getjob_internal = getjob_internal_124; getjob_internal = getjob_internal_124;
getfile_internal = getfile_internal_121; getfile_internal = getfile_internal_121;
file->job_struct_size = JOB_SIZE_124;
} }
else else
{ {
...@@ -302,7 +308,7 @@ int darshan_log_getmounts(darshan_fd fd, int64_t** devs, char*** mnt_pts, char** ...@@ -302,7 +308,7 @@ int darshan_log_getmounts(darshan_fd fd, int64_t** devs, char*** mnt_pts, char**
int array_index = 0; int array_index = 0;
char buf[CP_EXE_LEN+1]; char buf[CP_EXE_LEN+1];
gzseek(fd->gzf, sizeof(struct darshan_job), SEEK_SET); gzseek(fd->gzf, fd->job_struct_size, SEEK_SET);
ret = gzread(fd->gzf, buf, (CP_EXE_LEN + 1)); ret = gzread(fd->gzf, buf, (CP_EXE_LEN + 1));
if (ret < (CP_EXE_LEN + 1)) if (ret < (CP_EXE_LEN + 1))
...@@ -378,7 +384,7 @@ int darshan_log_getexe(darshan_fd fd, char *buf, int *flag) ...@@ -378,7 +384,7 @@ int darshan_log_getexe(darshan_fd fd, char *buf, int *flag)
int ret; int ret;
char* newline; char* newline;
gzseek(fd->gzf, sizeof(struct darshan_job), SEEK_SET); gzseek(fd->gzf, fd->job_struct_size, SEEK_SET);
ret = gzread(fd->gzf, buf, (CP_EXE_LEN + 1)); ret = gzread(fd->gzf, buf, (CP_EXE_LEN + 1));
if (ret < (CP_EXE_LEN + 1)) if (ret < (CP_EXE_LEN + 1))
...@@ -677,7 +683,6 @@ static int getfile_internal_200(darshan_fd fd, struct darshan_job *job, ...@@ -677,7 +683,6 @@ static int getfile_internal_200(darshan_fd fd, struct darshan_job *job,
/* If we see version 1.24, assume that it is stored in big endian 32 bit /* If we see version 1.24, assume that it is stored in big endian 32 bit
* format. Convert up to current format. * format. Convert up to current format.
*/ */
#define JOB_SIZE_124 28
static int getjob_internal_124(darshan_fd fd, struct darshan_job *job) static int getjob_internal_124(darshan_fd fd, struct darshan_job *job)
{ {
char* buffer; char* buffer;
......
...@@ -13,6 +13,7 @@ struct darshan_fd_s ...@@ -13,6 +13,7 @@ struct darshan_fd_s
gzFile gzf; gzFile gzf;
int swap_flag; int swap_flag;
char version[10]; char version[10];
int job_struct_size;
}; };
typedef struct darshan_fd_s* darshan_fd; typedef struct darshan_fd_s* darshan_fd;
......
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