From 1cfe5fa4dea7918edc52521d05f2db3c7f4525fb Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Tue, 10 Jul 2012 17:20:16 -0500 Subject: [svn-r22549] move ref count management on the VOL struct inside the VLint code - H5Freopen still needs to be handled create the public interface for VOL callbacks: - unresolved issue with var_args update and create new API fapl calls to support stacking drivers: - need to add fapl copy callback fix a memory leak with registration of external plugins --- src/H5A.c | 13 - src/H5Adeprec.c | 3 - src/H5D.c | 11 - src/H5Ddeprec.c | 2 - src/H5F.c | 25 +- src/H5Fint.c | 2 +- src/H5G.c | 12 - src/H5Gdeprec.c | 2 - src/H5O.c | 3 - src/H5Pfapl.c | 108 ++++- src/H5Pprivate.h | 1 + src/H5Ppublic.h | 1 + src/H5Tcommit.c | 11 - src/H5Tdeprec.c | 1 - src/H5VL.c | 1264 ++++++++++++++++++++++++++++++++++++++++++++++++++++- src/H5VLint.c | 76 +++- src/H5VLprivate.h | 4 +- src/H5VLpublic.h | 106 +++-- 18 files changed, 1483 insertions(+), 162 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 6915e29..a4558fe 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -270,7 +270,6 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, /* Get an atom for the attribute */ if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && attr) @@ -369,7 +368,6 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Get an atom for the attribute */ if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && attr) @@ -434,7 +432,6 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) /* Get an atom for the attribute */ if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && attr) @@ -511,7 +508,6 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, /* Get an atom for the attribute */ if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && attr) @@ -597,7 +593,6 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Get an atom for the attribute */ if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && attr) @@ -1907,14 +1902,6 @@ H5A_close_attr(void *attr, H5VL_t *vol_plugin) if((ret_value = H5VL_attr_close(attr, vol_plugin, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to close attribute") - vol_plugin->nrefs --; - if (0 == vol_plugin->nrefs) { - if (NULL != vol_plugin->container_name) - H5MM_xfree(vol_plugin->container_name); - if (NULL != vol_plugin) - H5MM_free(vol_plugin); - } - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_close_attr() */ diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 92d80bc..e9387b5 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -187,7 +187,6 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, /* Get an atom for the attribute */ if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && attr) @@ -255,7 +254,6 @@ H5Aopen_name(hid_t loc_id, const char *name) /* Get an atom for the attribute */ if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && attr) @@ -325,7 +323,6 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) /* Get an atom for the attribute */ if((ret_value = H5I_register2(H5I_ATTR, attr, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && attr) diff --git a/src/H5D.c b/src/H5D.c index 3b87e3a..0c08768 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -202,7 +202,6 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, /* Get an atom for the dataset */ if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && dset) @@ -303,7 +302,6 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, /* Get an atom for the dataset */ if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && dset) @@ -371,7 +369,6 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) /* Get an atom for the dataset */ if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && dset) @@ -1058,14 +1055,6 @@ H5D_close_dataset(void *dset, H5VL_t *vol_plugin) if((ret_value = H5VL_dataset_close(dset, vol_plugin, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset") - vol_plugin->nrefs --; - if (0 == vol_plugin->nrefs) { - if (NULL != vol_plugin->container_name) - H5MM_xfree(vol_plugin->container_name); - if (NULL != vol_plugin) - H5MM_free(vol_plugin); - } - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_close_dataset() */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index c84d440..15dc409 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -189,7 +189,6 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, /* Get an atom for the dataset */ if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && dset) @@ -251,7 +250,6 @@ H5Dopen1(hid_t loc_id, const char *name) /* Get an atom for the dataset */ if((ret_value = H5I_register2(H5I_DATASET, dset, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && dset) diff --git a/src/H5F.c b/src/H5F.c index cb25723..f03ed42 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -500,14 +500,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") - /* Build the vol plugin struct */ - if(NULL == (vol_plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - vol_plugin->nrefs = 1; - /* create a new file or truncate an existing file through the VOL */ - if(NULL == (file = H5VL_file_create(vol_plugin, filename, flags, fcpl_id, fapl_id, H5_REQUEST_NULL))) + if(NULL == (file = H5VL_file_create(&vol_plugin, filename, flags, fcpl_id, fapl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") /* Get an atom for the file with the VOL information as the auxilary struct*/ @@ -586,14 +580,8 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") - /* Build the vol plugin struct */ - if(NULL == (vol_plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - vol_plugin->nrefs = 1; - /* Open the file through the VOL layer */ - if(NULL == (file = H5VL_file_open(vol_plugin, filename, flags, fapl_id, H5_REQUEST_NULL))) + if(NULL == (file = H5VL_file_open(&vol_plugin, filename, flags, fapl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") /* Get an atom for the file with the VOL information as the auxilary struct*/ @@ -744,15 +732,6 @@ H5F_close_file(void *file, H5VL_t *vol_plugin) /* Close the file through the VOL*/ if((ret_value = H5VL_file_close(file, vol_plugin, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") - - vol_plugin->nrefs --; - if (0 == vol_plugin->nrefs) { - if (NULL != vol_plugin->container_name) - H5MM_xfree(vol_plugin->container_name); - if (NULL != vol_plugin) - H5MM_free(vol_plugin); - } - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_close_file() */ diff --git a/src/H5Fint.c b/src/H5Fint.c index e584dd3..9e05c60 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1270,7 +1270,7 @@ H5F_close(H5F_t *f) /* Sanity check */ HDassert(f); - HDassert(f->file_id > 0); /* This routine should only be called when a file ID's ref count drops to zero */ + //HDassert(f->file_id > 0); /* This routine should only be called when a file ID's ref count drops to zero */ /* Perform checks for "semi" file close degree here, since closing the * file is not allowed if there are objects still open */ diff --git a/src/H5G.c b/src/H5G.c index 4a6c211..43cb4d0 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -313,7 +313,6 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g /* get the file object */ if(NULL == (obj = (void *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") @@ -325,7 +324,6 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g /* Get an atom for the group */ if((ret_value = H5I_register2(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && grp) @@ -414,7 +412,6 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) /* Get an atom for the group */ if((ret_value = H5I_register2(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && grp) @@ -482,7 +479,6 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) /* Get an atom for the group */ if((ret_value = H5I_register2(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && grp) @@ -777,14 +773,6 @@ H5G_close_group(void *grp, H5VL_t *vol_plugin) if((ret_value = H5VL_group_close(grp, vol_plugin, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group") - vol_plugin->nrefs --; - if (0 == vol_plugin->nrefs) { - if (NULL != vol_plugin->container_name) - H5MM_xfree(vol_plugin->container_name); - if (NULL != vol_plugin) - H5MM_free(vol_plugin); - } - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_close_group() */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 070b969..5399219 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -269,7 +269,6 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) /* Get an atom for the group */ if((ret_value = H5I_register2(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) @@ -334,7 +333,6 @@ H5Gopen1(hid_t loc_id, const char *name) /* Get an atom for the group */ if((ret_value = H5I_register2(H5I_GROUP, grp, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs ++; done: if (ret_value < 0 && grp) diff --git a/src/H5O.c b/src/H5O.c index 88ee231..e9df5e6 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -261,7 +261,6 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) /* Get an atom for the object */ if((ret_value = H5I_register2(opened_type, opened_obj, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs++; #if 0 if ((ret_value = H5VL_object_register(opened_obj, opened_type, vol_plugin)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") @@ -344,7 +343,6 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Get an atom for the object */ if((ret_value = H5I_register2(opened_type, opened_obj, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs++; done: FUNC_LEAVE_API(ret_value) @@ -417,7 +415,6 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) /* Get an atom for the object */ if((ret_value = H5I_register2(opened_type, opened_obj, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize dataset handle") - vol_plugin->nrefs++; done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index b572350..a52e29b 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -2210,19 +2210,24 @@ H5P_set_vol(H5P_genplist_t *plist, H5VL_class_t *vol_cls, const void *vol_info) FUNC_ENTER_NOAPI(FAIL) - /* Get the current vol information */ - if(H5P_get(plist, H5F_ACS_VOL_NAME, &old_vol_cls) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol class") - if(H5P_get(plist, H5F_ACS_VOL_INFO_NAME, &old_vol_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol info") - - /* Close the vol for the property list */ - if(H5VL_fapl_close(old_vol_cls, old_vol_info)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset vol") - - /* Set the vol for the property list */ - if(H5VL_fapl_open(plist, vol_cls, vol_info)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vol") + if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { + /* Get the current vol information */ + if(H5P_get(plist, H5F_ACS_VOL_NAME, &old_vol_cls) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol class") + if(H5P_get(plist, H5F_ACS_VOL_INFO_NAME, &old_vol_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol info") + + /* Close the vol for the property list */ + if(H5VL_fapl_close(old_vol_cls, old_vol_info)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset vol") + + /* Set the vol for the property list */ + if(H5VL_fapl_open(plist, vol_cls, vol_info)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vol") + } + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_set_vol() */ @@ -2269,6 +2274,83 @@ done: /*------------------------------------------------------------------------- + * Function: H5P_get_vol_info + * + * Purpose: Returns a pointer directly to the file vol-specific + * information of a file access property list. + * + * Return: Success: Ptr to *uncopied* vol specific data + * structure if any. + * + * Failure: NULL. Null is also returned if the vol has + * not registered any vol-specific properties + * although no error is pushed on the stack in + * this case. + * + * Programmer: Mohamad Chaarawi + * July, 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5P_get_vol_info(H5P_genplist_t *plist) +{ + void *ret_value=NULL; + + FUNC_ENTER_NOAPI(NULL) + + /* Get the current vol info */ + if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) { + if(H5P_get(plist, H5F_ACS_VOL_INFO_NAME, &ret_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,NULL,"can't get vol info"); + } else { + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_get_vol_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_vol_info + * + * Purpose: Returns a pointer directly to the file vol-specific + * information of a file access property list. + * + * Return: Success: Ptr to *uncopied* vol specific data + * structure if any. + * + * Failure: NULL. Null is also returned if the vol has + * not registered any vol-specific properties + * although no error is pushed on the stack in + * this case. + * + * Programmer: Mohamad Chaarawi + * July 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5Pget_vol_info(hid_t plist_id) +{ + H5P_genplist_t *plist; /* Property list pointer */ + void *ret_value; /* Return value */ + + FUNC_ENTER_API(NULL) + + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") + + if(NULL == (ret_value = H5P_get_vol_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol info") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_vol_info() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_file_image * * Purpose: Sets the initial file image. Some file drivers can initialize diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index fb26eee..45e9ada 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -76,6 +76,7 @@ H5_DLL void * H5P_get_driver_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info); H5_DLL herr_t H5P_set_vol(H5P_genplist_t *plist, H5VL_class_t *vol_cls, const void *vol_info); +H5_DLL void * H5P_get_vol_info(H5P_genplist_t *plist); H5_DLL herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 3986c79..38753da 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -292,6 +292,7 @@ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, H5_DLL hid_t H5Pget_driver(hid_t plist_id); H5_DLL void *H5Pget_driver_info(hid_t plist_id); H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info); +H5_DLL void *H5Pget_vol_info(hid_t plist_id); /* H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t vol_id, const void *vol_info); diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 44e5b8b..f2d1743 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -186,7 +186,6 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, /* attach VOL information to the ID */ if (H5I_register_aux(type_id, vol_plugin, (H5I_free2_t)H5T_close_datatype) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach vol info to ID") - vol_plugin->nrefs ++; done: FUNC_LEAVE_API(ret_value) @@ -351,7 +350,6 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) /* attach VOL information to the ID */ if (H5I_register_aux(type_id, vol_plugin, (H5I_free2_t)H5T_close_datatype) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach vol info to ID") - vol_plugin->nrefs ++; done: FUNC_LEAVE_API(ret_value) @@ -988,7 +986,6 @@ H5VL_create_datatype(void *dt_obj, H5VL_t *vol_plugin, hid_t req) /* Get an atom for the datatype with the VOL information as the auxilary struct*/ if((ret_value = H5I_register2(H5I_DATATYPE, dt, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") - vol_plugin->nrefs ++; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1022,14 +1019,6 @@ H5T_close_datatype(void *type, H5VL_t *vol_plugin) if((ret_value = H5VL_datatype_close(dt->vol_obj, vol_plugin, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatypeibute") - vol_plugin->nrefs --; - if (0 == vol_plugin->nrefs) { - if (NULL != vol_plugin->container_name) - H5MM_xfree(vol_plugin->container_name); - if (NULL != vol_plugin) - H5MM_free(vol_plugin); - } - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_close_datatype() */ diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index ce82b2d..bc8fb51 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -167,7 +167,6 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) /* attach VOL information to the ID */ if (H5I_register_aux(type_id, vol_plugin, (H5I_free2_t)H5T_close_datatype) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't attach vol info to ID") - vol_plugin->nrefs ++; done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5VL.c b/src/H5VL.c index 46a0770..4372f05 100644 --- a/src/H5VL.c +++ b/src/H5VL.c @@ -187,6 +187,7 @@ H5VL_free_cls(H5VL_class_t *cls) if(cls->terminate && cls->terminate() < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "vol plugin '%s' did not terminate cleanly", cls->name) + H5MM_free(cls); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_free_cls() */ @@ -348,7 +349,7 @@ H5VLregister_object(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls) H5VL_t *vol_plugin; /* VOL plugin information */ hid_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_API(FAIL) /* Get an atom for the object */ if((ret_value = H5I_register(obj_type, obj, TRUE)) < 0) @@ -397,5 +398,1264 @@ H5VLregister_object(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") } /* end switch */ done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_API(ret_value) } /* H5VLregister_object */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_create + * + * Purpose: Creates an attribute through the VOL + * + * Return: Success: pointer to the new attr. + * + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, + hid_t acpl_id, hid_t aapl_id, hid_t req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API(NULL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") + if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, vol_plugin, name, acpl_id, aapl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create attribute") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_open + * + * Purpose: Opens an attribute through the VOL + * + * Return: Success: pointer to the new attr. + * + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, + hid_t aapl_id, hid_t req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_API(NULL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") + if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, vol_plugin, name, aapl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open attribute") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_read + * + * Purpose: Reads data from attr through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t H5VLattr_read(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, void *buf, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == attr || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_attr_read(attr, vol_plugin, mem_type_id, buf, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read attribute") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_write + * + * Purpose: Writes data to attr through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t H5VLattr_write(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, const void *buf, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == attr || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_attr_write(attr, vol_plugin, mem_type_id, buf, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write attribute") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_get + * + * Purpose: Get specific information about the attribute through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, hid_t req, ...) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_remove + * + * Purpose: Removes an attribute through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + const char *attr_name, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_attr_remove(obj, loc_params, vol_plugin, attr_name, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to remove attribute") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_remove() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLattr_close + * + * Purpose: Closes an attribute through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_close(void *attr, H5VL_t *vol_plugin, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == attr || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_attr_close(attr, vol_plugin, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close attribute") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_commit + * + * Purpose: Commits a datatype to the file through the VOL + * + * Return: Success: Positive + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, + hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API(NULL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") + if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, vol_plugin, name, type_id, + lcpl_id, tcpl_id, tapl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to commit datatype") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdatatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_open + * + * Purpose: Opens a named datatype through the VOL + * + * Return: Success: User ID of the datatype. + * + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, + hid_t tapl_id, hid_t req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API(NULL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") + if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, vol_plugin, name, tapl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open datatype") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdatatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_get_binary + * + * Purpose: gets required size to serialize datatype description + * + * Return: Success: size needed + * + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +ssize_t +H5VLdatatype_get_binary(void *obj, H5VL_t *vol_plugin, unsigned char *buf, size_t size, hid_t req) +{ + ssize_t ret_value = FAIL; + + FUNC_ENTER_API(FAIL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_datatype_get_binary(obj, vol_plugin, buf, size, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to encode datatype") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdatatype_get_binary() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_close + * + * Purpose: Closes a datatype through the VOL + * + * Return: Success: Positive + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * May, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_close(void *dt, H5VL_t *vol_plugin, hid_t req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if (NULL == dt || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_datatype_close(dt, vol_plugin, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close datatype") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdatatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_create + * + * Purpose: Creates a dataset through the VOL + * + * Return: Success: pointer to dataset + * + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, + hid_t dcpl_id, hid_t dapl_id, hid_t req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_API(NULL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") + if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, vol_plugin, name, + dcpl_id, dapl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create dataset") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_open + * + * Purpose: Opens a dataset through the VOL + * + * Return: Success: pointer to dataset + * + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, + hid_t dapl_id, hid_t req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_API(NULL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") + if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open dataset") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_read + * + * Purpose: Reads data from dataset through the VOL +* + * Return: Success: Non Negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, void *buf, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_dataset_read(dset, vol_plugin, mem_type_id, mem_space_id, file_space_id, + plist_id, buf, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_write + * + * Purpose: Writes data from dataset through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_dataset_write(dset, vol_plugin, mem_type_id, mem_space_id, file_space_id, + plist_id, buf, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_set_extent + * + * Purpose: Modifies the dimensions of a dataset + * + * Return: Success: Non Negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_set_extent(void *dset, H5VL_t *vol_plugin, const hsize_t size[], hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_dataset_set_extent(dset, vol_plugin, size, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to set extent of dataset") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_set_extent() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_get + * + * Purpose: Get specific information about the dataset through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, hid_t req, ...) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_close + * + * Purpose: Closes a dataset through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_close(void *dset, H5VL_t *vol_plugin, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_dataset_close(dset, vol_plugin, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close dataset") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_create + * + * Purpose: Creates a file through the VOL + * + * Return: Success: pointer to file. + * + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * January, 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5VLfile_create(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id, hid_t req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_API(NULL) + + if(NULL == (ret_value = H5VL_file_create(vol_plugin, name, flags, fcpl_id, fapl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_open + * + * Purpose: Opens a file through the VOL. + * + * Return: Success: pointer to file. + * + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * January, 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5VLfile_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_API(NULL) + + if(NULL == (ret_value = H5VL_file_open(vol_plugin, name, flags, fapl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_flush + * + * Purpose: Flushes a file through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * February, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_flush(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + H5F_scope_t scope, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_file_flush(obj, loc_params, vol_plugin, scope, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to flush file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_flush() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_get + * + * Purpose: Get specific information about the file through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * February, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, hid_t req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_file_get(file, vol_plugin, get_type, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_misc + * + * Purpose: perform a specified operation through the VOL + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_misc(void *file, H5VL_t *vol_plugin, H5VL_file_misc_t misc_type, hid_t req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_file_misc(file, vol_plugin, misc_type, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_misc() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_optional + * + * Purpose: perform a plugin specific operation + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_optional(void *file, H5VL_t *vol_plugin, H5VL_file_optional_t optional_type, hid_t req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLfile_close + * + * Purpose: Closes a file through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * January, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_close(void *file, H5VL_t *vol_plugin, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_file_close(file, vol_plugin, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close file") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_create + * + * Purpose: Creates a group through the VOL + * + * Return: Success: pointer to new group. + * + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, + hid_t gcpl_id, hid_t gapl_id, hid_t req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API(NULL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") + if(NULL == (ret_value = H5VL_group_create(obj, loc_params, vol_plugin, name, + gcpl_id, gapl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_open + * + * Purpose: Opens a group through the VOL + * + * Return: Success: pointer to new group. + * + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, + hid_t gapl_id, hid_t req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_API(NULL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") + if(NULL == (ret_value = H5VL_group_open(obj, loc_params, vol_plugin, name, + gapl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_get + * + * Purpose: Get specific information about the group through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * February, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, hid_t req, ...) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_group_get(obj, vol_plugin, get_type, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get group information") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_close + * + * Purpose: Closes a group through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_close(void *grp, H5VL_t *vol_plugin, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == grp || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_group_close(grp, vol_plugin, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close group") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_create + * + * Purpose: Creates a hard link through the VOL + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, + H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_link_create(create_type, obj, loc_params, vol_plugin, lcpl_id, lapl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to create link") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_move + * + * Purpose: Copy or move a link from src to dst. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, hid_t req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(NULL == src_obj || NULL == dst_obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, vol_plugin, + copy_flag, lcpl_id, lapl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_iterate + * + * Purpose: Iterate over links in a group + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * May, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t H5VLlink_iterate(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + hbool_t recursive, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, + H5L_iterate_t op, void *op_data, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_link_iterate(obj, loc_params, vol_plugin, recursive, idx_type, order, idx, + op, op_data, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Link iteration failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_iterate() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_get + * + * Purpose: Get specific information about the link through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_get_t get_type, + hid_t req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, get_type, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get link information") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_remove + * + * Purpose: Removes a link through the VOL. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +H5_DLL herr_t H5VLlink_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_link_remove(obj, loc_params, vol_plugin, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to remove link") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_remove() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_open + * + * Purpose: Opens a object through the VOL + * + * Return: Success: User ID of the new object. + * + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +void * +H5VLobject_open(void *obj, H5VL_loc_params_t params, H5VL_t *vol_plugin, H5I_type_t *opened_type, + hid_t req) +{ + void *ret_value; /* Return value */ + + FUNC_ENTER_API(NULL) + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") + if(NULL == (ret_value = H5VL_object_open(obj, params, vol_plugin, opened_type, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_copy + * + * Purpose: Copies an object to another destination through the VOL + * + * Return: Success: Non Negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == src_obj || NULL == dst_obj || NULL == vol_plugin1 || + NULL == vol_plugin2 || NULL == vol_plugin1->cls || NULL == vol_plugin2->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_object_copy(src_obj, loc_params1, vol_plugin1, src_name, + dst_obj, loc_params2, vol_plugin2, dst_name, + ocpypl_id, lcpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_visit + * + * Purpose: Iterate over links in a group + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * May, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t H5VLobject_visit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5_index_t idx_type, + H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_object_visit(obj, loc_params, vol_plugin, idx_type, order, + op, op_data, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject_visit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_get + * + * Purpose: Get specific information about the object through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * February, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_get_t get_type, + hid_t req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_misc + * + * Purpose: perform a plugin specific operation + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_misc(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_misc_t misc_type, + hid_t req, ...) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_object_misc(obj, loc_params, vol_plugin, misc_type, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject_misc() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLobject_close + * + * Purpose: Closes a object through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_close(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + + if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if((ret_value = H5VL_object_close(obj, loc_params, vol_plugin, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close object") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject_close() */ diff --git a/src/H5VLint.c b/src/H5VLint.c index 31a0b5a..efc685b 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -426,6 +426,7 @@ H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, co if(NULL == (ret_value = (vol_plugin->cls->attr_cls.create) (obj, loc_params, name, acpl_id, aapl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + vol_plugin->nrefs ++; done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_create() */ @@ -459,6 +460,7 @@ H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, cons if(NULL == (ret_value = (vol_plugin->cls->attr_cls.open) (obj, loc_params, name, aapl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "attribute open failed") + vol_plugin->nrefs ++; done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_open() */ @@ -637,6 +639,15 @@ H5VL_attr_close(void *attr, H5VL_t *vol_plugin, hid_t req) } else if((ret_value = (vol_plugin->cls->attr_cls.close)(attr, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + + vol_plugin->nrefs --; + if (0 == vol_plugin->nrefs) { + if (NULL != vol_plugin->container_name) + H5MM_xfree(vol_plugin->container_name); + if (NULL != vol_plugin) + H5MM_free(vol_plugin); + } + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_close() */ @@ -672,6 +683,7 @@ H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin if(NULL == (ret_value = (vol_plugin->cls->datatype_cls.commit) (obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "commit failed") + vol_plugin->nrefs ++; done: FUNC_LEAVE_NOAPI(ret_value) @@ -717,6 +729,8 @@ H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->datatype_cls.open)(obj, loc_params, name, tapl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + vol_plugin->nrefs ++; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_open() */ @@ -745,10 +759,10 @@ H5VL_datatype_get_binary(void *obj, H5VL_t *vol_plugin, unsigned char *buf, size /* check if the type specific corresponding VOL open callback exists */ if(NULL == vol_plugin->cls->datatype_cls.get_binary) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "no datatype open callback"); + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "no datatype get_binary callback"); /* call the corresponding VOL open callback */ if((ret_value = (vol_plugin->cls->datatype_cls.get_binary)(obj, buf, size, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "get binary failed") done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_get_binary() */ @@ -782,6 +796,14 @@ H5VL_datatype_close(void *dt, H5VL_t *vol_plugin, hid_t req) if((ret_value = (vol_plugin->cls->datatype_cls.close)(dt, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + vol_plugin->nrefs --; + if (0 == vol_plugin->nrefs) { + if (NULL != vol_plugin->container_name) + H5MM_xfree(vol_plugin->container_name); + if (NULL != vol_plugin) + H5MM_free(vol_plugin); + } + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_close() */ @@ -815,6 +837,7 @@ H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, /* call the corresponding VOL create callback */ if(NULL == (ret_value = (vol_plugin->cls->dataset_cls.create)(obj, loc_params, name, dcpl_id, dapl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + vol_plugin->nrefs ++; done: FUNC_LEAVE_NOAPI(ret_value) @@ -856,6 +879,8 @@ H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, c /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->dataset_cls.open)(obj, loc_params, name, dapl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + vol_plugin->nrefs ++; + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1045,6 +1070,14 @@ H5VL_dataset_close(void *dset, H5VL_t *vol_plugin, hid_t req) if((ret_value = (vol_plugin->cls->dataset_cls.close)(dset, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") } + + vol_plugin->nrefs --; + if (0 == vol_plugin->nrefs) { + if (NULL != vol_plugin->container_name) + H5MM_xfree(vol_plugin->container_name); + if (NULL != vol_plugin) + H5MM_free(vol_plugin); + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_close() */ @@ -1065,11 +1098,12 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_file_create(H5VL_t *vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, +H5VL_file_create(H5VL_t **plugin, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t req) { H5P_genplist_t *plist; /* Property list pointer */ H5VL_class_t *vol_cls; /* VOL class attached to fapl_id */ + H5VL_t *vol_plugin = NULL; /* the public VOL struct */ void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1087,7 +1121,13 @@ H5VL_file_create(H5VL_t *vol_plugin, const char *name, unsigned flags, hid_t fcp if(NULL == (ret_value = (vol_cls->file_cls.create)(name, flags, fcpl_id, fapl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + /* Build the vol plugin struct */ + if(NULL == (*plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + vol_plugin = *plugin; vol_plugin->cls = vol_cls; + vol_plugin->nrefs = 1; if((vol_plugin->container_name = H5MM_xstrdup(name)) == NULL) HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,NULL,"memory allocation failed") @@ -1111,10 +1151,11 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_file_open(H5VL_t *vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t req) +H5VL_file_open(H5VL_t **plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t req) { H5P_genplist_t *plist; /* Property list pointer */ H5VL_class_t *vol_cls; /* VOL class attached to fapl_id */ + H5VL_t *vol_plugin = NULL; /* the public VOL struct */ void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1132,7 +1173,13 @@ H5VL_file_open(H5VL_t *vol_plugin, const char *name, unsigned flags, hid_t fapl_ if(NULL == (ret_value = (vol_cls->file_cls.open)(name, flags, fapl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + /* Build the vol plugin struct */ + if(NULL == (*plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + + vol_plugin = *plugin; vol_plugin->cls = vol_cls; + vol_plugin->nrefs = 1; if((vol_plugin->container_name = H5MM_xstrdup(name)) == NULL) HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,NULL,"memory allocation failed") @@ -1324,6 +1371,13 @@ H5VL_file_close(void *file, H5VL_t *vol_plugin, hid_t req) if((ret_value = (vol_plugin->cls->file_cls.close)(file, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed") + vol_plugin->nrefs --; + if (0 == vol_plugin->nrefs) { + if (NULL != vol_plugin->container_name) + H5MM_xfree(vol_plugin->container_name); + if (NULL != vol_plugin) + H5MM_free(vol_plugin); + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_close() */ @@ -1357,6 +1411,7 @@ H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, c /* call the corresponding VOL create callback */ if(NULL == (ret_value = (vol_plugin->cls->group_cls.create)(obj, loc_params, name, gcpl_id, gapl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + vol_plugin->nrefs ++; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1398,6 +1453,7 @@ H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, con /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->group_cls.open)(obj, loc_params, name, gapl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + vol_plugin->nrefs ++; } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1472,6 +1528,15 @@ H5VL_group_close(void *grp, H5VL_t *vol_plugin, hid_t req) if((ret_value = (vol_plugin->cls->group_cls.close)(grp, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") } + + vol_plugin->nrefs --; + if (0 == vol_plugin->nrefs) { + if (NULL != vol_plugin->container_name) + H5MM_xfree(vol_plugin->container_name); + if (NULL != vol_plugin) + H5MM_free(vol_plugin); + } + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_close() */ @@ -1665,10 +1730,10 @@ H5VL_object_open(void *obj, H5VL_loc_params_t params, H5VL_t *vol_plugin, H5I_ty /* check if the corresponding VOL open callback exists */ if(NULL == vol_plugin->cls->object_cls.open) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `object open' method") - /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->object_cls.open)(obj, params, opened_type, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + vol_plugin->nrefs++; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1916,4 +1981,3 @@ H5VL_object_close(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, h done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_close() */ - diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 965b2c6..ee86cd5 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -72,8 +72,8 @@ H5_DLL void *H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t H5_DLL ssize_t H5VL_datatype_get_binary(void *obj, H5VL_t *vol_plugin, unsigned char *buf, size_t size, hid_t req); H5_DLL herr_t H5VL_datatype_close(void *dt, H5VL_t *vol_plugin, hid_t req); -H5_DLL void *H5VL_file_create(H5VL_t *vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t req); -H5_DLL void *H5VL_file_open(H5VL_t *vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t req); +H5_DLL void *H5VL_file_create(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t req); +H5_DLL void *H5VL_file_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t req); H5_DLL herr_t H5VL_file_flush(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5F_scope_t scope, hid_t req); H5_DLL herr_t H5VL_file_misc(void *file, H5VL_t *vol_plugin, H5VL_file_misc_t misc_type, hid_t req, ...); H5_DLL herr_t H5VL_file_optional(void *file, H5VL_t *vol_plugin, H5VL_file_optional_t optional_type, hid_t req, ...); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index bfd9c08..35fee4d 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -309,74 +309,66 @@ struct H5VL_t { int nrefs; /* number of references by objects using this struct */ }; -#if 0 +/* ATTRIBUTE OBJECT ROUTINES */ +H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t req); +H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t aapl_id, hid_t req); +H5_DLL herr_t H5VLattr_read(void *attr, H5VL_t *vol_plugin, hid_t dtype_id, void *buf, hid_t req); +H5_DLL herr_t H5VLattr_write(void *attr, H5VL_t *vol_plugin, hid_t dtype_id, const void *buf, hid_t req); +H5_DLL herr_t H5VLattr_get(void *attr, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, hid_t req, ...); +H5_DLL herr_t H5VLattr_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *attr_name, hid_t req); +H5_DLL herr_t H5VLattr_close(void *attr, H5VL_t *vol_plugin, hid_t req); + +/* DATASE OBJECT ROUTINES */ +H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t req); +H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t dapl_id, hid_t req); +H5_DLL herr_t H5VLdataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, hid_t req); +H5_DLL herr_t H5VLdataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, hid_t req); +H5_DLL herr_t H5VLdataset_set_extent(void *dset, H5VL_t *vol_plugin, const hsize_t size[], hid_t req); +H5_DLL herr_t H5VLdataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, hid_t req, ...); +H5_DLL herr_t H5VLdataset_close(void *dset, H5VL_t *vol_plugin, hid_t req); + +/* DATATYPE OBJECT ROUTINES */ +H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t req); +H5_DLL void *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t tapl_id, hid_t req); +H5_DLL ssize_t H5VLdatatype_get_binary(void *obj, H5VL_t *vol_plugin, unsigned char *buf, size_t size, hid_t req); +H5_DLL herr_t H5VLdatatype_close(void *dt, H5VL_t *vol_plugin, hid_t req); /* FILE OBJECT ROUTINES */ -H5_DLL void *H5VLfile_create(H5VL_t *vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t req); -H5_DLL void *H5VLfile_open(H5VL_t *vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t req); -H5_DLL herr_t H5VLfile_flush(void *file, H5VL_t *vol_plugin, H5F_scope_t scope, hid_t req); +H5_DLL void *H5VLfile_create(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t req); +H5_DLL void *H5VLfile_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t req); +H5_DLL herr_t H5VLfile_flush(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5F_scope_t scope, hid_t req); H5_DLL herr_t H5VLfile_misc(void *file, H5VL_t *vol_plugin, H5VL_file_misc_t misc_type, hid_t req, ...); H5_DLL herr_t H5VLfile_optional(void *file, H5VL_t *vol_plugin, H5VL_file_optional_t optional_type, hid_t req, ...); H5_DLL herr_t H5VLfile_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, hid_t req, ...); H5_DLL herr_t H5VLfile_close(void *file, H5VL_t *vol_plugin, hid_t req); -/* ATTRIBUTE OBJECT ROUTINES */ -H5_DLL void *H5VLattr_create(void *obj, H5VL_t *vol_plugin, const char *attr_name, hid_t acpl, hid_t aapl, hid_t req); -H5_DLL void *H5VLattr_open(void *obj, H5VL_t *vol_plugin, H5VL_loc_params_t loc_params, const char *name, hid_t aapl, hid_t req); -H5_DLL herr_t H5VLattr_read(void *obj, H5VL_t *vol_plugin, hid_t dtype_id, void *buf, hid_t req); -H5_DLL herr_t H5VLattr_write(void *obj, H5VL_t *vol_plugin, hid_t dtype_id, const void *buf, hid_t req); -H5_DLL herr_t H5VLattr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, hid_t req, ...); -H5_DLL herr_t H5VLattr_remove(void *obj, H5VL_t *vol_plugin, H5VL_loc_params_t loc_params, const char *attr_name, hid_t req); -H5_DLL herr_t H5VLattr_close(void *obj, H5VL_t *vol_plugin, hid_t req); - -/* DATASET OBJECT ROUTINES */ -H5_DLL void *H5VLdataset_create(void *obj, H5VL_t *vol_plugin, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t req); -H5_DLL void *H5VLdataset_open(void *obj, H5VL_t *vol_plugin, const char *name, hid_t dapl_id, hid_t req); -H5_DLL herr_t H5VLdataset_read(void *obj, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, hid_t req); -H5_DLL herr_t H5VLdataset_write(void *obj, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, hid_t req); -H5_DLL herr_t H5VLdataset_set_extent(void *obj, H5VL_t *vol_plugin, const hsize_t size[], hid_t req); -H5_DLL herr_t H5VLdataset_get(void *obj, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, hid_t req, ...); -H5_DLL herr_t H5VLdataset_close(void *obj, H5VL_t *vol_plugin, hid_t req); - -/* DATATYPE OBJECT ROUTINES */ -H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_t *vol_plugin, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t req); -H5_DLL size_t H5VLdatatype_get_serial_size(void *obj, H5VL_t *vol_plugin, const char *name, hid_t tapl_id, hid_t req); -H5_DLL void *H5VLdatatype_open(void *obj, H5VL_t *vol_plugin, void *serialized_type, const char *name, hid_t tapl_id, hid_t req); -H5_DLL herr_t H5VLdatatype_close(void *obj, H5VL_t *vol_plugin, hid_t req); - /* GROUP OBJECT ROUTINES */ -H5_DLL H5VL_t *H5VLgroup_create(void *obj, H5VL_t *vol_plugin, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t req); -H5_DLL H5VL_t *H5VLgroup_open(void *obj, H5VL_t *vol_plugin, const char *name, hid_t gapl_id, hid_t req); +H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t req); +H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t gapl_id, hid_t req); +H5_DLL herr_t H5VLgroup_close(void *grp, H5VL_t *vol_plugin, hid_t req); H5_DLL herr_t H5VLgroup_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, hid_t req, ...); -H5_DLL herr_t H5VLgroup_close(void *obj, H5VL_t *vol_plugin, hid_t req); - -/* LINK ROUTINES */ -H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_t *vol_plugin, const char *link_name, hid_t lcpl_id, hid_t lapl_id, hid_t req); -H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_t *src_plugin, const char *src_name, - void *dst_obj, H5VL_t *dst_plugin, const char *dst_name, - hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, hid_t req); -H5_DLL herr_t H5VLlink_iterate(void *obj, H5VL_t *vol_plugin, const char *name, hbool_t recursive, H5_index_t idx_type, - H5_iter_order_t order, hsize_t *idx, H5L_iterate_t op, void *op_data, - hid_t lapl_id); -H5_DLL herr_t H5VLlink_get(void *obj, H5VL_t *vol_plugin, H5VL_link_get_t get_type, hid_t req, ...); -H5_DLL herr_t H5VLlink_remove(void *obj, H5VL_t *vol_plugin, const char *name, void *udata, hid_t lapl_id, hid_t req); -/* OBJECT ROUTINES */ -H5_DLL void *H5VLobject_open(void *obj, H5VL_t *vol_plugin, H5VL_loc_params_t params, hid_t req); -H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_t *src_plugin, const char *src_name, - void *dst_obj, H5VL_t *dst_plugin, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t req); -H5_DLL herr_t H5VLobject_visit(void *obj, H5VL_t *vol_plugin, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id); -H5_DLL herr_t H5VLobject_get(void *obj, H5VL_t *vol_plugin, H5VL_object_get_t get_type, hid_t req, ...); -H5_DLL herr_t H5VLobject_misc(void *obj, H5VL_t *vol_plugin, H5VL_object_misc_t misc_type, hid_t req, ...); -H5_DLL herr_t H5VLobject_optional(void *obj, H5VL_t *vol_plugin, H5VL_object_misc_t optional_type, hid_t req, ...); -H5_DLL herr_t H5VLobject_close(void *obj, H5VL_t *vol_plugin, hid_t req); -/* -H5_DLL herr_t H5VLobject_lookup(void *obj, H5VL_t *vol_plugin, H5VL_loc_type_t lookup_type, void **location, hid_t req, ...); -H5_DLL herr_t H5VLobject_free_loc(void *obj, H5VL_t *vol_plugin, void *location, hid_t req); -*/ +/* LINK OBJECT ROUTINES */ +H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t req); +H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, hid_t req); +H5_DLL herr_t H5VLlink_iterate(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + hbool_t recursive, H5_index_t idx_type, H5_iter_order_t order, + hsize_t *idx, H5L_iterate_t op, void *op_data, hid_t req); +H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_get_t get_type, hid_t req, ...); +H5_DLL herr_t H5VLlink_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t req); -#endif +/* OBJECT ROUTINES */ +H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5I_type_t *opened_type, hid_t req); +H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t req); +H5_DLL herr_t H5VLobject_visit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t req); +H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_get_t get_type, hid_t req, ...); +H5_DLL herr_t H5VLobject_misc(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_misc_t misc_type, hid_t req, ...); +H5_DLL herr_t H5VLobject_optional(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_misc_t optional_type, hid_t req, ...); +H5_DLL herr_t H5VLobject_close(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t req); #ifdef __cplusplus extern "C" { -- cgit v0.12