Commit 8496aca0 authored by Philip Carns's avatar Philip Carns

rename some of the logutils functions


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@119 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 220c3419
......@@ -43,36 +43,36 @@ int main(int argc, char ** argv)
return(-1);
}
file1 = darshan_open(argv[1]);
file1 = darshan_log_open(argv[1]);
if(!file1) {
perror("darshan_open");
perror("darshan_log_open");
return(-1);
}
file2 = darshan_open(argv[2]);
file2 = darshan_log_open(argv[2]);
if(!file2) {
perror("darshan_open");
perror("darshan_log_open");
return(-1);
}
if (darshan_job_init(file1, &job1))
if (darshan_log_getjob(file1, &job1))
{
darshan_finalize(file1);
darshan_log_close(file1);
return(-1);
}
if (darshan_job_init(file2, &job2))
if (darshan_log_getjob(file2, &job2))
{
darshan_finalize(file2);
darshan_log_close(file2);
return(-1);
}
if (darshan_getexe(file1, exe1, &no_files_flag1))
if (darshan_log_getexe(file1, exe1, &no_files_flag1))
{
darshan_finalize(file1);
darshan_log_close(file1);
return(-1);
}
if (darshan_getexe(file2, exe2, &no_files_flag2))
if (darshan_log_getexe(file2, exe2, &no_files_flag2))
{
darshan_finalize(file2);
darshan_log_close(file2);
return(-1);
}
......@@ -98,18 +98,18 @@ int main(int argc, char ** argv)
* buffers in the while loop */
do {
ret1 = darshan_getfile(file1, &cp_file1);
ret1 = darshan_log_getfile(file1, &cp_file1);
if (ret1 < 0)
{
perror("darshan_getfile");
darshan_finalize(file1);
perror("darshan_log_getfile");
darshan_log_close(file1);
return(-1);
}
ret2 = darshan_getfile(file2, &cp_file2);
ret2 = darshan_log_getfile(file2, &cp_file2);
if (ret2 < 0)
{
perror("darshan_getfile");
darshan_finalize(file2);
perror("darshan_log_getfile");
darshan_log_close(file2);
return(-1);
}
......@@ -142,8 +142,8 @@ int main(int argc, char ** argv)
} while (ret1 == 1 || ret2 == 1);
darshan_finalize(file1);
darshan_finalize(file2);
darshan_log_close(file1);
darshan_log_close(file2);
return(0);
}
......
......@@ -173,16 +173,16 @@ char *darshan_f_names[] = {
};
/* a rather crude API for accessing raw binary darshan files */
darshan_fd darshan_open(char *name)
darshan_fd darshan_log_open(char *name)
{
return gzopen(name, "r");
}
/* darshan_job_init()
/* darshan_log_getjob()
*
* returns 0 on success, -1 on failure
*/
int darshan_job_init(darshan_fd file, struct darshan_job *job)
int darshan_log_getjob(darshan_fd file, struct darshan_job *job)
{
int ret;
ret = gzread(file, job, sizeof(*job));
......@@ -206,11 +206,11 @@ int darshan_job_init(darshan_fd file, struct darshan_job *job)
return(0);
}
/* darshan_getfile()
/* darshan_log_getfile()
*
* return 1 if file record found, 0 on eof, and -1 on error
*/
int darshan_getfile(darshan_fd fd, struct darshan_file *file)
int darshan_log_getfile(darshan_fd fd, struct darshan_file *file)
{
int ret;
const char* err_string;
......@@ -246,7 +246,7 @@ int darshan_getfile(darshan_fd fd, struct darshan_file *file)
return(-1);
}
int darshan_getexe(darshan_fd fd, char *buf, int *flag)
int darshan_log_getexe(darshan_fd fd, char *buf, int *flag)
{
int ret;
......@@ -263,7 +263,7 @@ int darshan_getexe(darshan_fd fd, char *buf, int *flag)
return (0);
}
void darshan_finalize(darshan_fd file)
void darshan_log_close(darshan_fd file)
{
gzclose(file);
}
......
......@@ -12,10 +12,10 @@ typedef gzFile darshan_fd;
extern char *darshan_names[];
extern char *darshan_f_names[];
darshan_fd darshan_open(char *name);
int darshan_job_init(darshan_fd file, struct darshan_job *job);
int darshan_getfile(darshan_fd fd, struct darshan_file *file);
int darshan_getexe(darshan_fd fd, char *buf, int *flag);
void darshan_finalize(darshan_fd file);
darshan_fd darshan_log_open(char *name);
int darshan_log_getjob(darshan_fd file, struct darshan_job *job);
int darshan_log_getfile(darshan_fd fd, struct darshan_file *file);
int darshan_log_getexe(darshan_fd fd, char *buf, int *flag);
void darshan_log_close(darshan_fd file);
#endif
......@@ -30,27 +30,27 @@ int main(int argc, char **argv)
return(-1);
}
file = darshan_open(argv[1]);
file = darshan_log_open(argv[1]);
if(!file)
{
perror("darshan_open");
perror("darshan_log_open");
return(-1);
}
/* read job info */
ret = darshan_job_init(file, &job);
ret = darshan_log_getjob(file, &job);
if(ret < 0)
{
fprintf(stderr, "Error: unable to read job information from log file.\n");
darshan_finalize(file);
darshan_log_close(file);
return(-1);
}
ret = darshan_getexe(file, tmp_string, &no_files_flag);
ret = darshan_log_getexe(file, tmp_string, &no_files_flag);
if(ret < 0)
{
fprintf(stderr, "Error: unable to read trailing job information.\n");
darshan_finalize(file);
darshan_log_close(file);
return(-1);
}
......@@ -72,7 +72,7 @@ int main(int argc, char **argv)
{
/* it looks like the app didn't open any files */
printf("# no files opened.\n");
darshan_finalize(file);
darshan_log_close(file);
return(0);
}
......@@ -126,7 +126,7 @@ int main(int argc, char **argv)
CP_PRINT_HEADER();
while((ret = darshan_getfile(file, &cp_file)) == 1)
while((ret = darshan_log_getfile(file, &cp_file)) == 1)
{
CP_PRINT(&job, &cp_file, CP_POSIX_READS);
CP_PRINT(&job, &cp_file, CP_POSIX_WRITES);
......@@ -289,6 +289,6 @@ int main(int argc, char **argv)
return(-1);
}
darshan_finalize(file);
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