diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Fmount.c | 6 | ||||
-rw-r--r-- | src/H5G.c | 24 | ||||
-rw-r--r-- | src/H5Gobj.c | 24 | ||||
-rw-r--r-- | src/H5Gprivate.h | 7 | ||||
-rw-r--r-- | src/H5Gpublic.h | 1 |
5 files changed, 61 insertions, 1 deletions
diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 470d323..c96c920 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -135,7 +135,7 @@ H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, HDassert(child); HDassert(TRUE == H5P_isa_class(plist_id, H5P_FILE_MOUNT)); - /* Set up dataset location to fill in */ + /* Set up group location to fill in */ mp_loc.oloc = &mp_oloc; mp_loc.path = &mp_path; H5G_loc_reset(&mp_loc); @@ -161,6 +161,10 @@ H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, if(NULL == (mount_point = H5G_open(&mp_loc, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found") + /* Check if the proposed mount point group is already a mount point */ + if(H5G_MOUNTED(mount_point)) + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point is already in use") + /* Retrieve information from the mount point group */ /* (Some of which we had before but was reset in mp_loc when the group * "took over" the group location - QAK) @@ -1526,6 +1526,30 @@ H5G_mount(H5G_t *grp) /*------------------------------------------------------------------------- + * Function: H5G_mounted + * + * Purpose: Retrieves the 'mounted' flag for a group + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Tuesday, July 15, 2008 + * + *------------------------------------------------------------------------- + */ +hbool_t +H5G_mounted(H5G_t *grp) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_mounted) + + /* Check args */ + HDassert(grp && grp->shared); + + FUNC_LEAVE_NOAPI(grp->shared->mounted) +} /* end H5G_mounted() */ + + +/*------------------------------------------------------------------------- * Function: H5G_unmount * * Purpose: Resets the 'mounted' flag for a group diff --git a/src/H5Gobj.c b/src/H5Gobj.c index 8ca8c52..e04c12d 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -702,6 +702,10 @@ done: herr_t H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id) { + H5G_t *grp = NULL; /* Group to query */ + H5G_loc_t grp_loc; /* Entry of group to be queried */ + H5G_name_t grp_path; /* Group hier. path */ + H5O_loc_t grp_oloc; /* Group object location */ H5O_linfo_t linfo; /* Link info message */ herr_t ret_value = SUCCEED; /* Return value */ @@ -711,6 +715,22 @@ H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id) HDassert(oloc); HDassert(grp_info); + /* Set up group location to fill in */ + grp_loc.oloc = &grp_oloc; + grp_loc.path = &grp_path; + H5G_loc_reset(&grp_loc); + + /* Deep copy (duplicate) of the group location object */ + if(H5O_loc_copy(&grp_oloc, oloc, H5_COPY_DEEP) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "can't copy object location") + + /* Open the group */ + if(NULL == (grp = H5G_open(&grp_loc, dxpl_id))) + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found") + + /* Get information from the group */ + grp_info->mounted = H5G_MOUNTED(grp); + /* Attempt to get the link info for this group */ if(H5G_obj_get_linfo(oloc, &linfo, dxpl_id)) { /* Retrieve the information about the links */ @@ -737,6 +757,10 @@ H5G_obj_info(H5O_loc_t *oloc, H5G_info_t *grp_info, hid_t dxpl_id) } /* end else */ done: + /* Clean up resources */ + if(grp && H5G_close(grp) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "unable to close queried group") + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_obj_info() */ diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index c54f11d..ab6abc1 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -101,6 +101,12 @@ H5G_CRT_GINFO_EST_NAME_LEN \ } +/* If the module using this macro is allowed access to the private variables, access them directly */ +#ifdef H5G_PACKAGE +#define H5G_MOUNTED(G) ((G)->shared->mounted) +#else /* H5G_PACKAGE */ +#define H5G_MOUNTED(G) (H5G_mounted(G)) +#endif /* H5G_PACKAGE */ /* Type of operation being performed for call to H5G_name_replace() */ typedef enum { @@ -158,6 +164,7 @@ H5_DLL herr_t H5G_close(H5G_t *grp); H5_DLL herr_t H5G_free_grp_name(H5G_t *grp); H5_DLL herr_t H5G_get_shared_count(H5G_t *grp); H5_DLL herr_t H5G_mount(H5G_t *grp); +H5_DLL hbool_t H5G_mounted(H5G_t *grp); H5_DLL herr_t H5G_unmount(H5G_t *grp); #ifndef H5_NO_DEPRECATED_SYMBOLS H5_DLL H5G_obj_t H5G_map_obj_type(H5O_type_t obj_type); diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index e818e72..5ba7050 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -61,6 +61,7 @@ typedef struct H5G_info_t { H5G_storage_type_t storage_type; /* Type of storage for links in group */ hsize_t nlinks; /* Number of links in group */ int64_t max_corder; /* Current max. creation order value for group */ + hbool_t mounted; /* Whether group has a file mounted on it */ } H5G_info_t; /********************/ |