summaryrefslogtreecommitdiffstats
path: root/src/H5F.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5F.c')
-rw-r--r--src/H5F.c214
1 files changed, 165 insertions, 49 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 99e352e..19a115e 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -95,8 +95,8 @@ H5FL_EXTERN(H5VL_object_t);
/*-------------------------------------------------------------------------
* Function: H5Fget_create_plist
*
- * Purpose: Get an atom for a copy of the file-creation property list for
- * this file. This function returns an atom with a copy of the
+ * Purpose: Get an ID for a copy of the file-creation property list for
+ * this file. This function returns an ID with a copy of the
* properties used to create a file.
*
* Return: Success: Object ID for a copy of the file creation
@@ -312,12 +312,12 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list)
+H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list /*out*/)
{
ssize_t ret_value = 0; /* Return value */
FUNC_ENTER_API((-1))
- H5TRACE4("Zs", "iIuz*i", file_id, types, max_objs, oid_list);
+ H5TRACE4("Zs", "iIuzx", file_id, types, max_objs, oid_list);
/* Check arguments */
if (0 == (types & H5F_OBJ_ALL))
@@ -391,13 +391,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle)
+H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle /*out*/)
{
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "ii**x", file_id, fapl_id, file_handle);
+ H5TRACE3("e", "iix", file_id, fapl_id, file_handle);
/* Check args */
if (!file_handle)
@@ -704,7 +704,7 @@ done:
herr_t
H5Fclose(hid_t file_id)
{
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
@@ -715,7 +715,7 @@ H5Fclose(hid_t file_id)
/* Close the file */
if (H5I_dec_app_ref(file_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "closing file ID failed")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -747,19 +747,19 @@ H5Fdelete(const char *filename, hid_t fapl_id)
/* Verify access property list and set up collective metadata if appropriate */
if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the VOL info from the fapl */
if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(fapl_id, H5I_GENPROP_LST)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL connector info")
/* Stash a copy of the "top-level" connector property, before any pass-through
* connectors modify or unwrap it.
*/
if (H5CX_set_vol_connector_prop(&connector_prop) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VOL connector info in API context")
/* Make sure this is HDF5 storage for this VOL connector */
if (H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id,
@@ -778,6 +778,121 @@ done:
} /* end H5Fdelete() */
/*-------------------------------------------------------------------------
+ * Function: H5Fmount
+ *
+ * Purpose: Mount file CHILD_ID onto the group specified by LOC_ID and
+ * NAME using mount properties PLIST_ID.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
+{
+ H5VL_object_t *loc_vol_obj = NULL; /* Parent object */
+ H5VL_object_t *child_vol_obj = NULL; /* Child object */
+ H5I_type_t loc_type; /* ID type of location */
+ H5I_type_t child_type; /* ID type of child */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "i*sii", loc_id, name, child_id, plist_id);
+
+ /* Check arguments */
+ loc_type = H5I_get_type(loc_id);
+ if (H5I_FILE != loc_type && H5I_GROUP != loc_type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc_id parameter not a file or group ID")
+ if (!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if (!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be the empty string")
+ child_type = H5I_get_type(child_id);
+ if (H5I_FILE != child_type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "child_id parameter not a file ID")
+ if (H5P_DEFAULT == plist_id)
+ plist_id = H5P_FILE_MOUNT_DEFAULT;
+ else if (TRUE != H5P_isa_class(plist_id, H5P_FILE_MOUNT))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a file mount property list ID")
+
+ /* Set up collective metadata if appropriate */
+ if (H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+
+ /* Get the location object */
+ if (NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
+
+ /* Get the child object */
+ if (NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object")
+
+ /* Check if both objects are associated with the same VOL connector */
+ if (loc_vol_obj->connector->cls->value != child_vol_obj->connector->cls->value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL connector")
+
+ /* Perform the mount operation */
+ if (H5VL_file_specific(loc_vol_obj, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ (int)loc_type, name, child_vol_obj->data, plist_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fmount() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Funmount
+ *
+ * Purpose: Given a mount point, dissassociate the mount point's file
+ * from the file mounted there. Do not close either file.
+ *
+ * The mount point can either be the group in the parent or the
+ * root group of the mounted file (both groups have the same
+ * name). If the mount point was opened before the mount then
+ * it's the group in the parent, but if it was opened after the
+ * mount then it's the root group of the child.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Funmount(hid_t loc_id, const char *name)
+{
+ H5VL_object_t *vol_obj = NULL; /* Parent object */
+ H5I_type_t loc_type; /* ID type of location */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*s", loc_id, name);
+
+ /* Check arguments */
+ loc_type = H5I_get_type(loc_id);
+ if (H5I_FILE != loc_type && H5I_GROUP != loc_type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc_id parameter not a file or group ID")
+ if (!name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
+ if (!*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be the empty string")
+
+ /* Set up collective metadata if appropriate */
+ if (H5CX_set_loc(loc_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+
+ /* Get the location object */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
+
+ /* Perform the unmount operation */
+ if (H5VL_file_specific(vol_obj, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
+ (int)loc_type, name) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Funmount() */
+
+/*-------------------------------------------------------------------------
* Function: H5Freopen
*
* Purpose: Reopen a file. The new file handle which is returned points
@@ -848,12 +963,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_intent(hid_t file_id, unsigned *intent_flags)
+H5Fget_intent(hid_t file_id, unsigned *intent_flags /*out*/)
{
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Iu", file_id, intent_flags);
+ H5TRACE2("e", "ix", file_id, intent_flags);
/* If no intent flags were passed in, exit quietly */
if (intent_flags) {
@@ -884,12 +999,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_fileno(hid_t file_id, unsigned long *fnumber)
+H5Fget_fileno(hid_t file_id, unsigned long *fnumber /*out*/)
{
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Ul", file_id, fnumber);
+ H5TRACE2("e", "ix", file_id, fnumber);
/* If no fnumber pointer was passed in, exit quietly */
if (fnumber) {
@@ -952,13 +1067,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_filesize(hid_t file_id, hsize_t *size)
+H5Fget_filesize(hid_t file_id, hsize_t *size /*out*/)
{
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*h", file_id, size);
+ H5TRACE2("e", "ix", file_id, size);
/* Check args */
if (!size)
@@ -1013,13 +1128,13 @@ done:
*-------------------------------------------------------------------------
*/
ssize_t
-H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
+H5Fget_file_image(hid_t file_id, void *buf /*out*/, size_t buf_len)
{
H5VL_object_t *vol_obj; /* File object for file ID */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
- H5TRACE3("Zs", "i*xz", file_id, buf_ptr, buf_len);
+ H5TRACE3("Zs", "ixz", file_id, buf, buf_len);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1027,7 +1142,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len)
/* Get the file image */
if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FILE_IMAGE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, buf_ptr, &ret_value, buf_len) < 0)
+ H5_REQUEST_NULL, buf, &ret_value, buf_len) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image")
done:
@@ -1049,17 +1164,17 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
+H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config /*out*/)
{
H5VL_object_t *vol_obj = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*Cc", file_id, config_ptr);
+ H5TRACE2("e", "ix", file_id, config);
/* Check args */
- if ((NULL == config_ptr) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr")
+ if ((NULL == config) || (config->version != H5AC__CURR_CACHE_CONFIG_VERSION))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config ptr")
/* Get the file object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
@@ -1067,7 +1182,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
/* Get the metadata cache configuration */
if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_CONF, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- config_ptr) < 0)
+ config) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration")
done:
@@ -1120,23 +1235,23 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr)
+H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate /*out*/)
{
H5VL_object_t *vol_obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*d", file_id, hit_rate_ptr);
+ H5TRACE2("e", "ix", file_id, hit_rate);
/* Check args */
- if (NULL == hit_rate_ptr)
+ if (NULL == hit_rate)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer")
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
/* Get the current hit rate */
if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_HR, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- hit_rate_ptr) < 0)
+ hit_rate) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
done:
@@ -1157,14 +1272,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr,
- int *cur_num_entries_ptr)
+H5Fget_mdc_size(hid_t file_id, size_t *max_size /*out*/, size_t *min_clean_size /*out*/,
+ size_t *cur_size /*out*/, int *cur_num_entries /*out*/)
{
H5VL_object_t *vol_obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "i*z*z*z*Is", file_id, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr);
+ H5TRACE5("e", "ixxxx", file_id, max_size, min_clean_size, cur_size, cur_num_entries);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1172,7 +1287,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
/* Get the size data */
if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0)
+ max_size, min_clean_size, cur_size, cur_num_entries) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size")
done:
@@ -1279,14 +1394,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo)
+H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo /*out*/)
{
H5VL_object_t *vol_obj = NULL;
H5I_type_t type;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*FI", obj_id, finfo);
+ H5TRACE2("e", "ix", obj_id, finfo);
/* Check args */
if (!finfo)
@@ -1322,13 +1437,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info)
+H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info /*out*/)
{
H5VL_object_t *vol_obj = NULL; /* File object for file ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*!", file_id, info);
+ H5TRACE2("e", "ix", file_id, info);
/* Check args */
if (!info)
@@ -1553,13 +1668,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, hbool_t *is_currently_logging)
+H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled /*out*/, hbool_t *is_currently_logging /*out*/)
{
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*b*b", file_id, is_enabled, is_currently_logging);
+ H5TRACE3("e", "ixx", file_id, is_enabled, is_currently_logging);
/* Sanity check */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1690,14 +1805,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2], unsigned misses[2],
- unsigned evictions[2], unsigned bypasses[2])
+H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2] /*out*/, unsigned hits[2] /*out*/,
+ unsigned misses[2] /*out*/, unsigned evictions[2] /*out*/,
+ unsigned bypasses[2] /*out*/)
{
H5VL_object_t *vol_obj; /* File object */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE6("e", "i*Iu*Iu*Iu*Iu*Iu", file_id, accesses, hits, misses, evictions, bypasses);
+ H5TRACE6("e", "ixxxxx", file_id, accesses, hits, misses, evictions, bypasses);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1728,13 +1844,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_len)
+H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr /*out*/, hsize_t *image_len /*out*/)
{
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "i*a*h", file_id, image_addr, image_len);
+ H5TRACE3("e", "ixx", file_id, image_addr, image_len);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1761,13 +1877,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_eoa(hid_t file_id, haddr_t *eoa)
+H5Fget_eoa(hid_t file_id, haddr_t *eoa /*out*/)
{
H5VL_object_t *vol_obj; /* File info */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*a", file_id, eoa);
+ H5TRACE2("e", "ix", file_id, eoa);
/* Check args */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
@@ -1827,13 +1943,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize)
+H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize /*out*/)
{
H5VL_object_t *vol_obj = NULL;
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "i*b", file_id, minimize);
+ H5TRACE2("e", "ix", file_id, minimize);
if (NULL == minimize)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "out pointer 'minimize' cannot be NULL")