summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2013-06-27 22:14:18 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2013-06-27 22:14:18 (GMT)
commit1b661d50673b61e69452437d1d3544963173fffe (patch)
treecc2b8a59b851d8da04af345c0ea2956cdaa8dc4c /src
parent48c37e86ec4b5642f8f70b55e683fd31f21a9049 (diff)
downloadhdf5-1b661d50673b61e69452437d1d3544963173fffe.zip
hdf5-1b661d50673b61e69452437d1d3544963173fffe.tar.gz
hdf5-1b661d50673b61e69452437d1d3544963173fffe.tar.bz2
[svn-r23840] split server implementation into several C files
Update Makefiles
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt7
-rw-r--r--src/H5Tcommit.c1
-rw-r--r--src/H5VLiod.c172
-rw-r--r--src/H5VLiod_attr.c967
-rw-r--r--src/H5VLiod_dset.c857
-rw-r--r--src/H5VLiod_dtype.c432
-rw-r--r--src/H5VLiod_file.c347
-rw-r--r--src/H5VLiod_group.c337
-rw-r--r--src/H5VLiod_link.c470
-rw-r--r--src/H5VLiod_obj.c579
-rw-r--r--src/H5VLiod_server.c3944
-rw-r--r--src/H5VLiod_server.h141
-rw-r--r--src/Makefile.am1
-rw-r--r--src/Makefile.in34
14 files changed, 4295 insertions, 3994 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cd327a8..ddc1cd3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -639,6 +639,13 @@ IF (HDF5_ENABLE_EFF)
${HDF5_SRC_DIR}/H5VLiod.c
${HDF5_SRC_DIR}/H5VLiod_client.c
${HDF5_SRC_DIR}/H5VLiod_server.c
+ ${HDF5_SRC_DIR}/H5VLiod_file.c
+ ${HDF5_SRC_DIR}/H5VLiod_group.c
+ ${HDF5_SRC_DIR}/H5VLiod_dset.c
+ ${HDF5_SRC_DIR}/H5VLiod_dtype.c
+ ${HDF5_SRC_DIR}/H5VLiod_attr.c
+ ${HDF5_SRC_DIR}/H5VLiod_link.c
+ ${HDF5_SRC_DIR}/H5VLiod_obj.c
${HDF5_SRC_DIR}/H5VLiod_encdec.c
)
SET (H5VL_HDRS
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 2630070..4b305ef 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -934,6 +934,7 @@ H5Tget_vol_named_type(hid_t type_id, void **dt_obj)
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i**x", type_id, dt_obj);
/* Check arguments */
if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
diff --git a/src/H5VLiod.c b/src/H5VLiod.c
index 931f1d4..6855ca1 100644
--- a/src/H5VLiod.c
+++ b/src/H5VLiod.c
@@ -315,16 +315,22 @@ EFF_init(MPI_Comm comm, MPI_Info UNUSED info)
MPI_Comm_size(comm, &num_procs);
MPI_Comm_rank(comm, &my_rank);
+ /* generate global variables to create and track axe_ids for every
+ operation. Each process owns a portion of the ID space and uses
+ that space incrementally. */
axe_seed = (pow(2.0,64.0) - 1) / num_procs;
axe_id = axe_seed * my_rank + 1;
axe_bound = axe_seed * (my_rank + 1);
+ /* This is a temporary solution for connecting to the server using
+ mercury */
if ((config = fopen("port.cfg", "r")) != NULL) {
fread(mpi_port_name, sizeof(char), MPI_MAX_PORT_NAME, config);
printf("Using MPI port name: %s.\n", mpi_port_name);
fclose(config);
}
+ /* initialize Mercury stuff */
network_class = NA_MPI_Init(NULL, 0);
if (HG_SUCCESS != HG_Init(network_class))
return FAIL;
@@ -385,54 +391,11 @@ EFF_init(MPI_Comm comm, MPI_Info UNUSED info)
H5VL_CANCEL_OP_ID = MERCURY_REGISTER("cancel_op", uint64_t, uint8_t);
- /* forward the init call to the IONs */
+ /* forward the init call to the ION and wait for its completion */
if(HG_Forward(PEER, H5VL_EFF_INIT_ID, &num_procs, &ret_value, &hg_req) < 0)
return FAIL;
-
HG_Wait(hg_req, HG_MAX_IDLE_TIME, HG_STATUS_IGNORE);
-#if 0
- {
- int i;
- uint64_t id;
-
- for(i=0; i<10; i++) {
- H5VL_iod_gen_obj_id(my_rank, num_procs, i, IOD_OBJ_KV, &id);
- fprintf(stderr,"%d ID %d = %llu\n", my_rank, i, id);
- while (id) {
- if (id & 1)
- fprintf(stderr,"1");
- else
- fprintf(stderr,"0");
-
- id >>= 1;
- }
- fprintf(stderr,"\n");
- H5VL_iod_gen_obj_id(my_rank, num_procs, i, IOD_OBJ_BLOB, &id);
- fprintf(stderr,"%d ID %d = %llu\n", my_rank, i, id);
- while (id) {
- if (id & 1)
- fprintf(stderr,"1");
- else
- fprintf(stderr,"0");
-
- id >>= 1;
- }
- fprintf(stderr,"\n");
- H5VL_iod_gen_obj_id(my_rank, num_procs, i, IOD_OBJ_ARRAY, &id);
- fprintf(stderr,"%d ID %d = %llu\n", my_rank, i, id);
- while (id) {
- if (id & 1)
- fprintf(stderr,"1");
- else
- fprintf(stderr,"0");
-
- id >>= 1;
- }
- fprintf(stderr,"\n");
- }
- }
-#endif
return ret_value;
} /* end EFF_init() */
@@ -455,10 +418,9 @@ EFF_finalize(void)
hg_request_t hg_req;
herr_t ret_value = SUCCEED;
- /* forward the finalize call to the IONs */
+ /* forward the finalize call to the ION and wait for it to complete */
if(HG_Forward(PEER, H5VL_EFF_FINALIZE_ID, &ret_value, &ret_value, &hg_req) < 0)
return FAIL;
-
HG_Wait(hg_req, HG_MAX_IDLE_TIME, HG_STATUS_IGNORE);
/* Free addr id */
@@ -544,7 +506,7 @@ H5VL_iod_fapl_copy(const void *_old_fa)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
/* Copy the general information */
- //HDmemcpy(new_fa, old_fa, sizeof(H5VL_iod_fapl_t));
+ /* HDmemcpy(new_fa, old_fa, sizeof(H5VL_iod_fapl_t)); */
/* Duplicate communicator and Info object. */
if(FAIL == H5FD_mpi_comm_info_dup(old_fa->comm, old_fa->info, &new_fa->comm, &new_fa->info))
@@ -596,6 +558,21 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_iod_fapl_free() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_dxpl_checksum
+ *
+ * Purpose: Modify the dataset transfer property list to set a
+ * checksum value for the data to be transfered.
+ * This is used with write operations.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * June, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
H5Pset_dxpl_checksum(hid_t dxpl_id, uint32_t cs)
{
@@ -620,6 +597,20 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_dxpl_checksum() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_dxpl_checksum
+ *
+ * Purpose: Retrieve the checksum value that was set using
+ * H5Pset_dxpl_checksum.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * June, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
H5Pget_dxpl_checksum(hid_t dxpl_id, uint32_t *cs/*out*/)
{
@@ -641,6 +632,21 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_dxpl_checksum() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_dxpl_checksum_ptr
+ *
+ * Purpose: Set a pointer to tell the library where to insert the
+ * checksum that is received from a remote location.
+ * This is used with read operations.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * June, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
H5Pset_dxpl_checksum_ptr(hid_t dxpl_id, uint32_t *cs)
{
@@ -665,6 +671,20 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_dxpl_checksum_ptr() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_dxpl_checksum_ptr
+ *
+ * Purpose: Retrieve the checksum pointer value that was set using
+ * H5Pset_dxpl_checksum_ptr.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * June, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
H5Pget_dxpl_checksum_ptr(hid_t dxpl_id, uint32_t **cs/*out*/)
{
@@ -686,6 +706,20 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_dxpl_checksum_ptr() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_dxpl_inject_corruption
+ *
+ * Purpose: Temporary routine to set a boolean flag that tells the
+ * library to inject corruption in the stack.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * June, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
H5Pset_dxpl_inject_corruption(hid_t dxpl_id, hbool_t flag)
{
@@ -710,6 +744,20 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_dxpl_inject_corruption() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_dxpl_inject_corruption
+ *
+ * Purpose: Temporary routine to retrieve the boolean flag that tells the
+ * library to inject corruption in the stack.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * June, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
H5Pget_dxpl_inject_corruption(hid_t dxpl_id, hbool_t *flag/*out*/)
{
@@ -731,6 +779,21 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_dxpl_inject_corruption() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_dcpl_append_only
+ *
+ * Purpose: Set a boolean flag on the dataset creation property list
+ * to indicate to the VOL plugin that access to this dataset
+ * will always be in an append/sequence only manner.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * June, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
H5Pset_dcpl_append_only(hid_t dcpl_id, hbool_t flag)
{
@@ -755,6 +818,21 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_dcpl_append_only() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_dcpl_append_only
+ *
+ * Purpose: Retrieve a boolean flag on the dataset creation property list
+ * that indicates whether access to this dataset
+ * will always be in an append/sequence only manner.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Mohamad Chaarawi
+ * June, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
herr_t
H5Pget_dcpl_append_only(hid_t dcpl_id, hbool_t *flag/*out*/)
{
diff --git a/src/H5VLiod_attr.c b/src/H5VLiod_attr.c
new file mode 100644
index 0000000..d7863dd
--- /dev/null
+++ b/src/H5VLiod_attr.c
@@ -0,0 +1,967 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "H5VLiod_server.h"
+
+#ifdef H5_HAVE_EFF
+
+/*
+ * Programmer: Mohamad Chaarawi <chaarawi@hdfgroup.gov>
+ * June, 2013
+ *
+ * Purpose: The IOD plugin server side attribute routines.
+ */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_attr_create_cb
+ *
+ * Purpose: Creates a attr as a iod object.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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_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_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;
+ scratch_pad_t sp;
+ iod_ret_t ret;
+ hbool_t collective = FALSE; /* MSC - change when we allow for collective */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start attribute Create %s on object path %s\n", attr_name, loc_name);
+#endif
+
+ /* the traversal will retrieve the location where the attribute needs
+ to be created. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE,
+ &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* Set the IOD array creation parameters */
+ array.cell_size = H5Tget_size(input->type_id);
+ array.num_dims = H5Sget_simple_extent_ndims(input->space_id);
+ if(NULL == (array.current_dims = (iod_size_t *)malloc (sizeof(iod_size_t) * array.num_dims)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dimention size array");
+ if(NULL == (max_dims = (iod_size_t *)malloc (sizeof(iod_size_t) * array.num_dims)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dimention size array");
+ if(H5Sget_simple_extent_dims(input->space_id, array.current_dims, max_dims) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes");
+ array.firstdim_max = max_dims[0];
+ array.chunk_dims = NULL;
+ array.dims_seq = NULL;
+
+ /* create the attribute */
+ ret = iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_ARRAY, NULL, &array,
+ &attr_id, NULL /*event*/);
+ if(collective && (0 == ret || EEXISTS == ret)) {
+ /* Attribute has been created by another process, open it */
+ if (iod_obj_open_write(coh, attr_id, NULL, &attr_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open attribute");
+ }
+ else if(!collective && 0 != ret) {
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Attribute");
+ }
+
+ /* for the process that succeeded in creating the attribute, update
+ the parent scratch pad, create attribute scratch pad */
+ if(0 == ret) {
+ /* create the metadata KV object for the attribute */
+ if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
+ NULL, NULL, &mdkv_id, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object");
+
+ /* set values for the scratch pad object */
+ sp.mdkv_id = mdkv_id;
+ sp.attr_id = IOD_ID_UNDEFINED;
+ sp.filler1_id = IOD_ID_UNDEFINED;
+ sp.filler2_id = IOD_ID_UNDEFINED;
+
+ /* set scratch pad in attribute */
+ 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 */
+ 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");
+
+ /* MSC - TODO store things */
+
+#if 0
+ /* insert attribute metadata into scratch pad */
+ kv.key = HDstrdup("attribute_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");
+ HDfree(kv.key);
+ free(kv.value);
+
+ kv.key = HDstrdup("attribute_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");
+ HDfree(kv.key);
+ free(kv.value);
+#endif
+
+ /* close the Metadata KV object */
+ if(iod_obj_close(mdkv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+
+ /* get scratch pad of the parent */
+ if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+
+ /* if attribute KV does not exist, create it */
+ if(IOD_ID_UNDEFINED == sp.attr_id) {
+ /* create the attribute KV object for the parent */
+ if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
+ NULL, NULL, &sp.attr_id, NULL)<0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Attr KV");
+
+ /* set scratch pad in attribute */
+ if (iod_obj_set_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad");
+ }
+
+ /* open the attribute KV in scratch pad */
+ if (iod_obj_open_write(coh, sp.attr_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
+ 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);
+ }
+
+ /* close parent group if it is not the location we started the
+ traversal into */
+ if(loc_handle.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+#if H5_DO_NATIVE
+ cur_oh.cookie = H5Acreate2(cur_oh.cookie, attr_name, input->type_id,
+ input->space_id, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(cur_oh.cookie);
+#endif
+
+ output.iod_oh = cur_oh;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with attr create, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &output);
+
+done:
+
+ /* return an UNDEFINED oh to the client if the operation failed */
+ if(ret_value < 0) {
+ output.iod_oh.cookie = IOD_OH_UNDEFINED;
+ HG_Handler_start_output(op_data->hg_handle, &output);
+ }
+
+ if(max_dims) free(max_dims);
+ if(array.current_dims) free(array.current_dims);
+ input = (attr_create_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ last_comp = (char *)H5MM_xfree(last_comp);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_attr_create_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_attr_open_cb
+ *
+ * Purpose: Opens a attribute as a iod object.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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 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;
+ scratch_pad_t sp;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start attribute Open %s\n", attr_name);
+#endif
+
+ /* the traversal will retrieve the location where the attribute needs
+ to be opened. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE,
+ &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* get scratch pad of the parent */
+ if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+
+ /* if attribute KV does not exist, return error*/
+ if(IOD_ID_UNDEFINED == sp.attr_id)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes");
+
+ /* open the attribute KV in scratch pad */
+ if (iod_obj_open_write(coh, sp.attr_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+
+ /* get attribute ID */
+ if(iod_kv_get_value(attr_kv_oh, IOD_TID_UNKNOWN, attr_name, &attr_id,
+ sizeof(iod_obj_id_t) , NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve Attribute ID from parent KV store");
+
+ /* close parent group if it is not the location we started the
+ traversal into */
+ if(loc_handle.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+ iod_obj_close(attr_kv_oh, NULL, NULL);
+
+ /* open the attribute */
+ if (iod_obj_open_write(coh, attr_id, NULL /*hints*/, &cur_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+
+ /* get scratch pad of the attribute */
+ if(iod_obj_get_scratch(cur_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");
+
+ /* MSC - retrieve all metadata from scratch pad */
+
+ /* close the metadata scratch pad */
+ if(iod_obj_close(mdkv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+
+ {
+ hsize_t dims[1];
+ //hid_t space_id, type_id;
+
+#if H5_DO_NATIVE
+ printf("attr name %s location %d %s\n", attr_name, loc_handle.cookie, loc_name);
+ if(strcmp(loc_name, ".") == 0)
+ cur_oh.cookie = H5Aopen(loc_handle.cookie, attr_name, H5P_DEFAULT);
+ else
+ cur_oh.cookie = H5Aopen_by_name(loc_handle.cookie, loc_name,
+ attr_name, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(cur_oh.cookie);
+ output.space_id = H5Aget_space(cur_oh.cookie);
+ output.type_id = H5Aget_type(cur_oh.cookie);
+ output.acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
+#else
+ /* fake a dataspace, type, and dcpl */
+ dims [0] = 60;
+ output.space_id = H5Screate_simple(1, dims, NULL);
+ output.type_id = H5Tcopy(H5T_NATIVE_INT);
+ output.acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
+#endif
+ }
+
+ output.iod_id = attr_id;
+ output.iod_oh = cur_oh;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with attr open, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &output);
+
+done:
+ if(ret_value < 0) {
+ output.iod_oh.cookie = IOD_OH_UNDEFINED;
+ output.iod_id = IOD_ID_UNDEFINED;
+ HG_Handler_start_output(op_data->hg_handle, &output);
+ }
+
+ H5Sclose(output.space_id);
+ H5Tclose(output.type_id);
+
+ input = (attr_open_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ last_comp = (char *)H5MM_xfree(last_comp);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_attr_open_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_attr_read_cb
+ *
+ * Purpose: Reads from IOD into the function shipper BDS handle.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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;
+ size_t size;
+ void *buf;
+ na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle);
+ hbool_t opened_locally = FALSE;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* open the attribute if we don't have the handle yet */
+ if(iod_oh.cookie == IOD_OH_UNDEFINED) {
+ if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+ opened_locally = TRUE;
+ }
+
+ size = HG_Bulk_handle_get_size(bulk_handle);
+
+ if(NULL == (buf = malloc(size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
+
+#if 0
+ /* create memory descriptor for reading */
+ mem_desc.nfrag = 1;
+ mem_desc.frag->addr = buf;
+ mem_desc.frag->len = (iod_size_t)size;
+
+ /* retrieve the dataspace of the attribute and create file descriptor for reading */
+ /* MSC TODO - populate file descriptor hyperslab */
+#endif
+
+ /* read from array object */
+ if(iod_array_read(iod_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
+
+ {
+ int i;
+ hbool_t flag;
+ int *buf_ptr = (int *)buf;
+
+#if H5_DO_NATIVE
+ ret_value = H5Aread(iod_oh.cookie, type_id, buf);
+#else
+ for(i=0;i<60;++i)
+ buf_ptr[i] = i;
+#endif
+ }
+
+ /* Create a new block handle to write the data */
+ HG_Bulk_block_handle_create(buf, size, HG_BULK_READ_ONLY, &bulk_block_handle);
+
+ /* Write bulk data here and wait for the data to be there */
+ if(HG_SUCCESS != HG_Bulk_write_all(dest, bulk_handle, bulk_block_handle, &bulk_request))
+ HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
+ /* wait for it to complete */
+ if(HG_SUCCESS != HG_Bulk_wait(bulk_request, HG_BULK_MAX_IDLE_TIME, HG_BULK_STATUS_IGNORE))
+ HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
+
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with attr read, sending response to client\n");
+#endif
+
+ if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value))
+ HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client");
+ if(HG_SUCCESS != HG_Bulk_block_handle_free(bulk_block_handle))
+ HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't free bds block handle");
+
+ input = (attr_io_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ free(buf);
+
+ /* close the attribute if we opened it in this routine */
+ if(opened_locally) {
+ if(iod_obj_close(iod_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
+ }
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_attr_read_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_attr_write_cb
+ *
+ * Purpose: Writes from IOD into the function shipper BDS handle.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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;
+ size_t size;
+ void *buf;
+ ssize_t ret;
+ na_addr_t source = HG_Handler_get_addr(op_data->hg_handle);
+ hbool_t opened_locally = FALSE;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* open the attribute if we don't have the handle yet */
+ if(iod_oh.cookie == IOD_OH_UNDEFINED) {
+ if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+ }
+
+ /* Read bulk data here and wait for the data to be here */
+ size = HG_Bulk_handle_get_size(bulk_handle);
+ if(NULL == (buf = malloc(size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
+
+ HG_Bulk_block_handle_create(buf, size, HG_BULK_READWRITE, &bulk_block_handle);
+
+ /* Write bulk data here and wait for the data to be there */
+ if(HG_SUCCESS != HG_Bulk_read_all(source, bulk_handle, bulk_block_handle, &bulk_request))
+ HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't get data from function shipper");
+ /* wait for it to complete */
+ if(HG_SUCCESS != HG_Bulk_wait(bulk_request, HG_BULK_MAX_IDLE_TIME, HG_BULK_STATUS_IGNORE))
+ HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't get data from function shipper");
+
+ /* free the bds block handle */
+ if(HG_SUCCESS != HG_Bulk_block_handle_free(bulk_block_handle))
+ HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't free bds block handle");
+
+#if H5VL_IOD_DEBUG
+ {
+ int i;
+ int *buf_ptr = (int *)buf;
+
+ fprintf(stderr, "AWRITE Received a buffer of size %d with values: ", size);
+ for(i=0;i<60;++i)
+ fprintf(stderr, "%d ", buf_ptr[i]);
+ fprintf(stderr, "\n");
+ }
+#endif
+
+#if 0
+ mem_desc.nfrag = 1;
+ mem_desc.frag->addr = buf;
+ mem_desc.frag->len = (iod_size_t)size;
+
+ /* retrieve the dataspace of the attribute and create file descriptor for reading */
+ /* MSC TODO - populate file descriptor hyperslab */
+#endif
+
+ /* write from array object */
+ if(iod_array_write(iod_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't write to array object");
+
+#if H5_DO_NATIVE
+ ret_value = H5Awrite(iod_oh.cookie, type_id, buf);
+#endif
+
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with attr write, sending %d response to client\n", ret_value);
+#endif
+
+ if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value))
+ HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client");
+
+ input = (attr_io_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ free(buf);
+
+ /* close the dataset if we opened it in this routine */
+ if(opened_locally) {
+ if(iod_obj_close(iod_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
+ }
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_attr_write_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_attr_exists_cb
+ *
+ * Purpose: Checks if an attribute exists on object.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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_obj_id_t cur_id, attr_id;
+ const char *loc_name = input->path;
+ const char *attr_name = input->attr_name;
+ char *last_comp = NULL;
+ scratch_pad_t sp;
+ htri_t ret = -1;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start attribute Exists %s\n", attr_name);
+#endif
+
+ /* the traversal will retrieve the location where the attribute needs
+ to be checked. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE,
+ &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* get scratch pad of the parent */
+ if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+
+ /* close parent group if it is not the location we started the
+ traversal into */
+ if(loc_handle.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+ /* if attribute KV does not exist, return false*/
+ if(IOD_ID_UNDEFINED == sp.attr_id) {
+ ret = FALSE;
+ HGOTO_DONE(SUCCEED);
+ }
+
+ /* open the attribute KV in scratch pad */
+ if (iod_obj_open_write(coh, sp.attr_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+
+ /* get attribute ID */
+ if(iod_kv_get_value(attr_kv_oh, IOD_TID_UNKNOWN, attr_name, &attr_id,
+ sizeof(iod_obj_id_t) , NULL, NULL) < 0) {
+ ret = FALSE;
+ }
+ else {
+ ret = TRUE;
+ }
+
+ iod_obj_close(attr_kv_oh, NULL, NULL);
+
+#if H5_DO_NATIVE
+ ret = H5Aexists(loc_handle.cookie, attr_name);
+#else
+ ret = FALSE;
+#endif
+
+done:
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with attr exists, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret);
+
+ input = (attr_op_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ last_comp = (char *)H5MM_xfree(last_comp);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_attr_exists_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_attr_rename_cb
+ *
+ * Purpose: Renames iod HDF5 attribute.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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_obj_id_t cur_id, attr_id;
+ const char *loc_name = input->path;
+ 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;
+ scratch_pad_t sp;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start attribute Rename %s to %s\n", old_name, new_name);
+#endif
+
+ /* the traversal will retrieve the location where the attribute
+ needs to be renamed. The traversal will fail if an intermediate
+ group does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE,
+ &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* get scratch pad of the parent */
+ if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+
+ /* close parent group if it is not the location we started the
+ traversal into */
+ if(loc_handle.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+ /* if attribute KV does not exist, return error*/
+ if(IOD_ID_UNDEFINED == sp.attr_id)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes");
+
+ /* open the attribute KV in scratch pad */
+ if (iod_obj_open_write(coh, sp.attr_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+
+ /* get attribute ID */
+ if(iod_kv_get_value(attr_kv_oh, IOD_TID_UNKNOWN, old_name, &attr_id,
+ sizeof(iod_obj_id_t) , NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Attribute does not exist");
+
+ /* remove attribute with old name */
+ kv.key = old_name;
+ 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)
+ 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);
+
+ iod_obj_close(attr_kv_oh, NULL, NULL);
+
+#if H5_DO_NATIVE
+ ret_value = H5Arename(loc_handle.cookie, old_name, new_name);
+#endif
+
+done:
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with attr rename, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+
+ input = (attr_rename_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ last_comp = (char *)H5MM_xfree(last_comp);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_attr_rename_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_attr_remove_cb
+ *
+ * Purpose: Removes iod HDF5 attribute.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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_obj_id_t cur_id, attr_id;
+ const char *loc_name = input->path;
+ const char *attr_name = input->attr_name;
+ char *last_comp = NULL;
+ iod_kv_params_t kvs;
+ iod_kv_t kv;
+ scratch_pad_t sp;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start attribute Remove %s\n", attr_name);
+#endif
+
+ /* the traversal will retrieve the location where the attribute
+ needs to be removed. The traversal will fail if an intermediate
+ group does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE,
+ &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* get scratch pad of the parent */
+ if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
+
+ /* close parent group if it is not the location we started the
+ traversal into */
+ if(loc_handle.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+ /* if attribute KV does not exist, return error*/
+ if(IOD_ID_UNDEFINED == sp.attr_id)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes");
+
+ /* open the attribute KV in scratch pad */
+ if (iod_obj_open_write(coh, sp.attr_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
+
+ /* get attribute ID */
+ if(iod_kv_get_value(attr_kv_oh, IOD_TID_UNKNOWN, attr_name, &attr_id,
+ sizeof(iod_obj_id_t) , NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Attribute does not exist");
+
+ /* remove attribute */
+ kv.key = attr_name;
+ 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)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
+
+ if(iod_obj_unlink(coh, attr_id, IOD_TID_UNKNOWN, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink object");
+
+#if H5_DO_NATIVE
+ ret_value = H5Adelete(loc_handle.cookie, attr_name);
+#endif
+
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with attr remove, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+
+ input = (attr_op_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ last_comp = (char *)H5MM_xfree(last_comp);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_attr_remove_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_attr_close_cb
+ *
+ * Purpose: Closes iod HDF5 attribute.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_attr_close_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start attribute Close\n");
+#endif
+
+ if(iod_oh.cookie != IOD_OH_UNDEFINED) {
+#if H5_DO_NATIVE
+ HDassert(H5Aclose(iod_oh.cookie) == SUCCEED);
+#endif
+ if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ }
+ else {
+ /* MSC - need a way to kill object handle for this group */
+ fprintf(stderr, "I do not have the OH of this attribute to close it\n");
+ }
+
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with attr close, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+
+ input = (attr_close_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_attr_close_cb() */
+
+#endif /* H5_HAVE_EFF */
diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c
new file mode 100644
index 0000000..40c35ef
--- /dev/null
+++ b/src/H5VLiod_dset.c
@@ -0,0 +1,857 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "H5VLiod_server.h"
+
+#ifdef H5_HAVE_EFF
+
+/*
+ * Programmer: Mohamad Chaarawi <chaarawi@hdfgroup.gov>
+ * June, 2013
+ *
+ * Purpose: The IOD plugin server side dataset routines.
+ */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_dset_create_cb
+ *
+ * Purpose: Creates a dset as a iod object.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * February, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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_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;
+ const char *name = input->name;
+ 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;
+ 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 */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* the traversal will retrieve the location where the dataset needs
+ to be created. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE,
+ &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* Set the IOD array creation parameters */
+ array.cell_size = H5Tget_size(input->type_id);
+ array.num_dims = H5Sget_simple_extent_ndims(input->space_id);
+ if(NULL == (array.current_dims = (iod_size_t *)malloc (sizeof(iod_size_t) * array.num_dims)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dimention size array");
+ if(NULL == (max_dims = (iod_size_t *)malloc (sizeof(iod_size_t) * array.num_dims)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dimention size array");
+ if(H5Sget_simple_extent_dims(input->space_id, array.current_dims, max_dims) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes");
+ array.firstdim_max = max_dims[0];
+ array.chunk_dims = NULL;
+ array.dims_seq = NULL;
+
+ /* MSC - NEED TO FIX THAT */
+#if 0
+ if(layout.type == H5D_CHUNKED) {
+ if(NULL == (array.chunk_dims = malloc (sizeof(iod_size_t) * layout.u.chunk.ndims)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate chunk dimention size array");
+ array.chunk_dims;
+ }
+#endif
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "now creating the dataset %s cellsize %d num dimenstions %d\n",
+ last_comp, array.cell_size, array.num_dims);
+#endif
+
+ /* create the dataset */
+ ret = iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_ARRAY, NULL, &array,
+ &dset_id, NULL /*event*/);
+ if(collective && (0 == ret || EEXISTS == ret)) {
+ /* Dataset has been created by another process, open it */
+ if (iod_obj_open_write(coh, dset_id, NULL, &dset_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Dataset");
+ }
+ else if(!collective && 0 != ret) {
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Dataset");
+ }
+
+ /* for the process that succeeded in creating the dataset, update
+ the parent KV, create scratch pad */
+ if(0 == ret) {
+ kv.key = HDstrdup(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");
+ HDfree(kv.key);
+
+ /* create the metadata KV object for the dataset */
+ if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
+ NULL, NULL, &mdkv_id, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object");
+
+ /* set values for the scratch pad object */
+ sp.mdkv_id = mdkv_id;
+ sp.attr_id = IOD_ID_UNDEFINED;
+ sp.filler1_id = IOD_ID_UNDEFINED;
+ sp.filler2_id = IOD_ID_UNDEFINED;
+
+ /* set scratch pad in dataset */
+ 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 */
+ 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");
+
+ /* MSC - TODO store things */
+#if 0
+ /* insert layout metadata into scratch pad */
+ kv.key = HDstrdup("dataset_dcpl");
+ /* determine the buffer size needed to store the encoded dcpl of the dataset */
+ if(H5Pencode(input->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(input->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");
+ HDfree(kv.key);
+ free(kv.value);
+
+ /* insert datatyoe metadata into scratch pad */
+ kv.key = HDstrdup("dataset_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");
+ HDfree(kv.key);
+ free(kv.value);
+
+ kv.key = HDstrdup("dataset_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");
+ HDfree(kv.key);
+ free(kv.value);
+#endif
+ /* close the Metadata KV object */
+ if(iod_obj_close(mdkv_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
+ traversal into */
+ if(loc_handle.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+#if H5_DO_NATIVE
+ cur_oh.cookie = H5Dcreate2(loc_handle.cookie, last_comp, input->type_id,
+ input->space_id, input->lcpl_id,
+ input->dcpl_id, input->dapl_id);
+ HDassert(cur_oh.cookie);
+#endif
+
+ output.iod_oh = cur_oh;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with dset create, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &output);
+
+done:
+ /* return an UNDEFINED oh to the client if the operation failed */
+ if(ret_value < 0) {
+ output.iod_oh.cookie = IOD_OH_UNDEFINED;
+ HG_Handler_start_output(op_data->hg_handle, &output);
+ }
+
+ if(max_dims) free(max_dims);
+ if(array.current_dims) free(array.current_dims);
+ last_comp = (char *)H5MM_xfree(last_comp);
+ input = (dset_create_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_dset_create_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_dset_open_cb
+ *
+ * Purpose: Opens a dataset as a iod object.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * February, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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 cur_oh, mdkv_oh;
+ iod_obj_id_t cur_id;
+ iod_obj_id_t dset_id;
+ char *name = input->name;
+ char *last_comp;
+ scratch_pad_t sp;
+ iod_size_t kv_size = sizeof(iod_obj_id_t);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start dataset Open %s\n", name);
+#endif
+
+ /* the traversal will retrieve the location where the dataset needs
+ to be opened. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE,
+ &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &dset_id,
+ kv_size , 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
+ location we started the traversal into */
+ if(loc_handle.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+ /* open the dataset */
+ if (iod_obj_open_write(coh, dset_id, NULL /*hints*/, &cur_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open dataset");
+
+ /* get scratch pad of the dataset */
+ 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");
+
+ /* open the metadata scratch pad */
+ 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");
+
+#if 0
+ /* MSC - retrieve all metadata from scratch pad */
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_dcpl", NULL,
+ &output.dcpl_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dcpl lookup failed");
+ if(NULL == (output.dcpl = H5MM_malloc (output.dcpl_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dcpl buffer");
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_dcpl", output.dcpl,
+ &output.dcpl_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dcpl lookup failed");
+
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_dtype", NULL,
+ &output.dtype_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dtype lookup failed");
+ if(NULL == (output.dtype = H5MM_malloc (output.dtype_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dtype buffer");
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_dtype", output.dtype,
+ &output.dtype_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dtype lookup failed");
+
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_dspace", NULL,
+ &output.dspace_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dspace lookup failed");
+ if(NULL == (output.dspace = H5MM_malloc (output.dspace_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dspace buffer");
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_dspace", output.dspace,
+ &output.dspace_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dspace lookup failed");
+#endif
+
+ /* close the metadata scratch pad */
+ if(iod_obj_close(mdkv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+
+ {
+ hsize_t dims[1];
+ //hid_t space_id, type_id;
+
+#if H5_DO_NATIVE
+ printf("dataset name %s location %d\n", name, loc_handle.cookie);
+ cur_oh.cookie = H5Dopen(loc_handle.cookie, name, input->dapl_id);
+ HDassert(cur_oh.cookie);
+ output.space_id = H5Dget_space(cur_oh.cookie);
+ output.type_id = H5Dget_type(cur_oh.cookie);
+ output.dcpl_id = H5P_DATASET_CREATE_DEFAULT;
+#else
+ /* fake a dataspace, type, and dcpl */
+ dims [0] = 60;
+ output.space_id = H5Screate_simple(1, dims, NULL);
+ output.type_id = H5Tcopy(H5T_NATIVE_INT);
+ output.dcpl_id = H5P_DATASET_CREATE_DEFAULT;
+ cur_oh.cookie = 1;
+#endif
+
+#if 0
+ output.dcpl_size = 0;
+ output.dcpl = NULL;
+
+ /* get Type size to encode */
+ if(H5Tencode(type_id, NULL, &output.dtype_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode dataset type");
+ if(NULL == (output.dtype = H5MM_malloc (output.dtype_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate datatype buffer");
+ if(H5Tencode(type_id, output.dtype, &output.dtype_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype");
+
+ /* get Dataspace size to encode */
+ if(H5Sencode(space_id, NULL, &output.dspace_size)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace");
+ if(NULL == (output.dspace = H5MM_malloc (output.dspace_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate datatype buffer");
+ if(H5Sencode(space_id, output.dspace, &output.dspace_size) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace");
+
+ H5Sclose(space_id);
+#endif
+
+ }
+
+ dset_id = 1;
+ output.iod_id = dset_id;
+ output.iod_oh.cookie = cur_oh.cookie;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with dset open, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &output);
+
+done:
+ if(ret_value < 0) {
+ output.iod_oh.cookie = IOD_OH_UNDEFINED;
+ output.iod_id = IOD_ID_UNDEFINED;
+ HG_Handler_start_output(op_data->hg_handle, &output);
+ }
+
+ H5Tclose(output.type_id);
+ H5Sclose(output.space_id);
+
+ input = (dset_open_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ last_comp = (char *)H5MM_xfree(last_comp);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_dset_open_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_dset_read_cb
+ *
+ * Purpose: Reads from IOD into the function shipper BDS handle.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * January, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_dset_read_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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;
+ size_t size, buf_size, src_size, dst_size;
+ void *buf;
+ uint32_t cs = 0;
+ size_t nelmts;
+ na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle);
+ hbool_t opened_locally = FALSE;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* open the dataset if we don't have the handle yet */
+ if(iod_oh.cookie == IOD_OH_UNDEFINED) {
+ if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+ opened_locally = TRUE;
+ }
+
+ size = HG_Bulk_handle_get_size(bulk_handle);
+
+ nelmts = (size_t)H5Sget_simple_extent_npoints(space_id);
+ src_size = H5Tget_size(src_id);
+ dst_size = H5Tget_size(dst_id);
+
+ /* adjust buffer size for datatype conversion */
+ if(src_size > dst_size) {
+ buf_size = src_size * nelmts;
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Adjusted Buffer size because of datatype conversion from %d to %d: ",
+ size, buf_size);
+#endif
+ }
+ else {
+ buf_size = dst_size * nelmts;
+ assert(buf_size == size);
+ }
+
+ if(NULL == (buf = malloc(buf_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
+
+#if 0
+ mem_desc.nfrag = 1;
+ mem_desc.frag->addr = buf;
+ mem_desc.frag->len = (iod_size_t)buf_size;
+
+ /* MSC TODO - populate file location hyperslab */
+#endif
+
+ /* read from array object */
+ if(iod_array_read(iod_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
+
+ {
+ int i;
+ hbool_t flag = FALSE;
+ int *buf_ptr = (int *)buf;
+
+#if H5_DO_NATIVE
+ ret_value = H5Dread(iod_oh.cookie, src_id, H5S_ALL, space_id, dxpl_id, buf);
+#else /* fake data */
+ for(i=0;i<60;++i)
+ buf_ptr[i] = i;
+#endif
+ if(H5Tconvert(src_id, dst_id, nelmts, buf, NULL, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed");
+
+ /* calculate a checksum for the data to be sent */
+ cs = H5checksum(buf, size, NULL);
+
+ /* MSC - check if client requested to corrupt data */
+ if(dxpl_id != H5P_DEFAULT && H5Pget_dxpl_inject_corruption(dxpl_id, &flag) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read property list");
+ if(flag) {
+ fprintf(stderr, "Injecting a bad data value to cause corruption \n");
+ buf_ptr[0] = 10;
+ }
+ }
+
+ /* Create a new block handle to write the data */
+ HG_Bulk_block_handle_create(buf, size, HG_BULK_READ_ONLY, &bulk_block_handle);
+
+ /* Write bulk data here and wait for the data to be there */
+ if(HG_SUCCESS != HG_Bulk_write_all(dest, bulk_handle, bulk_block_handle, &bulk_request))
+ HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
+ /* wait for it to complete */
+ if(HG_SUCCESS != HG_Bulk_wait(bulk_request, HG_BULK_MAX_IDLE_TIME, HG_BULK_STATUS_IGNORE))
+ HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
+
+done:
+
+ output.ret = ret_value;
+ output.cs = cs;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with dset read, checksum %u, sending response to client\n", cs);
+#endif
+
+ if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &output))
+ HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client");
+ if(HG_SUCCESS != HG_Bulk_block_handle_free(bulk_block_handle))
+ HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't free bds block handle");
+
+ input = (dset_io_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ free(buf);
+
+ /* close the dataset if we opened it in this routine */
+ if(opened_locally) {
+ if(iod_obj_close(iod_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
+ }
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_dset_read_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_dset_write_cb
+ *
+ * Purpose: Writes from IOD into the function shipper BDS handle.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * January, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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;
+ uint32_t data_cs = 0;
+ hid_t src_id = input->mem_type_id;
+ hid_t dst_id = input->dset_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;
+ size_t size, buf_size, src_size, dst_size;
+ void *buf;
+ size_t nelmts;
+ hbool_t flag = FALSE;
+ na_addr_t source = HG_Handler_get_addr(op_data->hg_handle);
+ hbool_t opened_locally = FALSE;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Dataset Write with AXE ID %llu\n",input->axe_id);
+#endif
+ /* open the dataset if we don't have the handle yet */
+ if(iod_oh.cookie == IOD_OH_UNDEFINED) {
+ if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+ opened_locally = TRUE;
+ }
+
+ /* Read bulk data here and wait for the data to be here */
+ size = HG_Bulk_handle_get_size(bulk_handle);
+
+ nelmts = (size_t)H5Sget_simple_extent_npoints(space_id);
+ src_size = H5Tget_size(src_id);
+ dst_size = H5Tget_size(dst_id);
+
+ /* adjust buffer size for datatype conversion */
+ if(src_size < dst_size) {
+ buf_size = dst_size * nelmts;
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Adjusted Buffer size because of datatype conversion from %d to %d\n",
+ size, buf_size);
+#endif
+ }
+ else {
+ buf_size = src_size * nelmts;
+ assert(buf_size == size);
+ }
+
+ if(NULL == (buf = malloc(buf_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
+
+ HG_Bulk_block_handle_create(buf, size, HG_BULK_READWRITE, &bulk_block_handle);
+
+ /* Write bulk data here and wait for the data to be there */
+ if(HG_SUCCESS != HG_Bulk_read_all(source, bulk_handle, bulk_block_handle, &bulk_request))
+ HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't get data from function shipper");
+ /* wait for it to complete */
+ if(HG_SUCCESS != HG_Bulk_wait(bulk_request, HG_BULK_MAX_IDLE_TIME, HG_BULK_STATUS_IGNORE))
+ HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't get data from function shipper");
+
+ /* free the bds block handle */
+ if(HG_SUCCESS != HG_Bulk_block_handle_free(bulk_block_handle))
+ HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't free bds block handle");
+
+ /* MSC - check if client requested to corrupt data */
+ if(dxpl_id != H5P_DEFAULT && H5Pget_dxpl_inject_corruption(dxpl_id, &flag) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read property list");
+ if(flag) {
+ ((int *)buf)[0] = 10;
+ }
+
+ /* If client specified a checksum, verify it */
+ if(dxpl_id != H5P_DEFAULT && H5Pget_dxpl_checksum(dxpl_id, &data_cs) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read property list");
+ if(data_cs != 0) {
+ cs = H5_checksum_lookup4(buf, size, NULL);
+ if(cs != data_cs) {
+ fprintf(stderr, "Errrr.. Network transfer Data corruption. expecting %u, got %u\n",
+ data_cs, cs);
+ HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "Checksum verification failed");
+ }
+ }
+
+ if(H5Tconvert(src_id, dst_id, nelmts, buf, NULL, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed")
+
+#if H5VL_IOD_DEBUG
+ {
+ int i;
+ int *buf_ptr = (int *)buf;
+
+ fprintf(stderr, "DWRITE Received a buffer of size %d with values: ", size);
+ for(i=0;i<60;++i)
+ fprintf(stderr, "%d ", buf_ptr[i]);
+ fprintf(stderr, "\n");
+ }
+#endif
+
+#if 0
+ mem_desc.nfrag = 1;
+ mem_desc.frag->addr = buf;
+ mem_desc.frag->len = (iod_size_t)buf_size;
+
+ /* MSC TODO - populate file location hyperslab */
+#endif
+
+ /* write from array object */
+ if(iod_array_write(iod_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, &cs, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't write to array object");
+
+#if H5_DO_NATIVE
+ ret_value = H5Dwrite(iod_oh.cookie, H5T_NATIVE_INT, H5S_ALL, space_id, dxpl_id, buf);
+#endif
+
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with dset write, sending %d response to client\n", ret_value);
+#endif
+
+ if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value))
+ HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client");
+#if 0
+ /* Shut down datatype info for operation */
+ if(type_info_init && H5VL_iod_typeinfo_term(&type_info) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info")
+#endif
+
+ input = (dset_io_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ free(buf);
+
+ /* close the dataset if we opened it in this routine */
+ if(opened_locally) {
+ if(iod_obj_close(iod_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
+ }
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_dset_write_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_dset_set_extent_cb
+ *
+ * Purpose: Set_Extents iod HDF5 dataset.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * January, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ dset_set_extent_in_t *input = (dset_set_extent_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;
+ int rank = input->dims.rank;
+ hbool_t opened_locally = FALSE;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start dataset Extend on the first dimension to %d\n", input->dims.size[0]);
+#endif
+
+ /* open the dataset if we don't have the handle yet */
+ if(iod_oh.cookie == IOD_OH_UNDEFINED) {
+ if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+ opened_locally = TRUE;
+ }
+
+ /* extend along the first dimension only */
+ if(iod_array_extend(iod_oh, IOD_TID_UNKNOWN, (iod_size_t)input->dims.size[0], NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't extend dataset");
+
+#if H5_DO_NATIVE
+ ret_value = H5Dset_extent(iod_oh.cookie, input->dims.size);
+#endif
+
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with dset set_extent, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+
+ input = (dset_set_extent_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ /* close the dataset if we opened it in this routine */
+ if(opened_locally) {
+ if(iod_obj_close(iod_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
+ }
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_dset_set_extent_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_dset_close_cb
+ *
+ * Purpose: Closes iod HDF5 dataset.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * January, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_dset_close_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ dset_close_in_t *input = (dset_close_in_t *)op_data->input;
+ iod_handle_t iod_oh = input->iod_oh;
+ iod_obj_id_t iod_id = input->iod_id;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start dataset Close\n");
+#endif
+
+ if(iod_oh.cookie != IOD_OH_UNDEFINED) {
+#if H5_DO_NATIVE
+ ret_value = H5Dclose(iod_oh.cookie);
+#endif
+
+ if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ }
+ else {
+ /* MSC - need a way to kill object handle for this group */
+ fprintf(stderr, "I do not have the OH of this dataset to close it\n");
+ }
+
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with dset close, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+
+ input = (dset_close_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_dset_close_cb() */
+
+#endif /* H5_HAVE_EFF */
diff --git a/src/H5VLiod_dtype.c b/src/H5VLiod_dtype.c
new file mode 100644
index 0000000..4be26ec
--- /dev/null
+++ b/src/H5VLiod_dtype.c
@@ -0,0 +1,432 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "H5VLiod_server.h"
+
+#ifdef H5_HAVE_EFF
+
+/*
+ * Programmer: Mohamad Chaarawi <chaarawi@hdfgroup.gov>
+ * June, 2013
+ *
+ * Purpose: The IOD plugin server side datatype routines.
+ */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_dtype_commit_cb
+ *
+ * Purpose: Commits a dtype as a iod object.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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_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;
+ const char *name = input->name;
+ iod_kv_t kv;
+ char *last_comp; /* the name of the datatype obtained from the last component in the path */
+ size_t buf_size;
+ void *buf;
+ iod_mem_desc_t mem_desc;
+ iod_blob_iodesc_t file_desc;
+ scratch_pad_t sp;
+ iod_ret_t ret;
+ hbool_t collective = FALSE; /* MSC - change when we allow for collective */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start datatype Commit %s\n", name);
+#endif
+
+ /* the traversal will retrieve the location where the datatype needs
+ to be created. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE,
+ &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* create the datatype */
+ ret = iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_BLOB, NULL, NULL,
+ &dtype_id, NULL /*event*/);
+ if(collective && (0 == ret || EEXISTS == ret)) {
+ /* Datatype has been created by another process, open it */
+ if (iod_obj_open_write(coh, dtype_id, NULL, &dtype_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Datatype");
+ }
+ else if(!collective && 0 != ret) {
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Datatype");
+ }
+
+ /* for the process that succeeded in creating the datatype, update
+ the parent KV, create scratch pad */
+ if(0 == ret) {
+ kv.key = HDstrdup(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");
+ HDfree(kv.key);
+
+ /* create the metadata KV object for the datatype */
+ if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
+ NULL, NULL, &mdkv_id, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object");
+
+ /* set values for the scratch pad object */
+ sp.mdkv_id = mdkv_id;
+ sp.attr_id = IOD_ID_UNDEFINED;
+ sp.filler1_id = IOD_ID_UNDEFINED;
+ sp.filler2_id = IOD_ID_UNDEFINED;
+
+ /* set scratch pad in datatype */
+ if (iod_obj_set_scratch(dtype_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 */
+ 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");
+
+ /* determine the buffer size needed to store the encoded type of the datatype */
+ if(H5Tencode(input->type_id, NULL, &buf_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode datatype type");
+ if(NULL == (buf = malloc (buf_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate type buffer");
+ /* encode datatype of the datatype */
+ if(H5Tencode(input->type_id, buf, &buf_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode datatype type");
+
+#if 0
+ /* create memory descriptor for writing */
+ mem_desc.nfrag = 1;
+ mem_desc.frag->addr = buf;
+ mem_desc.frag->len = (iod_size_t)buf_size;
+
+ /* create file descriptor for writing */
+ file_desc.nfrag = 1;
+ file_desc.frag->offset = 0;
+ file_desc.frag->len = (iod_size_t)buf_size;
+#endif
+
+ /* write the serialized type value to the BLOB object */
+ if(iod_blob_write(cur_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write BLOB object");
+
+ /* MSC - TODO store things */
+#if 0
+ /* insert datatype metadata into scratch pad */
+
+ kv.key = HDstrdup("datatype_tcpl");
+ /* determine the buffer size needed to store the encoded tcpl of the datatype */
+ if(H5Pencode(input->tcpl_id, NULL, &value_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode datatype tcpl");
+ if(NULL == (kv.value = malloc (value_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate tcpl buffer");
+ /* encode tcpl of the datatype */
+ if(H5Pencode(input->tcpl_id, kv.value, &value_size) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode datatype tcpl");
+ kv.value_len = (iod_size_t)value_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");
+ HDfree(kv.key);
+ free(kv.value);
+
+ kv.key = HDstrdup("datatype_size");
+ kv.value_len = sizeof(iod_size_t);
+ if(NULL == (kv.value = malloc (kv.value_len)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate buffer");
+ memcpy(kv.value, &buf_size, kv.value_len);
+
+ /* 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");
+ HDfree(kv.key);
+ free(kv.value);
+#endif
+
+ /* close the Metadata KV object */
+ if(iod_obj_close(mdkv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ }
+#if H5_DO_NATIVE
+ cur_oh.cookie = H5Tcopy(input->type_id);
+ if(H5Tcommit2(loc_handle.cookie, last_comp, cur_oh.cookie,
+ H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't commit datatype");
+ fprintf(stderr, "Committed Native Datatype %s with ID %d on %d\n",
+ last_comp, cur_oh.cookie, loc_handle.cookie);
+#endif
+
+ /* close parent group and its scratch pad if it is not the
+ location we started the traversal into */
+ if(loc_handle.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+ output.iod_oh = cur_oh;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with dtype commit, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &output);
+
+done:
+ if(ret_value < 0) {
+ output.iod_oh.cookie = IOD_OH_UNDEFINED;
+ HG_Handler_start_output(op_data->hg_handle, &output);
+ }
+
+ input = (dtype_commit_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ last_comp = (char *)H5MM_xfree(last_comp);
+ free(buf);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_dtype_commit_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_dtype_open_cb
+ *
+ * Purpose: Opens a datatype as a iod object.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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 cur_oh, mdkv_oh;
+ iod_obj_id_t cur_id, mdkv_id;
+ const char *name = input->name;
+ char *last_comp; /* the name of the datatype obtained from the last component in the path */
+ size_t buf_size;
+ void *buf;
+ iod_mem_desc_t mem_desc;
+ iod_blob_iodesc_t file_desc;
+ iod_size_t kv_size = sizeof(iod_obj_id_t);
+ scratch_pad_t sp;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ fprintf(stderr, "Start datatype Open %s\n", name);
+
+ /* the traversal will retrieve the location where the datatype needs
+ to be opened. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE,
+ &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &dtype_id,
+ kv_size , NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve BLOB ID from parent KV store");
+
+ /* open the datatype */
+ if (iod_obj_open_write(coh, dtype_id, NULL /*hints*/, &cur_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open datatype");
+
+ /* get scratch pad of the datatype */
+ 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");
+
+ /* open the metadata scratch pad */
+ 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 - need to read datatype; size should be stored in metadata,
+ but since no real IOD, can't do anything now */
+
+#if 0
+ /*retrieve tcpl metadata from scratch pad */
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "datatype_tcpl", NULL,
+ &output.tcpl_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "datatype tcpl lookup failed");
+ if(NULL == (output.tcpl = H5MM_malloc (output.tcpl_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate tcpl buffer");
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "datatype_tcpl", output.tcpl,
+ &output.tcpl_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "datatype tcpl lookup failed");
+
+ /*retrieve blob size metadata from scratch pad */
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "datatype_size", &buf_size,
+ sizeof(iod_size_t), NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "datatype size lookup failed");
+
+ if(NULL == (buf = malloc(buf_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate BLOB read buffer");
+
+ /* create memory descriptor for writing */
+ mem_desc.nfrag = 1;
+ mem_desc.frag->addr = buf;
+ mem_desc.frag->len = (iod_size_t)buf_size;
+
+ /* create file descriptor for writing */
+ file_desc.nfrag = 1;
+ file_desc.frag->offset = 0;
+ file_desc.frag->len = (iod_size_t)buf_size;
+
+ /* write the serialized type value to the BLOB object */
+ if(iod_blob_write(cur_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write BLOB object");
+
+ /* decode the datatype */
+ if((output.type_id = H5Tdecode(buf)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to decode datatype");
+
+ free(buf);
+#endif
+
+ /* 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 H5_DO_NATIVE
+ printf("datatype name %s location %d\n", name, loc_handle.cookie);
+ cur_oh.cookie = H5Topen(loc_handle.cookie, name, input->tapl_id);
+ HDassert(cur_oh.cookie);
+ output.type_id = cur_oh.cookie;
+ output.tcpl_id = H5P_DATATYPE_CREATE_DEFAULT;
+#else
+ /* fake a type, and tcpl */
+ output.type_id = H5Tcopy(H5T_NATIVE_INT);
+ output.tcpl_id = H5P_DATATYPE_CREATE_DEFAULT;
+#endif
+
+ output.iod_id = dtype_id;
+ output.iod_oh = cur_oh;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with dtype open, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &output);
+
+done:
+ if(ret_value < 0) {
+ output.iod_oh.cookie = IOD_OH_UNDEFINED;
+ output.iod_id = IOD_ID_UNDEFINED;
+ HG_Handler_start_output(op_data->hg_handle, &output);
+ }
+
+#if !H5_DO_NATIVE
+ H5Tclose(output.type_id);
+#endif
+
+ last_comp = (char *)H5MM_xfree(last_comp);
+ input = (dtype_open_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_dtype_open_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_dtype_close_cb
+ *
+ * Purpose: Closes iod HDF5 datatype.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_dtype_close_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ dtype_close_in_t *input = (dtype_close_in_t *)op_data->input;
+ iod_handle_t iod_oh = input->iod_oh;
+ iod_obj_id_t iod_id = input->iod_id;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start datatype Close\n");
+#endif
+
+ if(iod_oh.cookie != IOD_OH_UNDEFINED) {
+#if H5_DO_NATIVE
+ HDassert(H5Tclose(iod_oh.cookie) == SUCCEED);
+#endif
+
+ if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ }
+ else {
+ /* MSC - need a way to kill object handle for this group */
+ fprintf(stderr, "I do not have the OH of this datatype to close it\n");
+ }
+
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with dtype close, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+
+ input = (dtype_close_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_dtype_close_cb() */
+
+#endif /* H5_HAVE_EFF */
diff --git a/src/H5VLiod_file.c b/src/H5VLiod_file.c
new file mode 100644
index 0000000..451b5bb
--- /dev/null
+++ b/src/H5VLiod_file.c
@@ -0,0 +1,347 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "H5VLiod_server.h"
+
+#ifdef H5_HAVE_EFF
+
+/*
+ * Programmer: Mohamad Chaarawi <chaarawi@hdfgroup.gov>
+ * February, 2013
+ *
+ * Purpose: The IOD plugin server side file routines.
+ */
+
+static iod_obj_id_t ROOT_ID;
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_file_create_cb
+ *
+ * Purpose: Creates a file as a iod HDF5 file.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * January, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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;
+ iod_ret_t ret;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start file create %s %d %d\n", input->name, input->fapl_id, input->fcpl_id);
+#endif
+
+ /* convert HDF5 flags to IOD flags */
+ mode = (input->flags&H5F_ACC_RDWR) ? IOD_CONT_RW : IOD_CONT_RO;
+ if (input->flags&H5F_ACC_CREAT)
+ mode |= IOD_CONT_CREATE;
+
+ /* Create the Container */
+ if(iod_container_open(input->name, NULL /*hints*/, mode, &coh, NULL /*event*/) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't create container");
+
+ /* create the root group */
+ ret = iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV, NULL, NULL,
+ &input->root_id, NULL);
+ if(0 == ret || EEXISTS == ret) {
+ /* root group has been created, open it */
+ if (iod_obj_open_write(coh, input->root_id, NULL, &root_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+ }
+ else {
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create root group");
+ }
+
+ /* for the process that succeeded in creating the group, create
+ the scratch pad for it too */
+ if(0 == ret) {
+ scratch_pad_t sp;
+
+ /* create the metadata KV object for the root group */
+ if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
+ NULL, NULL, &mdkv_id, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object");
+
+ /* set values for the scratch pad object */
+ sp.mdkv_id = mdkv_id;
+ sp.attr_id = IOD_ID_UNDEFINED;
+ sp.filler1_id = IOD_ID_UNDEFINED;
+ sp.filler2_id = IOD_ID_UNDEFINED;
+
+ /* set scratch pad in root group */
+ if (iod_obj_set_scratch(root_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 */
+ 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");
+
+ /* MSC - TODO store things */
+
+ if(iod_obj_close(mdkv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle");
+ }
+
+#if H5_DO_NATIVE
+ coh.cookie = H5Fcreate(input->name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(coh.cookie);
+ root_oh.cookie = coh.cookie;
+ fprintf(stderr, "Created Native file %s with ID %d\n", input->name, root_oh.cookie);
+#endif
+
+ output.coh = coh;
+ output.root_oh = root_oh;
+ output.kv_oid_index = 1;
+ output.array_oid_index = 1;
+ output.blob_oid_index = 1;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with file create, sending response to client \n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &output);
+
+done:
+ if(ret_value < 0) {
+ output.coh.cookie = IOD_OH_UNDEFINED;
+ output.root_oh.cookie = IOD_OH_UNDEFINED;
+ output.kv_oid_index = 0;
+ output.array_oid_index = 0;
+ output.blob_oid_index = 0;
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+ }
+
+ input = (file_create_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_file_create_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_file_open_cb
+ *
+ * Purpose: Opens a file as a iod HDF5 file.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * January, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ 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;
+ scratch_pad_t sp;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start file open %s %d %d\n", input->name, input->flags, input->fapl_id);
+#endif
+
+ if(iod_container_open(input->name, NULL /*hints*/, mode, &coh, NULL /*event*/))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open file");
+
+ /* open the root group */
+ if (iod_obj_open_write(coh, ROOT_ID, NULL /*hints*/, &root_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open root object");
+
+ /* get scratch pad of root group */
+ if(iod_obj_get_scratch(root_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't get scratch pad for root object");
+
+ /* open the metadata scratch pad */
+ 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 */
+ output.kv_oid_index = 1;
+ output.array_oid_index = 1;
+ output.blob_oid_index = 1;
+ output.fcpl_id = H5P_FILE_CREATE_DEFAULT;
+
+ /* close the metadata scratch pad */
+ if(iod_obj_close(mdkv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle");
+
+#if H5_DO_NATIVE
+ {
+ coh.cookie = H5Fopen(input->name, H5F_ACC_RDWR, H5P_DEFAULT);
+ HDassert(coh.cookie);
+ root_oh.cookie = coh.cookie;
+ fprintf(stderr, "Opened Native file %s with ID %d\n", input->name, root_oh.cookie);
+ }
+#endif
+
+ output.coh = coh;
+ output.root_id = ROOT_ID;
+ output.root_oh = root_oh;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with file open, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &output);
+
+done:
+ if(ret_value < 0) {
+ output.coh.cookie = IOD_OH_UNDEFINED;
+ output.root_id = IOD_ID_UNDEFINED;
+ output.root_oh.cookie = IOD_OH_UNDEFINED;
+ output.fcpl_id = H5P_FILE_CREATE_DEFAULT;
+ output.kv_oid_index = 0;
+ output.array_oid_index = 0;
+ output.blob_oid_index = 0;
+ HG_Handler_start_output(op_data->hg_handle, &output);
+ }
+
+ input = (file_open_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_file_open_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_file_flush_cb
+ *
+ * Purpose: Flushs iod HDF5 file.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * January, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_file_flush_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ file_flush_in_t *input = (file_flush_in_t *)op_data->input;
+ iod_handle_t coh = input->coh;
+ H5F_scope_t scope = input->scope;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* MSC - TODO */
+
+#if H5_DO_NATIVE
+ ret_value = H5Fflush(coh.cookie, scope);
+#endif
+
+done:
+ if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value))
+ HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't send result of file flush to client");
+
+ input = (file_flush_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_file_flush_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_file_close_cb
+ *
+ * Purpose: Closes iod HDF5 file.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * January, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ file_close_in_t *input = (file_close_in_t *)op_data->input;
+ iod_handle_t coh = input->coh;
+ iod_handle_t root_oh = input->root_oh;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start file close\n");
+#endif
+
+#if H5_DO_NATIVE
+ H5Fclose(coh.cookie);
+#endif
+
+ /* close the root group */
+ if(iod_obj_close(root_oh, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close root object handle");
+
+ /* close the container */
+ if(iod_container_close(coh, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close container");
+
+done:
+ fprintf(stderr, "Done with file close, sending response to client\n");
+ if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value))
+ HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't send result of file close to client");
+
+ input = (file_close_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_file_close_cb() */
+
+#endif /* H5_HAVE_EFF */
diff --git a/src/H5VLiod_group.c b/src/H5VLiod_group.c
new file mode 100644
index 0000000..33a8fad
--- /dev/null
+++ b/src/H5VLiod_group.c
@@ -0,0 +1,337 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "H5VLiod_server.h"
+
+#ifdef H5_HAVE_EFF
+
+/*
+ * Programmer: Mohamad Chaarawi <chaarawi@hdfgroup.gov>
+ * June, 2013
+ *
+ * Purpose: The IOD plugin server side group routines.
+ */
+
+#define EEXISTS 1
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_group_create_cb
+ *
+ * Purpose: Creates a group as a iod object.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * February, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ group_create_in_t *input = (group_create_in_t *)op_data->input;
+ group_create_out_t output;
+ iod_handle_t coh = input->coh; /* the container handle */
+ iod_handle_t loc_handle = input->loc_oh; /* The handle for current object - could be undefined */
+ iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */
+ iod_obj_id_t grp_id = input->grp_id; /* The ID of the group that needs to be created */
+ const char *name = input->name; /* path relative to loc_id and loc_oh */
+ iod_handle_t grp_oh, cur_oh, mdkv_oh;
+ iod_obj_id_t cur_id, mdkv_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;
+ hbool_t collective = FALSE; /* MSC - change when we allow for collective */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start group create %s\n", name);
+#endif
+
+ /* the traversal will retrieve the location where the group needs
+ to be created. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE,
+ &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* create the group */
+ ret = iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
+ NULL, NULL, &grp_id, NULL);
+ if(collective && (0 == ret || EEXISTS == ret)) {
+ /* group has been created by another process, open it */
+ if (iod_obj_open_write(coh, grp_id, NULL, &grp_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Group");
+ }
+ else if(!collective && 0 != ret) {
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Group");
+ }
+
+ /* for the process that succeeded in creating the group, create
+ the scratch pad for it too */
+ if(0 == ret) {
+ /* insert new group in kv store of parent object */
+ kv.key = HDstrdup(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");
+ HDfree(kv.key);
+
+ /* create the metadata KV object for the group */
+ if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
+ NULL, NULL, &mdkv_id, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object");
+
+ /* set values for the scratch pad object */
+ sp.mdkv_id = mdkv_id;
+ sp.attr_id = IOD_ID_UNDEFINED;
+ sp.filler1_id = IOD_ID_UNDEFINED;
+ sp.filler2_id = IOD_ID_UNDEFINED;
+
+ /* set scratch pad in group */
+ 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 */
+ 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");
+
+ /* MSC - TODO store things */
+
+ if(iod_obj_close(mdkv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ } /* end if */
+
+ /* close parent group if it is not the location we started the
+ traversal into */
+ if(loc_handle.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+#if H5_DO_NATIVE
+ grp_oh.cookie = H5Gcreate2(loc_handle.cookie, name, input->lcpl_id,
+ input->gcpl_id, input->gapl_id);
+ HDassert(grp_oh.cookie);
+#endif
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with group create, sending response to client\n");
+#endif
+
+ /* return the object handle for the group to the client */
+ output.iod_oh = grp_oh;
+ HG_Handler_start_output(op_data->hg_handle, &output);
+
+done:
+ /* return an UNDEFINED oh to the client if the operation failed */
+ if(ret_value < 0) {
+ fprintf(stderr, "Failed Group Create\n");
+ output.iod_oh.cookie = IOD_OH_UNDEFINED;
+ HG_Handler_start_output(op_data->hg_handle, &output);
+ }
+
+ last_comp = (char *)H5MM_xfree(last_comp);
+ input = (group_create_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_group_create_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_group_open_cb
+ *
+ * Purpose: Opens a group as a iod object.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * February, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ 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_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;
+ char *last_comp; /* the name of the group obtained from traversal function */
+ iod_size_t kv_size;
+ scratch_pad_t sp;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start group open %s\n", name);
+#endif
+
+ /* the traversal will retrieve the location where the group needs
+ to be created. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE,
+ &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);
+
+ /* lookup group in the current location */
+ if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &grp_id, &kv_size, NULL, NULL) < 0) {
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Intermdiate group does not exist");
+ } /* end if */
+
+ /* close parent group and its scratch pad if it is not the
+ location we started the traversal into */
+ if(loc_handle.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+ /* open the group */
+ if (iod_obj_open_write(coh, grp_id, NULL, &cur_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+
+ /* get scratch pad of group */
+ 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");
+
+ /* open the metadata scratch pad */
+ 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
+ /* When we have a real IOD, open the scratch pad and read the
+ group's metadata */
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_gcpl", NULL,
+ &output.gcpl_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset gcpl lookup failed");
+ if(NULL == (output.gcpl = H5MM_malloc (output.gcpl_size)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate gcpl buffer");
+ if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_gcpl", output.gcpl,
+ &output.gcpl_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dcpl lookup failed");
+#endif
+
+ /* close the metadata scratch pad */
+ if(iod_obj_close(mdkv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close meta data KV handle");
+
+#if H5_DO_NATIVE
+ cur_oh.cookie = H5Gopen(loc_handle.cookie, name, input->gapl_id);
+ HDassert(cur_oh.cookie);
+#endif
+
+ output.iod_id = grp_id;
+ output.iod_oh = cur_oh;
+ output.gcpl_id = H5P_GROUP_CREATE_DEFAULT;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with group open, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &output);
+
+done:
+ if(ret_value < 0) {
+ output.iod_oh.cookie = IOD_OH_UNDEFINED;
+ output.iod_id = IOD_ID_UNDEFINED;
+ output.gcpl_id = H5P_GROUP_CREATE_DEFAULT;
+ HG_Handler_start_output(op_data->hg_handle, &output);
+ }
+
+ last_comp = (char *)H5MM_xfree(last_comp);
+ input = (group_open_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_group_open_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_group_close_cb
+ *
+ * Purpose: Closes iod HDF5 group.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * January, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_group_close_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ group_close_in_t *input = (group_close_in_t *)op_data->input;
+ iod_handle_t iod_oh = input->iod_oh;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start group close\n");
+#endif
+
+ if(iod_oh.cookie != IOD_OH_UNDEFINED) {
+#if H5_DO_NATIVE
+ ret_value = H5Gclose(iod_oh.cookie);
+#endif
+ if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ }
+ else {
+ /* MSC - need a way to kill object handle for this group */
+ fprintf(stderr, "I do not have the OH of this group to close it\n");
+ }
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with group close, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+
+ input = (group_close_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_group_close_cb() */
+
+#endif /* H5_HAVE_EFF */
diff --git a/src/H5VLiod_link.c b/src/H5VLiod_link.c
new file mode 100644
index 0000000..bf24949
--- /dev/null
+++ b/src/H5VLiod_link.c
@@ -0,0 +1,470 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "H5VLiod_server.h"
+
+#ifdef H5_HAVE_EFF
+
+/*
+ * Programmer: Mohamad Chaarawi <chaarawi@hdfgroup.gov>
+ * June, 2013
+ *
+ * Purpose: The IOD plugin server side link routines.
+ */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_link_create_cb
+ *
+ * Purpose: Creates a new link in the container (Hard or Soft).
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * May, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ link_create_in_t *input = (link_create_in_t *)op_data->input;
+ H5VL_link_create_type_t create_type = input->create_type;
+ iod_handle_t coh = input->coh; /* the container handle */
+ iod_handle_t src_oh; /* The handle for creation src object */
+ iod_obj_id_t src_id; /* The ID of the creation src object */
+ iod_handle_t cur_oh, target_oh;
+ iod_obj_id_t cur_id;
+ iod_obj_id_t target_id; /* The ID of the target object where link is created*/
+ char *src_last_comp = NULL, *dst_last_comp = NULL;
+ iod_kv_t kv;
+ iod_size_t kv_size = sizeof(iod_obj_id_t);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start link create\n");
+#endif
+
+ /* the traversal will retrieve the location where the link needs
+ to be created from. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, input->loc_id, input->loc_oh, input->loc_name, FALSE,
+ &src_last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* lookup group in the current location */
+ if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, src_last_comp, &src_id, &kv_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Intermdiate group does not exist");
+
+ /* close parent group if it is not the location we started the
+ traversal into */
+ if(input->loc_oh.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+ /* open the source group for link creation*/
+ if (iod_obj_open_write(coh, src_id, NULL, &src_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+
+ if(H5VL_LINK_CREATE_HARD == create_type) {
+ /* Retrieve the parent of the object where the new link points
+ to. The traversal must not fail. */
+ if(H5VL_iod_server_traverse(coh, input->target_loc_id, input->target_loc_oh,
+ input->target_name, FALSE,
+ &dst_last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't traverse path");
+
+ /* lookup target object in the current location - the lookup
+ must succeed since this is a hard link. */
+ if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, dst_last_comp, &target_id, &kv_size,
+ NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Intermdiate group does not exist");
+ }
+ else if(H5VL_LINK_CREATE_SOFT == create_type) {
+ /* Retrieve the parent of the object where the new link points
+ to. The traversal must not fail. */
+ if(H5VL_iod_server_traverse(coh, input->target_loc_id, input->target_loc_oh,
+ input->target_name, FALSE,
+ &dst_last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't traverse path");
+
+ /* lookup target object in the current location. The lookup
+ might fail since this is a soft link */
+ if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, dst_last_comp,
+ &target_id, &kv_size, NULL, NULL) < 0) {
+ /* the lookup failed so just insert the target_id as
+ undefined in the src object */
+ /* MSC - Figure out what to do when reaccessing this
+ object after it was created */
+ target_id = IOD_ID_UNDEFINED;
+ }
+ }
+ else
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Invalid Link type");
+
+ /* close parent group if it is not the location we started the
+ traversal into */
+ if(input->loc_oh.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+ /* insert new link (target group's ID) in kv store of the source object */
+ kv.key = HDstrdup(src_last_comp);
+ kv.value = &target_id;
+ kv.value_len = kv_size;
+ if (iod_kv_set(src_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);
+
+ /* close the source group */
+ if(src_oh.cookie != input->loc_oh.cookie) {
+ iod_obj_close(src_oh, NULL, NULL);
+ }
+
+ /* open the target object */
+ if (iod_obj_open_write(coh, target_id, NULL, &target_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
+
+ /* MSC - update metadata link information for this object */
+
+ /* close the target object */
+ iod_obj_close(target_oh, NULL, NULL);
+
+#if H5_DO_NATIVE
+ if(H5VL_LINK_CREATE_HARD == create_type) {
+ if(H5Lcreate_hard(input->target_loc_oh.cookie, input->target_name,
+ input->loc_oh.cookie, input->loc_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create hard link");
+ }
+ else if(H5VL_LINK_CREATE_SOFT == create_type) {
+ if(H5Lcreate_soft(input->target_name, input->loc_oh.cookie, input->loc_name,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create soft link");
+ }
+ else
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Invalid Link type");
+#endif
+
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with link create, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+
+ src_last_comp = (char *)H5MM_xfree(src_last_comp);
+ dst_last_comp = (char *)H5MM_xfree(dst_last_comp);
+ input = (link_create_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_link_create_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_link_move_cb
+ *
+ * Purpose: Moves/Copies a link in the container.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * May, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_link_move_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ link_move_in_t *input = (link_move_in_t *)op_data->input;
+ hbool_t copy_flag = input->copy_flag;
+ iod_handle_t coh = input->coh; /* the container handle */
+ iod_handle_t src_oh; /* The handle for src object group */
+ iod_obj_id_t src_id; /* The ID of the src object */
+ iod_handle_t dst_oh; /* The handle for the dst object where link is created*/
+ iod_obj_id_t dst_id; /* The ID of the dst object where link is created*/
+ iod_obj_id_t obj_id; /* The ID of the object to be moved/copied */
+ char *last_comp = NULL;
+ iod_kv_t kv;
+ iod_size_t kv_size = sizeof(iod_obj_id_t);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start link move\n");
+#endif
+
+ /* the traversal will retrieve the location where the link needs
+ to be moved/copied from. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, input->src_loc_id, input->src_loc_oh, input->src_loc_name,
+ FALSE, &last_comp, &src_id, &src_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* the traversal will retrieve the location where the link needs
+ to be moved/copied to. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, input->dst_loc_id, input->dst_loc_oh, input->dst_loc_name,
+ FALSE, NULL, &dst_id, &dst_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* lookup object ID in the current src location */
+ if(iod_kv_get_value(src_oh, IOD_TID_UNKNOWN, last_comp, &obj_id, &kv_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Object does not exist in source path");
+
+ /* Insert object in the destination path */
+ kv.key = HDstrdup(last_comp);
+ kv.value = &obj_id;
+ kv.value_len = kv_size;
+ if (iod_kv_set(dst_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
+
+ /* if the operation type is a Move, remove the KV pair from the source object */
+ if(!copy_flag) {
+ iod_kv_params_t kvs;
+
+ kvs.kv = &kv;
+ if(iod_kv_unlink_keys(src_oh,IOD_TID_UNKNOWN, NULL, 1, &kvs, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
+ }
+
+ HDfree(kv.key);
+
+ /* close source group if it is not the location we started the
+ traversal into */
+ if(input->src_loc_oh.cookie != src_oh.cookie) {
+ iod_obj_close(src_oh, NULL, NULL);
+ }
+
+ /* close parent group if it is not the location we started the
+ traversal into */
+ if(input->dst_loc_oh.cookie != dst_oh.cookie) {
+ iod_obj_close(dst_oh, NULL, NULL);
+ }
+
+#if H5_DO_NATIVE
+ if(copy_flag) {
+ if(H5Lcopy(input->src_loc_oh.cookie, input->src_loc_name,
+ input->dst_loc_oh.cookie, input->dst_loc_name,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create hard link");
+ }
+ else {
+ if(H5Lmove(input->src_loc_oh.cookie, input->src_loc_name,
+ input->dst_loc_oh.cookie, input->dst_loc_name,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create hard link");
+ }
+#endif
+
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with link move, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+
+ last_comp = (char *)H5MM_xfree(last_comp);
+ input = (link_move_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_link_move_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_link_exists_cb
+ *
+ * Purpose: Checks if a link exists.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * May, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_link_exists_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ link_op_in_t *input = (link_op_in_t *)op_data->input;
+ iod_handle_t coh = input->coh;
+ iod_handle_t loc_oh = input->loc_oh;
+ iod_obj_id_t loc_id = input->loc_id;
+ iod_handle_t cur_oh;
+ iod_obj_id_t cur_id;
+ const char *loc_name = input->path;
+ char *last_comp = NULL;
+ htri_t ret = -1;
+ iod_size_t kv_size = sizeof(iod_obj_id_t);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start link Exists\n");
+#endif
+
+ /* the traversal will retrieve the location where the link needs
+ to be checked */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, FALSE,
+ &last_comp, &cur_id, &cur_oh) < 0) {
+ ret = FALSE;
+ HGOTO_DONE(SUCCEED);
+ }
+
+ /* check the last component */
+ if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp,
+ &cur_id, &kv_size, NULL, NULL) < 0) {
+ ret = FALSE;
+ } /* end if */
+ else {
+ ret = TRUE;
+ }
+
+#if H5_DO_NATIVE
+ ret = H5Lexists(loc_oh.cookie, loc_name, H5P_DEFAULT);
+#else
+ ret = FALSE;
+#endif
+
+done:
+
+ /* close parent group if it is not the location we started the
+ traversal into */
+ if(loc_oh.cookie != IOD_OH_UNDEFINED && input->loc_oh.cookie != loc_oh.cookie) {
+ iod_obj_close(loc_oh, NULL, NULL);
+ }
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with link exists, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret);
+
+ input = (link_op_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ last_comp = (char *)H5MM_xfree(last_comp);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_link_exists_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_link_remove_cb
+ *
+ * Purpose: Removes a link from a container.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * May, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_link_remove_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ link_op_in_t *input = (link_op_in_t *)op_data->input;
+ iod_handle_t coh = input->coh;
+ iod_handle_t loc_oh = input->loc_oh;
+ iod_obj_id_t loc_id = input->loc_id;
+ iod_handle_t cur_oh;
+ iod_obj_id_t cur_id, obj_id;
+ const char *loc_name = input->path;
+ char *last_comp = NULL;
+ iod_kv_params_t kvs;
+ iod_kv_t kv;
+ iod_size_t kv_size = sizeof(iod_obj_id_t);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start link Remove\n");
+#endif
+
+ /* the traversal will retrieve the location where the link needs
+ to be removed. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name,
+ FALSE, &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* lookup object ID in the current location */
+ if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &obj_id, &kv_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Object does not exist in source path");
+
+ /* unlink object from conainer */
+ kv.key = HDstrdup(last_comp);
+ kv.value = &obj_id;
+ kv.value_len = kv_size;
+ kvs.kv = &kv;
+ if(iod_kv_unlink_keys(cur_oh, IOD_TID_UNKNOWN, NULL, 1, &kvs, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
+ HDfree(kv.key);
+
+ /* MSC - check the metadata information for the object and remove
+ it from the container if this is the last link to it */
+
+ /* close location object */
+ if(input->loc_oh.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+#if H5_DO_NATIVE
+ if(H5Ldelete(loc_oh.cookie, loc_name, H5P_DEFAULT) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
+#endif
+
+done:
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with link remove, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+
+ last_comp = (char *)H5MM_xfree(last_comp);
+ input = (link_op_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_link_remove_cb() */
+
+#endif /* H5_HAVE_EFF */
diff --git a/src/H5VLiod_obj.c b/src/H5VLiod_obj.c
new file mode 100644
index 0000000..be0dfe0
--- /dev/null
+++ b/src/H5VLiod_obj.c
@@ -0,0 +1,579 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * 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://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include "H5VLiod_server.h"
+
+#ifdef H5_HAVE_EFF
+
+/*
+ * Programmer: Mohamad Chaarawi <chaarawi@hdfgroup.gov>
+ * June, 2013
+ *
+ * Purpose: The IOD plugin server side general object routines.
+ */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_object_open_cb
+ *
+ * Purpose: Opens an existing object in the container
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * May, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ object_op_in_t *input = (object_op_in_t *)op_data->input;
+ object_open_out_t output;
+ iod_handle_t coh = input->coh; /* the container handle */
+ iod_handle_t obj_oh; /* The handle for object */
+ iod_obj_id_t obj_id; /* The ID of the object */
+ iod_handle_t cur_oh, mdkv_oh;
+ iod_obj_id_t cur_id;
+ char *last_comp = NULL;
+ iod_kv_t kv;
+ scratch_pad_t sp;
+ iod_size_t kv_size = sizeof(iod_obj_id_t);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start Object Open\n");
+#endif
+
+ /* the traversal will retrieve the location where the object needs
+ to be opened to be created from. The traversal will fail if an
+ intermediate group does not exist. */
+ if(H5VL_iod_server_traverse(coh, input->loc_id, input->loc_oh, input->loc_name, FALSE,
+ last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* lookup object in the current location */
+ if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &obj_id, &kv_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Intermdiate group does not exist");
+
+ /* close parent group if it is not the location we started the
+ traversal into */
+ if(input->loc_oh.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+ /* open the object */
+ 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 */
+ 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");
+
+ /* open the metadata scratch pad */
+ 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 - Read object's metadata */
+
+ /* 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 H5_DO_NATIVE
+ obj_oh.cookie = H5Oopen(input->loc_oh.cookie, input->loc_name, H5P_DEFAULT);
+ output.obj_type = H5Iget_type(obj_oh.cookie);
+ switch(output.obj_type){
+ case H5I_GROUP:
+ output.cpl_id = H5P_GROUP_CREATE_DEFAULT;
+ output.type_id = 0;
+ output.space_id = 0;
+ break;
+ case H5I_DATASET:
+ output.cpl_id = H5P_DATASET_CREATE_DEFAULT;
+ output.type_id = H5Dget_type(obj_oh.cookie);
+ output.space_id = H5Dget_space(obj_oh.cookie);
+ break;
+ case H5I_DATATYPE:
+ output.cpl_id = H5P_DATATYPE_CREATE_DEFAULT;
+ output.type_id = obj_oh.cookie;
+ output.space_id = 0;
+ break;
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "not a valid object (dataset, group, or datatype)")
+ }
+#else
+ /* Fake something */
+ output.obj_type = H5I_GROUP;
+ output.cpl_id = H5P_GROUP_CREATE_DEFAULT;
+ output.type_id = 0;
+ output.space_id = 0;
+#endif
+
+ output.iod_id = obj_id;
+ output.iod_oh = obj_oh;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with object open, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &output);
+
+done:
+ if(ret_value < 0) {
+ output.iod_oh.cookie = IOD_OH_UNDEFINED;
+ output.iod_id = IOD_ID_UNDEFINED;
+ output.cpl_id = H5P_GROUP_CREATE_DEFAULT;
+ HG_Handler_start_output(op_data->hg_handle, &output);
+ }
+
+ switch(output.obj_type){
+ case H5I_GROUP:
+ break;
+ case H5I_DATASET:
+#if H5_DO_NATIVE
+ H5Tclose(output.type_id);
+ H5Sclose(output.space_id);
+#endif
+ break;
+ case H5I_DATATYPE:
+ break;
+ default:
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "not a valid object (dataset, group, or datatype)")
+ }
+
+ last_comp = (char *)H5MM_xfree(last_comp);
+ input = (object_op_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_object_open_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_object_copy_cb
+ *
+ * Purpose: Moves/Copies a link in the container.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * May, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_object_copy_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ object_copy_in_t *input = (object_copy_in_t *)op_data->input;
+ iod_handle_t coh = input->coh; /* the container handle */
+ iod_handle_t src_oh; /* The handle for src object group */
+ iod_obj_id_t src_id; /* The ID of the src object */
+ iod_handle_t dst_oh; /* The handle for the dst object where link is created*/
+ iod_obj_id_t dst_id; /* The ID of the dst object where link is created*/
+ iod_obj_id_t obj_id; /* The ID of the object to be moved/copied */
+ char *last_comp = NULL, *new_name;
+ iod_kv_t kv;
+ iod_size_t kv_size = sizeof(iod_obj_id_t);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Start object copy\n");
+#endif
+
+ /* the traversal will retrieve the location where the object
+ exists. The traversal will fail if an intermediate group does
+ not exist. */
+ if(H5VL_iod_server_traverse(coh, input->src_loc_id, input->src_loc_oh, input->src_loc_name,
+ FALSE, &last_comp, &src_id, &src_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* the traversal will retrieve the location where the objects
+ needs to be copied to. The traversal will fail if an
+ intermediate group does not exist. */
+ if(H5VL_iod_server_traverse(coh, input->dst_loc_id, input->dst_loc_oh, input->dst_loc_name,
+ FALSE, &new_name, &dst_id, &dst_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* lookup object ID in the current src location */
+ if(iod_kv_get_value(src_oh, IOD_TID_UNKNOWN, last_comp, &obj_id, &kv_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Object does not exist in source path");
+
+ /* create new object as a copy of the source object */
+ /* MSC - wait to see if IOD will have an object copy */
+
+ /* Insert object in the destination path */
+ kv.key = HDstrdup(new_name);
+ kv.value = &obj_id;
+ kv.value_len = kv_size;
+ if (iod_kv_set(dst_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);
+
+ /* close source group if it is not the location we started the
+ traversal into */
+ if(input->src_loc_oh.cookie != src_oh.cookie) {
+ iod_obj_close(src_oh, NULL, NULL);
+ }
+
+ /* close dst group if it is not the location we started the
+ traversal into */
+ if(input->dst_loc_oh.cookie != dst_oh.cookie) {
+ iod_obj_close(dst_oh, NULL, NULL);
+ }
+
+#if H5_DO_NATIVE
+ if(H5Ocopy(input->src_loc_oh.cookie, input->src_loc_name,
+ input->dst_loc_oh.cookie, input->dst_loc_name,
+ H5P_DEFAULT, H5P_DEFAULT) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't copy object");
+#endif
+
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with object Copy, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+
+ last_comp = (char *)H5MM_xfree(last_comp);
+ if(new_name)
+ free(new_name);
+ input = (object_copy_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_object_copy_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_object_exists_cb
+ *
+ * Purpose: Checks if an object exists.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * May, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_object_exists_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ object_op_in_t *input = (object_op_in_t *)op_data->input;
+ iod_handle_t coh = input->coh;
+ iod_handle_t loc_oh = input->loc_oh;
+ iod_obj_id_t loc_id = input->loc_id;
+ iod_handle_t cur_oh;
+ iod_obj_id_t cur_id;
+ const char *loc_name = input->loc_name;
+ char *last_comp = NULL;
+ htri_t ret = -1;
+ iod_size_t kv_size = sizeof(iod_obj_id_t);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* the traversal will retrieve the location where the object needs
+ to be checked */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, FALSE,
+ &last_comp, &cur_id, &cur_oh) < 0) {
+ ret = FALSE;
+ HGOTO_DONE(SUCCEED);
+ }
+
+ /* check the last component */
+ if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp,
+ &cur_id, &kv_size, NULL, NULL) < 0) {
+ ret = FALSE;
+ } /* end if */
+ else {
+ iod_handle_t obj_oh;
+ /* try to open the object */
+ if (iod_obj_open_write(coh, cur_id, NULL, &obj_oh, NULL) < 0) {
+ ret = FALSE;
+ HGOTO_DONE(SUCCEED);
+ }
+ else {
+ /* close the object */
+ iod_obj_close(obj_oh, NULL, NULL);
+ ret = TRUE;
+ }
+ }
+
+#if H5_DO_NATIVE
+ ret = H5Oexists_by_name(loc_oh.cookie, loc_name, H5P_DEFAULT);
+#else
+ ret = FALSE;
+#endif
+
+done:
+
+ /* close parent group if it is not the location we started the
+ traversal into */
+ if(loc_oh.cookie != IOD_OH_UNDEFINED && input->loc_oh.cookie != loc_oh.cookie) {
+ iod_obj_close(loc_oh, NULL, NULL);
+ }
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with Object exists, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret);
+
+ input = (object_op_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+ last_comp = (char *)H5MM_xfree(last_comp);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_object_exists_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_object_set_comment_cb
+ *
+ * Purpose: Set comment for an object.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * May, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_object_set_comment_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ object_set_comment_in_t *input = (object_set_comment_in_t *)op_data->input;
+ iod_handle_t coh = input->coh;
+ iod_handle_t loc_oh = input->loc_oh;
+ iod_obj_id_t loc_id = input->loc_id;
+ iod_handle_t cur_oh, mdkv_oh;
+ iod_obj_id_t cur_id, obj_id;
+ const char *loc_name = input->path;
+ const char *comment = input->comment;
+ char *last_comp = NULL;
+ iod_kv_params_t kvs;
+ iod_kv_t kv;
+ scratch_pad_t sp;
+ iod_size_t kv_size = sizeof(iod_obj_id_t);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* the traversal will retrieve the location where the link needs
+ to be removed. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name,
+ FALSE, &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* lookup object ID in the current location */
+ if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &obj_id, &kv_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Object does not exist in source path");
+
+ /* close parent group and its scratch pad if it is not the
+ location we started the traversal into */
+ if(loc_oh.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+ /* open the object */
+ if (iod_obj_open_write(coh, obj_id, NULL /*hints*/, &cur_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open object");
+
+ /* 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");
+
+ /* open the metadata scratch pad */
+ 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 - update scratch pad with comment */
+
+ /* close metadata KV and object */
+ if(iod_obj_close(mdkv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ if(iod_obj_close(cur_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+
+#if H5_DO_NATIVE
+ if(H5Oset_comment(loc_oh.cookie, comment) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Unable to set object comment");
+#endif
+
+done:
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with set comment, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &ret_value);
+
+ last_comp = (char *)H5MM_xfree(last_comp);
+ input = (object_set_comment_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_object_set_comment_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_iod_server_object_get_comment_cb
+ *
+ * Purpose: Get comment for an object.
+ *
+ * Return: Success: SUCCEED
+ * Failure: Negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * May, 2013
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine,
+ size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
+ size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
+ void *_op_data)
+{
+ op_data_t *op_data = (op_data_t *)_op_data;
+ object_get_comment_in_t *input = (object_get_comment_in_t *)op_data->input;
+ object_get_comment_out_t output;
+ name_t comment;
+ iod_handle_t coh = input->coh;
+ iod_handle_t loc_oh = input->loc_oh;
+ iod_obj_id_t loc_id = input->loc_id;
+ size_t length = input->length;
+ iod_handle_t cur_oh, mdkv_oh;
+ iod_obj_id_t cur_id, obj_id;
+ const char *loc_name = input->path;
+ char *last_comp = NULL;
+ iod_kv_params_t kvs;
+ iod_kv_t kv;
+ iod_size_t kv_size = sizeof(iod_obj_id_t);
+ scratch_pad_t sp;
+ ssize_t size = 0;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* the traversal will retrieve the location where the link needs
+ to be removed. The traversal will fail if an intermediate group
+ does not exist. */
+ if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name,
+ FALSE, &last_comp, &cur_id, &cur_oh) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
+
+ /* lookup object ID in the current location */
+ if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &obj_id, &kv_size, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Object does not exist in source path");
+
+ /* close parent group and its scratch pad if it is not the
+ location we started the traversal into */
+ if(loc_oh.cookie != cur_oh.cookie) {
+ iod_obj_close(cur_oh, NULL, NULL);
+ }
+
+ /* open the object */
+ if (iod_obj_open_write(coh, obj_id, NULL /*hints*/, &cur_oh, NULL) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open object");
+
+ /* 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");
+
+ /* open the metadata scratch pad */
+ 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 - Get comment from MD KV store*/
+
+ /* close metadata KV and object */
+ if(iod_obj_close(mdkv_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+ if(iod_obj_close(cur_oh, NULL, NULL))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
+
+ comment.value_size = (ssize_t *)malloc(sizeof(ssize_t));
+ comment.value = NULL;
+ comment.size = length;
+
+#if H5_DO_NATIVE
+ if(0 != length) {
+ size = H5Oget_comment(loc_oh.cookie, NULL, length);
+ comment.value = malloc(size);
+ }
+ if((size = H5Oget_comment(loc_oh.cookie, comment.value, length)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Unable to get object comment");
+#else
+ if(length) {
+ comment.value = strdup("fake comment");
+ size = strlen(comment.value) + 1;
+ }
+ else
+ size = 22;
+#endif
+
+ *comment.value_size = size;
+
+done:
+ output.ret = ret_value;
+ output.name = comment;
+
+#if H5VL_IOD_DEBUG
+ fprintf(stderr, "Done with get comment, sending response to client\n");
+#endif
+
+ HG_Handler_start_output(op_data->hg_handle, &output);
+
+ if(comment.value)
+ free(comment.value);
+ free(comment.value_size);
+
+ last_comp = (char *)H5MM_xfree(last_comp);
+ input = (object_get_comment_in_t *)H5MM_xfree(input);
+ op_data = (op_data_t *)H5MM_xfree(op_data);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL_iod_server_object_get_comment_cb() */
+
+#endif /* H5_HAVE_EFF */
diff --git a/src/H5VLiod_server.c b/src/H5VLiod_server.c
index cc417076..66b0787 100644
--- a/src/H5VLiod_server.c
+++ b/src/H5VLiod_server.c
@@ -33,8 +33,6 @@
#ifdef H5_HAVE_EFF
-#define H5_DO_NATIVE 0
-
/*
* Programmer: Mohamad Chaarawi <chaarawi@hdfgroup.gov>
* February, 2013
@@ -49,15 +47,6 @@ static int num_peers = 0;
static int terminate_requests = 0;
static hbool_t shutdown = FALSE;
-#define EEXISTS 1
-
-H5FL_BLK_EXTERN(type_conv);
-
-static 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);
-
#if 0
static herr_t H5VL_iod_typeinfo_init(hid_t dset_type_id, const H5D_dxpl_cache_t *dxpl_cache,
hid_t dxpl_id, hid_t mem_type_id, hbool_t do_write,
@@ -65,140 +54,6 @@ static herr_t H5VL_iod_typeinfo_init(hid_t dset_type_id, const H5D_dxpl_cache_t
static herr_t H5VL_iod_typeinfo_term(const H5D_type_info_t *type_info);
#endif
-static void H5VL_iod_server_file_create_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_file_open_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_file_close_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_file_flush_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_attr_create_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_attr_open_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_attr_read_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_attr_write_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_attr_exists_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_attr_rename_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_attr_remove_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_attr_close_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_group_create_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_group_open_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_group_close_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_dset_create_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_dset_open_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_dset_read_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_dset_write_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_dset_set_extent_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_dset_close_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_dtype_commit_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_dtype_open_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_dtype_close_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_link_create_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_link_move_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_link_exists_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_link_remove_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-
-static void H5VL_iod_server_object_open_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_object_copy_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_object_exists_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_object_set_comment_cb(AXE_engine_t axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *op_data);
-static void H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine,
- size_t num_n_parents, AXE_task_t n_parents[],
- size_t num_s_parents, AXE_task_t s_parents[],
- void *_op_data);
-
herr_t
H5VLiod_start_handler(MPI_Comm comm, MPI_Info UNUSED info)
{
@@ -317,7 +172,6 @@ H5VLiod_start_handler(MPI_Comm comm, MPI_Info UNUSED info)
/* Loop tp receive requests from clients */
while(1) {
- /*fprintf(stderr, "Server In Loop\n");*/
/* Receive new function calls */
if(HG_SUCCESS != HG_Handler_process(HG_HANDLER_MAX_IDLE_TIME, HG_STATUS_IGNORE))
return FAIL;
@@ -362,9 +216,11 @@ H5VL_iod_server_eff_init(hg_handle_t handle)
FUNC_ENTER_NOAPI_NOINIT
+ /* get the input from the client connecting */
if(HG_FAIL == HG_Handler_get_input(handle, &num_procs))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, HG_FAIL, "can't get input parameters");
+ /* initialize the IOD library */
if(iod_initialize(iod_comm, NULL, num_procs, num_procs, NULL) < 0 )
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, HG_FAIL, "can't initialize");
@@ -397,8 +253,12 @@ H5VL_iod_server_eff_finalize(hg_handle_t handle)
FUNC_ENTER_NOAPI_NOINIT
+ /* increment the number of terminate requests received so far */
terminate_requests ++;
+ /* if all the peers that connected at the beginning have sent the
+ terminate request, then finalize IOD and indicate that it is
+ time to shutdown the server */
if(terminate_requests == num_peers) {
if(iod_finalize(NULL, NULL) < 0 )
HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, HG_FAIL, "can't finalize IOD");
@@ -2383,3794 +2243,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_iod_server_object_get_comment() */
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_file_create_cb
- *
- * Purpose: Creates a file as a iod HDF5 file.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * January, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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;
- iod_ret_t ret;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start file create %s %d %d\n", input->name, input->fapl_id, input->fcpl_id);
-#endif
-
- /* convert HDF5 flags to IOD flags */
- mode = (input->flags&H5F_ACC_RDWR) ? IOD_CONT_RW : IOD_CONT_RO;
- if (input->flags&H5F_ACC_CREAT)
- mode |= IOD_CONT_CREATE;
-
- /* Create the Container */
- if(iod_container_open(input->name, NULL /*hints*/, mode, &coh, NULL /*event*/) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't create container");
-
- /* create the root group */
- ret = iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV, NULL, NULL,
- &input->root_id, NULL);
- if(0 == ret || EEXISTS == ret) {
- /* root group has been created, open it */
- if (iod_obj_open_write(coh, input->root_id, NULL, &root_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
- }
- else {
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create root group");
- }
-
- /* for the process that succeeded in creating the group, create
- the scratch pad for it too */
- if(0 == ret) {
- scratch_pad_t sp;
-
- /* create the metadata KV object for the root group */
- if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
- NULL, NULL, &mdkv_id, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object");
-
- /* set values for the scratch pad object */
- sp.mdkv_id = mdkv_id;
- sp.attr_id = IOD_ID_UNDEFINED;
- sp.filler1_id = IOD_ID_UNDEFINED;
- sp.filler2_id = IOD_ID_UNDEFINED;
-
- /* set scratch pad in root group */
- if (iod_obj_set_scratch(root_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 */
- 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");
-
- /* MSC - TODO store things */
-
- if(iod_obj_close(mdkv_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle");
- }
-
-#if H5_DO_NATIVE
- coh.cookie = H5Fcreate(input->name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(coh.cookie);
- root_oh.cookie = coh.cookie;
- fprintf(stderr, "Created Native file %s with ID %d\n", input->name, root_oh.cookie);
-#endif
-
- output.coh = coh;
- output.root_oh = root_oh;
- output.kv_oid_index = 1;
- output.array_oid_index = 1;
- output.blob_oid_index = 1;
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with file create, sending response to client \n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &output);
-
-done:
- if(ret_value < 0) {
- output.coh.cookie = IOD_OH_UNDEFINED;
- output.root_oh.cookie = IOD_OH_UNDEFINED;
- output.kv_oid_index = 0;
- output.array_oid_index = 0;
- output.blob_oid_index = 0;
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
- }
-
- input = (file_create_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_file_create_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_file_open_cb
- *
- * Purpose: Opens a file as a iod HDF5 file.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * January, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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;
- scratch_pad_t sp;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start file open %s %d %d\n", input->name, input->flags, input->fapl_id);
-#endif
-
- if(iod_container_open(input->name, NULL /*hints*/, mode, &coh, NULL /*event*/))
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open file");
-
- /* open the root group */
- if (iod_obj_open_write(coh, ROOT_ID, NULL /*hints*/, &root_oh, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't open root object");
-
- /* get scratch pad of root group */
- if(iod_obj_get_scratch(root_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't get scratch pad for root object");
-
- /* open the metadata scratch pad */
- 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 */
- output.kv_oid_index = 1;
- output.array_oid_index = 1;
- output.blob_oid_index = 1;
- output.fcpl_id = H5P_FILE_CREATE_DEFAULT;
-
- /* close the metadata scratch pad */
- if(iod_obj_close(mdkv_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close root object handle");
-
-#if H5_DO_NATIVE
- {
- coh.cookie = H5Fopen(input->name, H5F_ACC_RDWR, H5P_DEFAULT);
- HDassert(coh.cookie);
- root_oh.cookie = coh.cookie;
- fprintf(stderr, "Opened Native file %s with ID %d\n", input->name, root_oh.cookie);
- }
-#endif
-
- output.coh = coh;
- output.root_id = ROOT_ID;
- output.root_oh = root_oh;
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with file open, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &output);
-
-done:
- if(ret_value < 0) {
- output.coh.cookie = IOD_OH_UNDEFINED;
- output.root_id = IOD_ID_UNDEFINED;
- output.root_oh.cookie = IOD_OH_UNDEFINED;
- output.fcpl_id = H5P_FILE_CREATE_DEFAULT;
- output.kv_oid_index = 0;
- output.array_oid_index = 0;
- output.blob_oid_index = 0;
- HG_Handler_start_output(op_data->hg_handle, &output);
- }
-
- input = (file_open_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_file_open_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_file_flush_cb
- *
- * Purpose: Flushs iod HDF5 file.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * January, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_file_flush_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- file_flush_in_t *input = (file_flush_in_t *)op_data->input;
- iod_handle_t coh = input->coh;
- H5F_scope_t scope = input->scope;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* MSC - TODO */
-
-#if H5_DO_NATIVE
- ret_value = H5Fflush(coh.cookie, scope);
-#endif
-
-done:
- if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value))
- HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't send result of file flush to client");
-
- input = (file_flush_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_file_flush_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_file_close_cb
- *
- * Purpose: Closes iod HDF5 file.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * January, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- file_close_in_t *input = (file_close_in_t *)op_data->input;
- iod_handle_t coh = input->coh;
- iod_handle_t root_oh = input->root_oh;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start file close\n");
-#endif
-
-#if H5_DO_NATIVE
- H5Fclose(coh.cookie);
-#endif
-
- /* close the root group */
- if(iod_obj_close(root_oh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close root object handle");
-
- /* close the container */
- if(iod_container_close(coh, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close container");
-
-done:
- fprintf(stderr, "Done with file close, sending response to client\n");
- if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value))
- HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't send result of file close to client");
-
- input = (file_close_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_file_close_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_group_create_cb
- *
- * Purpose: Creates a group as a iod object.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * February, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- group_create_in_t *input = (group_create_in_t *)op_data->input;
- group_create_out_t output;
- iod_handle_t coh = input->coh; /* the container handle */
- iod_handle_t loc_handle = input->loc_oh; /* The handle for current object - could be undefined */
- iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */
- iod_obj_id_t grp_id = input->grp_id; /* The ID of the group that needs to be created */
- const char *name = input->name; /* path relative to loc_id and loc_oh */
- iod_handle_t grp_oh, cur_oh, mdkv_oh;
- iod_obj_id_t cur_id, mdkv_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;
- hbool_t collective = FALSE; /* MSC - change when we allow for collective */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start group create %s\n", name);
-#endif
-
- /* the traversal will retrieve the location where the group needs
- to be created. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE,
- &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* create the group */
- ret = iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
- NULL, NULL, &grp_id, NULL);
- if(collective && (0 == ret || EEXISTS == ret)) {
- /* group has been created by another process, open it */
- if (iod_obj_open_write(coh, grp_id, NULL, &grp_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Group");
- }
- else if(!collective && 0 != ret) {
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Group");
- }
-
- /* for the process that succeeded in creating the group, create
- the scratch pad for it too */
- if(0 == ret) {
- /* insert new group in kv store of parent object */
- kv.key = HDstrdup(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");
- HDfree(kv.key);
-
- /* create the metadata KV object for the group */
- if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
- NULL, NULL, &mdkv_id, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object");
-
- /* set values for the scratch pad object */
- sp.mdkv_id = mdkv_id;
- sp.attr_id = IOD_ID_UNDEFINED;
- sp.filler1_id = IOD_ID_UNDEFINED;
- sp.filler2_id = IOD_ID_UNDEFINED;
-
- /* set scratch pad in group */
- 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 */
- 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");
-
- /* MSC - TODO store things */
-
- if(iod_obj_close(mdkv_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- } /* end if */
-
- /* close parent group if it is not the location we started the
- traversal into */
- if(loc_handle.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-#if H5_DO_NATIVE
- grp_oh.cookie = H5Gcreate2(loc_handle.cookie, name, input->lcpl_id,
- input->gcpl_id, input->gapl_id);
- HDassert(grp_oh.cookie);
-#endif
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with group create, sending response to client\n");
-#endif
-
- /* return the object handle for the group to the client */
- output.iod_oh = grp_oh;
- HG_Handler_start_output(op_data->hg_handle, &output);
-
-done:
- /* return an UNDEFINED oh to the client if the operation failed */
- if(ret_value < 0) {
- fprintf(stderr, "Failed Group Create\n");
- output.iod_oh.cookie = IOD_OH_UNDEFINED;
- HG_Handler_start_output(op_data->hg_handle, &output);
- }
-
- last_comp = (char *)H5MM_xfree(last_comp);
- input = (group_create_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_group_create_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_group_open_cb
- *
- * Purpose: Opens a group as a iod object.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * February, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- 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_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;
- char *last_comp; /* the name of the group obtained from traversal function */
- iod_size_t kv_size;
- scratch_pad_t sp;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start group open %s\n", name);
-#endif
-
- /* the traversal will retrieve the location where the group needs
- to be created. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE,
- &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);
-
- /* lookup group in the current location */
- if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &grp_id, &kv_size, NULL, NULL) < 0) {
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Intermdiate group does not exist");
- } /* end if */
-
- /* close parent group and its scratch pad if it is not the
- location we started the traversal into */
- if(loc_handle.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
- /* open the group */
- if (iod_obj_open_write(coh, grp_id, NULL, &cur_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
-
- /* get scratch pad of group */
- 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");
-
- /* open the metadata scratch pad */
- 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
- /* When we have a real IOD, open the scratch pad and read the
- group's metadata */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_gcpl", NULL,
- &output.gcpl_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset gcpl lookup failed");
- if(NULL == (output.gcpl = H5MM_malloc (output.gcpl_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate gcpl buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_gcpl", output.gcpl,
- &output.gcpl_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dcpl lookup failed");
-#endif
-
- /* close the metadata scratch pad */
- if(iod_obj_close(mdkv_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close meta data KV handle");
-
-#if H5_DO_NATIVE
- cur_oh.cookie = H5Gopen(loc_handle.cookie, name, input->gapl_id);
- HDassert(cur_oh.cookie);
-#endif
-
- output.iod_id = grp_id;
- output.iod_oh = cur_oh;
- output.gcpl_id = H5P_GROUP_CREATE_DEFAULT;
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with group open, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &output);
-
-done:
- if(ret_value < 0) {
- output.iod_oh.cookie = IOD_OH_UNDEFINED;
- output.iod_id = IOD_ID_UNDEFINED;
- output.gcpl_id = H5P_GROUP_CREATE_DEFAULT;
- HG_Handler_start_output(op_data->hg_handle, &output);
- }
-
- last_comp = (char *)H5MM_xfree(last_comp);
- input = (group_open_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_group_open_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_group_close_cb
- *
- * Purpose: Closes iod HDF5 group.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * January, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_group_close_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- group_close_in_t *input = (group_close_in_t *)op_data->input;
- iod_handle_t iod_oh = input->iod_oh;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start group close\n");
-#endif
-
- if(iod_oh.cookie != IOD_OH_UNDEFINED) {
-#if H5_DO_NATIVE
- ret_value = H5Gclose(iod_oh.cookie);
-#endif
- if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- }
- else {
- /* MSC - need a way to kill object handle for this group */
- fprintf(stderr, "I do not have the OH of this group to close it\n");
- }
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with group close, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
-
- input = (group_close_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_group_close_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_dset_create_cb
- *
- * Purpose: Creates a dset as a iod object.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * February, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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_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;
- const char *name = input->name;
- 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;
- 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 */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* the traversal will retrieve the location where the dataset needs
- to be created. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE,
- &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* Set the IOD array creation parameters */
- array.cell_size = H5Tget_size(input->type_id);
- array.num_dims = H5Sget_simple_extent_ndims(input->space_id);
- if(NULL == (array.current_dims = (iod_size_t *)malloc (sizeof(iod_size_t) * array.num_dims)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dimention size array");
- if(NULL == (max_dims = (iod_size_t *)malloc (sizeof(iod_size_t) * array.num_dims)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dimention size array");
- if(H5Sget_simple_extent_dims(input->space_id, array.current_dims, max_dims) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes");
- array.firstdim_max = max_dims[0];
- array.chunk_dims = NULL;
- array.dims_seq = NULL;
-
- /* MSC - NEED TO FIX THAT */
-#if 0
- if(layout.type == H5D_CHUNKED) {
- if(NULL == (array.chunk_dims = malloc (sizeof(iod_size_t) * layout.u.chunk.ndims)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate chunk dimention size array");
- array.chunk_dims;
- }
-#endif
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "now creating the dataset %s cellsize %d num dimenstions %d\n",
- last_comp, array.cell_size, array.num_dims);
-#endif
-
- /* create the dataset */
- ret = iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_ARRAY, NULL, &array,
- &dset_id, NULL /*event*/);
- if(collective && (0 == ret || EEXISTS == ret)) {
- /* Dataset has been created by another process, open it */
- if (iod_obj_open_write(coh, dset_id, NULL, &dset_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Dataset");
- }
- else if(!collective && 0 != ret) {
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Dataset");
- }
-
- /* for the process that succeeded in creating the dataset, update
- the parent KV, create scratch pad */
- if(0 == ret) {
- kv.key = HDstrdup(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");
- HDfree(kv.key);
-
- /* create the metadata KV object for the dataset */
- if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
- NULL, NULL, &mdkv_id, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object");
-
- /* set values for the scratch pad object */
- sp.mdkv_id = mdkv_id;
- sp.attr_id = IOD_ID_UNDEFINED;
- sp.filler1_id = IOD_ID_UNDEFINED;
- sp.filler2_id = IOD_ID_UNDEFINED;
-
- /* set scratch pad in dataset */
- 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 */
- 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");
-
- /* MSC - TODO store things */
-#if 0
- /* insert layout metadata into scratch pad */
- kv.key = HDstrdup("dataset_dcpl");
- /* determine the buffer size needed to store the encoded dcpl of the dataset */
- if(H5Pencode(input->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(input->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");
- HDfree(kv.key);
- free(kv.value);
-
- /* insert datatyoe metadata into scratch pad */
- kv.key = HDstrdup("dataset_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");
- HDfree(kv.key);
- free(kv.value);
-
- kv.key = HDstrdup("dataset_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");
- HDfree(kv.key);
- free(kv.value);
-#endif
- /* close the Metadata KV object */
- if(iod_obj_close(mdkv_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
- traversal into */
- if(loc_handle.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
-#if H5_DO_NATIVE
- cur_oh.cookie = H5Dcreate2(loc_handle.cookie, last_comp, input->type_id,
- input->space_id, input->lcpl_id,
- input->dcpl_id, input->dapl_id);
- HDassert(cur_oh.cookie);
-#endif
-
- output.iod_oh = cur_oh;
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with dset create, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &output);
-
-done:
- /* return an UNDEFINED oh to the client if the operation failed */
- if(ret_value < 0) {
- output.iod_oh.cookie = IOD_OH_UNDEFINED;
- HG_Handler_start_output(op_data->hg_handle, &output);
- }
-
- if(max_dims) free(max_dims);
- if(array.current_dims) free(array.current_dims);
- last_comp = (char *)H5MM_xfree(last_comp);
- input = (dset_create_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_dset_create_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_dset_open_cb
- *
- * Purpose: Opens a dataset as a iod object.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * February, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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 cur_oh, mdkv_oh;
- iod_obj_id_t cur_id;
- iod_obj_id_t dset_id;
- char *name = input->name;
- char *last_comp;
- scratch_pad_t sp;
- iod_size_t kv_size = sizeof(iod_obj_id_t);
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start dataset Open %s\n", name);
-#endif
-
- /* the traversal will retrieve the location where the dataset needs
- to be opened. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE,
- &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &dset_id,
- kv_size , 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
- location we started the traversal into */
- if(loc_handle.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
- /* open the dataset */
- if (iod_obj_open_write(coh, dset_id, NULL /*hints*/, &cur_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open dataset");
-
- /* get scratch pad of the dataset */
- 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");
-
- /* open the metadata scratch pad */
- 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");
-
-#if 0
- /* MSC - retrieve all metadata from scratch pad */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_dcpl", NULL,
- &output.dcpl_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dcpl lookup failed");
- if(NULL == (output.dcpl = H5MM_malloc (output.dcpl_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dcpl buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_dcpl", output.dcpl,
- &output.dcpl_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dcpl lookup failed");
-
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_dtype", NULL,
- &output.dtype_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dtype lookup failed");
- if(NULL == (output.dtype = H5MM_malloc (output.dtype_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dtype buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_dtype", output.dtype,
- &output.dtype_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dtype lookup failed");
-
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_dspace", NULL,
- &output.dspace_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dspace lookup failed");
- if(NULL == (output.dspace = H5MM_malloc (output.dspace_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dspace buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "dataset_dspace", output.dspace,
- &output.dspace_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "dataset dspace lookup failed");
-#endif
-
- /* close the metadata scratch pad */
- if(iod_obj_close(mdkv_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
-
- {
- hsize_t dims[1];
- //hid_t space_id, type_id;
-
-#if H5_DO_NATIVE
- printf("dataset name %s location %d\n", name, loc_handle.cookie);
- cur_oh.cookie = H5Dopen(loc_handle.cookie, name, input->dapl_id);
- HDassert(cur_oh.cookie);
- output.space_id = H5Dget_space(cur_oh.cookie);
- output.type_id = H5Dget_type(cur_oh.cookie);
- output.dcpl_id = H5P_DATASET_CREATE_DEFAULT;
-#else
- /* fake a dataspace, type, and dcpl */
- dims [0] = 60;
- output.space_id = H5Screate_simple(1, dims, NULL);
- output.type_id = H5Tcopy(H5T_NATIVE_INT);
- output.dcpl_id = H5P_DATASET_CREATE_DEFAULT;
- cur_oh.cookie = 1;
-#endif
-
-#if 0
- output.dcpl_size = 0;
- output.dcpl = NULL;
-
- /* get Type size to encode */
- if(H5Tencode(type_id, NULL, &output.dtype_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode dataset type");
- if(NULL == (output.dtype = H5MM_malloc (output.dtype_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate datatype buffer");
- if(H5Tencode(type_id, output.dtype, &output.dtype_size) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype");
-
- /* get Dataspace size to encode */
- if(H5Sencode(space_id, NULL, &output.dspace_size)<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace");
- if(NULL == (output.dspace = H5MM_malloc (output.dspace_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate datatype buffer");
- if(H5Sencode(space_id, output.dspace, &output.dspace_size) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace");
-
- H5Sclose(space_id);
-#endif
-
- }
-
- dset_id = 1;
- output.iod_id = dset_id;
- output.iod_oh.cookie = cur_oh.cookie;
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with dset open, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &output);
-
-done:
- if(ret_value < 0) {
- output.iod_oh.cookie = IOD_OH_UNDEFINED;
- output.iod_id = IOD_ID_UNDEFINED;
- HG_Handler_start_output(op_data->hg_handle, &output);
- }
-
- H5Tclose(output.type_id);
- H5Sclose(output.space_id);
-
- input = (dset_open_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- last_comp = (char *)H5MM_xfree(last_comp);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_dset_open_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_dset_read_cb
- *
- * Purpose: Reads from IOD into the function shipper BDS handle.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * January, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_dset_read_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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;
- size_t size, buf_size, src_size, dst_size;
- void *buf;
- uint32_t cs = 0;
- size_t nelmts;
- na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle);
- hbool_t opened_locally = FALSE;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* open the dataset if we don't have the handle yet */
- if(iod_oh.cookie == IOD_OH_UNDEFINED) {
- if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
- opened_locally = TRUE;
- }
-
- size = HG_Bulk_handle_get_size(bulk_handle);
-
- nelmts = (size_t)H5Sget_simple_extent_npoints(space_id);
- src_size = H5Tget_size(src_id);
- dst_size = H5Tget_size(dst_id);
-
- /* adjust buffer size for datatype conversion */
- if(src_size > dst_size) {
- buf_size = src_size * nelmts;
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Adjusted Buffer size because of datatype conversion from %d to %d: ",
- size, buf_size);
-#endif
- }
- else {
- buf_size = dst_size * nelmts;
- assert(buf_size == size);
- }
-
- if(NULL == (buf = malloc(buf_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
-
- mem_desc.nfrag = 1;
- mem_desc.frag->addr = buf;
- mem_desc.frag->len = (iod_size_t)buf_size;
-
- /* MSC TODO - populate file location hyperslab */
-
- /* read from array object */
- if(iod_array_read(iod_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
-
- {
- int i;
- hbool_t flag = FALSE;
- int *buf_ptr = (int *)buf;
-
-#if H5_DO_NATIVE
- ret_value = H5Dread(iod_oh.cookie, src_id, H5S_ALL, space_id, dxpl_id, buf);
-#else /* fake data */
- for(i=0;i<60;++i)
- buf_ptr[i] = i;
-#endif
- if(H5Tconvert(src_id, dst_id, nelmts, buf, NULL, dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed");
-
- /* calculate a checksum for the data to be sent */
- cs = H5checksum(buf, size, NULL);
-
- /* MSC - check if client requested to corrupt data */
- if(dxpl_id != H5P_DEFAULT && H5Pget_dxpl_inject_corruption(dxpl_id, &flag) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read property list");
- if(flag) {
- fprintf(stderr, "Injecting a bad data value to cause corruption \n");
- buf_ptr[0] = 10;
- }
- }
-
- /* Create a new block handle to write the data */
- HG_Bulk_block_handle_create(buf, size, HG_BULK_READ_ONLY, &bulk_block_handle);
-
- /* Write bulk data here and wait for the data to be there */
- if(HG_SUCCESS != HG_Bulk_write_all(dest, bulk_handle, bulk_block_handle, &bulk_request))
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
- /* wait for it to complete */
- if(HG_SUCCESS != HG_Bulk_wait(bulk_request, HG_BULK_MAX_IDLE_TIME, HG_BULK_STATUS_IGNORE))
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
-
-done:
-
- output.ret = ret_value;
- output.cs = cs;
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with dset read, checksum %u, sending response to client\n", cs);
-#endif
-
- if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &output))
- HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client");
- if(HG_SUCCESS != HG_Bulk_block_handle_free(bulk_block_handle))
- HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't free bds block handle");
-
- input = (dset_io_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- free(buf);
-
- /* close the dataset if we opened it in this routine */
- if(opened_locally) {
- if(iod_obj_close(iod_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
- }
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_dset_read_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_dset_write_cb
- *
- * Purpose: Writes from IOD into the function shipper BDS handle.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * January, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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;
- uint32_t data_cs = 0;
- hid_t src_id = input->mem_type_id;
- hid_t dst_id = input->dset_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;
- size_t size, buf_size, src_size, dst_size;
- void *buf;
- size_t nelmts;
- hbool_t flag = FALSE;
- na_addr_t source = HG_Handler_get_addr(op_data->hg_handle);
- hbool_t opened_locally = FALSE;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Dataset Write with AXE ID %llu\n",input->axe_id);
-#endif
- /* open the dataset if we don't have the handle yet */
- if(iod_oh.cookie == IOD_OH_UNDEFINED) {
- if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
- opened_locally = TRUE;
- }
-
- /* Read bulk data here and wait for the data to be here */
- size = HG_Bulk_handle_get_size(bulk_handle);
-
- nelmts = (size_t)H5Sget_simple_extent_npoints(space_id);
- src_size = H5Tget_size(src_id);
- dst_size = H5Tget_size(dst_id);
-
- /* adjust buffer size for datatype conversion */
- if(src_size < dst_size) {
- buf_size = dst_size * nelmts;
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Adjusted Buffer size because of datatype conversion from %d to %d\n",
- size, buf_size);
-#endif
- }
- else {
- buf_size = src_size * nelmts;
- assert(buf_size == size);
- }
-
- if(NULL == (buf = malloc(buf_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
-
- HG_Bulk_block_handle_create(buf, size, HG_BULK_READWRITE, &bulk_block_handle);
-
- /* Write bulk data here and wait for the data to be there */
- if(HG_SUCCESS != HG_Bulk_read_all(source, bulk_handle, bulk_block_handle, &bulk_request))
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't get data from function shipper");
- /* wait for it to complete */
- if(HG_SUCCESS != HG_Bulk_wait(bulk_request, HG_BULK_MAX_IDLE_TIME, HG_BULK_STATUS_IGNORE))
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't get data from function shipper");
-
- /* free the bds block handle */
- if(HG_SUCCESS != HG_Bulk_block_handle_free(bulk_block_handle))
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't free bds block handle");
-
- /* MSC - check if client requested to corrupt data */
- if(dxpl_id != H5P_DEFAULT && H5Pget_dxpl_inject_corruption(dxpl_id, &flag) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read property list");
- if(flag) {
- ((int *)buf)[0] = 10;
- }
-
- /* If client specified a checksum, verify it */
- if(dxpl_id != H5P_DEFAULT && H5Pget_dxpl_checksum(dxpl_id, &data_cs) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read property list");
- if(data_cs != 0) {
- cs = H5_checksum_lookup4(buf, size, NULL);
- if(cs != data_cs) {
- fprintf(stderr, "Errrr.. Network transfer Data corruption. expecting %u, got %u\n",
- data_cs, cs);
- HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "Checksum verification failed");
- }
- }
-
- if(H5Tconvert(src_id, dst_id, nelmts, buf, NULL, dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed")
-
-#if H5VL_IOD_DEBUG
- {
- int i;
- int *buf_ptr = (int *)buf;
-
- fprintf(stderr, "DWRITE Received a buffer of size %d with values: ", size);
- for(i=0;i<60;++i)
- fprintf(stderr, "%d ", buf_ptr[i]);
- fprintf(stderr, "\n");
- }
-#endif
-
- mem_desc.nfrag = 1;
- mem_desc.frag->addr = buf;
- mem_desc.frag->len = (iod_size_t)buf_size;
-
- /* MSC TODO - populate file location hyperslab */
-
- /* write from array object */
- if(iod_array_write(iod_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, &cs, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't write to array object");
-
-#if H5_DO_NATIVE
- ret_value = H5Dwrite(iod_oh.cookie, H5T_NATIVE_INT, H5S_ALL, space_id, dxpl_id, buf);
-#endif
-
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with dset write, sending %d response to client\n", ret_value);
-#endif
-
- if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value))
- HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client");
-#if 0
- /* Shut down datatype info for operation */
- if(type_info_init && H5VL_iod_typeinfo_term(&type_info) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info")
-#endif
-
- input = (dset_io_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- free(buf);
-
- /* close the dataset if we opened it in this routine */
- if(opened_locally) {
- if(iod_obj_close(iod_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
- }
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_dset_write_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_dset_set_extent_cb
- *
- * Purpose: Set_Extents iod HDF5 dataset.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * January, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- dset_set_extent_in_t *input = (dset_set_extent_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;
- int rank = input->dims.rank;
- hbool_t opened_locally = FALSE;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start dataset Extend on the first dimension to %d\n", input->dims.size[0]);
-#endif
-
- /* open the dataset if we don't have the handle yet */
- if(iod_oh.cookie == IOD_OH_UNDEFINED) {
- if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
- opened_locally = TRUE;
- }
-
- /* extend along the first dimension only */
- if(iod_array_extend(iod_oh, IOD_TID_UNKNOWN, (iod_size_t)input->dims.size[0], NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't extend dataset");
-
-#if H5_DO_NATIVE
- ret_value = H5Dset_extent(iod_oh.cookie, input->dims.size);
-#endif
-
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with dset set_extent, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
-
- input = (dset_set_extent_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- /* close the dataset if we opened it in this routine */
- if(opened_locally) {
- if(iod_obj_close(iod_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
- }
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_dset_set_extent_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_dset_close_cb
- *
- * Purpose: Closes iod HDF5 dataset.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * January, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_dset_close_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- dset_close_in_t *input = (dset_close_in_t *)op_data->input;
- iod_handle_t iod_oh = input->iod_oh;
- iod_obj_id_t iod_id = input->iod_id;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start dataset Close\n");
-#endif
-
- if(iod_oh.cookie != IOD_OH_UNDEFINED) {
-#if H5_DO_NATIVE
- ret_value = H5Dclose(iod_oh.cookie);
-#endif
-
- if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- }
- else {
- /* MSC - need a way to kill object handle for this group */
- fprintf(stderr, "I do not have the OH of this dataset to close it\n");
- }
-
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with dset close, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
-
- input = (dset_close_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_dset_close_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_dtype_commit_cb
- *
- * Purpose: Commits a dtype as a iod object.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * April, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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_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;
- const char *name = input->name;
- iod_kv_t kv;
- char *last_comp; /* the name of the datatype obtained from the last component in the path */
- size_t buf_size;
- void *buf;
- iod_mem_desc_t mem_desc;
- iod_blob_iodesc_t file_desc;
- scratch_pad_t sp;
- iod_ret_t ret;
- hbool_t collective = FALSE; /* MSC - change when we allow for collective */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start datatype Commit %s\n", name);
-#endif
-
- /* the traversal will retrieve the location where the datatype needs
- to be created. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE,
- &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* create the datatype */
- ret = iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_BLOB, NULL, NULL,
- &dtype_id, NULL /*event*/);
- if(collective && (0 == ret || EEXISTS == ret)) {
- /* Datatype has been created by another process, open it */
- if (iod_obj_open_write(coh, dtype_id, NULL, &dtype_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Datatype");
- }
- else if(!collective && 0 != ret) {
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Datatype");
- }
-
- /* for the process that succeeded in creating the datatype, update
- the parent KV, create scratch pad */
- if(0 == ret) {
- kv.key = HDstrdup(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");
- HDfree(kv.key);
-
- /* create the metadata KV object for the datatype */
- if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
- NULL, NULL, &mdkv_id, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object");
-
- /* set values for the scratch pad object */
- sp.mdkv_id = mdkv_id;
- sp.attr_id = IOD_ID_UNDEFINED;
- sp.filler1_id = IOD_ID_UNDEFINED;
- sp.filler2_id = IOD_ID_UNDEFINED;
-
- /* set scratch pad in datatype */
- if (iod_obj_set_scratch(dtype_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 */
- 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");
-
- /* determine the buffer size needed to store the encoded type of the datatype */
- if(H5Tencode(input->type_id, NULL, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode datatype type");
- if(NULL == (buf = malloc (buf_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate type buffer");
- /* encode datatype of the datatype */
- if(H5Tencode(input->type_id, buf, &buf_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode datatype type");
-
- /* create memory descriptor for writing */
- mem_desc.nfrag = 1;
- mem_desc.frag->addr = buf;
- mem_desc.frag->len = (iod_size_t)buf_size;
-
- /* create file descriptor for writing */
- file_desc.nfrag = 1;
- file_desc.frag->offset = 0;
- file_desc.frag->len = (iod_size_t)buf_size;
-
- /* write the serialized type value to the BLOB object */
- if(iod_blob_write(cur_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write BLOB object");
-
- /* MSC - TODO store things */
-#if 0
- /* insert datatype metadata into scratch pad */
-
- kv.key = HDstrdup("datatype_tcpl");
- /* determine the buffer size needed to store the encoded tcpl of the datatype */
- if(H5Pencode(input->tcpl_id, NULL, &value_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode datatype tcpl");
- if(NULL == (kv.value = malloc (value_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate tcpl buffer");
- /* encode tcpl of the datatype */
- if(H5Pencode(input->tcpl_id, kv.value, &value_size) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "failed to encode datatype tcpl");
- kv.value_len = (iod_size_t)value_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");
- HDfree(kv.key);
- free(kv.value);
-
- kv.key = HDstrdup("datatype_size");
- kv.value_len = sizeof(iod_size_t);
- if(NULL == (kv.value = malloc (kv.value_len)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate buffer");
- memcpy(kv.value, &buf_size, kv.value_len);
-
- /* 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");
- HDfree(kv.key);
- free(kv.value);
-#endif
-
- /* close the Metadata KV object */
- if(iod_obj_close(mdkv_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- }
-
-#if H5_DO_NATIVE
- cur_oh.cookie = H5Tcopy(input->type_id);
- if(H5Tcommit2(loc_handle.cookie, last_comp, cur_oh.cookie,
- H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't commit datatype");
- fprintf(stderr, "Committed Native Datatype %s with ID %d on %d\n",
- last_comp, cur_oh.cookie, loc_handle.cookie);
-#endif
-
- /* close parent group and its scratch pad if it is not the
- location we started the traversal into */
- if(loc_handle.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
- output.iod_oh = cur_oh;
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with dtype commit, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &output);
-
-done:
- if(ret_value < 0) {
- output.iod_oh.cookie = IOD_OH_UNDEFINED;
- HG_Handler_start_output(op_data->hg_handle, &output);
- }
-
- input = (dtype_commit_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- last_comp = (char *)H5MM_xfree(last_comp);
- free(buf);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_dtype_commit_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_dtype_open_cb
- *
- * Purpose: Opens a datatype as a iod object.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * April, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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 cur_oh, mdkv_oh;
- iod_obj_id_t cur_id, mdkv_id;
- const char *name = input->name;
- char *last_comp; /* the name of the datatype obtained from the last component in the path */
- size_t buf_size;
- void *buf;
- iod_mem_desc_t mem_desc;
- iod_blob_iodesc_t file_desc;
- iod_size_t kv_size = sizeof(iod_obj_id_t);
- scratch_pad_t sp;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- fprintf(stderr, "Start datatype Open %s\n", name);
-
- /* the traversal will retrieve the location where the datatype needs
- to be opened. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, FALSE,
- &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &dtype_id,
- kv_size , NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve BLOB ID from parent KV store");
-
- /* open the datatype */
- if (iod_obj_open_write(coh, dtype_id, NULL /*hints*/, &cur_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open datatype");
-
- /* get scratch pad of the datatype */
- 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");
-
- /* open the metadata scratch pad */
- 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 - need to read datatype; size should be stored in metadata,
- but since no real IOD, can't do anything now */
-
-#if 0
- /*retrieve tcpl metadata from scratch pad */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "datatype_tcpl", NULL,
- &output.tcpl_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "datatype tcpl lookup failed");
- if(NULL == (output.tcpl = H5MM_malloc (output.tcpl_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate tcpl buffer");
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "datatype_tcpl", output.tcpl,
- &output.tcpl_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "datatype tcpl lookup failed");
-
- /*retrieve blob size metadata from scratch pad */
- if(iod_kv_get_value(mdkv_oh, IOD_TID_UNKNOWN, "datatype_size", &buf_size,
- sizeof(iod_size_t), NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "datatype size lookup failed");
-
- if(NULL == (buf = malloc(buf_size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate BLOB read buffer");
-
- /* create memory descriptor for writing */
- mem_desc.nfrag = 1;
- mem_desc.frag->addr = buf;
- mem_desc.frag->len = (iod_size_t)buf_size;
-
- /* create file descriptor for writing */
- file_desc.nfrag = 1;
- file_desc.frag->offset = 0;
- file_desc.frag->len = (iod_size_t)buf_size;
-
- /* write the serialized type value to the BLOB object */
- if(iod_blob_write(cur_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write BLOB object");
-
- /* decode the datatype */
- if((output.type_id = H5Tdecode(buf)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to decode datatype");
-
- free(buf);
-#endif
-
- /* 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 H5_DO_NATIVE
- printf("datatype name %s location %d\n", name, loc_handle.cookie);
- cur_oh.cookie = H5Topen(loc_handle.cookie, name, input->tapl_id);
- HDassert(cur_oh.cookie);
- output.type_id = cur_oh.cookie;
- output.tcpl_id = H5P_DATATYPE_CREATE_DEFAULT;
-#else
- /* fake a type, and tcpl */
- output.type_id = H5Tcopy(H5T_NATIVE_INT);
- output.tcpl_id = H5P_DATATYPE_CREATE_DEFAULT;
-#endif
-
- output.iod_id = dtype_id;
- output.iod_oh = cur_oh;
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with dtype open, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &output);
-
-done:
- if(ret_value < 0) {
- output.iod_oh.cookie = IOD_OH_UNDEFINED;
- output.iod_id = IOD_ID_UNDEFINED;
- HG_Handler_start_output(op_data->hg_handle, &output);
- }
-
-#if !H5_DO_NATIVE
- H5Tclose(output.type_id);
-#endif
-
- last_comp = (char *)H5MM_xfree(last_comp);
- input = (dtype_open_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_dtype_open_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_dtype_close_cb
- *
- * Purpose: Closes iod HDF5 datatype.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * April, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_dtype_close_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- dtype_close_in_t *input = (dtype_close_in_t *)op_data->input;
- iod_handle_t iod_oh = input->iod_oh;
- iod_obj_id_t iod_id = input->iod_id;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start datatype Close\n");
-#endif
-
- if(iod_oh.cookie != IOD_OH_UNDEFINED) {
-#if H5_DO_NATIVE
- HDassert(H5Tclose(iod_oh.cookie) == SUCCEED);
-#endif
-
- if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- }
- else {
- /* MSC - need a way to kill object handle for this group */
- fprintf(stderr, "I do not have the OH of this datatype to close it\n");
- }
-
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with dtype close, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
-
- input = (dtype_close_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_dtype_close_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_attr_create_cb
- *
- * Purpose: Creates a attr as a iod object.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * April, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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_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_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;
- scratch_pad_t sp;
- iod_ret_t ret;
- hbool_t collective = FALSE; /* MSC - change when we allow for collective */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start attribute Create %s on object path %s\n", attr_name, loc_name);
-#endif
-
- /* the traversal will retrieve the location where the attribute needs
- to be created. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE,
- &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* Set the IOD array creation parameters */
- array.cell_size = H5Tget_size(input->type_id);
- array.num_dims = H5Sget_simple_extent_ndims(input->space_id);
- if(NULL == (array.current_dims = (iod_size_t *)malloc (sizeof(iod_size_t) * array.num_dims)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dimention size array");
- if(NULL == (max_dims = (iod_size_t *)malloc (sizeof(iod_size_t) * array.num_dims)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate dimention size array");
- if(H5Sget_simple_extent_dims(input->space_id, array.current_dims, max_dims) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get dimentions' sizes");
- array.firstdim_max = max_dims[0];
- array.chunk_dims = NULL;
- array.dims_seq = NULL;
-
- /* create the attribute */
- ret = iod_obj_create(coh, IOD_TID_UNKNOWN, NULL/*hints*/, IOD_OBJ_ARRAY, NULL, &array,
- &attr_id, NULL /*event*/);
- if(collective && (0 == ret || EEXISTS == ret)) {
- /* Attribute has been created by another process, open it */
- if (iod_obj_open_write(coh, attr_id, NULL, &attr_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open attribute");
- }
- else if(!collective && 0 != ret) {
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Attribute");
- }
-
- /* for the process that succeeded in creating the attribute, update
- the parent scratch pad, create attribute scratch pad */
- if(0 == ret) {
- /* create the metadata KV object for the attribute */
- if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
- NULL, NULL, &mdkv_id, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create metadata KV object");
-
- /* set values for the scratch pad object */
- sp.mdkv_id = mdkv_id;
- sp.attr_id = IOD_ID_UNDEFINED;
- sp.filler1_id = IOD_ID_UNDEFINED;
- sp.filler2_id = IOD_ID_UNDEFINED;
-
- /* set scratch pad in attribute */
- 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 */
- 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");
-
- /* MSC - TODO store things */
-
-#if 0
- /* insert attribute metadata into scratch pad */
- kv.key = HDstrdup("attribute_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");
- HDfree(kv.key);
- free(kv.value);
-
- kv.key = HDstrdup("attribute_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");
- HDfree(kv.key);
- free(kv.value);
-#endif
-
- /* close the Metadata KV object */
- if(iod_obj_close(mdkv_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
-
- /* get scratch pad of the parent */
- if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
-
- /* if attribute KV does not exist, create it */
- if(IOD_ID_UNDEFINED == sp.attr_id) {
- /* create the attribute KV object for the parent */
- if(iod_obj_create(coh, IOD_TID_UNKNOWN, NULL, IOD_OBJ_KV,
- NULL, NULL, &sp.attr_id, NULL)<0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Attr KV");
-
- /* set scratch pad in attribute */
- if (iod_obj_set_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set scratch pad");
- }
-
- /* open the attribute KV in scratch pad */
- if (iod_obj_open_write(coh, sp.attr_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
- 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);
- }
-
- /* close parent group if it is not the location we started the
- traversal into */
- if(loc_handle.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
-#if H5_DO_NATIVE
- cur_oh.cookie = H5Acreate2(cur_oh.cookie, attr_name, input->type_id,
- input->space_id, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(cur_oh.cookie);
-#endif
-
- output.iod_oh = cur_oh;
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with attr create, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &output);
-
-done:
-
- /* return an UNDEFINED oh to the client if the operation failed */
- if(ret_value < 0) {
- output.iod_oh.cookie = IOD_OH_UNDEFINED;
- HG_Handler_start_output(op_data->hg_handle, &output);
- }
-
- if(max_dims) free(max_dims);
- if(array.current_dims) free(array.current_dims);
- input = (attr_create_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- last_comp = (char *)H5MM_xfree(last_comp);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_attr_create_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_attr_open_cb
- *
- * Purpose: Opens a attribute as a iod object.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * April, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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 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;
- scratch_pad_t sp;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start attribute Open %s\n", attr_name);
-#endif
-
- /* the traversal will retrieve the location where the attribute needs
- to be opened. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE,
- &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* get scratch pad of the parent */
- if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
-
- /* if attribute KV does not exist, return error*/
- if(IOD_ID_UNDEFINED == sp.attr_id)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes");
-
- /* open the attribute KV in scratch pad */
- if (iod_obj_open_write(coh, sp.attr_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
-
- /* get attribute ID */
- if(iod_kv_get_value(attr_kv_oh, IOD_TID_UNKNOWN, attr_name, &attr_id,
- sizeof(iod_obj_id_t) , NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve Attribute ID from parent KV store");
-
- /* close parent group if it is not the location we started the
- traversal into */
- if(loc_handle.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
- iod_obj_close(attr_kv_oh, NULL, NULL);
-
- /* open the attribute */
- if (iod_obj_open_write(coh, attr_id, NULL /*hints*/, &cur_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
-
- /* get scratch pad of the attribute */
- if(iod_obj_get_scratch(cur_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");
-
- /* MSC - retrieve all metadata from scratch pad */
-
- /* close the metadata scratch pad */
- if(iod_obj_close(mdkv_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
-
- {
- hsize_t dims[1];
- //hid_t space_id, type_id;
-
-#if H5_DO_NATIVE
- printf("attr name %s location %d %s\n", attr_name, loc_handle.cookie, loc_name);
- if(strcmp(loc_name, ".") == 0)
- cur_oh.cookie = H5Aopen(loc_handle.cookie, attr_name, H5P_DEFAULT);
- else
- cur_oh.cookie = H5Aopen_by_name(loc_handle.cookie, loc_name,
- attr_name, H5P_DEFAULT, H5P_DEFAULT);
- HDassert(cur_oh.cookie);
- output.space_id = H5Aget_space(cur_oh.cookie);
- output.type_id = H5Aget_type(cur_oh.cookie);
- output.acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
-#else
- /* fake a dataspace, type, and dcpl */
- dims [0] = 60;
- output.space_id = H5Screate_simple(1, dims, NULL);
- output.type_id = H5Tcopy(H5T_NATIVE_INT);
- output.acpl_id = H5P_ATTRIBUTE_CREATE_DEFAULT;
-#endif
- }
-
- output.iod_id = attr_id;
- output.iod_oh = cur_oh;
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with attr open, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &output);
-
-done:
- if(ret_value < 0) {
- output.iod_oh.cookie = IOD_OH_UNDEFINED;
- output.iod_id = IOD_ID_UNDEFINED;
- HG_Handler_start_output(op_data->hg_handle, &output);
- }
-
- H5Sclose(output.space_id);
- H5Tclose(output.type_id);
-
- input = (attr_open_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- last_comp = (char *)H5MM_xfree(last_comp);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_attr_open_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_attr_read_cb
- *
- * Purpose: Reads from IOD into the function shipper BDS handle.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * April, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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;
- size_t size;
- void *buf;
- na_addr_t dest = HG_Handler_get_addr(op_data->hg_handle);
- hbool_t opened_locally = FALSE;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* open the attribute if we don't have the handle yet */
- if(iod_oh.cookie == IOD_OH_UNDEFINED) {
- if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
- opened_locally = TRUE;
- }
-
- size = HG_Bulk_handle_get_size(bulk_handle);
-
- if(NULL == (buf = malloc(size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
-
- /* create memory descriptor for reading */
- mem_desc.nfrag = 1;
- mem_desc.frag->addr = buf;
- mem_desc.frag->len = (iod_size_t)size;
-
- /* retrieve the dataspace of the attribute and create file descriptor for reading */
- /* MSC TODO - populate file descriptor hyperslab */
-
- /* read from array object */
- if(iod_array_read(iod_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
-
- {
- int i;
- hbool_t flag;
- int *buf_ptr = (int *)buf;
-
-#if H5_DO_NATIVE
- ret_value = H5Aread(iod_oh.cookie, type_id, buf);
-#else
- for(i=0;i<60;++i)
- buf_ptr[i] = i;
-#endif
- }
-
- /* Create a new block handle to write the data */
- HG_Bulk_block_handle_create(buf, size, HG_BULK_READ_ONLY, &bulk_block_handle);
-
- /* Write bulk data here and wait for the data to be there */
- if(HG_SUCCESS != HG_Bulk_write_all(dest, bulk_handle, bulk_block_handle, &bulk_request))
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
- /* wait for it to complete */
- if(HG_SUCCESS != HG_Bulk_wait(bulk_request, HG_BULK_MAX_IDLE_TIME, HG_BULK_STATUS_IGNORE))
- HGOTO_ERROR(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object");
-
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with attr read, sending response to client\n");
-#endif
-
- if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value))
- HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client");
- if(HG_SUCCESS != HG_Bulk_block_handle_free(bulk_block_handle))
- HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't free bds block handle");
-
- input = (attr_io_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- free(buf);
-
- /* close the attribute if we opened it in this routine */
- if(opened_locally) {
- if(iod_obj_close(iod_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
- }
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_attr_read_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_attr_write_cb
- *
- * Purpose: Writes from IOD into the function shipper BDS handle.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * April, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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;
- size_t size;
- void *buf;
- ssize_t ret;
- na_addr_t source = HG_Handler_get_addr(op_data->hg_handle);
- hbool_t opened_locally = FALSE;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* open the attribute if we don't have the handle yet */
- if(iod_oh.cookie == IOD_OH_UNDEFINED) {
- if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
- }
-
- /* Read bulk data here and wait for the data to be here */
- size = HG_Bulk_handle_get_size(bulk_handle);
- if(NULL == (buf = malloc(size)))
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer");
-
- HG_Bulk_block_handle_create(buf, size, HG_BULK_READWRITE, &bulk_block_handle);
-
- /* Write bulk data here and wait for the data to be there */
- if(HG_SUCCESS != HG_Bulk_read_all(source, bulk_handle, bulk_block_handle, &bulk_request))
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't get data from function shipper");
- /* wait for it to complete */
- if(HG_SUCCESS != HG_Bulk_wait(bulk_request, HG_BULK_MAX_IDLE_TIME, HG_BULK_STATUS_IGNORE))
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't get data from function shipper");
-
- /* free the bds block handle */
- if(HG_SUCCESS != HG_Bulk_block_handle_free(bulk_block_handle))
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't free bds block handle");
-
-#if H5VL_IOD_DEBUG
- {
- int i;
- int *buf_ptr = (int *)buf;
-
- fprintf(stderr, "AWRITE Received a buffer of size %d with values: ", size);
- for(i=0;i<60;++i)
- fprintf(stderr, "%d ", buf_ptr[i]);
- fprintf(stderr, "\n");
- }
-#endif
-
- mem_desc.nfrag = 1;
- mem_desc.frag->addr = buf;
- mem_desc.frag->len = (iod_size_t)size;
-
- /* retrieve the dataspace of the attribute and create file descriptor for reading */
- /* MSC TODO - populate file descriptor hyperslab */
-
- /* write from array object */
- if(iod_array_write(iod_oh, IOD_TID_UNKNOWN, NULL, &mem_desc, &file_desc, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't write to array object");
-
-#if H5_DO_NATIVE
- ret_value = H5Awrite(iod_oh.cookie, type_id, buf);
-#endif
-
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with attr write, sending %d response to client\n", ret_value);
-#endif
-
- if(HG_SUCCESS != HG_Handler_start_output(op_data->hg_handle, &ret_value))
- HDONE_ERROR(H5E_SYM, H5E_WRITEERROR, FAIL, "can't send result of write to client");
-
- input = (attr_io_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- free(buf);
-
- /* close the dataset if we opened it in this routine */
- if(opened_locally) {
- if(iod_obj_close(iod_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object");
- }
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_attr_write_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_attr_exists_cb
- *
- * Purpose: Checks if an attribute exists on object.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * April, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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_obj_id_t cur_id, attr_id;
- const char *loc_name = input->path;
- const char *attr_name = input->attr_name;
- char *last_comp = NULL;
- scratch_pad_t sp;
- htri_t ret = -1;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start attribute Exists %s\n", attr_name);
-#endif
-
- /* the traversal will retrieve the location where the attribute needs
- to be checked. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE,
- &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* get scratch pad of the parent */
- if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
-
- /* close parent group if it is not the location we started the
- traversal into */
- if(loc_handle.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
- /* if attribute KV does not exist, return false*/
- if(IOD_ID_UNDEFINED == sp.attr_id) {
- ret = FALSE;
- HGOTO_DONE(SUCCEED);
- }
-
- /* open the attribute KV in scratch pad */
- if (iod_obj_open_write(coh, sp.attr_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
-
- /* get attribute ID */
- if(iod_kv_get_value(attr_kv_oh, IOD_TID_UNKNOWN, attr_name, &attr_id,
- sizeof(iod_obj_id_t) , NULL, NULL) < 0) {
- ret = FALSE;
- }
- else {
- ret = TRUE;
- }
-
- iod_obj_close(attr_kv_oh, NULL, NULL);
-
-#if H5_DO_NATIVE
- ret = H5Aexists(loc_handle.cookie, attr_name);
-#else
- ret = FALSE;
-#endif
-
-done:
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with attr exists, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret);
-
- input = (attr_op_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- last_comp = (char *)H5MM_xfree(last_comp);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_attr_exists_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_attr_rename_cb
- *
- * Purpose: Renames iod HDF5 attribute.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * April, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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_obj_id_t cur_id, attr_id;
- const char *loc_name = input->path;
- 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;
- scratch_pad_t sp;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start attribute Rename %s to %s\n", old_name, new_name);
-#endif
-
- /* the traversal will retrieve the location where the attribute
- needs to be renamed. The traversal will fail if an intermediate
- group does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE,
- &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* get scratch pad of the parent */
- if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
-
- /* close parent group if it is not the location we started the
- traversal into */
- if(loc_handle.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
- /* if attribute KV does not exist, return error*/
- if(IOD_ID_UNDEFINED == sp.attr_id)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes");
-
- /* open the attribute KV in scratch pad */
- if (iod_obj_open_write(coh, sp.attr_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
-
- /* get attribute ID */
- if(iod_kv_get_value(attr_kv_oh, IOD_TID_UNKNOWN, old_name, &attr_id,
- sizeof(iod_obj_id_t) , NULL, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Attribute does not exist");
-
- /* remove attribute with old name */
- kv.key = old_name;
- 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)
- 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);
-
- iod_obj_close(attr_kv_oh, NULL, NULL);
-
-#if H5_DO_NATIVE
- ret_value = H5Arename(loc_handle.cookie, old_name, new_name);
-#endif
-
-done:
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with attr rename, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
-
- input = (attr_rename_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- last_comp = (char *)H5MM_xfree(last_comp);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_attr_rename_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_attr_remove_cb
- *
- * Purpose: Removes iod HDF5 attribute.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * April, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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_obj_id_t cur_id, attr_id;
- const char *loc_name = input->path;
- const char *attr_name = input->attr_name;
- char *last_comp = NULL;
- iod_kv_params_t kvs;
- iod_kv_t kv;
- scratch_pad_t sp;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start attribute Remove %s\n", attr_name);
-#endif
-
- /* the traversal will retrieve the location where the attribute
- needs to be removed. The traversal will fail if an intermediate
- group does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, loc_name, FALSE,
- &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* get scratch pad of the parent */
- if(iod_obj_get_scratch(cur_oh, IOD_TID_UNKNOWN, &sp, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't get scratch pad for object");
-
- /* close parent group if it is not the location we started the
- traversal into */
- if(loc_handle.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
- /* if attribute KV does not exist, return error*/
- if(IOD_ID_UNDEFINED == sp.attr_id)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes");
-
- /* open the attribute KV in scratch pad */
- if (iod_obj_open_write(coh, sp.attr_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad");
-
- /* get attribute ID */
- if(iod_kv_get_value(attr_kv_oh, IOD_TID_UNKNOWN, attr_name, &attr_id,
- sizeof(iod_obj_id_t) , NULL, NULL) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "Attribute does not exist");
-
- /* remove attribute */
- kv.key = attr_name;
- 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)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
-
- if(iod_obj_unlink(coh, attr_id, IOD_TID_UNKNOWN, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink object");
-
-#if H5_DO_NATIVE
- ret_value = H5Adelete(loc_handle.cookie, attr_name);
-#endif
-
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with attr remove, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
-
- input = (attr_op_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- last_comp = (char *)H5MM_xfree(last_comp);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_attr_remove_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_attr_close_cb
- *
- * Purpose: Closes iod HDF5 attribute.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * April, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_attr_close_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- 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;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start attribute Close\n");
-#endif
-
- if(iod_oh.cookie != IOD_OH_UNDEFINED) {
-#if H5_DO_NATIVE
- HDassert(H5Aclose(iod_oh.cookie) == SUCCEED);
-#endif
- if((ret_value = iod_obj_close(iod_oh, NULL, NULL)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- }
- else {
- /* MSC - need a way to kill object handle for this group */
- fprintf(stderr, "I do not have the OH of this attribute to close it\n");
- }
-
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with attr close, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
-
- input = (attr_close_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_attr_close_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_link_create_cb
- *
- * Purpose: Creates a new link in the container (Hard or Soft).
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * May, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- link_create_in_t *input = (link_create_in_t *)op_data->input;
- H5VL_link_create_type_t create_type = input->create_type;
- iod_handle_t coh = input->coh; /* the container handle */
- iod_handle_t src_oh; /* The handle for creation src object */
- iod_obj_id_t src_id; /* The ID of the creation src object */
- iod_handle_t cur_oh, target_oh;
- iod_obj_id_t cur_id;
- iod_obj_id_t target_id; /* The ID of the target object where link is created*/
- char *src_last_comp = NULL, *dst_last_comp = NULL;
- iod_kv_t kv;
- iod_size_t kv_size = sizeof(iod_obj_id_t);
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start link create\n");
-#endif
-
- /* the traversal will retrieve the location where the link needs
- to be created from. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, input->loc_id, input->loc_oh, input->loc_name, FALSE,
- &src_last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* lookup group in the current location */
- if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, src_last_comp, &src_id, &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Intermdiate group does not exist");
-
- /* close parent group if it is not the location we started the
- traversal into */
- if(input->loc_oh.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
- /* open the source group for link creation*/
- if (iod_obj_open_write(coh, src_id, NULL, &src_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
-
- if(H5VL_LINK_CREATE_HARD == create_type) {
- /* Retrieve the parent of the object where the new link points
- to. The traversal must not fail. */
- if(H5VL_iod_server_traverse(coh, input->target_loc_id, input->target_loc_oh,
- input->target_name, FALSE,
- &dst_last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't traverse path");
-
- /* lookup target object in the current location - the lookup
- must succeed since this is a hard link. */
- if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, dst_last_comp, &target_id, &kv_size,
- NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Intermdiate group does not exist");
- }
- else if(H5VL_LINK_CREATE_SOFT == create_type) {
- /* Retrieve the parent of the object where the new link points
- to. The traversal must not fail. */
- if(H5VL_iod_server_traverse(coh, input->target_loc_id, input->target_loc_oh,
- input->target_name, FALSE,
- &dst_last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't traverse path");
-
- /* lookup target object in the current location. The lookup
- might fail since this is a soft link */
- if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, dst_last_comp,
- &target_id, &kv_size, NULL, NULL) < 0) {
- /* the lookup failed so just insert the target_id as
- undefined in the src object */
- /* MSC - Figure out what to do when reaccessing this
- object after it was created */
- target_id = IOD_ID_UNDEFINED;
- }
- }
- else
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Invalid Link type");
-
- /* close parent group if it is not the location we started the
- traversal into */
- if(input->loc_oh.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
- /* insert new link (target group's ID) in kv store of the source object */
- kv.key = HDstrdup(src_last_comp);
- kv.value = &target_id;
- kv.value_len = kv_size;
- if (iod_kv_set(src_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);
-
- /* close the source group */
- if(src_oh.cookie != input->loc_oh.cookie) {
- iod_obj_close(src_oh, NULL, NULL);
- }
-
- /* open the target object */
- if (iod_obj_open_write(coh, target_id, NULL, &target_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group");
-
- /* MSC - update metadata link information for this object */
-
- /* close the target object */
- iod_obj_close(target_oh, NULL, NULL);
-
-#if H5_DO_NATIVE
- if(H5VL_LINK_CREATE_HARD == create_type) {
- if(H5Lcreate_hard(input->target_loc_oh.cookie, input->target_name,
- input->loc_oh.cookie, input->loc_name, H5P_DEFAULT, H5P_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create hard link");
- }
- else if(H5VL_LINK_CREATE_SOFT == create_type) {
- if(H5Lcreate_soft(input->target_name, input->loc_oh.cookie, input->loc_name,
- H5P_DEFAULT, H5P_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create soft link");
- }
- else
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Invalid Link type");
-#endif
-
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with link create, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
-
- src_last_comp = (char *)H5MM_xfree(src_last_comp);
- dst_last_comp = (char *)H5MM_xfree(dst_last_comp);
- input = (link_create_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_link_create_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_link_move_cb
- *
- * Purpose: Moves/Copies a link in the container.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * May, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_link_move_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- link_move_in_t *input = (link_move_in_t *)op_data->input;
- hbool_t copy_flag = input->copy_flag;
- iod_handle_t coh = input->coh; /* the container handle */
- iod_handle_t src_oh; /* The handle for src object group */
- iod_obj_id_t src_id; /* The ID of the src object */
- iod_handle_t dst_oh; /* The handle for the dst object where link is created*/
- iod_obj_id_t dst_id; /* The ID of the dst object where link is created*/
- iod_obj_id_t obj_id; /* The ID of the object to be moved/copied */
- char *last_comp = NULL;
- iod_kv_t kv;
- iod_size_t kv_size = sizeof(iod_obj_id_t);
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start link move\n");
-#endif
-
- /* the traversal will retrieve the location where the link needs
- to be moved/copied from. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, input->src_loc_id, input->src_loc_oh, input->src_loc_name,
- FALSE, &last_comp, &src_id, &src_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* the traversal will retrieve the location where the link needs
- to be moved/copied to. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, input->dst_loc_id, input->dst_loc_oh, input->dst_loc_name,
- FALSE, NULL, &dst_id, &dst_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* lookup object ID in the current src location */
- if(iod_kv_get_value(src_oh, IOD_TID_UNKNOWN, last_comp, &obj_id, &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Object does not exist in source path");
-
- /* Insert object in the destination path */
- kv.key = HDstrdup(last_comp);
- kv.value = &obj_id;
- kv.value_len = kv_size;
- if (iod_kv_set(dst_oh, IOD_TID_UNKNOWN, NULL, &kv, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't set KV pair in parent");
-
- /* if the operation type is a Move, remove the KV pair from the source object */
- if(!copy_flag) {
- iod_kv_params_t kvs;
-
- kvs.kv = &kv;
- if(iod_kv_unlink_keys(src_oh,IOD_TID_UNKNOWN, NULL, 1, &kvs, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
- }
-
- HDfree(kv.key);
-
- /* close source group if it is not the location we started the
- traversal into */
- if(input->src_loc_oh.cookie != src_oh.cookie) {
- iod_obj_close(src_oh, NULL, NULL);
- }
-
- /* close parent group if it is not the location we started the
- traversal into */
- if(input->dst_loc_oh.cookie != dst_oh.cookie) {
- iod_obj_close(dst_oh, NULL, NULL);
- }
-
-#if H5_DO_NATIVE
- if(copy_flag) {
- if(H5Lcopy(input->src_loc_oh.cookie, input->src_loc_name,
- input->dst_loc_oh.cookie, input->dst_loc_name,
- H5P_DEFAULT, H5P_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create hard link");
- }
- else {
- if(H5Lmove(input->src_loc_oh.cookie, input->src_loc_name,
- input->dst_loc_oh.cookie, input->dst_loc_name,
- H5P_DEFAULT, H5P_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create hard link");
- }
-#endif
-
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with link move, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
-
- last_comp = (char *)H5MM_xfree(last_comp);
- input = (link_move_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_link_move_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_link_exists_cb
- *
- * Purpose: Checks if a link exists.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * May, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_link_exists_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- link_op_in_t *input = (link_op_in_t *)op_data->input;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_oh = input->loc_oh;
- iod_obj_id_t loc_id = input->loc_id;
- iod_handle_t cur_oh;
- iod_obj_id_t cur_id;
- const char *loc_name = input->path;
- char *last_comp = NULL;
- htri_t ret = -1;
- iod_size_t kv_size = sizeof(iod_obj_id_t);
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start link Exists\n");
-#endif
-
- /* the traversal will retrieve the location where the link needs
- to be checked */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, FALSE,
- &last_comp, &cur_id, &cur_oh) < 0) {
- ret = FALSE;
- HGOTO_DONE(SUCCEED);
- }
-
- /* check the last component */
- if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp,
- &cur_id, &kv_size, NULL, NULL) < 0) {
- ret = FALSE;
- } /* end if */
- else {
- ret = TRUE;
- }
-
-#if H5_DO_NATIVE
- ret = H5Lexists(loc_oh.cookie, loc_name, H5P_DEFAULT);
-#else
- ret = FALSE;
-#endif
-
-done:
-
- /* close parent group if it is not the location we started the
- traversal into */
- if(loc_oh.cookie != IOD_OH_UNDEFINED && input->loc_oh.cookie != loc_oh.cookie) {
- iod_obj_close(loc_oh, NULL, NULL);
- }
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with link exists, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret);
-
- input = (link_op_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- last_comp = (char *)H5MM_xfree(last_comp);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_link_exists_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_link_remove_cb
- *
- * Purpose: Removes a link from a container.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * May, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_link_remove_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- link_op_in_t *input = (link_op_in_t *)op_data->input;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_oh = input->loc_oh;
- iod_obj_id_t loc_id = input->loc_id;
- iod_handle_t cur_oh;
- iod_obj_id_t cur_id, obj_id;
- const char *loc_name = input->path;
- char *last_comp = NULL;
- iod_kv_params_t kvs;
- iod_kv_t kv;
- iod_size_t kv_size = sizeof(iod_obj_id_t);
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start link Remove\n");
-#endif
-
- /* the traversal will retrieve the location where the link needs
- to be removed. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name,
- FALSE, &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* lookup object ID in the current location */
- if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &obj_id, &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Object does not exist in source path");
-
- /* unlink object from conainer */
- kv.key = HDstrdup(last_comp);
- kv.value = &obj_id;
- kv.value_len = kv_size;
- kvs.kv = &kv;
- if(iod_kv_unlink_keys(cur_oh, IOD_TID_UNKNOWN, NULL, 1, &kvs, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
- HDfree(kv.key);
-
- /* MSC - check the metadata information for the object and remove
- it from the container if this is the last link to it */
-
- /* close location object */
- if(input->loc_oh.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
-#if H5_DO_NATIVE
- if(H5Ldelete(loc_oh.cookie, loc_name, H5P_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "Unable to unlink KV pair");
-#endif
-
-done:
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with link remove, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
-
- last_comp = (char *)H5MM_xfree(last_comp);
- input = (link_op_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_link_remove_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_object_open_cb
- *
- * Purpose: Opens an existing object in the container
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * May, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- object_op_in_t *input = (object_op_in_t *)op_data->input;
- object_open_out_t output;
- iod_handle_t coh = input->coh; /* the container handle */
- iod_handle_t obj_oh; /* The handle for object */
- iod_obj_id_t obj_id; /* The ID of the object */
- iod_handle_t cur_oh, mdkv_oh;
- iod_obj_id_t cur_id;
- char *last_comp = NULL;
- iod_kv_t kv;
- scratch_pad_t sp;
- iod_size_t kv_size = sizeof(iod_obj_id_t);
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start Object Open\n");
-#endif
-
- /* the traversal will retrieve the location where the object needs
- to be opened to be created from. The traversal will fail if an
- intermediate group does not exist. */
- if(H5VL_iod_server_traverse(coh, input->loc_id, input->loc_oh, input->loc_name, FALSE,
- last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* lookup object in the current location */
- if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &obj_id, &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Intermdiate group does not exist");
-
- /* close parent group if it is not the location we started the
- traversal into */
- if(input->loc_oh.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
- /* open the object */
- 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 */
- 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");
-
- /* open the metadata scratch pad */
- 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 - Read object's metadata */
-
- /* 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 H5_DO_NATIVE
- obj_oh.cookie = H5Oopen(input->loc_oh.cookie, input->loc_name, H5P_DEFAULT);
- output.obj_type = H5Iget_type(obj_oh.cookie);
- switch(output.obj_type){
- case H5I_GROUP:
- output.cpl_id = H5P_GROUP_CREATE_DEFAULT;
- output.type_id = 0;
- output.space_id = 0;
- break;
- case H5I_DATASET:
- output.cpl_id = H5P_DATASET_CREATE_DEFAULT;
- output.type_id = H5Dget_type(obj_oh.cookie);
- output.space_id = H5Dget_space(obj_oh.cookie);
- break;
- case H5I_DATATYPE:
- output.cpl_id = H5P_DATATYPE_CREATE_DEFAULT;
- output.type_id = obj_oh.cookie;
- output.space_id = 0;
- break;
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "not a valid object (dataset, group, or datatype)")
- }
-#else
- /* Fake something */
- output.obj_type = H5I_GROUP;
- output.cpl_id = H5P_GROUP_CREATE_DEFAULT;
- output.type_id = 0;
- output.space_id = 0;
-#endif
-
- output.iod_id = obj_id;
- output.iod_oh = obj_oh;
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with object open, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &output);
-
-done:
- if(ret_value < 0) {
- output.iod_oh.cookie = IOD_OH_UNDEFINED;
- output.iod_id = IOD_ID_UNDEFINED;
- output.cpl_id = H5P_GROUP_CREATE_DEFAULT;
- HG_Handler_start_output(op_data->hg_handle, &output);
- }
-
- switch(output.obj_type){
- case H5I_GROUP:
- break;
- case H5I_DATASET:
-#if H5_DO_NATIVE
- H5Tclose(output.type_id);
- H5Sclose(output.space_id);
-#endif
- break;
- case H5I_DATATYPE:
- break;
- default:
- HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "not a valid object (dataset, group, or datatype)")
- }
-
- last_comp = (char *)H5MM_xfree(last_comp);
- input = (object_op_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_object_open_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_object_copy_cb
- *
- * Purpose: Moves/Copies a link in the container.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * May, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_object_copy_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- object_copy_in_t *input = (object_copy_in_t *)op_data->input;
- iod_handle_t coh = input->coh; /* the container handle */
- iod_handle_t src_oh; /* The handle for src object group */
- iod_obj_id_t src_id; /* The ID of the src object */
- iod_handle_t dst_oh; /* The handle for the dst object where link is created*/
- iod_obj_id_t dst_id; /* The ID of the dst object where link is created*/
- iod_obj_id_t obj_id; /* The ID of the object to be moved/copied */
- char *last_comp = NULL, *new_name;
- iod_kv_t kv;
- iod_size_t kv_size = sizeof(iod_obj_id_t);
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Start object copy\n");
-#endif
-
- /* the traversal will retrieve the location where the object
- exists. The traversal will fail if an intermediate group does
- not exist. */
- if(H5VL_iod_server_traverse(coh, input->src_loc_id, input->src_loc_oh, input->src_loc_name,
- FALSE, &last_comp, &src_id, &src_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* the traversal will retrieve the location where the objects
- needs to be copied to. The traversal will fail if an
- intermediate group does not exist. */
- if(H5VL_iod_server_traverse(coh, input->dst_loc_id, input->dst_loc_oh, input->dst_loc_name,
- FALSE, &new_name, &dst_id, &dst_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* lookup object ID in the current src location */
- if(iod_kv_get_value(src_oh, IOD_TID_UNKNOWN, last_comp, &obj_id, &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Object does not exist in source path");
-
- /* create new object as a copy of the source object */
- /* MSC - wait to see if IOD will have an object copy */
-
- /* Insert object in the destination path */
- kv.key = HDstrdup(new_name);
- kv.value = &obj_id;
- kv.value_len = kv_size;
- if (iod_kv_set(dst_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);
-
- /* close source group if it is not the location we started the
- traversal into */
- if(input->src_loc_oh.cookie != src_oh.cookie) {
- iod_obj_close(src_oh, NULL, NULL);
- }
-
- /* close dst group if it is not the location we started the
- traversal into */
- if(input->dst_loc_oh.cookie != dst_oh.cookie) {
- iod_obj_close(dst_oh, NULL, NULL);
- }
-
-#if H5_DO_NATIVE
- if(H5Ocopy(input->src_loc_oh.cookie, input->src_loc_name,
- input->dst_loc_oh.cookie, input->dst_loc_name,
- H5P_DEFAULT, H5P_DEFAULT) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't copy object");
-#endif
-
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with object Copy, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
-
- last_comp = (char *)H5MM_xfree(last_comp);
- if(new_name)
- free(new_name);
- input = (object_copy_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_object_copy_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_object_exists_cb
- *
- * Purpose: Checks if an object exists.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * May, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_object_exists_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- object_op_in_t *input = (object_op_in_t *)op_data->input;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_oh = input->loc_oh;
- iod_obj_id_t loc_id = input->loc_id;
- iod_handle_t cur_oh;
- iod_obj_id_t cur_id;
- const char *loc_name = input->loc_name;
- char *last_comp = NULL;
- htri_t ret = -1;
- iod_size_t kv_size = sizeof(iod_obj_id_t);
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* the traversal will retrieve the location where the object needs
- to be checked */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, FALSE,
- &last_comp, &cur_id, &cur_oh) < 0) {
- ret = FALSE;
- HGOTO_DONE(SUCCEED);
- }
-
- /* check the last component */
- if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp,
- &cur_id, &kv_size, NULL, NULL) < 0) {
- ret = FALSE;
- } /* end if */
- else {
- iod_handle_t obj_oh;
- /* try to open the object */
- if (iod_obj_open_write(coh, cur_id, NULL, &obj_oh, NULL) < 0) {
- ret = FALSE;
- HGOTO_DONE(SUCCEED);
- }
- else {
- /* close the object */
- iod_obj_close(obj_oh, NULL, NULL);
- ret = TRUE;
- }
- }
-
-#if H5_DO_NATIVE
- ret = H5Oexists_by_name(loc_oh.cookie, loc_name, H5P_DEFAULT);
-#else
- ret = FALSE;
-#endif
-
-done:
-
- /* close parent group if it is not the location we started the
- traversal into */
- if(loc_oh.cookie != IOD_OH_UNDEFINED && input->loc_oh.cookie != loc_oh.cookie) {
- iod_obj_close(loc_oh, NULL, NULL);
- }
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with Object exists, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret);
-
- input = (object_op_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
- last_comp = (char *)H5MM_xfree(last_comp);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_object_exists_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_object_set_comment_cb
- *
- * Purpose: Set comment for an object.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * May, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_object_set_comment_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- object_set_comment_in_t *input = (object_set_comment_in_t *)op_data->input;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_oh = input->loc_oh;
- iod_obj_id_t loc_id = input->loc_id;
- iod_handle_t cur_oh, mdkv_oh;
- iod_obj_id_t cur_id, obj_id;
- const char *loc_name = input->path;
- const char *comment = input->comment;
- char *last_comp = NULL;
- iod_kv_params_t kvs;
- iod_kv_t kv;
- scratch_pad_t sp;
- iod_size_t kv_size = sizeof(iod_obj_id_t);
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* the traversal will retrieve the location where the link needs
- to be removed. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name,
- FALSE, &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* lookup object ID in the current location */
- if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &obj_id, &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Object does not exist in source path");
-
- /* close parent group and its scratch pad if it is not the
- location we started the traversal into */
- if(loc_oh.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
- /* open the object */
- if (iod_obj_open_write(coh, obj_id, NULL /*hints*/, &cur_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open object");
-
- /* 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");
-
- /* open the metadata scratch pad */
- 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 - update scratch pad with comment */
-
- /* close metadata KV and object */
- if(iod_obj_close(mdkv_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- if(iod_obj_close(cur_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
-
-#if H5_DO_NATIVE
- if(H5Oset_comment(loc_oh.cookie, comment) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Unable to set object comment");
-#endif
-
-done:
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with set comment, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &ret_value);
-
- last_comp = (char *)H5MM_xfree(last_comp);
- input = (object_set_comment_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_object_set_comment_cb() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_iod_server_object_get_comment_cb
- *
- * Purpose: Get comment for an object.
- *
- * Return: Success: SUCCEED
- * Failure: Negative
- *
- * Programmer: Mohamad Chaarawi
- * May, 2013
- *
- *-------------------------------------------------------------------------
- */
-static void
-H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine,
- size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[],
- size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[],
- void *_op_data)
-{
- op_data_t *op_data = (op_data_t *)_op_data;
- object_get_comment_in_t *input = (object_get_comment_in_t *)op_data->input;
- object_get_comment_out_t output;
- name_t comment;
- iod_handle_t coh = input->coh;
- iod_handle_t loc_oh = input->loc_oh;
- iod_obj_id_t loc_id = input->loc_id;
- size_t length = input->length;
- iod_handle_t cur_oh, mdkv_oh;
- iod_obj_id_t cur_id, obj_id;
- const char *loc_name = input->path;
- char *last_comp = NULL;
- iod_kv_params_t kvs;
- iod_kv_t kv;
- iod_size_t kv_size = sizeof(iod_obj_id_t);
- scratch_pad_t sp;
- ssize_t size = 0;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* the traversal will retrieve the location where the link needs
- to be removed. The traversal will fail if an intermediate group
- does not exist. */
- if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name,
- FALSE, &last_comp, &cur_id, &cur_oh) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path");
-
- /* lookup object ID in the current location */
- if(iod_kv_get_value(cur_oh, IOD_TID_UNKNOWN, last_comp, &obj_id, &kv_size, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Object does not exist in source path");
-
- /* close parent group and its scratch pad if it is not the
- location we started the traversal into */
- if(loc_oh.cookie != cur_oh.cookie) {
- iod_obj_close(cur_oh, NULL, NULL);
- }
-
- /* open the object */
- if (iod_obj_open_write(coh, obj_id, NULL /*hints*/, &cur_oh, NULL) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't open object");
-
- /* 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");
-
- /* open the metadata scratch pad */
- 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 - Get comment from MD KV store*/
-
- /* close metadata KV and object */
- if(iod_obj_close(mdkv_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
- if(iod_obj_close(cur_oh, NULL, NULL))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object");
-
- comment.value_size = (ssize_t *)malloc(sizeof(ssize_t));
- comment.value = NULL;
- comment.size = length;
-
-#if H5_DO_NATIVE
- if(0 != length) {
- size = H5Oget_comment(loc_oh.cookie, NULL, length);
- comment.value = malloc(size);
- }
- if((size = H5Oget_comment(loc_oh.cookie, comment.value, length)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "Unable to get object comment");
-#else
- if(length) {
- comment.value = strdup("fake comment");
- size = strlen(comment.value) + 1;
- }
- else
- size = 22;
-#endif
-
- *comment.value_size = size;
-
-done:
- output.ret = ret_value;
- output.name = comment;
-
-#if H5VL_IOD_DEBUG
- fprintf(stderr, "Done with get comment, sending response to client\n");
-#endif
-
- HG_Handler_start_output(op_data->hg_handle, &output);
-
- if(comment.value)
- free(comment.value);
- free(comment.value_size);
-
- last_comp = (char *)H5MM_xfree(last_comp);
- input = (object_get_comment_in_t *)H5MM_xfree(input);
- op_data = (op_data_t *)H5MM_xfree(op_data);
-
- FUNC_LEAVE_NOAPI_VOID
-} /* end H5VL_iod_server_object_get_comment_cb() */
-
-static herr_t
+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)
@@ -6221,8 +2294,9 @@ H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handle_t loc
/* Check if this is the last component of the path */
if(!((s = H5G__component(path + nchars, NULL)) && *s)) {
- if(last_comp)
+ if(last_comp) {
*last_comp = HDstrdup(comp);
+ }
break;
}
diff --git a/src/H5VLiod_server.h b/src/H5VLiod_server.h
index b541962..2aedf08 100644
--- a/src/H5VLiod_server.h
+++ b/src/H5VLiod_server.h
@@ -23,6 +23,9 @@
#ifdef H5_HAVE_EFF
+#define EEXISTS 1
+#define H5_DO_NATIVE 0
+
/* the AXE op data strucutre stored with every operation */
typedef struct op_data_t {
void *input;
@@ -76,5 +79,143 @@ H5_DLL int H5VL_iod_server_object_exists(hg_handle_t handle);
H5_DLL int H5VL_iod_server_object_set_comment(hg_handle_t handle);
H5_DLL int H5VL_iod_server_object_get_comment(hg_handle_t handle);
+H5_DLL void H5VL_iod_server_file_create_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_file_open_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_file_close_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_file_flush_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_attr_create_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_attr_open_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_attr_read_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_attr_write_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_attr_exists_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_attr_rename_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_attr_remove_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_attr_close_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_group_create_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_group_open_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_group_close_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_dset_create_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_dset_open_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_dset_read_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_dset_write_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_dset_set_extent_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_dset_close_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_dtype_commit_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_dtype_open_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_dtype_close_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_link_create_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_link_move_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_link_exists_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_link_remove_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+
+H5_DLL void H5VL_iod_server_object_open_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_object_copy_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_object_exists_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_object_set_comment_cb(AXE_engine_t axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *op_data);
+H5_DLL void H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine,
+ size_t num_n_parents, AXE_task_t n_parents[],
+ size_t num_s_parents, AXE_task_t s_parents[],
+ void *_op_data);
+
+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);
+
#endif /* H5_HAVE_EFF */
#endif /* _H5VLiod_server_H */
diff --git a/src/Makefile.am b/src/Makefile.am
index ed136dc..1a9837f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -61,6 +61,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5FAstat.c H5FAtest.c \
H5VL.c H5VLint.c H5VLnative.c \
H5VLiod.c H5VLiod_client.c H5VLiod_server.c H5VLiod_encdec.c \
+ H5VLiod_file.c H5VLiod_group.c H5VLiod_dset.c H5VLiod_dtype.c H5VLiod_attr.c H5VLiod_link.c H5VLiod_obj.c \
H5FD.c H5FDcore.c \
H5FDdirect.c H5FDfamily.c H5FDint.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 3e29343..59dce77 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -136,18 +136,20 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5Ftest.lo H5FA.lo H5FAcache.lo H5FAdbg.lo H5FAdblock.lo \
H5FAdblkpage.lo H5FAhdr.lo H5FAstat.lo H5FAtest.lo H5VL.lo \
H5VLint.lo H5VLnative.lo H5VLiod.lo H5VLiod_client.lo \
- H5VLiod_server.lo H5VLiod_encdec.lo H5FD.lo H5FDcore.lo \
- H5FDdirect.lo H5FDfamily.lo H5FDint.lo H5FDlog.lo H5FDmpi.lo \
- H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo H5FDsec2.lo \
- H5FDspace.lo H5FDstdio.lo H5FF.lo H5EQ.lo H5FL.lo H5FO.lo \
- H5FS.lo H5FScache.lo H5FSdbg.lo H5FSsection.lo H5FSstat.lo \
- H5FStest.lo H5G.lo H5Gbtree2.lo H5Gcache.lo H5Gcompact.lo \
- H5Gdense.lo H5Gdeprec.lo H5Gent.lo H5Gint.lo H5Glink.lo \
- H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Groot.lo \
- H5Gstab.lo H5Gtest.lo H5Gtraverse.lo H5HF.lo H5HFbtree2.lo \
- H5HFcache.lo H5HFdbg.lo H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo \
- H5HFhuge.lo H5HFiblock.lo H5HFiter.lo H5HFman.lo \
- H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \
+ H5VLiod_server.lo H5VLiod_encdec.lo H5VLiod_file.lo \
+ H5VLiod_group.lo H5VLiod_dset.lo H5VLiod_dtype.lo \
+ H5VLiod_attr.lo H5VLiod_link.lo H5VLiod_obj.lo H5FD.lo \
+ H5FDcore.lo H5FDdirect.lo H5FDfamily.lo H5FDint.lo H5FDlog.lo \
+ H5FDmpi.lo H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo \
+ H5FDsec2.lo H5FDspace.lo H5FDstdio.lo H5FF.lo H5EQ.lo H5FL.lo \
+ H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo H5FSsection.lo \
+ H5FSstat.lo H5FStest.lo H5G.lo H5Gbtree2.lo H5Gcache.lo \
+ H5Gcompact.lo H5Gdense.lo H5Gdeprec.lo H5Gent.lo H5Gint.lo \
+ H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo \
+ H5Groot.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo H5HF.lo \
+ H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \
+ H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \
+ H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \
H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HGquery.lo \
H5HL.lo H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HP.lo H5I.lo \
H5Itest.lo H5L.lo H5Lexternal.lo H5lib_settings.lo H5MF.lo \
@@ -568,6 +570,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5FAstat.c H5FAtest.c \
H5VL.c H5VLint.c H5VLnative.c \
H5VLiod.c H5VLiod_client.c H5VLiod_server.c H5VLiod_encdec.c \
+ H5VLiod_file.c H5VLiod_group.c H5VLiod_dset.c H5VLiod_dtype.c H5VLiod_attr.c H5VLiod_link.c H5VLiod_obj.c \
H5FD.c H5FDcore.c \
H5FDdirect.c H5FDfamily.c H5FDint.c H5FDlog.c H5FDmpi.c H5FDmpio.c \
H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \
@@ -1022,8 +1025,15 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VL.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLint.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_attr.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_client.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_dset.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_dtype.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_encdec.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_file.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_group.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_link.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_obj.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_server.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLnative.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5WB.Plo@am__quote@