diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2021-03-15 13:16:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-15 13:16:41 (GMT) |
commit | c193d436f512e73be6569e56bf875bb2673ebdf8 (patch) | |
tree | 612757b041e867107053d03a2eb4ab1a9600bf51 /src/H5Fint.c | |
parent | a09e1ea2191ad0ea2a72f7bd519b2cc95f218328 (diff) | |
download | hdf5-c193d436f512e73be6569e56bf875bb2673ebdf8.zip hdf5-c193d436f512e73be6569e56bf875bb2673ebdf8.tar.gz hdf5-c193d436f512e73be6569e56bf875bb2673ebdf8.tar.bz2 |
Merge H5Fopen VOL auto-detect feature and latest VOL fixes to 1.12 (#395)
* Enable H5Fopen to probe list of available VOL connectors when opening a file
* Unwrap file VOL object when destroying file (#308)
* Check for wrap context before unwrapping file VOL object in H5F__dest (#325)
Diffstat (limited to 'src/H5Fint.c')
-rw-r--r-- | src/H5Fint.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c index a999741..6922948 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -249,7 +249,8 @@ H5F__close_cb(H5VL_object_t *file_vol_obj) 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") - /* Free the VOL object */ + /* Free the VOL object; it is unnecessary to unwrap the VOL + * object before freeing it, as the object was not wrapped */ if (H5VL_free_object(file_vol_obj) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") @@ -1337,6 +1338,8 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F done: if (!ret_value && f) { + HDassert(NULL == f->vol_obj); + if (!shared) { /* Attempt to clean up some of the shared file structures */ if (f->shared->efc) @@ -1349,11 +1352,6 @@ done: f->shared = H5FL_FREE(H5F_shared_t, f->shared); } - /* Free VOL object */ - if (f->vol_obj) - if (H5VL_free_object(f->vol_obj) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "unable to free VOL object") - f = H5FL_FREE(H5F_t, f); } @@ -1620,9 +1618,21 @@ H5F__dest(H5F_t *f, hbool_t flush) /* Free the non-shared part of the file */ f->open_name = (char *)H5MM_xfree(f->open_name); f->actual_name = (char *)H5MM_xfree(f->actual_name); - if (f->vol_obj && H5VL_free_object(f->vol_obj) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") - f->vol_obj = NULL; + if (f->vol_obj) { + void *vol_wrap_ctx = NULL; + + /* If a VOL wrapping context is available, retrieve it + * and unwrap file VOL object + */ + if (H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL object wrap context") + if (vol_wrap_ctx && (NULL == H5VL_object_unwrap(f->vol_obj))) + HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't unwrap VOL object") + + if (H5VL_free_object(f->vol_obj) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") + f->vol_obj = NULL; + } if (H5FO_top_dest(f) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file") f->shared = NULL; |