Commit 7d35c45a authored by Shane Snyder's avatar Shane Snyder

register/lookup_record now use strings explicitly

parent 8f463e51
...@@ -119,8 +119,7 @@ void darshan_core_unregister_module( ...@@ -119,8 +119,7 @@ void darshan_core_unregister_module(
* *
*/ */
void darshan_core_lookup_record( void darshan_core_lookup_record(
void *name, char *name,
int name_len,
darshan_record_id *rec_id); darshan_record_id *rec_id);
/* darshan_core_register_record() /* darshan_core_register_record()
...@@ -139,7 +138,7 @@ void darshan_core_lookup_record( ...@@ -139,7 +138,7 @@ void darshan_core_lookup_record(
*/ */
int darshan_core_register_record( int darshan_core_register_record(
darshan_record_id rec_id, darshan_record_id rec_id,
void *name, char *name,
darshan_module_id mod_id, darshan_module_id mod_id,
int rec_size, int rec_size,
int *file_alignment); int *file_alignment);
......
...@@ -1772,16 +1772,14 @@ void darshan_core_unregister_module( ...@@ -1772,16 +1772,14 @@ void darshan_core_unregister_module(
} }
void darshan_core_lookup_record( void darshan_core_lookup_record(
void *name, char *name,
int name_len,
darshan_record_id *rec_id) darshan_record_id *rec_id)
{ {
darshan_record_id tmp_rec_id; darshan_record_id tmp_rec_id;
int name_len = strlen(name);
/* TODO: how do we handle potentially non-ascii record names? */
/* hash the input name to get a unique id for this record */ /* hash the input name to get a unique id for this record */
tmp_rec_id = darshan_hash(name, name_len, 0); tmp_rec_id = darshan_hash((unsigned char *)name, name_len, 0);
*rec_id = tmp_rec_id; *rec_id = tmp_rec_id;
return; return;
...@@ -1789,7 +1787,7 @@ void darshan_core_lookup_record( ...@@ -1789,7 +1787,7 @@ void darshan_core_lookup_record(
int darshan_core_register_record( int darshan_core_register_record(
darshan_record_id rec_id, darshan_record_id rec_id,
void *name, char *name,
darshan_module_id mod_id, darshan_module_id mod_id,
int rec_size, int rec_size,
int *file_alignment) int *file_alignment)
......
...@@ -279,8 +279,7 @@ static struct hdf5_file_runtime* hdf5_file_by_name(const char *name) ...@@ -279,8 +279,7 @@ static struct hdf5_file_runtime* hdf5_file_by_name(const char *name)
/* lookup the unique id for this filename */ /* lookup the unique id for this filename */
darshan_core_lookup_record( darshan_core_lookup_record(
(void*)newname, newname,
strlen(newname),
&file_id); &file_id);
/* search the hash table for this file record, and return if found */ /* search the hash table for this file record, and return if found */
...@@ -288,7 +287,7 @@ static struct hdf5_file_runtime* hdf5_file_by_name(const char *name) ...@@ -288,7 +287,7 @@ static struct hdf5_file_runtime* hdf5_file_by_name(const char *name)
if(!file) if(!file)
{ {
/* register the record with the darshan core component */ /* register the record with the darshan core component */
ret = darshan_core_register_record(file_id, (void *)newname, DARSHAN_HDF5_MOD, ret = darshan_core_register_record(file_id, newname, DARSHAN_HDF5_MOD,
sizeof(struct darshan_hdf5_file), NULL); sizeof(struct darshan_hdf5_file), NULL);
if(ret == 1) if(ret == 1)
{ {
......
...@@ -910,8 +910,7 @@ static struct mpiio_file_runtime* mpiio_file_by_name(const char *name) ...@@ -910,8 +910,7 @@ static struct mpiio_file_runtime* mpiio_file_by_name(const char *name)
/* lookup the unique id for this filename */ /* lookup the unique id for this filename */
darshan_core_lookup_record( darshan_core_lookup_record(
(void*)newname, newname,
strlen(newname),
&file_id); &file_id);
/* search the hash table for this file record, and return if found */ /* search the hash table for this file record, and return if found */
...@@ -919,7 +918,7 @@ static struct mpiio_file_runtime* mpiio_file_by_name(const char *name) ...@@ -919,7 +918,7 @@ static struct mpiio_file_runtime* mpiio_file_by_name(const char *name)
if(!file) if(!file)
{ {
/* register the record with the darshan core component */ /* register the record with the darshan core component */
ret = darshan_core_register_record(file_id, (void *)newname, DARSHAN_MPIIO_MOD, ret = darshan_core_register_record(file_id, newname, DARSHAN_MPIIO_MOD,
sizeof(struct darshan_mpiio_file), NULL); sizeof(struct darshan_mpiio_file), NULL);
if(ret == 1) if(ret == 1)
{ {
......
...@@ -291,8 +291,7 @@ static struct pnetcdf_file_runtime* pnetcdf_file_by_name(const char *name) ...@@ -291,8 +291,7 @@ static struct pnetcdf_file_runtime* pnetcdf_file_by_name(const char *name)
/* lookup the unique id for this filename */ /* lookup the unique id for this filename */
darshan_core_lookup_record( darshan_core_lookup_record(
(void*)newname, newname,
strlen(newname),
&file_id); &file_id);
/* search the hash table for this file record, and return if found */ /* search the hash table for this file record, and return if found */
...@@ -300,7 +299,7 @@ static struct pnetcdf_file_runtime* pnetcdf_file_by_name(const char *name) ...@@ -300,7 +299,7 @@ static struct pnetcdf_file_runtime* pnetcdf_file_by_name(const char *name)
if(!file) if(!file)
{ {
/* register the record with the darshan core component */ /* register the record with the darshan core component */
ret = darshan_core_register_record(file_id, (void *)newname, DARSHAN_PNETCDF_MOD, ret = darshan_core_register_record(file_id, newname, DARSHAN_PNETCDF_MOD,
sizeof(struct darshan_pnetcdf_file), NULL); sizeof(struct darshan_pnetcdf_file), NULL);
if(ret == 1) if(ret == 1)
{ {
......
...@@ -1529,8 +1529,7 @@ static struct posix_file_runtime* posix_file_by_name(const char *name) ...@@ -1529,8 +1529,7 @@ static struct posix_file_runtime* posix_file_by_name(const char *name)
/* lookup the unique id for this filename */ /* lookup the unique id for this filename */
darshan_core_lookup_record( darshan_core_lookup_record(
(void*)newname, newname,
strlen(newname),
&file_id); &file_id);
/* search the hash table for this file record, and return if found */ /* search the hash table for this file record, and return if found */
...@@ -1538,7 +1537,7 @@ static struct posix_file_runtime* posix_file_by_name(const char *name) ...@@ -1538,7 +1537,7 @@ static struct posix_file_runtime* posix_file_by_name(const char *name)
if(!file) if(!file)
{ {
/* register the record with the darshan core component */ /* register the record with the darshan core component */
ret = darshan_core_register_record(file_id, (void *)newname, DARSHAN_POSIX_MOD, ret = darshan_core_register_record(file_id, newname, DARSHAN_POSIX_MOD,
sizeof(struct darshan_posix_file), &file_alignment); sizeof(struct darshan_posix_file), &file_alignment);
if(ret == 1) if(ret == 1)
{ {
......
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