summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c18
-rw-r--r--src/H5D.c46
-rw-r--r--src/H5Doh.c4
-rw-r--r--src/H5F.c4
-rw-r--r--src/H5Fprivate.h2
-rw-r--r--src/H5G.c4
-rw-r--r--src/H5Gbtree2.c2
-rw-r--r--src/H5Gcompact.c6
-rw-r--r--src/H5Gdense.c18
-rw-r--r--src/H5Gdeprec.c4
-rw-r--r--src/H5Glink.c12
-rw-r--r--src/H5Gloc.c2
-rw-r--r--src/H5Gnode.c2
-rw-r--r--src/H5Gobj.c36
-rw-r--r--src/H5Gstab.c20
-rw-r--r--src/H5Gtest.c10
-rw-r--r--src/H5Gtraverse.c8
-rw-r--r--src/H5HFcache.c6
-rw-r--r--src/H5HFhdr.c2
-rw-r--r--src/H5HFtest.c2
-rw-r--r--src/H5L.c6
-rw-r--r--src/H5O.c1061
-rw-r--r--src/H5Oalloc.c6
-rw-r--r--src/H5Oattr.c8
-rw-r--r--src/H5Ocache.c2
-rw-r--r--src/H5Odbg.c2
-rw-r--r--src/H5Odtype.c4
-rw-r--r--src/H5Ofill.c6
-rw-r--r--src/H5Olinfo.c2
-rw-r--r--src/H5Omessage.c1092
-rw-r--r--src/H5Opkg.h26
-rw-r--r--src/H5Opline.c4
-rw-r--r--src/H5Oprivate.h28
-rw-r--r--src/H5Osdspace.c4
-rw-r--r--src/H5Oshared.c14
-rw-r--r--src/H5Pdcpl.c14
-rw-r--r--src/H5S.c10
-rw-r--r--src/H5T.c2
-rw-r--r--src/H5Tcommit.c2
-rw-r--r--src/H5Z.c2
-rwxr-xr-xsrc/Makefile.am2
-rw-r--r--src/Makefile.in5
42 files changed, 1297 insertions, 1213 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 06ab7eb..01ccb95 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -647,9 +647,9 @@ H5A_open(H5G_loc_t *loc, unsigned idx, hid_t dxpl_id)
/* check args */
HDassert(loc);
- /* Read in attribute with H5O_read() */
+ /* Read in attribute with H5O_msg_read() */
H5_CHECK_OVERFLOW(idx,unsigned,int);
- if(NULL == (attr = (H5A_t *)H5O_read(loc->oloc, H5O_ATTR_ID, (int)idx, NULL, dxpl_id)))
+ if(NULL == (attr = (H5A_t *)H5O_msg_read(loc->oloc, H5O_ATTR_ID, (int)idx, NULL, dxpl_id)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from dataset header")
attr->initialized = TRUE;
@@ -828,7 +828,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id)
HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "attribute not found")
/* Modify the attribute data */
- if(H5O_write(&(attr->oloc), H5O_ATTR_ID, idx, 0, H5O_UPDATE_DATA_ONLY|H5O_UPDATE_TIME, attr, dxpl_id) < 0)
+ if(H5O_msg_write(&(attr->oloc), H5O_ATTR_ID, idx, 0, H5O_UPDATE_DATA_ONLY|H5O_UPDATE_TIME, attr, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages")
} /* end if */
@@ -1352,7 +1352,7 @@ H5A_rename(H5O_loc_t *loc, const char *old_name, const char *new_name, hid_t dxp
/* Read in the existing attributes to check for duplicates */
seq = 0;
- while(H5O_read(loc, H5O_ATTR_ID, seq, &found_attr, dxpl_id) != NULL) {
+ while(H5O_msg_read(loc, H5O_ATTR_ID, seq, &found_attr, dxpl_id) != NULL) {
/*
* Compare found attribute name.
*/
@@ -1360,7 +1360,7 @@ H5A_rename(H5O_loc_t *loc, const char *old_name, const char *new_name, hid_t dxp
idx = seq;
break;
}
- if(H5O_reset(H5O_ATTR_ID, &found_attr) < 0)
+ if(H5O_msg_reset(H5O_ATTR_ID, &found_attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info")
seq++;
} /* end while */
@@ -1380,7 +1380,7 @@ H5A_rename(H5O_loc_t *loc, const char *old_name, const char *new_name, hid_t dxp
found_attr.initialized = TRUE;
/* Modify the attribute message */
- if(H5O_write(loc, H5O_ATTR_ID, idx, 0, H5O_UPDATE_TIME, &found_attr, dxpl_id) < 0)
+ if(H5O_msg_write(loc, H5O_ATTR_ID, idx, 0, H5O_UPDATE_TIME, &found_attr, dxpl_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to update attribute header messages")
/* Close the attribute */
@@ -1452,17 +1452,17 @@ H5Aiterate(hid_t loc_id, unsigned *attr_num, H5A_operator_t op, void *op_data)
if(idx < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified")
if(idx < H5O_count(loc.oloc, H5O_ATTR_ID, H5AC_dxpl_id)) {
- while(H5O_read(loc.oloc, H5O_ATTR_ID, idx++, &found_attr, H5AC_dxpl_id) != NULL) {
+ while(H5O_msg_read(loc.oloc, H5O_ATTR_ID, idx++, &found_attr, H5AC_dxpl_id) != NULL) {
/*
* Compare found attribute name to new attribute name reject
* creation if names are the same.
*/
if((ret_value = (op)(loc_id,found_attr.name,op_data)) != 0) {
- if(H5O_reset(H5O_ATTR_ID, &found_attr) < 0)
+ if(H5O_msg_reset(H5O_ATTR_ID, &found_attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info")
break;
} /* end if */
- if(H5O_reset(H5O_ATTR_ID, &found_attr) < 0)
+ if(H5O_msg_reset(H5O_ATTR_ID, &found_attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't release attribute info")
} /* end while */
H5E_clear_stack(NULL);
diff --git a/src/H5D.c b/src/H5D.c
index 76b7a9c..dd8bc6e 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1268,7 +1268,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
} /* end if */
if(fill_status == H5D_FILL_VALUE_DEFAULT || fill_status == H5D_FILL_VALUE_USER_DEFINED) {
- if(H5O_copy(H5O_FILL_ID, fill_prop, &fill) == NULL)
+ if(H5O_msg_copy(H5O_FILL_ID, fill_prop, &fill) == NULL)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL, "unable to copy fill value")
if(fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(&fill, type, dxpl_id) < 0)
@@ -1302,22 +1302,22 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to protect dataset object header")
/* Write new fill value message */
- if(H5O_append(file, dxpl_id, oh, H5O_FILL_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, &fill, &oh_flags) < 0)
+ if(H5O_msg_append(file, dxpl_id, oh, H5O_FILL_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, &fill, &oh_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message")
/* If there is valid information for the old fill value struct, update it */
/* (only if we aren't trying to write the latest version of the file format) */
if(fill.buf && !use_latest_format) {
/* Clear any previous values */
- if(H5O_reset(H5O_FILL_ID, fill_prop)<0)
+ if(H5O_msg_reset(H5O_FILL_ID, fill_prop)<0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release fill info")
/* Copy new fill value information to old fill value struct */
- if(H5O_copy(H5O_FILL_ID, &fill, fill_prop) == NULL)
+ if(H5O_msg_copy(H5O_FILL_ID, &fill, fill_prop) == NULL)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT,FAIL,"unable to copy fill value")
/* Write old fill value */
- if(fill_prop->buf && H5O_append(file, dxpl_id, oh, H5O_FILL_ID, H5O_MSG_FLAG_CONSTANT, 0, fill_prop, &oh_flags) < 0)
+ if(fill_prop->buf && H5O_msg_append(file, dxpl_id, oh, H5O_FILL_ID, H5O_MSG_FLAG_CONSTANT, 0, fill_prop, &oh_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message")
/* Update dataset creation property */
@@ -1327,7 +1327,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
} /* end if */
/* Update the type and space header messages */
- if(H5O_append(file, dxpl_id, oh, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_SHARED, 0, type, &oh_flags) < 0 ||
+ if(H5O_msg_append(file, dxpl_id, oh, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_SHARED, 0, type, &oh_flags) < 0 ||
H5S_append(file, dxpl_id, oh, dset->shared->space, &oh_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update type or space header messages")
@@ -1338,7 +1338,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve pipeline filter")
- if(pline.nused > 0 && H5O_append(file, dxpl_id, oh, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, &pline, &oh_flags) < 0)
+ if(pline.nused > 0 && H5O_msg_append(file, dxpl_id, oh, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, &pline, &oh_flags) < 0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message")
} /* end if */
@@ -1374,14 +1374,14 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
efl->slot[u].name_offset = offset;
} /* end for */
- if(H5O_append(file, dxpl_id, oh, H5O_EFL_ID, H5O_MSG_FLAG_CONSTANT, 0, efl, &oh_flags) < 0)
+ if(H5O_msg_append(file, dxpl_id, oh, H5O_EFL_ID, H5O_MSG_FLAG_CONSTANT, 0, efl, &oh_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message")
} /* end if */
/* Create layout message */
/* (Don't make layout message constant unless allocation time is early, since space may not be allocated) */
- /* Note: this is relying on H5D_alloc_storage not calling H5O_write during dataset creation */
- if(H5O_append(file, dxpl_id, oh, H5O_LAYOUT_ID, ((alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type) ? H5O_MSG_FLAG_CONSTANT : 0), 0, layout, &oh_flags) < 0)
+ /* Note: this is relying on H5D_alloc_storage not calling H5O_msg_write during dataset creation */
+ if(H5O_msg_append(file, dxpl_id, oh, H5O_LAYOUT_ID, ((alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type) ? H5O_MSG_FLAG_CONSTANT : 0), 0, layout, &oh_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout")
#ifdef H5O_ENABLE_BOGUS
@@ -1398,7 +1398,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
done:
/* Release fill value information */
- if(H5O_reset(H5O_FILL_ID, &fill) < 0)
+ if(H5O_msg_reset(H5O_FILL_ID, &fill) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release fill-value info")
/* Release pointer to object header itself */
@@ -1891,7 +1891,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open")
/* Get the type and space */
- if(NULL == (dataset->shared->type = H5O_read(&(dataset->oloc), H5O_DTYPE_ID, 0, NULL, dxpl_id)))
+ if(NULL == (dataset->shared->type = H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, 0, NULL, dxpl_id)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load type info from dataset header")
/* Get a datatype ID for the dataset's datatype */
if((dataset->shared->type_id = H5I_register(H5I_DATATYPE, dataset->shared->type))<0)
@@ -1905,7 +1905,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list")
/* Get the optional filters message */
- if(NULL == H5O_read(&(dataset->oloc), H5O_PLINE_ID, 0, &pline, dxpl_id)) {
+ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_PLINE_ID, 0, &pline, dxpl_id)) {
H5E_clear_stack(NULL);
HDmemset(&pline, 0, sizeof(pline));
} /* end if */
@@ -1918,7 +1918,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
* values are copied to the dataset create plist so the user can query
* them.
*/
- if(NULL == H5O_read(&(dataset->oloc), H5O_LAYOUT_ID, 0, &(dataset->shared->layout), dxpl_id))
+ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, 0, &(dataset->shared->layout), dxpl_id))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message")
if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout.type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout")
@@ -1986,11 +1986,11 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
/* Retrieve & release the previous fill-value settings */
if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't get fill value")
- if(H5O_reset(H5O_FILL_ID, fill_prop)<0)
+ if(H5O_msg_reset(H5O_FILL_ID, fill_prop)<0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release fill info")
/* Get the new fill value message */
- if(NULL == H5O_read(&(dataset->oloc), H5O_FILL_NEW_ID, 0, &fill, dxpl_id)) {
+ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_NEW_ID, 0, &fill, dxpl_id)) {
H5E_clear_stack(NULL);
HDmemset(&fill, 0, sizeof(fill));
@@ -2016,12 +2016,12 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
fill.fill_time = H5D_FILL_TIME_IFSET;
} /* end if */
if(fill.fill_defined) {
- if(NULL==H5O_copy(H5O_FILL_ID, &fill, fill_prop))
+ if(NULL==H5O_msg_copy(H5O_FILL_ID, &fill, fill_prop))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't copy fill value")
} else {
/* For compatibility with v1.4. Retrieve the old fill value message.
* If size is 0, make it -1 for undefined. */
- if(NULL == H5O_read(&(dataset->oloc), H5O_FILL_ID, 0, fill_prop, dxpl_id)) {
+ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_ID, 0, fill_prop, dxpl_id)) {
H5E_clear_stack(NULL);
HDmemset(fill_prop, 0, sizeof(H5O_fill_t));
} /* end if */
@@ -2053,7 +2053,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
if((dataset->shared->layout.type==H5D_CONTIGUOUS && !H5F_addr_defined(dataset->shared->layout.u.contig.addr))
|| (dataset->shared->layout.type==H5D_CHUNKED && !H5F_addr_defined(dataset->shared->layout.u.chunk.addr))) {
HDmemset(&dataset->shared->efl,0,sizeof(H5O_efl_t));
- if(NULL != H5O_read(&(dataset->oloc), H5O_EFL_ID, 0, &dataset->shared->efl, dxpl_id)) {
+ if(NULL != H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, 0, &dataset->shared->efl, dxpl_id)) {
if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->shared->efl) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set external file list")
@@ -2082,7 +2082,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
done:
/* Release fill value information */
- if(H5O_reset(H5O_FILL_ID, &fill) < 0)
+ if(H5O_msg_reset(H5O_FILL_ID, &fill) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release fill-value info")
if(ret_value < 0) {
@@ -2170,7 +2170,7 @@ H5D_close(H5D_t *dataset)
case H5D_COMPACT:
/* Update header message of layout for compact dataset. */
if(dataset->shared->layout.u.compact.dirty) {
- if(H5O_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), H5AC_dxpl_id) < 0)
+ if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), H5AC_dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to update layout message")
dataset->shared->layout.u.compact.dirty = FALSE;
} /* end if */
@@ -2563,7 +2563,7 @@ H5D_alloc_storage(H5F_t *f, hid_t dxpl_id, H5D_t *dset/*in,out*/, H5D_time_alloc
* set the address. (this is improves forward compatibility).
*/
if(time_alloc != H5D_ALLOC_CREATE && addr_set)
- if(H5O_write(&(dset->oloc), H5O_LAYOUT_ID, 0, H5O_MSG_FLAG_CONSTANT, update_time, &(dset->shared->layout), dxpl_id) < 0)
+ if(H5O_msg_write(&(dset->oloc), H5O_LAYOUT_ID, 0, H5O_MSG_FLAG_CONSTANT, update_time, &(dset->shared->layout), dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout message")
} /* end if */
@@ -3468,7 +3468,7 @@ H5D_flush(const H5F_t *f, hid_t dxpl_id, unsigned flags)
case H5D_COMPACT:
if(dataset->shared->layout.u.compact.dirty) {
- if(H5O_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), dxpl_id)<0)
+ if(H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, 0, H5O_UPDATE_TIME, &(dataset->shared->layout), dxpl_id)<0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message")
dataset->shared->layout.u.compact.dirty = FALSE;
} /* end if */
diff --git a/src/H5Doh.c b/src/H5Doh.c
index 52ac017..e25a0ae 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -132,7 +132,7 @@ H5O_dset_free_copy_file_udata(void *_udata)
/* Release copy of dataset's dataspace extent, if it was set */
if(udata->src_space_extent)
- H5O_free(H5O_SDSPACE_ID, udata->src_space_extent);
+ H5O_msg_free(H5O_SDSPACE_ID, udata->src_space_extent);
/* Release copy of dataset's datatype, if it was set */
if(udata->src_dtype)
@@ -140,7 +140,7 @@ H5O_dset_free_copy_file_udata(void *_udata)
/* Release copy of dataset's filter pipeline, if it was set */
if (udata->src_pline)
- H5O_free(H5O_PLINE_ID, udata->src_pline);
+ H5O_msg_free(H5O_PLINE_ID, udata->src_pline);
/* Release space for 'copy file' user data */
H5FL_FREE(H5D_copy_file_ud_t, udata);
diff --git a/src/H5F.c b/src/H5F.c
index 76f98f3..27256dd 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -2333,10 +2333,10 @@ H5F_get_intent(const H5F_t *f)
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_intent)
- assert(f);
+ HDassert(f);
FUNC_LEAVE_NOAPI(f->intent)
-}
+} /* end H5F_get_intent() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index f28c8c1..c5d782d 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -263,6 +263,7 @@ typedef struct H5F_t H5F_t;
#define H5F_SIEVE_BUF_SIZE(F) ((F)->shared->sieve_buf_size)
#define H5F_GC_REF(F) ((F)->shared->gc_ref)
#define H5F_USE_LATEST_FORMAT(F) ((F)->shared->latest_format)
+#define H5F_INTENT(F) ((F)->intent)
#else /* H5F_PACKAGE */
#define H5F_FCPL(F) (H5F_get_fcpl(F))
#define H5F_SIZEOF_ADDR(F) (H5F_sizeof_addr(F))
@@ -278,6 +279,7 @@ typedef struct H5F_t H5F_t;
#define H5F_SIEVE_BUF_SIZE(F) (H5F_sieve_buf_size(F))
#define H5F_GC_REF(F) (H5F_gc_ref(F))
#define H5F_USE_LATEST_FORMAT(F) (H5F_use_latest_format(F))
+#define H5F_INTENT(F) (H5F_get_intent(F))
#endif /* H5F_PACKAGE */
diff --git a/src/H5G.c b/src/H5G.c
index c9537ec..3f1cc08 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -545,7 +545,7 @@ H5Gget_create_plist(hid_t group_id)
H5O_ginfo_t ginfo; /* Group info message */
/* Read the group info */
- if(NULL == H5O_read(&(grp->oloc), H5O_GINFO_ID, 0, &ginfo, H5AC_ind_dxpl_id))
+ if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, 0, &ginfo, H5AC_ind_dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
/* Set the group info for the property list */
@@ -560,7 +560,7 @@ H5Gget_create_plist(hid_t group_id)
H5O_linfo_t linfo; /* Link info message */
/* Read the link info */
- if(NULL == H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_ind_dxpl_id))
+ if(NULL == H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_ind_dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
/* Set the link info for the property list */
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c
index 8b0aa11..2812513 100644
--- a/src/H5Gbtree2.c
+++ b/src/H5Gbtree2.c
@@ -176,7 +176,7 @@ H5G_dense_fh_name_cmp(const void *obj, size_t UNUSED obj_len, void *_udata)
} /* end if */
/* Release the space allocated for the link */
- H5O_free(H5O_LINK_ID, lnk);
+ H5O_msg_free(H5O_LINK_ID, lnk);
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c
index e321155..5229a9a 100644
--- a/src/H5Gcompact.c
+++ b/src/H5Gcompact.c
@@ -96,7 +96,7 @@ H5G_compact_build_table_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
HDassert(udata->curr_lnk < udata->ltable->nlinks);
/* Copy link message into table */
- if(NULL == H5O_copy(H5O_LINK_ID, lnk, &(udata->ltable->lnks[udata->curr_lnk])))
+ if(NULL == H5O_msg_copy(H5O_LINK_ID, lnk, &(udata->ltable->lnks[udata->curr_lnk])))
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message")
/* Increment current link entry to operate on */
@@ -530,7 +530,7 @@ H5G_compact_lookup_cb(const void *_mesg, unsigned UNUSED idx, void *_udata)
if(HDstrcmp(lnk->name, udata->name) == 0) {
if(udata->lnk) {
/* Copy link information */
- if(NULL == H5O_copy(H5O_LINK_ID, lnk, udata->lnk))
+ if(NULL == H5O_msg_copy(H5O_LINK_ID, lnk, udata->lnk))
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message")
} /* end if */
@@ -627,7 +627,7 @@ H5G_compact_lookup_by_idx(H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *lin
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index out of bound")
/* Copy link information */
- if(NULL == H5O_copy(H5O_LINK_ID, &ltable.lnks[n], lnk))
+ if(NULL == H5O_msg_copy(H5O_LINK_ID, &ltable.lnks[n], lnk))
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message")
done:
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index 7e93605..214f5fc 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -486,7 +486,7 @@ H5G_dense_lookup_cb(const void *_lnk, void *_user_lnk)
/* Check if we want the link information */
if(user_lnk) {
/* Copy link information */
- if(H5O_copy(H5O_LINK_ID, lnk, user_lnk) == NULL)
+ if(H5O_msg_copy(H5O_LINK_ID, lnk, user_lnk) == NULL)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message")
} /* end if */
@@ -581,13 +581,13 @@ H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_uda
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
/* Copy link information */
- if(NULL == H5O_copy(H5O_LINK_ID, tmp_lnk, udata->lnk))
+ if(NULL == H5O_msg_copy(H5O_LINK_ID, tmp_lnk, udata->lnk))
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message")
done:
/* Release the space allocated for the link */
if(tmp_lnk)
- H5O_free(H5O_LINK_ID, tmp_lnk);
+ H5O_msg_free(H5O_LINK_ID, tmp_lnk);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_dense_lookup_by_idx_fh_cb() */
@@ -718,7 +718,7 @@ H5G_dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
/* Copy link information */
- if(NULL == H5O_copy(H5O_LINK_ID, &ltable.lnks[n], lnk))
+ if(NULL == H5O_msg_copy(H5O_LINK_ID, &ltable.lnks[n], lnk))
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message")
} /* end else */
@@ -762,7 +762,7 @@ H5G_dense_build_table_cb(const H5O_link_t *lnk, void *_udata)
HDassert(udata->curr_lnk < udata->ltable->nlinks);
/* Copy link information */
- if(H5O_copy(H5O_LINK_ID, lnk, &(udata->ltable->lnks[udata->curr_lnk])) == NULL)
+ if(H5O_msg_copy(H5O_LINK_ID, lnk, &(udata->ltable->lnks[udata->curr_lnk])) == NULL)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message")
/* Increment number of links stored */
@@ -941,7 +941,7 @@ H5G_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)
} /* end switch */
/* Release the space allocated for the link */
- H5O_free(H5O_LINK_ID, fh_udata.lnk);
+ H5O_msg_free(H5O_LINK_ID, fh_udata.lnk);
} /* end else */
/* Increment the number of entries passed through */
@@ -1072,7 +1072,7 @@ H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t UNUSED obj_len, void *_u
} /* end if */
/* Release the space allocated for the link */
- H5O_free(H5O_LINK_ID, lnk);
+ H5O_msg_free(H5O_LINK_ID, lnk);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1361,7 +1361,7 @@ H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link")
/* Release the space allocated for the link */
- H5O_free(H5O_LINK_ID, lnk);
+ H5O_msg_free(H5O_LINK_ID, lnk);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1608,7 +1608,7 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link")
/* Release the space allocated for the link */
- H5O_free(H5O_LINK_ID, fh_udata.lnk);
+ H5O_msg_free(H5O_LINK_ID, fh_udata.lnk);
/* Remove record from fractal heap */
if(H5HF_remove(bt2_udata->fheap, bt2_udata->dxpl_id, heap_id) < 0)
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 5163748..4d665ab 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -670,7 +670,7 @@ H5G_get_comment(H5G_loc_t *loc, const char *name, size_t bufsize, char *buf, hid
/* Get the message */
comment.s = NULL;
- if(NULL == H5O_read(obj_loc.oloc, H5O_NAME_ID, 0, &comment, dxpl_id)) {
+ if(NULL == H5O_msg_read(obj_loc.oloc, H5O_NAME_ID, 0, &comment, dxpl_id)) {
if(buf && bufsize > 0)
buf[0] = '\0';
ret_value = 0;
@@ -678,7 +678,7 @@ H5G_get_comment(H5G_loc_t *loc, const char *name, size_t bufsize, char *buf, hid
if(buf && bufsize)
HDstrncpy(buf, comment.s, bufsize);
ret_value = (int)HDstrlen(comment.s);
- H5O_reset(H5O_NAME_ID, &comment);
+ H5O_msg_reset(H5O_NAME_ID, &comment);
} /* end else */
done:
diff --git a/src/H5Glink.c b/src/H5Glink.c
index 23e5f4b..3aa7eb4 100644
--- a/src/H5Glink.c
+++ b/src/H5Glink.c
@@ -500,7 +500,7 @@ H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk,
H5G_name_t grp_path; /* Path for group holding soft link */
/* Make a temporary copy, so that it will not change the info in the cache */
- if(NULL == H5O_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk))
+ if(NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk))
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy message")
/* Set up group location for soft link to start in */
@@ -521,12 +521,12 @@ H5G_link_copy_file(H5F_t *dst_file, hid_t dxpl_id, const H5O_link_t *_src_lnk,
H5E_clear_stack(NULL);
/* Release any information copied for temporary src link */
- H5O_reset(H5O_LINK_ID, &tmp_src_lnk);
+ H5O_msg_reset(H5O_LINK_ID, &tmp_src_lnk);
} /* end else */
} /* end if */
/* Copy src link information to dst link information */
- if(NULL == H5O_copy(H5O_LINK_ID, src_lnk, dst_lnk))
+ if(NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, dst_lnk))
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy message")
dst_lnk_init = TRUE;
@@ -557,11 +557,11 @@ done:
/* Check if we used a temporary src link */
if(src_lnk != _src_lnk) {
HDassert(src_lnk == &tmp_src_lnk);
- H5O_reset(H5O_LINK_ID, &tmp_src_lnk);
+ H5O_msg_reset(H5O_LINK_ID, &tmp_src_lnk);
} /* end if */
if(ret_value < 0)
if(dst_lnk_init)
- H5O_reset(H5O_LINK_ID, dst_lnk);
+ H5O_msg_reset(H5O_LINK_ID, dst_lnk);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_link_copy_file() */
@@ -713,7 +713,7 @@ H5G_link_release_table(H5G_link_table_t *ltable)
if(ltable->nlinks > 0) {
/* Free link message information */
for(u = 0; u < ltable->nlinks; u++)
- if(H5O_reset(H5O_LINK_ID, &(ltable->lnks[u])) < 0)
+ if(H5O_msg_reset(H5O_LINK_ID, &(ltable->lnks[u])) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link message")
/* Free table of links */
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index bdd41a5..8ba4c3e 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -454,7 +454,7 @@ H5G_loc_find_by_idx_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
done:
/* Reset the link information, if we have a copy */
if(lnk_copied)
- H5O_reset(H5O_LINK_ID, &fnd_lnk);
+ H5O_msg_reset(H5O_LINK_ID, &fnd_lnk);
/* Release the object location if we failed after copying it */
if(ret_value < 0 && obj_loc_valid)
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 714661c..0c23524 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -1520,7 +1520,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad
ret_value = (udata->lnk_op->u.lib_op)(&lnk, udata->op_data);
/* Release memory for link object */
- if(H5O_reset(H5O_LINK_ID, &lnk) < 0)
+ if(H5O_msg_reset(H5O_LINK_ID, &lnk) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, H5_ITER_ERROR, "unable to release link message")
}
} /* end switch */
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 8a223a7..c1d1fd3 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -413,14 +413,14 @@ H5G_obj_insert(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
/* Check if we have information about the number of objects in this group */
/* (by attempting to get the link info message for this group) */
- if(H5O_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5O_msg_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
size_t link_msg_size; /* Size of new link message in the file */
/* Using the new format for groups */
use_old_format = FALSE;
/* Get the group info */
- if(NULL == H5O_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
+ if(NULL == H5O_msg_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
/* Check for tracking creation order on this group's links */
@@ -541,7 +541,7 @@ H5G_obj_insert(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
/* Increment the number of objects in this group */
if(!use_old_format) {
linfo.nlinks++;
- if(H5O_write(grp_oloc, H5O_LINFO_ID, 0, 0, H5O_UPDATE_TIME, &linfo, dxpl_id) < 0)
+ if(H5O_msg_write(grp_oloc, H5O_LINFO_ID, 0, 0, H5O_UPDATE_TIME, &linfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message")
} /* end if */
@@ -606,7 +606,7 @@ H5G_obj_iterate(hid_t loc_id, const char *group_name,
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "bad group ID")
/* Attempt to get the link info for this group */
- if(H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
/* Check for going out of bounds */
if(skip > 0 && (size_t)skip >= linfo.nlinks)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
@@ -616,7 +616,7 @@ H5G_obj_iterate(hid_t loc_id, const char *group_name,
H5O_ginfo_t ginfo; /* Group info message */
/* Get group info message, to see if creation order is tracked for links in this group */
- if(NULL == H5O_read(&(grp->oloc), H5O_GINFO_ID, 0, &ginfo, dxpl_id))
+ if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, 0, &ginfo, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info message for group")
/* Check if creation order is tracked */
@@ -682,7 +682,7 @@ H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id)
HDassert(grp_info);
/* Attempt to get the link info for this group */
- if(H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5O_msg_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
/* Retrieve the information about the links */
grp_info->nlinks = linfo.nlinks;
grp_info->min_corder = linfo.min_corder;
@@ -740,13 +740,13 @@ H5G_obj_get_name_by_idx(H5O_loc_t *oloc, H5L_index_t idx_type,
HDassert(oloc && oloc->file);
/* Attempt to get the link info for this group */
- if(H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5O_msg_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
/* Check for creation order tracking, if creation order index lookup requested */
if(idx_type == H5L_INDEX_CRT_ORDER) {
H5O_ginfo_t ginfo; /* Group info message */
/* Get group info message, to see if creation order is tracked for links in this group */
- if(NULL == H5O_read(oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
+ if(NULL == H5O_msg_read(oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info message for group")
/* Check if creation order is tracked */
@@ -811,7 +811,7 @@ H5G_obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
HDassert(oloc);
/* Attempt to get the link info for this group */
- if(H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5O_msg_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
if(H5F_addr_defined(linfo.link_fheap_addr)) {
/* Get the object's name from the dense link storage */
if((ret_value = H5G_dense_get_type_by_idx(oloc->file, dxpl_id, &linfo, idx)) < 0)
@@ -881,7 +881,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
H5O_ginfo_t ginfo; /* Group info message */
/* Get the group info */
- if(NULL == H5O_read(oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
+ if(NULL == H5O_msg_read(oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info")
/* Check if we should switch from dense storage back to link messages */
@@ -915,7 +915,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
/* Insert link messages into group */
for(u = 0; u < linfo->nlinks; u++)
- if(H5O_append(oloc->file, dxpl_id, oh, H5O_LINK_ID, 0, H5O_UPDATE_TIME, &(ltable.lnks[u]), &oh_flags) < 0) {
+ if(H5O_msg_append(oloc->file, dxpl_id, oh, H5O_LINK_ID, 0, H5O_UPDATE_TIME, &(ltable.lnks[u]), &oh_flags) < 0) {
/* Release object header */
if(H5O_unprotect(oloc, oh, dxpl_id, oh_flags) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to unprotect dataset object header")
@@ -940,7 +940,7 @@ H5G_obj_remove_update_linfo(H5O_loc_t *oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
} /* end if */
/* Update link info in the object header */
- if(H5O_write(oloc, H5O_LINFO_ID, 0, 0, H5O_UPDATE_TIME, linfo, dxpl_id) < 0)
+ if(H5O_msg_write(oloc, H5O_LINFO_ID, 0, 0, H5O_UPDATE_TIME, linfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message")
done:
@@ -975,7 +975,7 @@ H5G_obj_remove(H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name, h
HDassert(name && *name);
/* Attempt to get the link info for this group */
- if(H5O_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5O_msg_read(oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
/* Using the new format for groups */
use_old_format = FALSE;
@@ -1041,13 +1041,13 @@ H5G_obj_remove_by_idx(H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r,
HDassert(grp_oloc && grp_oloc->file);
/* Attempt to get the link info for this group */
- if(H5O_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5O_msg_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
/* Check for creation order tracking, if creation order index lookup requested */
if(idx_type == H5L_INDEX_CRT_ORDER) {
H5O_ginfo_t ginfo; /* Group info message */
/* Get group info message, to see if creation order is tracked for links in this group */
- if(NULL == H5O_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
+ if(NULL == H5O_msg_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info message for group")
/* Check if creation order is tracked */
@@ -1124,7 +1124,7 @@ H5G_obj_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk,
HDassert(name && *name);
/* Attempt to get the link info message for this group */
- if(H5O_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5O_msg_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
/* Check for dense link storage */
if(H5F_addr_defined(linfo.link_fheap_addr)) {
/* Get the object's info from the dense link storage */
@@ -1178,13 +1178,13 @@ H5G_obj_lookup_by_idx(H5O_loc_t *grp_oloc, H5L_index_t idx_type,
HDassert(grp_oloc && grp_oloc->file);
/* Attempt to get the link info message for this group */
- if(H5O_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
+ if(H5O_msg_read(grp_oloc, H5O_LINFO_ID, 0, &linfo, dxpl_id)) {
/* Check for creation order tracking, if creation order index lookup requested */
if(idx_type == H5L_INDEX_CRT_ORDER) {
H5O_ginfo_t ginfo; /* Group info message */
/* Get group info message, to see if creation order is tracked for links in this group */
- if(NULL == H5O_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
+ if(NULL == H5O_msg_read(grp_oloc, H5O_GINFO_ID, 0, &ginfo, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info message for group")
/* Check if creation order is tracked */
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index 2e41dc5..3310024 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -268,7 +268,7 @@ H5G_stab_insert(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
HDassert(obj_lnk);
/* Retrieve symbol table message */
- if(NULL == H5O_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
+ if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table")
if(H5G_stab_insert_real(grp_oloc->file, &stab, name, obj_lnk, dxpl_id) < 0)
@@ -305,7 +305,7 @@ H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r,
HDassert(name && *name);
/* Read in symbol table message */
- if(NULL == H5O_read(loc, H5O_STAB_ID, 0, &stab, dxpl_id))
+ if(NULL == H5O_msg_read(loc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table")
/* Initialize data to pass through B-tree */
@@ -355,7 +355,7 @@ H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_
lnk_copied = TRUE;
/* Read in symbol table message */
- if(NULL == H5O_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
+ if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table")
/* Initialize data to pass through B-tree */
@@ -371,7 +371,7 @@ H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_
done:
/* Reset the link information, if we have a copy */
if(lnk_copied)
- H5O_reset(H5O_LINK_ID, &obj_lnk);
+ H5O_msg_reset(H5O_LINK_ID, &obj_lnk);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_stab_remove() */
@@ -450,7 +450,7 @@ H5G_stab_iterate(H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order,
HDassert(lnk_op && lnk_op->u.old_op);
/* Get the B-tree info */
- if(NULL == H5O_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
+ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
/* Check on iteration order */
@@ -539,7 +539,7 @@ H5G_stab_count(H5O_loc_t *oloc, hsize_t *num_objs, hid_t dxpl_id)
*num_objs = 0;
/* Get the B-tree info */
- if(NULL == H5O_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
+ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
/* Iterate over the group members */
@@ -627,7 +627,7 @@ H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n,
HDassert(oloc);
/* Get the B-tree & local heap info */
- if(NULL == H5O_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
+ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
/* Remap index for decreasing iteration order */
@@ -761,7 +761,7 @@ H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, hid_t dxpl_id)
HDassert(oloc);
/* Get the B-tree & local heap info */
- if(NULL == H5O_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
+ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5G_UNKNOWN, "unable to determine local heap address")
/* Set iteration information */
@@ -859,7 +859,7 @@ H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk,
udata.lnk = lnk;
/* Set up the user data for actual B-tree find operation */
- if(NULL == H5O_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
+ if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't read message")
bt_udata.common.name = name;
bt_udata.common.heap_addr = stab.heap_addr;
@@ -956,7 +956,7 @@ H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n,
HDassert(lnk);
/* Get the B-tree & local heap info */
- if(NULL == H5O_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
+ if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, 0, &stab, dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address")
/* Remap index for decreasing iteration order */
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index f84f30b..a179ea8 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -132,7 +132,7 @@ H5G_is_empty_test(hid_t gid)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found")
/* Get the link info */
- if(NULL == H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
+ if(NULL == H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
/* Check for 'dense' link storage file addresses being defined */
@@ -166,7 +166,7 @@ H5G_is_empty_test(hid_t gid)
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and group info messages found")
/* Get the B-tree & local heap info */
- if(NULL == H5O_read(&(grp->oloc), H5O_STAB_ID, 0, &stab, H5AC_dxpl_id))
+ if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, 0, &stab, H5AC_dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol table message")
/* Get the count of links in the group */
@@ -342,7 +342,7 @@ H5G_is_new_dense_test(hid_t gid)
H5O_linfo_t linfo; /* Link info message */
/* Get the link info */
- if(NULL == H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
+ if(NULL == H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
/* Check for 'dense' link storage file addresses being defined */
@@ -392,7 +392,7 @@ H5G_new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* Get the link info */
- if(NULL == H5O_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
+ if(NULL == H5O_msg_read(&(grp->oloc), H5O_LINFO_ID, 0, &linfo, H5AC_dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info")
/* Check for 'dense' link storage file addresses being defined */
@@ -452,7 +452,7 @@ H5G_lheap_size_test(hid_t gid, size_t *lheap_size)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group")
/* Make certain the group has a symbol table message */
- if(NULL == H5O_read(&(grp->oloc), H5O_STAB_ID, 0, &stab, H5AC_dxpl_id))
+ if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, 0, &stab, H5AC_dxpl_id))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message")
/* Check the size of the local heap for the group */
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 8047eb6..ad39402 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -638,7 +638,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* If there's valid information in the link, reset it */
if(link_valid) {
- H5O_reset(H5O_LINK_ID, &lnk);
+ H5O_msg_reset(H5O_LINK_ID, &lnk);
link_valid = FALSE;
} /* end if */
@@ -700,7 +700,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* Get the group info for parent group */
/* (OK if not found) */
- if(NULL == H5O_read(grp_loc.oloc, H5O_GINFO_ID, 0, &par_ginfo, dxpl_id)) {
+ if(NULL == H5O_msg_read(grp_loc.oloc, H5O_GINFO_ID, 0, &par_ginfo, dxpl_id)) {
/* Clear error stack from not finding the group info message */
H5E_clear_stack(NULL);
@@ -712,7 +712,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target,
/* Get the link info for parent group */
/* (OK if not found) */
- if(NULL == H5O_read(grp_loc.oloc, H5O_LINFO_ID, 0, &par_linfo, dxpl_id)) {
+ if(NULL == H5O_msg_read(grp_loc.oloc, H5O_LINFO_ID, 0, &par_linfo, dxpl_id)) {
/* Clear error stack from not finding the link info message */
H5E_clear_stack(NULL);
@@ -791,7 +791,7 @@ done:
/* If there's valid information in the link, reset it */
if(link_valid)
- H5O_reset(H5O_LINK_ID, &lnk);
+ H5O_msg_reset(H5O_LINK_ID, &lnk);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_traverse_real() */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 8661af7..e3c07c4 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -379,11 +379,11 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
p += hdr->filter_len;
/* Copy the information into the header's I/O pipeline structure */
- if(NULL == H5O_copy(H5O_PLINE_ID, pline, &(hdr->pline)))
+ if(NULL == H5O_msg_copy(H5O_PLINE_ID, pline, &(hdr->pline)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, NULL, "can't copy I/O filter pipeline")
/* Release the space allocated for the I/O pipeline filters */
- H5O_free(H5O_PLINE_ID, pline);
+ H5O_msg_free(H5O_PLINE_ID, pline);
} /* end if */
else
/* Set the heap header's size */
@@ -589,7 +589,7 @@ H5HF_cache_hdr_dest(H5F_t UNUSED *f, H5HF_hdr_t *hdr)
/* Release any I/O pipeline filter information */
if(hdr->pline.nused)
- H5O_reset(H5O_PLINE_ID, &(hdr->pline));
+ H5O_msg_reset(H5O_PLINE_ID, &(hdr->pline));
/* Free the shared info itself */
H5FL_FREE(H5HF_hdr_t, hdr);
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index ab9d7bc..8bcea64 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -420,7 +420,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
*/
if(cparam->pline.nused > 0) {
/* Copy the I/O filter pipeline from the creation parameters to the header */
- if(NULL == H5O_copy(H5O_PLINE_ID, &(cparam->pline), &(hdr->pline)))
+ if(NULL == H5O_msg_copy(H5O_PLINE_ID, &(cparam->pline), &(hdr->pline)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, HADDR_UNDEF, "can't copy I/O filter pipeline")
/* Compute the I/O filters' encoded size */
diff --git a/src/H5HFtest.c b/src/H5HFtest.c
index d7f6f5e..da78fb8 100644
--- a/src/H5HFtest.c
+++ b/src/H5HFtest.c
@@ -101,7 +101,7 @@ H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam)
cparam->id_len = fh->hdr->id_len;
cparam->max_man_size = fh->hdr->max_man_size;
HDmemcpy(&(cparam->managed), &(fh->hdr->man_dtable.cparam), sizeof(H5HF_dtable_cparam_t));
- H5O_copy(H5O_PLINE_ID, &(fh->hdr->pline), &(cparam->pline));
+ H5O_msg_copy(H5O_PLINE_ID, &(fh->hdr->pline), &(cparam->pline));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5HF_get_cparam_test() */
diff --git a/src/H5L.c b/src/H5L.c
index f3cebdc..1296c4d 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -1958,7 +1958,7 @@ H5L_get_val_by_idx_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
done:
/* Reset the link information, if we have a copy */
if(lnk_copied)
- H5O_reset(H5O_LINK_ID, &fnd_lnk);
+ H5O_msg_reset(H5O_LINK_ID, &fnd_lnk);
/* Indicate that this callback didn't take ownership of the group *
* location for the object */
@@ -2364,7 +2364,7 @@ H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk,
} /* end switch */
/* Set up user data for move_dest_cb */
- if((udata_out.lnk = H5O_copy(H5O_LINK_ID, lnk, NULL)) == NULL)
+ if((udata_out.lnk = H5O_msg_copy(H5O_LINK_ID, lnk, NULL)) == NULL)
HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved")
/* In this special case, the link's name is going to be replaced at its
@@ -2639,7 +2639,7 @@ H5L_get_info_by_idx_cb(H5G_loc_t UNUSED *grp_loc/*in*/, const char UNUSED *name,
done:
/* Reset the link information, if we have a copy */
if(lnk_copied)
- H5O_reset(H5O_LINK_ID, &fnd_lnk);
+ H5O_msg_reset(H5O_LINK_ID, &fnd_lnk);
/* Indicate that this callback didn't take ownership of the group *
* location for the object */
diff --git a/src/H5O.c b/src/H5O.c
index 00fc201..e57f4c0 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -35,7 +35,7 @@
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
#include "H5FLprivate.h" /* Free lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MFprivate.h" /* File memory management */
@@ -47,24 +47,6 @@
/* Local Macros */
/****************/
-/* Load native information for a message, if it's not already present */
-/* (Only works for messages with decode callback) */
-#define LOAD_NATIVE(F, DXPL, MSG, ERR) \
- if(NULL == (MSG)->native) { \
- const H5O_msg_class_t *decode_type; \
- \
- /* Check for shared message */ \
- if((MSG)->flags & H5O_MSG_FLAG_SHARED) \
- decode_type = H5O_MSG_SHARED; \
- else \
- decode_type = (MSG)->type; \
- \
- /* Decode the message */ \
- HDassert(decode_type->decode); \
- if(NULL == ((MSG)->native = (decode_type->decode)((F), (DXPL), (MSG)->raw))) \
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message") \
- } /* end if */
-
/******************/
/* Local Typedefs */
@@ -116,29 +98,9 @@ static hid_t H5O_open_by_loc(H5G_loc_t *obj_loc, hid_t dxpl_id);
static H5O_loc_t * H5O_get_oloc(hid_t id);
static herr_t H5O_new(H5F_t *f, hid_t dxpl_id, haddr_t header, size_t chunk_size,
hid_t ocpl_id, H5O_loc_t *loc/*out*/);
-static herr_t H5O_reset_real(const H5O_msg_class_t *type, void *native);
-static void * H5O_copy_real(const H5O_msg_class_t *type, const void *mesg,
- void *dst);
-static void *H5O_read_real(H5F_t *f, H5O_t *oh, unsigned type_id, int sequence,
- void *mesg, hid_t dxpl_id);
-static unsigned H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
- const H5O_msg_class_t **type_p, int sequence);
-static herr_t H5O_write_real(H5O_loc_t *loc, const H5O_msg_class_t *type,
- unsigned overwrite, unsigned flags, unsigned update_flags, const void *mesg,
- hid_t dxpl_id);
-static herr_t H5O_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
- const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags,
- const void *mesg, unsigned * oh_flags_ptr);
static herr_t H5O_remove_real(const H5O_loc_t *loc, const H5O_msg_class_t *type,
int sequence, H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id);
static herr_t H5O_delete_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh);
-static unsigned H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags,
- const H5O_msg_class_t *orig_type, const void *orig_mesg, H5O_shared_t *sh_mesg,
- const H5O_msg_class_t **new_type, const void **new_mesg, hid_t dxpl_id,
- unsigned * oh_flags_ptr);
-static herr_t H5O_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
- const H5O_msg_class_t *type, const void *mesg, unsigned flags,
- unsigned update_flags, unsigned * oh_flags_ptr);
static herr_t H5O_iterate_real(const H5O_loc_t *loc, const H5O_msg_class_t *type,
H5AC_protect_t prot, hbool_t internal, H5O_mesg_operator_t op, void *op_data, hid_t dxpl_id);
static const H5O_obj_class_t *H5O_obj_class(H5O_loc_t *loc, hid_t dxpl_id);
@@ -1032,268 +994,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_reset
- *
- * Purpose: Some message data structures have internal fields that
- * need to be freed. This function does that if appropriate
- * but doesn't free NATIVE.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 12 1997
- *
- * Modifications:
- * Changed to use IDs for types, instead of type objects, then
- * call "real" routine.
- * Quincey Koziol
- * Feb 14 2003
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_reset(unsigned type_id, void *native)
-{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5O_reset, FAIL)
-
- /* check args */
- 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);
-
- /* Call the "real" reset routine */
- if(H5O_reset_real(type, native) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "unable to reset object header")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_reset() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_reset_real
- *
- * Purpose: Some message data structures have internal fields that
- * need to be freed. This function does that if appropriate
- * but doesn't free NATIVE.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 12 1997
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_reset_real(const H5O_msg_class_t *type, void *native)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5O_reset_real)
-
- /* check args */
- HDassert(type);
-
- if(native) {
- if(type->reset) {
- if((type->reset)(native) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed")
- } else
- HDmemset(native, 0, type->native_size);
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_reset_real() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_free
- *
- * Purpose: Similar to H5O_reset() except it also frees the message
- * pointer.
- *
- * Return: Success: NULL
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Thursday, May 21, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5O_free(unsigned type_id, void *mesg)
-{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- void * ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOFUNC(H5O_free)
-
- /* check args */
- 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);
-
- /* Call the "real" free routine */
- ret_value = H5O_free_real(type, mesg);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_free() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_free_mesg
- *
- * Purpose: Call H5O_free_real() on a message.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Tuesday, Sep 6, 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_free_mesg(H5O_mesg_t *mesg)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_free_mesg)
-
- /* check args */
- HDassert(mesg);
-
- /* Free any native information */
- if(mesg->flags & H5O_MSG_FLAG_SHARED)
- mesg->native = H5O_free_real(H5O_MSG_SHARED, mesg->native);
- else
- mesg->native = H5O_free_real(mesg->type, mesg->native);
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_free_mesg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_free_real
- *
- * Purpose: Similar to H5O_reset() except it also frees the message
- * pointer.
- *
- * Return: Success: NULL
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Thursday, May 21, 1998
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5O_free_real(const H5O_msg_class_t *type, void *msg_native)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_free_real)
-
- /* check args */
- HDassert(type);
-
- if(msg_native) {
- H5O_reset_real(type, msg_native);
- if (NULL!=(type->free))
- (type->free)(msg_native);
- else
- H5MM_xfree(msg_native);
- } /* end if */
-
- FUNC_LEAVE_NOAPI(NULL)
-} /* end H5O_free_real() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_copy
- *
- * Purpose: Copies a message. If MESG is is the null pointer then a null
- * pointer is returned with no error.
- *
- * Return: Success: Ptr to the new message
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Thursday, May 21, 1998
- *
- * Modifications:
- * Changed to use IDs for types, instead of type objects, then
- * call "real" routine.
- * Quincey Koziol
- * Feb 14 2003
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5O_copy (unsigned type_id, const void *mesg, void *dst)
-{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(H5O_copy, NULL)
-
- /* check args */
- 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);
-
- /* Call the "real" copy routine */
- if((ret_value = H5O_copy_real(type, mesg, dst)) == NULL)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object header message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_copy() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_copy_real
- *
- * Purpose: Copies a message. If MESG is is the null pointer then a null
- * pointer is returned with no error.
- *
- * Return: Success: Ptr to the new message
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Thursday, May 21, 1998
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5O_copy_real(const H5O_msg_class_t *type, const void *mesg, void *dst)
-{
- void *ret_value = NULL;
-
- FUNC_ENTER_NOAPI_NOINIT(H5O_copy_real)
-
- /* check args */
- HDassert(type);
- HDassert(type->copy);
-
- if(mesg)
- if(NULL == (ret_value = (type->copy)(mesg, dst, 0)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy object header message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_copy_real() */
-
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_link
*
* Purpose: Adjust the link count for an object header by adding
@@ -1325,7 +1025,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id)
HDassert(loc);
HDassert(loc->file);
HDassert(H5F_addr_defined(loc->addr));
- if(adjust != 0 && 0 == (loc->file->intent & H5F_ACC_RDWR))
+ if(adjust != 0 && 0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
/* get header */
@@ -1534,434 +1234,10 @@ H5O_exists_oh(H5O_t *oh, unsigned type_id, int sequence)
/*-------------------------------------------------------------------------
- * Function: H5O_read
- *
- * Purpose: Reads a message from an object header and returns a pointer
- * to it. The caller will usually supply the memory through
- * MESG and the return value will be MESG. But if MESG is
- * the null pointer, then this function will malloc() memory
- * to hold the result and return its pointer instead.
- *
- * Return: Success: Ptr to message in native format. The message
- * should be freed by calling H5O_reset(). If
- * MESG is a null pointer then the caller should
- * also call H5MM_xfree() on the return value
- * after calling H5O_reset().
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 6 1997
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5O_read(const H5O_loc_t *loc, unsigned type_id, int sequence, void *mesg, hid_t dxpl_id)
-{
- H5O_t *oh = NULL; /* Object header to use */
- void *ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(H5O_read, NULL)
-
- /* check args */
- HDassert(loc);
- HDassert(loc->file);
- HDassert(H5F_addr_defined(loc->addr));
- HDassert(type_id < NELMTS(H5O_msg_class_g));
- HDassert(sequence >= 0);
-
- /* Get the object header */
- if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header")
-
- /* Call the "real" read routine */
- if((ret_value = H5O_read_real(loc->file, oh, type_id, sequence, mesg, dxpl_id)) == NULL)
- HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to load object header")
-
-done:
- if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_read() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_read_real
- *
- * Purpose: Reads a message from an object header and returns a pointer
- * to it. The caller will usually supply the memory through
- * MESG and the return value will be MESG. But if MESG is
- * the null pointer, then this function will malloc() memory
- * to hold the result and return its pointer instead.
- *
- * Return: Success: Ptr to message in native format. The message
- * should be freed by calling H5O_reset(). If
- * MESG is a null pointer then the caller should
- * also call H5MM_xfree() on the return value
- * after calling H5O_reset().
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 6 1997
- *
- *-------------------------------------------------------------------------
- */
-static void *
-H5O_read_real(H5F_t *f, H5O_t *oh, unsigned type_id, int sequence, void *mesg, hid_t dxpl_id)
-{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- int idx;
- void *ret_value = NULL;
-
- FUNC_ENTER_NOAPI_NOINIT(H5O_read_real)
-
- /* check args */
- HDassert(f);
- HDassert(oh);
- 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);
- HDassert(sequence >= 0);
-
- /* can we get it from the object header? */
- if((idx = H5O_find_in_ohdr(f, dxpl_id, oh, &type, sequence)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "unable to find message in object header")
-
- if(oh->mesg[idx].flags & H5O_MSG_FLAG_SHARED) {
- /*
- * If the message is shared then then the native pointer points to an
- * H5O_MSG_SHARED message. We use that information to look up the real
- * message in the global heap or some other object header.
- */
- H5O_shared_t *shared;
-
- shared = (H5O_shared_t *)(oh->mesg[idx].native);
- ret_value = H5O_shared_read(f, dxpl_id, shared, type, mesg);
- } else {
- /*
- * The message is not shared, but rather exists in the object
- * header. The object header caches the native message (along with
- * the raw message) so we must copy the native message before
- * returning.
- */
- if(NULL == (ret_value = (type->copy)(oh->mesg[idx].native, mesg, 0)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space")
- } /* end else */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_read_real() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_find_in_ohdr
- *
- * Purpose: Find a message in the object header without consulting
- * a symbol table entry.
- *
- * Return: Success: Index number of message.
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 6 1997
- *
- * Modifications:
- * Robb Matzke, 1999-07-28
- * The ADDR argument is passed by value.
- *
- * Bill Wendling, 2003-09-30
- * Modified so that the object header needs to be AC_protected
- * before calling this function.
- *-------------------------------------------------------------------------
- */
-static unsigned
-H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t **type_p, int sequence)
-{
- unsigned u;
- unsigned ret_value;
-
- FUNC_ENTER_NOAPI_NOINIT(H5O_find_in_ohdr)
-
- /* Check args */
- HDassert(f);
- HDassert(oh);
- HDassert(type_p);
-
- /* Scan through the messages looking for the right one */
- for(u = 0; u < oh->nmesgs; u++) {
- if(*type_p && (*type_p)->id != oh->mesg[u].type->id)
- continue;
- if(--sequence < 0)
- break;
- } /* end for */
-
- if(sequence >= 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, UFAIL, "unable to find object header message")
-
- /*
- * Decode the message if necessary. If the message is shared then decode
- * a shared message, ignoring the message type.
- */
- LOAD_NATIVE(f, dxpl_id, &(oh->mesg[u]), UFAIL)
-
- /*
- * Return the message type. If this is a shared message then return the
- * pointed-to type.
- */
- *type_p = oh->mesg[u].type;
-
- /* Set return value */
- ret_value = u;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_find_in_ohdr() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_write
- *
- * Purpose: Modifies an existing message or creates a new message.
- *
- * The OVERWRITE argument is a sequence number of a
- * message to overwrite (usually zero).
- * If the message to overwrite doesn't exist then this routine
- * fails.
- *
- * The UPDATE_FLAGS argument are flags that allow the caller
- * to skip updating the modification time or reseting the message
- * data. This is useful when several calls to H5O_write will be
- * made in a sequence.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 6 1997
- *
- *-------------------------------------------------------------------------
- */
-/* JAMES: this will probably get put through its paces when extending shared
- * dataspaces */
-herr_t
-H5O_write(H5O_loc_t *loc, unsigned type_id, unsigned overwrite,
- unsigned mesg_flags, unsigned update_flags, void *mesg, hid_t dxpl_id)
-{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- htri_t shared_mesg; /* Whether the message should be shared */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5O_write, 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);
- HDassert(mesg);
- HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS));
-
- /* Should this message be written as a SOHM? */
- if((shared_mesg = H5SM_try_share(loc->file, dxpl_id, type_id, mesg)) > 0)
- /* Mark the message as shared */
- mesg_flags |= H5O_MSG_FLAG_SHARED;
- else if(shared_mesg < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "error while trying to share message");
-
- /* Call the "real" modify routine */
- if(H5O_write_real(loc, type, overwrite, mesg_flags, update_flags, mesg, dxpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_write() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_write_real
- *
- * Purpose: Modifies an existing message or creates a new message.
- *
- * The OVERWRITE argument is a sequence number of a
- * message to overwrite (usually zero).
- * If the message to overwrite doesn't exist then this routine
- * fails.
- *
- * The UPDATE_FLAGS argument are flags that allow the caller
- * to skip updating the modification time or reseting the message
- * data. This is useful when several calls to H5O_write will be
- * made in a sequence.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 6 1997
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_write_real(H5O_loc_t *loc, const H5O_msg_class_t *type, unsigned overwrite,
- unsigned mesg_flags, unsigned update_flags, const void *mesg, hid_t dxpl_id)
-{
- H5O_t *oh = NULL;
- unsigned oh_flags = H5AC__NO_FLAGS_SET;
- int sequence; /* Sequence # of message type to modify */
- unsigned idx; /* Index of message to modify */
- H5O_mesg_t *idx_msg; /* Pointer to message to modify */
- H5O_shared_t sh_mesg;
- const H5O_msg_class_t *write_type = type; /* Type of message to be written */
- const void *write_mesg = mesg; /* Actual message being written */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5O_write_real)
-
- /* check args */
- HDassert(loc);
- HDassert(loc->file);
- HDassert(H5F_addr_defined(loc->addr));
- HDassert(type);
- HDassert(mesg);
- HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS));
-
- /* Check for write access on the file */
- if(0 == (loc->file->intent & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
-
- /* Protect the object header */
- if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
-
- /* Count similar messages */
- for(idx = 0, sequence = -1, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) {
- if(type->id != idx_msg->type->id)
- continue;
- if(++sequence == (int)overwrite)
- break;
- } /* end for */
-
- /* Was the right message found? */
- if(sequence != (int)overwrite)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message not found")
-
- /* Check for modifying a constant message */
- if(oh->mesg[idx].flags & H5O_MSG_FLAG_CONSTANT) {
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message")
- } else if(oh->mesg[idx].flags & H5O_MSG_FLAG_SHARED) {
- /* This message is shared, but it's being modified. This is valid if
- * it's shared in the heap .
- * First, make sure it's not a committed message; these can't ever
- * be modified.
- */
- if(((H5O_shared_t*)oh->mesg[idx].native)->flags & H5O_COMMITTED_FLAG)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify committed message")
-
- /* Remove the old message from the SOHM index */
- if(H5SM_try_delete(loc->file, dxpl_id, oh->mesg[idx].type->id, oh->mesg[idx].native) < 0)
- HGOTO_ERROR (H5E_OHDR, H5E_CANTFREE, FAIL, "unable to delete message from SOHM table")
-
- /* Now this message is no longer shared and we can safely overwrite it.
- * We need to make sure that the message we're writing is shared,
- * though, and that the library doesn't try to reset the current
- * message like it would in a normal overwrite (this message is
- * realy a shared pointer, not a real message).
- * JAMES: will this break if a shared message is overwritten with a larger
- * non-shared message?
- */
- HDassert(H5O_is_shared(type->id, mesg) > 0); /* JAMES: this should work with
- * replacement messages that aren't shared, too. */
-
- if(H5O_get_share(type->id, loc->file, mesg, &sh_mesg) < 0)
- HGOTO_ERROR (H5E_OHDR, H5E_BADMESG, FAIL, "can't get shared message")
-
- /* Instead of writing the original message, write a shared message */
- write_type = H5O_MSG_SHARED;
- write_mesg = &sh_mesg;
- } /* end if */
-
- /* Write the information to the message */
- if(H5O_write_mesg(loc->file, dxpl_id, oh, idx, write_type, write_mesg, mesg_flags, update_flags, &oh_flags) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message")
-#ifdef H5O_DEBUG
-H5O_assert(oh);
-#endif /* H5O_DEBUG */
-
-done:
- if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_write_real() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_msg_create
- *
- * Purpose: Create a new object header message
- *
- * Return: Success: The sequence number of the message that
- * was created.
- *
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Dec 1 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_msg_create(H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
- unsigned update_flags, void *mesg, hid_t dxpl_id)
-{
- H5O_t *oh = NULL; /* Object header */
- unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Metadata cache flags for object header */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5O_msg_create, FAIL)
-
- /* check args */
- HDassert(loc);
- HDassert(type_id < NELMTS(H5O_msg_class_g));
- HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS));
- HDassert(mesg);
-
- /* Check for write access on the file */
- if(0 == (loc->file->intent & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
-
- /* Protect the object header */
- if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
-
- /* Go append message to object header */
- if(H5O_append(loc->file, dxpl_id, oh, type_id, mesg_flags, update_flags, mesg, &oh_flags) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header")
-
-done:
- if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_msg_create() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_protect
*
* Purpose: Wrapper around H5AC_protect for use during a H5O_protect->
- * H5O_append->...->H5O_append->H5O_unprotect sequence of calls
+ * H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls
* during an object's creation.
*
* Return: Success: Pointer to the object header structure for the
@@ -1988,7 +1264,7 @@ H5O_protect(H5O_loc_t *loc, hid_t dxpl_id)
HDassert(H5F_addr_defined(loc->addr));
/* Check for write access on the file */
- if(0 == (loc->file->intent & H5F_ACC_RDWR))
+ if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "no write intent on file")
/* Lock the object header into the cache */
@@ -2004,7 +1280,7 @@ done:
* Function: H5O_unprotect
*
* Purpose: Wrapper around H5AC_unprotect for use during a H5O_protect->
- * H5O_append->...->H5O_append->H5O_unprotect sequence of calls
+ * H5O_msg_append->...->H5O_msg_append->H5O_unprotect sequence of calls
* during an object's creation.
*
* Return: Success: Non-negative
@@ -2040,249 +1316,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_append
- *
- * Purpose: Simplified version of H5O_msg_create, used when creating a new
- * object header message (usually during object creation) and
- * several messages will be added to the object header at once.
- *
- * Return: Success: The sequence number of the message that
- * was created.
- *
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Dec 31 2002
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, unsigned mesg_flags,
- unsigned update_flags, void *mesg, unsigned * oh_flags_ptr)
-{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5O_append, FAIL)
-
- /* check args */
- HDassert(f);
- HDassert(oh);
- 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);
- HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS));
- HDassert(mesg);
- HDassert(oh_flags_ptr);
-
- /* Should this message be written as a SOHM? */
- if((shared_mesg = H5SM_try_share(f, dxpl_id, type_id, mesg)) > 0)
- /* Mark the message as shared */
- mesg_flags |= H5O_MSG_FLAG_SHARED;
- else if(shared_mesg < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "error determining if message should be shared");
-
- if(H5O_append_real(f, dxpl_id, oh, type, mesg_flags, update_flags, mesg, oh_flags_ptr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_append() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_append_real
- *
- * Purpose: Simplified version of H5O_msg_create, used when creating a new
- * object header message (usually during object creation) and
- * several messages will be added to the object header at once.
- *
- * Return: Success: The sequence number of the message that
- * was created.
- *
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Dec 31 2002
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
- unsigned mesg_flags, unsigned update_flags, const void *mesg, unsigned * oh_flags_ptr)
-{
- unsigned idx; /* Index of message to modify */
- H5O_shared_t sh_mesg;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5O_append_real)
-
- /* check args */
- HDassert(f);
- HDassert(oh);
- HDassert(type);
- HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS));
- HDassert(mesg);
- HDassert(oh_flags_ptr);
-
- /* Create a new message */
- if((idx = H5O_new_mesg(f, oh, &mesg_flags, type, mesg, &sh_mesg, &type, &mesg, dxpl_id, oh_flags_ptr)) == UFAIL)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create new message")
-
- /* Write the information to the message */
- if(H5O_write_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags, oh_flags_ptr) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message")
-#ifdef H5O_DEBUG
-H5O_assert(oh);
-#endif /* H5O_DEBUG */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_append_real () */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_new_mesg
- *
- * Purpose: Create a new message in an object header
- *
- * Return: Success: Index of message
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * Friday, September 3, 2003
- *
- *-------------------------------------------------------------------------
- */
-static unsigned
-H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *mesg_flags, const H5O_msg_class_t *orig_type,
- const void *orig_mesg, H5O_shared_t *sh_mesg, const H5O_msg_class_t **new_type,
- const void **new_mesg, hid_t dxpl_id, unsigned * oh_flags_ptr)
-{
- size_t size; /* Size of space allocated for object header */
- htri_t is_shared; /* Is this a shared message? */
- unsigned ret_value = UFAIL; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5O_new_mesg)
-
- /* check args */
- HDassert(f);
- HDassert(oh);
- HDassert(mesg_flags);
- HDassert(orig_type);
- HDassert(orig_mesg);
- HDassert(sh_mesg);
- HDassert(new_mesg);
- HDassert(new_type);
- HDassert(oh_flags_ptr);
-
- /* Check for shared message */
- if(*mesg_flags & H5O_MSG_FLAG_SHARED) {
- if((NULL == orig_type->is_shared) || (NULL == orig_type->get_share))
- HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, UFAIL, "message class is not sharable")
- if((is_shared = (orig_type->is_shared)(orig_mesg)) == FALSE) {
- /*
- * If the message isn't shared then turn off the shared bit
- * and treat it as an unshared message.
- */
- *mesg_flags &= ~H5O_MSG_FLAG_SHARED;
- *new_type = orig_type;
- *new_mesg = orig_mesg;
- } else if(is_shared > 0) {
- /* Message is shared. Get shared message, change message type,
- * and use shared information */
- HDmemset(sh_mesg, 0, sizeof(H5O_shared_t));
- if((orig_type->get_share)(f, orig_mesg, sh_mesg/*out*/) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, UFAIL, "can't get shared message")
-
- *new_type = H5O_MSG_SHARED;
- *new_mesg = sh_mesg;
- } else {
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, UFAIL, "can't determine if message is shared")
- }/* end else */
- } /* end if */
- else {
- *new_type = orig_type;
- *new_mesg = orig_mesg;
- } /* end else */
-
- /* Compute the size needed to store the message on disk */
- if((size = ((*new_type)->raw_size)(f, *new_mesg)) >= H5O_MESG_MAX_SIZE)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large")
-
- /* Allocate space in the object header for the message */
- if((ret_value = H5O_alloc(f, dxpl_id, oh, orig_type, size, oh_flags_ptr)) == UFAIL)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "unable to allocate space for message")
-
- /* Increment any links in message */
- if((*new_type)->link && ((*new_type)->link)(f, dxpl_id, (*new_mesg)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, UFAIL, "unable to adjust shared object link count")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_new_mesg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_write_mesg
- *
- * Purpose: Write message to object header
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Friday, September 3, 2003
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
- const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags,
- unsigned update_flags, unsigned *oh_flags_ptr)
-{
- H5O_mesg_t *idx_msg; /* Pointer to message to modify */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5O_write_mesg)
-
- /* check args */
- HDassert(f);
- HDassert(oh);
- HDassert(type);
- HDassert(mesg);
- HDassert(oh_flags_ptr);
-
- /* Set pointer to the correct message */
- idx_msg = &oh->mesg[idx];
-
- /* Reset existing native information */
- if(!(update_flags & H5O_UPDATE_DATA_ONLY))
- H5O_reset_real(type, idx_msg->native);
-
- /* Copy the native value for the message */
- if(NULL == (idx_msg->native = (type->copy)(mesg, idx_msg->native, update_flags)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy message to object header")
-
- /* Update the message flags and mark the message as modified */
- idx_msg->flags = mesg_flags;
- idx_msg->dirty = TRUE;
-
- /* Update the modification time message if any */
- if(update_flags & H5O_UPDATE_TIME)
- H5O_touch_oh(f, dxpl_id, oh, FALSE, oh_flags_ptr);
-
- /* Mark the object header as modified */
- *oh_flags_ptr |= H5AC__DIRTIED_FLAG;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_write_mesg() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_touch_oh
*
* Purpose: If FORCE is non-zero then create a modification time message
@@ -2390,7 +1423,7 @@ H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id)
HDassert(loc);
HDassert(loc->file);
HDassert(H5F_addr_defined(loc->addr));
- if(0 == (loc->file->intent & H5F_ACC_RDWR))
+ if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Get the object header */
@@ -2493,7 +1526,7 @@ H5O_bogus(H5O_loc_t *loc, hid_t dxpl_id)
HDassert(H5F_addr_defined(loc->addr));
/* Verify write access to the file */
- if(0 == (loc->file->intent & H5F_ACC_RDWR))
+ if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Get the object header */
@@ -2714,7 +1747,7 @@ H5O_remove_real(const H5O_loc_t *loc, const H5O_msg_class_t *type, int sequence,
HDassert(type);
/* Make certain we are allowed to modify the file */
- if(0 == (loc->file->intent & H5F_ACC_RDWR))
+ if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Set up iterator operator data */
@@ -3010,7 +2043,6 @@ done:
} /* end H5O_reset_share() */
-
/*-------------------------------------------------------------------------
* Function: H5O_delete
*
@@ -3371,7 +2403,7 @@ H5O_iterate_real(const H5O_loc_t *loc, const H5O_msg_class_t *type, H5AC_protect
/*
* Decode the message if necessary.
*/
- LOAD_NATIVE(loc->file, dxpl_id, idx_msg, FAIL)
+ H5O_LOAD_NATIVE(loc->file, dxpl_id, idx_msg, FAIL)
/* Check for making an "internal" (i.e. within the H5O package) callback */
if(internal) {
@@ -3398,7 +2430,7 @@ H5O_iterate_real(const H5O_loc_t *loc, const H5O_msg_class_t *type, H5AC_protect
/* Free the "real" message if it was allocated */
if(native_mesg_alloc) {
- H5O_free(idx_msg->type->id, native_mesg);
+ H5O_msg_free(idx_msg->type->id, native_mesg);
native_mesg_alloc = FALSE;
}
} /* end else */
@@ -3415,7 +2447,7 @@ H5O_iterate_real(const H5O_loc_t *loc, const H5O_msg_class_t *type, H5AC_protect
done:
/* Free the native message if it was allocated */
if(native_mesg_alloc) {
- H5O_free(idx_msg->type->id, native_mesg);
+ H5O_msg_free(idx_msg->type->id, native_mesg);
native_mesg_alloc = FALSE;
}
@@ -3794,73 +2826,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_mesg_hash
- *
- * Purpose: Returns a hash value for an object header message.
- *
- * Return: Non-H5O_HASH_UNDEF hash value on success
- * H5O_HASH_UNDEF on failure
- *
- * Programmer: James Laird
- * April 13 2006
- *
- *-------------------------------------------------------------------------
- */
-uint32_t
-H5O_mesg_hash(unsigned type_id, H5F_t *f, const void *mesg)
-{
- size_t buf_size;
- unsigned char * buf = NULL; /* Buffer to be hashed */
- uint32_t hash;
- uint32_t ret_value;
-
- FUNC_ENTER_NOAPI(H5O_mesg_hash, H5O_HASH_UNDEF)
-
- /* Check args */
- HDassert(type_id < NELMTS(H5O_msg_class_g));
- HDassert(mesg);
- HDassert(f);
-
- /* Find out the size of buffer needed */
- if((buf_size = H5O_raw_size(type_id, f, mesg)) <= 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADSIZE, H5O_HASH_UNDEF, "can't find message size");
-
- /* JAMES: revisit this! Some messages don't use as much space as they say
- * they need. Quincey may have fixed this.
- */
- if((buf = H5MM_calloc(buf_size)) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5O_HASH_UNDEF, "can't allocate buffer for message");
-
- /* Encode message into temporary buffer */
- if(H5O_encode(f, buf, mesg, type_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, H5O_HASH_UNDEF, "can't encode OH message");
-
- /*
- * Compute the hash value for this message. type_id is used here to
- * initialize the hash algorithm, and affects the resulting value.
- */
- hash = H5_checksum_lookup3(buf, buf_size, type_id);
-
- /* JAMES: this is a pretty good hash function. Do we need to version it?
- * If so, we'd do so here. */
-
- /* A hash value of H5O_HASH_UNDEF indicates failure. If we naturally
- * generated this value, reset it to some valid value. */
- if(hash == H5O_HASH_UNDEF)
- hash = (uint32_t) 1;
-
- /* Set return value */
- ret_value = hash;
-
-done:
- if(buf)
- HDfree(buf);
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_mesg_hash() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_get_info
*
* Purpose: Retrieve the information for an object
@@ -3924,9 +2889,9 @@ H5O_get_info(H5O_loc_t *oloc, H5O_info_t *oinfo, hid_t dxpl_id)
oinfo->btime = 0;
/* Might be information for modification time */
- if(NULL == H5O_read_real(oloc->file, oh, H5O_MTIME_ID, 0, &oinfo->ctime, dxpl_id)) {
+ if(NULL == H5O_msg_read_real(oloc->file, oh, H5O_MTIME_ID, 0, &oinfo->ctime, dxpl_id)) {
H5E_clear_stack(NULL);
- if(NULL == H5O_read_real(oloc->file, oh, H5O_MTIME_NEW_ID, 0, &oinfo->ctime, dxpl_id)) {
+ if(NULL == H5O_msg_read_real(oloc->file, oh, H5O_MTIME_NEW_ID, 0, &oinfo->ctime, dxpl_id)) {
H5E_clear_stack(NULL);
oinfo->ctime = 0;
} /* end if */
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index ae1c5ff..af1a4a0 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -938,7 +938,7 @@ H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg,
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete file space for object header message")
/* Free any native information */
- H5O_free_mesg(mesg);
+ H5O_msg_free_mesg(mesg);
} /* end if */
/* Change message type to nil and zero it */
@@ -1255,7 +1255,7 @@ H5O_merge_null(H5O_t *oh)
/* Second message has been merged, delete it */
if(merged_msg) {
/* Release any information/memory for second message */
- H5O_free_mesg(curr_msg2);
+ H5O_msg_free_mesg(curr_msg2);
/* Mark first message as dirty */
curr_msg->dirty = TRUE;
@@ -1391,7 +1391,7 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id)
*/
/* Release any information/memory for message */
- H5O_free_mesg(null_msg);
+ H5O_msg_free_mesg(null_msg);
/* Remove null message from list of messages */
if(null_msg_no < (oh->nmesgs - 1))
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index f45c2fd..05fb4b9 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -198,7 +198,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype")
/* Free the shared information */
- H5O_free_real(H5O_MSG_SHARED, shared);
+ H5O_msg_free_real(H5O_MSG_SHARED, shared);
} /* end if */
else {
if((attr->dt = (H5O_MSG_DTYPE->decode)(f, dxpl_id, p)) == NULL)
@@ -227,7 +227,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace")
/* Free the shared information */
- H5O_free_real(H5O_MSG_SHARED, shared);
+ H5O_msg_free_real(H5O_MSG_SHARED, shared);
} /* end if */
else {
if((extent = (H5O_MSG_SDSPACE->decode)(f, dxpl_id, p)) == NULL)
@@ -1072,7 +1072,7 @@ H5O_attr_get_share(H5F_t UNUSED *f, const void *_mesg,
HDassert (mesg);
HDassert (sh);
- if(NULL == H5O_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh))
ret_value = FAIL;
FUNC_LEAVE_NOAPI(ret_value)
@@ -1105,7 +1105,7 @@ H5O_attr_set_share(H5F_t UNUSED *f, void *_mesg/*in,out*/,
HDassert (mesg);
HDassert (sh);
- if(NULL == H5O_copy(H5O_SHARED_ID, sh, &(mesg->sh_loc)))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, sh, &(mesg->sh_loc)))
ret_value = FAIL;
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 1375bb1..ff157ea 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -756,7 +756,7 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh)
/* Verify that message is clean */
HDassert(oh->mesg[u].dirty == 0);
- H5O_free_mesg(&oh->mesg[u]);
+ H5O_msg_free_mesg(&oh->mesg[u]);
} /* end for */
if(oh->mesg)
oh->mesg = H5FL_SEQ_FREE(H5O_mesg_t, oh->mesg);
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index 348a931..88178a1 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -431,7 +431,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
mesg = H5O_shared_read(f, dxpl_id, shared, oh->mesg[i].type, NULL);
if(oh->mesg[i].type->debug)
(oh->mesg[i].type->debug)(f, dxpl_id, mesg, stream, indent + 3, MAX (0, fwidth - 3));
- H5O_free_real(oh->mesg[i].type, mesg);
+ H5O_msg_free_real(oh->mesg[i].type, mesg);
} /* end if */
} /* end for */
sequence = H5MM_xfree(sequence);
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index feae7e7..32f01f5 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -1291,7 +1291,7 @@ H5O_dtype_get_share(H5F_t UNUSED *f, const void *_mesg,
HDassert(H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state);
/* Do actual copy of shared information */
- if(NULL == H5O_copy(H5O_SHARED_ID, &(dt->sh_loc), sh))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(dt->sh_loc), sh))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to get shared information")
done:
@@ -1331,7 +1331,7 @@ H5O_dtype_set_share(H5F_t UNUSED *f, void *_mesg/*in,out*/,
(dt->shared->state != H5T_STATE_OPEN && dt->shared->state != H5T_STATE_NAMED));
/* Copy the shared information */
- if(NULL == H5O_copy(H5O_SHARED_ID, sh, &(dt->sh_loc)))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, sh, &(dt->sh_loc)))
ret_value = FAIL;
/* If this is now a committed datatype, set its state properly. */
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index c9e1a4c..9ad1b84 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -357,7 +357,7 @@ H5O_fill_new_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
/* Copy shared message information */
- if(NULL == H5O_copy(H5O_SHARED_ID, &(mesg->sh_loc), &(dest->sh_loc)))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), &(dest->sh_loc)))
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "unable to copy fill value shared info");
/* Copy data type of fill value */
@@ -696,7 +696,7 @@ H5O_fill_new_get_share(H5F_t UNUSED *f, const void *_mesg,
HDassert (mesg);
HDassert (sh);
- if(NULL == H5O_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh))
ret_value = FAIL;
FUNC_LEAVE_NOAPI(ret_value)
@@ -729,7 +729,7 @@ H5O_fill_new_set_share(H5F_t UNUSED *f, void *_mesg/*in,out*/,
HDassert (mesg);
HDassert (sh);
- if(NULL == H5O_copy(H5O_SHARED_ID, sh, &(mesg->sh_loc)))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, sh, &(mesg->sh_loc)))
ret_value = FAIL;
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index 297ba06..384a181 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -471,7 +471,7 @@ H5O_linfo_post_copy_file_cb(const H5O_link_t *src_lnk, void *_udata)
done:
/* Check if the destination link has been initialized */
if(dst_lnk_init)
- H5O_reset(H5O_LINK_ID, &dst_lnk);
+ H5O_msg_reset(H5O_LINK_ID, &dst_lnk);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_linfo_post_copy_file_cb() */
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
new file mode 100644
index 0000000..c244899
--- /dev/null
+++ b/src/H5Omessage.c
@@ -0,0 +1,1092 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5Omessage.c
+ * Dec 3 2006
+ * Quincey Koziol <koziol@hdfgroup.org>
+ *
+ * Purpose: Object header message routines.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#define H5O_PACKAGE /*suppress error about including H5Opkg */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5SMprivate.h" /* Shared object header messages */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+static herr_t H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
+ const H5O_msg_class_t *type, unsigned mesg_flags, unsigned update_flags,
+ const void *mesg, unsigned * oh_flags_ptr);
+static herr_t H5O_msg_write_real(H5O_loc_t *loc, const H5O_msg_class_t *type,
+ unsigned overwrite, unsigned flags, unsigned update_flags, const void *mesg,
+ hid_t dxpl_id);
+static herr_t H5O_msg_reset_real(const H5O_msg_class_t *type, void *native);
+static void *H5O_msg_copy_real(const H5O_msg_class_t *type, const void *mesg,
+ void *dst);
+static unsigned H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
+ const H5O_msg_class_t **type_p, int sequence);
+static unsigned H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags,
+ const H5O_msg_class_t *orig_type, const void *orig_mesg, H5O_shared_t *sh_mesg,
+ const H5O_msg_class_t **new_type, const void **new_mesg, hid_t dxpl_id,
+ unsigned * oh_flags_ptr);
+static herr_t H5O_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
+ const H5O_msg_class_t *type, const void *mesg, unsigned flags,
+ unsigned update_flags, unsigned * oh_flags_ptr);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_create
+ *
+ * Purpose: Create a new object header message
+ *
+ * Return: Success: The sequence number of the message that
+ * was created.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Dec 1 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_msg_create(H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
+ unsigned update_flags, void *mesg, hid_t dxpl_id)
+{
+ H5O_t *oh = NULL; /* Object header */
+ unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Metadata cache flags for object header */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_msg_create, FAIL)
+
+ /* check args */
+ HDassert(loc);
+ HDassert(type_id < NELMTS(H5O_msg_class_g));
+ HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS));
+ HDassert(mesg);
+
+ /* Check for write access on the file */
+ if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR))
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
+
+ /* Protect the object header */
+ if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+
+ /* Go append message to object header */
+ if(H5O_msg_append(loc->file, dxpl_id, oh, type_id, mesg_flags, update_flags, mesg, &oh_flags) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header")
+
+done:
+ if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_append
+ *
+ * Purpose: Simplified version of H5O_msg_create, used when creating a new
+ * object header message (usually during object creation) and
+ * several messages will be added to the object header at once.
+ *
+ * Return: Success: The sequence number of the message that
+ * was created.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Dec 31 2002
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_msg_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id, unsigned mesg_flags,
+ unsigned update_flags, void *mesg, unsigned * oh_flags_ptr)
+{
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_msg_append, FAIL)
+
+ /* check args */
+ HDassert(f);
+ HDassert(oh);
+ 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);
+ HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS));
+ HDassert(mesg);
+ HDassert(oh_flags_ptr);
+
+ /* Should this message be written as a SOHM? */
+ if((shared_mesg = H5SM_try_share(f, dxpl_id, type_id, mesg)) > 0)
+ /* Mark the message as shared */
+ mesg_flags |= H5O_MSG_FLAG_SHARED;
+ else if(shared_mesg < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "error determining if message should be shared");
+
+ if(H5O_msg_append_real(f, dxpl_id, oh, type, mesg_flags, update_flags, mesg, oh_flags_ptr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_append() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_append_real
+ *
+ * Purpose: Simplified version of H5O_msg_create, used when creating a new
+ * object header message (usually during object creation) and
+ * several messages will be added to the object header at once.
+ *
+ * Return: Success: The sequence number of the message that
+ * was created.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Dec 31 2002
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
+ unsigned mesg_flags, unsigned update_flags, const void *mesg, unsigned * oh_flags_ptr)
+{
+ unsigned idx; /* Index of message to modify */
+ H5O_shared_t sh_mesg;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_msg_append_real)
+
+ /* check args */
+ HDassert(f);
+ HDassert(oh);
+ HDassert(type);
+ HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS));
+ HDassert(mesg);
+ HDassert(oh_flags_ptr);
+
+ /* Create a new message */
+ if((idx = H5O_new_mesg(f, oh, &mesg_flags, type, mesg, &sh_mesg, &type, &mesg, dxpl_id, oh_flags_ptr)) == UFAIL)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create new message")
+
+ /* Write the information to the message */
+ if(H5O_write_mesg(f, dxpl_id, oh, idx, type, mesg, mesg_flags, update_flags, oh_flags_ptr) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message")
+#ifdef H5O_DEBUG
+H5O_assert(oh);
+#endif /* H5O_DEBUG */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_append_real () */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_hash
+ *
+ * Purpose: Returns a hash value for an object header message.
+ *
+ * Return: Non-H5O_HASH_UNDEF hash value on success
+ * H5O_HASH_UNDEF on failure
+ *
+ * Programmer: James Laird
+ * April 13 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+uint32_t
+H5O_msg_hash(unsigned type_id, H5F_t *f, const void *mesg)
+{
+ size_t buf_size;
+ unsigned char * buf = NULL; /* Buffer to be hashed */
+ uint32_t hash;
+ uint32_t ret_value;
+
+ FUNC_ENTER_NOAPI(H5O_msg_hash, H5O_HASH_UNDEF)
+
+ /* Check args */
+ HDassert(type_id < NELMTS(H5O_msg_class_g));
+ HDassert(mesg);
+ HDassert(f);
+
+ /* Find out the size of buffer needed */
+ if((buf_size = H5O_raw_size(type_id, f, mesg)) <= 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADSIZE, H5O_HASH_UNDEF, "can't find message size");
+
+ /* JAMES: revisit this! Some messages don't use as much space as they say
+ * they need. Quincey may have fixed this.
+ */
+ if((buf = H5MM_calloc(buf_size)) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5O_HASH_UNDEF, "can't allocate buffer for message");
+
+ /* Encode message into temporary buffer */
+ if(H5O_encode(f, buf, mesg, type_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, H5O_HASH_UNDEF, "can't encode OH message");
+
+ /*
+ * Compute the hash value for this message. type_id is used here to
+ * initialize the hash algorithm, and affects the resulting value.
+ */
+ hash = H5_checksum_lookup3(buf, buf_size, type_id);
+
+ /* JAMES: this is a pretty good hash function. Do we need to version it?
+ * If so, we'd do so here. */
+
+ /* A hash value of H5O_HASH_UNDEF indicates failure. If we naturally
+ * generated this value, reset it to some valid value. */
+ if(hash == H5O_HASH_UNDEF)
+ hash = (uint32_t) 1;
+
+ /* Set return value */
+ ret_value = hash;
+
+done:
+ if(buf)
+ HDfree(buf);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_hash() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_write
+ *
+ * Purpose: Modifies an existing message or creates a new message.
+ *
+ * The OVERWRITE argument is a sequence number of a
+ * message to overwrite (usually zero).
+ * If the message to overwrite doesn't exist then this routine
+ * fails.
+ *
+ * The UPDATE_FLAGS argument are flags that allow the caller
+ * to skip updating the modification time or reseting the message
+ * data. This is useful when several calls to H5O_msg_write will be
+ * made in a sequence.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Aug 6 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+/* JAMES: this will probably get put through its paces when extending shared
+ * dataspaces */
+herr_t
+H5O_msg_write(H5O_loc_t *loc, unsigned type_id, unsigned overwrite,
+ unsigned mesg_flags, unsigned update_flags, void *mesg, hid_t dxpl_id)
+{
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ htri_t shared_mesg; /* Whether the message should be shared */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_msg_write, 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);
+ HDassert(mesg);
+ HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS));
+
+ /* Should this message be written as a SOHM? */
+ if((shared_mesg = H5SM_try_share(loc->file, dxpl_id, type_id, mesg)) > 0)
+ /* Mark the message as shared */
+ mesg_flags |= H5O_MSG_FLAG_SHARED;
+ else if(shared_mesg < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "error while trying to share message");
+
+ /* Call the "real" modify routine */
+ if(H5O_msg_write_real(loc, type, overwrite, mesg_flags, update_flags, mesg, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_write_real
+ *
+ * Purpose: Modifies an existing message or creates a new message.
+ *
+ * The OVERWRITE argument is a sequence number of a
+ * message to overwrite (usually zero).
+ * If the message to overwrite doesn't exist then this routine
+ * fails.
+ *
+ * The UPDATE_FLAGS argument are flags that allow the caller
+ * to skip updating the modification time or reseting the message
+ * data. This is useful when several calls to H5O_msg_write will be
+ * made in a sequence.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Aug 6 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_msg_write_real(H5O_loc_t *loc, const H5O_msg_class_t *type, unsigned overwrite,
+ unsigned mesg_flags, unsigned update_flags, const void *mesg, hid_t dxpl_id)
+{
+ H5O_t *oh = NULL;
+ unsigned oh_flags = H5AC__NO_FLAGS_SET;
+ int sequence; /* Sequence # of message type to modify */
+ unsigned idx; /* Index of message to modify */
+ H5O_mesg_t *idx_msg; /* Pointer to message to modify */
+ H5O_shared_t sh_mesg;
+ const H5O_msg_class_t *write_type = type; /* Type of message to be written */
+ const void *write_mesg = mesg; /* Actual message being written */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_msg_write_real)
+
+ /* check args */
+ HDassert(loc);
+ HDassert(loc->file);
+ HDassert(H5F_addr_defined(loc->addr));
+ HDassert(type);
+ HDassert(mesg);
+ HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS));
+
+ /* Check for write access on the file */
+ if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR))
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
+
+ /* Protect the object header */
+ if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
+
+ /* Count similar messages */
+ for(idx = 0, sequence = -1, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) {
+ if(type->id != idx_msg->type->id)
+ continue;
+ if(++sequence == (int)overwrite)
+ break;
+ } /* end for */
+
+ /* Was the right message found? */
+ if(sequence != (int)overwrite)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message not found")
+
+ /* Check for modifying a constant message */
+ if(oh->mesg[idx].flags & H5O_MSG_FLAG_CONSTANT) {
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message")
+ } else if(oh->mesg[idx].flags & H5O_MSG_FLAG_SHARED) {
+ /* This message is shared, but it's being modified. This is valid if
+ * it's shared in the heap .
+ * First, make sure it's not a committed message; these can't ever
+ * be modified.
+ */
+ if(((H5O_shared_t*)oh->mesg[idx].native)->flags & H5O_COMMITTED_FLAG)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify committed message")
+
+ /* Remove the old message from the SOHM index */
+ if(H5SM_try_delete(loc->file, dxpl_id, oh->mesg[idx].type->id, oh->mesg[idx].native) < 0)
+ HGOTO_ERROR (H5E_OHDR, H5E_CANTFREE, FAIL, "unable to delete message from SOHM table")
+
+ /* Now this message is no longer shared and we can safely overwrite it.
+ * We need to make sure that the message we're writing is shared,
+ * though, and that the library doesn't try to reset the current
+ * message like it would in a normal overwrite (this message is
+ * realy a shared pointer, not a real message).
+ * JAMES: will this break if a shared message is overwritten with a larger
+ * non-shared message?
+ */
+ HDassert(H5O_is_shared(type->id, mesg) > 0); /* JAMES: this should work with
+ * replacement messages that aren't shared, too. */
+
+ if(H5O_get_share(type->id, loc->file, mesg, &sh_mesg) < 0)
+ HGOTO_ERROR (H5E_OHDR, H5E_BADMESG, FAIL, "can't get shared message")
+
+ /* Instead of writing the original message, write a shared message */
+ write_type = H5O_MSG_SHARED;
+ write_mesg = &sh_mesg;
+ } /* end if */
+
+ /* Write the information to the message */
+ if(H5O_write_mesg(loc->file, dxpl_id, oh, idx, write_type, write_mesg, mesg_flags, update_flags, &oh_flags) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message")
+#ifdef H5O_DEBUG
+H5O_assert(oh);
+#endif /* H5O_DEBUG */
+
+done:
+ if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_write_real() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_read
+ *
+ * Purpose: Reads a message from an object header and returns a pointer
+ * to it. The caller will usually supply the memory through
+ * MESG and the return value will be MESG. But if MESG is
+ * the null pointer, then this function will malloc() memory
+ * to hold the result and return its pointer instead.
+ *
+ * Return: Success: Ptr to message in native format. The message
+ * should be freed by calling H5O_msg_reset(). If
+ * MESG is a null pointer then the caller should
+ * also call H5MM_xfree() on the return value
+ * after calling H5O_msg_reset().
+ *
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Aug 6 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, int sequence, void *mesg, hid_t dxpl_id)
+{
+ H5O_t *oh = NULL; /* Object header to use */
+ void *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_msg_read, NULL)
+
+ /* check args */
+ HDassert(loc);
+ HDassert(loc->file);
+ HDassert(H5F_addr_defined(loc->addr));
+ HDassert(type_id < NELMTS(H5O_msg_class_g));
+ HDassert(sequence >= 0);
+
+ /* Get the object header */
+ if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header")
+
+ /* Call the "real" read routine */
+ if((ret_value = H5O_msg_read_real(loc->file, oh, type_id, sequence, mesg, dxpl_id)) == NULL)
+ HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to load object header")
+
+done:
+ if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_read_real
+ *
+ * Purpose: Reads a message from an object header and returns a pointer
+ * to it. The caller will usually supply the memory through
+ * MESG and the return value will be MESG. But if MESG is
+ * the null pointer, then this function will malloc() memory
+ * to hold the result and return its pointer instead.
+ *
+ * Return: Success: Ptr to message in native format. The message
+ * should be freed by calling H5O_msg_reset(). If
+ * MESG is a null pointer then the caller should
+ * also call H5MM_xfree() on the return value
+ * after calling H5O_msg_reset().
+ *
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Aug 6 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5O_msg_read_real(H5F_t *f, H5O_t *oh, unsigned type_id, int sequence, void *mesg, hid_t dxpl_id)
+{
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ int idx;
+ void *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_msg_read_real)
+
+ /* check args */
+ HDassert(f);
+ HDassert(oh);
+ 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);
+ HDassert(sequence >= 0);
+
+ /* can we get it from the object header? */
+ if((idx = H5O_find_in_ohdr(f, dxpl_id, oh, &type, sequence)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "unable to find message in object header")
+
+ if(oh->mesg[idx].flags & H5O_MSG_FLAG_SHARED) {
+ /*
+ * If the message is shared then then the native pointer points to an
+ * H5O_MSG_SHARED message. We use that information to look up the real
+ * message in the global heap or some other object header.
+ */
+ H5O_shared_t *shared;
+
+ shared = (H5O_shared_t *)(oh->mesg[idx].native);
+ ret_value = H5O_shared_read(f, dxpl_id, shared, type, mesg);
+ } else {
+ /*
+ * The message is not shared, but rather exists in the object
+ * header. The object header caches the native message (along with
+ * the raw message) so we must copy the native message before
+ * returning.
+ */
+ if(NULL == (ret_value = (type->copy)(oh->mesg[idx].native, mesg, 0)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_read_real() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_reset
+ *
+ * Purpose: Some message data structures have internal fields that
+ * need to be freed. This function does that if appropriate
+ * but doesn't free NATIVE.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Aug 12 1997
+ *
+ * Modifications:
+ * Changed to use IDs for types, instead of type objects, then
+ * call "real" routine.
+ * Quincey Koziol
+ * Feb 14 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_msg_reset(unsigned type_id, void *native)
+{
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_msg_reset, FAIL)
+
+ /* check args */
+ 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);
+
+ /* Call the "real" reset routine */
+ if(H5O_msg_reset_real(type, native) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "unable to reset object header")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_reset() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_reset_real
+ *
+ * Purpose: Some message data structures have internal fields that
+ * need to be freed. This function does that if appropriate
+ * but doesn't free NATIVE.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Aug 12 1997
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_msg_reset_real(const H5O_msg_class_t *type, void *native)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_msg_reset_real)
+
+ /* check args */
+ HDassert(type);
+
+ if(native) {
+ if(type->reset) {
+ if((type->reset)(native) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed")
+ } else
+ HDmemset(native, 0, type->native_size);
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_reset_real() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_free
+ *
+ * Purpose: Similar to H5O_msg_reset() except it also frees the message
+ * pointer.
+ *
+ * Return: Success: NULL
+ *
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Thursday, May 21, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5O_msg_free(unsigned type_id, void *mesg)
+{
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ void * ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOFUNC(H5O_msg_free)
+
+ /* check args */
+ 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);
+
+ /* Call the "real" free routine */
+ ret_value = H5O_msg_free_real(type, mesg);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_free_mesg
+ *
+ * Purpose: Call H5O_msg_free_real() on a message.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, Sep 6, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5O_msg_free_mesg(H5O_mesg_t *mesg)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_msg_free_mesg)
+
+ /* check args */
+ HDassert(mesg);
+
+ /* Free any native information */
+ if(mesg->flags & H5O_MSG_FLAG_SHARED)
+ mesg->native = H5O_msg_free_real(H5O_MSG_SHARED, mesg->native);
+ else
+ mesg->native = H5O_msg_free_real(mesg->type, mesg->native);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_msg_free_mesg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_free_real
+ *
+ * Purpose: Similar to H5O_msg_reset() except it also frees the message
+ * pointer.
+ *
+ * Return: Success: NULL
+ *
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Thursday, May 21, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_msg_free_real)
+
+ /* check args */
+ HDassert(type);
+
+ if(msg_native) {
+ H5O_msg_reset_real(type, msg_native);
+ if (NULL!=(type->free))
+ (type->free)(msg_native);
+ else
+ H5MM_xfree(msg_native);
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(NULL)
+} /* end H5O_msg_free_real() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_copy
+ *
+ * Purpose: Copies a message. If MESG is is the null pointer then a null
+ * pointer is returned with no error.
+ *
+ * Return: Success: Ptr to the new message
+ *
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Thursday, May 21, 1998
+ *
+ * Modifications:
+ * Changed to use IDs for types, instead of type objects, then
+ * call "real" routine.
+ * Quincey Koziol
+ * Feb 14 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5O_msg_copy(unsigned type_id, const void *mesg, void *dst)
+{
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ void *ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_msg_copy, NULL)
+
+ /* check args */
+ 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);
+
+ /* Call the "real" copy routine */
+ if((ret_value = H5O_msg_copy_real(type, mesg, dst)) == NULL)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object header message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_msg_copy_real
+ *
+ * Purpose: Copies a message. If MESG is is the null pointer then a null
+ * pointer is returned with no error.
+ *
+ * Return: Success: Ptr to the new message
+ *
+ * Failure: NULL
+ *
+ * Programmer: Robb Matzke
+ * Thursday, May 21, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5O_msg_copy_real(const H5O_msg_class_t *type, const void *mesg, void *dst)
+{
+ void *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_msg_copy_real)
+
+ /* check args */
+ HDassert(type);
+ HDassert(type->copy);
+
+ if(mesg)
+ if(NULL == (ret_value = (type->copy)(mesg, dst, 0)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy object header message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_msg_copy_real() */
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_find_in_ohdr
+ *
+ * Purpose: Find a message in the object header without consulting
+ * a symbol table entry.
+ *
+ * Return: Success: Index number of message.
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Aug 6 1997
+ *
+ * Modifications:
+ * Robb Matzke, 1999-07-28
+ * The ADDR argument is passed by value.
+ *
+ * Bill Wendling, 2003-09-30
+ * Modified so that the object header needs to be AC_protected
+ * before calling this function.
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+H5O_find_in_ohdr(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t **type_p, int sequence)
+{
+ unsigned u;
+ unsigned ret_value;
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_find_in_ohdr)
+
+ /* Check args */
+ HDassert(f);
+ HDassert(oh);
+ HDassert(type_p);
+
+ /* Scan through the messages looking for the right one */
+ for(u = 0; u < oh->nmesgs; u++) {
+ if(*type_p && (*type_p)->id != oh->mesg[u].type->id)
+ continue;
+ if(--sequence < 0)
+ break;
+ } /* end for */
+
+ if(sequence >= 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, UFAIL, "unable to find object header message")
+
+ /*
+ * Decode the message if necessary. If the message is shared then decode
+ * a shared message, ignoring the message type.
+ */
+ H5O_LOAD_NATIVE(f, dxpl_id, &(oh->mesg[u]), UFAIL)
+
+ /*
+ * Return the message type. If this is a shared message then return the
+ * pointed-to type.
+ */
+ *type_p = oh->mesg[u].type;
+
+ /* Set return value */
+ ret_value = u;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_find_in_ohdr() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_new_mesg
+ *
+ * Purpose: Create a new message in an object header
+ *
+ * Return: Success: Index of message
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, September 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *mesg_flags, const H5O_msg_class_t *orig_type,
+ const void *orig_mesg, H5O_shared_t *sh_mesg, const H5O_msg_class_t **new_type,
+ const void **new_mesg, hid_t dxpl_id, unsigned * oh_flags_ptr)
+{
+ size_t size; /* Size of space allocated for object header */
+ htri_t is_shared; /* Is this a shared message? */
+ unsigned ret_value = UFAIL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_new_mesg)
+
+ /* check args */
+ HDassert(f);
+ HDassert(oh);
+ HDassert(mesg_flags);
+ HDassert(orig_type);
+ HDassert(orig_mesg);
+ HDassert(sh_mesg);
+ HDassert(new_mesg);
+ HDassert(new_type);
+ HDassert(oh_flags_ptr);
+
+ /* Check for shared message */
+ if(*mesg_flags & H5O_MSG_FLAG_SHARED) {
+ if((NULL == orig_type->is_shared) || (NULL == orig_type->get_share))
+ HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, UFAIL, "message class is not sharable")
+ if((is_shared = (orig_type->is_shared)(orig_mesg)) == FALSE) {
+ /*
+ * If the message isn't shared then turn off the shared bit
+ * and treat it as an unshared message.
+ */
+ *mesg_flags &= ~H5O_MSG_FLAG_SHARED;
+ *new_type = orig_type;
+ *new_mesg = orig_mesg;
+ } else if(is_shared > 0) {
+ /* Message is shared. Get shared message, change message type,
+ * and use shared information */
+ HDmemset(sh_mesg, 0, sizeof(H5O_shared_t));
+ if((orig_type->get_share)(f, orig_mesg, sh_mesg/*out*/) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, UFAIL, "can't get shared message")
+
+ *new_type = H5O_MSG_SHARED;
+ *new_mesg = sh_mesg;
+ } else {
+ HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, UFAIL, "can't determine if message is shared")
+ }/* end else */
+ } /* end if */
+ else {
+ *new_type = orig_type;
+ *new_mesg = orig_mesg;
+ } /* end else */
+
+ /* Compute the size needed to store the message on disk */
+ if((size = ((*new_type)->raw_size)(f, *new_mesg)) >= H5O_MESG_MAX_SIZE)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large")
+
+ /* Allocate space in the object header for the message */
+ if((ret_value = H5O_alloc(f, dxpl_id, oh, orig_type, size, oh_flags_ptr)) == UFAIL)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "unable to allocate space for message")
+
+ /* Increment any links in message */
+ if((*new_type)->link && ((*new_type)->link)(f, dxpl_id, (*new_mesg)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, UFAIL, "unable to adjust shared object link count")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_new_mesg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_write_mesg
+ *
+ * Purpose: Write message to object header
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, September 3, 2003
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
+ const H5O_msg_class_t *type, const void *mesg, unsigned mesg_flags,
+ unsigned update_flags, unsigned *oh_flags_ptr)
+{
+ H5O_mesg_t *idx_msg; /* Pointer to message to modify */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5O_write_mesg)
+
+ /* check args */
+ HDassert(f);
+ HDassert(oh);
+ HDassert(type);
+ HDassert(mesg);
+ HDassert(oh_flags_ptr);
+
+ /* Set pointer to the correct message */
+ idx_msg = &oh->mesg[idx];
+
+ /* Reset existing native information */
+ if(!(update_flags & H5O_UPDATE_DATA_ONLY))
+ H5O_msg_reset_real(type, idx_msg->native);
+
+ /* Copy the native value for the message */
+ if(NULL == (idx_msg->native = (type->copy)(mesg, idx_msg->native, update_flags)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy message to object header")
+
+ /* Update the message flags and mark the message as modified */
+ idx_msg->flags = mesg_flags;
+ idx_msg->dirty = TRUE;
+
+ /* Update the modification time message if any */
+ if(update_flags & H5O_UPDATE_TIME)
+ H5O_touch_oh(f, dxpl_id, oh, FALSE, oh_flags_ptr);
+
+ /* Mark the object header as modified */
+ *oh_flags_ptr |= H5AC__DIRTIED_FLAG;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_write_mesg() */
+
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index a403680..0471d5f 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -151,6 +151,24 @@
#define H5O_SIZEOF_CHKSUM_OH(O) \
H5O_SIZEOF_CHKSUM_VERS((O)->version)
+/* Load native information for a message, if it's not already present */
+/* (Only works for messages with decode callback) */
+#define H5O_LOAD_NATIVE(F, DXPL, MSG, ERR) \
+ if(NULL == (MSG)->native) { \
+ const H5O_msg_class_t *decode_type; \
+ \
+ /* Check for shared message */ \
+ if((MSG)->flags & H5O_MSG_FLAG_SHARED) \
+ decode_type = H5O_MSG_SHARED; \
+ else \
+ decode_type = (MSG)->type; \
+ \
+ /* Decode the message */ \
+ HDassert(decode_type->decode); \
+ if(NULL == ((MSG)->native = (decode_type->decode)((F), (DXPL), (MSG)->raw))) \
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message") \
+ } /* end if */
+
struct H5O_msg_class_t {
unsigned id; /*message type ID on disk */
const char *name; /*for debugging */
@@ -376,13 +394,17 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1];
H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh);
H5_DLL herr_t H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_mesg_t *mesg,
hbool_t adj_link);
-H5_DLL herr_t H5O_free_mesg(H5O_mesg_t *mesg);
-H5_DLL void * H5O_free_real(const H5O_msg_class_t *type, void *mesg);
H5_DLL void * H5O_copy_mesg_file(const H5O_msg_class_t *copy_type,
const H5O_msg_class_t *mesg_type, H5F_t *file_src, void *mesg_src,
H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info, void *udata);
H5_DLL const H5O_obj_class_t *H5O_obj_class_real(H5O_t *oh);
+/* Object header message routines */
+H5_DLL void *H5O_msg_read_real(H5F_t *f, H5O_t *oh, unsigned type_id,
+ int sequence, void *mesg, hid_t dxpl_id);
+H5_DLL void *H5O_msg_free_real(const H5O_msg_class_t *type, void *mesg);
+H5_DLL herr_t H5O_msg_free_mesg(H5O_mesg_t *mesg);
+
/* Object header allocation routines */
H5_DLL unsigned H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
const H5O_msg_class_t *type, size_t size, hbool_t * oh_dirtied_ptr);
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 7210876..e95863b 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -622,7 +622,7 @@ H5O_pline_get_share(H5F_t UNUSED *f, const void *_mesg,
HDassert (mesg);
HDassert (sh);
- if(NULL == H5O_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh))
ret_value = FAIL;
FUNC_LEAVE_NOAPI(ret_value)
@@ -655,7 +655,7 @@ H5O_pline_set_share(H5F_t UNUSED *f, void *_mesg/*in,out*/,
HDassert (mesg);
HDassert (sh);
- if(NULL == H5O_copy(H5O_SHARED_ID, sh, &(mesg->sh_loc)))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, sh, &(mesg->sh_loc)))
ret_value = FAIL;
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index acb291f..cd821db 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -388,18 +388,9 @@ H5_DLL int H5O_count(H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id);
H5_DLL htri_t H5O_exists(H5O_loc_t *loc, unsigned type_id, int sequence,
hid_t dxpl_id);
H5_DLL htri_t H5O_exists_oh(struct H5O_t *oh, unsigned type_id, int sequence);
-H5_DLL herr_t H5O_msg_create(H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
- unsigned update_flags, void *mesg, hid_t dxpl_id);
-H5_DLL void *H5O_read(const H5O_loc_t *loc, unsigned type_id, int sequence,
- void *mesg, hid_t dxpl_id);
-H5_DLL herr_t H5O_write(H5O_loc_t *loc, unsigned type_id, unsigned overwrite,
- unsigned flags, unsigned update_flags, void *mesg, hid_t dxpl_id);
H5_DLL struct H5O_t *H5O_protect(H5O_loc_t *loc, hid_t dxpl_id);
H5_DLL herr_t H5O_unprotect(H5O_loc_t *loc, struct H5O_t *oh, hid_t dxpl_id,
unsigned oh_flags);
-H5_DLL herr_t H5O_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, unsigned type_id,
- unsigned mesg_flags, unsigned update_flags, void *mesg,
- unsigned *oh_flags_ptr);
H5_DLL herr_t H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id);
H5_DLL herr_t H5O_touch_oh(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh,
hbool_t force, unsigned *oh_flags_ptr);
@@ -412,12 +403,9 @@ H5_DLL herr_t H5O_remove(H5O_loc_t *loc, unsigned type_id, int sequence,
hbool_t adj_link, hid_t dxpl_id);
H5_DLL herr_t H5O_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence,
H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id);
-H5_DLL herr_t H5O_reset(unsigned type_id, void *native);
-H5_DLL void *H5O_free(unsigned type_id, void *mesg);
H5_DLL herr_t H5O_encode(H5F_t *f, unsigned char *buf, const void *obj, unsigned type_id);
H5_DLL void* H5O_decode(H5F_t *f, hid_t dxpl_id, const unsigned char *buf,
unsigned type_id);
-H5_DLL void *H5O_copy(unsigned type_id, const void *mesg, void *dst);
H5_DLL size_t H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg);
H5_DLL size_t H5O_mesg_size(unsigned type_id, const H5F_t *f, const void *mesg,
size_t extra_raw);
@@ -431,9 +419,23 @@ H5_DLL herr_t H5O_get_info(H5O_loc_t *oloc, H5O_info_t *oinfo, hid_t dxpl_id);
H5_DLL herr_t H5O_iterate(const H5O_loc_t *loc, unsigned type_id, H5O_operator_t op,
void *op_data, hid_t dxpl_id);
H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id);
-H5_DLL uint32_t H5O_mesg_hash(unsigned type_id, H5F_t *f, const void *mesg);
H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, struct H5P_genplist_t *oc_plist);
+/* Object header message routines */
+H5_DLL herr_t H5O_msg_create(H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
+ unsigned update_flags, void *mesg, hid_t dxpl_id);
+H5_DLL herr_t H5O_msg_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, unsigned type_id,
+ unsigned mesg_flags, unsigned update_flags, void *mesg,
+ unsigned *oh_flags_ptr);
+H5_DLL herr_t H5O_msg_write(H5O_loc_t *loc, unsigned type_id, unsigned overwrite,
+ unsigned flags, unsigned update_flags, void *mesg, hid_t dxpl_id);
+H5_DLL void *H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, int sequence,
+ void *mesg, hid_t dxpl_id);
+H5_DLL herr_t H5O_msg_reset(unsigned type_id, void *native);
+H5_DLL void *H5O_msg_free(unsigned type_id, void *mesg);
+H5_DLL void *H5O_msg_copy(unsigned type_id, const void *mesg, void *dst);
+H5_DLL uint32_t H5O_msg_hash(unsigned type_id, H5F_t *f, const void *mesg);
+
/* Object copying routines */
H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
hid_t dxpl_id, H5O_copy_t *cpy_info, hbool_t inc_depth);
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index bd2ee8d..750ad4a 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -475,7 +475,7 @@ H5O_sdspace_get_share(H5F_t UNUSED *f, const void *_mesg,
HDassert (mesg);
HDassert (sh);
- if(NULL == H5O_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh))
ret_value = FAIL;
FUNC_LEAVE_NOAPI(ret_value)
@@ -508,7 +508,7 @@ H5O_sdspace_set_share(H5F_t UNUSED *f, void *_mesg/*in,out*/,
HDassert (mesg);
HDassert (sh);
- if(NULL == H5O_copy(H5O_SHARED_ID, sh, &(mesg->sh_loc)))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, sh, &(mesg->sh_loc)))
ret_value = FAIL;
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 108e74e..1a1ca21 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -90,10 +90,10 @@ const H5O_msg_class_t H5O_MSG_SHARED[1] = {{
* Purpose: Reads a message referred to by a shared message.
*
* Return: Success: Ptr to message in native format. The message
- * should be freed by calling H5O_reset(). If
+ * should be freed by calling H5O_msg_reset(). If
* MESG is a null pointer then the caller should
* also call H5MM_xfree() on the return value
- * after calling H5O_reset().
+ * after calling H5O_msg_reset().
*
* Failure: NULL
*
@@ -162,7 +162,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *shared,
HDassert(shared->flags & H5O_COMMITTED_FLAG);
/* Get the shared message from an object header */
- if(NULL == (ret_value = H5O_read(&(shared->u.oloc), type->id, 0, mesg, dxpl_id)))
+ if(NULL == (ret_value = H5O_msg_read(&(shared->u.oloc), type->id, 0, mesg, dxpl_id)))
HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message")
} /* end else */
@@ -175,7 +175,7 @@ done:
HDfree(buf);
if(native_mesg)
- H5O_free(type->id, native_mesg);
+ H5O_msg_free(type->id, native_mesg);
if(fheap)
if(H5HF_close(fheap, dxpl_id) < 0)
@@ -530,8 +530,8 @@ H5O_shared_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg,
* Committed datatypes increment the OH of the original message when they
* are written (in H5O_shared_link) and decrement it here.
* SOHMs in the heap behave differently; their refcount is incremented
- * during H5SM_share when they are going to be written (in H5O_append
- * or H5O_write). Their refcount in the SOHM indexes still needs to
+ * during H5SM_share when they are going to be written (in H5O_msg_append
+ * or H5O_msg_write). Their refcount in the SOHM indexes still needs to
* be decremented when they're deleted (in H5O_shared_link_adj).
*/
@@ -632,7 +632,7 @@ H5O_shared_pre_copy_file(H5F_t *file_src, const H5O_msg_class_t *type,
done:
if(mesg_native)
- H5O_free_real(type, mesg_native);
+ H5O_msg_free_real(type, mesg_native);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_shared_pre_copy_file() */
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 8c95b43..6df13c0 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -247,7 +247,7 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
/* Make copies of fill value, external file list, and data pipeline */
if(src_fill.buf) {
- if(NULL == H5O_copy(H5O_FILL_ID, &src_fill, &dst_fill))
+ if(NULL == H5O_msg_copy(H5O_FILL_ID, &src_fill, &dst_fill))
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy fill value")
} /* end if */
else {
@@ -255,9 +255,9 @@ H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
dst_fill.size = src_fill.size;
} /* end else */
HDmemset(&dst_efl, 0, sizeof(H5O_efl_t));
- if(NULL == H5O_copy(H5O_EFL_ID, &src_efl, &dst_efl))
+ if(NULL == H5O_msg_copy(H5O_EFL_ID, &src_efl, &dst_efl))
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy external file list")
- if(NULL == H5O_copy(H5O_PLINE_ID, &src_pline, &dst_pline))
+ if(NULL == H5O_msg_copy(H5O_PLINE_ID, &src_pline, &dst_pline))
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy data pipeline")
/* Set the fill value, external file list, and data pipeline property
@@ -316,11 +316,11 @@ H5P_dcrt_close(hid_t dcpl_id, void UNUSED *close_data)
/* Clean up any values set for the fill-value, external file-list and
* data pipeline */
- if(H5O_reset(H5O_FILL_ID, &fill) < 0)
+ if(H5O_msg_reset(H5O_FILL_ID, &fill) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release fill info")
- if(H5O_reset(H5O_EFL_ID, &efl) < 0)
+ if(H5O_msg_reset(H5O_EFL_ID, &efl) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release external file list info")
- if(H5O_reset(H5O_PLINE_ID, &pline) < 0)
+ if(H5O_msg_reset(H5O_PLINE_ID, &pline) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release pipeline info")
done:
@@ -2012,7 +2012,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
/* Reset the fill structure */
- if(H5O_reset(H5O_FILL_ID, &fill)<0)
+ if(H5O_msg_reset(H5O_FILL_ID, &fill)<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset fill value");
if(value) {
diff --git a/src/H5S.c b/src/H5S.c
index 7cd960a..42c70ca 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -643,7 +643,7 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src)
}
/* Copy the shared object info */
- if(NULL == H5O_copy(H5O_SHARED_ID, &(src->sh_loc), &(dst->sh_loc)))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(src->sh_loc), &(dst->sh_loc)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy shared information");
done:
@@ -1055,7 +1055,7 @@ H5S_write(H5O_loc_t *loc, const H5S_t *ds, hbool_t update_time, hid_t dxpl_id)
case H5S_NULL:
case H5S_SCALAR:
case H5S_SIMPLE:
- if(H5O_write(loc, H5O_SDSPACE_ID, 0, 0, update_time, &(ds->extent), dxpl_id) < 0)
+ if(H5O_msg_write(loc, H5O_SDSPACE_ID, 0, 0, update_time, &(ds->extent), dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update simple dataspace message")
break;
@@ -1106,7 +1106,7 @@ H5S_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, const H5S_t *ds,
case H5S_NULL:
case H5S_SCALAR:
case H5S_SIMPLE:
- if(H5O_append(f, dxpl_id, oh, H5O_SDSPACE_ID, 0, 0, &(ds->extent), oh_flags_ptr) < 0)
+ if(H5O_msg_append(f, dxpl_id, oh, H5O_SDSPACE_ID, 0, 0, &(ds->extent), oh_flags_ptr) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update simple data space message")
break;
@@ -1148,7 +1148,7 @@ H5S_read(const H5O_loc_t *loc, hid_t dxpl_id)
if(NULL == (ds = H5FL_CALLOC(H5S_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- if(H5O_read(loc, H5O_SDSPACE_ID, 0, &(ds->extent), dxpl_id) == NULL)
+ if(H5O_msg_read(loc, H5O_SDSPACE_ID, 0, &(ds->extent), dxpl_id) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to load dataspace info from dataset header")
/* Default to entire dataspace being selected */
@@ -1877,7 +1877,7 @@ H5S_decode(const unsigned char *buf)
/* Copy the extent into dataspace structure */
if((ds = H5FL_CALLOC(H5S_t))==NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for data space conversion path table")
- if(H5O_copy(H5O_SDSPACE_ID, extent, &(ds->extent)) == NULL)
+ if(H5O_msg_copy(H5O_SDSPACE_ID, extent, &(ds->extent)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object")
if(H5S_extent_release(extent) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace")
diff --git a/src/H5T.c b/src/H5T.c
index 0b636be..76619b1 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -3275,7 +3275,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
if(old_dt->sh_loc.flags & H5O_SHARED_IN_HEAP_FLAG ||
new_dt->shared->state == H5T_STATE_NAMED || new_dt->shared->state == H5T_STATE_OPEN)
{
- if(NULL == H5O_copy(H5O_SHARED_ID, &(old_dt->sh_loc), &(new_dt->sh_loc)))
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, &(old_dt->sh_loc), &(new_dt->sh_loc)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to copy shared location")
}
else
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index efe1d92..1417638 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -790,7 +790,7 @@ H5T_open_oid(H5G_loc_t *loc, hid_t dxpl_id)
if(H5O_open(loc->oloc) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype")
- if(NULL == (dt = H5O_read(loc->oloc, H5O_DTYPE_ID, 0, NULL, dxpl_id)))
+ if(NULL == (dt = H5O_msg_read(loc->oloc, H5O_DTYPE_ID, 0, NULL, dxpl_id)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header")
/* Mark the type as named and open */
diff --git a/src/H5Z.c b/src/H5Z.c
index b83377d..817d33c 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -1162,7 +1162,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter)
/* Delete all filters */
if(H5Z_FILTER_ALL == filter) {
- if(H5O_reset(H5O_PLINE_ID, pline) < 0)
+ if(H5O_msg_reset(H5O_PLINE_ID, pline) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTFREE, FAIL, "can't release pipeline info")
} /* end if */
/* Delete filter */
diff --git a/src/Makefile.am b/src/Makefile.am
index d7fdb0d..099efbe 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -61,7 +61,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Obogus.c H5Ocache.c \
H5Ocont.c H5Ocopy.c H5Odbg.c H5Odtype.c H5Oefl.c H5Ofill.c H5Oginfo.c \
H5Olayout.c \
- H5Olinfo.c H5Olink.c H5Omtime.c \
+ H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \
H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \
H5P.c H5Pacpl.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
H5Pgcpl.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index cf86dba..5dd5fda 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -101,7 +101,7 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5MP.lo H5MPtest.lo H5L.lo H5Lexternal.lo H5O.lo H5Oalloc.lo \
H5Oattr.lo H5Obogus.lo H5Ocache.lo H5Ocont.lo H5Ocopy.lo \
H5Odbg.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Oginfo.lo \
- H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omtime.lo H5Oname.lo \
+ H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo H5Oname.lo \
H5Onull.lo H5Opline.lo H5Osdspace.lo H5Oshared.lo H5Ostab.lo \
H5P.lo H5Pacpl.lo H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo \
H5Pfmpl.lo H5Pgcpl.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo \
@@ -417,7 +417,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Obogus.c H5Ocache.c \
H5Ocont.c H5Ocopy.c H5Odbg.c H5Odtype.c H5Oefl.c H5Ofill.c H5Oginfo.c \
H5Olayout.c \
- H5Olinfo.c H5Olink.c H5Omtime.c \
+ H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \
H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \
H5P.c H5Pacpl.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
H5Pgcpl.c \
@@ -670,6 +670,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Olayout.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Olinfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Olink.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Omessage.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Omtime.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oname.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Onull.Plo@am__quote@