summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2012-05-24 18:14:05 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2012-05-24 18:14:05 (GMT)
commit485dcbd4026b0d68df1b075fba9415d83c9eb554 (patch)
tree039175f8fe63b51c76103bf0c47792a0459488e4 /src
parentb65385eebd1aa95ab517f707997d234b7c3b3fd7 (diff)
downloadhdf5-485dcbd4026b0d68df1b075fba9415d83c9eb554.zip
hdf5-485dcbd4026b0d68df1b075fba9415d83c9eb554.tar.gz
hdf5-485dcbd4026b0d68df1b075fba9415d83c9eb554.tar.bz2
[svn-r22404] split the generic callback into a misc and optional callback for objects and files
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c12
-rw-r--r--src/H5Adeprec.c2
-rw-r--r--src/H5F.c136
-rw-r--r--src/H5Fprivate.h1
-rw-r--r--src/H5O.c8
-rw-r--r--src/H5R.c2
-rw-r--r--src/H5VL.c92
-rw-r--r--src/H5VLnative.c282
-rw-r--r--src/H5VLprivate.h6
-rw-r--r--src/H5VLpublic.h60
10 files changed, 390 insertions, 211 deletions
diff --git a/src/H5A.c b/src/H5A.c
index eb8c24e..a3f85ab 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -665,7 +665,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
- if(H5VL_object_generic(loc_id, H5VL_ATTR_OPEN_BY_IDX, H5_REQUEST_NULL, &ret_value,
+ if(H5VL_object_misc(loc_id, H5VL_ATTR_OPEN_BY_IDX, H5_REQUEST_NULL, &ret_value,
obj_name, idx_type, order, n, aapl_id, lapl_id) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to open attribute")
@@ -1529,7 +1529,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
- if(H5VL_object_generic(loc_id, H5VL_ATTR_OPEN_BY_IDX, H5_REQUEST_NULL, &attr_id,
+ if(H5VL_object_misc(loc_id, H5VL_ATTR_OPEN_BY_IDX, H5_REQUEST_NULL, &attr_id,
obj_name, idx_type, order, n, H5P_DEFAULT, lapl_id) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to open attribute")
@@ -1753,7 +1753,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
#endif
/* open the attribute through the VOL */
- if(H5VL_object_generic(loc_id, H5VL_ATTR_OPEN_BY_IDX, H5_REQUEST_NULL, &attr_id,
+ if(H5VL_object_misc(loc_id, H5VL_ATTR_OPEN_BY_IDX, H5_REQUEST_NULL, &attr_id,
obj_name, idx_type, order, n, H5P_DEFAULT, lapl_id) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to open attribute")
@@ -1842,7 +1842,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
/* Avoid thrashing things if the names are the same */
if(HDstrcmp(old_name, new_name))
/* rename the attribute info through the VOL */
- if(H5VL_object_generic(loc_id, H5VL_ATTR_RENAME, H5_REQUEST_NULL, NULL, old_name, new_name) < 0)
+ if(H5VL_object_misc(loc_id, H5VL_ATTR_RENAME, H5_REQUEST_NULL, NULL, old_name, new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
done:
@@ -1897,7 +1897,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object")
/* get the attribute info through the VOL */
- if(H5VL_object_generic(loc_id, H5VL_ATTR_RENAME, H5_REQUEST_NULL, location, old_attr_name, new_attr_name) < 0)
+ if(H5VL_object_misc(loc_id, H5VL_ATTR_RENAME, H5_REQUEST_NULL, location, old_attr_name, new_attr_name) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info")
if(NULL != location) {
@@ -2250,7 +2250,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to locate object")
/* get the attribute info through the VOL */
- if(H5VL_object_generic(loc_id, H5VL_ATTR_DELETE_BY_IDX, H5_REQUEST_NULL, location, idx_type, order, n) < 0)
+ if(H5VL_object_misc(loc_id, H5VL_ATTR_DELETE_BY_IDX, H5_REQUEST_NULL, location, idx_type, order, n) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index b045bb6..f4283f1 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -256,7 +256,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx)
if(H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
- if(H5VL_object_generic(loc_id, H5VL_ATTR_OPEN_BY_IDX, H5_REQUEST_NULL, &ret_value, ".", H5_INDEX_CRT_ORDER,
+ if(H5VL_object_misc(loc_id, H5VL_ATTR_OPEN_BY_IDX, H5_REQUEST_NULL, &ret_value, ".", H5_INDEX_CRT_ORDER,
H5_ITER_INC, (hsize_t)idx, H5P_DEFAULT, H5P_LINK_ACCESS_DEFAULT) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataset access properties")
diff --git a/src/H5F.c b/src/H5F.c
index 3972a08..8c1f1c3 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -830,7 +830,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle)
if(!file_handle)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer")
- if((ret_value = H5VL_file_generic(file_id, H5VL_FILE_GET_VFD_HANDLE, H5_REQUEST_NULL, file_handle, fapl)) < 0)
+ if((ret_value = H5VL_file_optional(file_id, H5VL_FILE_GET_VFD_HANDLE, H5_REQUEST_NULL, file_handle, fapl)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle")
done:
@@ -895,7 +895,7 @@ done:
if(!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified")
- if((ret_value = H5VL_file_generic(H5VL_FILE_IS_HDF5, &ret_value, name)) < 0)
+ if((ret_value = H5VL_file_optional(H5VL_FILE_IS_HDF5, &ret_value, name)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle")
FUNC_LEAVE_API(ret_value)
@@ -2027,54 +2027,73 @@ done:
hid_t
H5Freopen(hid_t file_id)
{
- H5F_t *old_file = NULL;
- H5F_t *new_file = NULL;
hid_t ret_value;
FUNC_ENTER_API(FAIL)
H5TRACE1("i", "i", file_id);
- /* Check arguments */
- if(NULL == (old_file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ if(H5VL_file_optional(file_id, H5VL_FILE_REOPEN, H5_REQUEST_NULL, &ret_value) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Freopen() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_reopen
+ *
+ * Purpose: Reopen a file. The new file handle which is returned points
+ * to the same file as the specified file handle. Both handles
+ * share caches and other information. The only difference
+ * between the handles is that the new handle is not mounted
+ * anywhere and no files are mounted on it.
+ *
+ * Return: Success: New file ID
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Friday, October 16, 1998
+ *
+ * Modifications:
+ * Quincey Koziol, May 14, 2002
+ * Keep old file's read/write intent in reopened file.
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5F_reopen(H5F_t *f)
+{
+ H5F_t *new_file = NULL;
+ hid_t ret_value;
+
+ FUNC_ENTER_NOAPI_NOINIT
/* Get a new "top level" file struct, sharing the same "low level" file struct */
- if(NULL == (new_file = H5F_new(old_file->shared, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
+ if(NULL == (new_file = H5F_new(f->shared, H5P_FILE_CREATE_DEFAULT,
+ H5P_FILE_ACCESS_DEFAULT, NULL)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
/* Keep old file's read/write intent in new file */
- new_file->intent = old_file->intent;
-
+ new_file->intent = f->intent;
/* Duplicate old file's names */
- new_file->open_name = H5MM_xstrdup(old_file->open_name);
- new_file->actual_name = H5MM_xstrdup(old_file->actual_name);
+ new_file->open_name = H5MM_xstrdup(f->open_name);
+ new_file->actual_name = H5MM_xstrdup(f->actual_name);
if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle")
/* Keep this ID in file object structure */
new_file->file_id = ret_value;
-#if 1 /*MSC - This needs to go through the VOL */
- {
- H5VL_class_t *vol_plugin; /* VOL structure attached to id */
- if (NULL == (vol_plugin = (H5VL_class_t *)H5I_get_aux(file_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
-
- /* attach VOL information to the ID */
- if (H5I_register_aux(ret_value, vol_plugin, (H5I_free_t)H5VL_close) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach vol info to ID")
- vol_plugin->nrefs++;
- }
-#endif
-
done:
if(ret_value < 0 && new_file)
- if(H5F_dest(new_file, H5AC_dxpl_id, FALSE) < 0)
- HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
+ if(H5F_dest(new_file, H5AC_dxpl_id, FALSE) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
- FUNC_LEAVE_API(ret_value)
-} /* end H5Freopen() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5F_reopen() */
/*-------------------------------------------------------------------------
@@ -2510,7 +2529,7 @@ H5Fget_freespace(hid_t file_id)
FUNC_ENTER_API(FAIL)
H5TRACE1("Hs", "i", file_id);
- if(H5VL_file_get(file_id, H5VL_FILE_GET_FREE_SPACE, H5_REQUEST_NULL, &ret_value) < 0)
+ if(H5VL_file_optional(file_id, H5VL_FILE_GET_FREE_SPACE, H5_REQUEST_NULL, &ret_value) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file free space")
done:
@@ -2544,7 +2563,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", file_id, size);
- if((ret_value = H5VL_file_get(file_id, H5VL_FILE_GET_SIZE, H5_REQUEST_NULL, size)) < 0)
+ if((ret_value = H5VL_file_optional(file_id, H5VL_FILE_GET_SIZE, H5_REQUEST_NULL, size)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file size")
done:
@@ -2715,8 +2734,9 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
if((NULL == config_ptr) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr")
- if((ret_value = H5VL_file_get(file_id, H5VL_FILE_GET_MDC_CONF, H5_REQUEST_NULL, config_ptr)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get mdc config")
+ if((ret_value = H5VL_file_optional(file_id, H5VL_FILE_GET_MDC_CONF, H5_REQUEST_NULL,
+ config_ptr)) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get mdc configuration")
done:
FUNC_LEAVE_API(ret_value)
@@ -2741,19 +2761,13 @@ done:
herr_t
H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
{
- H5F_t *file; /* File object for file ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*x", file_id, config_ptr);
- /* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
-
- /* set the resize configuration */
- if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.")
+ if(H5VL_file_optional(file_id, H5VL_FILE_RESET_MDC_HIT_RATE, H5_REQUEST_NULL, config_ptr) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "uanvle to set MDC configuration")
done:
FUNC_LEAVE_API(ret_value)
@@ -2787,7 +2801,8 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr)
if(NULL == hit_rate_ptr)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer")
- if((ret_value = H5VL_file_get(file_id, H5VL_FILE_GET_MDC_HR, H5_REQUEST_NULL, hit_rate_ptr)) < 0)
+ if((ret_value = H5VL_file_optional(file_id, H5VL_FILE_GET_MDC_HR, H5_REQUEST_NULL,
+ hit_rate_ptr)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
done:
@@ -2822,9 +2837,9 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr,
H5TRACE5("e", "i*z*z*z*Is", file_id, max_size_ptr, min_clean_size_ptr,
cur_size_ptr, cur_num_entries_ptr);
- if((ret_value = H5VL_file_get(file_id, H5VL_FILE_GET_MDC_SIZE, H5_REQUEST_NULL, max_size_ptr,
- min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr)) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
+ if((ret_value = H5VL_file_optional(file_id, H5VL_FILE_GET_MDC_SIZE, H5_REQUEST_NULL, max_size_ptr,
+ min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr)) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC size")
done:
FUNC_LEAVE_API(ret_value)
@@ -2854,18 +2869,12 @@ done:
herr_t
H5Freset_mdc_hit_rate_stats(hid_t file_id)
{
- H5F_t *file; /* File object for file ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
- /* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
-
- /* Reset the hit rate statistic */
- if(H5AC_reset_cache_hit_rate_stats(file->shared->cache) < 0)
+ if(H5VL_file_optional(file_id, H5VL_FILE_RESET_MDC_HIT_RATE, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate")
done:
@@ -2940,7 +2949,7 @@ H5Fget_info2(hid_t file_id, H5F_info2_t *finfo)
if(!finfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
- if((ret_value = H5VL_file_get(file_id, H5VL_FILE_GET_INFO, H5_REQUEST_NULL, finfo)) < 0)
+ if((ret_value = H5VL_file_optional(file_id, H5VL_FILE_GET_INFO, H5_REQUEST_NULL, finfo)) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file info")
done:
FUNC_LEAVE_API(ret_value)
@@ -2975,9 +2984,9 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
if(sect_info && nsects == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0")
- if(H5VL_file_get(file_id, H5VL_FILE_GET_FREE_SECTIONS, H5_REQUEST_NULL, sect_info, &ret_value,
- type, nsects) < 0)
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file info")
+ if(H5VL_file_optional(file_id, H5VL_FILE_GET_FREE_SECTIONS, H5_REQUEST_NULL, sect_info,
+ &ret_value, type, nsects) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file free sections")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_free_sections() */
@@ -3000,20 +3009,13 @@ done:
herr_t
H5Fclear_elink_file_cache(hid_t file_id)
{
- H5F_t *file; /* File */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", file_id);
- /* Check args */
- if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
-
- /* Release the EFC */
- if(file->shared->efc)
- if(H5F_efc_release(file->shared->efc) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
+ if(H5VL_file_optional(file_id, H5VL_FILE_CLEAR_ELINK_CACHE, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index bf5e02d..fdbd0b6 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -515,6 +515,7 @@ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id,
hid_t fapl_id, hid_t dxpl_id);
H5_DLL herr_t H5F_close(H5F_t *f);
H5_DLL herr_t H5F_try_close(H5F_t *f);
+H5_DLL hid_t H5F_reopen(H5F_t *f);
/* Functions than retrieve values from the file struct */
H5_DLL unsigned H5F_get_intent(const H5F_t *f);
diff --git a/src/H5O.c b/src/H5O.c
index ad63163..4062c3e 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -485,7 +485,7 @@ H5Oincr_refcount(hid_t object_id)
H5TRACE1("e", "i", object_id);
/* change the ref count through the VOL */
- if(H5VL_object_generic(object_id, H5VL_OBJECT_CHANGE_REF_COUNT, H5_REQUEST_NULL, 1) < 0)
+ if(H5VL_object_misc(object_id, H5VL_OBJECT_CHANGE_REF_COUNT, H5_REQUEST_NULL, 1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -522,7 +522,7 @@ H5Odecr_refcount(hid_t object_id)
H5TRACE1("e", "i", object_id);
/* change the ref count through the VOL */
- if(H5VL_object_generic(object_id, H5VL_OBJECT_CHANGE_REF_COUNT, H5_REQUEST_NULL, H5_REQUEST_NULL) < 0)
+ if(H5VL_object_misc(object_id, H5VL_OBJECT_CHANGE_REF_COUNT, H5_REQUEST_NULL, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -747,7 +747,7 @@ H5Oset_comment(hid_t obj_id, const char *comment)
H5TRACE2("e", "i*s", obj_id, comment);
/* set comment on object through the VOL */
- if(H5VL_object_generic(obj_id, H5VL_OBJECT_SET_COMMENT, H5_REQUEST_NULL, ".", comment, H5P_LINK_ACCESS_DEFAULT) < 0)
+ if(H5VL_object_misc(obj_id, H5VL_OBJECT_SET_COMMENT, H5_REQUEST_NULL, ".", comment, H5P_LINK_ACCESS_DEFAULT) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
done:
@@ -791,7 +791,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID")
/* set comment on object through the VOL */
- if(H5VL_object_generic(loc_id, H5VL_OBJECT_SET_COMMENT, H5_REQUEST_NULL, name, comment, lapl_id) < 0)
+ if(H5VL_object_misc(loc_id, H5VL_OBJECT_SET_COMMENT, H5_REQUEST_NULL, name, comment, lapl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found")
done:
diff --git a/src/H5R.c b/src/H5R.c
index 807cf18..bfead4a 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -318,7 +318,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
/* create the ref through the VOL */
- if(H5VL_object_generic(loc_id, H5VL_REF_CREATE, H5_REQUEST_NULL, ref, name, ref_type, space_id) < 0)
+ if(H5VL_object_misc(loc_id, H5VL_REF_CREATE, H5_REQUEST_NULL, ref, name, ref_type, space_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
diff --git a/src/H5VL.c b/src/H5VL.c
index 973206f..24821aa 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -737,7 +737,7 @@ H5VL_attr_close(hid_t id, hid_t req)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
/* if the VOL class does not implement a specific attr close
- callback, try the generic object close */
+ callback, try the object close */
if(NULL == vol_plugin->attr_cls.close){
if(H5VL_object_close(id, req) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close object")
@@ -1182,7 +1182,7 @@ H5VL_dataset_close(hid_t id, hid_t req)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
/* if the VOL class does not implement a specific dataset close
- callback, try the generic object close */
+ callback, try the object close */
if(NULL == vol_plugin->dataset_cls.close){
if(H5VL_object_close(id, req) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close object")
@@ -1225,8 +1225,8 @@ H5VL_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t req)
if(H5P_get(plist, H5F_ACS_VOL_NAME, &vol_plugin) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol plugin")
- /* check if the corresponding VOL open callback exists */
- if(NULL == vol_plugin->file_cls.open)
+ /* check if the corresponding VOL open callback exists */
+ if(NULL == vol_plugin->file_cls.open)
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file open' method")
/* call the corresponding VOL open callback */
if((ret_value = (vol_plugin->file_cls.open)(name, flags, fapl_id, req)) < 0)
@@ -1363,7 +1363,45 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_file_generic
+ * Function: H5VL_file_misc
+ *
+ * Purpose: perform a specified operation through the VOL
+ *
+ * Return: Success: non negative
+ * Failure: negative
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_file_misc(hid_t id, H5VL_file_misc_t misc_type, hid_t req, ...)
+{
+ va_list arguments; /* argument list passed from the API call */
+ H5VL_class_t *vol_plugin; /* VOL structure attached to id */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ if (NULL == (vol_plugin = (H5VL_class_t *)H5I_get_aux(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
+
+ if(NULL == vol_plugin->file_cls.misc)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file misc' method")
+
+ va_start (arguments, req);
+ if((ret_value = (vol_plugin->file_cls.misc)(id, misc_type, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "misc failed")
+ va_end (arguments);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_file_misc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_file_optional
*
* Purpose: perform a plugin specific operation
*
@@ -1376,7 +1414,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_file_generic(hid_t id, H5VL_file_generic_t generic_type, hid_t req, ...)
+H5VL_file_optional(hid_t id, H5VL_file_optional_t optional_type, hid_t req, ...)
{
va_list arguments; /* argument list passed from the API call */
H5VL_class_t *vol_plugin; /* VOL structure attached to id */
@@ -1387,17 +1425,31 @@ H5VL_file_generic(hid_t id, H5VL_file_generic_t generic_type, hid_t req, ...)
if (NULL == (vol_plugin = (H5VL_class_t *)H5I_get_aux(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
- if(NULL == vol_plugin->file_cls.generic)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file generic' method")
+ if(NULL == vol_plugin->file_cls.optional)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file optional' method")
va_start (arguments, req);
- if((ret_value = (vol_plugin->file_cls.generic)(id, generic_type, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "generic failed")
+ if((ret_value = (vol_plugin->file_cls.optional)(id, optional_type, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "optional failed")
va_end (arguments);
+ /* if we are re-opening the file ,attach the VOL info to the new id */
+ if(H5VL_FILE_REOPEN == optional_type) {
+ hid_t *ret_id;
+
+ va_start (arguments, req);
+ ret_id = va_arg (arguments, hid_t *);
+
+ /* attach VOL information to the ID */
+ if (H5I_register_aux(*ret_id, vol_plugin, (H5I_free_t)H5VL_close) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach vol info to ID")
+ vol_plugin->nrefs++;
+ va_end (arguments);
+ }
+
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_file_generic() */
+} /* end H5VL_file_optional() */
/*-------------------------------------------------------------------------
@@ -1602,7 +1654,7 @@ H5VL_group_close(hid_t id, hid_t req)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
/* if the VOL class does not implement a specific group close
- callback, try the generic object close */
+ callback, try the object close */
if(NULL == vol_plugin->group_cls.close) {
if(H5VL_object_close(id, req) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close object")
@@ -1994,7 +2046,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_object_generic
+ * Function: H5VL_object_misc
*
* Purpose: perform a plugin specific operation
*
@@ -2007,7 +2059,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_object_generic(hid_t id, H5VL_object_generic_t generic_type, hid_t req, ...)
+H5VL_object_misc(hid_t id, H5VL_object_misc_t misc_type, hid_t req, ...)
{
va_list arguments; /* argument list passed from the API call */
H5VL_class_t *vol_plugin; /* VOL structure attached to id */
@@ -2018,15 +2070,15 @@ H5VL_object_generic(hid_t id, H5VL_object_generic_t generic_type, hid_t req, ...
if (NULL == (vol_plugin = (H5VL_class_t *)H5I_get_aux(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information")
- if(NULL == vol_plugin->object_cls.generic)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object generic' method")
+ if(NULL == vol_plugin->object_cls.misc)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object misc' method")
va_start (arguments, req);
- if((ret_value = (vol_plugin->object_cls.generic)(id, generic_type, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "generic failed")
+ if((ret_value = (vol_plugin->object_cls.misc)(id, misc_type, req, arguments)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "misc failed")
va_end (arguments);
- if(H5VL_ATTR_OPEN_BY_IDX == generic_type) {
+ if(H5VL_ATTR_OPEN_BY_IDX == misc_type) {
hid_t *ret_id;
va_start (arguments, req);
@@ -2041,7 +2093,7 @@ H5VL_object_generic(hid_t id, H5VL_object_generic_t generic_type, hid_t req, ...
}
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_object_generic() */
+} /* end H5VL_object_misc() */
/*-------------------------------------------------------------------------
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index 0b6955c..b99296e 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -90,7 +90,8 @@ static hid_t H5VL_native_file_create(const char *name, unsigned flags, hid_t fc
static hid_t H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t req);
static herr_t H5VL_native_file_flush(hid_t fid, H5F_scope_t scope, hid_t req);
static herr_t H5VL_native_file_get(hid_t file_id, H5VL_file_get_t get_type, hid_t req, va_list arguments);
-static herr_t H5VL_native_file_generic(hid_t loc_id, H5VL_file_generic_t generic_type, hid_t req, va_list arguments);
+static herr_t H5VL_native_file_misc(hid_t loc_id, H5VL_file_misc_t misc_type, hid_t req, va_list arguments);
+static herr_t H5VL_native_file_optional(hid_t loc_id, H5VL_file_optional_t optional_type, hid_t req, va_list arguments);
static herr_t H5VL_native_file_close(hid_t fid, hid_t req);
static hid_t H5VL_native_group_create(hid_t loc_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t req);
@@ -111,7 +112,8 @@ static herr_t H5VL_native_object_copy(hid_t src_loc_id, const char *src_name, hi
static herr_t H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, void **location, hid_t req, va_list arguments);
static herr_t H5VL_native_object_free_loc(void *location, hid_t req);
static herr_t H5VL_native_object_get(hid_t id, H5VL_object_get_t get_type, hid_t req, va_list arguments);
-static herr_t H5VL_native_object_generic(hid_t id, H5VL_object_generic_t generic_type, hid_t req, va_list arguments);
+static herr_t H5VL_native_object_misc(hid_t id, H5VL_object_misc_t misc_type, hid_t req, va_list arguments);
+static herr_t H5VL_native_object_optional(hid_t id, H5VL_object_optional_t optional_type, hid_t req, va_list arguments);
static herr_t H5VL_native_object_close(hid_t object_id, hid_t req);
H5VL_class_t H5VL_native_g = {
@@ -146,7 +148,8 @@ H5VL_class_t H5VL_native_g = {
H5VL_native_file_open, /* open */
H5VL_native_file_flush, /* flush */
H5VL_native_file_get, /* get */
- H5VL_native_file_generic, /* generic */
+ H5VL_native_file_misc, /* misc */
+ H5VL_native_file_optional, /* optional */
H5VL_native_file_close /* close */
},
{ /* group_cls */
@@ -167,7 +170,8 @@ H5VL_class_t H5VL_native_g = {
H5VL_native_object_lookup, /* lookup */
H5VL_native_object_free_loc, /* free location */
H5VL_native_object_get, /* get */
- H5VL_native_object_generic, /* generic */
+ H5VL_native_object_misc, /* misc */
+ H5VL_native_object_optional, /* optional */
H5VL_native_object_close /* close */
}
};
@@ -1591,6 +1595,124 @@ H5VL_native_file_get(hid_t obj_id, H5VL_file_get_t get_type, hid_t UNUSED req, v
*ret = (ssize_t)obj_count;
break;
}
+ /* H5Fget_intent */
+ case H5VL_FILE_GET_INTENT:
+ {
+ unsigned *ret = va_arg (arguments, unsigned *);
+
+ /* HDF5 uses some flags internally that users don't know about.
+ * Simplify things for them so that they only get either H5F_ACC_RDWR
+ * or H5F_ACC_RDONLY.
+ */
+ if(H5F_INTENT(f) & H5F_ACC_RDWR)
+ *ret = H5F_ACC_RDWR;
+ else
+ *ret = H5F_ACC_RDONLY;
+ break;
+ }
+ /* H5Fget_name */
+ case H5VL_FILE_GET_NAME:
+ {
+ char *name = va_arg (arguments, char *);
+ ssize_t *ret = va_arg (arguments, ssize_t *);
+ size_t size = va_arg (arguments, size_t);
+ size_t len;
+
+ len = HDstrlen(H5F_OPEN_NAME(f));
+
+ if(name) {
+ HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size));
+ if(len >= size)
+ name[size-1]='\0';
+ } /* end if */
+
+ /* Set the return value for the API call */
+ *ret = (ssize_t)len;
+ break;
+ }
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information")
+ } /* end switch */
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_native_file_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_native_file_misc
+ *
+ * Purpose: Perform an operation
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_native_file_misc(hid_t loc_id, H5VL_file_misc_t misc_type, hid_t UNUSED req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ switch (misc_type) {
+ /* H5Fis_hdf5 */
+ case H5VL_FILE_IS_HDF5:
+ {
+ htri_t *ret = va_arg (arguments, htri_t *);
+ const char *name = va_arg (arguments, const char *);
+
+ if((*ret = H5F_is_hdf5(name)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't determine if file is an HDF5 file")
+ break;
+ }
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type")
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_native_file_misc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_native_file_optional
+ *
+ * Purpose: Perform a plugin specific operation on a native file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Mohamad Chaarawi
+ * May, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_native_file_optional(hid_t id, H5VL_file_optional_t optional_type, hid_t UNUSED req, va_list arguments)
+{
+ H5F_t *f = NULL; /* File */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Check/fix arguments. */
+ if(H5I_FILE == H5I_get_type(id)) {
+ if(NULL == (f = (H5F_t *)H5I_object(id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
+ } /* end if */
+ else {
+ H5G_loc_t loc; /* Object location */
+ /* Get symbol table entry */
+ if(H5G_loc(id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object ID")
+ f = loc.oloc->file;
+ } /* end else */
+
+ switch (optional_type) {
/* H5Fget_filesize */
case H5VL_FILE_GET_SIZE:
{
@@ -1663,41 +1785,6 @@ H5VL_native_file_get(hid_t obj_id, H5VL_file_get_t get_type, hid_t UNUSED req, v
finfo->free.version = HDF5_FREESPACE_VERSION;
break;
}
- /* H5Fget_intent */
- case H5VL_FILE_GET_INTENT:
- {
- unsigned *ret = va_arg (arguments, unsigned *);
-
- /* HDF5 uses some flags internally that users don't know about.
- * Simplify things for them so that they only get either H5F_ACC_RDWR
- * or H5F_ACC_RDONLY.
- */
- if(H5F_INTENT(f) & H5F_ACC_RDWR)
- *ret = H5F_ACC_RDWR;
- else
- *ret = H5F_ACC_RDONLY;
- break;
- }
- /* H5Fget_name */
- case H5VL_FILE_GET_NAME:
- {
- char *name = va_arg (arguments, char *);
- ssize_t *ret = va_arg (arguments, ssize_t *);
- size_t size = va_arg (arguments, size_t);
- size_t len;
-
- len = HDstrlen(H5F_OPEN_NAME(f));
-
- if(name) {
- HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1,size));
- if(len >= size)
- name[size-1]='\0';
- } /* end if */
-
- /* Set the return value for the API call */
- *ret = (ssize_t)len;
- break;
- }
/* H5Fget_mdc_config */
case H5VL_FILE_GET_MDC_CONF:
{
@@ -1736,59 +1823,50 @@ H5VL_native_file_get(hid_t obj_id, H5VL_file_get_t get_type, hid_t UNUSED req, v
*cur_num_entries_ptr = (int)cur_num_entries;
break;
}
- default:
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information")
- } /* end switch */
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_file_get() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5VL_native_file_generic
- *
- * Purpose: Perform a plugin specific operation on a native file
- *
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Mohamad Chaarawi
- * April, 2012
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_native_file_generic(hid_t loc_id, H5VL_file_generic_t generic_type, hid_t UNUSED req, va_list arguments)
-{
- H5F_t *file = NULL; /* File */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT
-
- switch (generic_type) {
/* H5Fget_vfd_handle */
case H5VL_FILE_GET_VFD_HANDLE:
{
void **file_handle = va_arg (arguments, void **);
hid_t fapl = va_arg (arguments, hid_t);
- /* Get the file */
- if(NULL == (file = (H5F_t *)H5I_object_verify(loc_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file id")
-
/* Retrieve the VFD handle for the file */
- if(H5F_get_vfd_handle(file, fapl, file_handle) < 0)
+ if(H5F_get_vfd_handle(f, fapl, file_handle) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle")
break;
}
- /* H5Fis_hdf5 */
- case H5VL_FILE_IS_HDF5:
+ /* H5Fclear_elink_file_cache */
+ case H5VL_FILE_CLEAR_ELINK_CACHE:
{
- htri_t *ret = va_arg (arguments, htri_t *);
- const char *name = va_arg (arguments, const char *);
+ /* Release the EFC */
+ if(f->shared->efc)
+ if(H5F_efc_release(f->shared->efc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
+ break;
+ }
+ /* H5Freopen */
+ case H5VL_FILE_REOPEN:
+ {
+ hid_t *ret_id = va_arg (arguments, hid_t *);
- if((*ret = H5F_is_hdf5(name)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't determine if file is an HDF5 file")
+ if((*ret_id = H5F_reopen(f)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
+ break;
+ }
+ /* H5Freset_mdc_hit_rate_stats */
+ case H5VL_FILE_RESET_MDC_HIT_RATE:
+ {
+ /* Reset the hit rate statistic */
+ if(H5AC_reset_cache_hit_rate_stats(f->shared->cache) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate")
+ break;
+ }
+ case H5VL_FILE_SET_MDC_CONFIG:
+ {
+ H5AC_cache_config_t *config_ptr = va_arg (arguments, H5AC_cache_config_t *);
+
+ /* set the resize configuration */
+ if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.")
break;
}
default:
@@ -1797,7 +1875,7 @@ H5VL_native_file_generic(hid_t loc_id, H5VL_file_generic_t generic_type, hid_t U
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_file_generic() */
+} /* end H5VL_native_file_optional() */
/*-------------------------------------------------------------------------
@@ -2498,7 +2576,7 @@ H5VL_native_object_lookup(hid_t loc_id, H5VL_object_lookup_t lookup_type, void *
H5G_loc_reset(obj_loc);
switch (lookup_type) {
- case H5VL_OBJECT_LOOKUP:
+ case H5VL_OBJECT_LOOKUP_BY_ID:
obj_loc->oloc->addr = loc.oloc->addr;
obj_loc->oloc->file = loc.oloc->file;
obj_loc->oloc->holding_file = loc.oloc->holding_file;
@@ -2640,7 +2718,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5VL_native_object_generic
+ * Function: H5VL_native_object_misc
*
* Purpose: Perform a plugin specific operation for an objectibute
*
@@ -2653,14 +2731,14 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_native_object_generic(hid_t loc_id, H5VL_object_generic_t generic_type, hid_t UNUSED req, va_list arguments)
+H5VL_native_object_misc(hid_t loc_id, H5VL_object_misc_t misc_type, hid_t UNUSED req, va_list arguments)
{
herr_t ret_value = SUCCEED; /* Return value */
H5A_t *attr = NULL; /* Attribute opened */
FUNC_ENTER_NOAPI_NOINIT
- switch (generic_type) {
+ switch (misc_type) {
/* H5Adelete_by_idx */
case H5VL_ATTR_DELETE_BY_IDX:
{
@@ -2780,11 +2858,41 @@ H5VL_native_object_generic(hid_t loc_id, H5VL_object_generic_t generic_type, hid
done:
/* Cleanup on failure */
- if(H5VL_ATTR_OPEN_BY_IDX == generic_type && ret_value < 0)
+ if(H5VL_ATTR_OPEN_BY_IDX == misc_type && ret_value < 0)
if(attr && H5A_close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_native_object_generic() */
+} /* end H5VL_native_object_misc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_native_object_optional
+ *
+ * Purpose: Perform a plugin specific operation for an objectibute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Mohamad Chaarawi
+ * April, 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_native_object_optional(hid_t loc_id, H5VL_object_optional_t optional_type, hid_t UNUSED req, va_list arguments)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ switch (optional_type) {
+ default:
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object");
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_native_object_optional() */
/*-------------------------------------------------------------------------
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index a4fdf48..80eff2c 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -73,7 +73,8 @@ H5_DLL hid_t H5VL_file_open(const char *name, unsigned flags, hid_t fapl_id, hi
H5_DLL hid_t H5VL_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t req);
H5_DLL herr_t H5VL_file_close(hid_t file_id, hid_t req);
H5_DLL herr_t H5VL_file_flush(hid_t file_id, H5F_scope_t scope, hid_t req);
-H5_DLL herr_t H5VL_file_generic(hid_t loc_id, H5VL_file_generic_t generic_type, hid_t req, ...);
+H5_DLL herr_t H5VL_file_misc(hid_t loc_id, H5VL_file_misc_t misc_type, hid_t req, ...);
+H5_DLL herr_t H5VL_file_optional(hid_t loc_id, H5VL_file_optional_t optional_type, hid_t req, ...);
H5_DLL herr_t H5VL_file_get(hid_t uid, H5VL_file_get_t get_type, hid_t req, ...);
H5_DLL hid_t H5VL_group_create(hid_t uid, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t req);
@@ -92,7 +93,8 @@ H5_DLL hid_t H5VL_object_open_by_loc(hid_t loc_id, void *obj_loc, hid_t lapl_id,
H5_DLL herr_t H5VL_object_copy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t req);
H5_DLL herr_t H5VL_object_get(hid_t uid, H5VL_object_get_t get_type, hid_t req, ...);
-H5_DLL herr_t H5VL_object_generic(hid_t id, H5VL_object_generic_t generic_type, hid_t req, ...);
+H5_DLL herr_t H5VL_object_misc(hid_t id, H5VL_object_misc_t misc_type, hid_t req, ...);
+H5_DLL herr_t H5VL_object_optional(hid_t id, H5VL_object_misc_t optional_type, hid_t req, ...);
H5_DLL herr_t H5VL_object_lookup(hid_t uid, H5VL_object_lookup_t lookup_type, void **location, hid_t req, ...);
H5_DLL herr_t H5VL_object_free_loc(hid_t loc_id, void *location, hid_t req);
H5_DLL herr_t H5VL_object_close(hid_t uid, hid_t req);
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index bacf27c..0f15c83 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -48,29 +48,37 @@ typedef enum H5VL_dataset_get_t {
H5VL_DATASET_GET_OFFSET = 6 /* offset */
} H5VL_dataset_get_t;
-/* types for all file general operations */
-typedef enum H5VL_file_generic_t {
- H5VL_FILE_GET_VFD_HANDLE = 0, /*file VFD handle */
- H5VL_FILE_IS_HDF5 = 1 /* is HDF5? */
-} H5VL_file_generic_t;
-
/* types for all file get API routines */
typedef enum H5VL_file_get_t {
H5VL_FILE_GET_FAPL = 0, /*file access property list */
H5VL_FILE_GET_FCPL = 1, /*file creation property list */
- H5VL_FILE_GET_SIZE = 2, /*file size */
- H5VL_FILE_GET_FREE_SPACE = 3, /*file freespace */
- H5VL_FILE_GET_INFO = 4, /*file info */
- H5VL_FILE_GET_INTENT = 5, /*file intent */
- H5VL_FILE_GET_NAME = 6, /*file name */
- H5VL_FILE_GET_OBJ_COUNT = 7, /*object count in file */
- H5VL_FILE_GET_OBJ_IDS = 8, /*object ids in file */
- H5VL_FILE_GET_MDC_CONF = 9, /*file metadata cache configuration */
- H5VL_FILE_GET_MDC_HR = 10, /*file metadata cache hit rate */
- H5VL_FILE_GET_MDC_SIZE = 11, /*file metadata cache size */
- H5VL_FILE_GET_FREE_SECTIONS = 12 /*file free selections */
+ H5VL_FILE_GET_INTENT = 2, /*file intent */
+ H5VL_FILE_GET_NAME = 3, /*file name */
+ H5VL_FILE_GET_OBJ_COUNT = 4, /*object count in file */
+ H5VL_FILE_GET_OBJ_IDS = 5, /*object ids in file */
} H5VL_file_get_t;
+/* types for all file misc operations */
+typedef enum H5VL_file_misc_t {
+ H5VL_FILE_IS_HDF5 = 0 /* is HDF5? */
+} H5VL_file_misc_t;
+
+/* types for all file optional operations */
+typedef enum H5VL_file_optional_t {
+ H5VL_FILE_CLEAR_ELINK_CACHE = 0,
+ H5VL_FILE_GET_FREE_SECTIONS = 1, /*file free selections */
+ H5VL_FILE_GET_FREE_SPACE = 2, /*file freespace */
+ H5VL_FILE_GET_INFO = 3, /*file info */
+ H5VL_FILE_GET_MDC_CONF = 4, /*file metadata cache configuration */
+ H5VL_FILE_GET_MDC_HR = 5, /*file metadata cache hit rate */
+ H5VL_FILE_GET_MDC_SIZE = 6, /*file metadata cache size */
+ H5VL_FILE_GET_SIZE = 7, /*file size */
+ H5VL_FILE_GET_VFD_HANDLE = 8, /*file VFD handle */
+ H5VL_FILE_REOPEN = 9,
+ H5VL_FILE_RESET_MDC_HIT_RATE = 10,
+ H5VL_FILE_SET_MDC_CONFIG = 11
+} H5VL_file_optional_t;
+
/* types for all group get API routines */
typedef enum H5VL_group_get_t {
H5VL_GROUP_GET_GCPL = 0, /*group creation property list */
@@ -93,14 +101,19 @@ typedef enum H5VL_link_get_t {
} H5VL_link_get_t;
/* types for all object general operations */
-typedef enum H5VL_object_generic_t {
+typedef enum H5VL_object_misc_t {
H5VL_ATTR_DELETE_BY_IDX = 0, /* H5Adelete_by_idx */
H5VL_ATTR_OPEN_BY_IDX = 1, /* H5Aopen_by_idx */
H5VL_ATTR_RENAME = 2, /* H5Arename */
H5VL_OBJECT_CHANGE_REF_COUNT = 3, /* H5Oincr/decr_refcount */
H5VL_OBJECT_SET_COMMENT = 4, /* H5Oset_comment(_by_name) */
H5VL_REF_CREATE = 5 /* H5Rcreate */
-} H5VL_object_generic_t;
+} H5VL_object_misc_t;
+
+/* types for all object general operations */
+typedef enum H5VL_object_optional_t {
+ H5VL_OPTIONAL = 0
+} H5VL_object_optional_t;
/* types for all object get API routines */
typedef enum H5VL_object_get_t {
@@ -114,14 +127,13 @@ typedef enum H5VL_object_get_t {
/* types for all object lookup API routines */
typedef enum H5VL_object_lookup_t {
- H5VL_OBJECT_LOOKUP = 0,
+ H5VL_OBJECT_LOOKUP_BY_ID = 0,
H5VL_OBJECT_LOOKUP_BY_NAME = 1,
H5VL_OBJECT_LOOKUP_BY_IDX = 2,
H5VL_OBJECT_LOOKUP_BY_ADDR = 3,
H5VL_OBJECT_LOOKUP_BY_REF = 4
} H5VL_object_lookup_t;
-
#define H5VL_VOL_DEFAULT 0 /* Default VOL plugin value */
/* H5A routines */
@@ -162,7 +174,8 @@ typedef struct H5VL_file_class_t {
hid_t (*open) (const char *name, unsigned flags, hid_t fapl_id, hid_t req);
herr_t (*flush) (hid_t file_id, H5F_scope_t scope, hid_t req);
herr_t (*get) (hid_t file_id, H5VL_file_get_t get_type, hid_t req, va_list arguments);
- herr_t (*generic)(hid_t loc_id, H5VL_file_generic_t generic_type, hid_t req, va_list arguments);
+ herr_t (*misc)(hid_t loc_id, H5VL_file_misc_t misc_type, hid_t req, va_list arguments);
+ herr_t (*optional)(hid_t id, H5VL_file_optional_t op_type, hid_t req, va_list arguments);
herr_t (*close) (hid_t file_id, hid_t req);
} H5VL_file_class_t;
@@ -192,7 +205,8 @@ typedef struct H5VL_object_class_t {
herr_t (*lookup)(hid_t loc_id, H5VL_object_lookup_t lookup_type, void **location, hid_t req, va_list arguments);
herr_t (*free_loc)(void *location, hid_t req);
herr_t (*get) (hid_t loc_id, H5VL_object_get_t get_type, hid_t req, va_list arguments);
- herr_t (*generic)(hid_t id, H5VL_object_generic_t generic_type, hid_t req, va_list arguments);
+ herr_t (*misc) (hid_t id, H5VL_object_misc_t misc_type, hid_t req, va_list arguments);
+ herr_t (*optional)(hid_t id, H5VL_object_optional_t op_type, hid_t req, va_list arguments);
herr_t (*close) (hid_t obj_id, hid_t req);
} H5VL_object_class_t;