From fef3f1fc6c6f0ed0df987fba12b8370c5f592eae Mon Sep 17 00:00:00 2001 From: Shane Snyder Date: Thu, 1 Dec 2016 15:42:29 -0600 Subject: [PATCH] bug fix in lustre logutils --- darshan-util/darshan-lustre-logutils.c | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/darshan-util/darshan-lustre-logutils.c b/darshan-util/darshan-lustre-logutils.c index 49071b3..89f58ea 100644 --- a/darshan-util/darshan-lustre-logutils.c +++ b/darshan-util/darshan-lustre-logutils.c @@ -61,6 +61,16 @@ static int darshan_log_get_lustre_record(darshan_fd fd, void** lustre_buf_p) else if(ret < sizeof(struct darshan_lustre_record)) return(0); + /* swap bytes if necessary */ + if(fd->swap_flag) + { + DARSHAN_BSWAP64(&tmp_rec.base_rec.id); + DARSHAN_BSWAP64(&tmp_rec.base_rec.rank); + for(i=0; iswap_flag) - { - DARSHAN_BSWAP64(&rec->base_rec.id); - DARSHAN_BSWAP64(&rec->base_rec.rank); - for(i=0; icounters[i]); - DARSHAN_BSWAP64(&(rec->ost_ids[0])); - } - /* now read the rest of the record */ if ( rec->counters[LUSTRE_STRIPE_WIDTH] > 1 ) { ret = darshan_log_get_mod( @@ -87,16 +87,16 @@ static int darshan_log_get_lustre_record(darshan_fd fd, void** lustre_buf_p) (void*)(&(rec->ost_ids[1])), (rec->counters[LUSTRE_STRIPE_WIDTH] - 1)*sizeof(OST_ID) ); - if(ret < 0) + if(ret < (rec->counters[LUSTRE_STRIPE_WIDTH] - 1)*sizeof(OST_ID)) ret = -1; - else if(ret < (rec->counters[LUSTRE_STRIPE_WIDTH] - 1)*sizeof(OST_ID)) - ret = 0; else + { ret = 1; - /* swap bytes if necessary */ - if ( fd->swap_flag ) - for (i = 1; i < rec->counters[LUSTRE_STRIPE_WIDTH]; i++ ) - DARSHAN_BSWAP64(&(rec->ost_ids[i])); + /* swap bytes if necessary */ + if ( fd->swap_flag ) + for (i = 1; i < rec->counters[LUSTRE_STRIPE_WIDTH]; i++ ) + DARSHAN_BSWAP64(&(rec->ost_ids[i])); + } } else { -- 2.26.2