diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2016-11-12 09:05:47 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2016-11-12 09:05:47 (GMT) |
commit | 1c6924f18bd8fdad63c4f191c00605092c17fa6e (patch) | |
tree | cfa3351ffe9a04b46e2ed226da6a5c00a80b4caa /src/H5Omessage.c | |
parent | 70938cbf28ca91a17d8d975d5b5ebcd44648e1c9 (diff) | |
download | hdf5-1c6924f18bd8fdad63c4f191c00605092c17fa6e.zip hdf5-1c6924f18bd8fdad63c4f191c00605092c17fa6e.tar.gz hdf5-1c6924f18bd8fdad63c4f191c00605092c17fa6e.tar.bz2 |
Refactor H5O code to clean up message allocation, align cache deserialize code
with revise_chunks changes, and remove unused "message locking" code.
Diffstat (limited to 'src/H5Omessage.c')
-rw-r--r-- | src/H5Omessage.c | 173 |
1 files changed, 0 insertions, 173 deletions
diff --git a/src/H5Omessage.c b/src/H5Omessage.c index d42896c..7063ef6 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -2254,176 +2254,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_flush_msgs() */ - -/*------------------------------------------------------------------------- - * Function: H5O_msg_chunkno - * - * Purpose: Queries the object header chunk index for a message. - * - * Return: Success: >=0 value indicating the chunk number for - * the message - * Failure: <0 - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Apr 22 2010 - * - *------------------------------------------------------------------------- - */ -int -H5O_msg_get_chunkno(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) -{ - H5O_t *oh = NULL; /* Object header to use */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - H5O_mesg_t *idx_msg; /* Pointer to message to modify */ - unsigned idx; /* Index of message to modify */ - int ret_value = -1; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - - /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") - - /* Locate message of correct type */ - for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) - if(type == idx_msg->type) - break; - if(idx == oh->nmesgs) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") - - /* Set return value */ - H5_CHECKED_ASSIGN(ret_value, int, idx_msg->chunkno, unsigned); - -done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_msg_get_chunkno() */ - - -/*------------------------------------------------------------------------- - * Function: H5O_msg_lock - * - * Purpose: Locks a message into a particular chunk, preventing it from - * being moved into another chunk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Apr 22 2010 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O_msg_lock(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) -{ - H5O_t *oh = NULL; /* Object header to use */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - H5O_mesg_t *idx_msg; /* Pointer to message to modify */ - unsigned idx; /* Index of message to modify */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - - /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") - - /* Locate message of correct type */ - for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) - if(type == idx_msg->type) - break; - if(idx == oh->nmesgs) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") - - /* Fail if the message is already locked */ - if(idx_msg->locked) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOCK, FAIL, "message already locked") - - /* Make the message locked */ - idx_msg->locked = TRUE; - -done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_msg_lock() */ - - -/*------------------------------------------------------------------------- - * Function: H5O_msg_unlock - * - * Purpose: Unlocks a message, allowing it to be moved into another chunk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Apr 22 2010 - * - *------------------------------------------------------------------------- - */ -herr_t -H5O_msg_unlock(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) -{ - H5O_t *oh = NULL; /* Object header to use */ - const H5O_msg_class_t *type; /* Actual H5O class type for the ID */ - H5O_mesg_t *idx_msg; /* Pointer to message to modify */ - unsigned idx; /* Index of message to modify */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(type_id < NELMTS(H5O_msg_class_g)); - type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - - /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, dxpl_id, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") - - /* Locate message of correct type */ - for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) - if(type == idx_msg->type) - break; - if(idx == oh->nmesgs) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") - - /* Fail if the message is not locked */ - if(!idx_msg->locked) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNLOCK, FAIL, "message not locked") - - /* Make the message unlocked */ - idx_msg->locked = FALSE; - -done: - if(oh && H5O_unprotect(loc, dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_msg_unlock() */ - |