summaryrefslogtreecommitdiffstats
path: root/src/H5Fmount.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Fmount.c')
-rw-r--r--src/H5Fmount.c59
1 files changed, 39 insertions, 20 deletions
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index adde071..0276cf3 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -25,11 +25,9 @@
#include "H5Iprivate.h" /* IDs */
#include "H5Pprivate.h" /* Property lists */
#include "H5MMprivate.h" /* Memory management */
+#include "H5VLprivate.h" /* VOL */
/* PRIVATE PROTOTYPES */
-static herr_t H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child,
- hid_t plist_id, hid_t dxpl_id);
-static herr_t H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id);
static void H5F_mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs);
@@ -101,7 +99,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child,
hid_t H5_ATTR_UNUSED plist_id, hid_t dxpl_id)
{
@@ -267,7 +265,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id)
{
H5G_t *child_group = NULL; /* Child's group in parent mtab */
@@ -445,28 +443,41 @@ H5F_is_mount(const H5F_t *file)
herr_t
H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
{
- H5G_loc_t loc;
- H5F_t *child = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t *obj;
+ H5VL_object_t *file;
+ H5I_type_t type;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sii", loc_id, name, child_id, plist_id);
/* Check arguments */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- if(NULL == (child = (H5F_t *)H5I_object_verify(child_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
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, "not property list")
- /* Do the mount */
- if(H5F_mount(&loc, name, child, plist_id, H5AC_ind_read_dxpl_id) < 0)
+ type = H5I_get_type(loc_id);
+ if(H5I_FILE != type && H5I_GROUP != type) {
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or group object")
+ }
+
+ /* get the group/file object */
+ if(NULL == (obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* get the file object */
+ if(NULL == (file = (H5VL_object_t *)H5I_object(child_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+
+ /* check if both objects are associated with the same VOL plugin */
+ if (obj->vol_info->vol_cls->value != file->vol_info->vol_cls->value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL plugin")
+
+ if(H5VL_file_specific(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_MOUNT, H5AC_ind_read_dxpl_id,
+ H5_REQUEST_NULL, type, name, file->vol_obj, plist_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
done:
@@ -496,20 +507,28 @@ done:
herr_t
H5Funmount(hid_t loc_id, const char *name)
{
- H5G_loc_t loc;
+ H5VL_object_t *obj;
+ H5I_type_t type;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", loc_id, name);
/* Check args */
- if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
- /* Unmount */
- if (H5F_unmount(&loc, name, H5AC_ind_read_dxpl_id) < 0)
+ type = H5I_get_type(loc_id);
+ if(H5I_FILE != type && H5I_GROUP != type) {
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or group object")
+ }
+
+ /* get the group/file object */
+ if(NULL == (obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+
+ if(H5VL_file_specific(obj->vol_obj, obj->vol_info->vol_cls, H5VL_FILE_UNMOUNT,
+ H5AC_ind_read_dxpl_id, H5_REQUEST_NULL, type, name) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
done:
@@ -543,7 +562,7 @@ H5F_mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_obj
HDassert(nopen_objs);
/* If this file is still open, increment number of file IDs open */
- if(f->file_id > 0)
+ if(f->id_exists)
*nopen_files += 1;
/* Increment number of open objects in file