Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Cristian Simarro
darshan
Commits
4ac75905
Commit
4ac75905
authored
Dec 04, 2015
by
Shane Snyder
Browse files
modify hash write routine to use new serialization
parent
c9618c8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
darshan-util/darshan-logutils.c
View file @
4ac75905
...
@@ -638,13 +638,12 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash)
...
@@ -638,13 +638,12 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash)
int
hash_buf_sz
;
int
hash_buf_sz
;
struct
darshan_record_ref
*
ref
,
*
tmp
;
struct
darshan_record_ref
*
ref
,
*
tmp
;
char
*
buf_ptr
;
char
*
buf_ptr
;
int
path_len
;
int
wrote
;
int
wrote
;
assert
(
state
);
assert
(
state
);
/* allocate memory for largest possible hash record */
/* allocate memory for largest possible hash record */
hash_buf_sz
=
sizeof
(
darshan_record_id
)
+
sizeof
(
uint32_t
)
+
PATH_MAX
;
hash_buf_sz
=
sizeof
(
darshan_record_id
)
+
PATH_MAX
+
1
;
hash_buf
=
malloc
(
hash_buf_sz
);
hash_buf
=
malloc
(
hash_buf_sz
);
if
(
!
hash_buf
)
if
(
!
hash_buf
)
return
(
-
1
);
return
(
-
1
);
...
@@ -654,18 +653,15 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash)
...
@@ -654,18 +653,15 @@ int darshan_log_puthash(darshan_fd fd, struct darshan_record_ref *hash)
HASH_ITER
(
hlink
,
hash
,
ref
,
tmp
)
HASH_ITER
(
hlink
,
hash
,
ref
,
tmp
)
{
{
buf_ptr
=
hash_buf
;
buf_ptr
=
hash_buf
;
path_len
=
strlen
(
ref
->
rec
.
name
);
/* the hash buffer has space to serialize this record
/* the hash buffer has space to serialize this record
* NOTE: darshan record hash serialization method:
* NOTE: darshan record hash serialization method:
* ... darshan_record_id |
(uint32_t) path_len | path
...
* ... darshan_record_id |
path '\0'
...
*/
*/
*
((
darshan_record_id
*
)
buf_ptr
)
=
ref
->
rec
.
id
;
*
((
darshan_record_id
*
)
buf_ptr
)
=
ref
->
rec
.
id
;
buf_ptr
+=
sizeof
(
darshan_record_id
);
buf_ptr
+=
sizeof
(
darshan_record_id
);
*
((
uint32_t
*
)
buf_ptr
)
=
path_len
;
strcpy
(
buf_ptr
,
ref
->
rec
.
name
);
buf_ptr
+=
sizeof
(
uint32_t
);
buf_ptr
+=
strlen
(
ref
->
rec
.
name
)
+
1
;
memcpy
(
buf_ptr
,
ref
->
rec
.
name
,
path_len
);
buf_ptr
+=
path_len
;
/* write this hash entry to log file */
/* write this hash entry to log file */
wrote
=
darshan_log_dzwrite
(
fd
,
DARSHAN_REC_MAP_REGION_ID
,
wrote
=
darshan_log_dzwrite
(
fd
,
DARSHAN_REC_MAP_REGION_ID
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment