From 1e0a0784bc2b24262beab54a633604ced1f77936 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Tue, 24 Jun 2014 09:53:13 -0500 Subject: [svn-r25348] - adding properties for dataset layout (still not used). - move iod plist functions into a speparate file as they are a numch now. --- src/H5Pdcpl.c | 16 + src/H5VLiod.c | 771 -------------------------------------------- src/H5VLiod.h | 18 ++ src/H5VLiod_props.c | 910 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 2 +- 5 files changed, 945 insertions(+), 772 deletions(-) create mode 100644 src/H5VLiod_props.c diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 67e954a..8f56d7c 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -59,6 +59,22 @@ #define H5D_CRT_APPEND_ONLY_DEF FALSE #define H5D_CRT_APPEND_ONLY_ENC H5P__encode_hbool_t #define H5D_CRT_APPEND_ONLY_DEC H5P__decode_hbool_t + +/* hints for Dataset storage layout */ +#define H5D_CRT_DIMS_ORDER_SIZE sizeof(uint32_t) +#define H5D_CRT_DIMS_ORDER_DEF H5D_ROW_MAJOR +#define H5D_CRT_DIMS_ORDER_ENC H5P__encode_unsigned +#define H5D_CRT_DIMS_ORDER_DEC H5P__decode_unsigned + +#define H5D_CRT_STRIPE_COUNT_SIZE sizeof(size_t) +#define H5D_CRT_STRIPE_COUNT_DEF 0 +#define H5D_CRT_STRIPE_COUNT_ENC H5P__encode_size_t +#define H5D_CRT_STRIPE_COUNT_DEC H5P__decode_size_t + +#define H5D_CRT_STRIPE_SIZE_SIZE sizeof(size_t) +#define H5D_CRT_STRIPE_SIZE_DEF 0 +#define H5D_CRT_STRIPE_SIZE_ENC H5P__encode_size_t +#define H5D_CRT_STRIPE_SIZE_DEC H5P__decode_size_t #endif /* Define default layout information */ diff --git a/src/H5VLiod.c b/src/H5VLiod.c index 4c85ba6..3771218 100644 --- a/src/H5VLiod.c +++ b/src/H5VLiod.c @@ -947,777 +947,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pset_ocpl_enable_checksum - * - * Purpose: Set a boolean flag on the object creation property list - * to indicate to the VOL plugin to enable checksum on the - * object to be created. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * January, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_ocpl_enable_checksum(hid_t ocpl_id, hbool_t flag) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ib", ocpl_id, flag); - - if(ocpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ - if(NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a ocpl") - - /* Set the transfer mode */ - if(H5P_set(plist, H5O_CRT_ENABLE_CHECKSUM_NAME, &flag) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_ocpl_enable_checksum() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pget_ocpl_enable_checksum - * - * Purpose: Retrieve a boolean flag on the object creation property - * list that indicates whether checksuming on this object - * is enabled or not. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * January, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_ocpl_enable_checksum(hid_t ocpl_id, hbool_t *flag/*out*/) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", ocpl_id, flag); - - if(NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a ocpl") - - /* Get the transfer mode */ - if(flag) - if(H5P_get(plist, H5O_CRT_ENABLE_CHECKSUM_NAME, flag) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_ocpl_enable_checksum() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pset_dxpl_replica - * - * Purpose: Set the replica ID to be used when accessing an object - * using this transfer plist. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * February, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_dxpl_replica(hid_t dxpl_id, hrpl_t replica_id) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "iRp", dxpl_id, replica_id); - - if(dxpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") - - /* Set the transfer mode */ - if(H5P_set(plist, H5O_XFER_REPLICA_ID_NAME, &replica_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_dxpl_replica() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pget_dxpl_replica - * - * Purpose: Retrieve the replica ID from this access plist. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * February, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_dxpl_replica(hid_t dxpl_id, hrpl_t *replica_id/*out*/) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", dxpl_id, replica_id); - - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") - - /* Get the transfer mode */ - if(replica_id) - if(H5P_get(plist, H5O_XFER_REPLICA_ID_NAME, replica_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_dxpl_replica() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pset_prefetch_layout - * - * Purpose: Set the prefetch layout to be used when accessing an object - * using this transfer plist. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * May, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_prefetch_layout(hid_t dxpl_id, H5FF_layout_t layout) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - - if(dxpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") - - /* Set the transfer mode */ - if(H5P_set(plist, H5O_XFER_LAYOUT_TYPE_NAME, &layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_prefetch_layout() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pget_prefetch_layout - * - * Purpose: Retrieve the prefetch layout from this access plist. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * May, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_prefetch_layout(hid_t dxpl_id, H5FF_layout_t *layout/*out*/) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", dxpl_id, layout); - - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") - - /* Get the transfer mode */ - if(layout) - if(H5P_get(plist, H5O_XFER_LAYOUT_TYPE_NAME, layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_prefetch_layout() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pset_prefetch_selection - * - * Purpose: Set the prefetch selection to be used when accessing an object - * using this transfer plist. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * May, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_prefetch_selection(hid_t dxpl_id, hid_t selection) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ii", dxpl_id, selection); - - if(dxpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") - - /* Set the transfer mode */ - if(H5P_set(plist, H5O_XFER_SELECTION_NAME, &selection) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_prefetch_selection() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pset_prefetch_range - * - * Purpose: Set the prefetch range to be used when accessing an object - * using this transfer plist. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * May, 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_prefetch_range(hid_t dxpl_id, hid_t keymem_type, const void *low_key, const void *high_key) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "ii*x*x", dxpl_id, keymem_type, low_key, high_key); - - if(dxpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") - - /* Set the transfer mode */ - if(H5P_set(plist, H5O_XFER_KEY_TYPE_NAME, &keymem_type) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") - if(H5P_set(plist, H5O_XFER_LOW_KEY_BUF_NAME, &low_key) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") - if(H5P_set(plist, H5O_XFER_HIGH_KEY_BUF_NAME, &high_key) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_prefetch_range() */ - - -/*------------------------------------------------------------------------- - * 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, uint64_t cs) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "iIl", dxpl_id, cs); - - if(dxpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") - - /* Set the transfer mode */ - if(H5P_set(plist, H5D_XFER_CHECKSUM_NAME, &cs) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set checksum value") - -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, uint64_t *cs/*out*/) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", dxpl_id, cs); - - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") - - /* Get the transfer mode */ - if(cs) - if(H5P_get(plist, H5D_XFER_CHECKSUM_NAME, cs) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get checksum value") - -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, uint64_t *cs) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Il", dxpl_id, cs); - - if(dxpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") - - /* Set the transfer mode */ - if(H5P_set(plist, H5D_XFER_CHECKSUM_PTR_NAME, &cs) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set checksum_ptr value") - -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, uint64_t **cs/*out*/) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", dxpl_id, cs); - - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") - - /* Get the transfer mode */ - if(cs) - if(H5P_get(plist, H5D_XFER_CHECKSUM_PTR_NAME, *cs) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get checksum_ptr value") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_dxpl_checksum_ptr() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pset_metadata_integrity_scope - * - * Purpose: Set the scope of checksum generation and verification for - * metadata in the FF stack. This is a file access property so the - * property is set on a particular container. Changing the property - * would require closing the file and reopening it. Possible values - * for this property are: - * H5_CHECKSUM_NONE = No metadata checksuming and verification - is done at any part of the stack. - * H5_CHECKSUM_TRANSFER = Metadata is verified after being transfered - through Mercury. - * H5_CHECKSUM_IOD = Metadata is checksumed and the checksum is - given to IOD when written, and verified when read. - * H5_CHECKSUM_MEMORY = Metadata is verified when moved in memory - (Not currently supported). - * H5_CHECKSUM_ALL = Metadata is checksumed and verified on all levels. - * - * Note that the property value is a bitflag so any combination can be - * set for individual values using OR operation. - * - * Return: Non-negative - * on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * September 2013 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_metadata_integrity_scope(hid_t fapl_id, uint32_t scope) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "iIu", fapl_id, scope); - - if(scope > H5_CHECKSUM_ALL) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid scope for Data Integrity"); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Set property */ - if(H5P_set(plist, H5VL_CS_BITFLAG_NAME, &scope) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data integrity scope"); - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_metadata_integrity_scope() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pget_metadata_integrity_scope - * - * Purpose: Get the current bit flag indicating the data integrity scope. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * September 2013 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_metadata_integrity_scope(hid_t fapl_id, uint32_t *scope) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Iu", fapl_id, scope); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - if(scope) { - /* Get property */ - if(H5P_get(plist, H5VL_CS_BITFLAG_NAME, scope) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks"); - } - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_metadata_integrity_scope() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pset_rawdata_integrity_scope - * - * Purpose: Set the scope of checksum generation and verification for - * rawdata in the FF stack. This is a data transfer property so the - * property is set on a particular I/O operation (H5Dread/write, - * H5Mset/get, etc ...). Possible values for this property are: - * H5_CHECKSUM_NONE = No checksuming and verification - is done at any part of the stack. - * H5_CHECKSUM_TRANSFER = Data is verified after being transfered - through Mercury. - * H5_CHECKSUM_IOD = Data is checksumed and the checksum is - given to IOD when written, and verified when read. - * H5_CHECKSUM_MEMORY = Data is verified when moved in memory - * H5_CHECKSUM_ALL = Data is checksumed and verified on all levels. - * - * Note that the property value is a bitflag so any combination can be - * set for individual values using OR operation. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * September 2013 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_rawdata_integrity_scope(hid_t dxpl_id, uint32_t scope) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "iIu", dxpl_id, scope); - - if(scope > H5_CHECKSUM_ALL) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid scope for Data Integrity"); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Set property */ - if(H5P_set(plist, H5VL_CS_BITFLAG_NAME, &scope) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data integrity scope"); - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_rawdata_integrity_scope() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pget_rawdata_integrity_scope - * - * Purpose: Get the current bit flag indicating the data integrity scope. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mohamad Chaarawi - * September 2013 - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_rawdata_integrity_scope(hid_t dxpl_id, uint32_t *scope) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Iu", dxpl_id, scope); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - if(scope) { - /* Get property */ - if(H5P_get(plist, H5VL_CS_BITFLAG_NAME, scope) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks"); - } - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_rawdata_integrity_scope() */ - - -/*------------------------------------------------------------------------- - * 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) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ib", dxpl_id, flag); - - if(dxpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") - - /* Set the transfer mode */ - if(H5P_set(plist, H5D_XFER_INJECT_CORRUPTION_NAME, &flag) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") - -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*/) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", dxpl_id, flag); - - if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") - - /* Get the transfer mode */ - if(flag) - if(H5P_get(plist, H5D_XFER_INJECT_CORRUPTION_NAME, flag) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") - -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) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ib", dcpl_id, flag); - - if(dcpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") - - /* Check arguments */ - if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl") - - /* Set the transfer mode */ - if(H5P_set(plist, H5D_CRT_APPEND_ONLY_NAME, &flag) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") - -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*/) -{ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ix", dcpl_id, flag); - - if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl") - - /* Get the transfer mode */ - if(flag) - if(H5P_get(plist, H5D_CRT_APPEND_ONLY_NAME, flag) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_dcpl_append_only() */ - - -/*------------------------------------------------------------------------- * Function: H5VL_iod_analysis_invoke * * Purpose: Creates a file as a iod HDF5 file. diff --git a/src/H5VLiod.h b/src/H5VLiod.h index 9ef5be9..4349b94 100644 --- a/src/H5VLiod.h +++ b/src/H5VLiod.h @@ -50,8 +50,14 @@ extern "C" { #define H5D_XFER_INJECT_CORRUPTION_NAME "inject_corruption" #define H5D_XFER_CHECKSUM_NAME "checksum" #define H5D_XFER_CHECKSUM_PTR_NAME "checksum_ptr" + +#define H5D_CRT_DIM_ORDER_NAME "dim_order" +#define H5D_CRT_STRIPE_COUNT_NAME "stripe_count" +#define H5D_CRT_STRIPE_SIZE_NAME "stripe_size" #define H5D_CRT_APPEND_ONLY_NAME "append_only" + #define H5O_CRT_ENABLE_CHECKSUM_NAME "enable_obj_checksum" + #define H5O_XFER_REPLICA_ID_NAME "replica_id" #define H5O_XFER_LAYOUT_TYPE_NAME "layout_type" #define H5O_XFER_SELECTION_NAME "prefetched_selection" @@ -65,6 +71,11 @@ typedef enum H5FF_layout_t { H5_CONTROLLED_LAYOUT } H5FF_layout_t; +typedef enum H5FF_dset_dim_layout_t { + H5D_ROW_MAJOR = 0, + H5D_COL_MAJOR +} H5FF_dset_dim_layout_t; + H5_DLL H5VL_class_t *H5VL_iod_init(void); H5_DLL herr_t H5Pset_fapl_iod(hid_t fapl_id, MPI_Comm comm, MPI_Info info); H5_DLL herr_t EFF_start_server(MPI_Comm comm, MPI_Info info); @@ -98,6 +109,13 @@ H5_DLL herr_t H5Pget_dxpl_inject_corruption(hid_t dxpl_id, hbool_t *flag); H5_DLL herr_t H5Pset_dcpl_append_only(hid_t dcpl_id, hbool_t flag); H5_DLL herr_t H5Pget_dcpl_append_only(hid_t dcpl_id, hbool_t *flag); +H5_DLL herr_t H5Pset_dcpl_dim_layout(hid_t dcpl_id, H5FF_dset_dim_layout_t layout); +H5_DLL herr_t H5Pget_dcpl_dim_layout(hid_t dcpl_id, H5FF_dset_dim_layout_t *layout); +H5_DLL herr_t H5Pset_dcpl_stripe_count(hid_t dcpl_id, size_t stripe_count); +H5_DLL herr_t H5Pget_dcpl_stripe_count(hid_t dcpl_id, size_t *stripe_count); +H5_DLL herr_t H5Pset_dcpl_stripe_size(hid_t dcpl_id, size_t stripe_size); +H5_DLL herr_t H5Pget_dcpl_stripe_size(hid_t dcpl_id, size_t *stripe_size); + H5_DLL hid_t H5VLiod_get_file_id(const char *filename, iod_handle_t coh, hid_t fapl_id, hid_t *rcxt_id); H5_DLL herr_t H5VLiod_close_file_id(hid_t file_id); diff --git a/src/H5VLiod_props.c b/src/H5VLiod_props.c new file mode 100644 index 0000000..31a17e0 --- /dev/null +++ b/src/H5VLiod_props.c @@ -0,0 +1,910 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Mohamad Chaarawi + * June, 2014 + * + * Purpose: The IOD VOL plugin property list functions. + */ + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FDprivate.h" /* file drivers */ +#include "H5FFprivate.h" /* Fast Forward */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5VLiod.h" /* Iod VOL plugin */ + +#ifdef H5_HAVE_EFF + + +/*------------------------------------------------------------------------- + * Function: H5Pset_ocpl_enable_checksum + * + * Purpose: Set a boolean flag on the object creation property list + * to indicate to the VOL plugin to enable checksum on the + * object to be created. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * January, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_ocpl_enable_checksum(hid_t ocpl_id, hbool_t flag) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", ocpl_id, flag); + + if(ocpl_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + + /* Check arguments */ + if(NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a ocpl") + + /* Set the transfer mode */ + if(H5P_set(plist, H5O_CRT_ENABLE_CHECKSUM_NAME, &flag) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_ocpl_enable_checksum() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_ocpl_enable_checksum + * + * Purpose: Retrieve a boolean flag on the object creation property + * list that indicates whether checksuming on this object + * is enabled or not. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * January, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_ocpl_enable_checksum(hid_t ocpl_id, hbool_t *flag/*out*/) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", ocpl_id, flag); + + if(NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a ocpl") + + /* Get the transfer mode */ + if(flag) + if(H5P_get(plist, H5O_CRT_ENABLE_CHECKSUM_NAME, flag) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_ocpl_enable_checksum() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_dxpl_replica + * + * Purpose: Set the replica ID to be used when accessing an object + * using this transfer plist. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * February, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_dxpl_replica(hid_t dxpl_id, hrpl_t replica_id) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "iRp", dxpl_id, replica_id); + + if(dxpl_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + + /* Check arguments */ + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + + /* Set the transfer mode */ + if(H5P_set(plist, H5O_XFER_REPLICA_ID_NAME, &replica_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_dxpl_replica() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_dxpl_replica + * + * Purpose: Retrieve the replica ID from this access plist. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * February, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_dxpl_replica(hid_t dxpl_id, hrpl_t *replica_id/*out*/) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", dxpl_id, replica_id); + + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + + /* Get the transfer mode */ + if(replica_id) + if(H5P_get(plist, H5O_XFER_REPLICA_ID_NAME, replica_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_dxpl_replica() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_prefetch_layout + * + * Purpose: Set the prefetch layout to be used when accessing an object + * using this transfer plist. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * May, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_prefetch_layout(hid_t dxpl_id, H5FF_layout_t layout) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(dxpl_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + + /* Check arguments */ + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + + /* Set the transfer mode */ + if(H5P_set(plist, H5O_XFER_LAYOUT_TYPE_NAME, &layout) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_prefetch_layout() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_prefetch_layout + * + * Purpose: Retrieve the prefetch layout from this access plist. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * May, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_prefetch_layout(hid_t dxpl_id, H5FF_layout_t *layout/*out*/) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", dxpl_id, layout); + + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + + /* Get the transfer mode */ + if(layout) + if(H5P_get(plist, H5O_XFER_LAYOUT_TYPE_NAME, layout) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_prefetch_layout() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_prefetch_selection + * + * Purpose: Set the prefetch selection to be used when accessing an object + * using this transfer plist. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * May, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_prefetch_selection(hid_t dxpl_id, hid_t selection) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ii", dxpl_id, selection); + + if(dxpl_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + + /* Check arguments */ + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + + /* Set the transfer mode */ + if(H5P_set(plist, H5O_XFER_SELECTION_NAME, &selection) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_prefetch_selection() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_prefetch_range + * + * Purpose: Set the prefetch range to be used when accessing an object + * using this transfer plist. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * May, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_prefetch_range(hid_t dxpl_id, hid_t keymem_type, const void *low_key, const void *high_key) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "ii*x*x", dxpl_id, keymem_type, low_key, high_key); + + if(dxpl_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + + /* Check arguments */ + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + + /* Set the transfer mode */ + if(H5P_set(plist, H5O_XFER_KEY_TYPE_NAME, &keymem_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + if(H5P_set(plist, H5O_XFER_LOW_KEY_BUF_NAME, &low_key) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + if(H5P_set(plist, H5O_XFER_HIGH_KEY_BUF_NAME, &high_key) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_prefetch_range() */ + + +/*------------------------------------------------------------------------- + * 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, uint64_t cs) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "iIl", dxpl_id, cs); + + if(dxpl_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + + /* Check arguments */ + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + + /* Set the transfer mode */ + if(H5P_set(plist, H5D_XFER_CHECKSUM_NAME, &cs) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set checksum value") + +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, uint64_t *cs/*out*/) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", dxpl_id, cs); + + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + + /* Get the transfer mode */ + if(cs) + if(H5P_get(plist, H5D_XFER_CHECKSUM_NAME, cs) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get checksum value") + +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, uint64_t *cs) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*Il", dxpl_id, cs); + + if(dxpl_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + + /* Check arguments */ + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + + /* Set the transfer mode */ + if(H5P_set(plist, H5D_XFER_CHECKSUM_PTR_NAME, &cs) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set checksum_ptr value") + +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, uint64_t **cs/*out*/) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", dxpl_id, cs); + + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + + /* Get the transfer mode */ + if(cs) + if(H5P_get(plist, H5D_XFER_CHECKSUM_PTR_NAME, *cs) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get checksum_ptr value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_dxpl_checksum_ptr() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_metadata_integrity_scope + * + * Purpose: Set the scope of checksum generation and verification for + * metadata in the FF stack. This is a file access property so the + * property is set on a particular container. Changing the property + * would require closing the file and reopening it. Possible values + * for this property are: + * H5_CHECKSUM_NONE = No metadata checksuming and verification + is done at any part of the stack. + * H5_CHECKSUM_TRANSFER = Metadata is verified after being transfered + through Mercury. + * H5_CHECKSUM_IOD = Metadata is checksumed and the checksum is + given to IOD when written, and verified when read. + * H5_CHECKSUM_MEMORY = Metadata is verified when moved in memory + (Not currently supported). + * H5_CHECKSUM_ALL = Metadata is checksumed and verified on all levels. + * + * Note that the property value is a bitflag so any combination can be + * set for individual values using OR operation. + * + * Return: Non-negative + * on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * September 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_metadata_integrity_scope(hid_t fapl_id, uint32_t scope) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "iIu", fapl_id, scope); + + if(scope > H5_CHECKSUM_ALL) + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid scope for Data Integrity"); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Set property */ + if(H5P_set(plist, H5VL_CS_BITFLAG_NAME, &scope) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data integrity scope"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_metadata_integrity_scope() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_metadata_integrity_scope + * + * Purpose: Get the current bit flag indicating the data integrity scope. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * September 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_metadata_integrity_scope(hid_t fapl_id, uint32_t *scope) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*Iu", fapl_id, scope); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + if(scope) { + /* Get property */ + if(H5P_get(plist, H5VL_CS_BITFLAG_NAME, scope) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks"); + } + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_metadata_integrity_scope() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_rawdata_integrity_scope + * + * Purpose: Set the scope of checksum generation and verification for + * rawdata in the FF stack. This is a data transfer property so the + * property is set on a particular I/O operation (H5Dread/write, + * H5Mset/get, etc ...). Possible values for this property are: + * H5_CHECKSUM_NONE = No checksuming and verification + is done at any part of the stack. + * H5_CHECKSUM_TRANSFER = Data is verified after being transfered + through Mercury. + * H5_CHECKSUM_IOD = Data is checksumed and the checksum is + given to IOD when written, and verified when read. + * H5_CHECKSUM_MEMORY = Data is verified when moved in memory + * H5_CHECKSUM_ALL = Data is checksumed and verified on all levels. + * + * Note that the property value is a bitflag so any combination can be + * set for individual values using OR operation. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * September 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_rawdata_integrity_scope(hid_t dxpl_id, uint32_t scope) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "iIu", dxpl_id, scope); + + if(scope > H5_CHECKSUM_ALL) + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid scope for Data Integrity"); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + /* Set property */ + if(H5P_set(plist, H5VL_CS_BITFLAG_NAME, &scope) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data integrity scope"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_rawdata_integrity_scope() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_rawdata_integrity_scope + * + * Purpose: Get the current bit flag indicating the data integrity scope. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * September 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_rawdata_integrity_scope(hid_t dxpl_id, uint32_t *scope) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*Iu", dxpl_id, scope); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + + if(scope) { + /* Get property */ + if(H5P_get(plist, H5VL_CS_BITFLAG_NAME, scope) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get scope for data integrity checks"); + } + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_rawdata_integrity_scope() */ + + +/*------------------------------------------------------------------------- + * 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) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", dxpl_id, flag); + + if(dxpl_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + + /* Check arguments */ + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + + /* Set the transfer mode */ + if(H5P_set(plist, H5D_XFER_INJECT_CORRUPTION_NAME, &flag) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + +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*/) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", dxpl_id, flag); + + if(NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + + /* Get the transfer mode */ + if(flag) + if(H5P_get(plist, H5D_XFER_INJECT_CORRUPTION_NAME, flag) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") + +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) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", dcpl_id, flag); + + if(dcpl_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + + /* Check arguments */ + if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl") + + /* Set the transfer mode */ + if(H5P_set(plist, H5D_CRT_APPEND_ONLY_NAME, &flag) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + +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*/) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", dcpl_id, flag); + + if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl") + + /* Get the transfer mode */ + if(flag) + if(H5P_get(plist, H5D_CRT_APPEND_ONLY_NAME, flag) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_dcpl_append_only() */ + +herr_t +H5Pset_dcpl_dim_layout(hid_t dcpl_id, H5FF_dset_dim_layout_t layout) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl") + + if(H5P_set(plist, H5D_CRT_DIM_ORDER_NAME, &layout) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") +done: + FUNC_LEAVE_API(ret_value) +} + +herr_t +H5Pget_dcpl_dim_layout(hid_t dcpl_id, H5FF_dset_dim_layout_t *layout) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl") + + if(layout) + if(H5P_get(plist, H5D_CRT_DIM_ORDER_NAME, layout) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") +done: + FUNC_LEAVE_API(ret_value) +} + +herr_t +H5Pset_dcpl_stripe_count(hid_t dcpl_id, size_t stripe_count) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl") + + if(H5P_set(plist, H5D_CRT_STRIPE_COUNT_NAME, &stripe_count) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") +done: + FUNC_LEAVE_API(ret_value) +} + +herr_t +H5Pget_dcpl_stripe_count(hid_t dcpl_id, size_t *stripe_count) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl") + + if(stripe_count) + if(H5P_get(plist, H5D_CRT_STRIPE_COUNT_NAME, stripe_count) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") +done: + FUNC_LEAVE_API(ret_value) +} + +herr_t +H5Pset_dcpl_stripe_size(hid_t dcpl_id, size_t stripe_size) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl") + + if(H5P_set(plist, H5D_CRT_STRIPE_SIZE_NAME, &stripe_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") +done: + FUNC_LEAVE_API(ret_value) +} + +herr_t +H5Pget_dcpl_stripe_size(hid_t dcpl_id, size_t *stripe_size) +{ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dcpl") + + if(stripe_size) + if(H5P_get(plist, H5D_CRT_STRIPE_SIZE_NAME, stripe_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") +done: + FUNC_LEAVE_API(ret_value) +} + +#endif /* H5_HAVE_EFF */ diff --git a/src/Makefile.am b/src/Makefile.am index 051ba37..45826ce 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -59,7 +59,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5FA.c H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \ H5FAstat.c H5FAtest.c \ H5VL.c H5VLint.c H5VLnative.c \ - H5VLiod.c H5VLiod_common.c H5VLiod_client.c H5VLiod_server.c H5VLiod_encdec.c H5VLiod_util.c \ + H5VLiod.c H5VLiod_props.c H5VLiod_common.c H5VLiod_client.c H5VLiod_server.c H5VLiod_encdec.c H5VLiod_util.c \ H5VLiod_file.c H5VLiod_group.c H5VLiod_map.c H5VLiod_dset.c H5VLiod_dtype.c H5VLiod_index.c \ H5VLiod_attr.c H5VLiod_link.c H5VLiod_obj.c H5VLiod_trans.c H5VLiod_view.c H5VLiod_analysis.c \ H5FD.c H5FDcore.c \ -- cgit v0.12