From 59c28780d35924b6512fe18a0eeb49d55e03f0fc Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 18 Nov 2018 00:38:29 -0600 Subject: Add VOL connector info to the flie access property list returned from H5Fget_access_plist(). Also, other misc. cleanups, etc. --- src/H5F.c | 122 ++++++++++++++++++++------------------- src/H5Fint.c | 164 ++++++++++++++++++++++++++++++++++++++--------------- src/H5Fpkg.h | 22 +++---- src/H5Ofill.c | 4 +- src/H5Pfapl.c | 113 +++--------------------------------- src/H5VLcallback.c | 150 ++++++++++++++++++++++++++++++++++++++++++------ src/H5VLint.c | 103 +++++++++++++++++++++++++++++++-- src/H5VLnative.c | 18 +++++- src/H5VLprivate.h | 22 ++++--- src/H5VLpublic.h | 7 ++- src/H5trace.c | 3 + test/vol.c | 51 +++++++++++++++-- 12 files changed, 511 insertions(+), 268 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index b7fc126..a5017d8 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -43,10 +43,24 @@ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ +/* User data for traversal routine to get ID counts */ +typedef struct { + size_t obj_count; /* Number of objects counted so far */ + unsigned types; /* Types of objects to be counted */ +} H5F_trav_obj_cnt_t; + +/* User data for traversal routine to get ID lists */ +typedef struct { + size_t max_objs; /* Maximum # of IDs to record */ + hid_t *oid_list; /* Array of recorded IDs*/ + size_t obj_count; /* Number of objects counted so far */ +} H5F_trav_obj_ids_t; + /********************/ /* Package Typedefs */ @@ -200,11 +214,11 @@ H5F__close_cb(H5VL_object_t *file_vol_obj) /* Close the file */ if(H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") /* Free the VOL object */ if(H5VL_free_object(file_vol_obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object"); + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") done: FUNC_LEAVE_NOAPI(ret_value) @@ -306,7 +320,7 @@ H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, FUNC_ENTER_STATIC_NOERR - *(udata->obj_count) = *(udata->obj_count) + 1; + udata->obj_count++; FUNC_LEAVE_NOAPI(ret_value) } /* H5F_get_all_count_cb */ @@ -353,36 +367,33 @@ H5Fget_obj_count(hid_t file_id, unsigned types) } /* If we passed in the 'special' ID, get the count for everything open in the * library, iterating over all open files and getting the object count for each. - * - * XXX: Consider making this a helper function in H5I. */ else { H5F_trav_obj_cnt_t udata; - udata.obj_count = &ret_value; + /* Set up callback context */ udata.types = types | H5F_OBJ_LOCAL; + udata.obj_count = 0; - if(types & H5F_OBJ_FILE) { + if(types & H5F_OBJ_FILE) if(H5I_iterate(H5I_FILE, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed"); - } - if(types & H5F_OBJ_DATASET) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed") + if(types & H5F_OBJ_DATASET) if(H5I_iterate(H5I_DATASET, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed"); - } - if(types & H5F_OBJ_GROUP) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed") + if(types & H5F_OBJ_GROUP) if(H5I_iterate(H5I_GROUP, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed"); - } - if(types & H5F_OBJ_DATATYPE) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed") + if(types & H5F_OBJ_DATATYPE) if(H5I_iterate(H5I_DATATYPE, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed"); - } - if(types & H5F_OBJ_ATTR) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed") + if(types & H5F_OBJ_ATTR) if(H5I_iterate(H5I_ATTR, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed"); - } - } + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed") + + /* Set return value */ + ret_value = (ssize_t)udata.obj_count; + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -408,11 +419,12 @@ H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key) FUNC_ENTER_STATIC_NOERR - if(*udata->obj_count >= udata->max_objs) + if(udata->obj_count >= udata->max_objs) HGOTO_DONE(H5_ITER_STOP); - udata->oid_list[*udata->obj_count] = obj_id; - *(udata->obj_count) = *(udata->obj_count) + 1; + /* Add the ID to the array */ + udata->oid_list[udata->obj_count] = obj_id; + udata->obj_count++; done: FUNC_LEAVE_NOAPI(ret_value) @@ -427,6 +439,9 @@ done: * NOTE: Type mismatch - You can ask for more objects than can be * returned. * + * NOTE: Currently, the IDs' ref counts are not incremented. Is this + * intentional and documented? + * * Return: Success: The number of IDs in oid_list * * Failure: -1 @@ -465,7 +480,6 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) /* If we passed in the 'special' ID, get the count for everything open in the * library, iterating over all open files and getting the object count for each. * - * XXX: Consider making this a helper function in H5I. * XXX: Note that the RM states that passing in a negative value for max_objs * gets you all the objects. This technically works, but is clearly wrong * behavior since max_objs is an unsigned type. @@ -473,30 +487,29 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) else { H5F_trav_obj_ids_t udata; + /* Set up callback context */ udata.max_objs = max_objs; udata.oid_list = oid_list; - udata.obj_count = &ret_value; + udata.obj_count = 0; - if(types & H5F_OBJ_FILE) { + if(types & H5F_OBJ_FILE) if(H5I_iterate(H5I_FILE, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed"); - } /* end if */ - if(types & H5F_OBJ_DATASET) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed") + if(types & H5F_OBJ_DATASET) if(H5I_iterate(H5I_DATASET, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed"); - } /* end if */ - if(types & H5F_OBJ_GROUP) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed") + if(types & H5F_OBJ_GROUP) if(H5I_iterate(H5I_GROUP, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed"); - } /* end if */ - if(types & H5F_OBJ_DATATYPE) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed") + if(types & H5F_OBJ_DATATYPE) if(H5I_iterate(H5I_DATATYPE, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed"); - } /* end if */ - if(types & H5F_OBJ_ATTR) { + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed") + if(types & H5F_OBJ_ATTR) if(H5I_iterate(H5I_ATTR, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed"); - } /* end if */ + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed") + + /* Set return value */ + ret_value = (ssize_t)udata.obj_count; } /* end else */ done: @@ -605,11 +618,9 @@ done: hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - void *new_file = NULL; /* file struct for new file */ - + H5F_t *new_file = NULL; /* File struct for new file */ H5P_genplist_t *plist; /* Property list pointer */ - H5VL_class_t *cls = NULL; /* VOL Class structure for callback info */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -645,8 +656,6 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID") /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for @@ -657,7 +666,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; /* Create a new file or truncate an existing file through the VOL */ - if(NULL == (new_file = H5VL_file_create(cls, filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (new_file = (H5F_t *)H5VL_file_create(&connector_prop, filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") /* Get an atom for the file */ @@ -691,11 +700,10 @@ done: hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - void *new_file = NULL; /* file struct for new file */ - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - H5VL_class_t *cls = NULL; /* VOL class structure for callback info */ - hid_t ret_value; /* return value */ + H5F_t *new_file = NULL; /* File struct for new file */ + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -724,11 +732,9 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL connector ID") /* Open the file through the VOL layer */ - if(NULL == (new_file = H5VL_file_open(cls, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if(NULL == (new_file = (H5F_t *)H5VL_file_open(&connector_prop, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") /* Get an ID for the file */ @@ -836,7 +842,7 @@ hid_t H5Freopen(hid_t file_id) { H5VL_object_t *vol_obj = NULL; - void *file; /* File token from VOL connector */ + H5F_t *file = NULL; /* File struct for new file */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) diff --git a/src/H5Fint.c b/src/H5Fint.c index c085e83..9c01c71 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -79,6 +79,7 @@ static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, static int H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out*/); static char *H5F__getenv_prefix_name(char **env_prefix/*in,out*/); +static H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name, char ** /*out*/ actual_name); static herr_t H5F__flush_phase1(H5F_t *f); static herr_t H5F__flush_phase2(H5F_t *f, hbool_t closing); @@ -107,6 +108,53 @@ H5FL_DEFINE(H5F_file_t); /*------------------------------------------------------------------------- + * Function: H5F__set_vol_conn + * + * Purpose: Set the VOL connector ID and info for a file. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info) +{ + void *new_connector_info = NULL; /* Copy of connector info */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(file); + + /* Only cache VOL connector ID & info the first time the file is opened */ + if(file->shared->nrefs == 1) { + /* Copy connector info, if it exists */ + if(vol_info) { + H5VL_class_t *connector; /* Pointer to connector */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(vol_id))) + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Allocate and copy connector info */ + if(H5VL_copy_connector_info(connector, &new_connector_info, vol_info) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed") + } /* end if */ + + /* Cache the connector ID & info for the container */ + file->shared->vol_id = vol_id; + file->shared->vol_info = new_connector_info; + if(H5I_inc_ref(file->shared->vol_id, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__set_vol_conn() */ + + +/*------------------------------------------------------------------------- * Function: H5F_get_access_plist * * Purpose: Returns a copy of the file access property list of the @@ -129,6 +177,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) H5P_genplist_t *old_plist; /* Old property list */ H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ unsigned efc_size = 0; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -141,60 +190,60 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) if(NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") if((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list") if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(ret_value))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") /* Copy properties of the file access property list */ if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(f->shared->rdcc_nslots)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots") if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size") if(H5P_set(new_plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks") if(H5P_set(new_plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold") if(H5P_set(new_plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment") if(H5P_set(new_plist, H5F_ACS_GARBG_COLCT_REF_NAME, &(f->shared->gc_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference") if(H5P_set(new_plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size") if(H5P_set(new_plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size") if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size") if(H5P_set(new_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &f->shared->low_bound) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'low' bound for library format versions") if(H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions") - if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'high' bound for library format versions") + if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->orig_read_attempts)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag") if(H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback") if(f->shared->efc) efc_size = H5F__efc_max_nfiles(f->shared->efc); if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set elink file cache size") if(f->shared->page_buf != NULL) { if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->page_buf->max_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set page buffer size") if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &(f->shared->page_buf->min_meta_perc)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum metadata fraction of page buffer") if(H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &(f->shared->page_buf->min_raw_perc)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set minimum raw data fraction of page buffer") } /* end if */ #ifdef H5_HAVE_PARALLEL if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't set collective metadata read flag") #endif /* H5_HAVE_PARALLEL */ if(H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") /* Prepare the driver property */ driver_prop.driver_id = f->shared->lf->driver_id; @@ -203,13 +252,19 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) /* Set the driver property */ if(H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info") + + /* Set the VOL connector property */ + connector_prop.connector_id = f->shared->vol_id; + connector_prop.connector_info = f->shared->vol_info; + if(H5P_set(new_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector ID & info") /* Set the file close degree appropriately */ if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") done: /* Release the copy of the driver info, if it was set up */ @@ -835,13 +890,13 @@ done: * *------------------------------------------------------------------------- */ -H5F_t * +static H5F_t * H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) { H5F_t *f = NULL; H5F_t *ret_value = NULL; - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC if(NULL == (f = H5FL_CALLOC(H5F_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") @@ -991,8 +1046,9 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ f->shared->use_tmp_space = !H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI); /* Retrieve the # of read attempts here so that sohm in superblock will get the correct # of attempts */ - if(H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &f->shared->read_attempts) < 0) + if(H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &f->shared->orig_read_attempts) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get the # of read attempts") + f->shared->read_attempts = f->shared->orig_read_attempts; /* When opening file with SWMR access, the # of read attempts is H5F_SWMR_METADATA_READ_ATTEMPTS if not set */ /* When opening file without SWMR access, the # of read attempts is always H5F_METADATA_READ_ATTEMPTS (set or not set) */ @@ -1005,12 +1061,12 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ f->shared->feature_flags &= ~(unsigned)H5FD_FEAT_ACCUMULATE_METADATA; if(H5FD_set_feature_flags(f->shared->lf, f->shared->feature_flags) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set feature_flags in VFD") - } + } /* end if */ else { /* If no value for read attempts has been set, use the default */ if(!f->shared->read_attempts) f->shared->read_attempts = H5F_METADATA_READ_ATTEMPTS; - } + } /* end else */ /* Determine the # of bins for metdata read retries */ if(H5F_set_retries(f) < 0) @@ -1296,6 +1352,25 @@ H5F__dest(H5F_t *f, hbool_t flush) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close property list") + /* Clean up the cached VOL connector ID & info */ + if(f->shared->vol_info) { + H5VL_class_t *connector; /* Pointer to connector */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(f->shared->vol_id))) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Free the connector info */ + if(H5VL_free_connector_info(connector, f->shared->vol_info) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + } /* end if */ + if(f->shared->vol_id > 0) + if(H5I_dec_ref(f->shared->vol_id) < 0) + /* Push error, but keep going*/ + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close VOL connector ID") + /* Close the file */ if(H5FD_close(f->shared->lf) < 0) /* Push error, but keep going*/ @@ -1535,7 +1610,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Create the 'top' file structure */ if(NULL == (file = H5F__new(NULL, flags, fcpl_id, fapl_id, lf))) { /* If this is the only time the file has been opened and the struct - * returned is NULL, H5FD_close() will never be called via H5F_dest() + * returned is NULL, H5FD_close() will never be called via H5F__dest() * so we have to close lf here before heading to the error handling. */ if(H5FD_close(lf) < 0) @@ -1634,16 +1709,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) */ if(H5P_get(a_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file close degree") - - /* This is a private property to clear the status_flags in the super block */ - /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */ - if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) { - if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags") - else if(clear) - file->shared->sblock->status_flags = 0; - } /* end if */ - if(shared->nrefs == 1) { if(fc_degree == H5F_CLOSE_DEFAULT) shared->fc_degree = lf->cls->fc_degree; @@ -1657,6 +1722,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match") } /* end if */ + /* This is a private property to clear the status_flags in the super block */ + /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */ + if(H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) { + if(H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags") + else if(clear) + file->shared->sblock->status_flags = 0; + } /* end if */ + /* Record the evict-on-close MDC behavior. If it's the first time opening * the file, set it to access property list value; if it's the second time * or later, verify that the access property list value matches the value @@ -2099,7 +2173,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) /* Delay flush until the shared file struct is closed, in H5F__dest. If the * application called H5Fclose, it would have been flushed in that function - * (unless it will have been flushed in H5F_dest anyways). + * (unless it will have been flushed in H5F__dest anyways). */ /* Destroy the H5F_t struct and decrement the reference count for the @@ -2135,7 +2209,7 @@ done: H5F_t * H5F__reopen(H5F_t *f) { - H5F_t *ret_value = NULL; + H5F_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -2183,7 +2257,7 @@ H5F_get_id(H5F_t *file) else { /* Increment reference count on existing ID */ if(H5I_inc_ref(ret_value, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "incrementing file ID failed") } /* end else */ done: diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 990a6b9..192262c 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -292,7 +292,7 @@ struct H5F_file_t { /* begin on file access/create */ char *mdc_log_location; /* location of mdc log */ hid_t fcpl_id; /* File creation property list ID */ - H5F_close_degree_t fc_degree; /* File close behavior degree */ + H5F_close_degree_t fc_degree; /* File close behavior degree */ hbool_t evict_on_close; /* If the file's objects should be evicted from the metadata cache on close */ size_t rdcc_nslots; /* Size of raw data chunk cache (slots) */ size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */ @@ -310,6 +310,10 @@ struct H5F_file_t { H5FO_t *open_objs; /* Open objects in file */ H5UC_t *grp_btree_shared; /* Ref-counted group B-tree node info */ + /* Cached VOL connector ID & info */ + hid_t vol_id; /* ID of VOL connector for the container */ + void *vol_info; /* Copy of VOL connector info for container */ + /* File space allocation information */ H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */ hsize_t fs_threshold; /* Free space section threshold */ @@ -349,6 +353,7 @@ struct H5F_file_t { /* Metadata retry info */ unsigned read_attempts; /* The # of reads to try when reading metadata with checksum */ + unsigned orig_read_attempts; /* Original value from the property: The # of reads to try when reading metadata with checksum */ unsigned retries_nbins; /* # of bins for each retries[] */ uint32_t *retries[H5AC_NTYPES]; /* Track # of read retries for metdata items with checksum */ @@ -407,19 +412,6 @@ typedef enum H5VL_file_optional_t { H5VL_FILE_SET_LIBVER_BOUNDS } H5VL_file_optional_t; -/* User data for traversal routine to get ID counts */ -typedef struct { - ssize_t *obj_count; /* number of objects counted so far */ - unsigned types; /* types of objects to be counted */ -} H5F_trav_obj_cnt_t; - -/* User data for traversal routine to get ID lists */ -/* XXX (VOL MERGE): Should the type of obj_count and max_objs be identical? */ -typedef struct { - size_t max_objs; - hid_t *oid_list; - ssize_t *obj_count; /* number of objects counted so far */ -} H5F_trav_obj_ids_t; /*****************************/ /* Package Private Variables */ @@ -438,7 +430,6 @@ H5FL_EXTERN(H5F_file_t); /* General routines */ H5_DLL H5F_t *H5F__reopen(H5F_t *f); -H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush); H5_DLL herr_t H5F__flush(H5F_t *f); H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id); @@ -450,6 +441,7 @@ H5_DLL herr_t H5F__close(H5F_t *f); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); H5_DLL H5F_t *H5F__get_file(void *obj, H5I_type_t type); H5_DLL hid_t H5F__get_file_id(H5F_t *file); +H5_DLL herr_t H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info); /* File mount related routines */ H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id); diff --git a/src/H5Ofill.c b/src/H5Ofill.c index adf36b9..125da36 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -347,9 +347,9 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, if(NULL == (dt = (H5T_t *)H5O_msg_read_oh(f, open_oh, H5O_DTYPE_ID, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't read DTYPE message") /* Verify size */ - if(fill->size != H5T_GET_SIZE(dt)) + if(fill->size != (ssize_t)H5T_GET_SIZE(dt)) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "inconsistent fill value size") - } + } /* end if */ if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 820c291..f4dbd0a 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -5125,7 +5125,7 @@ H5Pget_vol_info(hid_t plist_id, void **vol_info) /* Get the connector property */ if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector property") /* Copy connector info, if it exists */ if(connector_prop.connector_info) { @@ -5152,105 +5152,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5P__vol_copy - * - * Purpose: Copy VOL connector ID & info. - * - * Note: This is an "in-place" copy, since this routine gets called - * after the top-level copy has been performed and this routine - * finishes the "deep" part of the copy. - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P__vol_copy(void *value) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - if(value) { - H5VL_connector_prop_t *connector_prop = (H5VL_connector_prop_t *)value; /* connector ID & info struct */ - - /* Copy the connector ID & info, if there is one */ - if(connector_prop->connector_id > 0) { - /* Increment the reference count on connector ID and copy connector info */ - if(H5I_inc_ref(connector_prop->connector_id, FALSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID") - - /* Copy connector info, if it exists */ - if(connector_prop->connector_info) { - H5VL_class_t *connector; /* Pointer to connector */ - void *new_connector_info = NULL; /* Copy of connector info */ - - /* Retrieve the connector for the ID */ - if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") - - /* Allocate and copy connector info */ - if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop->connector_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed") - - /* Set the connector info to the copy */ - connector_prop->connector_info = new_connector_info; - } /* end if */ - } /* end if */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__vol_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__vol_free - * - * Purpose: Free VOL connector ID & info. - * - * Return: Success: Non-negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P__vol_free(void *value) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - if(value) { - H5VL_connector_prop_t *info = (H5VL_connector_prop_t *)value; /* connector ID & info struct */ - - /* Free the connector info (if it exists) and decrement the ID */ - if(info->connector_id > 0) { - if(info->connector_info) { - H5VL_class_t *connector; /* Pointer to connector */ - - /* Retrieve the connector for the ID */ - if(NULL == (connector = (H5VL_class_t *)H5I_object(info->connector_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") - - /* Free the connector info */ - if(H5VL_free_connector_info(connector, (void *)info->connector_info) < 0) /* Casting away const OK - QAK */ - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") - } /* end if */ - - /* Decrement reference count for connector ID */ - if(H5I_dec_ref(info->connector_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID") - } /* end if */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__vol_free() */ - - -/*------------------------------------------------------------------------- * Function: H5P__facc_vol_create * connectorose: Create callback for the VOL connector ID & info property. @@ -5268,7 +5169,7 @@ H5P__facc_vol_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size FUNC_ENTER_STATIC /* Make copy of the VOL connector */ - if(H5P__vol_copy(value) < 0) + if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: @@ -5298,7 +5199,7 @@ H5P__facc_vol_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, HDassert(value); /* Make copy of VOL connector ID & info */ - if(H5P__vol_copy(value) < 0) + if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: @@ -5328,7 +5229,7 @@ H5P__facc_vol_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, HDassert(value); /* Make copy of VOL connector */ - if(H5P__vol_copy(value) < 0) + if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: @@ -5354,7 +5255,7 @@ H5P__facc_vol_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, FUNC_ENTER_STATIC /* Free the VOL connector ID & info */ - if(H5P__vol_free(value) < 0) + if(H5VL_conn_free((H5VL_connector_prop_t *)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector") done: @@ -5380,7 +5281,7 @@ H5P__facc_vol_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, FUNC_ENTER_STATIC /* Make copy of VOL connector */ - if(H5P__vol_copy(value) < 0) + if(H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") done: @@ -5460,7 +5361,7 @@ H5P__facc_vol_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, FUNC_ENTER_STATIC /* Free the VOL connector */ - if(H5P__vol_free(value) < 0) + if(H5VL_conn_free((H5VL_connector_prop_t *)value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector") done: diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 52d1296..e921dea 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -95,6 +95,12 @@ static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__file_cache_connector(void *obj, const H5VL_class_t *cls, + hid_t dxpl_id, void **req, ...); +static void * H5VL__file_create(const H5VL_class_t *cls, const char *name, + unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +static void * H5VL__file_open(const H5VL_class_t *cls, const char *name, + unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, @@ -2463,7 +2469,43 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_file_create + * Function: H5VL__file_cache_connector + * + * Purpose: Wrap varargs and reissue 'cache VOL connector' operation + * to file specific call + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_cache_connector(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, + void **req, ...) +{ + va_list arguments; /* Argument list passed from the API call */ + hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Re-issue call to internal file specific callback routine */ + va_start(arguments, req); + arg_started = TRUE; + if(H5VL__file_specific(obj, cls, H5VL_FILE_CACHE_VOL_CONN, dxpl_id, req, arguments) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + +done: + /* End access to the va_list, if we started it */ + if(arg_started) + va_end(arguments); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_cache_connector() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL__file_create * * Purpose: Creates a file through the VOL * @@ -2475,13 +2517,13 @@ done: * *------------------------------------------------------------------------- */ -void * -H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id, void **req) +static void * +H5VL__file_create(const H5VL_class_t *cls, const char *name, + unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) { - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->file_cls.create) @@ -2493,6 +2535,45 @@ H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_ done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_create + * + * Purpose: Creates a file through the VOL + * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * + * Return: Success: Pointer to new file + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name, + unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL Class structure for callback info */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Get the connector's class */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed") + + /* Cache the connector ID & info */ + if(H5VL__file_cache_connector(ret_value, cls, dxpl_id, req, connector_prop->connector_id, connector_prop->connector_info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "caching VOL connector ID & info failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_create() */ @@ -2529,7 +2610,7 @@ H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create file") done: @@ -2538,25 +2619,22 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_file_open + * Function: H5VL__file_open * * Purpose: Opens a file through the VOL. * - * Note: Does not have a 'static' version of the routine, since there's - * no objects in the container before this operation completes. - * * Return: Success: Pointer to file. * Failure: NULL * *------------------------------------------------------------------------- */ -void * -H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, - hid_t dxpl_id, void **req) +static void * +H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigned flags, + hid_t fapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC /* Check if the corresponding VOL callback exists */ if(NULL == cls->file_cls.open) @@ -2568,6 +2646,45 @@ H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t done: FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_open + * + * Purpose: Opens a file through the VOL. + * + * Note: Does not have a 'static' version of the routine, since there's + * no objects in the container before this operation completes. + * + * Return: Success: Pointer to file. + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name, + unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) +{ + H5VL_class_t *cls; /* VOL Class structure for callback info */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Get the connector's class */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if(NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + + /* Cache the connector ID & info */ + if(H5VL__file_cache_connector(ret_value, cls, dxpl_id, req, connector_prop->connector_id, connector_prop->connector_info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "caching VOL connector ID & info failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_open() */ @@ -2604,7 +2721,7 @@ H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if(NULL == (ret_value = H5VL_file_open(cls, name, flags, fapl_id, dxpl_id, req))) + if(NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open file") done: @@ -2816,7 +2933,6 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t cls = vol_obj->connector->cls; } /* end else */ - /* Call the corresponding internal VOL routine */ if(H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, specific_type, dxpl_id, req, arguments) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") diff --git a/src/H5VLint.c b/src/H5VLint.c index 4590885..167d098 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -225,7 +225,7 @@ H5VL__free_cls(H5VL_class_t *cls) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") /* Release the class */ - H5MM_xfree(cls->name); + H5MM_xfree((void *)cls->name); /* Casting away const OK -QAK */ H5FL_FREE(H5VL_class_t, cls); done: @@ -333,6 +333,99 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_conn_copy + * + * Purpose: Copy VOL connector ID & info. + * + * Note: This is an "in-place" copy. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_conn_copy(H5VL_connector_prop_t *connector_prop) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if(connector_prop) { + /* Copy the connector ID & info, if there is one */ + if(connector_prop->connector_id > 0) { + /* Increment the reference count on connector ID and copy connector info */ + if(H5I_inc_ref(connector_prop->connector_id, FALSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID") + + /* Copy connector info, if it exists */ + if(connector_prop->connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ + void *new_connector_info = NULL; /* Copy of connector info */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Allocate and copy connector info */ + if(H5VL_copy_connector_info(connector, &new_connector_info, connector_prop->connector_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed") + + /* Set the connector info to the copy */ + connector_prop->connector_info = new_connector_info; + } /* end if */ + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_conn_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_conn_free + * + * Purpose: Free VOL connector ID & info. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_conn_free(const H5VL_connector_prop_t *info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if(info) { + /* Free the connector info (if it exists) and decrement the ID */ + if(info->connector_id > 0) { + if(info->connector_info) { + H5VL_class_t *connector; /* Pointer to connector */ + + /* Retrieve the connector for the ID */ + if(NULL == (connector = (H5VL_class_t *)H5I_object(info->connector_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Free the connector info */ + if(H5VL_free_connector_info(connector, (void *)info->connector_info) < 0) /* Casting away const OK - QAK */ + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + } /* end if */ + + /* Decrement reference count for connector ID */ + if(H5I_dec_ref(info->connector_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID") + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_conn_free() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_register * * Purpose: VOL-aware version of H5I_register. Constructs an H5VL_object_t @@ -436,19 +529,19 @@ H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool FUNC_ENTER_NOAPI(FAIL) /* Get the VOL class object from the connector's ID */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID") /* Setup VOL info struct */ - if (NULL == (connector = H5FL_CALLOC(H5VL_t))) + if(NULL == (connector = H5FL_CALLOC(H5VL_t))) HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate VOL info struct") connector->cls = cls; connector->id = connector_id; - if (H5I_inc_ref(connector->id, FALSE) < 0) + if(H5I_inc_ref(connector->id, FALSE) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") /* Get an ID for the VOL object */ - if ((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0) + if((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: diff --git a/src/H5VLnative.c b/src/H5VLnative.c index bf847c5..e506af4 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -1685,13 +1685,13 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, /* Call the flush routine for mounted file hierarchies */ if(H5F_flush_mounts(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") - } + } /* end if */ else { /* Call the flush routine, for this file */ if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") - } - } + } /* end else */ + } /* end if */ break; } @@ -1759,6 +1759,18 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, break; } + /* H5Fcreate / H5Fopen */ + case H5VL_FILE_CACHE_VOL_CONN: + { + hid_t vol_id = va_arg(arguments, hid_t); + void *vol_info = va_arg(arguments, void *); + + /* Call private routine */ + if(H5F__set_vol_conn((H5F_t *)obj, vol_id, vol_info) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cache VOL connector ID & info failed") + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") } /* end switch */ diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 83e9600..6b69d93 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -56,11 +56,8 @@ typedef struct H5VL_connector_prop_t { /* Utility functions */ H5_DLL herr_t H5VL_init(void); H5_DLL int H5VL_cmp_connector_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls); -H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, - const void *src_info); -H5_DLL int H5VL_cmp_connector_info(const H5VL_class_t *connector, const void *info1, - const void *info2); -H5_DLL herr_t H5VL_free_connector_info(const H5VL_class_t *connector, void *info); +H5_DLL herr_t H5VL_conn_copy(H5VL_connector_prop_t *value); +H5_DLL herr_t H5VL_conn_free(const H5VL_connector_prop_t *info); /* Functions that deal with VOL connectors */ H5_DLL hid_t H5VL_register_connector(const void *cls, hbool_t app_ref, hid_t vipl_id); @@ -98,9 +95,16 @@ H5_DLL hid_t H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref); H5_DLL hid_t H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref); H5_DLL herr_t H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ref, hid_t existing_id); -/****************************** +/********************************** * VOL connector callback wrappers - *****************************/ + *********************************/ + +/* Connector "management" functions */ +H5_DLL int H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, + const void *src_info); +H5_DLL int H5VL_cmp_connector_info(const H5VL_class_t *connector, const void *info1, + const void *info2); +H5_DLL herr_t H5VL_free_connector_info(const H5VL_class_t *connector, void *info); /* Attribute functions */ H5_DLL void *H5VL_attr_create(const H5VL_object_t *vol_obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); @@ -123,8 +127,8 @@ H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, H5_DLL herr_t H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* File functions */ -H5_DLL void *H5VL_file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VL_file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_file_open(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req, ...); diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index 7049930..26e841d 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -121,10 +121,11 @@ typedef enum H5VL_file_get_t { /* types for file SPECIFIC callback */ typedef enum H5VL_file_specific_t { H5VL_FILE_FLUSH, /* Flush file */ - H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */ - H5VL_FILE_REOPEN, /* Reopen the file */ + H5VL_FILE_REOPEN, /* Reopen the file */ H5VL_FILE_MOUNT, /* Mount a file */ - H5VL_FILE_UNMOUNT /* Un-Mount a file */ + H5VL_FILE_UNMOUNT, /* Unmount a file */ + H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */ + H5VL_FILE_CACHE_VOL_CONN /* Cache VOL connector ID & info */ } H5VL_file_specific_t; /* types for group GET callback */ diff --git a/src/H5trace.c b/src/H5trace.c index de63c4c..db26d83 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -2743,6 +2743,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_FILE_IS_ACCESSIBLE: HDfprintf(out, "H5VL_FILE_IS_ACCESSIBLE"); break; + case H5VL_FILE_CACHE_VOL_CONN: + HDfprintf(out, "H5VL_FILE_CACHE_VOL_CONN"); + break; default: HDfprintf(out, "%ld", (long)specific); break; diff --git a/test/vol.c b/test/vol.c index d9157cf..38b7e62 100644 --- a/test/vol.c +++ b/test/vol.c @@ -240,6 +240,7 @@ test_basic_file_operation(void) hid_t fid = H5I_INVALID_HID; hid_t fid_reopen = H5I_INVALID_HID; hid_t fapl_id = H5I_INVALID_HID; + hid_t fapl_id2 = H5I_INVALID_HID; hid_t fcpl_id = H5I_INVALID_HID; ssize_t obj_count; @@ -252,8 +253,23 @@ test_basic_file_operation(void) TESTING("Basic VOL file operations"); + /* Retrieve the file access property for testing */ + fapl_id = h5_fileaccess(); + + /* Set the file close degree to a non-default value, to make the H5Pequal + * work out. This is kinda odd, but the library's current behavior with + * a default value is to return the value chosen (H5F_CLOSE_SEMI) instead + * of the default value (H5F_CLOSE_DEFAULT) from the property and then + * the H5Pequal doesn't detect that the property lists are the same. Since + * this is the documented behavior for file close degree for many years, + * I'm not fighting it, just getting the testing to verify that the VOL + * connector property is returned correctly. -QAK, 2018/11/17 + */ + if(H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI) < 0) + TEST_ERROR; + /* H5Fcreate */ - if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if ((fid = H5Fcreate(NATIVE_VOL_TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; /* H5Fget_obj_count */ @@ -271,9 +287,11 @@ test_basic_file_operation(void) TEST_ERROR; /* H5Fget_access_plist */ - if ((fapl_id = H5Fget_access_plist(fid)) < 0) + if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) TEST_ERROR; - if (H5Pclose(fapl_id) < 0) + if (H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if (H5Pclose(fapl_id2) < 0) TEST_ERROR; /* H5Fget_create_plist */ @@ -315,19 +333,41 @@ test_basic_file_operation(void) TEST_ERROR; /* H5Fis_accessible */ - if (H5Fis_accessible(NATIVE_VOL_TEST_FILENAME, H5P_DEFAULT) < 0) + if (H5Fis_accessible(NATIVE_VOL_TEST_FILENAME, fapl_id) < 0) TEST_ERROR; /* H5Fopen */ - if ((fid = H5Fopen(NATIVE_VOL_TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + if ((fid = H5Fopen(NATIVE_VOL_TEST_FILENAME, H5F_ACC_RDWR, fapl_id)) < 0) + TEST_ERROR; + + /* H5Fget_access_plist */ + if ((fapl_id2 = H5Fget_access_plist(fid)) < 0) + TEST_ERROR; + if (H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if (H5Pclose(fapl_id2) < 0) TEST_ERROR; + if ((fid_reopen = H5Freopen(fid)) < 0) TEST_ERROR; + + /* H5Fget_access_plist */ + if ((fapl_id2 = H5Fget_access_plist(fid_reopen)) < 0) + TEST_ERROR; + if (H5Pequal(fapl_id, fapl_id2) != TRUE) + TEST_ERROR; + if (H5Pclose(fapl_id2) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) TEST_ERROR; if (H5Fclose(fid_reopen) < 0) TEST_ERROR; + /* H5Pclose */ + if (H5Pclose(fapl_id) < 0) + TEST_ERROR; + HDremove(NATIVE_VOL_TEST_FILENAME); PASSED(); @@ -338,6 +378,7 @@ error: H5Fclose(fid); H5Fclose(fid_reopen); H5Pclose(fapl_id); + H5Pclose(fapl_id2); H5Pclose(fcpl_id); } H5E_END_TRY; -- cgit v0.12