summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2013-07-17 20:41:08 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2013-07-17 20:41:08 (GMT)
commit9af20ef8d82f5d87f9aaba9543f476752f5e8b9a (patch)
tree3caf610df8d217cfeb71454a9cd43afbec49636a
parent0f09f4d6ff35e023e863e226286ee239e4a408fb (diff)
downloadhdf5-9af20ef8d82f5d87f9aaba9543f476752f5e8b9a.zip
hdf5-9af20ef8d82f5d87f9aaba9543f476752f5e8b9a.tar.gz
hdf5-9af20ef8d82f5d87f9aaba9543f476752f5e8b9a.tar.bz2
[svn-r23913] some refactoring of the server side access to IOD
-rw-r--r--src/H5VLiod_attr.c355
-rw-r--r--src/H5VLiod_dset.c297
-rw-r--r--src/H5VLiod_dtype.c153
-rw-r--r--src/H5VLiod_file.c158
-rw-r--r--src/H5VLiod_group.c119
-rw-r--r--src/H5VLiod_map.c49
-rw-r--r--src/H5VLiod_obj.c2
-rw-r--r--src/H5VLiod_server.c315
-rw-r--r--src/H5VLiod_server.h27
9 files changed, 787 insertions, 688 deletions
diff --git a/src/H5VLiod_attr.c b/src/H5VLiod_attr.c
index 8565882..dd8c786 100644
--- a/src/H5VLiod_attr.c
+++ b/src/H5VLiod_attr.c
@@ -47,19 +47,17 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine,
op_data_t *op_data = (op_data_t *)_op_data;
attr_create_in_t *input = (attr_create_in_t *)op_data->input;
attr_create_out_t output;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_handle = input->loc_oh;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */
iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */
iod_obj_id_t attr_id = input->attr_id; /* The ID of the attribute that needs to be created */
- iod_handle_t attr_oh, attr_kv_oh, cur_oh, mdkv_oh;
+ iod_handle_t attr_oh, attr_kv_oh, cur_oh, mdkv_oh; /* object handles */
iod_obj_id_t cur_id, mdkv_id;
- const char *loc_name = input->path;
- const char *attr_name = input->attr_name;
- char *last_comp = NULL;
- iod_array_struct_t array;
- iod_size_t *max_dims;
- iod_kv_t kv;
- size_t buf_size;
+ const char *loc_name = input->path; /* path to start hierarchy traversal */
+ const char *attr_name = input->attr_name; /* attribute's name */
+ char *last_comp = NULL; /* the last component's name where attribute is created */
+ iod_array_struct_t array; /* IOD array structure for attribute's creation */
+ iod_size_t *max_dims; /* MAX dims for IOD */
scratch_pad_t sp;
iod_ret_t ret;
hbool_t collective = FALSE; /* MSC - change when we allow for collective */
@@ -121,45 +119,26 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine,
if (iod_obj_set_scratch(attr_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad");
- /* Store Metadata in scratch pad */
+ /* Open Metadata KV object for write */
if (iod_obj_open_write(coh, mdkv_id, NULL, &mdkv_oh, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad");
+ /* insert object type metadata */
+ if(H5VL_iod_insert_object_type(mdkv_oh, IOD_TID_UNKNOWN, H5I_ATTR,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
/* MSC - need to check size of datatype if it fits in
entry otherwise create a BLOB*/
- /* insert datatype metadata into scratch pad */
- kv.key = strdup("dtype");
- /* determine the buffer size needed to store the encoded type of the attribute */
- if(H5Tencode(input->type_id, NULL, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode attribute type");
- if(NULL == (kv.value = malloc (buf_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate type buffer");
- /* encode datatype of the attribute */
- if(H5Tencode(input->type_id, kv.value, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode attribute type");
- kv.value_len = (iod_size_t)buf_size;
- /* insert kv pair into scratch pad */
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
-
- /* insert dataspace metadata into scratch pad */
- kv.key = strdup("dspace");
- /* determine the buffer size needed to store the encoded space of the attribute */
- if(H5Sencode(input->space_id, NULL, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode attribute space");
- if(NULL == (kv.value = malloc (buf_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate space buffer");
- /* encode dataspace of the attribute */
- if(H5Sencode(input->space_id, kv.value, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode attribute space");
- kv.value_len = (iod_size_t)buf_size;
- /* insert kv pair into scratch pad */
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
+ /* insert datatype metadata */
+ if(H5VL_iod_insert_datatype(mdkv_oh, IOD_TID_UNKNOWN, input->type_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
+ /* insert dataspace metadata */
+ if(H5VL_iod_insert_dataspace(mdkv_oh, IOD_TID_UNKNOWN, input->space_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
/* close the Metadata KV object */
if(iod_obj_close(mdkv_oh, NULL, NULL))
@@ -174,14 +153,13 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine,
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
/* insert new attribute in scratch pad of current object */
- kv.key = HDstrdup(attr_name);
- kv.value = &attr_id;
- kv.value_len = 0;
- if (iod_kv_set(attr_kv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- HDfree(kv.key);
-
- iod_obj_close(attr_kv_oh, NULL, NULL);
+ if(H5VL_iod_insert_new_link(attr_kv_oh, IOD_TID_UNKNOWN, attr_name, attr_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
+ /* close the Attribute KV object */
+ if(iod_obj_close(attr_kv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
}
/* close parent group if it is not the location we started the
@@ -244,17 +222,16 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine,
op_data_t *op_data = (op_data_t *)_op_data;
attr_open_in_t *input = (attr_open_in_t *)op_data->input;
attr_open_out_t output;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_handle = input->loc_oh;
- iod_obj_id_t loc_id = input->loc_id;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t loc_handle = input->loc_oh; /* location handle to start traversal */
+ iod_obj_id_t loc_id = input->loc_id; /* location ID */
iod_handle_t attr_kv_oh, cur_oh, mdkv_oh;
iod_obj_id_t cur_id, mdkv_id;
iod_obj_id_t attr_id;
- const char *loc_name = input->path;
- const char *attr_name = input->attr_name;
- char *last_comp = NULL;
+ const char *loc_name = input->path; /* current path to start traversal */
+ const char *attr_name = input->attr_name; /* attribute's name to open */
+ char *last_comp = NULL; /* name of last object in path */
scratch_pad_t sp;
- iod_size_t kv_size = 0;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
@@ -311,34 +288,13 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine,
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
#if 0
- /* read the attributes's datatype */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dtype", NULL,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dtype lookup failed");
- if(NULL == (buf = H5MM_malloc (kv_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dtype buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dtype", buf,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "attribute dtype lookup failed");
- if((output.type_id = H5Tdecode(buf)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode datatype");
- free(buf);
- buf = NULL;
-
- kv_size = 0;
- /* read the attributes's dataspace */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dspace", NULL,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dspace lookup failed");
- if(NULL == (buf = H5MM_malloc (kv_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dspace buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dspace", buf,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "attribute dspace lookup failed");
- if((output.space_id = H5Tdecode(buf)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode dataspace");
- free(buf);
- buf = NULL;
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_DATATYPE, "datatype",
+ NULL, NULL, NULL, &output.type_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve datatype");
+
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_DATASPACE, "dataspace",
+ NULL, NULL, NULL, &output.space_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace");
#endif
/* close the metadata scratch pad */
@@ -417,22 +373,24 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine,
{
op_data_t *op_data = (op_data_t *)_op_data;
attr_io_in_t *input = (attr_io_in_t *)op_data->input;
- iod_handle_t coh = input->coh;
- iod_handle_t iod_oh = input->iod_oh;
- iod_obj_id_t iod_id = input->iod_id;
- hg_bulk_t bulk_handle = input->bulk_handle;
- hid_t type_id = input->type_id;
- hg_bulk_block_t bulk_block_handle;
- hg_bulk_request_t bulk_request;
- iod_mem_desc_t mem_desc;
- iod_array_iodesc_t file_desc;
- iod_hyperslab_t hslabs;
- size_t size;
- void *buf;
- hid_t space_id;
- hssize_t num_descriptors = 0;
- na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle);
- hbool_t opened_locally = FALSE;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t iod_oh = input->iod_oh; /* attribute's object handle */
+ iod_obj_id_t iod_id = input->iod_id; /* attribute's ID */
+ hg_bulk_t bulk_handle = input->bulk_handle; /* bulk handle for data */
+ hid_t type_id = input->type_id; /* datatype ID of data */
+ hg_bulk_block_t bulk_block_handle; /* HG block handle */
+ hg_bulk_request_t bulk_request; /* HG request */
+ iod_mem_desc_t mem_desc; /* memory descriptor used for reading array */
+ iod_array_iodesc_t file_desc; /* file descriptor used to read array */
+ iod_hyperslab_t hslabs; /* IOD hyperslab generated from HDF5 filespace */
+ size_t size; /* size of outgoing bulk data */
+ void *buf; /* buffer to hold outgoing data */
+ hid_t space_id; /* dataspace ID of attribute */
+ iod_handle_t mdkv_oh; /* metadata KV handle of attribute */
+ scratch_pad_t sp;
+ hssize_t num_descriptors = 0; /* number of IOD file descriptors needed to describe filespace selection */
+ na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle); /* destination address to push data to */
+ hbool_t opened_locally = FALSE; /* flag to indicate whether we opened the attribute here or if it was already open */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
@@ -449,40 +407,23 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine,
if(NULL == (buf = malloc(size)))
HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
- /* MSC - remove now till we have an IOD */
+ /* MSC - NEED IOD */
#if 0
- {
- iod_handle_t mdkv_oh;
- scratch_pad_t sp;
- iod_size_t kv_size = 0;
- void *space_buf = NULL;
+ /* get scratch pad of the attribute */
+ if(iod_obj_get_scratch(iod_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
- /* get scratch pad of the attribute */
- if(iod_obj_get_scratch(iod_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+ /* open the metadata scratch pad of the attribute */
+ if (iod_obj_open_write(coh, sp.mdkv_id, NULL /*hints*/, &mdkv_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
- /* open the metadata scratch pad of the attribute */
- if (iod_obj_open_write(coh, sp.mdkv_id, NULL /*hints*/, &mdkv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
-
- /* read the attributes's dataspace */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dspace", NULL,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dspace lookup failed");
- if(NULL == (space_buf = H5MM_malloc (kv_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dspace buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dspace", space_buf,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "attribute dspace lookup failed");
- if((space_id = H5Tdecode(space_buf)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode dataspace");
- free(space_buf);
- space_buf = NULL;
-
- /* close the metadata scratch pad */
- if(iod_obj_close(mdkv_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- }
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_DATASPACE, "dataspace",
+ NULL, NULL, NULL, &space_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace");
+
+ /* close the metadata scratch pad */
+ if(iod_obj_close(mdkv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
/* create memory descriptor for reading */
mem_desc.nfrag = 1;
@@ -580,23 +521,24 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine,
{
op_data_t *op_data = (op_data_t *)_op_data;
attr_io_in_t *input = (attr_io_in_t *)op_data->input;
- iod_handle_t coh = input->coh;
- iod_handle_t iod_oh = input->iod_oh;
- iod_obj_id_t iod_id = input->iod_id;
- hg_bulk_t bulk_handle = input->bulk_handle;
- hid_t type_id = input->type_id;
- hg_bulk_block_t bulk_block_handle;
- hg_bulk_request_t bulk_request;
- iod_mem_desc_t mem_desc;
- iod_array_iodesc_t file_desc;
- iod_hyperslab_t hslabs;
- size_t size;
- void *buf;
- ssize_t ret;
- hid_t space_id;
- hssize_t num_descriptors = 0;
- na_addr_t source = HG_Handler_get_addr(op_data->hg_handle);
- hbool_t opened_locally = FALSE;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t iod_oh = input->iod_oh; /* attribute's object handle */
+ iod_obj_id_t iod_id = input->iod_id; /* attribute's ID */
+ hg_bulk_t bulk_handle = input->bulk_handle; /* bulk handle for data */
+ hid_t type_id = input->type_id; /* datatype ID of data */
+ hg_bulk_block_t bulk_block_handle; /* HG block handle */
+ hg_bulk_request_t bulk_request; /* HG request */
+ iod_mem_desc_t mem_desc; /* memory descriptor used for writing array */
+ iod_array_iodesc_t file_desc; /* file descriptor used to write array */
+ iod_hyperslab_t hslabs; /* IOD hyperslab generated from HDF5 filespace */
+ size_t size; /* size of outgoing bulk data */
+ void *buf; /* buffer to hold outgoing data */
+ hid_t space_id; /* dataspace ID of attribute */
+ scratch_pad_t sp;
+ iod_handle_t mdkv_oh; /* metadata KV handle of attribute */
+ hssize_t num_descriptors = 0; /* number of IOD file descriptors needed to describe filespace selection*/
+ na_addr_t source = HG_Handler_get_addr(op_data->hg_handle); /* source address to pull data from */
+ hbool_t opened_locally = FALSE; /* flag to indicate whether we opened the attribute here or if it was already opened */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
@@ -637,40 +579,23 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine,
}
#endif
- /* MSC - remove now till we have an IOD */
+ /* MSC - NEED IOD */
#if 0
- {
- iod_handle_t mdkv_oh;
- scratch_pad_t sp;
- iod_size_t kv_size = 0;
- void *space_buf = NULL;
+ /* get scratch pad of the attribute */
+ if(iod_obj_get_scratch(iod_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
- /* get scratch pad of the attribute */
- if(iod_obj_get_scratch(iod_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+ /* open the metadata scratch pad of the attribute */
+ if (iod_obj_open_write(coh, sp.mdkv_id, NULL /*hints*/, &mdkv_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
- /* open the metadata scratch pad of the attribute */
- if (iod_obj_open_write(coh, sp.mdkv_id, NULL /*hints*/, &mdkv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
-
- /* read the attributes's dataspace */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dspace", NULL,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dspace lookup failed");
- if(NULL == (space_buf = H5MM_malloc (kv_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dspace buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dspace", space_buf,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "attribute dspace lookup failed");
- if((space_id = H5Tdecode(space_buf)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode dataspace");
- free(space_buf);
- space_buf = NULL;
-
- /* close the metadata scratch pad */
- if(iod_obj_close(mdkv_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- }
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_DATASPACE, "dataspace",
+ NULL, NULL, NULL, &space_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace");
+
+ /* close the metadata scratch pad */
+ if(iod_obj_close(mdkv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
mem_desc.nfrag = 1;
mem_desc.frag->addr = buf;
@@ -745,14 +670,15 @@ H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine,
{
op_data_t *op_data = (op_data_t *)_op_data;
attr_op_in_t *input = (attr_op_in_t *)op_data->input;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_handle = input->loc_oh;
- iod_obj_id_t loc_id = input->loc_id;
- iod_handle_t cur_oh, attr_kv_oh;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */
+ iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */
+ iod_handle_t cur_oh; /* current object handle accessed */
+ iod_handle_t attr_kv_oh; /* KV handle holding attributes for object */
iod_obj_id_t cur_id, attr_id;
- const char *loc_name = input->path;
- const char *attr_name = input->attr_name;
- char *last_comp = NULL;
+ const char *loc_name = input->path; /* path to start hierarchy traversal */
+ const char *attr_name = input->attr_name; /* attribute's name */
+ char *last_comp = NULL; /* the last component's name where attribute is created */
scratch_pad_t sp;
htri_t ret = -1;
herr_t ret_value = SUCCEED;
@@ -847,17 +773,18 @@ H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine,
{
op_data_t *op_data = (op_data_t *)_op_data;
attr_rename_in_t *input = (attr_rename_in_t *)op_data->input;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_handle = input->loc_oh;
- iod_obj_id_t loc_id = input->loc_id;
- iod_handle_t cur_oh, attr_kv_oh;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */
+ iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */
+ iod_handle_t cur_oh; /* current object handle accessed */
+ iod_handle_t attr_kv_oh; /* KV handle holding attributes for object */
iod_obj_id_t cur_id, attr_id;
- const char *loc_name = input->path;
+ const char *loc_name = input->path; /* path to start hierarchy traversal */
const char *old_name = input->old_attr_name;
const char *new_name = input->new_attr_name;
- char *last_comp = NULL;
- iod_kv_params_t kvs;
- iod_kv_t kv;
+ char *last_comp = NULL; /* the last component's name where attribute is created */
+ iod_kv_params_t kvs; /* KV lists for objects - used to unlink attribute object */
+ iod_kv_t kv; /* KV entry */
scratch_pad_t sp;
herr_t ret_value = SUCCEED;
@@ -905,18 +832,17 @@ H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine,
kv.value = &attr_id;
kv.value_len = sizeof(iod_obj_id_t);
kvs.kv = &kv;
- if(iod_kv_unlink_keys(attr_kv_oh,IOD_TID_UNKNOWN, NULL, 1, &kvs, NULL) < 0)
+ if(iod_kv_unlink_keys(attr_kv_oh, IOD_TID_UNKNOWN, NULL, 1, &kvs, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
/* insert attribute with new name */
- kv.key = strdup(new_name);
- kv.value = &attr_id;
- kv.value_len = sizeof(iod_obj_id_t);
- if (iod_kv_set(attr_kv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- HDfree(kv.key);
+ if(H5VL_iod_insert_new_link(attr_kv_oh, IOD_TID_UNKNOWN, new_name, attr_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
- iod_obj_close(attr_kv_oh, NULL, NULL);
+ /* close the Attribute KV object */
+ if(iod_obj_close(attr_kv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
#if H5_DO_NATIVE
ret_value = H5Arename(loc_handle.cookie, old_name, new_name);
@@ -959,14 +885,15 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine,
{
op_data_t *op_data = (op_data_t *)_op_data;
attr_op_in_t *input = (attr_op_in_t *)op_data->input;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_handle = input->loc_oh;
- iod_obj_id_t loc_id = input->loc_id;
- iod_handle_t cur_oh, attr_kv_oh;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */
+ iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */
+ iod_handle_t cur_oh; /* current object handle accessed */
+ iod_handle_t attr_kv_oh; /* KV handle holding attributes for object */
iod_obj_id_t cur_id, attr_id;
- const char *loc_name = input->path;
- const char *attr_name = input->attr_name;
- char *last_comp = NULL;
+ const char *loc_name = input->path; /* path to start hierarchy traversal */
+ const char *attr_name = input->attr_name; /* attribute's name */
+ char *last_comp = NULL; /* the last component's name where attribute is created */
iod_kv_params_t kvs;
iod_kv_t kv;
scratch_pad_t sp;
@@ -1062,8 +989,8 @@ H5VL_iod_server_attr_close_cb(AXE_engine_t UNUSED axe_engine,
{
op_data_t *op_data = (op_data_t *)_op_data;
attr_close_in_t *input = (attr_close_in_t *)op_data->input;
- iod_handle_t iod_oh = input->iod_oh;
- iod_obj_id_t iod_id = input->iod_id;
+ iod_handle_t iod_oh = input->iod_oh; /* iod handle to close */
+ iod_obj_id_t iod_id = input->iod_id; /* iod id of object to close */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c
index 390a0c5..f31d75a 100644
--- a/src/H5VLiod_dset.c
+++ b/src/H5VLiod_dset.c
@@ -47,18 +47,17 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
op_data_t *op_data = (op_data_t *)_op_data;
dset_create_in_t *input = (dset_create_in_t *)op_data->input;
dset_create_out_t output;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_handle = input->loc_oh;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */
iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */
iod_obj_id_t dset_id = input->dset_id; /* The ID of the dataset that needs to be created */
iod_handle_t dset_oh, cur_oh, mdkv_oh;
iod_obj_id_t cur_id, mdkv_id, attr_id;
- const char *name = input->name;
+ const char *name = input->name; /* name of dset including path to create */
char *last_comp; /* the name of the dataset obtained from the last component in the path */
- iod_kv_t kv;
- iod_array_struct_t array;
+ hid_t dcpl_id;
+ iod_array_struct_t array; /* IOD array struct describing the dataset's dimensions */
iod_size_t *max_dims;
- size_t buf_size;
scratch_pad_t sp;
iod_ret_t ret;
hbool_t collective = FALSE; /* MSC - change when we allow for collective */
@@ -135,97 +134,50 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
if (iod_obj_set_scratch(dset_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad");
- /* Store Metadata in scratch pad */
+ /* Open Metadata KV object for write */
if (iod_obj_open_write(coh, mdkv_id, NULL, &mdkv_oh, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad");
- {
- size_t buf_size;
- hid_t dcpl_id;
- uint64_t count;
-
- if(H5P_DEFAULT == input->dcpl_id)
- dcpl_id = H5P_DATASET_CREATE_DEFAULT;
- else
- dcpl_id = input->dcpl_id;
-
- /* insert dataset creation properties in Metadata KV */
- kv.key = strdup("dcpl");
- /* determine the buffer size needed to store the encoded dcpl of the dataset */
- if(H5Pencode(dcpl_id, NULL, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode dataset dcpl");
- if(NULL == (kv.value = malloc (buf_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dcpl buffer");
- /* encode dcpl of the dataset */
- if(H5Pencode(dcpl_id, kv.value, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode dataset dcpl");
- kv.value_len = (iod_size_t)buf_size;
- /* insert kv pair into scratch pad */
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
-
- /* MSC - need to check size of datatype if it fits in
- entry otherwise create a BLOB*/
- /* insert datatype metadata into scratch pad */
- kv.key = strdup("dtype");
- /* determine the buffer size needed to store the encoded type of the dataset */
- if(H5Tencode(input->type_id, NULL, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode dataset type");
- if(NULL == (kv.value = malloc (buf_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate type buffer");
- /* encode datatype of the dataset */
- if(H5Tencode(input->type_id, kv.value, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode dataset type");
- kv.value_len = (iod_size_t)buf_size;
- /* insert kv pair into scratch pad */
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
-
- /* insert dataspace metadata into scratch pad */
- kv.key = strdup("dspace");
- /* determine the buffer size needed to store the encoded space of the dataset */
- if(H5Sencode(input->space_id, NULL, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode dataset space");
- if(NULL == (kv.value = malloc (buf_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate space buffer");
- /* encode dataspace of the dataset */
- if(H5Sencode(input->space_id, kv.value, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode dataset space");
- kv.value_len = (iod_size_t)buf_size;
- /* insert kv pair into scratch pad */
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
-
- /* insert link count metadata on object */
- if(NULL == (kv.value = malloc (sizeof(uint64_t))))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate buffer");
- /* initial count is 1, since object is created now */
- count = 1;
- memcpy(kv.value, &count, sizeof(uint64_t));
- kv.key = strdup("link_count");
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
- }
+ if(H5P_DEFAULT == input->dcpl_id)
+ dcpl_id = H5P_DATASET_CREATE_DEFAULT;
+ else
+ dcpl_id = input->dcpl_id;
+
+ /* insert plist metadata */
+ if(H5VL_iod_insert_plist(mdkv_oh, IOD_TID_UNKNOWN, dcpl_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
+ /* insert link count metadata */
+ if(H5VL_iod_insert_link_count(mdkv_oh, IOD_TID_UNKNOWN, (uint64_t)1,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
+ /* insert object type metadata */
+ if(H5VL_iod_insert_object_type(mdkv_oh, IOD_TID_UNKNOWN, H5I_DATASET,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
+ /* MSC - need to check size of datatype if it fits in
+ entry otherwise create a BLOB*/
+ /* insert datatype metadata */
+ if(H5VL_iod_insert_datatype(mdkv_oh, IOD_TID_UNKNOWN, input->type_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
+ /* insert dataspace metadata */
+ if(H5VL_iod_insert_dataspace(mdkv_oh, IOD_TID_UNKNOWN, input->space_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
/* close the Metadata KV object */
if(iod_obj_close(mdkv_oh, NULL, NULL))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- kv.key = strdup(last_comp);
- kv.value = &dset_id;
- kv.value_len = sizeof(iod_obj_id_t);
- /* insert new dataset in kv store of current group */
- if (iod_kv_set(cur_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
+ /* add link in parent group to current object */
+ if(H5VL_iod_insert_new_link(cur_oh, IOD_TID_UNKNOWN, last_comp, dset_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
}
/* close parent group if it is not the location we started the
@@ -288,17 +240,15 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine,
op_data_t *op_data = (op_data_t *)_op_data;
dset_open_in_t *input = (dset_open_in_t *)op_data->input;
dset_open_out_t output;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_handle = input->loc_oh;
- iod_obj_id_t loc_id = input->loc_id;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */
+ iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */
+ iod_obj_id_t dset_id; /* ID of the dataset to open */
+ char *name = input->name; /* name of dset including path to open */
+ char *last_comp; /* the name of the dataset obtained from the last component in the path */
iod_handle_t cur_oh, mdkv_oh;
iod_obj_id_t cur_id;
- iod_obj_id_t dset_id;
- char *name = input->name;
- char *last_comp;
- void *buf = NULL;
scratch_pad_t sp;
- iod_size_t kv_size;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
@@ -314,10 +264,8 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine,
&last_comp, &cur_id, &cur_oh) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
- kv_size = sizeof(iod_obj_id_t);
-
if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &dset_id,
- kv_size , NULL, NULL) < 0)
+ sizeof(iod_obj_id_t), NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve Array ID from parent KV store");
/* close parent group and its scratch pad if it is not the
@@ -338,58 +286,23 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine,
if (iod_obj_open_write(coh, sp.mdkv_id, NULL /*hints*/, &mdkv_oh, NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
- /* MSC - retrieve metadata */
+ /* MSC - retrieve metadata - NEED IOD */
#if 0
- kv_size = 0;
- /* read the datasets's creation properties */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dcpl", NULL,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dcpl lookup failed");
- if(NULL == (buf = malloc (kv_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dcpl buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dcpl", buf,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dcpl lookup failed");
- if((output.dcpl_id = H5Pdecode(buf)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode dcpl");
- free(buf);
- buf = NULL;
-
- kv_size = 0;
- /* read the datasets's datatype */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dtype", NULL,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dtype lookup failed");
- if(NULL == (buf = H5MM_malloc (kv_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dtype buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dtype", buf,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dtype lookup failed");
- if((output.type_id = H5Tdecode(buf)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode datatype");
- free(buf);
- buf = NULL;
-
- kv_size = 0;
- /* read the datasets's dataspace */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dspace", NULL,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dspace lookup failed");
- if(NULL == (buf = H5MM_malloc (kv_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dspace buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dspace", buf,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dspace lookup failed");
- if((output.space_id = H5Tdecode(buf)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode dataspace");
- free(buf);
- buf = NULL;
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_PLIST, "create_plist",
+ NULL, NULL, NULL, &output.dcpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dcpl");
+
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_LINK_COUNT, "link_count",
+ NULL, NULL, NULL, &output.link_count) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve link count");
- kv_size = sizeof(uint64_t);
- /* read the dataset's link count */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "link_count", output.link_count,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "link_count lookup failed");
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_DATATYPE, "datatype",
+ NULL, NULL, NULL, &output.type_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve datatype");
+
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_DATASPACE, "dataspace",
+ NULL, NULL, NULL, &output.space_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace");
#endif
/* close the metadata scratch pad */
@@ -491,28 +404,28 @@ H5VL_iod_server_dset_read_cb(AXE_engine_t UNUSED axe_engine,
op_data_t *op_data = (op_data_t *)_op_data;
dset_io_in_t *input = (dset_io_in_t *)op_data->input;
dset_read_out_t output;
- iod_handle_t coh = input->coh;
- iod_handle_t iod_oh = input->iod_oh;
- iod_obj_id_t iod_id = input->iod_id;
- hg_bulk_t bulk_handle = input->bulk_handle;
- hid_t space_id = input->space_id;
- hid_t dxpl_id = input->dxpl_id;
- hid_t src_id = input->dset_type_id;
- hid_t dst_id = input->mem_type_id;
- hg_bulk_block_t bulk_block_handle;
- hg_bulk_request_t bulk_request;
- iod_mem_desc_t mem_desc;
- iod_array_iodesc_t file_desc;
- iod_hyperslab_t *hslabs = NULL;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t iod_oh = input->iod_oh; /* dset object handle */
+ iod_obj_id_t iod_id = input->iod_id; /* dset ID */
+ hg_bulk_t bulk_handle = input->bulk_handle; /* bulk handle for data */
+ hid_t space_id = input->space_id; /* file space selection */
+ hid_t dxpl_id = input->dxpl_id; /* transfer property list */
+ hid_t src_id = input->dset_type_id; /* the datatype of the dataset's element */
+ hid_t dst_id = input->mem_type_id; /* the memory type of the elements */
+ hg_bulk_block_t bulk_block_handle; /* HG block handle */
+ hg_bulk_request_t bulk_request; /* HG request */
+ iod_mem_desc_t mem_desc; /* memory descriptor used for reading array */
+ iod_array_iodesc_t file_desc; /* file descriptor used to read array */
+ iod_hyperslab_t *hslabs = NULL; /* IOD hyperslab generated from HDF5 filespace */
size_t size, buf_size, src_size, dst_size;
- void *buf;
+ void *buf; /* buffer to hold outgoing data */
uint8_t *buf_ptr;
- hssize_t num_descriptors = 0, n;
- int ndims, i;
- uint32_t cs = 0;
- size_t nelmts;
- na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle);
- hbool_t opened_locally = FALSE;
+ hssize_t num_descriptors = 0, n; /* number of IOD file descriptors needed to describe filespace selection */
+ int ndims, i; /* dataset's rank/number of dimensions */
+ uint32_t cs = 0; /* checksum value */
+ size_t nelmts; /* number of elements selected to read */
+ na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle); /* destination address to push data to */
+ hbool_t opened_locally = FALSE; /* flag to indicate whether we opened the dset here or if it was already open */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
@@ -702,30 +615,30 @@ H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine,
{
op_data_t *op_data = (op_data_t *)_op_data;
dset_io_in_t *input = (dset_io_in_t *)op_data->input;
- iod_handle_t coh = input->coh;
- iod_handle_t iod_oh = input->iod_oh;
- iod_obj_id_t iod_id = input->iod_id;
- hg_bulk_t bulk_handle = input->bulk_handle;
- hid_t space_id = input->space_id;
- hid_t dxpl_id = input->dxpl_id;
- uint32_t cs = input->checksum;
- hid_t src_id = input->mem_type_id;
- hid_t dst_id = input->dset_type_id;
- uint32_t data_cs = 0;
- hg_bulk_block_t bulk_block_handle;
- hg_bulk_request_t bulk_request;
- iod_mem_desc_t mem_desc;
- iod_array_iodesc_t file_desc;
- iod_hyperslab_t *hslabs = NULL;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t iod_oh = input->iod_oh; /* dset object handle */
+ iod_obj_id_t iod_id = input->iod_id; /* dset ID */
+ hg_bulk_t bulk_handle = input->bulk_handle; /* bulk handle for data */
+ hid_t space_id = input->space_id; /* file space selection */
+ hid_t dxpl_id = input->dxpl_id; /* transfer property list */
+ uint32_t cs = input->checksum; /* checksum recieved for data */
+ hid_t src_id = input->mem_type_id; /* the memory type of the elements */
+ hid_t dst_id = input->dset_type_id; /* the datatype of the dataset's element */
+ hg_bulk_block_t bulk_block_handle; /* HG block handle */
+ hg_bulk_request_t bulk_request; /* HG request */
+ iod_mem_desc_t mem_desc; /* memory descriptor used for writing array */
+ iod_array_iodesc_t file_desc; /* file descriptor used to write array */
+ iod_hyperslab_t *hslabs = NULL; /* IOD hyperslab generated from HDF5 filespace */
size_t size, buf_size, src_size, dst_size;
- hssize_t num_descriptors = 0, n;
- int ndims, i;
+ uint32_t data_cs = 0;
+ hssize_t num_descriptors = 0, n; /* number of IOD file descriptors needed to describe filespace selection */
+ int ndims, i; /* dataset's rank/number of dimensions */
void *buf;
uint8_t *buf_ptr;
- size_t nelmts;
- hbool_t flag = FALSE;
- na_addr_t source = HG_Handler_get_addr(op_data->hg_handle);
- hbool_t opened_locally = FALSE;
+ size_t nelmts; /* number of elements selected to write */
+ hbool_t flag = FALSE; /* temp flag to indicate whether corruption will be inserted */
+ na_addr_t source = HG_Handler_get_addr(op_data->hg_handle); /* source address to pull data from */
+ hbool_t opened_locally = FALSE; /* flag to indicate whether we opened the dset here or if it was already open */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
@@ -936,7 +849,7 @@ H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine,
iod_handle_t coh = input->coh;
iod_handle_t iod_oh = input->iod_oh;
iod_obj_id_t iod_id = input->iod_id;
- int rank = input->dims.rank;
+ int rank = input->dims.rank; /* rank of dataset */
hbool_t opened_locally = FALSE;
herr_t ret_value = SUCCEED;
diff --git a/src/H5VLiod_dtype.c b/src/H5VLiod_dtype.c
index 454cd03..264ab27 100644
--- a/src/H5VLiod_dtype.c
+++ b/src/H5VLiod_dtype.c
@@ -47,22 +47,22 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine,
op_data_t *op_data = (op_data_t *)_op_data;
dtype_commit_in_t *input = (dtype_commit_in_t *)op_data->input;
dtype_commit_out_t output;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_handle = input->loc_oh;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */
iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */
iod_obj_id_t dtype_id = input->dtype_id; /* The ID of the datatype that needs to be created */
iod_handle_t dtype_oh, cur_oh, mdkv_oh;
iod_obj_id_t cur_id, mdkv_id, attr_id;
- const char *name = input->name;
- iod_kv_t kv;
+ const char *name = input->name; /* name of dtype including path to commit */
+ hid_t tcpl_id;
char *last_comp; /* the name of the datatype obtained from the last component in the path */
- size_t buf_size;
+ size_t buf_size; /* size of the serialized datatype */
void *buf;
- iod_mem_desc_t mem_desc;
- iod_blob_iodesc_t file_desc;
+ iod_mem_desc_t mem_desc; /* memory descriptor used for writing */
+ iod_blob_iodesc_t file_desc; /* file descriptor used to write */
scratch_pad_t sp;
iod_ret_t ret;
- hbool_t collective = FALSE; /* MSC - change when we allow for collective */
+ hbool_t collective = FALSE; /* flag to indicate whether we opened the attribute here or if it was already open */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
@@ -142,67 +142,57 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine,
if(iod_blob_write(dtype_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write BLOB object");
- {
- size_t tcpl_size = 0;
- hid_t tcpl_id;
- uint64_t count;
-
- if(H5P_DEFAULT == input->tcpl_id)
- tcpl_id = H5P_DATATYPE_CREATE_DEFAULT;
- else
- tcpl_id = input->tcpl_id;
-
- /* insert datatype creation properties in Metadata KV */
- kv.key = strdup("tcpl");
- /* determine the buffer size needed to store the encoded tcpl of the datatype */
- if(H5Pencode(tcpl_id, NULL, &tcpl_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode tcpl");
- if(NULL == (kv.value = malloc (tcpl_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate tcpl buffer");
- /* encode tcpl of the datatype */
- if(H5Pencode(tcpl_id, kv.value, &tcpl_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode tcpl");
- kv.value_len = (iod_size_t)tcpl_size;
- /* insert kv pair into scratch pad */
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
- /* insert link count metadata on object */
- if(NULL == (kv.value = malloc (sizeof(uint64_t))))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate buffer");
- /* initial count is 1, since object is created now */
- count = 1;
- memcpy(kv.value, &count, sizeof(uint64_t));
- kv.key = strdup("link_count");
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
+ if(H5P_DEFAULT == input->tcpl_id)
+ tcpl_id = H5P_DATATYPE_CREATE_DEFAULT;
+ else
+ tcpl_id = input->tcpl_id;
+
+ /* insert plist metadata */
+ if(H5VL_iod_insert_plist(mdkv_oh, IOD_TID_UNKNOWN, tcpl_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
+ /* insert link count metadata */
+ if(H5VL_iod_insert_link_count(mdkv_oh, IOD_TID_UNKNOWN, (uint64_t)1,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
+ /* insert object type metadata */
+ if(H5VL_iod_insert_object_type(mdkv_oh, IOD_TID_UNKNOWN, H5I_DATATYPE,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
- kv.key = strdup("size");
+ /* store the datatype size */
+ {
+ iod_kv_t kv;
+ char *key = NULL;
+ char *value = NULL;
+
+ key = strdup("size");
+ kv.key = key;
kv.value_len = sizeof(iod_size_t);
- if(NULL == (kv.value = malloc (kv.value_len)))
+
+ if(NULL == (value = malloc (kv.value_len)))
HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate buffer");
- memcpy(kv.value, &buf_size, kv.value_len);
+ *((int32_t *)value) = buf_size;
+ kv.value = value;
+
if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
+
+ free(key);
+ free(value);
}
/* close the Metadata KV object */
if(iod_obj_close(mdkv_oh, NULL, NULL))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- kv.key = strdup(last_comp);
- kv.value = &dtype_id;
- kv.value_len = sizeof(iod_obj_id_t);
- /* insert new datatype in kv store of current group */
- if (iod_kv_set(cur_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
+ /* add link in parent group to current object */
+ if(H5VL_iod_insert_new_link(cur_oh, IOD_TID_UNKNOWN, last_comp, dtype_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
}
#if H5_DO_NATIVE
cur_oh.cookie = H5Tcopy(input->type_id);
@@ -264,18 +254,18 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine,
op_data_t *op_data = (op_data_t *)_op_data;
dtype_open_in_t *input = (dtype_open_in_t *)op_data->input;
dtype_open_out_t output;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_handle = input->loc_oh;
- iod_obj_id_t loc_id = input->loc_id;
- iod_obj_id_t dtype_id;
+ iod_handle_t coh = input->coh; /* container handle */
+ iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */
+ iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */
+ iod_obj_id_t dtype_id; /* ID of datatype to open */
iod_handle_t cur_oh, mdkv_oh;
iod_obj_id_t cur_id, mdkv_id;
- const char *name = input->name;
+ const char *name = input->name; /* name of dtype including path to open */
char *last_comp; /* the name of the datatype obtained from the last component in the path */
- size_t buf_size;
- void *buf = NULL, *tcpl = NULL;
- iod_mem_desc_t mem_desc;
- iod_blob_iodesc_t file_desc;
+ size_t buf_size; /* size of serialized datatype */
+ void *buf = NULL;
+ iod_mem_desc_t mem_desc; /* memory descriptor used for reading */
+ iod_blob_iodesc_t file_desc; /* file descriptor used to write */
iod_size_t kv_size = sizeof(iod_obj_id_t);
scratch_pad_t sp;
herr_t ret_value = SUCCEED;
@@ -308,28 +298,15 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine,
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
#if 0
- kv_size = 0;
- /* read the datatypes's creation properties */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "tcpl", NULL,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "tcpl lookup failed");
- if(NULL == (tcpl = malloc (kv_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate tcpl buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "tcpl", tcpl,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "tcpl lookup failed");
- if((output.tcpl_id = H5Pdecode(tcpl)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode tcpl");
- free(tcpl);
- tcpl = NULL;
-
- kv_size = sizeof(uint64_t);
- /* read the datatype's link count */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "link_count", output.link_count,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "link_count lookup failed");
-
- /*retrieve blob size metadata from scratch pad */
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_PLIST, "create_plist",
+ NULL, NULL, NULL, &output.tcpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve tcpl");
+
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_LINK_COUNT, "link_count",
+ NULL, NULL, NULL, &output.link_count) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve link count");
+
+ /* retrieve blob size metadata from scratch pad */
if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "size", &buf_size,
sizeof(iod_size_t), NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "datatype size lookup failed");
diff --git a/src/H5VLiod_file.c b/src/H5VLiod_file.c
index 94fb4b7..febc379 100644
--- a/src/H5VLiod_file.c
+++ b/src/H5VLiod_file.c
@@ -49,10 +49,11 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine,
op_data_t *op_data = (op_data_t *)_op_data;
file_create_in_t *input = (file_create_in_t *)op_data->input;
file_create_out_t output;
- unsigned int mode;
- iod_handle_t coh;
- iod_handle_t root_oh, mdkv_oh;
- iod_obj_id_t mdkv_id, attr_id;
+ unsigned int mode; /* create mode */
+ iod_handle_t coh; /* container handle */
+ iod_handle_t root_oh; /* root object handle */
+ iod_handle_t mdkv_oh; /* metadata object handle for KV to store file's metadata */
+ iod_obj_id_t mdkv_id, attr_id; /* metadata and attribute KV IDs for the file */
iod_ret_t ret;
herr_t ret_value = SUCCEED;
@@ -87,6 +88,12 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine,
the scratch pad for it too */
if(0 == ret) {
scratch_pad_t sp;
+ iod_kv_t kv;
+ void *key = NULL;
+ void *value = NULL;
+ size_t buf_size;
+ hid_t fcpl_id;
+ uint64_t index;
/* create the metadata KV object for the root group */
if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
@@ -113,57 +120,47 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine,
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad");
/* store metadata */
- {
- iod_kv_t kv;
- size_t buf_size;
- hid_t fcpl_id;
- uint64_t index;
-
- if(H5P_DEFAULT == input->fcpl_id)
- fcpl_id = H5P_FILE_CREATE_DEFAULT;
- else
- fcpl_id = input->fcpl_id;
-
- /* insert file creation properties in Metadata KV */
- kv.key = strdup("fcpl");
- /* determine the buffer size needed to store the encoded fcpl of the file */
- if(H5Pencode(fcpl_id, NULL, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode file fcpl");
- if(NULL == (kv.value = malloc (buf_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate fcpl buffer");
- /* encode fcpl of the file */
- if(H5Pencode(fcpl_id, kv.value, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode file fcpl");
- kv.value_len = (iod_size_t)buf_size;
- /* insert kv pair into scratch pad */
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
-
- /* insert initial indexes for IOD IDs */
- if(NULL == (kv.value = malloc (sizeof(uint64_t))))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate fcpl buffer");
- index = 1;
- memcpy(kv.value, &index, sizeof(uint64_t));
-
- kv.key = strdup("kv_index");
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
-
- kv.key = strdup("array_index");
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
-
- kv.key = strdup("blob_index");
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
-
- free(kv.value);
- }
+
+
+ if(H5P_DEFAULT == input->fcpl_id)
+ fcpl_id = H5P_FILE_CREATE_DEFAULT;
+ else
+ fcpl_id = input->fcpl_id;
+
+ /* insert plist metadata */
+ if(H5VL_iod_insert_plist(mdkv_oh, IOD_TID_UNKNOWN, fcpl_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert link count KV value");
+
+ /* insert initial indexes for IOD IDs */
+ if(NULL == (value = malloc (sizeof(uint64_t))))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate buffer");
+ *((uint64_t *)value) = 1;
+ kv.value_len = sizeof(uint64_t);
+
+ key = strdup("kv_index");
+ kv.key = (char *)key;
+ if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
+ free(key);
+ key = NULL;
+
+ key = strdup("array_index");
+ kv.key = (char *)key;
+ if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
+ free(key);
+ key = NULL;
+
+ key = strdup("blob_index");
+ kv.key = (char *)key;
+ if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
+ free(key);
+ key = NULL;
+
+ free(value);
+ value = NULL;
if(iod_obj_close(mdkv_oh, NULL, NULL))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle");
@@ -227,9 +224,10 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine,
op_data_t *op_data = (op_data_t *)_op_data;
file_open_in_t *input = (file_open_in_t *)op_data->input;
file_open_out_t output;
- unsigned int mode = input->flags;
- iod_handle_t coh;
- iod_handle_t root_oh, mdkv_oh;
+ unsigned int mode = input->flags; /* File Open mode */
+ iod_handle_t coh; /* container handle */
+ iod_handle_t root_oh; /* root object handle */
+ iod_handle_t mdkv_oh; /* metadata object handle for KV to store file's metadata */
scratch_pad_t sp;
herr_t ret_value = SUCCEED;
@@ -262,35 +260,23 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine,
output.blob_oid_index = 1;
output.fcpl_id = H5P_FILE_CREATE_DEFAULT;
+ /* MSC - NEED IOD */
#if 0
- {
- void *fcpl_buf = NULL;
- size_t fcpl_size = 0;
-
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "fcpl", NULL,
- &fcpl_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "file fcpl lookup failed");
- if(NULL == (fcpl_buf = H5MM_malloc (output.fcpl_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate fcpl buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "file_fcpl", fcpl_buf,
- &fcpl_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "file fcpl lookup failed");
- if((output.fcpl_id = H5Pdecode(fcpl_buf)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode file fcpl");
- free(fcpl_buf);
-
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "kv_index", &output.kv_oid_index,
- sizeof(uint64_t), NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "KV index lookup failed");
-
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "array_index", &output.array_oid_index,
- sizeof(uint64_t), NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Array index lookup failed");
-
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "blob_index", &output.blob_oid_index,
- sizeof(uint64_t), NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "BLOB index lookup failed");
- }
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_PLIST, "create_plist",
+ NULL, NULL, NULL, &output.fcpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve fcpl");
+
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "kv_index", &output.kv_oid_index,
+ sizeof(uint64_t), NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "KV index lookup failed");
+
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "array_index", &output.array_oid_index,
+ sizeof(uint64_t), NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Array index lookup failed");
+
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "blob_index", &output.blob_oid_index,
+ sizeof(uint64_t), NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "BLOB index lookup failed");
#endif
/* close the metadata scratch pad */
diff --git a/src/H5VLiod_group.c b/src/H5VLiod_group.c
index b830079..018457d 100644
--- a/src/H5VLiod_group.c
+++ b/src/H5VLiod_group.c
@@ -57,7 +57,7 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine,
iod_handle_t grp_oh, cur_oh, mdkv_oh;
iod_obj_id_t cur_id, mdkv_id, attr_id;
char *last_comp; /* the name of the group obtained from traversal function */
- iod_kv_t kv;
+ hid_t gcpl_id;
scratch_pad_t sp;
iod_ret_t ret;
hbool_t collective = FALSE; /* MSC - change when we allow for collective */
@@ -111,62 +111,39 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine,
if (iod_obj_set_scratch(grp_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad");
- /* Store Metadata in scratch pad */
+ /* store metadata */
+ /* Open Metadata KV object for write */
if (iod_obj_open_write(coh, mdkv_id, NULL, &mdkv_oh, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad");
- /* store metadata */
- {
- iod_kv_t kv;
- size_t buf_size;
- hid_t gcpl_id;
- uint64_t count;
-
- if(H5P_DEFAULT == input->gcpl_id)
- gcpl_id = H5P_GROUP_CREATE_DEFAULT;
- else
- gcpl_id = input->gcpl_id;
-
- /* insert group creation properties in Metadata KV */
- kv.key = strdup("gcpl");
- /* determine the buffer size needed to store the encoded gcpl of the group */
- if(H5Pencode(gcpl_id, NULL, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode group gcpl");
- if(NULL == (kv.value = malloc (buf_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate gcpl buffer");
- /* encode gcpl of the group */
- if(H5Pencode(gcpl_id, kv.value, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode group gcpl");
- kv.value_len = (iod_size_t)buf_size;
- /* insert kv pair into scratch pad */
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
-
- /* insert link count metadata on object */
- if(NULL == (kv.value = malloc (sizeof(uint64_t))))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate buffer");
- /* initial count is 1, since object is created now */
- count = 1;
- memcpy(kv.value, &count, sizeof(uint64_t));
- kv.key = strdup("link_count");
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
- }
+ if(H5P_DEFAULT == input->gcpl_id)
+ gcpl_id = H5P_GROUP_CREATE_DEFAULT;
+ else
+ gcpl_id = input->gcpl_id;
+
+ /* insert plist metadata */
+ if(H5VL_iod_insert_plist(mdkv_oh, IOD_TID_UNKNOWN, gcpl_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
+ /* insert link count metadata */
+ if(H5VL_iod_insert_link_count(mdkv_oh, IOD_TID_UNKNOWN, (uint64_t)1,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+ /* insert object type metadata */
+ if(H5VL_iod_insert_object_type(mdkv_oh, IOD_TID_UNKNOWN, H5I_GROUP,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
+ /* close Metadata KV object */
if(iod_obj_close(mdkv_oh, NULL, NULL))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- /* insert new group in kv store of parent object */
- kv.key = strdup(last_comp);
- kv.value = &grp_id;
- kv.value_len = sizeof(iod_obj_id_t);
- if (iod_kv_set(cur_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
+ /* add link in parent group to current object */
+ if(H5VL_iod_insert_new_link(cur_oh, IOD_TID_UNKNOWN, last_comp, grp_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
} /* end if */
/* close parent group if it is not the location we started the
@@ -228,12 +205,12 @@ H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine,
group_open_in_t *input = (group_open_in_t *)op_data->input;
group_open_out_t output;
iod_handle_t coh = input->coh;
- iod_handle_t loc_handle = input->loc_oh;
- iod_obj_id_t loc_id = input->loc_id;
- const char *name = input->name;
+ iod_handle_t loc_handle = input->loc_oh; /* location handle to start lookup */
+ iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */
+ const char *name = input->name; /* group name including path to open */
iod_obj_id_t grp_id; /* The ID of the group that needs to be opened */
iod_handle_t cur_oh, mdkv_oh;
- iod_obj_id_t cur_id, mdkv_id;
+ iod_obj_id_t cur_id;
char *last_comp; /* the name of the group obtained from traversal function */
iod_size_t kv_size;
scratch_pad_t sp;
@@ -277,31 +254,15 @@ H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine,
if (iod_obj_open_write(coh, sp.mdkv_id, NULL /*hints*/, &mdkv_oh, NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
- /* MSC - retrieve metadata */
-#if 0
- {
- void *buf = NULL;
-
- kv_size = 0;
- /* read the group's creation properties */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "gcpl", NULL,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "group gcpl lookup failed");
- if(NULL == (buf = malloc (kv_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate gcpl buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "gcpl", buf,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "group gcpl lookup failed");
- if((output.gcpl_id = H5Pdecode(buf)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode gcpl");
- free(buf);
-
- kv_size = sizeof(uint64_t);
- /* read the group's link count */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "link_count", output.link_count,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "link_count lookup failed");
- }
+ /* MSC - retrieve metadata, need IOD */
+#if 0
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_PLIST, "create_plist",
+ NULL, NULL, NULL, &output.gcpl_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve gcpl");
+
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_LINK_COUNT, "link_count",
+ NULL, NULL, NULL, &output.link_count) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve link count");
#endif
/* close the metadata scratch pad */
diff --git a/src/H5VLiod_map.c b/src/H5VLiod_map.c
index a96b9e9..002d315 100644
--- a/src/H5VLiod_map.c
+++ b/src/H5VLiod_map.c
@@ -59,10 +59,8 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine,
iod_handle_t map_oh, cur_oh, mdkv_oh;
iod_obj_id_t cur_id, mdkv_id, attr_id;
char *last_comp; /* the name of the group obtained from traversal function */
- iod_kv_t kv;
scratch_pad_t sp;
iod_ret_t ret;
- uint64_t count;
hbool_t collective = FALSE; /* MSC - change when we allow for collective */
herr_t ret_value = SUCCEED;
@@ -114,32 +112,31 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine,
if (iod_obj_set_scratch(map_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad");
- /* Store Metadata in scratch pad */
+ /* Open Metadata KV object for write */
if (iod_obj_open_write(coh, mdkv_id, NULL, &mdkv_oh, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad");
- /* insert link count metadata on object */
- if(NULL == (kv.value = malloc (sizeof(uint64_t))))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate buffer");
- /* initial count is 1, since object is created now */
- count = 1;
- memcpy(kv.value, &count, sizeof(uint64_t));
- kv.key = strdup("link_count");
- if (iod_kv_set(mdkv_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
- free(kv.value);
+ /* insert link count metadata */
+ if(H5VL_iod_insert_link_count(mdkv_oh, IOD_TID_UNKNOWN, (uint64_t)1,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
+ /* insert object type metadata */
+ if(H5VL_iod_insert_object_type(mdkv_oh, IOD_TID_UNKNOWN, H5I_MAP,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
+
+ /* MSC - insert Key datatype metadata */
+ /* MSC - insert Value datatype metadata */
+ /* close MD KV object */
if(iod_obj_close(mdkv_oh, NULL, NULL))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- /* insert new map in kv store of parent object */
- kv.key = strdup(last_comp);
- kv.value = &map_id;
- kv.value_len = sizeof(iod_obj_id_t);
- if (iod_kv_set(cur_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
- free(kv.key);
+ /* add link in parent group to current object */
+ if(H5VL_iod_insert_new_link(cur_oh, IOD_TID_UNKNOWN, last_comp, map_id,
+ NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't insert KV value");
} /* end if */
/* close parent group if it is not the location we started the
@@ -245,13 +242,11 @@ H5VL_iod_server_map_open_cb(AXE_engine_t UNUSED axe_engine,
if (iod_obj_open_write(coh, sp.mdkv_id, NULL /*hints*/, &mdkv_oh, NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad");
- /* MSC - retrieve metadata */
+ /* MSC - retrieve metadata - need IOD*/
#if 0
- kv_size = sizeof(uint64_t);
- /* read the map's link count */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "link_count", output.link_count,
- &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "link_count lookup failed");
+ if(H5VL_iod_get_metadata(mdkv_oh, IOD_TID_UNKNOWN, H5VL_IOD_LINK_COUNT, "link_count",
+ NULL, NULL, NULL, &output.link_count) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve link count");
#endif
/* close the metadata scratch pad */
diff --git a/src/H5VLiod_obj.c b/src/H5VLiod_obj.c
index b9d3fda..ad64a75 100644
--- a/src/H5VLiod_obj.c
+++ b/src/H5VLiod_obj.c
@@ -85,7 +85,7 @@ H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine,
if (iod_obj_open_write(coh, obj_id, NULL, &obj_oh, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
- /* get scratch pad of the dataset */
+ /* get scratch pad of the object */
if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
diff --git a/src/H5VLiod_server.c b/src/H5VLiod_server.c
index 59c4a56..9634982 100644
--- a/src/H5VLiod_server.c
+++ b/src/H5VLiod_server.c
@@ -2934,6 +2934,321 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
}
+herr_t
+H5VL_iod_insert_plist(iod_handle_t oh, iod_trans_id_t tid, hid_t plist_id,
+ iod_hint_list_t *hints, iod_checksum_t *cs, iod_event_t *event)
+{
+ void *key = NULL;
+ void *value = NULL;
+ iod_kv_t kv;
+ size_t buf_size;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* insert group creation properties in Metadata KV */
+ key = strdup("create_plist");
+
+ /* determine the buffer size needed to store the encoded plist */
+ if(H5Pencode(plist_id, NULL, &buf_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode plist");
+ if(NULL == (value = malloc (buf_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate plist buffer");
+ /* encode plist */
+ if(H5Pencode(plist_id, value, &buf_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode plist");
+
+ kv.key = (char *)key;
+ kv.value = value;
+ kv.value_len = (iod_size_t)buf_size;
+ /* insert kv pair into scratch pad */
+ if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
+
+done:
+ if(key) {
+ free(key);
+ key = NULL;
+ }
+ if(value) {
+ free(value);
+ value = NULL;
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+herr_t
+H5VL_iod_insert_link_count(iod_handle_t oh, iod_trans_id_t tid, uint64_t count,
+ iod_hint_list_t *hints, iod_checksum_t *cs, iod_event_t *event)
+{
+ void *key = NULL;
+ void *value = NULL;
+ iod_kv_t kv;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ key = strdup("link_count");
+ if(NULL == (value = malloc (sizeof(uint64_t))))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate buffer");
+
+ *((uint64_t *)value) = count;
+ kv.key = (char *)key;
+ kv.value = value;
+ kv.value_len = sizeof(uint64_t);
+
+ if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
+
+done:
+ if(key) {
+ free(key);
+ key = NULL;
+ }
+ if(value) {
+ free(value);
+ value = NULL;
+ }
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+herr_t
+H5VL_iod_insert_object_type(iod_handle_t oh, iod_trans_id_t tid, H5I_type_t obj_type,
+ iod_hint_list_t *hints, iod_checksum_t *cs, iod_event_t *event)
+{
+ void *key = NULL;
+ void *value = NULL;
+ iod_kv_t kv;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ key = strdup("object_type");
+
+ if(NULL == (value = malloc (sizeof(int32_t))))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate buffer");
+
+ *((int32_t *)value) = obj_type;
+ kv.key = (char *)key;
+ kv.value = value;
+ kv.value_len = sizeof(int32_t);
+
+ if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
+
+done:
+ if(key) {
+ free(key);
+ key = NULL;
+ }
+ if(value) {
+ free(value);
+ value = NULL;
+ }
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+herr_t
+H5VL_iod_insert_new_link(iod_handle_t oh, iod_trans_id_t tid, char *link_name,
+ iod_obj_id_t obj_id, iod_hint_list_t *hints,
+ iod_checksum_t *cs, iod_event_t *event)
+{
+ void *value = NULL;
+ iod_kv_t kv;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ if(NULL == (value = malloc (sizeof(iod_obj_id_t))))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate buffer");
+
+ *((int32_t *)value) = obj_id;
+ kv.key = link_name;
+ kv.value = value;
+ kv.value_len = sizeof(iod_obj_id_t);
+
+ if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
+
+done:
+ if(value) {
+ free(value);
+ value = NULL;
+ }
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+herr_t
+H5VL_iod_insert_datatype(iod_handle_t oh, iod_trans_id_t tid, hid_t type_id,
+ iod_hint_list_t *hints, iod_checksum_t *cs, iod_event_t *event)
+{
+ void *key = NULL;
+ void *value = NULL;
+ iod_kv_t kv;
+ size_t buf_size;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* insert group creation properties in Metadata KV */
+ key = strdup("datatype");
+
+ /* determine the buffer size needed to store the encoded type */
+ if(H5Tencode(type_id, NULL, &buf_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode type");
+ if(NULL == (value = malloc (buf_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate type buffer");
+ /* encode type */
+ if(H5Tencode(type_id, value, &buf_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode type");
+
+ kv.key = (char *)key;
+ kv.value = value;
+ kv.value_len = (iod_size_t)buf_size;
+ /* insert kv pair into scratch pad */
+ if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
+
+done:
+ if(key) {
+ free(key);
+ key = NULL;
+ }
+ if(value) {
+ free(value);
+ value = NULL;
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+herr_t
+H5VL_iod_insert_dataspace(iod_handle_t oh, iod_trans_id_t tid, hid_t space_id,
+ iod_hint_list_t *hints, iod_checksum_t *cs, iod_event_t *event)
+{
+ void *key = NULL;
+ void *value = NULL;
+ iod_kv_t kv;
+ size_t buf_size;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* insert group creation properties in Metadata KV */
+ key = strdup("dataspace");
+
+ /* determine the buffer size needed to store the encoded space */
+ if(H5Sencode(space_id, NULL, &buf_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode space");
+ if(NULL == (value = malloc (buf_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate space buffer");
+ /* encode space */
+ if(H5Sencode(space_id, value, &buf_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode space");
+
+ kv.key = (char *)key;
+ kv.value = value;
+ kv.value_len = (iod_size_t)buf_size;
+ /* insert kv pair into scratch pad */
+ if (iod_kv_set(oh, tid, hints, &kv, cs, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
+
+done:
+ if(key) {
+ free(key);
+ key = NULL;
+ }
+ if(value) {
+ free(value);
+ value = NULL;
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+herr_t
+H5VL_iod_get_metadata(iod_handle_t oh, iod_trans_id_t tid, H5VL_iod_metadata_t md_type,
+ const char *key, iod_hint_list_t *hints, iod_checksum_t *cs,
+ iod_event_t *event, void *ret)
+{
+ iod_size_t val_size = 0;
+ void *value;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ switch(md_type) {
+ case H5VL_IOD_PLIST:
+ {
+ hid_t plist_id = *((hid_t *)ret);
+
+ if(iod_kv_get_value(oh, tid, key, NULL, &val_size, cs, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "lookup failed");
+
+ if(NULL == (value = malloc (val_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate value buffer");
+
+ if(iod_kv_get_value(oh, tid, key, value, &val_size, hints, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "lookup failed");
+
+ if((plist_id = H5Pdecode(value)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode gcpl");
+ break;
+ }
+ case H5VL_IOD_LINK_COUNT:
+ val_size = sizeof(uint64_t);
+ if(iod_kv_get_value(oh, tid, key, ret, &val_size, cs, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "link_count lookup failed");
+ break;
+ case H5VL_IOD_DATATYPE:
+ {
+ hid_t type_id = *((hid_t *)ret);
+
+ if(iod_kv_get_value(oh, tid, key, NULL, &val_size, cs, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "lookup failed");
+
+ if(NULL == (value = malloc (val_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate value buffer");
+
+ if(iod_kv_get_value(oh, tid, key, value, &val_size, hints, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "lookup failed");
+
+ if((type_id = H5Tdecode(value)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode gcpl");
+ break;
+ }
+ case H5VL_IOD_DATASPACE:
+ {
+ hid_t space_id = *((hid_t *)ret);
+
+ if(iod_kv_get_value(oh, tid, key, NULL, &val_size, cs, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "lookup failed");
+
+ if(NULL == (value = malloc (val_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate value buffer");
+
+ if(iod_kv_get_value(oh, tid, key, value, &val_size, hints, event) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "lookup failed");
+
+ if((space_id = H5Tdecode(value)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "failed to decode gcpl");
+ break;
+ }
+ default:
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "invalide metadata type");
+ }
+done:
+ if(value) {
+ free(value);
+ value = NULL;
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+
+
#if 0
/*-------------------------------------------------------------------------
diff --git a/src/H5VLiod_server.h b/src/H5VLiod_server.h
index deda473..f483d25 100644
--- a/src/H5VLiod_server.h
+++ b/src/H5VLiod_server.h
@@ -30,6 +30,15 @@
#define EEXISTS 1
#define H5_DO_NATIVE 0
+/* Enum for metadata types stored in MD KV for HDF5->IOD objects */
+typedef enum H5VL_iod_metadata_t {
+ H5VL_IOD_PLIST, /*type ID for property lists */
+ H5VL_IOD_LINK_COUNT, /*type ID for link count */
+ H5VL_IOD_OBJECT_TYPE, /*type ID for object type */
+ H5VL_IOD_DATATYPE, /*type ID for datatypes */
+ H5VL_IOD_DATASPACE /*type ID for dataspaces */
+} H5VL_iod_metadata_t;
+
/* the AXE op data strucutre stored with every operation */
typedef struct op_data_t {
void *input;
@@ -257,10 +266,26 @@ H5_DLL void H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine
size_t num_s_parents, AXE_task_t s_parents[],
void *_op_data);
+/* Helper routines used several times in different places */
H5_DLL herr_t H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handle_t loc_handle,
const char *path, hbool_t create_interm_grps,
char **last_comp, iod_obj_id_t *iod_id, iod_handle_t *iod_oh);
H5_DLL herr_t H5VL_iod_get_file_desc(hid_t space_id, hssize_t *count, iod_hyperslab_t *hslabs);
-
+H5_DLL herr_t H5VL_iod_insert_plist(iod_handle_t oh, iod_trans_id_t tid, hid_t plist_id,
+ iod_hint_list_t *hints, iod_checksum_t *cs, iod_event_t *event);
+H5_DLL herr_t H5VL_iod_insert_link_count(iod_handle_t oh, iod_trans_id_t tid, uint64_t count,
+ iod_hint_list_t *hints, iod_checksum_t *cs, iod_event_t *event);
+H5_DLL herr_t H5VL_iod_insert_object_type(iod_handle_t oh, iod_trans_id_t tid, H5I_type_t obj_type,
+ iod_hint_list_t *hints, iod_checksum_t *cs, iod_event_t *event);
+H5_DLL herr_t H5VL_iod_insert_datatype(iod_handle_t oh, iod_trans_id_t tid, hid_t type_id,
+ iod_hint_list_t *hints, iod_checksum_t *cs, iod_event_t *event);
+H5_DLL herr_t H5VL_iod_insert_dataspace(iod_handle_t oh, iod_trans_id_t tid, hid_t space_id,
+ iod_hint_list_t *hints, iod_checksum_t *cs, iod_event_t *event);
+H5_DLL herr_t H5VL_iod_insert_new_link(iod_handle_t oh, iod_trans_id_t tid, char *link_name,
+ iod_obj_id_t obj_id, iod_hint_list_t *hints,
+ iod_checksum_t *cs, iod_event_t *event);
+H5_DLL herr_t H5VL_iod_get_metadata(iod_handle_t oh, iod_trans_id_t tid, H5VL_iod_metadata_t md_type,
+ const char *key, iod_hint_list_t *hints, iod_checksum_t *cs,
+ iod_event_t *event, void *ret);
#endif /* H5_HAVE_EFF */
#endif /* _H5VLiod_server_H */