diff --git a/darshan.h b/darshan.h index 8683f95a130354a534fe274dcd5e383d15653ee4..726f66860d658337cfc97ba4c1a48fc78ddc6949 100644 --- a/darshan.h +++ b/darshan.h @@ -204,7 +204,7 @@ void darshan_shutdown_bench(int argc, char** argv, int rank, int nprocs); void darshan_walk_file_accesses(struct darshan_job_runtime* final_job); double darshan_wtime(void); -uint32_t hashlittle(const void *key, size_t length, uint32_t initval); -uint64_t hash(register unsigned char *k, register uint64_t length, register uint64_t level); +uint32_t darshan_hashlittle(const void *key, size_t length, uint32_t initval); +uint64_t darshan_hash(register unsigned char *k, register uint64_t length, register uint64_t level); #endif /* __DARSHAN_H */ diff --git a/lib/darshan-mpi-io.c b/lib/darshan-mpi-io.c index f79399bf9fcca4c3ee9397aa13cea4ecb2d85564..b996d924d9b6b48ce75da1687a84d749d45b782e 100644 --- a/lib/darshan-mpi-io.c +++ b/lib/darshan-mpi-io.c @@ -543,7 +543,7 @@ int MPI_File_open(MPI_Comm comm, char *filename, int amode, MPI_Info info, MPI_F { CP_INC(file, CP_HINTS, 1); } - tmp_hash = hash((void*)fh, sizeof(*fh), 0); + tmp_hash = darshan_hash((void*)fh, sizeof(*fh), 0); hash_index = tmp_hash & CP_HASH_MASK; file->fh_prev = NULL; file->fh_next = darshan_global_job->fh_table[hash_index]; @@ -580,7 +580,7 @@ int MPI_File_close(MPI_File *fh) if(file->fh_prev == NULL) { /* head of fh hash table list */ - tmp_hash = hash((void*)&tmp_fh, sizeof(tmp_fh), 0); + tmp_hash = darshan_hash((void*)&tmp_fh, sizeof(tmp_fh), 0); hash_index = tmp_hash & CP_HASH_MASK; darshan_global_job->fh_table[hash_index] = file->fh_next; if(file->fh_next) @@ -1031,7 +1031,7 @@ static struct darshan_file_runtime* darshan_file_by_fh(MPI_File fh) return(darshan_global_job->darshan_mru_file); } - tmp_hash = hash((void*)(&fh), sizeof(fh), 0); + tmp_hash = darshan_hash((void*)(&fh), sizeof(fh), 0); /* search hash table */ hash_index = tmp_hash & CP_HASH_MASK; @@ -1767,7 +1767,7 @@ static char* darshan_get_exe_and_mounts(struct darshan_job_runtime* final_job) if(mnt_array_index < CP_MAX_MNTS) { mnt_hash_array[mnt_array_index] = - hash((void*)entry->mnt_dir, strlen(entry->mnt_dir), 0); + darshan_hash((void*)entry->mnt_dir, strlen(entry->mnt_dir), 0); mnt_id_array[mnt_array_index] = tmp_st_dev; mnt_array_index++; } diff --git a/lib/darshan-posix.c b/lib/darshan-posix.c index ba14d09497254c790a6de1a8e76a903f8effcb1c..0fad0286989591efbf671cc03c7245fabcf72ba9 100644 --- a/lib/darshan-posix.c +++ b/lib/darshan-posix.c @@ -1181,7 +1181,7 @@ struct darshan_file_runtime* darshan_file_by_name(const char* name) return(&darshan_global_job->file_runtime_array[0]); } - tmp_hash = hash((void*)name, strlen(name), 0); + tmp_hash = darshan_hash((void*)name, strlen(name), 0); /* check most recently used */ if(darshan_global_job->darshan_mru_file && darshan_global_job->darshan_mru_file->log_file->hash == tmp_hash) diff --git a/lib/lookup3.c b/lib/lookup3.c index f86a02aa52f826ffd20fc47a0f4f00b005272ae2..57ad15c2f29de0a45830db194121932b305a7103 100644 --- a/lib/lookup3.c +++ b/lib/lookup3.c @@ -253,7 +253,7 @@ uint32_t *pb) /* IN: more seed OUT: secondary hash value */ /* ------------------------------------------------------------------------------- -hashlittle() -- hash a variable-length key into a 32-bit value +darshan_hashlittle() -- hash a variable-length key into a 32-bit value k : the key (the unaligned variable-length array of bytes) length : the length of the key, counting by bytes initval : can be any 4-byte value @@ -278,7 +278,7 @@ acceptable. Do NOT use for cryptographic purposes. ------------------------------------------------------------------------------- */ -uint32_t hashlittle( const void *key, size_t length, uint32_t initval) +uint32_t darshan_hashlittle( const void *key, size_t length, uint32_t initval) { uint32_t a,b,c; /* internal state */ union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ diff --git a/lib/lookup8.c b/lib/lookup8.c index ce818cc0a0d1067c97926c7b5b0b93574608fcdc..4acb416f1721bff2928f6a7331b38b990f373fe6 100644 --- a/lib/lookup8.c +++ b/lib/lookup8.c @@ -54,7 +54,7 @@ This implies that a hash using mix64 has no funnels. There may be /* -------------------------------------------------------------------- -hash() -- hash a variable-length key into a 64-bit value +darshan_hash() -- hash a variable-length key into a 64-bit value k : the key (the unaligned variable-length array of bytes) len : the length of the key, counting by bytes level : can be any 8-byte value @@ -81,7 +81,7 @@ is acceptable. Do NOT use for cryptographic purposes. -------------------------------------------------------------------- */ -ub8 hash( k, length, level) +ub8 darshan_hash( k, length, level) const register ub1 *k; /* the key */ register ub8 length; /* the length of the key */ register ub8 level; /* the previous hash, or an arbitrary value */ @@ -280,7 +280,7 @@ void driver1() for (i=0; i<256; ++i) { - h = hash(buf,i,h); + h = darshan_hash(buf,i,h); } } @@ -318,10 +318,10 @@ void driver2() /* have a and b be two keys differing in only one bit */ a[i] ^= (k<>(8-j)); - c[0] = hash(a, hlen, m); + c[0] = darshan_hash(a, hlen, m); b[i] ^= ((k+1)<>(8-j)); - d[0] = hash(b, hlen, m); + d[0] = darshan_hash(b, hlen, m); /* check every bit is 1, 0, set, and not set at least once */ for (l=0; l>32)); - h = hash(qq+1, (ub8)(sizeof(q)-1), (ub8)0); + h = darshan_hash(qq+1, (ub8)(sizeof(q)-1), (ub8)0); printf("%.8lx%.8lx\n", (ub4)h, (ub4)(h>>32)); - h = hash(qqq+2, (ub8)(sizeof(q)-1), (ub8)0); + h = darshan_hash(qqq+2, (ub8)(sizeof(q)-1), (ub8)0); printf("%.8lx%.8lx\n", (ub4)h, (ub4)(h>>32)); - h = hash(qqqq+3, (ub8)(sizeof(q)-1), (ub8)0); + h = darshan_hash(qqqq+3, (ub8)(sizeof(q)-1), (ub8)0); printf("%.8lx%.8lx\n", (ub4)h, (ub4)(h>>32)); - h = hash(o+4, (ub8)(sizeof(q)-1), (ub8)0); + h = darshan_hash(o+4, (ub8)(sizeof(q)-1), (ub8)0); printf("%.8lx%.8lx\n", (ub4)h, (ub4)(h>>32)); - h = hash(oo+5, (ub8)(sizeof(q)-1), (ub8)0); + h = darshan_hash(oo+5, (ub8)(sizeof(q)-1), (ub8)0); printf("%.8lx%.8lx\n", (ub4)h, (ub4)(h>>32)); - h = hash(ooo+6, (ub8)(sizeof(q)-1), (ub8)0); + h = darshan_hash(ooo+6, (ub8)(sizeof(q)-1), (ub8)0); printf("%.8lx%.8lx\n", (ub4)h, (ub4)(h>>32)); - h = hash(oooo+7, (ub8)(sizeof(q)-1), (ub8)0); + h = darshan_hash(oooo+7, (ub8)(sizeof(q)-1), (ub8)0); printf("%.8lx%.8lx\n", (ub4)h, (ub4)(h>>32)); printf("\n"); for (h=0, b=buf+1; h<8; ++h, ++b) @@ -399,11 +399,11 @@ void driver3() for (j=0; j>32)); } }