summaryrefslogtreecommitdiffstats
path: root/src/H5Fint.c
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2019-12-19 20:55:49 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2019-12-19 20:55:49 (GMT)
commitd11b347aa77cbcfa2bf782c8856bf559444ad880 (patch)
treedf43489411575f566e0475ad4bb040dc69f623e6 /src/H5Fint.c
parent4281d101c41f80a75143c0d40232383a81afc7f0 (diff)
parent817235bb60e1f79c4b22b4a6116a1594aa75b81d (diff)
downloadhdf5-d11b347aa77cbcfa2bf782c8856bf559444ad880.zip
hdf5-d11b347aa77cbcfa2bf782c8856bf559444ad880.tar.gz
hdf5-d11b347aa77cbcfa2bf782c8856bf559444ad880.tar.bz2
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit '817235bb60e1f79c4b22b4a6116a1594aa75b81d': (145 commits) Remove const Fix compile error - declaration after executable statement Adjust cache.c only variables. Fix include to correct memory calls - big-endian issue. Update h5debug to retrieve file pointer through VOL framework Minor whitespace Remove duplicate instance Revert and move declaration Correct struct access Fix duplicate and varname Fix compile and test issues from DT Modify H5VL initialization routines to initialize all VOL-managed object types. Modify H5VLwrap_register() to reject non-VOL-managed object types. Also fix overisights in h5trace.c from previous changes. Add release note for sanitizer support HDFFV-10979 cleanup globals TRILABS-135 Add clang analyzers HDFFV-10979 fix global name clash Fix issues found with ONLY_SHARED_LIBS option Fix 2010 compile issues Change from using H5Dcreate to H5Dcreate2 Latest date first in RELEASE.txt ...
Diffstat (limited to 'src/H5Fint.c')
-rw-r--r--src/H5Fint.c65
1 files changed, 18 insertions, 47 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 435c1be..153ec2f 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -3654,9 +3654,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__get_file_id
+ * Function: H5F_get_file_id
*
- * Purpose: The package version of H5Iget_file_id(), obtains the file
+ * Purpose: The private version of H5Iget_file_id(), obtains the file
* ID given an object ID.
*
* Return: Success: The file ID associated with the object
@@ -3665,22 +3665,31 @@ done:
*-------------------------------------------------------------------------
*/
hid_t
-H5F__get_file_id(H5F_t *file, hbool_t app_ref)
+H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref)
{
- hid_t file_id = H5I_INVALID_HID; /* File ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void *vol_obj_file = NULL; /* File object pointer */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ hid_t file_id = H5I_INVALID_HID; /* File ID for object */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(H5I_INVALID_HID)
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = obj_type;
+
+ /* Retrieve VOL file from object */
+ if(H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vol_obj_file) < 0)
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object")
/* Check if the file's ID already exists */
- if(H5I_find_id(file, H5I_FILE, &file_id) < 0)
+ if(H5I_find_id(vol_obj_file, H5I_FILE, &file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed")
/* If the ID does not exist, register it with the VOL connector */
if(H5I_INVALID_HID == file_id) {
- if((file_id = H5VL_wrap_register(H5I_FILE, file, app_ref)) < 0)
+ if((file_id = H5VL_register(H5I_FILE, vol_obj_file, vol_obj->connector, app_ref)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle")
- file->id_exists = TRUE;
} /* end if */
else {
/* Increment ref count on existing ID */
@@ -3693,44 +3702,6 @@ H5F__get_file_id(H5F_t *file, hbool_t app_ref)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__get_file_id() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F_get_file_id
- *
- * Purpose: The private version of H5Iget_file_id(), obtains the file
- * ID given an object ID.
- *
- * Return: Success: The file ID associated with the object
- * Failure: H5I_INVALID_HID
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5F_get_file_id(hid_t obj_id, H5I_type_t type, hbool_t app_ref)
-{
- H5VL_object_t *vol_obj; /* File info */
- hid_t file_id = H5I_INVALID_HID; /* File ID for object */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
-
- FUNC_ENTER_NOAPI(H5I_INVALID_HID)
-
- /* Get the object pointer */
- if(NULL == (vol_obj = H5VL_vol_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier")
-
- /* Get the file through the VOL */
- if(H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_FILE_ID, (int)type, (int)app_ref, &file_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file ID")
- if(H5I_INVALID_HID == file_id)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file ID through the VOL")
-
- /* Set return value */
- ret_value = file_id;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_get_file_id() */