diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2018-12-18 17:20:07 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2018-12-18 17:20:07 (GMT) |
commit | b55e5efc1c2a4bc4a074921e2130b22be1b564bd (patch) | |
tree | 452ebf0f358b09cf6d6e061854017b251cfe8885 /src/H5Fint.c | |
parent | 55fc5067b66e77bc8b21aa768c4e8fb035cd2bc7 (diff) | |
parent | f0c83dedb64082dcbce3012e99fcb77dc1d96d1b (diff) | |
download | hdf5-b55e5efc1c2a4bc4a074921e2130b22be1b564bd.zip hdf5-b55e5efc1c2a4bc4a074921e2130b22be1b564bd.tar.gz hdf5-b55e5efc1c2a4bc4a074921e2130b22be1b564bd.tar.bz2 |
Merge branch 'develop' into vol_optional_enum_to_macros
Diffstat (limited to 'src/H5Fint.c')
-rw-r--r-- | src/H5Fint.c | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c index bfe1f60..c0a9dc3 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -74,6 +74,7 @@ typedef struct H5F_olist_t { /* Local Prototypes */ /********************/ +static herr_t H5F__set_vol_conn(H5F_t *file, hid_t vol_id, const void *vol_info); static herr_t H5F__get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); 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*/); @@ -115,39 +116,36 @@ H5FL_DEFINE(H5F_file_t); * *------------------------------------------------------------------------- */ -herr_t +static 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 + FUNC_ENTER_STATIC /* 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") + /* Copy connector info, if it exists */ + if(vol_info) { + H5VL_class_t *connector; /* Pointer to connector */ - /* 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 */ + /* 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") - /* 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") + /* 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") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__set_vol_conn() */ @@ -1089,6 +1087,16 @@ H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_ if(H5P_get(plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get object flush cb info") + /* Get the VOL connector info */ + { + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + + if(H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info") + if(H5F__set_vol_conn(f, connector_prop.connector_id, connector_prop.connector_info) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't cache VOL connector info") + } /* end block */ + /* Create a metadata cache with the specified number of elements. * The cache might be created with a different number of elements and * the access property list should be updated to reflect that. |