Commit 1b60a103 authored by Philip Carns's avatar Philip Carns

add mode argument to logutils open function (preparing to support writing

log data)


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@430 3b7491f3-a168-0410-bf4b-c445ed680a29
parent dfec7343
...@@ -39,7 +39,7 @@ int process_log(const char *fname, double *io_ratio, int *used_mpio, int *used_p ...@@ -39,7 +39,7 @@ int process_log(const char *fname, double *io_ratio, int *used_mpio, int *used_p
double total_job_time; double total_job_time;
int nofiles = 0; int nofiles = 0;
zfile = darshan_log_open(fname); zfile = darshan_log_open(fname, "r");
if (zfile == NULL) if (zfile == NULL)
{ {
perror("darshan_log_open"); perror("darshan_log_open");
......
...@@ -43,12 +43,12 @@ int main(int argc, char ** argv) ...@@ -43,12 +43,12 @@ int main(int argc, char ** argv)
return(-1); return(-1);
} }
file1 = darshan_log_open(argv[1]); file1 = darshan_log_open(argv[1], "r");
if(!file1) { if(!file1) {
perror("darshan_log_open"); perror("darshan_log_open");
return(-1); return(-1);
} }
file2 = darshan_log_open(argv[2]); file2 = darshan_log_open(argv[2], "r");
if(!file2) { if(!file2) {
perror("darshan_log_open"); perror("darshan_log_open");
return(-1); return(-1);
......
...@@ -94,7 +94,7 @@ int tree_walk (const char *fpath, const struct stat *sb, int typeflag) ...@@ -94,7 +94,7 @@ int tree_walk (const char *fpath, const struct stat *sb, int typeflag)
} }
/* Process Log Files */ /* Process Log Files */
dfile = darshan_log_open(fpath); dfile = darshan_log_open(fpath, "r");
if (dfile == NULL) if (dfile == NULL)
{ {
perror("darshan_log_open"); perror("darshan_log_open");
......
...@@ -212,7 +212,7 @@ static void shift_missing_1_22(struct darshan_file* file); ...@@ -212,7 +212,7 @@ static void shift_missing_1_22(struct darshan_file* file);
static void shift_missing_1_21(struct darshan_file* file); static void shift_missing_1_21(struct darshan_file* file);
/* a rather crude API for accessing raw binary darshan files */ /* a rather crude API for accessing raw binary darshan files */
darshan_fd darshan_log_open(const char *name) darshan_fd darshan_log_open(const char *name, const char* mode)
{ {
darshan_fd tmp_fd = malloc(sizeof(*tmp_fd)); darshan_fd tmp_fd = malloc(sizeof(*tmp_fd));
if(!tmp_fd) if(!tmp_fd)
...@@ -220,7 +220,7 @@ darshan_fd darshan_log_open(const char *name) ...@@ -220,7 +220,7 @@ darshan_fd darshan_log_open(const char *name)
memset(tmp_fd, 0, sizeof(*tmp_fd)); memset(tmp_fd, 0, sizeof(*tmp_fd));
tmp_fd->gzf = gzopen(name, "r"); tmp_fd->gzf = gzopen(name, mode);
if(!tmp_fd->gzf) if(!tmp_fd->gzf)
{ {
free(tmp_fd); free(tmp_fd);
......
...@@ -20,7 +20,7 @@ typedef struct darshan_fd_s* darshan_fd; ...@@ -20,7 +20,7 @@ typedef struct darshan_fd_s* darshan_fd;
extern char *darshan_names[]; extern char *darshan_names[];
extern char *darshan_f_names[]; extern char *darshan_f_names[];
darshan_fd darshan_log_open(const char *name); darshan_fd darshan_log_open(const char *name, const char* mode);
int darshan_log_getjob(darshan_fd file, struct darshan_job *job); int darshan_log_getjob(darshan_fd file, struct darshan_job *job);
int darshan_log_getfile(darshan_fd fd, int darshan_log_getfile(darshan_fd fd,
struct darshan_job* job, struct darshan_job* job,
......
...@@ -202,7 +202,7 @@ int main(int argc, char **argv) ...@@ -202,7 +202,7 @@ int main(int argc, char **argv)
mask = parse_args(argc, argv, &filename); mask = parse_args(argc, argv, &filename);
file = darshan_log_open(filename); file = darshan_log_open(filename, "r");
if(!file) if(!file)
{ {
perror("darshan_log_open"); perror("darshan_log_open");
......
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