summaryrefslogtreecommitdiffstats
path: root/src/H5Dlayout.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-03-15 21:54:30 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-03-15 21:54:30 (GMT)
commit4a17aff4085ad6ee265b95730aca3f493056dec8 (patch)
tree8bfb665c6d95a2e3520fa1bb0ff54d95aff3923f /src/H5Dlayout.c
parent853ae26333592faf69cd8c454ef92ffea8549df5 (diff)
downloadhdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.zip
hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.tar.gz
hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.tar.bz2
Add API context interface and use it throughout the library.
Diffstat (limited to 'src/H5Dlayout.c')
-rw-r--r--src/H5Dlayout.c64
1 files changed, 34 insertions, 30 deletions
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index ec18e86..a591957 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -25,6 +25,7 @@
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5HLprivate.h" /* Local heaps */
+#include "H5MMprivate.h" /* Memory management */
/****************/
@@ -454,8 +455,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
- hid_t dapl_id)
+H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
{
H5O_layout_t *layout; /* Dataset's layout information */
const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
@@ -463,7 +463,7 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_TAG(dxpl_id, dset->oloc.addr, FAIL)
+ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
/* Sanity checking */
HDassert(file);
@@ -479,12 +479,12 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
H5O_pline_t *pline; /* Dataset's I/O pipeline information */
pline = &dset->shared->dcpl_cache.pline;
- if(pline->nused > 0 && H5O_msg_append_oh(file, dxpl_id, oh, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, pline) < 0)
+ if(pline->nused > 0 && H5O_msg_append_oh(file, oh, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, pline) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message")
} /* end if */
/* Initialize the layout information for the new dataset */
- if(dset->shared->layout.ops->init && (dset->shared->layout.ops->init)(file, dxpl_id, dset, dapl_id) < 0)
+ if(dset->shared->layout.ops->init && (dset->shared->layout.ops->init)(file, dset, dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information")
/* Indicate that the layout information was initialized */
@@ -498,12 +498,11 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
H5D_io_info_t io_info;
io_info.dset = dset;
- io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id;
- io_info.md_dxpl_id = dxpl_id;
if(H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage")
- }
+ } /* end if */
+
/* Update external storage message, if it's used */
if(dset->shared->dcpl_cache.efl.nused > 0) {
H5O_efl_t *efl = &dset->shared->dcpl_cache.efl; /* Dataset's external file list */
@@ -516,15 +515,15 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
heap_size += H5HL_ALIGN(HDstrlen(efl->slot[u].name) + 1);
/* Create the heap for the EFL file names */
- if(H5HL_create(file, dxpl_id, heap_size, &efl->heap_addr/*out*/) < 0)
+ if(H5HL_create(file, heap_size, &efl->heap_addr/*out*/) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create EFL file name heap")
/* Pin the heap down in memory */
- if(NULL == (heap = H5HL_protect(file, dxpl_id, efl->heap_addr, H5AC__NO_FLAGS_SET)))
+ if(NULL == (heap = H5HL_protect(file, efl->heap_addr, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect EFL file name heap")
/* Insert "empty" name first */
- if(UFAIL == H5HL_insert(file, dxpl_id, heap, (size_t)1, "")) {
+ if(UFAIL == H5HL_insert(file, heap, (size_t)1, "")) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
} /* end if */
@@ -533,7 +532,7 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
size_t offset; /* Offset of file name in heap */
/* Insert file name into heap */
- if(UFAIL == (offset = H5HL_insert(file, dxpl_id, heap,
+ if(UFAIL == (offset = H5HL_insert(file, heap,
HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
@@ -549,11 +548,10 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
heap = NULL;
/* Insert EFL message into dataset object header */
- if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_EFL_ID, H5O_MSG_FLAG_CONSTANT, 0, efl) < 0)
+ if(H5O_msg_append_oh(file, oh, H5O_EFL_ID, H5O_MSG_FLAG_CONSTANT, 0, efl) < 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 and non-filtered, since space may not be allocated) */
/* (Note: this is relying on H5D__alloc_storage not calling H5O_msg_write during dataset creation) */
if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY && H5D_COMPACT != layout->type
@@ -561,7 +559,14 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset,
layout_mesg_flags = H5O_MSG_FLAG_CONSTANT;
else
layout_mesg_flags = 0;
- if(H5O_msg_append_oh(file, dxpl_id, oh, H5O_LAYOUT_ID, layout_mesg_flags, 0, layout) < 0)
+
+ /* Store VDS info in global heap */
+ if(H5D_VIRTUAL == layout->type)
+ if(H5D__virtual_store_layout(file, layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to store VDS info")
+
+ /* Create layout message */
+ if(H5O_msg_append_oh(file, oh, H5O_LAYOUT_ID, layout_mesg_flags, 0, layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout")
done:
@@ -569,10 +574,10 @@ done:
if(ret_value < 0)
if(layout_init)
/* Destroy any cached layout information for the dataset */
- if(dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset, dxpl_id) < 0)
+ if(dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info")
- FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__layout_oh_create() */
@@ -590,7 +595,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t *plist)
+H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist)
{
htri_t msg_exists; /* Whether a particular type of message exists */
hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */
@@ -603,11 +608,11 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t
HDassert(plist);
/* Get the optional filters message */
- if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_PLINE_ID, dxpl_id)) < 0)
+ if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_PLINE_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists")
if(msg_exists) {
/* Retrieve the I/O pipeline message */
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline, dxpl_id))
+ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message")
/* Set the I/O pipeline info in the property list */
@@ -621,16 +626,16 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t
* values are copied to the dataset create plist so the user can query
* them.
*/
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout), dxpl_id))
+ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message")
layout_copied = TRUE;
/* Check for external file list message (which might not exist) */
- if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_EFL_ID, dxpl_id)) < 0)
+ if((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_EFL_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists")
if(msg_exists) {
/* Retrieve the EFL message */
- if(NULL == H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, &dataset->shared->dcpl_cache.efl, dxpl_id))
+ if(NULL == H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, &dataset->shared->dcpl_cache.efl))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message")
/* Set the EFL info in the property list */
@@ -645,7 +650,7 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t
HDassert(dataset->shared->layout.ops);
/* Initialize the layout information for the dataset */
- if(dataset->shared->layout.ops->init && (dataset->shared->layout.ops->init)(dataset->oloc.file, dxpl_id, dataset, dapl_id) < 0)
+ if(dataset->shared->layout.ops->init && (dataset->shared->layout.ops->init)(dataset->oloc.file, dataset, dapl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information")
/* Adjust chunk dimensions to omit datatype size (in last dimension) for creation property */
@@ -657,16 +662,15 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout")
/* Set chunk sizes */
- if(H5D_CHUNKED == dataset->shared->layout.type) {
+ if(H5D_CHUNKED == dataset->shared->layout.type)
if(H5D__chunk_set_sizes(dataset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes")
- }
done:
- if(ret_value < 0 && layout_copied) {
+ if(ret_value < 0 && layout_copied)
if(H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info")
- }
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_oh_read() */
@@ -685,7 +689,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__layout_oh_write(H5D_t *dataset, hid_t dxpl_id, H5O_t *oh, unsigned update_flags)
+H5D__layout_oh_write(H5D_t *dataset, H5O_t *oh, unsigned update_flags)
{
htri_t msg_exists; /* Whether the layout message exists */
herr_t ret_value = SUCCEED; /* Return value */
@@ -701,7 +705,7 @@ H5D__layout_oh_write(H5D_t *dataset, hid_t dxpl_id, H5O_t *oh, unsigned update_f
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to check if layout message exists")
if(msg_exists) {
/* Write the layout message to the dataset's header */
- if(H5O_msg_write_oh(dataset->oloc.file, dxpl_id, oh, H5O_LAYOUT_ID, 0, update_flags, &dataset->shared->layout) < 0)
+ if(H5O_msg_write_oh(dataset->oloc.file, oh, H5O_LAYOUT_ID, 0, update_flags, &dataset->shared->layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout message")
} /* end if */