diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2018-10-25 04:52:47 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2018-10-25 04:52:47 (GMT) |
commit | 0df6e44a6e68da1614cf80b50ed7b208edaa5df7 (patch) | |
tree | f734083b478d38e09b0aecb8e8f3db838cf0b785 /src | |
parent | 1e8ef703cdc057211b3587be776a6e9f62e8f76f (diff) | |
download | hdf5-0df6e44a6e68da1614cf80b50ed7b208edaa5df7.zip hdf5-0df6e44a6e68da1614cf80b50ed7b208edaa5df7.tar.gz hdf5-0df6e44a6e68da1614cf80b50ed7b208edaa5df7.tar.bz2 |
Squashed commit of private branch changes to support stackable VOL plugins.
modified: test/dsets.c
Diffstat (limited to 'src')
56 files changed, 5106 insertions, 3497 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7045012..287292a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -662,6 +662,7 @@ IDE_GENERATED_PROPERTIES ("H5UC" "${H5UC_HDRS}" "${H5UC_SOURCES}" ) set (H5VL_SOURCES ${HDF5_SRC_DIR}/H5VL.c + ${HDF5_SRC_DIR}/H5VLcallback.c ${HDF5_SRC_DIR}/H5VLint.c ${HDF5_SRC_DIR}/H5VLnative.c ) @@ -296,18 +296,18 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, attr_name, + if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->plugin->cls, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -402,18 +402,18 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, attr_name, + if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->plugin->cls, attr_name, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close (attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close (attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -442,7 +442,7 @@ done: hid_t H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { - void *attr = NULL; /* attr token from VOL driver */ + void *attr = NULL; /* attr token from VOL plugin */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; @@ -471,18 +471,18 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name) /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -514,7 +514,7 @@ hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id, hid_t lapl_id) { - void *attr = NULL; /* attr token from VOL driver */ + void *attr = NULL; /* attr token from VOL plugin */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; hid_t ret_value = H5I_INVALID_HID; @@ -554,18 +554,18 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "can't open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close (attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close (attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -646,18 +646,18 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -702,7 +702,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Write the attribute data */ - if((ret_value = H5VL_attr_write(vol_obj->data, vol_obj->driver->cls, + if((ret_value = H5VL_attr_write(vol_obj->data, vol_obj->plugin->cls, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") @@ -745,7 +745,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") /* Read the attribute data */ - if((ret_value = H5VL_attr_read(vol_obj->data, vol_obj->driver->cls, + if((ret_value = H5VL_attr_read(vol_obj->data, vol_obj->plugin->cls, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") @@ -784,7 +784,7 @@ H5Aget_space(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") /* Get the dataspace */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_SPACE, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute") @@ -812,7 +812,8 @@ done: hid_t H5Aget_type(hid_t attr_id) { - H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ + H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -822,12 +823,21 @@ H5Aget_type(hid_t attr_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Get the datatype */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_TYPE, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* H5Aget_type() */ @@ -867,7 +877,7 @@ H5Aget_create_plist(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") /* Get the acpl */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_ACPL, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_ACPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get creation property list for attribute") @@ -918,7 +928,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) loc_params.obj_type = H5I_get_type(attr_id); /* Get the attribute name */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_NAME, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, buf_size, buf, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name") @@ -985,7 +995,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Get the name */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_NAME, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name") @@ -1025,7 +1035,7 @@ H5Aget_storage_size(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute") /* Get the storage size */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_STORAGE_SIZE, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get acpl") @@ -1065,7 +1075,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) loc_params.obj_type = H5I_get_type(attr_id); /* Get the attribute information */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") @@ -1122,7 +1132,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") @@ -1186,7 +1196,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the attribute information */ - if(H5VL_attr_get(vol_obj->data, vol_obj->driver->cls, H5VL_ATTR_GET_INFO, + if(H5VL_attr_get(vol_obj->data, vol_obj->plugin->cls, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") @@ -1238,7 +1248,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") /* Rename the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_RENAME, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_name, new_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } @@ -1299,7 +1309,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Rename the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_RENAME, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, old_attr_name, new_attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } @@ -1356,6 +1366,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1376,13 +1387,22 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Iterate over attributes */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_ITER, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* H5Aiterate2() */ @@ -1437,6 +1457,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1466,13 +1487,22 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Iterate over attributes */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_ITER, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, idx, op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed"); done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* H5Aiterate_by_name() */ @@ -1522,7 +1552,7 @@ H5Adelete(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1581,7 +1611,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1652,7 +1682,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Delete the attribute through the VOL */ - if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_DELETE, + if((ret_value = H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1731,7 +1761,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) loc_params.obj_type = H5I_get_type(obj_id); /* Check if the attribute exists */ - if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_EXISTS, + if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") @@ -1786,7 +1816,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.obj_type = H5I_get_type(loc_id); /* Check existence of attribute */ - if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_ATTR_EXISTS, + if(H5VL_attr_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, attr_name, &ret_value) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index 47983ea..eb4f447 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -156,18 +156,18 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the attribute */ - if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, + if(NULL == (attr = H5VL_attr_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, acpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") /* Register the new attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -222,18 +222,18 @@ H5Aopen_name(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if (NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if (NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if ((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if ((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -291,18 +291,18 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the attribute */ - if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (attr = H5VL_attr_open(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") /* Register the attribute and get an ID for it */ - if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_ATTR, attr, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize attribute handle") done: /* Clean up on failure */ if(H5I_INVALID_HID == ret_value) - if(attr && H5VL_attr_close(attr, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(attr && H5VL_attr_close(attr, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") FUNC_LEAVE_API(ret_value) @@ -346,7 +346,7 @@ H5Aget_num_attrs(hid_t loc_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the number of attributes for the object */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, &oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object") diff --git a/src/H5Aint.c b/src/H5Aint.c index 80a3e98..af5e479 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -43,7 +43,7 @@ #include "H5Opkg.h" /* Object headers */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5VLnative.h" /* Native VOL plugin */ /****************/ @@ -924,7 +924,15 @@ H5A__get_type(H5A_t *attr) * two level IDs, where the VOL object is a copy of the * returned datatype */ - if ((ret_value = H5VL_native_register(H5I_DATATYPE, dt, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") } else { @@ -1156,7 +1164,7 @@ H5A__close_cb(H5VL_object_t *attr_vol_obj) HDassert(attr_vol_obj); /* Close the attribute */ - if((ret_value = H5VL_attr_close(attr_vol_obj->data, attr_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if((ret_value = H5VL_attr_close(attr_vol_obj->data, attr_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute") /* Free the VOL object */ @@ -2648,7 +2656,15 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5 HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object"); /* Get an ID for the object */ - if((obj_loc_id = H5VL_native_register(obj_type, temp_obj, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((obj_loc_id = H5VL_wrap_register(obj_type, temp_obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype"); /* Call internal attribute iteration routine */ @@ -125,7 +125,6 @@ (*head)->ctx.H5_GLUE(PROP_FIELD,_set) = TRUE; \ } /* end if */ \ } -#endif /* H5_HAVE_PARALLEL */ /* Macro for the duplicated code to test and set properties for a property list */ #define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \ @@ -140,6 +139,7 @@ if(H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0) \ HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting filter mask xfer property") \ } /* end if */ +#endif /* H5_HAVE_PARALLEL */ /******************/ @@ -267,6 +267,10 @@ typedef struct H5CX_t { /* Cached LAPL properties */ size_t nlinks; /* Number of soft / UD links to traverse (H5L_ACS_NLINKS_NAME) */ hbool_t nlinks_valid; /* Whether number of soft / UD links to traverse is valid */ + + /* Cached VOL properties */ + void *vol_wrap_ctx; /* VOL plugin's "wrap context" for creating IDs */ + hbool_t vol_wrap_ctx_valid; /* Whether VOL plugin's "wrap context" for creating IDs is valid */ } H5CX_t; /* Typedef for nodes on the API context stack */ @@ -918,6 +922,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5CX_set_vol_wrap_ctx + * + * Purpose: Sets the VOL object wrapping context for an operation. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Quincey Koziol + * October 14, 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_set_vol_wrap_ctx(void *vol_wrap_ctx) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(head && *head); + + /* Set the API context value */ + (*head)->ctx.vol_wrap_ctx = vol_wrap_ctx; + + /* Mark the value as valid */ + (*head)->ctx.vol_wrap_ctx_valid = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_set_vol_wrap_ctx() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_get_dxpl * * Purpose: Retrieves the DXPL ID for the current API call context. @@ -970,6 +1008,42 @@ H5CX_get_lapl(void) /*------------------------------------------------------------------------- + * Function: H5CX_get_vol_wrap_ctx + * + * Purpose: Retrieves the VOL object wrapping context for an operation. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: Quincey Koziol + * October 14, 2018 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_wrap_ctx); + HDassert(head && *head); + + /* Check for value that was set */ + if((*head)->ctx.vol_wrap_ctx_valid) + /* Get the value */ + *vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx; + else + *vol_wrap_ctx = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_vol_wrap_ctx() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_get_tag * * Purpose: Retrieves the object tag for the current API call context. @@ -2501,7 +2575,9 @@ H5CX__pop_common(void) ret_value = (*head); (*head) = (*head)->next; +#ifdef H5_HAVE_PARALLEL done: +#endif /* H5_HAVE_PARALLEL */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX__pop_common() */ diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index 44a4067..57ca5cd 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -63,10 +63,12 @@ H5_DLL void H5CX_set_lapl(hid_t lapl_id); H5_DLL herr_t H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t loc_id, hbool_t is_collective); H5_DLL herr_t H5CX_set_loc(hid_t loc_id); +H5_DLL herr_t H5CX_set_vol_wrap_ctx(void *wrap_ctx); /* "Getter" routines for API context info */ H5_DLL hid_t H5CX_get_dxpl(void); H5_DLL hid_t H5CX_get_lapl(void); +H5_DLL herr_t H5CX_get_vol_wrap_ctx(void **wrap_ctx); H5_DLL haddr_t H5CX_get_tag(void); H5_DLL H5AC_ring_t H5CX_get_ring(void); #ifdef H5_HAVE_PARALLEL @@ -107,6 +107,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist = NULL; /* Property list pointer */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -157,18 +158,27 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Create the dataset */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize dataset handle") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -250,19 +260,19 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, loc_params.obj_type = H5I_get_type(loc_id); /* Create the dataset */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close (dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close (dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -290,6 +300,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) void *dset = NULL; /* dset token from VOL plugin */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -313,18 +324,27 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Open the dataset */ - if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, + if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Register an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ @@ -391,7 +411,7 @@ H5Dget_space(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataspace */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace") @@ -423,7 +443,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* Get dataspace status */ - if((ret_value = H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE_STATUS, + if((ret_value = H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, allocation)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status") @@ -449,6 +469,7 @@ hid_t H5Dget_type(hid_t dset_id) { H5VL_object_t *vol_obj; /* Dataset structure */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -458,12 +479,21 @@ H5Dget_type(hid_t dset_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* get the datatype */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_TYPE, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Dget_type() */ @@ -498,7 +528,7 @@ H5Dget_create_plist(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataset creation property list */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_DCPL, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties") @@ -554,7 +584,7 @@ H5Dget_access_plist(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") /* Get the dataset access property list */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_DAPL, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties") @@ -592,7 +622,7 @@ H5Dget_storage_size(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") /* Get the storage size */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_STORAGE_SIZE, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size") @@ -626,7 +656,7 @@ H5Dget_offset(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") /* Get the offset */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_OFFSET, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset") @@ -840,7 +870,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, vlen_bufsize.mspace_id = H5I_INVALID_HID; /* Get a copy of the dataset's dataspace */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace") @@ -922,7 +952,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Set the extent */ - if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_SET_EXTENT, + if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, size)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent") @@ -961,7 +991,7 @@ H5Dflush(hid_t dset_id) * XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t * callback needs it and that's in the public API. */ - if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_FLUSH, + if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") @@ -997,7 +1027,7 @@ H5Drefresh(hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Refresh the dataset object */ - if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_REFRESH, + if((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_id)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") @@ -1041,7 +1071,7 @@ H5Dformat_convert(hid_t dset_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the dataset */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_FORMAT_CONVERT) < 0) HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format") @@ -1078,7 +1108,7 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL") /* Get the chunk indexing type */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_INDEX_TYPE, idx_type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type") @@ -1120,7 +1150,7 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL") /* Get the dataset creation property list */ - if(H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_DATASET_GET_CHUNK_STORAGE_SIZE, offset, chunk_nbytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 4abba93..4206e23 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -161,17 +161,17 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, dcpl_id, + if(NULL == (dset = H5VL_dataset_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") done: if (H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -221,17 +221,17 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the dataset */ - if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, + if(NULL == (dset = H5VL_dataset_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, H5P_DATASET_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") /* Get an atom for the dataset */ - if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATASET, dset, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset atom") done: if(H5I_INVALID_HID == ret_value) - if(dset && H5VL_dataset_close(dset, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dset && H5VL_dataset_close(dset, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") FUNC_LEAVE_API(ret_value) @@ -275,7 +275,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") /* Get the dataspace pointer for the dataset */ - if(H5VL_dataset_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_GET_SPACE, + if(H5VL_dataset_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace") if(H5I_INVALID_HID == sid) @@ -306,7 +306,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Increase size */ - if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->driver->cls, H5VL_DATASET_SET_EXTENT, + if ((ret_value = H5VL_dataset_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, dset_dims)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset") diff --git a/src/H5Dint.c b/src/H5Dint.c index 3436105..413de33 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -21,17 +21,17 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5FOprivate.h" /* File objects */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5VLprivate.h" /* Virtual Object Layer */ -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VLnative.h" /* Native VOL plugin */ /****************/ @@ -301,7 +301,7 @@ H5D__close_cb(H5VL_object_t *dset_vol_obj) HDassert(dset_vol_obj); /* Close the dataset */ - if(H5VL_dataset_close(dset_vol_obj->data, dset_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_dataset_close(dset_vol_obj->data, dset_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset"); done: @@ -975,7 +975,7 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Get the dataset's datatype */ if(NULL == (dt = (const H5T_t *)H5I_object(type_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") - /* If this is a named datatype, get the pointer via the VOL driver */ + /* If this is a named datatype, get the pointer via the VOL plugin */ type = (const H5T_t *)H5T_get_actual_type(dt); /* Check if the datatype is "sensible" for use in a dataset */ @@ -2460,7 +2460,7 @@ H5D__vlen_get_buf_size(void H5_ATTR_UNUSED *elem, hid_t type_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ - if(H5VL_dataset_read(vol_obj->data, vol_obj->driver->cls, + if(H5VL_dataset_read(vol_obj->data, vol_obj->plugin->cls, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, H5P_DATASET_XFER_DEFAULT, vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) @@ -3402,13 +3402,20 @@ H5D__get_type(const H5D_t *dset) * two-level IDs, where the VOL object is a copy of the * returned datatype. */ - if((ret_value = H5VL_native_register(H5I_DATATYPE, dt, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") - } - else { + } /* end if */ + else if((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") - } done: if(ret_value < 0) diff --git a/src/H5Dio.c b/src/H5Dio.c index b6d4f1b..b30e0c9 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -191,7 +191,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5CX_set_dxpl(dxpl_id); /* Read the data */ - if ((ret_value = H5VL_dataset_read(vol_obj->data, vol_obj->driver->cls, mem_type_id, mem_space_id, + if ((ret_value = H5VL_dataset_read(vol_obj->data, vol_obj->plugin->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") @@ -243,7 +243,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil H5CX_set_dxpl(dxpl_id); /* Read the raw chunk */ - if (H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, dxpl_id, + if (H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_READ, offset, filters, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") @@ -315,7 +315,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5CX_set_dxpl(dxpl_id); /* Write the data */ - if ((ret_value = H5VL_dataset_write(vol_obj->data, vol_obj->driver->cls, mem_type_id, mem_space_id, + if ((ret_value = H5VL_dataset_write(vol_obj->data, vol_obj->plugin->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") @@ -373,7 +373,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of H5CX_set_dxpl(dxpl_id); /* Write chunk */ - if (H5VL_dataset_optional(vol_obj->data, vol_obj->driver->cls, dxpl_id, + if (H5VL_dataset_optional(vol_obj->data, vol_obj->plugin->cls, dxpl_id, H5_REQUEST_NULL, H5VL_DATASET_CHUNK_WRITE, filters, offset, data_size_32, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 89974b2..8af4379 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -2973,6 +2973,7 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) HDassert(dset && *dset); /* Get the native VOL driver's ID */ +/* XXX (VOL MERGE): Need a better solution than this */ if((native_vol_id = H5VL_native_get_driver_id()) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get native VOL driver ID") @@ -199,7 +199,7 @@ H5F__close_cb(H5VL_object_t *file_vol_obj) HDassert(file_vol_obj); /* Close the file */ - if(H5VL_file_close(file_vol_obj->data, file_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_file_close(file_vol_obj->data, file_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); /* Free the VOL object */ @@ -239,7 +239,7 @@ H5Fget_create_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file creation property list */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_FCPL, + if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_FCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties") @@ -280,7 +280,7 @@ H5Fget_access_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Retrieve the file's access property list */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_FAPL, + if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_FAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") @@ -350,7 +350,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id") /* Get the count */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_OBJ_COUNT, + if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_OBJ_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)") } @@ -462,7 +462,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the IDs */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_OBJ_IDS, + if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_OBJ_IDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)") } @@ -536,7 +536,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Retrieve the VFD handle for the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") @@ -614,9 +614,9 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) void *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_t *driver = NULL; /* VOL driver struct */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_class_t *cls = NULL; /* VOL Class structure for callback info */ + H5VL_t *plugin = NULL; /* VOL plugin struct */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -650,10 +650,10 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get vol driver info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL plugin info") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL plugin 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 @@ -668,16 +668,16 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") - /* Setup VOL driver struct */ - if(NULL == (driver = H5FL_CALLOC(H5VL_t))) + /* Setup VOL plugin struct */ + if(NULL == (plugin = H5FL_CALLOC(H5VL_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct") - driver->cls = cls; - driver->id = driver_prop.driver_id; - if(H5I_inc_ref(driver->id, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") + plugin->cls = cls; + plugin->id = plugin_prop.plugin_id; + if(H5I_inc_ref(plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") /* Get an atom for the file */ - if((ret_value = H5VL_register_id(H5I_FILE, new_file, driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_FILE, new_file, plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: @@ -709,9 +709,9 @@ 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_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ H5VL_class_t *cls = NULL; /* VOL class structure for callback info */ - H5VL_t *driver = NULL; /* VOL driver struct */ + H5VL_t *plugin = NULL; /* VOL plugin struct */ hid_t ret_value; /* return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -739,25 +739,25 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) /* Get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL driver info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL driver ID") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL plugin info") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL plugin 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))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") - /* Setup VOL driver struct */ - if(NULL == (driver = H5FL_CALLOC(H5VL_t))) + /* Setup VOL plugin struct */ + if(NULL == (plugin = H5FL_CALLOC(H5VL_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VL info struct") - driver->cls = cls; - driver->id = driver_prop.driver_id; - if(H5I_inc_ref(driver->id, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") + plugin->cls = cls; + plugin->id = plugin_prop.plugin_id; + if(H5I_inc_ref(plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") /* Get an ID for the file */ - if((ret_value = H5VL_register_id(H5I_FILE, new_file, driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_FILE, new_file, plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: @@ -798,7 +798,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Flush the object */ - if(H5VL_file_specific(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_FLUSH, + if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, scope) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") @@ -863,7 +863,7 @@ hid_t H5Freopen(hid_t file_id) { H5VL_object_t *vol_obj = NULL; - void *file; /* File token from VOL driver */ + void *file; /* File token from VOL plugin */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -874,16 +874,16 @@ H5Freopen(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Reopen the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, - H5_REQUEST_NULL, H5VL_FILE_REOPEN, &file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL driver") + if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_REOPEN, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &file) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL plugin") /* Make sure that worked */ if(NULL == file) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file") /* Get an atom for the file */ - if((ret_value = H5VL_register_id(H5I_FILE, file, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_FILE, file, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") done: @@ -919,7 +919,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the flags */ - if((ret_value = H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_INTENT, + if((ret_value = H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, intent_flags)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags") } @@ -954,7 +954,7 @@ H5Fget_freespace(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the amount of free space in the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") @@ -990,7 +990,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the file size */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_SIZE, size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") @@ -1052,7 +1052,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID") /* Get the file image */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") @@ -1093,7 +1093,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the metadata cache configuration */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") @@ -1127,7 +1127,7 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Set the metadata cache configuration */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") @@ -1164,7 +1164,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the current hit rate */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") @@ -1202,7 +1202,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the size data */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_SIZE, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") @@ -1242,7 +1242,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the hit rate statistic */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_MDC_HIT_RATE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") @@ -1292,7 +1292,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") /* Get the filename via the VOL */ - if(H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_GET_NAME, + if(H5VL_file_get(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name") @@ -1338,7 +1338,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Get the file information */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_INFO, type, finfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") @@ -1375,7 +1375,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Get the retry info */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_METADATA_READ_RETRY_INFO, info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info") @@ -1415,7 +1415,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") /* Get the free-space section information in the file */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") @@ -1449,7 +1449,7 @@ H5Fclear_elink_file_cache(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Release the EFC */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_CLEAR_ELINK_CACHE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") @@ -1510,7 +1510,7 @@ H5Fstart_swmr_write(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* start SWMR writing */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_SWMR_WRITE) < 0) HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") @@ -1543,7 +1543,7 @@ H5Fstart_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_START_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") @@ -1577,7 +1577,7 @@ H5Fstop_mdc_logging(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_STOP_MDC_LOGGING) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") @@ -1612,7 +1612,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") /* Call mdc logging function */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_MDC_LOGGING_STATUS, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") @@ -1633,13 +1633,10 @@ done: * *------------------------------------------------------------------------- */ -/* XXX (VOL MERGE): This could go in the native VOL driver under 'optional' - */ herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) { H5VL_object_t *vol_obj; /* File as VOL object */ - H5F_t *f; /* File */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1648,15 +1645,15 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) /* Check args */ if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") - f = (H5F_t *)(vol_obj->data); /* Set up collective metadata if appropriate */ if(H5CX_set_loc(file_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") - /* Call internal set_libver_bounds function */ - if(H5F__set_libver_bounds(f, low, high) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + /* Set the library's version bounds */ + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_SET_LIBVER_BOUNDS, low, high) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") done: FUNC_LEAVE_API(ret_value) @@ -1692,7 +1689,7 @@ H5Fformat_convert(hid_t file_id) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Convert the format */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_FORMAT_CONVERT) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") @@ -1724,7 +1721,7 @@ H5Freset_page_buffering_stats(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Reset the statistics */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_RESET_PAGE_BUFFERING_STATS) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering") @@ -1760,7 +1757,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], unsigned hits[2 HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats") /* Get the statistics */ - if(H5VL_file_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_PAGE_BUFFERING_STATS, accesses, hits, misses, evictions, bypasses) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") @@ -1820,29 +1817,23 @@ done: herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa) { - H5F_t *file; /* File object for file ID */ - haddr_t rel_eoa; /* Relative address of EOA */ + H5VL_object_t *vol_obj; /* File info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*a", file_id, eoa); /* Check args */ - if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") - /* This public routine will work only for drivers with this feature enabled.*/ - /* We might introduce a new feature flag in the future */ - if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") - - /* The real work */ - if(HADDR_UNDEF == (rel_eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed") + /* Only do work if valid pointer to fill in */ + if(eoa) { + /* Retrieve the EOA for the file */ + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_GET_EOA, eoa) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA") + } /* end if */ - /* (Note compensating for base address subtraction in internal routine) */ - if(eoa) - *eoa = rel_eoa + H5FD_get_base_addr(file->shared->lf); done: FUNC_LEAVE_API(ret_value) } /* H5Fget_eoa() */ @@ -1859,30 +1850,19 @@ done: herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment) { - H5F_t *file; /* File object for file ID */ - haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* File info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ih", file_id, increment); /* Check args */ - if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") - /* This public routine will work only for drivers with this feature enabled.*/ - /* We might introduce a new feature flag in the future */ - if(!H5F_HAS_FEATURE(file, H5FD_FEAT_SUPPORTS_SWMR_IO)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") - - /* Get the maximum of EOA and EOF */ - if(H5F__get_max_eof_eoa(file, &max_eof_eoa) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") - - /* Set EOA to the maximum value + increment */ - /* H5FD_set_eoa() will add base_addr to max_eof_eoa */ - if(H5FD_set_eoa(file->shared->lf, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + /* Increment the file size */ + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_FILE_INCR_FILESIZE, increment) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5FDtest.c b/src/H5FDtest.c index 080223c..dec0818 100644 --- a/src/H5FDtest.c +++ b/src/H5FDtest.c @@ -104,11 +104,10 @@ H5FD__supports_swmr_test(const char *vfd_name) FUNC_ENTER_NOAPI_NOINIT_NOERR - if(!vfd_name || !HDstrcmp(vfd_name, "")) + if(!vfd_name || !HDstrcmp(vfd_name, "") || !HDstrcmp(vfd_name, "nomatch")) ret_value = TRUE; else - ret_value = !HDstrcmp(vfd_name, "log") - || !HDstrcmp(vfd_name, "sec2"); + ret_value = !HDstrcmp(vfd_name, "log") || !HDstrcmp(vfd_name, "sec2"); FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Fint.c b/src/H5Fint.c index 230a744..7edd985 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -37,9 +37,8 @@ #include "H5Pprivate.h" /* Property lists */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tprivate.h" /* Datatypes */ -#include "H5VLprivate.h" /* VOL drivers */ - -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5VLprivate.h" /* VOL plugins */ +#include "H5VLnative.h" /* Native VOL plugin */ /****************/ @@ -2167,7 +2166,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5F_get_id(H5F_t *file, hbool_t app_ref) +H5F_get_id(H5F_t *file) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -2177,15 +2176,15 @@ H5F_get_id(H5F_t *file, hbool_t app_ref) if(H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) { /* resurrect the ID - Register an ID with the native driver */ - if((ret_value = H5VL_native_register(H5I_FILE, file, app_ref)) < 0) + if((ret_value = H5VL_native_register(H5I_FILE, file, FALSE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") file->id_exists = TRUE; - } + } /* end if */ else { /* Increment reference count on existing ID */ - if(H5I_inc_ref(ret_value, app_ref) < 0) + if(H5I_inc_ref(ret_value, FALSE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") - } + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -3000,6 +2999,7 @@ H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr) HDassert(f->shared); /* Dispatch to driver */ + /* (H5FD_set_eoa() will add base_addr to addr) */ if(H5FD_set_eoa(f->shared->lf, type, addr) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") @@ -3235,7 +3235,7 @@ H5F__start_swmr_write(H5F_t *f) H5G_name_t *obj_paths = NULL; /* Group hierarchy path */ size_t u; /* Local index variable */ hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */ - H5VL_t *vol_driver = NULL; /* VOL driver for the file */ + H5VL_t *vol_plugin = NULL; /* VOL plugin for the file */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -3299,15 +3299,15 @@ H5F__start_swmr_write(H5F_t *f) if(H5F_get_obj_ids(f, H5F_OBJ_GROUP|H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed") - /* Save the VOL driver for the refresh step */ + /* Save the VOL plugin for the refresh step */ if(grp_dset_count > 0) { H5VL_object_t *vol_obj = NULL; if(NULL == (vol_obj = H5VL_get_object(obj_ids[0]))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - vol_driver = vol_obj->driver; - } + vol_plugin = vol_obj->plugin; + } /* end if */ /* Refresh opened objects (groups, datasets) in the file */ for(u = 0; u < grp_dset_count; u++) { @@ -3370,10 +3370,9 @@ H5F__start_swmr_write(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict file's cached information") /* Refresh (reopen) the objects (groups & datasets) in the file */ - for(u = 0; u < grp_dset_count; u++) { - if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_driver, TRUE) < 0) + for(u = 0; u < grp_dset_count; u++) + if(H5O_refresh_metadata_reopen(obj_ids[u], &obj_glocs[u], vol_plugin, TRUE) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CLOSEERROR, FAIL, "can't refresh-close object") - } /* Unlock the file */ if(H5FD_unlock(f->shared->lf) < 0) @@ -3483,3 +3482,72 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__format_convert() */ + +/*------------------------------------------------------------------------- + * Function: H5F_get_file_id + * + * Purpose: The private version of H5Iget_file_id(), obtains the file + * ID given an object ID. + * + * Return: Success: The file ID associated with the object + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5F_get_file_id(hid_t obj_id, H5I_type_t type) +{ + H5VL_object_t *vol_obj; + void *file = NULL; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_NOAPI(H5I_INVALID_HID) + + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_get_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Get the file through the VOL */ + if(H5VL_file_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, H5VL_FILE_GET_FILE, type, &file) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file") + if(NULL == file) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file through the VOL") + + /* Check if the file's ID already exists */ + if(H5I_find_id(file, H5I_FILE, &ret_value) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") + + /* If the ID does not exist, register it with the VOL plugin */ + if(H5I_INVALID_HID == ret_value) { +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if ((ret_value = H5VL_wrap_register(H5I_FILE, file, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") + } /* end if */ + else { + /* Increment ref count on existing ID */ + if(H5I_inc_ref(ret_value, TRUE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") + } /* end else */ + +done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_get_file_id() */ + diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 310edd4..0e3c06d 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -443,6 +443,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) H5VL_object_t *child_vol_obj = NULL; /* Child object */ H5I_type_t loc_type; /* ID type of location */ H5I_type_t child_type; /* ID type of child */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -478,15 +479,24 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object") /* Check if both objects are associated with the same VOL plugin */ - if(loc_vol_obj->driver->cls->value != child_vol_obj->driver->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL driver") + if(loc_vol_obj->plugin->cls->value != child_vol_obj->plugin->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL plugin") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(loc_vol_obj->data, loc_vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; /* Perform the mount operation */ - if(H5VL_file_specific(loc_vol_obj->data, loc_vol_obj->driver->cls, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, + if(H5VL_file_specific(loc_vol_obj->data, loc_vol_obj->plugin->cls, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name, child_vol_obj->data, plist_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Fmount() */ @@ -512,6 +522,7 @@ H5Funmount(hid_t loc_id, const char *name) { H5VL_object_t *vol_obj = NULL; /* Parent object */ H5I_type_t loc_type; /* ID type of location */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -534,12 +545,21 @@ H5Funmount(hid_t loc_id, const char *name) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Perform the unmount operation */ - if(H5VL_file_specific(vol_obj->data, vol_obj->driver->cls, H5VL_FILE_UNMOUNT, + if(H5VL_file_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_type, name) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Funmount() */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index e97144f..7f67226 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -385,12 +385,12 @@ typedef enum H5VL_file_optional_t { H5VL_FILE_GET_FREE_SECTIONS, /* file free selections */ H5VL_FILE_GET_FREE_SPACE, /* file freespace */ H5VL_FILE_GET_INFO, /* file info */ - H5VL_FILE_GET_MDC_CONF, /* file metadata cache configuration */ - H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */ + H5VL_FILE_GET_MDC_CONF, /* file metadata cache configuration */ + H5VL_FILE_GET_MDC_HR, /* file metadata cache hit rate */ H5VL_FILE_GET_MDC_SIZE, /* file metadata cache size */ H5VL_FILE_GET_SIZE, /* file size */ H5VL_FILE_GET_VFD_HANDLE, /* file VFD handle */ - H5VL_FILE_REOPEN, /* reopen the file */ + H5VL_FILE_GET_FILE, /* retrieve or resurrect file of object */ H5VL_FILE_RESET_MDC_HIT_RATE, /* get metadata cache hit rate */ H5VL_FILE_SET_MDC_CONFIG, /* set metadata cache configuration */ H5VL_FILE_GET_METADATA_READ_RETRY_INFO, @@ -398,12 +398,13 @@ typedef enum H5VL_file_optional_t { H5VL_FILE_START_MDC_LOGGING, H5VL_FILE_STOP_MDC_LOGGING, H5VL_FILE_GET_MDC_LOGGING_STATUS, - H5VL_FILE_SET_LATEST_FORMAT, H5VL_FILE_FORMAT_CONVERT, H5VL_FILE_RESET_PAGE_BUFFERING_STATS, H5VL_FILE_GET_PAGE_BUFFERING_STATS, - H5VL_FILE_GET_MDC_IMAGE_INFO - + H5VL_FILE_GET_MDC_IMAGE_INFO, + H5VL_FILE_GET_EOA, + H5VL_FILE_INCR_FILESIZE, + H5VL_FILE_SET_LIBVER_BOUNDS } H5VL_file_optional_t; /* User data for traversal routine to get ID counts */ @@ -506,6 +507,7 @@ H5_DLL herr_t H5F__get_sohm_mesg_count_test(hid_t fid, unsigned type_id, size_t H5_DLL herr_t H5F__check_cached_stab_test(hid_t file_id); H5_DLL herr_t H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr); H5_DLL herr_t H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr); +H5_DLL htri_t H5F__same_file_test(hid_t file_id1, hid_t file_id2); #endif /* H5F_TESTING */ #endif /* _H5Fpkg_H */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 6595677..b611f44 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -716,6 +716,7 @@ typedef enum H5F_prefix_open_t { /* Private functions */ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/); +H5_DLL hid_t H5F_get_file_id(hid_t obj_id, H5I_type_t id_type); /* Functions that retrieve values from the file struct */ H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f); @@ -734,7 +735,7 @@ H5_DLL H5F_t *H5F_get_parent(const H5F_t *f); H5_DLL unsigned H5F_get_nmounts(const H5F_t *f); H5_DLL unsigned H5F_get_read_attempts(const H5F_t *f); H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref); -H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref); +H5_DLL hid_t H5F_get_id(H5F_t *file); H5_DLL herr_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_id_count_ptr); H5_DLL herr_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list, hbool_t app_ref, size_t *obj_id_count_ptr); H5_DLL hsize_t H5F_get_pgend_meta_thres(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index b036974..3147e95 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -904,7 +904,7 @@ H5F_get_eoa(const H5F_t *f, H5FD_mem_t type) /* Dispatch to driver */ if(HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Ftest.c b/src/H5Ftest.c index 1183284..49a2a22 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -233,3 +233,37 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__get_sbe_addr_test() */ + +/*------------------------------------------------------------------------- + * Function: H5F__same_file_test + * + * Purpose: Check if two file IDs refer to the same underlying file. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Oct 13, 2018 + * + *------------------------------------------------------------------------- + */ +htri_t +H5F__same_file_test(hid_t file_id1, hid_t file_id2) +{ + H5F_t *file1, *file2; /* File info */ + htri_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments */ + if(NULL == (file1 = (H5F_t *)H5VL_object_verify(file_id1, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + if(NULL == (file2 = (H5F_t *)H5VL_object_verify(file_id2, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + + /* If they are using the same underlying "shared" file struct, they are the same file */ + ret_value = (file1->shared == file2->shared); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__same_file_test() */ + @@ -278,7 +278,7 @@ H5G__close_cb(H5VL_object_t *grp_vol_obj) HDassert(grp_vol_obj); /* Close the group */ - if(H5VL_group_close(grp_vol_obj->data, grp_vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(H5VL_group_close(grp_vol_obj->data, grp_vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group") /* Free the VOL object */ @@ -321,6 +321,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -364,18 +365,27 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, + if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -445,18 +455,18 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, NULL, + if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize group handle") done: /* Cleanup on failure */ if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -484,6 +494,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) void *grp = NULL; /* Group opened */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -506,17 +517,27 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) /* Open the group */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); - if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls, + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Register an ID for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -550,7 +571,7 @@ H5Gget_create_plist(hid_t group_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID") /* Get the group creation property list for the group */ - if(H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_GCPL, + if(H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_GCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") @@ -593,7 +614,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info) /* Retrieve the group's information */ loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = id_type; - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO, + if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") @@ -646,7 +667,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO, + if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") @@ -707,7 +728,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Retrieve the group's information */ - if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_GET_INFO, + if((ret_value = H5VL_group_get(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, loc_params, group_info)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") @@ -779,7 +800,7 @@ H5Gflush(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Flush group's metadata to file */ - if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_FLUSH, + if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") @@ -818,7 +839,7 @@ H5Grefresh(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") /* Refresh group's metadata */ - if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->driver->cls, H5VL_GROUP_REFRESH, + if((ret_value = H5VL_group_specific(vol_obj->data, vol_obj->plugin->cls, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index ab73e7e..80f91a1 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -235,12 +235,12 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Create the group */ - if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->driver->cls, name, tmp_gcpl, + if(NULL == (grp = H5VL_group_create(vol_obj->data, loc_params, vol_obj->plugin->cls, name, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") /* Get an atom for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: @@ -249,7 +249,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list") if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -297,17 +297,17 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the group */ - if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->driver->cls, name, H5P_DEFAULT, + if(NULL == (grp = H5VL_group_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") /* Get an atom for the group */ - if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_GROUP, grp, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") done: if(H5I_INVALID_HID == ret_value) - if(grp && H5VL_group_close(grp, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(grp && H5VL_group_close(grp, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -372,7 +372,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target loc params") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_obj->driver->cls, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_obj->plugin->cls, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } @@ -394,7 +394,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } @@ -469,7 +469,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target name") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, vol_obj2->driver->cls, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, vol_obj2->plugin->cls, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } @@ -496,7 +496,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for target name") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } @@ -544,7 +544,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Move the link */ - if((ret_value = H5VL_link_move(vol_obj->data, loc_params1, NULL, loc_params2, vol_obj->driver->cls, + if((ret_value = H5VL_link_move(vol_obj->data, loc_params1, NULL, loc_params2, vol_obj->plugin->cls, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") @@ -601,7 +601,7 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Move the link */ if((ret_value = H5VL_link_move(vol_obj1->data, loc_params1, vol_obj2->data, loc_params2, - vol_obj1->driver->cls, H5P_DEFAULT, H5P_DEFAULT, + vol_obj1->plugin->cls, H5P_DEFAULT, H5P_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") @@ -645,7 +645,7 @@ H5Gunlink(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Delete the link */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE, + if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") @@ -690,7 +690,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if((ret_value = H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL, + if((ret_value = H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value") @@ -825,8 +825,10 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, { H5G_loc_t loc; /* Location of object */ H5G_link_iterate_t lnk_op; /* Link operator */ + H5VL_object_t *vol_obj; hsize_t last_obj; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -850,6 +852,15 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_type = H5G_LINK_OP_OLD; lnk_op.op_func.op_old = op; + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, (-1), "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Call private function */ if((ret_value = H5G_iterate(&loc, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") @@ -859,6 +870,10 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, *idx_p = (int)last_obj; done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Giterate() */ diff --git a/src/H5Gint.c b/src/H5Gint.c index 88ef82b..ef5007f 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -808,7 +808,15 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, */ if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((gid = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") /* Set up user data for callback */ @@ -1069,8 +1077,16 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, if(NULL == (grp = H5G__open_name(loc, group_name))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} /* Register an ID for the starting group */ - if((gid = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) + if((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") /* Get the location of the starting group */ diff --git a/src/H5Gname.c b/src/H5Gname.c index b6b0c20..f6ddeeb 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -584,21 +584,9 @@ H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size, *cached = TRUE; } /* end if */ else if(!loc->path->obj_hidden) { - hid_t file; - - /* Retrieve file ID for name search */ - if((file = H5F_get_id(loc->oloc->file, FALSE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get file ID") - /* Search for name of object */ - if((len = H5G_get_name_by_addr(file, loc->oloc, name, size)) < 0) { - H5I_dec_ref(file); + if((len = H5G_get_name_by_addr(loc->oloc->file, loc->oloc, name, size)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name") - } /* end if */ - - /* Close file ID used for search */ - if(H5I_dec_ref(file) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCLOSEFILE, FAIL, "can't determine name") /* Indicate that the name is _not_ cached, if requested */ /* (Currently only used for testing - QAK, 2010/07/26) */ @@ -1282,8 +1270,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, - char *name, size_t size) +H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size) { H5G_gnba_iter_t udata; /* User data for iteration */ H5G_loc_t root_loc; /* Root group's location */ @@ -1296,8 +1283,8 @@ H5G_get_name_by_addr(hid_t file, const H5O_loc_t *loc, FUNC_ENTER_NOAPI((-1)) - /* Construct the link info for the file's root group */ - if(H5G_loc(file, &root_loc) < 0) + /* Construct a group location for root group of the file */ + if(H5G_root_loc(f, &root_loc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get root group's location") /* Check for root group being the object looked for */ diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index f4f04bc..dc8146c 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -261,7 +261,7 @@ H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_dept H5_DLL herr_t H5G_name_free(H5G_name_t *name); H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name/*out*/, size_t size, hbool_t *cached); -H5_DLL ssize_t H5G_get_name_by_addr(hid_t fid, const struct H5O_loc_t *loc, +H5_DLL ssize_t H5G_get_name_by_addr(H5F_t *f, const struct H5O_loc_t *loc, char* name, size_t size); H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name); diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index a103f53..6ac74b0 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -198,7 +198,15 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, /* Create a group ID to pass to the user-defined callback */ if(NULL == (grp = H5G_open(&grp_loc_copy))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((cur_grp = H5VL_native_register(H5I_GROUP, grp, FALSE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((cur_grp = H5VL_wrap_register(H5I_GROUP, grp, FALSE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") /* User-defined callback function */ @@ -33,8 +33,9 @@ #include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ #include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Gprivate.h" /* Groups */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -130,6 +131,7 @@ H5FL_DEFINE_STATIC(H5I_class_t); H5FL_EXTERN(H5VL_object_t); /*--------------------- Local function prototypes ---------------------------*/ +static void *H5I__unwrap(void *obj_ptr, H5I_type_t type); static htri_t H5I__clear_type_cb(void *_id, void *key, void *udata); static int H5I__destroy_type(H5I_type_t type); static void *H5I__remove_verify(hid_t id, H5I_type_t id_type); @@ -139,7 +141,6 @@ static int H5I__get_type_ref(H5I_type_t type); static int H5I__search_cb(void *obj, hid_t id, void *_udata); static H5I_id_info_t *H5I__find_id(hid_t id); static int H5I__iterate_pub_cb(void *obj, hid_t id, void *udata); -static hid_t H5I__get_file_id(hid_t obj_id, H5I_type_t id_type); static int H5I__find_id_cb(void *_item, void *_key, void *_udata); static int H5I__id_dump_cb(void *_item, void *_key, void *_udata); @@ -452,6 +453,51 @@ done: /*------------------------------------------------------------------------- + * Function: H5I__unwrap + * + * Purpose: Unwraps the object pointer for the 'item' that corresponds + * to an ID. + * + * Return: Pointer to the unwrapped pointer (can't fail) + * + * Programmer: Quincey Koziol + * Friday, October 19, 2018 + * + *------------------------------------------------------------------------- + */ +static void * +H5I__unwrap(void *obj_ptr, H5I_type_t type) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(obj_ptr); + + /* The stored object pointer might be an H5VL_object_t, in which + * case we'll need to get the wrapped object struct (H5F_t *, etc.). + */ + if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { + const H5VL_object_t *vol_obj; + + vol_obj = (const H5VL_object_t *)obj_ptr; + ret_value = H5VL_object_data(vol_obj); + } /* end if */ + else if(H5I_DATATYPE == type) { + const H5T_t *dt; + + dt = (const H5T_t *)obj_ptr; + ret_value = (void *)H5T_get_actual_type(dt); + } /* end if */ + else + ret_value = obj_ptr; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5I__unwrap() */ + + +/*------------------------------------------------------------------------- * Function: H5Iclear_type * * Purpose: Removes all objects from the type, calling the free @@ -547,6 +593,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) FUNC_ENTER_STATIC_NOERR + /* Sanity checks */ HDassert(id); HDassert(udata); HDassert(udata->type_ptr); @@ -556,8 +603,7 @@ H5I__clear_type_cb(void *_id, void H5_ATTR_UNUSED *key, void *_udata) */ if(udata->force || (id->count - (!udata->app_ref * id->app_count)) <= 1) { /* Check for a 'free' function and call it, if it exists */ - /* (Casting away const OK -QAK) */ - if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { + if(udata->type_ptr->cls->free_func && (udata->type_ptr->cls->free_func)((void *)id->obj_ptr) < 0) { /* (Casting away const OK -QAK) */ if(udata->force) { #ifdef H5I_DEBUG if(H5DEBUG(I)) { @@ -778,7 +824,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref, hid_t id) +H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref, hid_t id) { H5VL_object_t *new_vol_obj = NULL; /* pointer to new VOL object */ H5I_id_type_t *type_ptr; /* ptr to the type */ @@ -789,7 +835,7 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t /* Check arguments */ HDassert(object); - HDassert(vol_driver); + HDassert(vol_plugin); /* Make sure ID is not already in use */ if(NULL != (id_ptr = H5I__find_id(id))) @@ -816,11 +862,11 @@ H5I_register_with_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t /* Set up the new VOL object */ if(NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_ATOM, H5E_CANTALLOC, FAIL, "can't allocate memory for VOL object"); - new_vol_obj->driver = vol_driver; + new_vol_obj->plugin = vol_plugin; new_vol_obj->data = object; - /* Bump the reference count on the VOL driver */ - vol_driver->nrefs++; + /* Bump the reference count on the VOL plugin */ + vol_plugin->nrefs++; /* Create the struct & insert requested ID */ id_ptr->id = id; @@ -1996,16 +2042,7 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) /* The stored object pointer might be an H5VL_object_t, in which * case we'll need to get the wrapped object struct (H5F_t *, etc.). */ - if(H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - obj_ptr = vol_obj->data; - } - else if(H5I_DATATYPE == type) { - const H5T_t *dt = (const H5T_t *)item->obj_ptr; - obj_ptr = (void *)H5T_get_actual_type(dt); - } - else - obj_ptr = item->obj_ptr; + obj_ptr = H5I__unwrap(item->obj_ptr, type); /* Invoke callback function */ cb_ret_val = (*udata->user_func)((void *)obj_ptr, item->id, udata->user_udata); /* (Casting away const OK) */ @@ -2127,7 +2164,7 @@ done: * * Failure: -1 * - * NOTE: Not safe for arbitrary VOL drivers as it relies on + * NOTE: Not safe for arbitrary VOL plugins as it relies on * private H5G calls. * * Comments: Public function @@ -2145,7 +2182,9 @@ done: ssize_t H5Iget_name(hid_t id, char *name/*out*/, size_t size) { + H5VL_object_t *vol_obj; H5G_loc_t loc; /* Object location */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) @@ -2155,11 +2194,24 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) if(H5G_loc(id, &loc) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") + /* Get the object pointer */ + if(NULL == (vol_obj = H5VL_get_object(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADTYPE, (-1), "invalid identifier") + + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, (-1), "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Retrieve object's name */ if((ret_value = H5G_get_name(&loc, name, size, NULL)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_ATOM, H5E_CANTSET, (-1), "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Iget_name() */ @@ -2190,9 +2242,9 @@ H5Iget_file_id(hid_t obj_id) /* Call internal function */ if (H5I_FILE == type || H5I_DATATYPE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - if ((ret_value = H5I__get_file_id(obj_id, type)) < 0) + if ((ret_value = H5F_get_file_id(obj_id, type)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") - } + } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "not an ID of a file object") @@ -2202,56 +2254,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5I__get_file_id - * - * Purpose: The private version of H5Iget_file_id(), obtains the file - * ID given an object ID. - * - * Return: Success: The file ID associated with the object - * Failure: H5I_INVALID_HID - * - *------------------------------------------------------------------------- - */ -static hid_t -H5I__get_file_id(hid_t obj_id, H5I_type_t type) -{ - H5VL_object_t *vol_obj = NULL; - void *file = NULL; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ - - FUNC_ENTER_STATIC - - /* Get the object pointer */ - if (NULL == (vol_obj = H5VL_get_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid identifier") - - /* Get the file through the VOL */ - if (H5VL_file_get(vol_obj->data, vol_obj->driver->cls, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type, &file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get file") - if (NULL == file) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the file through the VOL") - - /* Check if the file's ID already exists */ - if (H5I_find_id(file, H5I_FILE, &ret_value) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") - - /* If the ID does not exist, register it with the VOL driver */ - if (H5I_INVALID_HID == ret_value) { - if ((ret_value = H5VL_register_id(H5I_FILE, file, vol_obj->driver, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize file handle") - } - else { - /* Increment ref count on existing ID */ - if (H5I_inc_ref(ret_value, TRUE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I__get_file_id() */ - - -/*------------------------------------------------------------------------- * Function: H5I__find_id_cb * * Purpose: Callback for searching for an ID with a specific pointer @@ -2276,23 +2278,14 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) HDassert(item); HDassert(udata); - /* Get a pointer to the VOL driver's data */ - if (H5I_FILE == type || H5I_GROUP == type || H5I_DATASET == type || H5I_ATTR == type) { - const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - obj_ptr = vol_obj->data; - } - else if (H5I_DATATYPE == type) { - const H5T_t *dt = (const H5T_t *)item->obj_ptr; - obj_ptr = (void *)H5T_get_actual_type(dt); - } - else - obj_ptr = item->obj_ptr; + /* Get a pointer to the VOL plugin's data */ + obj_ptr = H5I__unwrap(item->obj_ptr, type); /* Check for a match */ if (obj_ptr == udata->object) { udata->ret_id = item->id; ret_value = H5_ITER_STOP; - } + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__find_id_cb() */ @@ -2340,7 +2333,7 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id) HGOTO_ERROR(H5E_ATOM, H5E_BADITER, FAIL, "iteration failed") *id = udata.ret_id; - } + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -2362,7 +2355,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */ H5I_type_t type = *(H5I_type_t *)_udata; /* User data */ H5G_name_t *path = NULL; /* Path to file object */ - const void *obj_ptr = NULL; /* Pointer to VOL driver object */ + const void *obj_ptr = NULL; /* Pointer to VOL plugin object */ FUNC_ENTER_STATIC_NOERR @@ -2376,22 +2369,24 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) { const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - obj_ptr = vol_obj->data; + obj_ptr = H5VL_object_data(vol_obj); - if(H5_VOL_NATIVE == vol_obj->driver->cls->value) + if(H5_VOL_NATIVE == vol_obj->plugin->cls->value) path = H5G_nameof((H5G_t *)obj_ptr); break; } + case H5I_DATASET: { const H5VL_object_t *vol_obj = (const H5VL_object_t *)item->obj_ptr; - obj_ptr = vol_obj->data; + obj_ptr = H5VL_object_data(vol_obj); - if(H5_VOL_NATIVE == vol_obj->driver->cls->value) + if(H5_VOL_NATIVE == vol_obj->plugin->cls->value) path = H5D_nameof((H5D_t *)obj_ptr); break; } + case H5I_DATATYPE: { const H5T_t *dt = (const H5T_t *)item->obj_ptr; @@ -2401,6 +2396,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) path = H5T_nameof((H5T_t *)obj_ptr); break; } + case H5I_UNINIT: case H5I_BADID: case H5I_FILE: @@ -279,6 +279,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5VL_loc_params_t loc_params1; H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ H5VL_loc_params_t loc_params2; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -316,31 +317,42 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; loc_params2.obj_type = H5I_get_type(dst_loc_id); - if (H5L_SAME_LOC != src_loc_id) { + if (H5L_SAME_LOC != src_loc_id) /* Get the location object */ if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if (H5L_SAME_LOC != dst_loc_id) { + if (H5L_SAME_LOC != dst_loc_id) /* Get the location object */ if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - /* Make sure that the VOL drivers are the same */ - if (vol_obj1 && vol_obj2) { - if (vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) + /* Make sure that the VOL plugins are the same */ + if (vol_obj1 && vol_obj2) + if (vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + + /* Set wrapper info in API context */ + { + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + + vol_obj = (vol_obj1 ? vol_obj1 : vol_obj2); + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; } /* Move the link */ if (H5VL_link_move((vol_obj1 ? vol_obj1->data : NULL), loc_params1, (vol_obj2 ? vol_obj2->data : NULL), loc_params2, - (vol_obj1 ? vol_obj1->driver->cls : vol_obj2->driver->cls), + (vol_obj1 ? vol_obj1->plugin->cls : vol_obj2->plugin->cls), lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lmove() */ @@ -367,6 +379,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5VL_loc_params_t loc_params1; H5VL_object_t *vol_obj2 = NULL; /* Object token of dst_id */ H5VL_loc_params_t loc_params2; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -405,31 +418,42 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; loc_params2.obj_type = H5I_get_type(dst_loc_id); - if(H5L_SAME_LOC != src_loc_id) { + if(H5L_SAME_LOC != src_loc_id) /* Get the location object */ if(NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if(H5L_SAME_LOC != dst_loc_id) { + if(H5L_SAME_LOC != dst_loc_id) /* Get the location object */ if(NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } /* Make sure that the VOL plugins are the same */ - if(vol_obj1 && vol_obj2) { - if(vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) + if(vol_obj1 && vol_obj2) + if(vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + + /* Set wrapper info in API context */ + { + H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ + + vol_obj = (vol_obj1 ? vol_obj1 : vol_obj2); + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; } /* Copy the link */ if(H5VL_link_copy((vol_obj1 ? vol_obj1->data : NULL), loc_params1, (vol_obj2 ? vol_obj2->data : NULL), loc_params2, - (vol_obj1 ? vol_obj1->driver->cls : vol_obj2->driver->cls), + (vol_obj1 ? vol_obj1->plugin->cls : vol_obj2->plugin->cls), lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lcopy() */ @@ -459,6 +483,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist = NULL; /* Property list pointer */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -504,12 +529,21 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Create the link */ - if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->driver->cls, + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_soft() */ @@ -578,22 +612,19 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, loc_params2.loc_data.loc_by_name.name = new_name; loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; - if(H5L_SAME_LOC != cur_loc_id) { + if(H5L_SAME_LOC != cur_loc_id) /* Get the current location object */ if (NULL == (vol_obj1 = (H5VL_object_t *)H5VL_get_object(cur_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if(H5L_SAME_LOC != new_loc_id) { + if(H5L_SAME_LOC != new_loc_id) /* Get the new location object */ if(NULL == (vol_obj2 = (H5VL_object_t *)H5VL_get_object(new_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - /* Make sure that the VOL drivers are the same */ - if(vol_obj1 && vol_obj2) { - if(vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL drivers and can't be linked") - } + /* Make sure that the VOL plugins are the same */ + if(vol_obj1 && vol_obj2) + if(vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") /* Get the link creation plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) @@ -607,7 +638,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, /* Create the link */ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, (vol_obj2 ? (vol_obj2->data) : NULL), loc_params2, - (vol_obj1 != NULL ? vol_obj1->driver->cls : vol_obj2->driver->cls), + (vol_obj1 != NULL ? vol_obj1->plugin->cls : vol_obj2->plugin->cls), lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link") @@ -647,6 +678,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; H5P_genplist_t *plist; /* Property list pointer */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -688,12 +720,21 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, if(H5P_set(plist, H5VL_PROP_LINK_UDATA_SIZE, &udata_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Create external link */ - if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->driver->cls, + if(H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lcreate_ud() */ @@ -720,6 +761,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -743,12 +785,21 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Unlink */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE, + if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Ldelete() */ @@ -808,7 +859,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Delete the link */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_DELETE, + if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") @@ -865,7 +916,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL, + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) @@ -930,7 +981,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Get the link value */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_VAL, + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value") @@ -982,7 +1033,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check for the existence of the link */ - if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_EXISTS, + if(H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") @@ -1011,6 +1062,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1033,12 +1085,21 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Get the link information */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_INFO, + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lget_info() */ @@ -1064,6 +1125,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1094,12 +1156,21 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Get the link information */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_INFO, + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lget_info_by_idx() */ @@ -1292,7 +1363,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") /* Get the link information */ - if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_GET_NAME, + if(H5VL_link_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, name, size, &ret_value) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name") @@ -1326,6 +1397,7 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; H5I_type_t id_type; /* Type of ID */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1350,13 +1422,22 @@ H5Literate(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(group_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, + if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Literate() */ @@ -1423,7 +1504,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, + if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") @@ -1467,6 +1548,7 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; H5I_type_t id_type; /* Type of ID */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1491,13 +1573,22 @@ H5Lvisit(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Iterate over the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, + if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lvisit() */ @@ -1536,6 +1627,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1568,13 +1660,22 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.name = group_name; loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Visit the links */ - if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_LINK_ITER, + if((ret_value = H5VL_link_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Lvisit_by_name() */ @@ -1949,7 +2050,15 @@ H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t H5_ATT /* Set up location for user-defined callback */ if(NULL == (grp = H5G_open(&temp_loc))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp_id = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group") /* Make callback */ @@ -2734,7 +2843,15 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, /* Set up location for user-defined callback */ if(NULL == (grp = H5G_open(&temp_loc))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp_id = H5VL_native_register(H5I_GROUP, grp, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID") if(udata->copy) { diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index d9cc7a3..eb732ee 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -242,8 +242,16 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, if(NULL == (ext_obj = H5O_open_name(&root_loc, obj_name, &opened_type))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} /* Get an ID for the external link's object */ - if((ext_obj_id = H5VL_native_register(opened_type, ext_obj, TRUE)) < 0) + if((ext_obj_id = H5VL_wrap_register(opened_type, ext_obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object") /* Set return value */ @@ -414,7 +422,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") /* Create an external link */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj->data, loc_params, vol_obj->plugin->cls, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link") @@ -104,6 +104,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) H5I_type_t opened_type; void *opened_obj = NULL; H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(H5I_INVALID_HID) @@ -129,15 +130,25 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) loc_params.loc_data.loc_by_name.lapl_id = lapl_id; loc_params.obj_type = H5I_get_type(loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Get an atom for the object */ - if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oopen() */ @@ -203,11 +214,11 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") - if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: @@ -271,12 +282,12 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the object */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, &opened_type, + if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") /* Register the dataset ID */ - if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: @@ -348,21 +359,19 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, loc_params2.loc_data.loc_by_name.name = new_name; loc_params2.loc_data.loc_by_name.lapl_id = lapl_id; - if(H5L_SAME_LOC != obj_id) { + if(H5L_SAME_LOC != obj_id) /* get the location object */ if(NULL == (vol_obj1 = H5VL_get_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } - if(H5L_SAME_LOC != new_loc_id) { + if(H5L_SAME_LOC != new_loc_id) /* get the location object */ if(NULL == (vol_obj2 = H5VL_get_object(new_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") - } + /* Make sure that the VOL plugins are the same */ - if(vol_obj1 && vol_obj2) { - if (vol_obj1->driver->cls->value != vol_obj2->driver->cls->value) + if(vol_obj1 && vol_obj2) + if (vol_obj1->plugin->cls->value != vol_obj2->plugin->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") - } /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) @@ -376,7 +385,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, /* Create a link to the object */ if(H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2->data, loc_params2, - (vol_obj1 != NULL ? vol_obj1->driver->cls : vol_obj2->driver->cls), + (vol_obj1 != NULL ? vol_obj1->plugin->cls : vol_obj2->plugin->cls), lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") @@ -427,7 +436,7 @@ H5Oincr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's reference count */ - if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_CHANGE_REF_COUNT, + if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -478,7 +487,7 @@ H5Odecr_refcount(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") /* Change the object's reference count */ - if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_CHANGE_REF_COUNT, + if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") @@ -505,6 +514,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -530,12 +540,21 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) loc_params.loc_data.loc_by_name.lapl_id = lapl_id; loc_params.obj_type = H5I_get_type(loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Check if the object exists */ - if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_OBJECT_EXISTS, + if(H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_EXISTS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oexists_by_name() */ @@ -559,6 +578,7 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -578,12 +598,21 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields) if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oget_info2() */ @@ -608,6 +637,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -637,12 +667,21 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo, if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oget_info_by_name2() */ @@ -669,6 +708,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -703,12 +743,21 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oget_info_by_idx2() */ @@ -735,6 +784,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -752,12 +802,21 @@ H5Oset_comment(hid_t obj_id, const char *comment) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* (Re)set the object's comment */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oset_comment() */ @@ -785,6 +844,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -808,12 +868,21 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* (Re)set the object's comment */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oset_comment_by_name() */ @@ -839,6 +908,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) @@ -852,12 +922,21 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Retrieve the object's comment */ - if (H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if (H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oget_comment() */ @@ -884,6 +963,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) @@ -907,12 +987,21 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf if(NULL == (vol_obj = H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Retrieve the object's comment */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name) done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Oget_comment_by_name() */ @@ -958,6 +1047,7 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -981,13 +1071,22 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Ovisit2() */ @@ -1033,6 +1132,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1067,13 +1167,22 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; loc_params.obj_type = H5I_get_type(loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Ovisit_by_name2() */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index c03c352..d6c1406 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -204,6 +204,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5VL_loc_params_t loc_params1; H5VL_object_t *vol_obj2 = NULL; /* object token of dst_id */ H5VL_loc_params_t loc_params2; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -246,13 +247,22 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, loc_params2.type = H5VL_OBJECT_BY_SELF; loc_params2.obj_type = H5I_get_type(dst_loc_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj1->data, vol_obj1->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Copy the object */ - if((ret_value = H5VL_object_copy(vol_obj1->data, loc_params1, vol_obj1->driver->cls, src_name, - vol_obj2->data, loc_params2, vol_obj2->driver->cls, dst_name, + if((ret_value = H5VL_object_copy(vol_obj1->data, loc_params1, vol_obj1->plugin->cls, src_name, + vol_obj2->data, loc_params2, vol_obj2->plugin->cls, dst_name, ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Ocopy() */ diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index ead2028..3d09b33 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -109,7 +109,7 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") @@ -161,7 +161,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name) @@ -223,7 +223,7 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Retrieve the object's information */ - if(H5VL_object_optional(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, + if(H5VL_object_optional(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_OBJECT_GET_INFO, loc_params, oinfo, H5O_INFO_ALL) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object") @@ -270,6 +270,7 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -291,13 +292,22 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Ovisit1() */ @@ -373,7 +383,7 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.obj_type = H5I_get_type(loc_id); /* Visit the objects */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 84095d9..2ef5ab8 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -92,7 +92,7 @@ H5Oflush(hid_t obj_id) loc_params.obj_type = H5I_get_type(obj_id); /* Flush the object */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") @@ -257,7 +257,7 @@ H5Orefresh(hid_t oid) loc_params.obj_type = H5I_get_type(oid); /* Refresh the object */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, oid)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") @@ -301,7 +301,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) H5O_loc_t obj_oloc; H5G_name_t obj_path; H5O_shared_t cached_H5O_shared; - H5VL_t *driver = NULL; + H5VL_t *plugin = NULL; /* Create empty object location */ obj_loc.oloc = &obj_oloc; @@ -319,29 +319,29 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) if(H5T_save_refresh_state(oid, &cached_H5O_shared) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to save datatype state") - /* Get the VOL object from the ID and cache a pointer to the driver. + /* Get the VOL object from the ID and cache a pointer to the plugin. * The vol_obj will disappear when the underlying object is closed, so * we can't use that directly. */ if(NULL == (vol_obj = H5VL_get_object(oid))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - driver = vol_obj->driver; + plugin = vol_obj->plugin; - /* Bump the number of references on the VOL driver. - * If you don't do this, VDS refreshes can accidentally close the driver. + /* Bump the number of references on the VOL plugin. + * If you don't do this, VDS refreshes can accidentally close the plugin. */ - driver->nrefs++; + plugin->nrefs++; /* Close object & evict its metadata */ if((H5O__refresh_metadata_close(oid, oloc, &obj_loc)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") /* Re-open the object, re-fetching its metadata */ - if((H5O_refresh_metadata_reopen(oid, &obj_loc, driver, FALSE)) < 0) + if((H5O_refresh_metadata_reopen(oid, &obj_loc, plugin, FALSE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") - /* Restore the number of references on the VOL driver */ - driver->nrefs--; + /* Restore the number of references on the VOL plugin */ + plugin->nrefs--; /* Restore important datatype state */ if(H5I_get_type(oid) == H5I_DATATYPE) @@ -444,7 +444,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, hbool_t start_swmr) +H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_plugin, hbool_t start_swmr) { void *object = NULL; /* Object for this operation */ H5I_type_t type; /* Type of object for the ID */ @@ -454,7 +454,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h /* Sanity check */ HDassert(obj_loc); - HDassert(vol_driver); + HDassert(vol_plugin); /* Get object's type */ type = H5I_get_type(oid); @@ -501,7 +501,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, h } /* end switch */ /* Re-register ID for the object */ - if((H5I_register_with_id(type, object, vol_driver, TRUE, oid)) < 0) + if((H5I_register_with_id(type, object, vol_plugin, TRUE, oid)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh") done: diff --git a/src/H5Oint.c b/src/H5Oint.c index c569226..61a913c 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -2658,7 +2658,15 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Get an ID for the visited object */ - if((obj_id = H5VL_native_register(opened_type, obj, TRUE)) < 0) +{ +void *vol_wrap_ctx = NULL; /* Object wrapping context */ + +/* Retrieve the VOL object wrap context */ +if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") +HDassert(vol_wrap_ctx); +} + if((obj_id = H5VL_wrap_register(opened_type, obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register visited object") /* Make callback for starting object */ diff --git a/src/H5Olink.c b/src/H5Olink.c index 6447936..961c619 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -648,7 +648,7 @@ H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) hid_t file_id; /* ID for the file the link is located in (passed to user callback) */ /* Get a file ID for the file the link is in */ - if((file_id = H5F_get_id(f, FALSE)) < 0) + if((file_id = H5F_get_id(f)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID") /* Call user-defined link's 'delete' callback */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 0340b67..0e40603 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -39,7 +39,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory Management */ #include "H5Ppkg.h" /* Property lists */ -#include "H5VLprivate.h" /* VOL drivers */ +#include "H5VLprivate.h" /* VOL plugins */ /* Includes needed to set as default file driver */ #include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ @@ -48,8 +48,8 @@ #include "H5FDwindows.h" /* Win32 I/O */ #endif -/* Includes needed to set the default VOL driver */ -#include "H5VLnative.h" /* Native HDF5 file VOL driver */ +/* Includes needed to set the default VOL plugin */ +#include "H5VLnative.h" /* Native HDF5 file VOL plugin */ /****************/ @@ -262,8 +262,8 @@ #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF 0 #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC H5P__encode_unsigned #define H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC H5P__decode_unsigned -/* Definition for file VOL driver properties (ID, etc.) */ -#define H5F_ACS_VOL_SIZE sizeof(H5VL_driver_prop_t) +/* Definition for file VOL plugin properties (ID, etc.) */ +#define H5F_ACS_VOL_SIZE sizeof(H5VL_plugin_prop_t) #define H5F_ACS_VOL_DEF {H5_DEFAULT_VOL, NULL} #define H5F_ACS_VOL_CRT H5P__facc_vol_create #define H5F_ACS_VOL_SET H5P__facc_vol_set @@ -334,7 +334,7 @@ static int H5P__facc_cache_image_config_cmp(const void *_config1, const void *_c static herr_t H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size); static herr_t H5P__facc_cache_image_config_dec(const void **_pp, void *_value); -/* VOL driver callbacks */ +/* VOL plugin callbacks */ static herr_t H5P__facc_vol_create(const char *name, size_t size, void *value); static herr_t H5P__facc_vol_set(hid_t prop_id, const char *name, size_t size, void *value); static herr_t H5P__facc_vol_get(hid_t prop_id, const char *name, size_t size, void *value); @@ -437,7 +437,7 @@ static herr_t H5P__facc_reg_prop(H5P_genclass_t *pclass) { const H5FD_driver_prop_t def_driver_prop = H5F_ACS_FILE_DRV_DEF; /* Default VFL driver ID & info (initialized from a variable) */ - const H5VL_driver_prop_t def_vol_prop = H5F_ACS_VOL_DEF; /* Default VOL driver ID & info (initialized from a variable) */ + const H5VL_plugin_prop_t def_vol_prop = H5F_ACS_VOL_DEF; /* Default VOL plugin ID & info (initialized from a variable) */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -668,7 +668,7 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the file VOL driver ID & info */ + /* Register the file VOL plugin ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ if(H5P__register_real(pclass, H5F_ACS_VOL_DRV_NAME, H5F_ACS_VOL_SIZE, &def_vol_prop, H5F_ACS_VOL_CRT, H5F_ACS_VOL_SET, H5F_ACS_VOL_GET, NULL, NULL, @@ -4974,10 +4974,10 @@ done: /*------------------------------------------------------------------------- * Function: H5P_set_vol * - * Purpose: Set the VOL driver for a file access property list - * (PLIST_ID). The vol properties will + * Purpose: Set the VOL plugin for a file access property list + * (PLIST_ID). The VOL properties will * be copied into the property list and the reference count on - * the vol will be incremented. + * the VOL will be incremented. * * Return: SUCCEED/FAIL * @@ -4991,19 +4991,19 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info) FUNC_ENTER_NOAPI(FAIL) if(NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - H5VL_driver_prop_t vol_prop; /* Property for VOL ID & info */ + H5VL_plugin_prop_t vol_prop; /* Property for VOL ID & info */ - /* Prepare the VOL driver property */ - vol_prop.driver_id = vol_id; - vol_prop.driver_info = vol_info; + /* Prepare the VOL plugin property */ + vol_prop.plugin_id = vol_id; + vol_prop.plugin_info = vol_info; - /* Set the driver ID & info property */ + /* Set the plugin ID & info property */ if(H5P_set(plist, H5F_ACS_VOL_DRV_NAME, &vol_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL driver ID & info") - } + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL plugin ID & info") + } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); @@ -5015,7 +5015,7 @@ done: /*------------------------------------------------------------------------- * Function: H5Pset_vol * - * Purpose: Set the file VOL driver (VOL_ID) for a file access + * Purpose: Set the file VOL plugin (VOL_ID) for a file access * property list (PLIST_ID) * * Return: Success: Non-negative @@ -5036,11 +5036,11 @@ H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info) if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") if(NULL == H5I_object_verify(new_vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file vol ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file VOL ID") - /* Set the vol */ + /* Set the VOL */ if(H5P_set_vol(plist, new_vol_id, new_vol_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vol") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL") done: FUNC_LEAVE_API(ret_value) @@ -5048,75 +5048,103 @@ done: /*------------------------------------------------------------------------- - * Function: H5P_get_vol_info + * Function: H5Pget_vol_id * - * Purpose: Returns a pointer directly to the file vol-specific - * information of a file access property list. + * Purpose: Returns the ID of the current VOL plugin. + * This ID should be closed with H5VLclose(). * - * 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. + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -void * -H5P_get_vol_info(H5P_genplist_t *plist) +herr_t +H5Pget_vol_id(hid_t plist_id, hid_t *vol_id) { - void *ret_value = NULL; + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*i", plist_id, vol_id); + + /* Get property list for ID */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - /* Get the current vol info */ + /* Get the current VOL ID */ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + + /* Get the plugin property */ + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info") - ret_value = (void *)driver_prop.driver_info; - } else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + /* Increment the VOL ID's ref count */ + if(H5I_inc_ref(plugin_prop.plugin_id, TRUE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin ID") + + /* Set the plugin ID to return */ + *vol_id = plugin_prop.plugin_id; + } /* end if */ + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_get_vol_info() */ + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_vol_id() */ /*------------------------------------------------------------------------- * Function: H5Pget_vol_info * - * Purpose: Returns a pointer directly to the file vol-specific - * information of a file access property list. - * - * XXX (VOL MERGE): This API call seems like a REALLY bad idea - DER - * - * Return: Success: Ptr to *uncopied* vol specific data - * structure if any. + * Purpose: Returns a copy of the VOL info for a plugin. + * This information should be freed with H5VLfree_plugin_info. * - * 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. + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ -void * -H5Pget_vol_info(hid_t plist_id) +herr_t +H5Pget_vol_info(hid_t plist_id, void **vol_info) { - H5P_genplist_t *plist; /* Property list pointer */ - void *ret_value; /* Return value */ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(NULL) - H5TRACE1("*x", "i", plist_id); + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i**x", plist_id, vol_info); + /* Get property list for ID */ 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") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get the current VOL info */ + if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { + void *new_plugin_info = NULL; /* Copy of plugin info */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ - if(NULL == (ret_value = H5P_get_vol_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol info") + /* Get the plugin property */ + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") + + /* Copy plugin info, if it exists */ + if(plugin_prop.plugin_info) { + H5VL_class_t *plugin; /* Pointer to plugin */ + + /* Retrieve the plugin for the ID */ + if(NULL == (plugin = (H5VL_class_t *)H5I_object(plugin_prop.plugin_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Allocate and copy plugin info */ + if(H5VL_copy_plugin_info(plugin, &new_plugin_info, plugin_prop.plugin_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "plugin info copy failed") + } /* end if */ + + /* Set the plugin info */ + *vol_info = new_plugin_info; + } /* end if */ + else + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") done: FUNC_LEAVE_API(ret_value) @@ -5126,7 +5154,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__vol_copy * - * Purpose: Copy VOL driver ID & info. + * Purpose: Copy VOL plugin 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 @@ -5145,41 +5173,32 @@ H5P__vol_copy(void *value) FUNC_ENTER_STATIC if(value) { - H5VL_driver_prop_t *info = (H5VL_driver_prop_t *)value; /* Driver ID & info struct */ + H5VL_plugin_prop_t *plugin_prop = (H5VL_plugin_prop_t *)value; /* Driver ID & info struct */ - /* Copy the driver ID & info, if there is one */ - if(info->driver_id > 0) { - /* Increment the reference count on driver ID and copy driver info */ - if(H5I_inc_ref(info->driver_id, FALSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL driver ID") + /* Copy the plugin ID & info, if there is one */ + if(plugin_prop->plugin_id > 0) { + /* Increment the reference count on plugin ID and copy plugin info */ + if(H5I_inc_ref(plugin_prop->plugin_id, FALSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin ID") - /* Copy driver info, if it exists */ - if(info->driver_info) { - H5VL_class_t *driver; /* Pointer to driver */ - void *new_driver; /* Copy of driver info */ + /* Copy plugin info, if it exists */ + if(plugin_prop->plugin_info) { + H5VL_class_t *plugin; /* Pointer to plugin */ + void *new_plugin_info = NULL; /* Copy of plugin info */ - /* Retrieve the driver for the ID */ - if(NULL == (driver = (H5VL_class_t *)H5I_object(info->driver_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL driver ID") + /* Retrieve the plugin for the ID */ + if(NULL == (plugin = (H5VL_class_t *)H5I_object(plugin_prop->plugin_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Allow the driver to copy or do it ourselves */ - if(driver->fapl_copy) { - if(NULL == (new_driver = (driver->fapl_copy)(info->driver_info))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver info copy failed") - } - else if(driver->fapl_size > 0) { - if(NULL == (new_driver = H5MM_malloc(driver->fapl_size))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed") - HDmemcpy(new_driver, info->driver_info, driver->fapl_size); - } - else - HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info") + /* Allocate and copy plugin info */ + if(H5VL_copy_plugin_info(plugin, &new_plugin_info, plugin_prop->plugin_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "plugin info copy failed") - /* Set the driver info for the copy */ - info->driver_info = new_driver; - } - } - } + /* Set the plugin info to the copy */ + plugin_prop->plugin_info = new_plugin_info; + } /* end if */ + } /* end if */ + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -5189,7 +5208,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__vol_free * - * Purpose: Free VOL driver ID & info. + * Purpose: Free VOL plugin ID & info. * * Return: Success: Non-negative * Failure: Negative @@ -5204,31 +5223,27 @@ H5P__vol_free(void *value) FUNC_ENTER_STATIC if(value) { - H5VL_driver_prop_t *info = (H5VL_driver_prop_t *)value; /* Driver ID & info struct */ + H5VL_plugin_prop_t *info = (H5VL_plugin_prop_t *)value; /* Driver ID & info struct */ - /* Free the driver info (if it exists) and decrement the ID */ - if(info->driver_id > 0) { - if(info->driver_info) { - H5VL_class_t *driver; /* Pointer to driver */ + /* Free the plugin info (if it exists) and decrement the ID */ + if(info->plugin_id > 0) { + if(info->plugin_info) { + H5VL_class_t *plugin; /* Pointer to plugin */ - /* Retrieve the driver for the ID */ - if(NULL == (driver = (H5VL_class_t *)H5I_object(info->driver_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL driver ID") + /* Retrieve the plugin for the ID */ + if(NULL == (plugin = (H5VL_class_t *)H5I_object(info->plugin_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - /* Allow the driver to free info or do it ourselves */ - if(driver->fapl_free) { - if((driver->fapl_free)((void *)info->driver_info) < 0) /* Casting away const OK -QAK */ - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed") - } - else - H5MM_xfree((void *)info->driver_info); /* Casting away const OK -QAK */ - } + /* Free the plugin info */ + if(H5VL_free_plugin_info(plugin, (void *)info->plugin_info) < 0) /* Casting away const OK - QAK */ + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin info object") + } /* end if */ - /* Decrement reference count for driver ID */ - if(H5I_dec_ref(info->driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID") - } - } + /* Decrement reference count for plugin ID */ + if(H5I_dec_ref(info->plugin_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for plugin ID") + } /* end if */ + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -5238,7 +5253,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_create * - * Purpose: Create callback for the VOL driver ID & info property. + * Purpose: Create callback for the VOL plugin ID & info property. * * Return: Success: Non-negative * Failure: Negative @@ -5252,9 +5267,9 @@ H5P__facc_vol_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size FUNC_ENTER_STATIC - /* Make copy of the VOL driver */ + /* Make copy of the VOL plugin */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5264,7 +5279,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_set * - * Purpose: Copies a VOL driver property when it's set for a property list + * Purpose: Copies a VOL plugin property when it's set for a property list * * Return: Success: Non-negative * Failure: Negative @@ -5282,9 +5297,9 @@ H5P__facc_vol_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, /* Sanity check */ HDassert(value); - /* Make copy of VOL driver ID & info */ + /* Make copy of VOL plugin ID & info */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5294,7 +5309,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_get * - * Purpose: Copies a VOL driver property when it's retrieved from a property list + * Purpose: Copies a VOL plugin property when it's retrieved from a property list * * Return: Success: Non-negative * Failure: Negative @@ -5312,9 +5327,9 @@ H5P__facc_vol_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, /* Sanity check */ HDassert(value); - /* Make copy of VOL driver */ + /* Make copy of VOL plugin */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5324,7 +5339,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_del * - * Purpose: Frees memory used to store the VOL driver ID & info property + * Purpose: Frees memory used to store the VOL plugin ID & info property * * Return: Success: Non-negative * Failure: Negative @@ -5338,9 +5353,9 @@ H5P__facc_vol_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, FUNC_ENTER_STATIC - /* Free the VOL driver ID & info */ + /* Free the VOL plugin ID & info */ if(H5P__vol_free(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5350,7 +5365,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_copy * - * Purpose: Copy callback for the VOL driver ID & info property. + * Purpose: Copy callback for the VOL plugin ID & info property. * * Return: Success: Non-negative * Failure: Negative @@ -5364,9 +5379,9 @@ H5P__facc_vol_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, FUNC_ENTER_STATIC - /* Make copy of VOL driver */ + /* Make copy of VOL plugin */ if(H5P__vol_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5376,7 +5391,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_cmp * - * Purpose: Callback routine which is called whenever the VOL driver + * Purpose: Callback routine which is called whenever the VOL plugin * ID & info property in the file access property list * is compared. * @@ -5389,48 +5404,39 @@ done: static int H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED size) { - const H5VL_driver_prop_t *info1 = (const H5VL_driver_prop_t *)_info1; /* Create local aliases for values */ - const H5VL_driver_prop_t *info2 = (const H5VL_driver_prop_t *)_info2; + const H5VL_plugin_prop_t *info1 = (const H5VL_plugin_prop_t *)_info1; /* Create local aliases for values */ + const H5VL_plugin_prop_t *info2 = (const H5VL_plugin_prop_t *)_info2; H5VL_class_t *cls1, *cls2; /* Driver class for each property */ int cmp_value; /* Value from comparison */ - herr_t ret_value = 0; /* Return value */ + int ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR /* Sanity check */ HDassert(info1); HDassert(info2); - HDassert(size == sizeof(H5VL_driver_prop_t)); + HDassert(size == sizeof(H5VL_plugin_prop_t)); - /* Compare drivers */ - if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->driver_id))) + /* Compare plugins */ + if(NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->plugin_id))) HGOTO_DONE(-1) - if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->driver_id))) + if(NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->plugin_id))) HGOTO_DONE(1) - if(cls1->name == NULL && cls2->name != NULL) - HGOTO_DONE(-1); - if(cls1->name != NULL && cls2->name == NULL) - HGOTO_DONE(1); - if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name))) + if(0 != (cmp_value = H5VL_cmp_plugin_cls(cls1, cls2))) HGOTO_DONE(cmp_value); - /* Compare driver info */ - if(cls1->fapl_size < cls2->fapl_size) - HGOTO_DONE(-1) - if(cls1->fapl_size > cls2->fapl_size) - HGOTO_DONE(1) - HDassert(cls1->fapl_size == cls2->fapl_size); + /* At this point, we should be able to assume that we are dealing with + * the same plugin class struct (or a copies of the same class struct) + */ - if(info1->driver_info == NULL && info2->driver_info != NULL) - HGOTO_DONE(-1); - if(info1->driver_info != NULL && info2->driver_info == NULL) - HGOTO_DONE(1); - if(info1->driver_info) { - HDassert(cls1->fapl_size > 0); - if(0 != (cmp_value = HDmemcmp(info1->driver_info, info2->driver_info, cls1->fapl_size))) - HGOTO_DONE(cmp_value); - } + /* Use one of the classes (cls1) info comparison routines to compare the + * info objects + */ + HDassert(cls1->info_cmp == cls2->info_cmp); + if(0 != (cmp_value = H5VL_cmp_plugin_info(cls1, info1->plugin_info, info2->plugin_info))) + HGOTO_DONE(cmp_value); + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_vol_cmp() */ @@ -5439,7 +5445,7 @@ done: /*------------------------------------------------------------------------- * Function: H5P__facc_vol_close * - * Purpose: Close callback for the VOL driver ID & info property. + * Purpose: Close callback for the VOL plugin ID & info property. * * Return: Success: Non-negative * Failure: Negative @@ -5453,9 +5459,9 @@ H5P__facc_vol_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, FUNC_ENTER_STATIC - /* Free the VOL driver */ + /* Free the VOL plugin */ if(H5P__vol_free(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL plugin") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index cd749cb..866f088 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -178,7 +178,6 @@ H5_DLL const void *H5P_peek_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, hid_t vol_id, 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 77d8ebb..86c6687 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -314,7 +314,8 @@ 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 const 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 H5Pget_vol_id(hid_t plist_id, hid_t *vol_id); +H5_DLL herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info); H5_DLL herr_t H5Pset_family_offset(hid_t fapl_id, hsize_t offset); H5_DLL herr_t H5Pget_family_offset(hid_t fapl_id, hsize_t *offset); H5_DLL herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type); @@ -93,6 +93,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t { H5VL_object_t *vol_obj = NULL; /* Object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -126,13 +127,22 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t if(H5CX_set_loc(loc_id) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Create reference */ - if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_CREATE, + if((ret_value = H5VL_object_specific(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, ref, name, ref_type, space_id)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create reference") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Rcreate() */ @@ -200,11 +210,11 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r loc_params.obj_type = H5I_get_type(obj_id); /* Dereference */ - if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") - if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: @@ -260,7 +270,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") /* Get the dataspace with the correct region selected */ - if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_GET_REGION, + if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_GET_REGION, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve dataspace") @@ -318,7 +328,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Get the object type */ - if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, + if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") @@ -367,6 +377,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, { H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_API((-1)) @@ -386,13 +397,22 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Get name */ - if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_GET_NAME, + if(H5VL_object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value, name, size, ref_type, _ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Rget_name() */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 9c1fcc5..83d2783 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -126,7 +126,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid file identifier") /* Get the object information */ - if (H5VL_object_get(vol_obj->data, loc_params, vol_obj->driver->cls, H5VL_REF_GET_TYPE, + if (H5VL_object_get(vol_obj->data, loc_params, vol_obj->plugin->cls, H5VL_REF_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &obj_type, ref_type, ref) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "unable to determine object type") @@ -183,12 +183,12 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) loc_params.obj_type = H5I_get_type(obj_id); /* Dereference */ - if (NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->driver->cls, &opened_type, + if (NULL == (opened_obj = H5VL_object_open(vol_obj->data, loc_params, vol_obj->plugin->cls, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to dereference object") /* Get an atom for the object */ - if ((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->driver, TRUE)) < 0) + if ((ret_value = H5VL_register_id(opened_type, opened_obj, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") done: diff --git a/src/H5Rint.c b/src/H5Rint.c index 52a4ee1..7142d54 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -692,9 +692,9 @@ done: REVISION LOG --------------------------------------------------------------------------*/ ssize_t -H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_t size) +H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, + char *name, size_t size) { - hid_t file_id = H5I_INVALID_HID; /* ID for file that the reference is in */ H5O_loc_t oloc; /* Object location describing object for reference */ ssize_t ret_value = -1; /* Return value */ @@ -747,19 +747,11 @@ H5R__get_name(H5F_t *f, H5R_type_t ref_type, const void *_ref, char *name, size_ HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, (-1), "internal error (unknown reference type)") } /* end switch */ - /* Retrieve file ID for name search */ - if ((file_id = H5F_get_id(f, FALSE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't get file ID") - /* Get name, length, etc. */ - if ((ret_value = H5G_get_name_by_addr(file_id, &oloc, name, size)) < 0) + if ((ret_value = H5G_get_name_by_addr(f, &oloc, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't determine name") done: - /* Close file ID used for search */ - if (file_id > 0 && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__get_name() */ @@ -1609,12 +1609,12 @@ H5T__close_cb(H5T_t *dt) HDassert(dt->shared); /* If this datatype is VOL-managed (i.e.: has a VOL object), - * close it through the VOL driver. + * close it through the VOL plugin. */ if(NULL != dt->vol_obj) { - /* Close the driver-managed datatype data */ - if(H5VL_datatype_close(dt->vol_obj->data, dt->vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + /* Close the plugin-managed datatype data */ + if(H5VL_datatype_close(dt->vol_obj->data, dt->vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); /* Free the VOL object */ @@ -3672,7 +3672,7 @@ done: * Purpose: Frees a datatype and all associated memory. * * Note: Does _not_ deal with open named datatypes, etc. so this - * should never see a type managed by a VOL driver. + * should never see a type managed by a VOL plugin. * * Return: Non-negative on success/Negative on failure * @@ -5194,7 +5194,7 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f) H5VL_object_t *vol_obj = dt->vol_obj; /* Close the datatype through the VOL*/ - if ((ret_value = H5VL_datatype_close(vol_obj->data, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) + if ((ret_value = H5VL_datatype_close(vol_obj->data, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); /* Free the datatype and set the VOL object pointer to NULL */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 8f7b4de..8389352 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -108,6 +108,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, H5T_t *dt = NULL; /* High level datatype object that wraps the VOL object */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -149,8 +150,13 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Commit the type */ - if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->plugin->cls, name, type_id, lcpl_id, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") @@ -158,14 +164,18 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, /* Set up VOL object */ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") - new_obj->driver = vol_obj->driver; - new_obj->driver->nrefs ++; + new_obj->plugin = vol_obj->plugin; + new_obj->plugin->nrefs ++; new_obj->data = data; - /* Set the committed type object to the VOL driver pointer in the H5T_t struct */ + /* Set the committed type object to the VOL plugin pointer in the H5T_t struct */ dt->vol_obj = new_obj; done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + FUNC_LEAVE_API(ret_value) } /* end H5Tcommit2() */ @@ -305,7 +315,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* Commit the datatype */ - if(NULL == (dt = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (dt = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->plugin->cls, NULL, type_id, H5P_DEFAULT, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") @@ -313,11 +323,11 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) /* Setup VOL object */ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") - new_obj->driver = vol_obj->driver; - new_obj->driver->nrefs ++; + new_obj->plugin = vol_obj->plugin; + new_obj->plugin->nrefs ++; new_obj->data = dt; - /* Set the committed type object to the VOL pluging pointer in the H5T_t struct */ + /* Set the committed type object to the VOL plugin pointer in the H5T_t struct */ type->vol_obj = new_obj; done: @@ -568,9 +578,10 @@ done: hid_t H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) { - void *dt = NULL; /* datatype token created by VOL driver */ + void *dt = NULL; /* datatype token created by VOL plugin */ H5VL_object_t *vol_obj = NULL; /* object token of loc_id */ H5VL_loc_params_t loc_params; + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) @@ -594,19 +605,28 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + /* Set wrapper info in API context */ + if(H5VL_set_vol_wrapper(vol_obj->data, vol_obj->plugin) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + /* Open the datatype */ - if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ - if((ret_value = H5VL_register_id(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATATYPE, dt, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: + /* Reset object wrapping info in API context */ + if(vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't reset VOL wrapper info") + /* Cleanup on error */ if(H5I_INVALID_HID == ret_value) - if(dt && H5VL_datatype_close(dt, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dt && H5VL_datatype_close(dt, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") FUNC_LEAVE_API(ret_value) @@ -664,7 +684,7 @@ H5Tget_create_plist(hid_t dtype_id) H5VL_object_t *vol_obj = type->vol_obj; /* Get the property list through the VOL */ - if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_TCPL, + if(H5VL_datatype_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATATYPE_GET_TCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") } @@ -707,7 +727,7 @@ H5Tflush(hid_t type_id) /* Flush metadata for named datatype */ if(dt->vol_obj) - if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->driver->cls, H5VL_DATATYPE_FLUSH, + if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->plugin->cls, H5VL_DATATYPE_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") @@ -749,7 +769,7 @@ H5Trefresh(hid_t type_id) /* Refresh the datatype's metadata */ if(dt->vol_obj) - if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->driver->cls, H5VL_DATATYPE_REFRESH, + if((ret_value = H5VL_datatype_specific(dt->vol_obj->data, dt->vol_obj->plugin->cls, H5VL_DATATYPE_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, type_id)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") @@ -1106,7 +1126,7 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) FUNC_ENTER_NOAPI(NULL) /* get required buf size for encoding the datatype */ - if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_BINARY, + if(H5VL_datatype_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get datatype serialized size") @@ -1115,7 +1135,7 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype") /* get binary description of the datatype */ - if(H5VL_datatype_get(vol_obj->data, vol_obj->driver->cls, H5VL_DATATYPE_GET_BINARY, + if(H5VL_datatype_get(vol_obj->data, vol_obj->plugin->cls, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype") @@ -1161,7 +1181,7 @@ H5T_get_named_type(const H5T_t *dt) /*------------------------------------------------------------------------- * Function: H5T_get_actual_type * - * Purpose: Returns underlying native datatype created by native driver + * Purpose: Returns underlying native datatype created by native plugin * if datatype is committed, otherwise return the datatype * object associate with the ID. * @@ -1181,7 +1201,7 @@ H5T_get_actual_type(H5T_t *dt) if(NULL == dt->vol_obj) ret_value = dt; else - ret_value = (H5T_t *)dt->vol_obj->data; + ret_value = (H5T_t *)H5VL_object_data(dt->vol_obj); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_get_actual_type() */ @@ -1268,3 +1288,24 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_restore_refresh_state() */ + +/*------------------------------------------------------------------------- + * Function: H5T_already_vol_managed + * + * Purpose: Check if the committed datatype is already VOL managed + * + * Return: TRUE / FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +H5T_already_vol_managed(const H5T_t *dt) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(dt); + + FUNC_LEAVE_NOAPI( dt->vol_obj != NULL ) +} /* end H5T_already_vol_managed() */ + diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 1b59c6b..2244f20 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -137,7 +137,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") /* Commit the datatype */ - if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (data = H5VL_datatype_commit(vol_obj->data, loc_params, vol_obj->plugin->cls, name, type_id, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) @@ -146,8 +146,8 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) /* Set up VOL object */ if(NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) HGOTO_ERROR(H5E_VOL, H5E_NOSPACE, FAIL, "can't allocate top object structure") - new_obj->driver = vol_obj->driver; - new_obj->driver->nrefs ++; + new_obj->plugin = vol_obj->plugin; + new_obj->plugin->nrefs ++; new_obj->data = data; /* Set the committed type object to the VOL pluging pointer in the H5T_t struct */ @@ -197,19 +197,19 @@ H5Topen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Open the datatype */ - if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->driver->cls, + if(NULL == (dt = H5VL_datatype_open(vol_obj->data, loc_params, vol_obj->plugin->cls, name, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") /* Register the type and return the ID */ - if((ret_value = H5VL_register_id(H5I_DATATYPE, dt, vol_obj->driver, TRUE)) < 0) + if((ret_value = H5VL_register_id(H5I_DATATYPE, dt, vol_obj->plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") done: /* Cleanup on error */ if(H5I_INVALID_HID == ret_value) - if(dt && H5VL_datatype_close(dt, vol_obj->driver->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if(dt && H5VL_datatype_close(dt, vol_obj->plugin->cls, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to close datatype") FUNC_LEAVE_API(ret_value) diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index c0a6d8d..a14eb8a 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -144,6 +144,7 @@ H5_DLL H5VL_object_t *H5T_get_named_type(const H5T_t *dt); H5_DLL H5T_t *H5T_get_actual_type(H5T_t *dt); H5_DLL herr_t H5T_save_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared); H5_DLL herr_t H5T_restore_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared); +H5_DLL hbool_t H5T_already_vol_managed(const H5T_t *dt); /* Reference specific functions */ H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt); diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 467847f..841637d 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -531,7 +531,7 @@ H5T_vlen_str_mem_getlen(const void *_vl) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const char *s=*(const char * const *)_vl; /* Pointer to the user's string information */ #else - const char *s; /* Pointer to the user's string information */ + const char *s = NULL; /* Pointer to the user's string information */ #endif FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -566,7 +566,7 @@ H5T_vlen_str_mem_getptr(void *_vl) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s=*(char **)_vl; /* Pointer to the user's string information */ #else - char *s; /* Pointer to the user's string information */ + char *s = NULL; /* Pointer to the user's string information */ #endif FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -601,7 +601,7 @@ H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s=*(char **)_vl; /* Pointer to the user's string information */ #else - char *s; /* Pointer to the user's string information */ + char *s = NULL; /* Pointer to the user's string information */ #endif FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -45,21 +45,21 @@ /* Local Typedefs */ /******************/ -/* Information needed for iterating over the registered VOL driver hid_t IDs. - * The name of the new VOL driver that is being registered is stored in the +/* Information needed for iterating over the registered VOL plugin hid_t IDs. + * The name of the new VOL plugin that is being registered is stored in the * name field and the found_id field is initialized to H5I_INVALID_HID (-1). - * If we find a VOL driver with the same name, we set the found_id field to + * If we find a VOL plugin with the same name, we set the found_id field to * the existing ID for return to the function. */ typedef struct { - const char *name; /* The name of the VOL driver to check */ + const char *name; /* The name of the VOL plugin to check */ hid_t found_id; /* The library ID if we found a match */ -} H5VL_get_driver_ud_t; +} H5VL_get_plugin_ud_t; /********************/ /* Local Prototypes */ /********************/ -static int H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data); +static int H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data); /*********************/ /* Package Variables */ @@ -75,7 +75,7 @@ static int H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data); /*------------------------------------------------------------------------- - * Function: H5VL__get_driver_cb + * Function: H5VL__get_plugin_cb * * Purpose: Callback routine to search through registered VOLs * @@ -87,9 +87,9 @@ static int H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data); *------------------------------------------------------------------------- */ static int -H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data) +H5VL__get_plugin_cb(void *obj, hid_t id, void *_op_data) { - H5VL_get_driver_ud_t *op_data = (H5VL_get_driver_ud_t *)_op_data; /* User data for callback */ + H5VL_get_plugin_ud_t *op_data = (H5VL_get_plugin_ud_t *)_op_data; /* User data for callback */ H5VL_class_t *cls = (H5VL_class_t *)obj; int ret_value = H5_ITER_CONT; /* Callback return value */ @@ -101,113 +101,17 @@ H5VL__get_driver_cb(void *obj, hid_t id, void *_op_data) } FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL__get_driver_cb() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLinitialize - * - * Purpose: Calls the driver-specific callback to initialize the driver. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLinitialize(hid_t driver_id, hid_t vipl_id) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ii", driver_id, vipl_id); - - /* Check args */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if (cls->initialize && cls->initialize(vipl_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not initialize") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLinitialize() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLterminate - * - * Purpose: Calls the driver-specific callback to terminate the driver. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLterminate(hid_t driver_id, hid_t vtpl_id) -{ - H5VL_class_t *cls = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "ii", driver_id, vtpl_id); - - /* Check args */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if (cls->terminate && cls->terminate(vtpl_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not terminate cleanly") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLterminate() */ - - -/*------------------------------------------------------------------------- - * Function: H5VLclose - * - * Purpose: Closes the specified VOL driver. The VOL ID will no longer - * be valid for accessing the VOL. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLclose(hid_t vol_id) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE1("e", "i", vol_id); - - /* Check args */ - if(NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - if(H5I_dec_app_ref(vol_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close VOL driver ID") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLclose() */ +} /* end H5VL__get_plugin_cb() */ /*------------------------------------------------------------------------- * Function: H5VLregister * - * Purpose: Registers a new VOL driver as a member of the virtual object + * Purpose: Registers a new VOL plugin as a member of the virtual object * layer class. * - * Return: Success: A VOL driver ID which is good until the - * library is closed or the driver is + * Return: Success: A VOL plugin ID which is good until the + * library is closed or the plugin is * unregistered. * * Failure: A negative value (H5I_INVALID_HID). @@ -215,39 +119,44 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLregister(const H5VL_class_t *cls) +H5VLregister(const H5VL_class_t *cls, hid_t vipl_id) { - H5VL_get_driver_ud_t op_data; + H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(FAIL) - H5TRACE1("i", "*x", cls); + H5TRACE2("i", "*xi", cls, vipl_id); /* Check arguments */ if (!cls) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL driver class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "VOL plugin class pointer cannot be NULL") if (!cls->name) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver class name cannot be the NULL pointer"); - /* XXX: Should probably come up with a max length so we can use strnlen()? */ + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL plugin class name cannot be the NULL pointer") if (0 == HDstrlen(cls->name)) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver class name cannot be the empty string"); + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL plugin class name cannot be the empty string") + if (cls->info_copy && !cls->info_free) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL plugin must provide free callback for VOL info objects when a copy callback is provided") + if (cls->get_wrap_ctx && !cls->free_wrap_ctx) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL plugin must provide free callback for object wrapping contexts when a get callback is provided") op_data.found_id = H5I_INVALID_HID; op_data.name = cls->name; - /* check if driver is already registered */ - if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + /* check if plugin is already registered */ + if (H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL IDs") - /* XXX: Does this need to be an error? Users probably don't care as long - * as their VOL driver is available. - */ - if (op_data.found_id != H5I_INVALID_HID) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL driver with the same name is already registered.") - - /* Create the new class ID */ - if ((ret_value = H5VL_register(cls, sizeof(H5VL_class_t), TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver") + /* Increment the ref count on the existing VOL plugin ID, if it's already registered */ + if(op_data.found_id != H5I_INVALID_HID) { + if (H5I_inc_ref(op_data.found_id, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") + ret_value = op_data.found_id; + } /* end if */ + else { + /* Create a new class ID */ + if ((ret_value = H5VL_register(cls, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL plugin") + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -257,11 +166,11 @@ done: /*------------------------------------------------------------------------- * Function: H5VLregister_by_name * - * Purpose: Registers a new VOL driver as a member of the virtual object + * Purpose: Registers a new VOL plugin as a member of the virtual object * layer class. * - * Return: Success: A VOL driver ID which is good until the - * library is closed or the driver is + * Return: Success: A VOL plugin ID which is good until the + * library is closed or the plugin is * unregistered. * * Failure: A negative value. @@ -269,46 +178,46 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLregister_by_name(const char *name) +H5VLregister_by_name(const char *name, hid_t vipl_id) { - H5VL_get_driver_ud_t op_data; - hid_t ret_value = H5I_INVALID_HID; + H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ + hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_API(FAIL) - H5TRACE1("i", "*s", name); + H5TRACE2("i", "*si", name, vipl_id); /* Check arguments */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL driver name is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL plugin name is disallowed") if (0 == HDstrlen(name)) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL driver name is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL plugin name is disallowed") op_data.found_id = H5I_INVALID_HID; op_data.name = name; - /* Check if driver is already registered */ - if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + /* Check if plugin is already registered */ + if (H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids") + /* If plugin alread registered, increment ref count on ID and return ID */ if (op_data.found_id != H5I_INVALID_HID) { - /* If driver alread registered, increment ref count on ID and return ID */ if (H5I_inc_ref(op_data.found_id, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") ret_value = op_data.found_id; - } + } /* end if */ else { H5PL_key_t key; const H5VL_class_t *cls; - /* Try loading the driver */ + /* Try loading the plugin */ key.name = name; if (NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, key))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL driver") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL plugin") - /* Register the driver we loaded */ - if ((ret_value = H5VL_register(cls, sizeof(H5VL_class_t), TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver ID") - } + /* Register the plugin we loaded */ + if ((ret_value = H5VL_register(cls, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL plugin ID") + } /* end else */ done: FUNC_LEAVE_API(ret_value) @@ -316,12 +225,46 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLclose + * + * Purpose: Closes a VOL plugin ID. This in no way affects + * file access property lists which have been defined to use + * this VOL plugin or files which are already opened under with + * this plugin. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLclose(hid_t vol_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", vol_id); + + /* Check args */ + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin") + + /* Decrement the ref count on the ID, possibly releasing the VOL plugin */ + if(H5I_dec_app_ref(vol_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close VOL plugin ID") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLclose() */ + + +/*------------------------------------------------------------------------- * Function: H5VLunregister * - * Purpose: Removes a vol driver ID from the library. This in no way affects + * Purpose: Removes a VOL plugin ID from the library. This in no way affects * file access property lists which have been defined to use - * this vol driver or files which are already opened under with - * this driver. + * this VOL plugin or files which are already opened under with + * this plugin. * * Return: Success: Non-negative * @@ -332,19 +275,18 @@ done: herr_t H5VLunregister(hid_t vol_id) { - H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", vol_id); /* Check arguments */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(vol_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a vol driver") + if(NULL == H5I_object_verify(vol_id, H5I_VOL)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL plugin") /* The H5VL_class_t struct will be freed by this function */ if (H5I_dec_app_ref(vol_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister vol driver") + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL plugin") done: FUNC_LEAVE_API(ret_value) @@ -367,8 +309,8 @@ done: htri_t H5VLis_registered(const char *name) { - H5VL_get_driver_ud_t op_data; - htri_t ret_value = FALSE; /* Return value */ + H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("t", "*s", name); @@ -377,7 +319,7 @@ H5VLis_registered(const char *name) op_data.name = name; /* Check arguments */ - if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) + if (H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL ids") if (op_data.found_id != H5I_INVALID_HID) @@ -389,9 +331,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLget_driver_id + * Function: H5VLget_plugin_id * - * Purpose: Retrieves the ID for a registered VOL driver. + * Purpose: Retrieves the ID for a registered VOL plugin. * * Return: Positive if the VOL class has been registered * Negative on error (if the class is not a valid class or not registered) @@ -399,10 +341,10 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VLget_driver_id(const char *name) +H5VLget_plugin_id(const char *name) { - H5VL_get_driver_ud_t op_data; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5VL_get_plugin_ud_t op_data; /* Callback info for plugin search */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "*s", name); @@ -411,47 +353,120 @@ H5VLget_driver_id(const char *name) op_data.name = name; /* Check arguments */ - if (H5I_iterate(H5I_VOL, H5VL__get_driver_cb, &op_data, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL driver IDs") + if (H5I_iterate(H5I_VOL, H5VL__get_plugin_cb, &op_data, TRUE) < 0) + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL plugin IDs") if (op_data.found_id != H5I_INVALID_HID) { if (H5I_inc_ref(op_data.found_id, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver") - + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") ret_value = op_data.found_id; - } + } /* end if */ done: FUNC_LEAVE_API(ret_value) -} /* end H5VLget_driver_id() */ +} /* end H5VLget_plugin_id() */ /*------------------------------------------------------------------------- - * Function: H5VLget_driver_name + * Function: H5VLget_plugin_name * - * Purpose: Returns the driver name for the VOL associated with the + * Purpose: Returns the plugin name for the VOL associated with the * object or file ID * - * Return: Success: The length of the driver name + * Return: Success: The length of the plugin name * * Failure: Negative * *------------------------------------------------------------------------- */ ssize_t -H5VLget_driver_name(hid_t obj_id, char *name/*out*/, size_t size) +H5VLget_plugin_name(hid_t obj_id, char *name/*out*/, size_t size) { ssize_t ret_value = -1; FUNC_ENTER_API(FAIL) H5TRACE3("Zs", "ixz", obj_id, name, size); - if ((ret_value = H5VL_get_driver_name(obj_id, name, size)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get driver name") + if ((ret_value = H5VL_get_plugin_name(obj_id, name, size)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get plugin name") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLget_plugin_name() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLcmp_plugin_cls + * + * Purpose: Compares two plugin classes + * + * Return: Success: Non-negative, with *cmp set to positive if + * plugin_id1 is greater than plugin_id2, negative if plugin_id2 + * is greater than plugin_id1 and zero if plugin_id1 and plugin_id2 + * are equal. + * + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcmp_plugin_cls(int *cmp, hid_t plugin_id1, hid_t plugin_id2) +{ + H5VL_class_t *cls1, *cls2; /* Plugins for IDs */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "*Isii", cmp, plugin_id1, plugin_id2); + + /* Check args and get class pointers */ + if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(plugin_id1, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(plugin_id2, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Compare the two VOL plugin classes */ + *cmp = H5VL_cmp_plugin_cls(cls1, cls2); done: FUNC_LEAVE_API(ret_value) -} /* end H5VLget_driver_name() */ +} /* H5VLcmp_plugin_cls() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLcmp_plugin_info + * + * Purpose: Compares two plugin info objects + * + * Note: Both info objects must be from the same VOL plugin class + * + * Return: Success: Non-negative, with *cmp set to positive if + * info1 is greater than info2, negative if info2 + * is greater than info1 and zero if info1 and info2 + * are equal. + * + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcmp_plugin_info(int *cmp, hid_t plugin_id, const void *info1, const void *info2) +{ + H5VL_class_t *cls; /* Plugins for ID */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "*Isi*x*x", cmp, plugin_id, info1, info2); + + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Compare the two VOL plugin info objects */ + *cmp = H5VL_cmp_plugin_info(cls, info1, info2); + +done: + FUNC_LEAVE_API(ret_value) +} /* H5VLcmp_plugin_info() */ /*--------------------------------------------------------------------------- @@ -467,18 +482,18 @@ done: *--------------------------------------------------------------------------- */ hid_t -H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t driver_id) +H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t plugin_id) { hid_t ret_value = FAIL; FUNC_ENTER_API(FAIL) - H5TRACE3("i", "*xIti", obj, obj_type, driver_id); + H5TRACE3("i", "*xIti", obj, obj_type, plugin_id); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object to register") - if ((ret_value = H5VL_object_register(obj, obj_type, driver_id, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object") + if ((ret_value = H5VL_object_register(obj, obj_type, plugin_id, TRUE)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "unable to register object") done: FUNC_LEAVE_API(ret_value) @@ -514,40 +529,306 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5VLobject() */ +/*------------------------------------------------------------------------- + * Routines below this are public wrappers for stackable VOL plugins, and + * should not be called by applications. + *-----------------------------------------------------------------------*/ + + +/*------------------------------------------------------------------------- + * Function: H5VLinitialize + * + * Purpose: Calls the plugin-specific callback to initialize the plugin. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLinitialize(hid_t plugin_id, hid_t vipl_id) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "ii", plugin_id, vipl_id); + + /* Check args */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if (cls->initialize && cls->initialize(vipl_id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not initialize") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLinitialize() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLterminate + * + * Purpose: Calls the plugin-specific callback to terminate the plugin. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLterminate(hid_t plugin_id) +{ + H5VL_class_t *cls = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE1("e", "i", plugin_id); + + /* Check args */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + if (cls->terminate && cls->terminate() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not terminate cleanly") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLterminate() */ + /*--------------------------------------------------------------------------- - * Function: H5VLget_object + * Function: H5VLget_cap_flags + * + * Purpose: Retrieves the capability flag for a plugin + * + * Return: Success: Non-NULL + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_cap_flags(hid_t plugin_id, unsigned *cap_flags) +{ + H5VL_class_t *cls; /* Plugin class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + H5TRACE2("e", "i*Iu", plugin_id, cap_flags); + /* Check args */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Retrieve capability flags */ + if(cap_flags) + *cap_flags = cls->cap_flags; + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_cap_flags */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLcopy_plugin_info * - * Purpose: Retrieves the object pointer associated with the ID. This - * also optionally returns the H5VL_t struct that this ID - * belongs to, if the user passes a valid pointer value. + * Purpose: Copies a VOL plugin's info object * * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLcopy_plugin_info(hid_t plugin_id, void **dst_vol_info, void *src_vol_info) +{ + H5VL_class_t *cls; /* Plugins for ID */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + H5TRACE3("e", "i**x*x", plugin_id, dst_vol_info, src_vol_info); + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Copy the VOL plugin's info object */ + if(H5VL_copy_plugin_info(cls, dst_vol_info, src_vol_info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL plugin info object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLcopy_plugin_info() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLfree_plugin_info + * + * Purpose: Free VOL plugin info object * + * Return: Success: Non-negative * Failure: Negative * *--------------------------------------------------------------------------- */ herr_t -H5VLget_object(hid_t obj_id, void **obj) +H5VLfree_plugin_info(hid_t plugin_id, void *info) { - herr_t ret_value = SUCCEED; + H5VL_class_t *cls; /* Plugins for ID */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i**x", obj_id, obj); + FUNC_ENTER_API_NOINIT + + H5TRACE2("e", "i*x", plugin_id, info); + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Free the VOL plugin info object */ + if(H5VL_free_plugin_info(cls, info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin info object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLfree_plugin_info() */ + +/*--------------------------------------------------------------------------- + * Function: H5VLget_object + * + * Purpose: Retrieves an underlying object. + * + * Return: Success: Non-NULL + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +void * +H5VLget_object(void *obj, hid_t plugin_id) +{ + H5VL_class_t *cls = NULL; + void *ret_value = NULL; + + FUNC_ENTER_API_NOINIT + + H5TRACE2("*x", "*xi", obj, plugin_id); /* Check args */ - if (!obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object pointer") + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") - if (NULL == (*obj = H5VL_get_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain a valid object") + /* Check for 'get_object' callback in plugin */ + if(cls->get_object) + ret_value = (cls->get_object)(obj); + else + ret_value = obj; done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* H5VLget_object */ +/*--------------------------------------------------------------------------- + * Function: H5VLget_wrap_ctx + * + * Purpose: Get a VOL plugin's object wrapping context + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLget_wrap_ctx(void *obj, hid_t plugin_id, void **wrap_ctx) +{ + H5VL_class_t *cls; /* Plugins for ID */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + H5TRACE3("e", "*xi**x", obj, plugin_id, wrap_ctx); + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Get the VOL plugin's object wrapper */ + if(H5VL_get_wrap_ctx(cls, obj, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL plugin object wrap context") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLget_wrap_ctx() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLfree_wrap_ctx + * + * Purpose: Release a VOL plugin's object wrapping context + * + * Return: Success: Non-negative + * Failure: Negative + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VLfree_wrap_ctx(void *wrap_ctx, hid_t plugin_id) +{ + H5VL_class_t *cls; /* Plugins for ID */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + + H5TRACE2("e", "*xi", wrap_ctx, plugin_id); + /* Check args and get class pointer */ + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + /* Release the VOL plugin's object wrapper */ + if(H5VL_free_wrap_ctx(cls, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL plugin object wrap context") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLfree_wrap_ctx() */ + + +/*--------------------------------------------------------------------------- + * Function: H5VLwrap_object + * + * Purpose: Asks a plugin to wrap an underlying object. + * + * Return: Success: Non-NULL + * Failure: NULL + * + *--------------------------------------------------------------------------- + */ +void * +H5VLwrap_object(void *obj, hid_t plugin_id, void *wrap_ctx) +{ + H5VL_class_t *cls; /* VOL plugin class */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_API_NOINIT + + H5TRACE3("*x", "*xi*x", obj, plugin_id, wrap_ctx); + /* Check args */ + if(NULL == obj) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") + + /* Wrap the object */ + if(NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* H5VLwrap_object */ + + /*------------------------------------------------------------------------- * Function: H5VLattr_create * @@ -560,27 +841,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_API(NULL) - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, acpl_id, + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, acpl_id, aapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, cls, name, acpl_id, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create attribute") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_create() */ @@ -596,27 +877,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_API(NULL) - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, aapl_id, + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, aapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, cls, name, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open attribute") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_open() */ @@ -631,23 +912,23 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VLattr_read(void *attr, hid_t driver_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) +herr_t H5VLattr_read(void *attr, hid_t plugin_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API_NOINIT if (NULL == attr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_attr_read(attr, cls, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read attribute") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_read() */ @@ -662,23 +943,23 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VLattr_write(void *attr, hid_t driver_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) +herr_t H5VLattr_write(void *attr, hid_t plugin_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API_NOINIT if (NULL == attr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_attr_write(attr, cls, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write attribute") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_write() */ @@ -694,35 +975,35 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_get(void *obj, hid_t driver_id, H5VL_attr_get_t get_type, +H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVai**xx", obj, driver_id, get_type, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVai**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr get' method") if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to get attribute information") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_get() */ /*------------------------------------------------------------------------- * Function: H5VLattr_specific * - * Purpose: Performs a driver-specific operation on an attribute + * Purpose: Performs a plugin-specific operation on an attribute * * Return: Success: Non-negative * @@ -731,37 +1012,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, +H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, driver_id, specific_type, + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVbi**xx", obj, loc_params, plugin_id, specific_type, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->attr_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr specific' method") if((ret_value = (cls->attr_cls.specific) (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_specific() */ /*------------------------------------------------------------------------- * Function: H5VLattr_optional * - * Purpose: Performs an optional driver-specific operation on an attribute + * Purpose: Performs an optional plugin-specific operation on an attribute * * Return: Success: Non-negative * @@ -770,27 +1051,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Have to bypass the H5VLint layer due to unknown val_list arguments */ if(NULL == cls->attr_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `attr optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `attr optional' method") if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_optional() */ @@ -806,24 +1087,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_close(void *attr, hid_t driver_id, hid_t dxpl_id, void **req) +H5VLattr_close(void *attr, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", attr, driver_id, dxpl_id, req); + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", attr, plugin_id, dxpl_id, req); if (NULL == attr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_attr_close(attr, cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close attribute") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_close() */ @@ -839,27 +1120,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; /* Return value */ - FUNC_ENTER_API(NULL) - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, dcpl_id, + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, dcpl_id, dapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, cls, name, dcpl_id, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create dataset") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_create() */ @@ -875,26 +1156,26 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, dapl_id, + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, dapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open dataset") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_open() */ @@ -910,27 +1191,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_read(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id, +H5VLdataset_read(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE8("e", "*xiiiii*x**x", dset, driver_id, mem_type_id, mem_space_id, + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "*xiiiii*x**x", dset, plugin_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); if (NULL == dset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_dataset_read(dset, cls, 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) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_read() */ @@ -946,27 +1227,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_write(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id, +H5VLdataset_write(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE8("e", "*xiiiii*x**x", dset, driver_id, mem_type_id, mem_space_id, + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "*xiiiii*x**x", dset, plugin_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req); if (NULL == dset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_dataset_write(dset, cls, 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) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_write() */ @@ -982,35 +1263,35 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_get(void *dset, hid_t driver_id, H5VL_dataset_get_t get_type, +H5VLdataset_get(void *dset, hid_t plugin_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVci**xx", dset, driver_id, get_type, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVci**xx", dset, plugin_id, get_type, dxpl_id, req, arguments); if (NULL == dset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset get' method") if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute dataset get callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_get() */ /*------------------------------------------------------------------------- * Function: H5VLdataset_specific * - * Purpose: Performs a driver-specific operation on a dataset + * Purpose: Performs a plugin-specific operation on a dataset * * Return: Success: Non-negative * @@ -1019,36 +1300,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_specific(void *obj, hid_t driver_id, H5VL_dataset_specific_t specific_type, +H5VLdataset_specific(void *obj, hid_t plugin_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVdi**xx", obj, driver_id, specific_type, dxpl_id, req, + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVdi**xx", obj, plugin_id, specific_type, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->dataset_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset specific' method") if((ret_value = (cls->dataset_cls.specific) (obj, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_specific() */ /*------------------------------------------------------------------------- * Function: H5VLdataset_optional * - * Purpose: Performs an optional driver-specific operation on a dataset + * Purpose: Performs an optional plugin-specific operation on a dataset * * Return: Success: Non-negative * @@ -1057,26 +1338,26 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLdataset_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->dataset_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `dataset optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `dataset optional' method") if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_optional() */ @@ -1092,24 +1373,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_close(void *dset, hid_t driver_id, hid_t dxpl_id, void **req) +H5VLdataset_close(void *dset, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", dset, driver_id, dxpl_id, req); + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", dset, plugin_id, dxpl_id, req); if (NULL == dset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_dataset_close(dset, cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close dataset") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_close() */ @@ -1129,28 +1410,28 @@ H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) { H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) + FUNC_ENTER_API_NOINIT H5TRACE6("*x", "*sIuiii**x", name, flags, fcpl_id, fapl_id, dxpl_id, req); /* get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL plugin info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLfile_create() */ @@ -1169,27 +1450,27 @@ void * H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) { H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) + FUNC_ENTER_API_NOINIT H5TRACE5("*x", "*sIuii**x", name, flags, fapl_id, dxpl_id, req); /* get the VOL info from the fapl */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get vol driver info") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL plugin info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_file_open(cls, name, flags, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLfile_open() */ @@ -1205,35 +1486,35 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_get(void *file, hid_t driver_id, H5VL_file_get_t get_type, +H5VLfile_get(void *file, hid_t plugin_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVgi**xx", file, driver_id, get_type, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVgi**xx", file, plugin_id, get_type, dxpl_id, req, arguments); if(NULL == file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file get' method") if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute file get callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLfile_get() */ /*------------------------------------------------------------------------- * Function: H5VLfile_specific * - * Purpose: Performs a driver-specific operation on a file + * Purpose: Performs a plugin-specific operation on a file * * Return: Success: Non-negative * @@ -1242,19 +1523,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_specific(void *file, hid_t driver_id, H5VL_file_specific_t specific_type, +H5VLfile_specific(void *file, hid_t plugin_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVhi**xx", file, driver_id, specific_type, dxpl_id, req, + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVhi**xx", file, plugin_id, specific_type, dxpl_id, req, arguments); if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for vol driver ID & info */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ hid_t fapl_id; fapl_id = va_arg (arguments, hid_t); @@ -1263,38 +1544,36 @@ H5VLfile_specific(void *file, hid_t driver_id, H5VL_file_specific_t specific_typ if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol driver info") + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) + if((ret_value = (cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - } + } /* end if */ else { if(NULL == file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file specific' method") - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file specific' method") + if((ret_value = (cls->file_cls.specific)(file, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file specific callback") - } + } /* end else */ done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLfile_specific() */ /*------------------------------------------------------------------------- * Function: H5VLfile_optional * - * Purpose: Performs an optional driver-specific operation on a file + * Purpose: Performs an optional plugin-specific operation on a file * * Return: Success: Non-negative * @@ -1303,26 +1582,26 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_optional(void *file, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLfile_optional(void *file, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", file, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", file, plugin_id, dxpl_id, req, arguments); if(NULL == file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `file optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `file optional' method") if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLfile_optional() */ @@ -1338,24 +1617,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_close(void *file, hid_t driver_id, hid_t dxpl_id, void **req) +H5VLfile_close(void *file, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", file, driver_id, dxpl_id, req); + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", file, plugin_id, dxpl_id, req); if(NULL == file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_file_close(file, cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close file") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLfile_close() */ @@ -1371,27 +1650,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) - H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, driver_id, name, gcpl_id, + FUNC_ENTER_API_NOINIT + H5TRACE8("*x", "*xxi*siii**x", obj, loc_params, plugin_id, name, gcpl_id, gapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_group_create(obj, loc_params, cls, name, gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_create() */ @@ -1407,27 +1686,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, gapl_id, + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, gapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_open() */ @@ -1443,35 +1722,35 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_get(void *obj, hid_t driver_id, H5VL_group_get_t get_type, +H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVii**xx", obj, driver_id, get_type, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVii**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group get' method") if((ret_value = (cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute group get callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_get() */ /*------------------------------------------------------------------------- * Function: H5VLgroup_specific * - * Purpose: Performs a driver-specific operation on a group + * Purpose: Performs a plugin-specific operation on a group * * Return: Success: Non-negative * @@ -1480,36 +1759,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_specific(void *obj, hid_t driver_id, H5VL_group_specific_t specific_type, +H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVji**xx", obj, driver_id, specific_type, dxpl_id, req, + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVji**xx", obj, plugin_id, specific_type, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group specific' method") if((ret_value = (cls->group_cls.specific) (obj, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_specific() */ /*------------------------------------------------------------------------- * Function: H5VLgroup_optional * - * Purpose: Performs an optional driver-specific operation on a group + * Purpose: Performs an optional plugin-specific operation on a group * * Return: Success: Non-negative * @@ -1518,26 +1797,26 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `group optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `group optional' method") if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_optional() */ @@ -1553,24 +1832,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_close(void *grp, hid_t driver_id, hid_t dxpl_id, void **req) +H5VLgroup_close(void *grp, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", grp, driver_id, dxpl_id, req); + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", grp, plugin_id, dxpl_id, req); if(NULL == grp) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_group_close(grp, cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close group") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_close() */ @@ -1579,6 +1858,8 @@ done: * * Purpose: Creates a hard link * + * Note: The 'obj' parameter is allowed to be NULL + * * Return: Success: Non-negative * * Failure: Negative @@ -1587,25 +1868,23 @@ done: */ herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - hid_t driver_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) + hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, driver_id, lcpl_id, + FUNC_ENTER_API_NOINIT + H5TRACE8("e", "Vk*xxiiii**x", create_type, obj, loc_params, plugin_id, lcpl_id, lapl_id, dxpl_id, req); - if(NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to create link") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLlink_create() */ @@ -1614,6 +1893,8 @@ done: * * Purpose: Copies a link to a new location * + * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL + * * Return: Success: Non-negative * * Failure: Negative @@ -1622,27 +1903,25 @@ done: */ herr_t H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, hid_t driver_id, + H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API_NOINIT H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, - driver_id, lcpl_id, lapl_id, dxpl_id, req); + plugin_id, lcpl_id, lapl_id, dxpl_id, req); - if(NULL == src_obj || NULL == dst_obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLlink_copy() */ @@ -1651,6 +1930,8 @@ done: * * Purpose: Moves a link to another location * + * Note: The 'src_obj' and 'dst_obj' parameters are allowed to be NULL + * * Return: Success: Non-negative * * Failure: Negative @@ -1659,27 +1940,25 @@ done: */ herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, hid_t driver_id, + H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API_NOINIT H5TRACE9("e", "*xx*xxiiii**x", src_obj, loc_params1, dst_obj, loc_params2, - driver_id, lcpl_id, lapl_id, dxpl_id, req); + plugin_id, lcpl_id, lapl_id, dxpl_id, req); - if(NULL == src_obj || NULL == dst_obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLlink_move() */ @@ -1695,36 +1974,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_get_t get_type, +H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVli**xx", obj, loc_params, driver_id, get_type, dxpl_id, req, + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVli**xx", obj, loc_params, plugin_id, get_type, dxpl_id, req, arguments); if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link get' method") if((ret_value = (cls->link_cls.get) (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link get callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLlink_get() */ /*------------------------------------------------------------------------- * Function: H5VLlink_specific * - * Purpose: Performs a driver-specific operation on a link + * Purpose: Performs a plugin-specific operation on a link * * Return: Success: Non-negative * @@ -1733,37 +2012,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, +H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, driver_id, specific_type, + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVmi**xx", obj, loc_params, plugin_id, specific_type, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->link_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link specific' method") if((ret_value = (cls->link_cls.specific) (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLlink_specific() */ /*------------------------------------------------------------------------- * Function: H5VLlink_optional * - * Purpose: Performs an optional driver-specific operation on a link + * Purpose: Performs an optional plugin-specific operation on a link * * Return: Success: Non-negative * @@ -1772,27 +2051,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Have to bypass the H5VLint layer due to unknown val_list arguments */ if(NULL == cls->link_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `link optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `link optional' method") if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLlink_optional() */ @@ -1808,25 +2087,25 @@ done: *------------------------------------------------------------------------- */ void * -H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t driver_id, H5I_type_t *opened_type, +H5VLobject_open(void *obj, H5VL_loc_params_t params, hid_t plugin_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) - H5TRACE6("*x", "*xxi*Iti**x", obj, params, driver_id, opened_type, dxpl_id, req); + FUNC_ENTER_API_NOINIT + H5TRACE6("*x", "*xxi*Iti**x", obj, params, plugin_id, opened_type, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_object_open(obj, params, cls, opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLobject_open() */ @@ -1842,33 +2121,33 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t driver_id1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id2, const char *dst_name, +H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t plugin_id1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls1 = NULL; H5VL_class_t *cls2 = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE12("e", "*xxi*s*xxi*siii**x", src_obj, loc_params1, driver_id1, - src_name, dst_obj, loc_params2, driver_id2, dst_name, ocpypl_id, + FUNC_ENTER_API_NOINIT + H5TRACE12("e", "*xxi*s*xxi*siii**x", src_obj, loc_params1, plugin_id1, + src_name, dst_obj, loc_params2, plugin_id2, dst_name, ocpypl_id, lcpl_id, dxpl_id, req); if(NULL == src_obj || NULL == dst_obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(driver_id1, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(driver_id2, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(plugin_id1, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + if(NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(plugin_id2, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_object_copy(src_obj, loc_params1, cls1, src_name, dst_obj, loc_params2, cls2, dst_name, ocpypl_id, lcpl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to move object") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLobject_copy() */ @@ -1884,36 +2163,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_get_t get_type, +H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVni**xx", obj, loc_params, driver_id, get_type, dxpl_id, req, + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVni**xx", obj, loc_params, plugin_id, get_type, dxpl_id, req, arguments); if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->object_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object get' method") if((ret_value = (cls->object_cls.get) (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object get callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLobject_get() */ /*------------------------------------------------------------------------- * Function: H5VLobject_specific * - * Purpose: Performs a driver-specific operation on an object + * Purpose: Performs a plugin-specific operation on an object * * Return: Success: Non-negative * @@ -1922,37 +2201,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, +H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, driver_id, specific_type, + FUNC_ENTER_API_NOINIT + H5TRACE7("e", "*xxiVoi**xx", obj, loc_params, plugin_id, specific_type, dxpl_id, req, arguments); if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object specific' method") if((ret_value = (cls->object_cls.specific) (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object specific callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLobject_specific() */ /*------------------------------------------------------------------------- * Function: H5VLobject_optional * - * Purpose: Performs an optional driver-specific operation on an object + * Purpose: Performs an optional plugin-specific operation on an object * * Return: Success: Non-negative * @@ -1961,27 +2240,27 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Have to bypass the H5VLint layer due to unknown val_list arguments */ if(NULL == cls->object_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `object optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `object optional' method") if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLobject_optional() */ @@ -1997,27 +2276,27 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) - H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, driver_id, name, type_id, + FUNC_ENTER_API_NOINIT + H5TRACE10("*x", "*xxi*siiiii**x", obj, loc_params, plugin_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to commit datatype") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdatatype_commit() */ @@ -2033,34 +2312,34 @@ done: *------------------------------------------------------------------------- */ void * -H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, +H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; void *ret_value = NULL; - FUNC_ENTER_API(NULL) - H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, driver_id, name, tapl_id, + FUNC_ENTER_API_NOINIT + H5TRACE7("*x", "*xxi*sii**x", obj, loc_params, plugin_id, name, tapl_id, dxpl_id, req); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL plugin ID") if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open datatype") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdatatype_open() */ /*------------------------------------------------------------------------- * Function: H5VLdatatype_specific * - * Purpose: Performs a driver-specific operation on a datatype + * Purpose: Performs a plugin-specific operation on a datatype * * Return: Success: Non-negative * @@ -2069,36 +2348,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_specific(void *obj, hid_t driver_id, H5VL_datatype_specific_t specific_type, +H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVfi**xx", obj, driver_id, specific_type, dxpl_id, req, + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVfi**xx", obj, plugin_id, specific_type, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype specific' method") if((ret_value = (cls->datatype_cls.specific) (obj, specific_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdatatype_specific() */ /*------------------------------------------------------------------------- * Function: H5VLdatatype_optional * - * Purpose: Performs an optional driver-specific operation on a datatype + * Purpose: Performs an optional plugin-specific operation on a datatype * * Return: Success: Non-negative * @@ -2107,26 +2386,26 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments) +H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xii**xx", obj, driver_id, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE5("e", "*xii**xx", obj, plugin_id, dxpl_id, req, arguments); if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if(NULL == cls->datatype_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype optional' method") if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdatatype_optional() */ @@ -2142,28 +2421,28 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_get(void *obj, hid_t driver_id, H5VL_datatype_get_t get_type, +H5VLdatatype_get(void *obj, hid_t plugin_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xiVei**xx", obj, driver_id, get_type, dxpl_id, req, arguments); + FUNC_ENTER_API_NOINIT + H5TRACE6("e", "*xiVei**xx", obj, plugin_id, get_type, dxpl_id, req, arguments); if(NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") /* Bypass the H5VLint layer */ if(NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol driver has no `datatype get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no `datatype get' method") if((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute datatype get callback") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdatatype_get() */ @@ -2179,24 +2458,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_close(void *dt, hid_t driver_id, hid_t dxpl_id, void **req) +H5VLdatatype_close(void *dt, hid_t plugin_id, hid_t dxpl_id, void **req) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE4("e", "*xii**x", dt, driver_id, dxpl_id, req); + FUNC_ENTER_API_NOINIT + H5TRACE4("e", "*xii**x", dt, plugin_id, dxpl_id, req); if (NULL == dt) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if((ret_value = H5VL_datatype_close(dt, cls, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close datatype") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdatatype_close() */ @@ -2212,22 +2491,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_cancel(void **req, hid_t driver_id, H5ES_status_t *status) +H5VLrequest_cancel(void **req, hid_t plugin_id, H5ES_status_t *status) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE3("e", "**xi*Es", req, driver_id, status); + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "**xi*Es", req, plugin_id, status); - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if ((ret_value = H5VL_request_cancel(req, cls, status)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLrequest_cancel() */ @@ -2243,22 +2522,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_test(void **req, hid_t driver_id, H5ES_status_t *status) +H5VLrequest_test(void **req, hid_t plugin_id, H5ES_status_t *status) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE3("e", "**xi*Es", req, driver_id, status); + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "**xi*Es", req, plugin_id, status); - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if ((ret_value = H5VL_request_test(req, cls, status)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to test request") done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLrequest_test() */ @@ -2274,23 +2553,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_wait(void **req, hid_t driver_id, H5ES_status_t *status) +H5VLrequest_wait(void **req, hid_t plugin_id, H5ES_status_t *status) { H5VL_class_t *cls = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_API(FAIL) - H5TRACE3("e", "**xi*Es", req, driver_id, status); + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "**xi*Es", req, plugin_id, status); - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") if ((ret_value = H5VL_request_wait(req, cls, status)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") - done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLrequest_wait() */ - diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c new file mode 100644 index 0000000..d7c1f5a --- /dev/null +++ b/src/H5VLcallback.c @@ -0,0 +1,1890 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The Virtual Object Layer as described in documentation. + * The pupose is to provide an abstraction on how to access the + * underlying HDF5 container, whether in a local file with + * a specific file format, or remotely on other machines, etc... + */ + + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5VLmodule.h" /* This source code file is part of the H5VL module */ + + +/***********/ +/* Headers */ +/***********/ + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VLpkg.h" /* Virtual Object Layer */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5VL_copy_plugin_info + * + * Purpose: Copy the VOL info for a plugin + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_copy_plugin_info(const H5VL_class_t *plugin, void **dst_info, + const void *src_info) +{ + void *new_plugin_info = NULL; /* Copy of plugin info */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(plugin); + + /* Check for actual source info */ + if(src_info) { + /* Allow the plugin to copy or do it ourselves */ + if(plugin->info_copy) { + if(NULL == (new_plugin_info = (plugin->info_copy)(src_info))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "plugin info copy callback failed") + } /* end if */ + else if(plugin->info_size > 0) { + if(NULL == (new_plugin_info = H5MM_malloc(plugin->info_size))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "plugin info allocation failed") + HDmemcpy(new_plugin_info, src_info, plugin->info_size); + } /* end else-if */ + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy plugin info") + } /* end if */ + + /* Set the plugin info for the copy */ + *dst_info = new_plugin_info; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_copy_plugin_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_cmp_plugin_info + * + * Purpose: Compare VOL info for a plugin + * + * Return: Positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + *------------------------------------------------------------------------- + */ +int +H5VL_cmp_plugin_info(const H5VL_class_t *plugin, const void *info1, + const void *info2) +{ + int cmp_value; /* Value from comparison */ + int ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(plugin); + + /* Use the class's info comparison routine to compare the info objects, + * if there is a a callback, otherwise just compare the info objects as + * memory buffers + */ + if(plugin->info_cmp) { + if(0 != (cmp_value = (plugin->info_cmp)(info1, info2))) + HGOTO_DONE(cmp_value); + } /* end if */ + else { + if(info1 == NULL && info2 != NULL) + HGOTO_DONE(-1); + if(info1 != NULL && info2 == NULL) + HGOTO_DONE(1); + if(info1) { + HDassert(plugin->info_size > 0); + if(0 != (cmp_value = HDmemcmp(info1, info2, plugin->info_size))) + HGOTO_DONE(cmp_value); + } /* end if */ + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_cmp_plugin_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_plugin_info + * + * Purpose: Free VOL info for a plugin + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_free_plugin_info(const H5VL_class_t *plugin, void *info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(plugin); + + /* Only free info object, if it's non-NULL */ + if(info) { + /* Allow the plugin to free info or do it ourselves */ + if(plugin->info_free) { + if((plugin->info_free)(info) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "plugin info free request failed") + } /* end if */ + else + H5MM_xfree(info); + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_plugin_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_get_wrap_ctx + * + * Purpose: Retrieve the VOL object wrapping context for a plugin + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_get_wrap_ctx(const H5VL_class_t *plugin, void *obj, void **wrap_ctx) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(plugin); + HDassert(obj); + HDassert(wrap_ctx); + + /* Allow the plugin to copy or do it ourselves */ + if(plugin->get_wrap_ctx) { + /* Sanity check */ + HDassert(plugin->free_wrap_ctx); + + /* Invoke plugin's callback */ + if((plugin->get_wrap_ctx)(obj, wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "plugin wrap context callback failed") + } /* end if */ + else + *wrap_ctx = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_get_wrap_ctx() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_free_wrap_ctx + * + * Purpose: Free object wrapping context for a plugin + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_free_wrap_ctx(const H5VL_class_t *plugin, void *wrap_ctx) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(plugin); + + /* Only free wrap context, if it's non-NULL */ + if(wrap_ctx) { + /* Free the plugin's object wrapping context */ + if((plugin->free_wrap_ctx)(wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "plugin wrap context free request failed") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_free_plugin_info() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_wrap_object + * + * Purpose: Wrap an object with plugin + * + * Return: SUCCEED / FAIL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_wrap_object(const H5VL_class_t *plugin, void *wrap_ctx, void *obj) +{ + void *ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* Sanity checks */ + HDassert(plugin); + HDassert(obj); + + /* Only wrap object if there's a wrap context */ + if(wrap_ctx) { + /* Ask the plugin to wrap the object */ + if(NULL == (ret_value = (plugin->wrap_object)(obj, wrap_ctx))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") + } /* end if */ + else + ret_value = obj; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_wrap_object() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_create + * + * Purpose: Creates an attribute through the VOL + * + * Return: Success: pointer to the new attribute + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if (NULL == cls->attr_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'attr create' method") + + /* call the corresponding VOL create callback */ + if (NULL == (ret_value = (cls->attr_cls.create) + (obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_open + * + * Purpose: Opens an attribute through the VOL + * + * Return: Success: pointer to the new attr. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t aapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the type specific corresponding VOL open callback exists */ + if(NULL == cls->attr_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'attr open' method") + + /* call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->attr_cls.open) + (obj, loc_params, name, aapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_read + * + * Purpose: Reads data from attr through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t H5VL_attr_read(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, + hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.read) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr read' method") + if((ret_value = (cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_write + * + * Purpose: Writes data to attr through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t H5VL_attr_write(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, + hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.write) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr write' method") + if((ret_value = (cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_get + * + * Purpose: Get specific information about the attribute through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr get' method") + + va_start (arguments, req); + if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_specific + * + * Purpose: specific operation on attributes through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr specific' method") + + va_start (arguments, req); + if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->attr_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr optional' method") + + va_start (arguments, req); + if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_attr_close + * + * Purpose: Closes an attribute through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + HDassert(attr); + HDassert(cls); + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->attr_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'attr close' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->attr_cls.close)(attr, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_attr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_create + * + * Purpose: Creates a dataset through the VOL + * + * Return: Success: pointer to dataset + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->dataset_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'dataset create' method") + + /* call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->dataset_cls.create) + (obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_open + * + * Purpose: Opens a dataset through the VOL + * + * Return: Success: pointer to dataset + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t dapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the type specific corresponding VOL open callback exists */ + if(NULL == cls->dataset_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'dset open' method") + + /* call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->dataset_cls.open) + (obj, loc_params, name, dapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_read + * + * Purpose: Reads data from dataset through the VOL +* + * Return: Success: Non Negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, + hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, + void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.read) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset read' method") + if((ret_value = (cls->dataset_cls.read)(dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "read failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_read() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_write + * + * Purpose: Writes data from dataset through the VOL + * + * Return: Success: Non Negative + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.write) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset write' method") + if((ret_value = (cls->dataset_cls.write) + (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_write() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_get + * + * Purpose: Get specific information about the dataset through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset get' method") + + va_start (arguments, req); + if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_specific + * + * Purpose: specific operation on datasets through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset specific' method") + + va_start (arguments, req); + if((ret_value = (cls->dataset_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->dataset_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dataset optional' method") + + va_start (arguments, req); + if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_close + * + * Purpose: Closes a dataset through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(dset); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->dataset_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'dset close' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->dataset_cls.close)(dset, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + +done: + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_create + * + * Purpose: Creates a file through the VOL + * + * Return: Success: pointer to file. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +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 */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->file_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'file create' method") + /* call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_open + * + * Purpose: Opens a file through the VOL. + * + * 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) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->file_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'file open' method") + /* call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_get + * + * Purpose: Get specific information about the file through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->file_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file get' method") + + va_start(arguments, req); + if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end(arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_specific + * + * Purpose: perform File specific operations through the VOL + * + * Return: Success: non negative + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + H5P_genplist_t *plist; /* Property list pointer */ + H5VL_plugin_prop_t plugin_prop; /* Property for VOL plugin ID & info */ + va_list tmp_args; /* argument list passed from the API call */ + hid_t fapl_id; + + va_start (tmp_args, req); + fapl_id = va_arg (tmp_args, hid_t); + va_end (tmp_args); + + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + + if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &plugin_prop) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL plugin info") + + if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_prop.plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL plugin ID") + + va_start (arguments, req); + if((ret_value = (cls->file_cls.specific) + (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") + va_end (arguments); + } + else { + if(NULL == cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file specific' method") + + va_start (arguments, req); + if((ret_value = (cls->file_cls.specific) + (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") + va_end (arguments); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_optional + * + * Purpose: perform a plugin specific operation + * + * Return: Success: non negative + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_optional(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->file_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file optional' method") + + va_start (arguments, req); + if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "optional failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_file_close + * + * Purpose: Closes a file through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(file); + HDassert(cls); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->file_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'file close' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->file_cls.close)(file, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_file_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_create + * + * Purpose: Creates a group through the VOL + * + * Return: Success: pointer to new group. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->group_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'group create' method") + + /* call the corresponding VOL create callback */ + if(NULL == (ret_value = (cls->group_cls.create) + (obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_open + * + * Purpose: Opens a group through the VOL + * + * Return: Success: pointer to new group. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t gapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + if(NULL == cls->group_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'group open' method") + + if(NULL == (ret_value = (cls->group_cls.open) + (obj, loc_params, name, gapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_get + * + * Purpose: Get specific information about the group through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->group_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group get' method") + + va_start (arguments, req); + if((ret_value = (cls->group_cls.get) + (obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_specific + * + * Purpose: specific operation on groups through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->group_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group specific' method") + + va_start (arguments, req); + if((ret_value = (cls->group_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->group_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group optional' method") + + va_start (arguments, req); + if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_group_close + * + * Purpose: Closes a group through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + HDassert(grp); + HDassert(cls); + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->group_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'group close' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->group_cls.close)(grp, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_group_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_create + * + * Purpose: Creates a hard link through the VOL + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, + const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check if the corresponding VOL create callback exists */ + if(NULL == cls->link_cls.create) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link create' method") + /* call the corresponding VOL create callback */ + if((ret_value = (cls->link_cls.create) + (create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link create failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_copy + * + * Purpose: Copys a link from src to dst. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check if the corresponding VOL copy callback exists */ + if(NULL == cls->link_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link copy' method") + + /* call the corresponding VOL copy callback */ + if((ret_value = (cls->link_cls.copy) + (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, + lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link copy failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_move + * + * Purpose: Moves a link from src to dst. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* check if the corresponding VOL move callback exists */ + if(NULL == cls->link_cls.move) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link move' method") + + /* call the corresponding VOL move callback */ + if((ret_value = (cls->link_cls.move) + (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, + lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link move failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_move() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_get + * + * Purpose: Get specific information about the link through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->link_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link get' method") + + va_start (arguments, req); + if((ret_value = (cls->link_cls.get) + (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_specific + * + * Purpose: specific operation on links through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->link_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link specific' method") + + va_start (arguments, req); + if((ret_value = (cls->link_cls.specific) + (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_link_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->link_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'link optional' method") + + va_start (arguments, req); + if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_open + * + * Purpose: Opens a object through the VOL + * + * Return: Success: User ID of the new object. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type, + hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL open callback exists */ + if(NULL == 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 = (cls->object_cls.open) + (obj, params, opened_type, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_copy + * + * Purpose: Copies an object to another destination through the VOL + * + * Return: Success: Non Negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Make sure that the VOL plugins are the same */ + if (cls1->value != cls2->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL plugins and can't be linked") + + if(NULL == cls1->object_cls.copy) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object copy' method") + + if((ret_value = (cls1->object_cls.copy) + (src_obj, loc_params1, src_name, dst_obj, loc_params2, dst_name, ocpypl_id, + lcpl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "copy failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_get + * + * Purpose: Get specific information about the object through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->object_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object get' method") + + va_start (arguments, req); + if((ret_value = (cls->object_cls.get) + (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_specific + * + * Purpose: specific operation on objects through the VOL + * + * Return: Success: non negative + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object specific' method") + + va_start (arguments, req); + if((ret_value = (cls->object_cls.specific) + (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_object_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->object_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'object optional' method") + + va_start (arguments, req); + if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_object_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_commit + * + * Purpose: Commits a datatype to the file through the VOL + * + * Return: Success: Positive + * + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +void * +H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, + hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the corresponding VOL commit callback exists */ + if(NULL == cls->datatype_cls.commit) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL plugin has no 'datatype commit' method") + + /* call the corresponding VOL commit callback */ + if(NULL == (ret_value = (cls->datatype_cls.commit) + (obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "commit failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_commit() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_open + * + * Purpose: Opens a named datatype through the VOL + * + * Return: Success: User ID of the datatype. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, + hid_t tapl_id, hid_t dxpl_id, void **req) +{ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check if the type specific corresponding VOL open callback exists */ + if(NULL == cls->datatype_cls.open) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback") + + /* call the corresponding VOL open callback */ + if(NULL == (ret_value = (cls->datatype_cls.open) + (obj, loc_params, name, tapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_get + * + * Purpose: Get specific information about the datatype through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype get' method") + va_start (arguments, req); + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_specific + * + * Purpose: specific operation on datatypes through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->datatype_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype specific' method") + + va_start (arguments, req); + if((ret_value = (cls->datatype_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +{ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + if(NULL == cls->datatype_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype optional' method") + + va_start (arguments, req); + if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") + va_end (arguments); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_optional() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_datatype_close + * + * Purpose: Closes a datatype through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->datatype_cls.close) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'datatype close' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->datatype_cls.close)(dt, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_cancel + * + * Purpose: Cancels an asynchronous request through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(req); + HDassert(cls); + HDassert(status); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->async_cls.cancel) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async cancel' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->async_cls.cancel)(req, status)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_cancel() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_test + * + * Purpose: Tests an asynchronous request through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(req); + HDassert(cls); + HDassert(status); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->async_cls.test) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async test' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->async_cls.test)(req, status)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request test failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_test() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_request_wait + * + * Purpose: Waits on an asychronous request through the VOL + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(req); + HDassert(cls); + HDassert(status); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->async_cls.wait) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL plugin has no 'async wait' method") + + /* Call the corresponding VOL callback */ + if ((ret_value = (cls->async_cls.wait)(req, status)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_request_wait() */ + + diff --git a/src/H5VLint.c b/src/H5VLint.c index 78ba6d9..fcc7fa7 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -30,11 +30,11 @@ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ #include "H5Tprivate.h" /* Datatypes */ #include "H5VLpkg.h" /* Virtual Object Layer */ @@ -47,6 +47,13 @@ /* Local Typedefs */ /******************/ +/* Object wrapping context info */ +typedef struct H5VL_wrap_ctx_t { + const H5VL_t *plugin; /* VOL plugin for "outermost" class to start wrap */ + void *obj_wrap_ctx; /* "wrap context" for outermost plugin */ +} H5VL_wrap_ctx_t; + + /********************/ /* Package Typedefs */ /********************/ @@ -54,8 +61,8 @@ /********************/ /* Local Prototypes */ /********************/ - -static herr_t H5VL_free_cls(H5VL_class_t *cls); +static herr_t H5VL__free_cls(H5VL_class_t *cls); +static void *H5VL__object(hid_t id, H5I_type_t obj_type); /*********************/ /* Package Variables */ @@ -77,15 +84,22 @@ static const H5I_class_t H5I_VOL_CLS[1] = {{ H5I_VOL, /* ID class value */ 0, /* Class flags */ 0, /* # of reserved IDs for class */ - (H5I_free_t)H5VL_free_cls /* Callback routine for closing objects of this class */ + (H5I_free_t)H5VL__free_cls /* Callback routine for closing objects of this class */ }}; +/* Declare a free list to manage the H5VL_class_t struct */ +H5FL_DEFINE_STATIC(H5VL_class_t); + /* Declare a free list to manage the H5VL_t struct */ H5FL_DEFINE(H5VL_t); /* Declare a free list to manage the H5VL_object_t struct */ H5FL_DEFINE(H5VL_object_t); +/* Declare a free list to manage the H5VL_wrap_ctx_t struct */ +H5FL_DEFINE_STATIC(H5VL_wrap_ctx_t); + + /*------------------------------------------------------------------------- * Function: H5VL_init @@ -132,7 +146,7 @@ H5VL__init_package(void) /* Initialize the atom group for the VL IDs */ if (H5I_register_type(H5I_VOL_CLS) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface"); + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface") done: FUNC_LEAVE_NOAPI(ret_value) @@ -163,7 +177,7 @@ H5VL_term_package(void) n++; } else { - /* Destroy the VOL driver ID group */ + /* Destroy the VOL plugin ID group */ n += (H5I_dec_type_ref(H5I_VOL) > 0); /* Mark interface as closed */ @@ -177,7 +191,7 @@ H5VL_term_package(void) /*------------------------------------------------------------------------- - * Function: H5VL_free_cls + * Function: H5VL__free_cls * * Purpose: Frees a file VOL class struct and returns an indication of * success. This function is used as the free callback for the @@ -189,34 +203,32 @@ H5VL_term_package(void) *------------------------------------------------------------------------- */ static herr_t -H5VL_free_cls(H5VL_class_t *cls) +H5VL__free_cls(H5VL_class_t *cls) { herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Sanity check */ HDassert(cls); - /* XXX: Need to retrieve the VOL termination property list for the - * terminate operation - JTH - */ - if (cls->terminate && cls->terminate(H5P_DEFAULT) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL driver did not terminate cleanly"); + /* Shut down the VOL plugin */ + if(cls->terminate && cls->terminate() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL plugin did not terminate cleanly") /* XXX (VOL MERGE): We'll leak memory if the name string was dynamically allocated. */ - H5MM_xfree(cls); + H5FL_FREE(H5VL_class_t, cls); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_free_cls() */ +} /* end H5VL__free_cls() */ /*------------------------------------------------------------------------- * Function: H5VL_register_id * * Purpose: Wrapper to register an object ID with a VOL aux struct - * and increment ref count on VOL driver ID + * and increment ref count on VOL plugin ID * * Return: Success: A valid HDF5 ID * Failure: H5I_INVALID_HID @@ -224,7 +236,7 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref) +H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref) { H5VL_object_t *new_obj = NULL; hid_t ret_value = H5I_INVALID_HID; @@ -233,30 +245,33 @@ H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ /* Check arguments */ HDassert(object); - HDassert(vol_driver); + HDassert(vol_plugin); - /* setup VOL object */ + /* Setup VOL object */ if (NULL == (new_obj = H5FL_CALLOC(H5VL_object_t))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate top object structure"); - new_obj->driver = vol_driver; + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate top object structure") + new_obj->plugin = vol_plugin; new_obj->data = object; - vol_driver->nrefs++; + /* Increment ref count, for new object */ + vol_plugin->nrefs++; + /* Special wrapper for named datatypes */ if (H5I_DATATYPE == type) { + H5T_t *dt; - H5T_t *dt = NULL; - + /* Wrap "real" (non-named) datatype around VOL object, so it's compatible with H5T interface */ if (NULL == (dt = H5T_construct_datatype(new_obj))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "can't construct datatype object"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "can't construct datatype object") - if ((ret_value = H5I_register(type, dt, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle"); - } - else { - if ((ret_value = H5I_register(type, new_obj, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle"); - } + /* New object is _actually_ the datatype */ + new_obj = (H5VL_object_t *)dt; + } /* end if */ + + /* Register VOL object as _object_ type, for future object API calls */ + /* (Except for named datatypes, as above) */ + if ((ret_value = H5I_register(type, new_obj, app_ref)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize handle") done: FUNC_LEAVE_NOAPI(ret_value) @@ -267,7 +282,7 @@ done: * Function: H5VL_free_object * * Purpose: Wrapper to unregister an object ID with a VOL aux struct - * and decrement ref count on VOL driver ID + * and decrement ref count on VOL plugin ID * * Return: SUCCEED/FAIL * @@ -283,13 +298,13 @@ H5VL_free_object(H5VL_object_t *vol_obj) /* Check arguments */ HDassert(vol_obj); - vol_obj->driver->nrefs --; + vol_obj->plugin->nrefs --; - if (0 == vol_obj->driver->nrefs) { - if (H5I_dec_ref(vol_obj->driver->id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL driver"); - vol_obj->driver = H5FL_FREE(H5VL_t, vol_obj->driver); - } + if(0 == vol_obj->plugin->nrefs) { + if(H5I_dec_ref(vol_obj->plugin->id) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") + vol_obj->plugin = H5FL_FREE(H5VL_t, vol_obj->plugin); + } /* end if */ vol_obj = H5FL_FREE(H5VL_object_t, vol_obj); @@ -301,18 +316,18 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_register * - * Purpose: Registers a new VOL driver as a member of the virtual object + * Purpose: Registers a new VOL plugin as a member of the virtual object * layer class. * - * Return: Success: A VOL driver ID which is good until the - * library is closed or the driver is unregistered. + * Return: Success: A VOL plugin ID which is good until the + * library is closed or the plugin is unregistered. * * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VL_register(const void *_cls, size_t size, hbool_t app_ref) +H5VL_register(const void *_cls, hbool_t app_ref, hid_t vipl_id) { const H5VL_class_t *cls = (const H5VL_class_t *)_cls; H5VL_class_t *saved = NULL; @@ -324,18 +339,22 @@ H5VL_register(const void *_cls, size_t size, hbool_t app_ref) HDassert(cls); /* Copy the class structure so the caller can reuse or free it */ - if (NULL == (saved = (H5VL_class_t *)H5MM_calloc(size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for VOL driver class struct"); - HDmemcpy(saved, cls, size); + if (NULL == (saved = H5FL_CALLOC(H5VL_class_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed for VOL plugin class struct") + HDmemcpy(saved, cls, sizeof(H5VL_class_t)); + + /* Initialize the VOL plugin */ + if(cls->initialize && cls->initialize(vipl_id) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL plugin") /* Create the new class ID */ if ((ret_value = H5I_register(H5I_VOL, saved, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL driver ID"); + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL plugin ID") done: if (ret_value < 0) if (saved) - H5MM_xfree(saved); + H5FL_FREE(H5VL_class_t, saved); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_register() */ @@ -353,28 +372,28 @@ done: *------------------------------------------------------------------------- */ hid_t -H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t driver_id, hbool_t app_ref) +H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t plugin_id, hbool_t app_ref) { H5VL_class_t *cls = NULL; - H5VL_t *driver = NULL; /* VOL driver struct */ + H5VL_t *plugin = NULL; /* VOL plugin struct */ hid_t ret_value = H5I_INVALID_HID; FUNC_ENTER_NOAPI(FAIL) - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL driver ID"); + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(plugin_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL plugin ID") /* Setup VOL info struct */ - if (NULL == (driver = H5FL_CALLOC(H5VL_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VOL info struct"); - driver->cls = cls; - driver->id = driver_id; - if (H5I_inc_ref(driver->id, FALSE) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL driver"); + if (NULL == (plugin = H5FL_CALLOC(H5VL_t))) + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, H5I_INVALID_HID, "can't allocate VOL info struct") + plugin->cls = cls; + plugin->id = plugin_id; + if (H5I_inc_ref(plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL plugin") /* Get an ID for the VOL object */ - if ((ret_value = H5VL_register_id(obj_type, obj, driver, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); + if ((ret_value = H5VL_register_id(obj_type, obj, plugin, app_ref)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") done: FUNC_LEAVE_NOAPI(ret_value) @@ -382,17 +401,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_get_driver_name + * Function: H5VL_get_plugin_name * - * Purpose: Private version of H5VLget_driver_name + * Purpose: Private version of H5VLget_plugin_name * - * Return: Success: The length of the driver name + * Return: Success: The length of the plugin name * Failure: Negative * *------------------------------------------------------------------------- */ ssize_t -H5VL_get_driver_name(hid_t id, char *name /*out*/, size_t size) +H5VL_get_plugin_name(hid_t id, char *name /*out*/, size_t size) { H5VL_object_t *vol_obj = NULL; const H5VL_class_t *cls = NULL; @@ -403,23 +422,23 @@ H5VL_get_driver_name(hid_t id, char *name /*out*/, size_t size) /* get the object pointer */ if (NULL == (vol_obj = H5VL_get_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - cls = vol_obj->driver->cls; + cls = vol_obj->plugin->cls; len = HDstrlen(cls->name); - if (name) { - HDstrncpy(name, cls->name, MIN(len + 1,size)); - if (len >= size) - name[size-1]='\0'; - } + if(name) { + HDstrncpy(name, cls->name, MIN(len + 1, size)); + if(len >= size) + name[size - 1] = '\0'; + } /* end if */ /* Set the return value for the API call */ ret_value = (ssize_t)len; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_get_driver_name() */ +} /* end H5VL_get_plugin_name() */ /*------------------------------------------------------------------------- @@ -439,145 +458,105 @@ H5VL_object_t * H5VL_get_object(hid_t id) { void *obj = NULL; - H5I_type_t obj_type = H5I_get_type(id); + H5I_type_t obj_type; H5VL_object_t *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) + obj_type = H5I_get_type(id); if (H5I_FILE == obj_type || H5I_GROUP == obj_type || H5I_ATTR == obj_type || - H5I_DATASET == obj_type || H5I_DATATYPE == obj_type) { - /* get the object */ + H5I_DATASET == obj_type || H5I_DATATYPE == obj_type) { + /* Get the object */ if (NULL == (obj = H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") /* if this is a datatype, get the VOL object attached to the H5T_t struct */ - if (H5I_DATATYPE == obj_type) { + if (H5I_DATATYPE == obj_type) if (NULL == (obj = H5T_get_named_type((H5T_t *)obj))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); - } - } + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype") + } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function"); - + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function") ret_value = (H5VL_object_t *)obj; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_get_object() */ /*------------------------------------------------------------------------- - * Function: H5VL_object + * Function: H5VL_object_data * - * Purpose: Utility function to return the VOL object pointer associated with - * a hid_t. + * Purpose: Correctly retrieve the 'data' field for a VOL object (H5VL_object), + * even for nested / stacked VOL plugins. * - * Return: Success: object pointer - * Failure: NULL + * Return: Success: object pointer + * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_object(hid_t id) +H5VL_object_data(const H5VL_object_t *vol_obj) { - H5VL_object_t *vol_obj = NULL; - void *ret_value = NULL; + void *ret_value = NULL; - FUNC_ENTER_NOAPI(NULL) - - /* Get the symbol table entry */ - switch (H5I_get_type(id)) { - case H5I_GROUP: - case H5I_DATASET: - case H5I_FILE: - case H5I_ATTR: - /* get the object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); - - ret_value = vol_obj->data; - break; - case H5I_DATATYPE: - { - H5T_t *dt = NULL; - - /* get the object */ - if (NULL == (dt = (H5T_t *)H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Get the actual datatype object that should be the vol_obj */ - if (NULL == (vol_obj = H5T_get_named_type(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); + /* Check for 'get_object' callback in plugin */ + if(vol_obj->plugin->cls->get_object) + ret_value = (vol_obj->plugin->cls->get_object)(vol_obj->data); + else + ret_value = vol_obj->data; - ret_value = vol_obj->data; - break; - } - case H5I_UNINIT: - case H5I_BADID: - case H5I_DATASPACE: - case H5I_REFERENCE: - case H5I_VFL: - case H5I_VOL: - case H5I_GENPROP_CLS: - case H5I_GENPROP_LST: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type"); - } -done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object() */ +} /* end H5VL_object_data() */ /*------------------------------------------------------------------------- - * Function: H5VL_object_verify + * Function: H5VL__object * - * Purpose: Utility function to return the VOL object pointer associated - * with an identifier. + * Purpose: Internal function to return the VOL object pointer associated + * with an hid_t. * * Return: Success: object pointer * Failure: NULL * *------------------------------------------------------------------------- */ -void * -H5VL_object_verify(hid_t id, H5I_type_t obj_type) +static void * +H5VL__object(hid_t id, H5I_type_t obj_type) { H5VL_object_t *vol_obj = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_STATIC - /* Get the symbol table entry */ - switch (obj_type) { + /* Get the underlying object */ + switch(obj_type) { case H5I_GROUP: case H5I_DATASET: case H5I_FILE: case H5I_ATTR: /* get the object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(id, obj_type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); - - ret_value = vol_obj->data; + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") break; + case H5I_DATATYPE: { H5T_t *dt = NULL; /* get the object */ - if (NULL == (dt = (H5T_t *)H5I_object_verify(id, obj_type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); + if (NULL == (dt = (H5T_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") /* Get the actual datatype object that should be the vol_obj */ if (NULL == (vol_obj = H5T_get_named_type(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); - - ret_value = vol_obj->data; + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype") break; } + case H5I_UNINIT: case H5I_BADID: case H5I_DATASPACE: @@ -592,1601 +571,276 @@ H5VL_object_verify(hid_t id, H5I_type_t obj_type) case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type") - } -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_verify() */ - - -/* XXX (VOL MERGE): This could be a macro like in H5F */ -void * -H5VL_driver_object(H5VL_object_t *vol_obj) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - FUNC_LEAVE_NOAPI(vol_obj->data) -} /* end H5VL_driver_object() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_create - * - * Purpose: Creates an attribute through the VOL - * - * Return: Success: pointer to the new attribute - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL create callback exists */ - if (NULL == cls->attr_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'attr create' method") - - /* call the corresponding VOL create callback */ - if (NULL == (ret_value = (cls->attr_cls.create) - (obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_open - * - * Purpose: Opens an attribute through the VOL - * - * Return: Success: pointer to the new attr. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t aapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the type specific corresponding VOL open callback exists */ - if(NULL == cls->attr_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'attr open' method") - - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->attr_cls.open) - (obj, loc_params, name, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_read - * - * Purpose: Reads data from attr through the VOL - * - * Return: Success: Non Negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t H5VL_attr_read(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, - hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->attr_cls.read) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr read' method") - if((ret_value = (cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "read failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_read() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_write - * - * Purpose: Writes data to attr through the VOL - * - * Return: Success: Non Negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t H5VL_attr_write(void *attr, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, - hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->attr_cls.write) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr write' method") - if((ret_value = (cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "write failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_write() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_get - * - * Purpose: Get specific information about the attribute through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr get' method") - - va_start (arguments, req); - if((ret_value = (cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_specific - * - * Purpose: specific operation on attributes through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, - H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->attr_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr specific' method") - - va_start (arguments, req); - if((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_attr_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->attr_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr optional' method") - - va_start (arguments, req); - if((ret_value = (cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_attr_close - * - * Purpose: Closes an attribute through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_attr_close(void *attr, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - HDassert(attr); - HDassert(cls); - - FUNC_ENTER_NOAPI(FAIL) - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->attr_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'attr close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->attr_cls.close)(attr, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_attr_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_create - * - * Purpose: Creates a dataset through the VOL - * - * Return: Success: pointer to dataset - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->dataset_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'dataset create' method") - - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->dataset_cls.create) - (obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_open - * - * Purpose: Opens a dataset through the VOL - * - * Return: Success: pointer to dataset - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t dapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the type specific corresponding VOL open callback exists */ - if(NULL == cls->dataset_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'dset open' method") - - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->dataset_cls.open) - (obj, loc_params, name, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_read - * - * Purpose: Reads data from dataset through the VOL -* - * Return: Success: Non Negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, void *buf, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->dataset_cls.read) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset read' method") - if((ret_value = (cls->dataset_cls.read) - (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "read failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_read() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_write - * - * Purpose: Writes data from dataset through the VOL - * - * Return: Success: Non Negative - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_write(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->dataset_cls.write) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset write' method") - if((ret_value = (cls->dataset_cls.write) - (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_write() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_get - * - * Purpose: Get specific information about the dataset through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_get(void *dset, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset get' method") - - va_start (arguments, req); - if((ret_value = (cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_specific - * - * Purpose: specific operation on datasets through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->dataset_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset specific' method") - - va_start (arguments, req); - if((ret_value = (cls->dataset_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->dataset_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dataset optional' method") - - va_start (arguments, req); - if((ret_value = (cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_dataset_close - * - * Purpose: Closes a dataset through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_dataset_close(void *dset, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(dset); - HDassert(cls); - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->dataset_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'dset close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->dataset_cls.close)(dset, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); - -done: - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_dataset_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_create - * - * Purpose: Creates a file through the VOL - * - * Return: Success: pointer to file. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -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 */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->file_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'file create' method") - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_open - * - * Purpose: Opens a file through the VOL. - * - * 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) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->file_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'file open' method") - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_get - * - * Purpose: Get specific information about the file through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_file_get(void *file, const H5VL_class_t *cls, H5VL_file_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file get' method") - - va_start(arguments, req); - if((ret_value = (cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end(arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_specific - * - * Purpose: perform File specific operations through the VOL - * - * Return: Success: non negative - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_file_specific(void *file, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { - H5P_genplist_t *plist; /* Property list pointer */ - H5VL_driver_prop_t driver_prop; /* Property for VOL driver ID & info */ - va_list tmp_args; /* argument list passed from the API call */ - hid_t fapl_id; - - va_start (tmp_args, req); - fapl_id = va_arg (tmp_args, hid_t); - va_end (tmp_args); - - /* get the VOL info from the fapl */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - - if(H5P_peek(plist, H5F_ACS_VOL_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL driver info") - - if(NULL == (cls = (H5VL_class_t *)H5I_object_verify(driver_prop.driver_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL driver ID") - - va_start (arguments, req); - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - va_end (arguments); - } - else { - if(NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file specific' method") - - va_start (arguments, req); - if((ret_value = (cls->file_cls.specific) - (file, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - va_end (arguments); - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_file_optional - * - * Purpose: perform a driver specific operation - * - * Return: Success: non negative - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_file_optional(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file optional' method") + } /* end switch */ - va_start (arguments, req); - if((ret_value = (cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "optional failed") - va_end (arguments); + /* Set the return value */ + ret_value = H5VL_object_data(vol_obj); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_optional() */ +} /* end H5VL__object() */ /*------------------------------------------------------------------------- - * Function: H5VL_file_close - * - * Purpose: Closes a file through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_file_close(void *file, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(file); - HDassert(cls); - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->file_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'file close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->file_cls.close)(file, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_create - * - * Purpose: Creates a group through the VOL - * - * Return: Success: pointer to new group. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ -void * -H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->group_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'group create' method") - - /* call the corresponding VOL create callback */ - if(NULL == (ret_value = (cls->group_cls.create) - (obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_open - * - * Purpose: Opens a group through the VOL + * Function: H5VL_object * - * Return: Success: pointer to new group. + * Purpose: Utility function to return the VOL object pointer associated with + * a hid_t. * - * Failure: NULL + * Return: Success: object pointer + * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t gapl_id, hid_t dxpl_id, void **req) +H5VL_object(hid_t id) { - void *ret_value; /* Return value */ + void *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) - if(NULL == cls->group_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'group open' method") - - if(NULL == (ret_value = (cls->group_cls.open) - (obj, loc_params, name, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_get - * - * Purpose: Get specific information about the group through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group get' method") - - va_start (arguments, req); - if((ret_value = (cls->group_cls.get) - (obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_specific - * - * Purpose: specific operation on groups through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group specific' method") - - va_start (arguments, req); - if((ret_value = (cls->group_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_group_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group optional' method") - - va_start (arguments, req); - if((ret_value = (cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_group_close - * - * Purpose: Closes a group through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_group_close(void *grp, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - HDassert(grp); - HDassert(cls); - - FUNC_ENTER_NOAPI(FAIL) - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->group_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'group close' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->group_cls.close)(grp, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_group_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_create - * - * Purpose: Creates a hard link through the VOL - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check if the corresponding VOL create callback exists */ - if(NULL == cls->link_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link create' method") - /* call the corresponding VOL create callback */ - if((ret_value = (cls->link_cls.create) - (create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link create failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_copy - * - * Purpose: Copys a link from src to dst. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check if the corresponding VOL copy callback exists */ - if(NULL == cls->link_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link copy' method") - - /* call the corresponding VOL copy callback */ - if((ret_value = (cls->link_cls.copy) - (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, - lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link copy failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_move - * - * Purpose: Moves a link from src to dst. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, const H5VL_class_t *cls, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* check if the corresponding VOL move callback exists */ - if(NULL == cls->link_cls.move) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link move' method") - - /* call the corresponding VOL move callback */ - if((ret_value = (cls->link_cls.move) - (src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, - lapl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link move failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_move() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_get - * - * Purpose: Get specific information about the link through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_link_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link get' method") - - va_start (arguments, req); - if((ret_value = (cls->link_cls.get) - (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); + /* Get the underlying object */ + if(NULL == (ret_value = H5VL__object(id, H5I_get_type(id)))) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_specific - * - * Purpose: specific operation on links through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, - H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->link_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link specific' method") - - va_start (arguments, req); - if((ret_value = (cls->link_cls.specific) - (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_link_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_link_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->link_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'link optional' method") - - va_start (arguments, req); - if((ret_value = (cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_link_optional() */ +} /* end H5VL_object() */ /*------------------------------------------------------------------------- - * Function: H5VL_object_open - * - * Purpose: Opens a object through the VOL + * Function: H5VL_object_verify * - * Return: Success: User ID of the new object. + * Purpose: Utility function to return the VOL object pointer associated + * with an identifier. * - * Failure: NULL + * Return: Success: object pointer + * Failure: NULL * *------------------------------------------------------------------------- */ void * -H5VL_object_open(void *obj, H5VL_loc_params_t params, const H5VL_class_t *cls, H5I_type_t *opened_type, - hid_t dxpl_id, void **req) +H5VL_object_verify(hid_t id, H5I_type_t obj_type) { - void *ret_value; /* Return value */ + void *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) - /* check if the corresponding VOL open callback exists */ - if(NULL == cls->object_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'object open' method") + /* Check of ID of correct type */ + if(obj_type != H5I_get_type(id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->object_cls.open) - (obj, params, opened_type, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + /* Get the underlying object */ + if(NULL == (ret_value = H5VL__object(id, obj_type))) + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_open() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_copy - * - * Purpose: Copies an object to another destination through the VOL - * - * Return: Success: Non Negative - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const H5VL_class_t *cls1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, const H5VL_class_t *cls2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Make sure that the VOL drivers are the same */ - if (cls1->value != cls2->value) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Objects are accessed through different VOL drivers and can't be linked") - - if(NULL == cls1->object_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object copy' method") - - if((ret_value = (cls1->object_cls.copy) - (src_obj, loc_params1, src_name, dst_obj, loc_params2, dst_name, ocpypl_id, - lcpl_id, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "copy failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_get - * - * Purpose: Get specific information about the object through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, H5VL_object_get_t get_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->object_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object get' method") - - va_start (arguments, req); - if((ret_value = (cls->object_cls.get) - (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_specific - * - * Purpose: specific operation on objects through the VOL - * - * Return: Success: non negative - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, - H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object specific' method") - - va_start (arguments, req); - if((ret_value = (cls->object_cls.specific) - (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_specific() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_object_optional - * - * Purpose: optional operation specific to drivers. - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_object_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == cls->object_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'object optional' method") - - va_start (arguments, req); - if((ret_value = (cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_commit - * - * Purpose: Commits a datatype to the file through the VOL - * - * Return: Success: Positive - * - * Failure: Negative - * - *------------------------------------------------------------------------- - */ -void * -H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, - hid_t dxpl_id, void **req) -{ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the corresponding VOL commit callback exists */ - if(NULL == cls->datatype_cls.commit) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL driver has no 'datatype commit' method") - - /* call the corresponding VOL commit callback */ - if(NULL == (ret_value = (cls->datatype_cls.commit) - (obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "commit failed") +} /* end H5VL_object_verify() */ -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_commit() */ - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_open - * - * Purpose: Opens a named datatype through the VOL - * - * Return: Success: User ID of the datatype. - * - * Failure: NULL - * - *------------------------------------------------------------------------- - */ +/* XXX (VOL MERGE): This could be a macro like in H5F */ void * -H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *name, - hid_t tapl_id, hid_t dxpl_id, void **req) +H5VL_plugin_object(H5VL_object_t *vol_obj) { - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check if the type specific corresponding VOL open callback exists */ - if(NULL == cls->datatype_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback"); - - /* call the corresponding VOL open callback */ - if(NULL == (ret_value = (cls->datatype_cls.open) - (obj, loc_params, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + FUNC_ENTER_NOAPI_NOINIT_NOERR -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_open() */ + FUNC_LEAVE_NOAPI(vol_obj->data) +} /* end H5VL_plugin_object() */ /*------------------------------------------------------------------------- - * Function: H5VL_datatype_get + * Function: H5VL_cmp_plugin_cls * - * Purpose: Get specific information about the datatype through the VOL + * Purpose: Compare VOL class for a plugin * - * Return: SUCCEED/FAIL + * Return: Positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. * *------------------------------------------------------------------------- */ -herr_t -H5VL_datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void **req, ...) +int +H5VL_cmp_plugin_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls2) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + int cmp_value; /* Value from comparison */ + int ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype get' method"); - va_start (arguments, req); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed"); - va_end (arguments); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_get() */ + /* Sanity checks */ + HDassert(cls1); + HDassert(cls1); - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_specific - * - * Purpose: specific operation on datatypes through the VOL - * - * Return: Success: non negative - * - * Failure: negative - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, - hid_t dxpl_id, void **req, ...) -{ - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + /* Compare plugin "values" */ + if(cls1->value < cls2->value) + HGOTO_DONE(-1) + if(cls1->value > cls2->value) + HGOTO_DONE(1) + HDassert(cls1->value == cls2->value); - FUNC_ENTER_NOAPI(FAIL) + /* Compare plugin names */ + if(cls1->name == NULL && cls2->name != NULL) + HGOTO_DONE(-1); + if(cls1->name != NULL && cls2->name == NULL) + HGOTO_DONE(1); + if(0 != (cmp_value = HDstrcmp(cls1->name, cls2->name))) + HGOTO_DONE(cmp_value); - if(NULL == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype specific' method") + /* Compare plugin VOL API versions */ + if(cls1->version < cls2->version) + HGOTO_DONE(-1) + if(cls1->version > cls2->version) + HGOTO_DONE(1) + HDassert(cls1->version == cls2->version); - va_start (arguments, req); - if((ret_value = (cls->datatype_cls.specific) - (obj, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") - va_end (arguments); + /* Compare plugin info */ + if(cls1->info_size < cls2->info_size) + HGOTO_DONE(-1) + if(cls1->info_size > cls2->info_size) + HGOTO_DONE(1) + HDassert(cls1->info_size == cls2->info_size); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_specific() */ +} /* end H5VL_cmp_plugin_cls() */ /*------------------------------------------------------------------------- - * Function: H5VL_datatype_optional - * - * Purpose: optional operation specific to drivers. + * Function: H5VL_set_vol_wrapper * - * Return: Success: non negative + * Purpose: Set up object wrapping context for current VOL plugin * - * Failure: negative + * Return: SUCCEED / FAIL * *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_optional(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req, ...) +H5VL_set_vol_wrapper(void *obj, const H5VL_t *plugin) { - va_list arguments; /* argument list passed from the API call */ - herr_t ret_value = SUCCEED; + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + void *obj_wrap_ctx = NULL; /* VOL plugin's wrapping context */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if(NULL == cls->datatype_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype optional' method") + /* Sanity checks */ + HDassert(obj); + HDassert(plugin); - va_start (arguments, req); - if((ret_value = (cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") - va_end (arguments); + /* Check if the plugin can create a wrap context */ + if(plugin->cls->get_wrap_ctx) { + /* Sanity check */ + HDassert(plugin->cls->free_wrap_ctx); -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_optional() */ + /* Get the wrap context from the plugin */ + if((plugin->cls->get_wrap_ctx)(obj, &obj_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL plugin's object wrap context") + } /* end if */ - -/*------------------------------------------------------------------------- - * Function: H5VL_datatype_close - * - * Purpose: Closes a datatype through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_id, void **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) + /* Allocate VOL object wrapper context */ + if(NULL == (vol_wrap_ctx = H5FL_MALLOC(H5VL_wrap_ctx_t))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context") - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->datatype_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'datatype close' method"); + /* Set up VOL object wrapper context */ + vol_wrap_ctx->plugin = plugin; + vol_wrap_ctx->obj_wrap_ctx = obj_wrap_ctx; - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->datatype_cls.close)(dt, dxpl_id, req)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed"); + /* Save the wrapper context */ + if(H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_datatype_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_request_cancel - * - * Purpose: Cancels an asynchronous request through the VOL - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status) -{ - herr_t ret_value = SUCCEED; + if(ret_value < 0 && vol_wrap_ctx) + /* Release object wrapping context */ + H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx); - FUNC_ENTER_NOAPI(FAIL) - - HDassert(req); - HDassert(cls); - HDassert(status); - - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->async_cls.cancel) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async cancel' method"); - - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->async_cls.cancel)(req, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed"); - -done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_request_cancel() */ +} /* end H5VL_set_vol_wrapper() */ /*------------------------------------------------------------------------- - * Function: H5VL_request_test + * Function: H5VL_reset_vol_wrapper * - * Purpose: Tests an asynchronous request through the VOL + * Purpose: Reset object wrapping context for current VOL plugin * - * Return: SUCCEED/FAIL + * Return: SUCCEED / FAIL * *------------------------------------------------------------------------- */ herr_t -H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +H5VL_reset_vol_wrapper(void) { - herr_t ret_value = SUCCEED; + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert(req); - HDassert(cls); - HDassert(status); + /* Retrieve the VOL object wrap context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->async_cls.test) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async test' method"); + /* If there is a VOL plugin object wrapping context, release it */ + if(vol_wrap_ctx->obj_wrap_ctx) { + /* Release the VOL plugin's object wrapping context */ + if((*vol_wrap_ctx->plugin->cls->free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release plugin's object wrapping context") + } /* end if */ - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->async_cls.test)(req, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request test failed"); + /* Release object wrapping context */ + H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_request_test() */ +} /* end H5VL_reset_vol_wrapper() */ /*------------------------------------------------------------------------- - * Function: H5VL_request_wait + * Function: H5VL_wrap_register * - * Purpose: Waits on an asychronous request through the VOL + * Purpose: Wrap an object and register an ID for it * - * Return: SUCCEED/FAIL + * Return: SUCCEED / FAIL * *------------------------------------------------------------------------- */ -herr_t -H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status) +hid_t +H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) { - herr_t ret_value = SUCCEED; + H5VL_wrap_ctx_t *vol_wrap_ctx = NULL; /* Object wrapping context */ + void *new_obj; /* Newly wrapped object */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) - HDassert(req); - HDassert(cls); - HDassert(status); + /* Sanity check */ + HDassert(obj); - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->async_cls.wait) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL driver has no 'async wait' method"); + /* If the datatype is already VOL-managed, the datatype's vol_obj + * field will get clobbered later, so disallow this. + */ + if(type == H5I_DATATYPE) + if(TRUE == H5T_already_vol_managed((const H5T_t *)obj)) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype") + + /* Retrieve the VOL object wrap context */ + if(H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") + + /* If there is a VOL object wrapping context, wrap the object */ + if(vol_wrap_ctx) { + /* Wrap object */ + if(NULL == (new_obj = H5VL_wrap_object(vol_wrap_ctx->plugin->cls, vol_wrap_ctx->obj_wrap_ctx, obj))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't wrap object") + } /* end if */ + else + new_obj = obj; - /* Call the corresponding VOL callback */ - if ((ret_value = (cls->async_cls.wait)(req, status)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed"); + /* Get an ID for the object */ + if((ret_value = H5VL_object_register(new_obj, type, vol_wrap_ctx->plugin->id, app_ref)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_request_wait() */ +} /* end H5VL_wrap_register() */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index acfceed..d071b3a 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -11,7 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: The native VOL driver where access is to a single HDF5 file + * Purpose: The native VOL plugin where access is to a single HDF5 file * using HDF5 VFDs. */ @@ -40,151 +40,157 @@ #include "H5Rpkg.h" /* References */ #include "H5SMprivate.h" /* Shared Object Header Messages */ #include "H5Tpkg.h" /* Datatypes */ -#include "H5VLprivate.h" /* VOL drivers */ -#include "H5VLnative.h" /* Native VOL driver */ +#include "H5VLprivate.h" /* VOL plugins */ +#include "H5VLnative.h" /* Native VOL plugin */ /* - * The VOL driver identification number. + * The VOL plugin identification number. */ static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID; /* Prototypes */ -static H5F_t *H5VL_native_get_file(void *obj, H5I_type_t type); +static H5F_t *H5VL__native_get_file(void *obj, H5I_type_t type); static herr_t H5VL__native_term(void); /* Atrribute callbacks */ -static void *H5VL_native_attr_create(void *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); -static void *H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); -static herr_t H5VL_native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); -static herr_t H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_attr_close(void *attr, hid_t dxpl_id, void **req); +static void *H5VL__native_attr_create(void *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); +static void *H5VL__native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req); /* Dataset callbacks */ -static void *H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, +static void *H5VL__native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); -static herr_t H5VL_native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, +static herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); -static herr_t H5VL_native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_dataset_close(void *dset, hid_t dxpl_id, void **req); +static herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_dataset_optional(void *dset, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_dataset_close(void *dset, hid_t dxpl_id, void **req); /* File callbacks */ -static void *H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_file_close(void *file, hid_t dxpl_id, void **req); +static void *H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_file_optional(void *file, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req); /* Group callbacks */ -static void *H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_group_specific(void *dset, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_group_close(void *grp, hid_t dxpl_id, void **req); +static void *H5VL__native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_group_specific(void *dset, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req); /* Link callbacks */ -static herr_t H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, +static herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, +static herr_t H5VL__native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, +static herr_t H5VL__native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); /* Object callbacks */ -static void *H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -static herr_t H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, +static void *H5VL__native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +static herr_t H5VL__native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_object_optional(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Datatype callbacks */ -static void *H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -static void *H5VL_native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_datatype_close(void *dt, hid_t dxpl_id, void **req); +static void *H5VL__native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +static void *H5VL__native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req); -/* Native VOL driver class struct */ +/* Native VOL plugin class struct */ static H5VL_class_t H5VL_native_cls_g = { H5VL_NATIVE_VERSION, /* version */ H5VL_NATIVE_VALUE, /* value */ H5VL_NATIVE_NAME, /* name */ + 0, /* capability flags */ NULL, /* initialize */ - NULL, /* terminate */ - (size_t)0, /* fapl size */ - NULL, /* fapl copy */ - NULL, /* fapl free */ + H5VL__native_term, /* terminate */ + (size_t)0, /* info size */ + NULL, /* info copy */ + NULL, /* info compare */ + NULL, /* info free */ + NULL, /* get_object */ + NULL, /* get_wrap_ctx */ + NULL, /* free_wrap_ctx */ + NULL, /* wrap_object */ { /* attribute_cls */ - H5VL_native_attr_create, /* create */ - H5VL_native_attr_open, /* open */ - H5VL_native_attr_read, /* read */ - H5VL_native_attr_write, /* write */ - H5VL_native_attr_get, /* get */ - H5VL_native_attr_specific, /* specific */ + H5VL__native_attr_create, /* create */ + H5VL__native_attr_open, /* open */ + H5VL__native_attr_read, /* read */ + H5VL__native_attr_write, /* write */ + H5VL__native_attr_get, /* get */ + H5VL__native_attr_specific, /* specific */ NULL, /* optional */ - H5VL_native_attr_close /* close */ + H5VL__native_attr_close /* close */ }, { /* dataset_cls */ - H5VL_native_dataset_create, /* create */ - H5VL_native_dataset_open, /* open */ - H5VL_native_dataset_read, /* read */ - H5VL_native_dataset_write, /* write */ - H5VL_native_dataset_get, /* get */ - H5VL_native_dataset_specific, /* specific */ - H5VL_native_dataset_optional, /* optional */ - H5VL_native_dataset_close /* close */ + H5VL__native_dataset_create, /* create */ + H5VL__native_dataset_open, /* open */ + H5VL__native_dataset_read, /* read */ + H5VL__native_dataset_write, /* write */ + H5VL__native_dataset_get, /* get */ + H5VL__native_dataset_specific, /* specific */ + H5VL__native_dataset_optional, /* optional */ + H5VL__native_dataset_close /* close */ }, { /* datatype_cls */ - H5VL_native_datatype_commit, /* commit */ - H5VL_native_datatype_open, /* open */ - H5VL_native_datatype_get, /* get */ - H5VL_native_datatype_specific, /* specific */ + H5VL__native_datatype_commit, /* commit */ + H5VL__native_datatype_open, /* open */ + H5VL__native_datatype_get, /* get */ + H5VL__native_datatype_specific, /* specific */ NULL, /* optional */ - H5VL_native_datatype_close /* close */ + H5VL__native_datatype_close /* close */ }, { /* file_cls */ - H5VL_native_file_create, /* create */ - H5VL_native_file_open, /* open */ - H5VL_native_file_get, /* get */ - H5VL_native_file_specific, /* specific */ - H5VL_native_file_optional, /* optional */ - H5VL_native_file_close /* close */ + H5VL__native_file_create, /* create */ + H5VL__native_file_open, /* open */ + H5VL__native_file_get, /* get */ + H5VL__native_file_specific, /* specific */ + H5VL__native_file_optional, /* optional */ + H5VL__native_file_close /* close */ }, { /* group_cls */ - H5VL_native_group_create, /* create */ - H5VL_native_group_open, /* open */ - H5VL_native_group_get, /* get */ - H5VL_native_group_specific, /* specific */ + H5VL__native_group_create, /* create */ + H5VL__native_group_open, /* open */ + H5VL__native_group_get, /* get */ + H5VL__native_group_specific, /* specific */ NULL, /* optional */ - H5VL_native_group_close /* close */ + H5VL__native_group_close /* close */ }, { /* link_cls */ - H5VL_native_link_create, /* create */ - H5VL_native_link_copy, /* copy */ - H5VL_native_link_move, /* move */ - H5VL_native_link_get, /* get */ - H5VL_native_link_specific, /* specific */ + H5VL__native_link_create, /* create */ + H5VL__native_link_copy, /* copy */ + H5VL__native_link_move, /* move */ + H5VL__native_link_get, /* get */ + H5VL__native_link_specific, /* specific */ NULL /* optional */ }, { /* object_cls */ - H5VL_native_object_open, /* open */ - H5VL_native_object_copy, /* copy */ - H5VL_native_object_get, /* get */ - H5VL_native_object_specific, /* specific */ - H5VL_native_object_optional /* optional */ + H5VL__native_object_open, /* open */ + H5VL__native_object_copy, /* copy */ + H5VL__native_object_get, /* get */ + H5VL__native_object_specific, /* specific */ + H5VL__native_object_optional /* optional */ }, { /* async_cls */ NULL, /* cancel */ @@ -198,27 +204,25 @@ static H5VL_class_t H5VL_native_cls_g = { /*------------------------------------------------------------------------- * Function: H5VL_native_init * - * Purpose: Initialize this VOL driver by registering it with the + * Purpose: Initialize this VOL plugin by registering it with the * library. * - * Return: Success: The ID for the native driver + * Return: Success: The ID for the native plugin * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ hid_t -H5VL_native_init(void) +H5VL_native_init(hid_t vipl_id) { hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(H5I_INVALID_HID) - /* Register the native VOL driver, if it isn't already */ - if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL)) { - if((H5VL_NATIVE_ID_g = H5VL_register((const H5VL_class_t *)&H5VL_native_cls_g, - sizeof(H5VL_class_t), TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL driver") - } + /* Register the native VOL plugin, if it isn't already */ + if(NULL == H5I_object_verify(H5VL_NATIVE_ID_g, H5I_VOL)) + if((H5VL_NATIVE_ID_g = H5VL_register((const H5VL_class_t *)&H5VL_native_cls_g, TRUE, vipl_id)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL plugin") /* Set return value */ ret_value = H5VL_NATIVE_ID_g; @@ -231,6 +235,7 @@ done: hid_t H5VL_native_get_driver_id(void) { +HDassert(0 && "H5VL_native_get_driver_id"); return H5VL_NATIVE_ID_g; } @@ -260,7 +265,7 @@ H5VL__native_term(void) * Function: H5Pset_fapl_native * * Purpose: Modify the file access property list to use the H5VL_NATIVE - * driver defined in this source file. + * plugin defined in this source file. * * Return: SUCCEED/FAIL * @@ -286,10 +291,10 @@ done: /*--------------------------------------------------------------------------- - * Function: H5VL_native_get_file + * Function: H5VL__native_get_file * * Purpose: Utility routine to get file struct for an object via the - * native VOL driver. + * native VOL plugin. * * Returns: SUCCESS: A pointer to the H5F_t struct for the file * associated with the object. @@ -298,17 +303,18 @@ done: *--------------------------------------------------------------------------- */ static H5F_t * -H5VL_native_get_file(void *obj, H5I_type_t type) +H5VL__native_get_file(void *obj, H5I_type_t type) { H5F_t *ret_value = NULL; /* File pointer */ H5O_loc_t *oloc = NULL; /* Object location for ID */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(type) { case H5I_FILE: ret_value = (H5F_t *)obj; break; + case H5I_GROUP: { H5G_t *grp; @@ -316,6 +322,7 @@ H5VL_native_get_file(void *obj, H5I_type_t type) oloc = H5G_oloc(grp); break; } + case H5I_DATATYPE: { H5T_t *dt; @@ -323,6 +330,7 @@ H5VL_native_get_file(void *obj, H5I_type_t type) oloc = H5T_oloc(dt); break; } + case H5I_DATASET: { H5D_t *dset; @@ -338,6 +346,7 @@ H5VL_native_get_file(void *obj, H5I_type_t type) oloc = H5A_oloc(attr); break; } + case H5I_UNINIT: case H5I_BADID: case H5I_DATASPACE: @@ -364,13 +373,13 @@ H5VL_native_get_file(void *obj, H5I_type_t type) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5VL_native_get_file */ +} /* H5VL__native_get_file */ /*--------------------------------------------------------------------------- * Function: H5VL_native_register * - * Purpose: Utility routine to register an ID with the native VOL driver + * Purpose: Utility routine to register an ID with the native VOL plugin * as an auxilary object. * * Returns: Success: An ID for the object @@ -383,7 +392,7 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) { hid_t ret_value = H5I_INVALID_HID; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI(H5I_INVALID_HID) HDassert(obj); @@ -394,6 +403,7 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) if(((H5T_t *)obj)->vol_obj != NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can only get an ID for an uncommitted datatype") +HDassert(0 && "H5VL_native_register"); /* Get an ID for the object */ if((ret_value = H5VL_object_register(obj, type, H5VL_NATIVE_ID_g, app_ref)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") @@ -403,39 +413,8 @@ done: } /* end H5VL_native_register() */ -/*--------------------------------------------------------------------------- - * Function: H5VL_native_unregister - * - * Purpose: Utility routine to decrement ref count on Native VOL driver - * objects. - * - * Returns: SUCCEED/FAIL - * - *--------------------------------------------------------------------------- - */ -herr_t -H5VL_native_unregister(hid_t obj_id) -{ - H5VL_object_t *vol_obj = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - /* get the driver pointer */ - if(NULL == (vol_obj = (H5VL_object_t *)H5VL_get_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid ID") - - /* free object */ - if(H5VL_free_object(vol_obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_unregister() */ - - /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_create + * Function: H5VL__native_attr_create * * Purpose: Creates an attribute on an object. * @@ -445,8 +424,9 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t acpl_id, - hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, + hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Object location */ H5G_loc_t obj_loc; /* Location used to open group */ @@ -458,7 +438,7 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att H5A_t *attr = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(acpl_id))) @@ -477,7 +457,7 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") - /* If this is a named datatype, get the driver pointer to the datatype */ + /* If this is a named datatype, get the plugin's pointer to the datatype */ type = H5T_get_actual_type(dt); if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) @@ -488,27 +468,28 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att /* Go do the real work for attaching the attribute to the dataset */ if(NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Acreate_by_name */ if(NULL == (attr = H5A__create_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name, type, space, acpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute create parameters") - } + ret_value = (void *)attr; done: /* Release resources */ if(loc_found && H5G_loc_free(&obj_loc) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location") + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_create() */ +} /* end H5VL__native_attr_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_open + * Function: H5VL__native_attr_open * * Purpose: Opens a attr inside a native h5 file. * @@ -521,14 +502,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, - hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, + hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ void *ret_value; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) @@ -539,13 +520,13 @@ H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_ /* Open the attribute */ if(NULL == (attr = H5A__open(&loc, attr_name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute: '%s'", attr_name) - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aopen_by_name */ /* Open the attribute on the object header */ if(NULL == (attr = H5A__open_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") - } + } /* end else-if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Aopen_by_idx */ /* Open the attribute in the object header */ @@ -554,20 +535,19 @@ H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_ loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute open parameters") - } ret_value = (void *)attr; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_open() */ +} /* end H5VL__native_attr_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_read + * Function: H5VL__native_attr_read * * Purpose: Reads in data from attribute. * @@ -579,26 +559,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5T_t *mem_type; /* Memory datatype */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + /* Go write the actual data to the attribute */ if((ret_value = H5A__read((H5A_t*)attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_read() */ +} /* end H5VL__native_attr_read() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_write + * Function: H5VL__native_attr_write * * Purpose: Writes out data to attribute. * @@ -610,26 +592,28 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5T_t *mem_type; /* Memory datatype */ herr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + /* Go write the actual data to the attribute */ if((ret_value = H5A__write((H5A_t*)attr, mem_type, buf)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_write() */ +} /* end H5VL__native_attr_write() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_get + * Function: H5VL__native_attr_get * * Purpose: Gets certain information about an attribute * @@ -642,11 +626,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(get_type) { /* H5Aget_space */ @@ -659,6 +644,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") break; } + /* H5Aget_type */ case H5VL_ATTR_GET_TYPE: { @@ -669,6 +655,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute") break; } + /* H5Aget_create_plist */ case H5VL_ATTR_GET_ACPL: { @@ -680,6 +667,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d break; } + /* H5Aget_name */ case H5VL_ATTR_GET_NAME: { @@ -721,13 +709,14 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d /* Release resources */ if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") } else HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") break; } + /* H5Aget_info */ case H5VL_ATTR_GET_INFO: { @@ -759,7 +748,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d /* Release resources */ if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") } else if(H5VL_OBJECT_BY_IDX == loc_params.type) { H5G_loc_t loc; @@ -781,13 +770,14 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d /* Release resources */ if(attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") } else HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") break; } + case H5VL_ATTR_GET_STORAGE_SIZE: { hsize_t *ret = va_arg(arguments, hsize_t *); @@ -797,17 +787,18 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED d *ret = attr->shared->data_size; break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from attr") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_get() */ +} /* end H5VL__native_attr_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_specific + * Function: H5VL__native_attr_specific * * Purpose: Specific operations for attributes * @@ -820,18 +811,17 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_loc_t loc; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get location for passed-in object */ if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - /* XXX: Do I need to clean this up? */ switch(specific_type) { case H5VL_ATTR_DELETE: @@ -843,24 +833,25 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe /* Delete the attribute from the location */ if(H5O__attr_remove(loc.oloc, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - } + } /* end if */ else if(H5VL_OBJECT_BY_NAME == loc_params.type) { /* H5Adelete_by_name */ /* Delete the attribute */ if(H5A__delete_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - } + } /* end else-if */ else if(H5VL_OBJECT_BY_IDX == loc_params.type) { /* H5Adelete_by_idx */ /* Delete the attribute from the location */ if(H5A__delete_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute remove parameters") break; } + case H5VL_ATTR_EXISTS: { const char *attr_name = va_arg(arguments, const char *); @@ -870,16 +861,17 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe /* Check if the attribute exists */ if((*ret = H5O__attr_exists(loc.oloc, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aexists_by_name */ /* Check if the attribute exists */ if((*ret = H5A__exists_by_name(loc, loc_params.loc_data.loc_by_name.name, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters") break; } + case H5VL_ATTR_ITER: { H5_index_t idx_type = va_arg(arguments, H5_index_t); @@ -889,21 +881,20 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe void *op_data = va_arg(arguments, void *); if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Aiterate2 */ - /* Iterate over attributes */ if((ret_value = H5A__iterate(&loc, ".", idx_type, order, idx, op, op_data)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aiterate_by_name */ - /* Iterate over attributes by name */ if((ret_value = H5A__iterate(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, idx, op, op_data)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed"); - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters") break; } + /* H5Arename/rename_by_name */ case H5VL_ATTR_RENAME: { @@ -914,26 +905,28 @@ H5VL_native_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_spe /* Call attribute rename routine */ if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Arename_by_name */ /* Call attribute rename routine */ if(H5A__rename_by_name(loc, loc_params.loc_data.loc_by_name.name, old_name, new_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters") break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_specific() */ +} /* end H5VL__native_attr_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_close + * Function: H5VL__native_attr_close * * Purpose: Closes an attribute. * @@ -946,22 +939,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_close(void *attr, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_close(void *attr, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5A__close((H5A_t*)attr) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close attribute") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_close() */ +} /* end H5VL__native_attr_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_create + * Function: H5VL__native_dataset_create * * Purpose: Creates a dataset in a native HDF5 file * @@ -971,8 +964,9 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dcpl_id, - hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_create(void *obj, H5VL_loc_params_t loc_params, + const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ H5G_loc_t loc; /* Object location to insert dataset into */ @@ -983,7 +977,7 @@ H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char * const H5S_t *space; /* Dataspace for dataset */ void *ret_value; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) @@ -1010,14 +1004,14 @@ H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char * /* build and open the new dataset */ if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") - } + } /* end if */ /* H5Dcreate2 */ else { /* Create the new dataset & get its ID */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, - dcpl_id, dapl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") - } + } /* end else */ + ret_value = (void *)dset; done: @@ -1033,14 +1027,15 @@ done: /* Decrement refcount on dataset's object header in memory */ if(H5O_dec_rc_by_loc(oloc) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") - } - } + } /* end if */ + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_create() */ +} /* end H5VL__native_dataset_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_open + * Function: H5VL__native_dataset_open * * Purpose: Opens a dataset in a native HDF5 file. * @@ -1050,14 +1045,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, - hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t dapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") @@ -1070,11 +1065,11 @@ H5VL_native_dataset_open(void *obj, H5VL_loc_params_t loc_params, const char *na done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_open() */ +} /* end H5VL__native_dataset_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_read + * Function: H5VL__native_dataset_read * * Purpose: Reads raw data from a dataset into a buffer. * @@ -1083,15 +1078,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, void *buf, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, void *buf, + void H5_ATTR_UNUSED **req) { H5D_t *dset = (H5D_t *)obj; const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Check arguments */ if(NULL == dset->oloc.file) @@ -1109,11 +1105,11 @@ H5VL_native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_read() */ +} /* end H5VL__native_dataset_read() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_write + * Function: H5VL__native_dataset_write * * Purpose: Writes raw data from a buffer into a dataset. * @@ -1122,15 +1118,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, const void *buf, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t H5_ATTR_UNUSED dxpl_id, const void *buf, + void H5_ATTR_UNUSED **req) { H5D_t *dset = (H5D_t *)obj; const H5S_t *mem_space = NULL; const H5S_t *file_space = NULL; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ if(NULL == dset->oloc.file) @@ -1148,11 +1145,11 @@ H5VL_native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_write() */ +} /* end H5VL__native_dataset_write() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_get + * Function: H5VL__native_dataset_get * * Purpose: Gets certain information about a dataset * @@ -1161,13 +1158,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5D_t *dset = (H5D_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(get_type) { /* H5Dget_space */ @@ -1180,7 +1177,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_space_statuc */ + + /* H5Dget_space_statuc */ case H5VL_DATASET_GET_SPACE_STATUS: { H5D_space_status_t *allocation = va_arg(arguments, H5D_space_status_t *); @@ -1191,7 +1189,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_type */ + + /* H5Dget_type */ case H5VL_DATASET_GET_TYPE: { hid_t *ret_id = va_arg(arguments, hid_t *); @@ -1201,7 +1200,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_create_plist */ + + /* H5Dget_create_plist */ case H5VL_DATASET_GET_DCPL: { hid_t *ret_id = va_arg(arguments, hid_t *); @@ -1211,7 +1211,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_access_plist */ + + /* H5Dget_access_plist */ case H5VL_DATASET_GET_DAPL: { hid_t *ret_id = va_arg(arguments, hid_t *); @@ -1221,7 +1222,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN break; } - /* H5Dget_storage_size */ + + /* H5Dget_storage_size */ case H5VL_DATASET_GET_STORAGE_SIZE: { hsize_t *ret = va_arg(arguments, hsize_t *); @@ -1231,7 +1233,8 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") break; } - /* H5Dget_offset */ + + /* H5Dget_offset */ case H5VL_DATASET_GET_OFFSET: { haddr_t *ret = va_arg(arguments, haddr_t *); @@ -1242,17 +1245,18 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UN *ret = HADDR_UNDEF; break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_get() */ +} /* end H5VL__native_dataset_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_specific + * Function: H5VL__native_dataset_specific * * Purpose: Specific operations for datasets * @@ -1261,13 +1265,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5D_t *dset = (H5D_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { /* H5Dspecific_space */ @@ -1279,6 +1283,7 @@ H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset") break; } + case H5VL_DATASET_FLUSH: { hid_t dset_id = va_arg(arguments, hid_t); @@ -1289,6 +1294,7 @@ H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, break; } + case H5VL_DATASET_REFRESH: { hid_t dset_id = va_arg(arguments, hid_t); @@ -1299,32 +1305,34 @@ H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_specific() */ +} /* end H5VL__native_dataset_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_optional + * Function: H5VL__native_dataset_optional * - * Purpose: Perform a driver specific operation on a native dataset + * Purpose: Perform a plugin-specific operation on a native dataset * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) { H5D_t *dset = NULL; /* Dataset */ H5VL_dataset_optional_t optional_type = va_arg(arguments, H5VL_dataset_optional_t); herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(optional_type) { case H5VL_DATASET_FORMAT_CONVERT: @@ -1361,6 +1369,7 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + case H5VL_DATASET_GET_CHUNK_INDEX_TYPE: { H5D_chunk_index_t *idx_type = va_arg(arguments, H5D_chunk_index_t *); @@ -1376,6 +1385,7 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + case H5VL_DATASET_GET_CHUNK_STORAGE_SIZE: { hsize_t *offset = va_arg(arguments, hsize_t *); @@ -1393,6 +1403,7 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + case H5VL_DATASET_CHUNK_READ: { const hsize_t *offset = va_arg(arguments, hsize_t *); @@ -1420,6 +1431,7 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + case H5VL_DATASET_CHUNK_WRITE: { uint32_t filters = va_arg(arguments, uint32_t); @@ -1448,17 +1460,18 @@ H5VL_native_dataset_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_AT break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_optional() */ +} /* end H5VL__native_dataset_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_close + * Function: H5VL__native_dataset_close * * Purpose: Closes a dataset. * @@ -1468,22 +1481,23 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_close(void *dset, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_close(void *dset, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5D_close((H5D_t*)dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close dataset") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_close() */ +} /* end H5VL__native_dataset_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_create + * Function: H5VL__native_file_create * * Purpose: Creates a file as a native HDF5 file. * @@ -1494,13 +1508,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5F_t *new_file = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* 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 @@ -1521,12 +1535,13 @@ done: if(NULL == ret_value && new_file) if(H5F__close(new_file) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_create() */ +} /* end H5VL__native_file_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_open + * Function: H5VL__native_file_open * * Purpose: Opens a file as a native HDF5 file. * @@ -1537,12 +1552,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5F_t *new_file = NULL; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Open the file */ if(NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) @@ -1554,12 +1570,13 @@ H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t H5_ done: if(NULL == ret_value && new_file && H5F_try_close(new_file, NULL) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_open() */ +} /* end H5VL__native_file_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_get + * Function: H5VL__native_file_get * * Purpose: Gets certain data about a file * @@ -1568,12 +1585,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5F_t *f = NULL; /* File struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(get_type) { /* H5Fget_access_plist */ @@ -1592,6 +1610,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") break; } + /* H5Fget_create_plist */ case H5VL_FILE_GET_FCPL: { @@ -1608,6 +1627,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d break; } + /* H5Fget_obj_count */ case H5VL_FILE_GET_OBJ_COUNT: { @@ -1624,6 +1644,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d *ret = (ssize_t)obj_count; break; } + /* H5Fget_obj_ids */ case H5VL_FILE_GET_OBJ_IDS: { @@ -1642,6 +1663,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d *ret = (ssize_t)obj_count; break; } + /* H5Fget_intent */ case H5VL_FILE_GET_INTENT: { @@ -1670,6 +1692,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d break; } + /* H5Fget_name */ case H5VL_FILE_GET_NAME: { @@ -1679,7 +1702,7 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d ssize_t *ret = va_arg(arguments, ssize_t *); size_t len; - if(NULL == (f = H5VL_native_get_file(obj, type))) + if(NULL == (f = H5VL__native_get_file(obj, type))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") len = HDstrlen(H5F_OPEN_NAME(f)); @@ -1694,28 +1717,18 @@ H5VL_native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED d *ret = (ssize_t)len; break; } - /* H5Iget_file_id */ - case H5VL_OBJECT_GET_FILE: - { - H5I_type_t type = va_arg(arguments, H5I_type_t); - void **ret = va_arg(arguments, void **); - if(NULL == (f = H5VL_native_get_file(obj, type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - f->id_exists = TRUE; - *ret = (void*)f; - break; - } default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information") } /* end switch */ + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_get() */ +} /* end H5VL__native_file_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_specific + * Function: H5VL__native_file_specific * * Purpose: Perform an operation * @@ -1724,12 +1737,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, - void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { /* H5Fflush */ @@ -1740,7 +1753,7 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H H5F_t *f = NULL; /* File to flush */ /* Get the file for the object */ - if(NULL == (f = H5VL_native_get_file(obj, type))) + if(NULL == (f = H5VL__native_get_file(obj, type))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Nothing to do if the file is read only. This determination is @@ -1764,6 +1777,21 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H } break; } + + /* H5Freopen */ + case H5VL_FILE_REOPEN: + { + void **ret = va_arg(arguments, void **); + H5F_t *new_file = NULL; + + /* Reopen the file through the VOL plugin */ + if(NULL == (new_file = H5F__reopen((H5F_t *)obj))) + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") + new_file->id_exists = TRUE; + *ret = (void *)new_file; + break; + } + /* H5Fmount */ case H5VL_FILE_MOUNT: { @@ -1782,6 +1810,7 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H break; } + /* H5Funmount */ case H5VL_FILE_UNMOUNT: { @@ -1798,6 +1827,7 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H break; } + /* H5Fis_accessible */ case H5VL_FILE_IS_ACCESSIBLE: { @@ -1810,33 +1840,35 @@ H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "error in HDF5 file check") break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_specific() */ +} /* end H5VL__native_file_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_optional + * Function: H5VL__native_file_optional * - * Purpose: Perform a driver specific operation on a native file + * Purpose: Perform a plugin-specific operation on a native file * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5F_t *f = NULL; /* File */ H5VL_file_optional_t optional_type = va_arg(arguments, H5VL_file_optional_t); herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + f = (H5F_t *)obj; switch(optional_type) { /* H5Fget_filesize */ case H5VL_FILE_GET_SIZE: @@ -1845,8 +1877,6 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ haddr_t base_addr; /* Base address for the file */ hsize_t *size = va_arg(arguments, hsize_t *); - f = (H5F_t *)obj; - /* Go get the actual file size */ if(H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") @@ -1858,6 +1888,7 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ break; } + /* H5Fget_file_image */ case H5VL_FILE_GET_FILE_IMAGE: { @@ -1865,25 +1896,25 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ ssize_t *ret = va_arg(arguments, ssize_t *); size_t buf_len = va_arg(arguments, size_t ); - f = (H5F_t *)obj; /* Do the actual work */ if((*ret = H5F__get_file_image(f, buf_ptr, buf_len)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed") break; } + /* H5Fget_freespace */ case H5VL_FILE_GET_FREE_SPACE: { hsize_t tot_space; /* Amount of free space in the file */ hssize_t *ret = va_arg(arguments, hssize_t *); - f = (H5F_t *)obj; /* Go get the actual amount of free space in the file */ if(H5MF_get_freespace(f, &tot_space, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") *ret = (hssize_t)tot_space; break; } + case H5VL_FILE_GET_FREE_SECTIONS: { H5F_sect_info_t *sect_info = va_arg(arguments, H5F_sect_info_t *); @@ -1891,12 +1922,12 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ H5F_mem_t type = va_arg(arguments, H5F_mem_t); size_t nsects = va_arg(arguments, size_t); - f = (H5F_t *)obj; /* Go get the free-space section information in the file */ if((*ret = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") break; } + /* H5Fget_info2 */ case H5VL_FILE_GET_INFO: { @@ -1906,7 +1937,7 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ /* Get the file struct. This call is careful to not return the file pointer * for the top file in a mount hierarchy. */ - if(NULL == (f = H5VL_native_get_file(obj, type))) + if(NULL == (f = H5VL__native_get_file(obj, type))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct") /* Get the file info */ @@ -1915,28 +1946,29 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ break; } + /* H5Fget_mdc_config */ case H5VL_FILE_GET_MDC_CONF: { H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *); - f = (H5F_t *)obj; /* Go get the resize configuration */ if(H5AC_get_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") break; } + /* H5Fget_mdc_hit_rate */ case H5VL_FILE_GET_MDC_HR: { double *hit_rate_ptr = va_arg(arguments, double *); - f = (H5F_t *)obj; /* Go get the current hit rate */ if(H5AC_get_cache_hit_rate(f->shared->cache, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") break; } + /* H5Fget_mdc_size */ case H5VL_FILE_GET_MDC_SIZE: { @@ -1946,7 +1978,6 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ int *cur_num_entries_ptr = va_arg(arguments, int *); uint32_t cur_num_entries; - f = (H5F_t *)obj; /* Go get the size data */ if(H5AC_get_cache_size(f->shared->cache, max_size_ptr, min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0) @@ -1956,138 +1987,120 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ *cur_num_entries_ptr = (int)cur_num_entries; break; } + /* H5Fget_vfd_handle */ case H5VL_FILE_GET_VFD_HANDLE: { void **file_handle = va_arg(arguments, void **); hid_t fapl_id = va_arg(arguments, hid_t); - f = (H5F_t *)obj; - /* Retrieve the VFD handle for the file */ if(H5F_get_vfd_handle(f, fapl_id, file_handle) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") break; } + + /* H5Iget_file_id */ + case H5VL_FILE_GET_FILE: + { + H5I_type_t type = va_arg(arguments, H5I_type_t); + void **ret = va_arg(arguments, void **); + + if(NULL == (f = H5VL__native_get_file(obj, type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + f->id_exists = TRUE; + *ret = (void*)f; + break; + } + /* H5Fclear_elink_file_cache */ case H5VL_FILE_CLEAR_ELINK_CACHE: { - f = (H5F_t *)obj; - /* Release the EFC */ if(f->shared->efc) if(H5F__efc_release(f->shared->efc) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") break; } - /* H5Freopen */ - case H5VL_FILE_REOPEN: - { - void **ret = va_arg(arguments, void **); - H5F_t *new_file = NULL; - f = (H5F_t *)obj; - - /* Reopen the file through the VOL driver */ - if(NULL == (new_file = H5F__reopen(f))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") - - new_file->id_exists = TRUE; - - *ret = (void *)new_file; - break; - } /* H5Freset_mdc_hit_rate_stats */ case H5VL_FILE_RESET_MDC_HIT_RATE: { - f = (H5F_t *)obj; /* Reset the hit rate statistic */ if(H5AC_reset_cache_hit_rate_stats(f->shared->cache) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate") break; } + case H5VL_FILE_SET_MDC_CONFIG: { H5AC_cache_config_t *config_ptr = va_arg(arguments, H5AC_cache_config_t *); - f = (H5F_t *)obj; /* set the resize configuration */ if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed") break; } + case H5VL_FILE_GET_METADATA_READ_RETRY_INFO: { H5F_retry_info_t *info = va_arg(arguments, H5F_retry_info_t *); - f = (H5F_t *)obj; - if(H5F_get_metadata_read_retry_info(f, info) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get metadata read retry info") break; } + case H5VL_FILE_START_SWMR_WRITE: { - f = (H5F_t *)obj; - if(H5F__start_swmr_write(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't start SWMR write") break; } + case H5VL_FILE_START_MDC_LOGGING: { - f = (H5F_t *)obj; - /* Call mdc logging function */ if(H5C_start_logging(f->shared->cache) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging") break; } + case H5VL_FILE_STOP_MDC_LOGGING: { - f = (H5F_t *)obj; - /* Call mdc logging function */ if(H5C_stop_logging(f->shared->cache) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging") break; } + case H5VL_FILE_GET_MDC_LOGGING_STATUS: { hbool_t *is_enabled = va_arg(arguments, hbool_t *); hbool_t *is_currently_logging = va_arg(arguments, hbool_t *); - f = (H5F_t *)obj; - /* Call mdc logging function */ if(H5C_get_logging_status(f->shared->cache, is_enabled, is_currently_logging) < 0) HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status") break; } - case H5VL_FILE_SET_LATEST_FORMAT: - { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") - break; - } + case H5VL_FILE_FORMAT_CONVERT: { - f = (H5F_t *)obj; - /* Convert the format */ if(H5F__format_convert(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") break; } + case H5VL_FILE_RESET_PAGE_BUFFERING_STATS: { - f = (H5F_t *)obj; - /* Sanity check */ if(NULL == f->shared->page_buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") @@ -2098,6 +2111,7 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ break; } + case H5VL_FILE_GET_PAGE_BUFFERING_STATS: { unsigned *accesses = va_arg(arguments, unsigned *); @@ -2106,8 +2120,6 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ unsigned *evictions = va_arg(arguments, unsigned *); unsigned *bypasses = va_arg(arguments, unsigned *); - f = (H5F_t *)obj; - /* Sanity check */ if(NULL == f->shared->page_buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") @@ -2118,23 +2130,81 @@ H5VL_native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_ break; } + case H5VL_FILE_GET_MDC_IMAGE_INFO: { HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") break; } + case H5VL_FILE_GET_EOA: + { + haddr_t *eoa = va_arg(arguments, haddr_t *); + haddr_t rel_eoa; /* Relative address of EOA */ + + /* Sanity check */ + HDassert(eoa); + + /* This routine will work only for drivers with this feature enabled.*/ + /* We might introduce a new feature flag in the future */ + if(!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO)) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") + + /* The real work */ + if(HADDR_UNDEF == (rel_eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed") + + /* Set return value */ + /* (Note compensating for base address subtraction in internal routine) */ + *eoa = rel_eoa + H5F_get_base_addr(f); + + break; + } + + case H5VL_FILE_INCR_FILESIZE: + { + hsize_t increment = va_arg(arguments, hsize_t); + haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */ + + /* This public routine will work only for drivers with this feature enabled.*/ + /* We might introduce a new feature flag in the future */ + if(!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO)) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "must use a SWMR-compatible VFD for this public routine") + + /* Get the maximum of EOA and EOF */ + if(H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") + + /* Set EOA to the maximum value + increment */ + if(H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + + break; + } + + case H5VL_FILE_SET_LIBVER_BOUNDS: + { + H5F_libver_t low = va_arg(arguments, H5F_libver_t); + H5F_libver_t high = va_arg(arguments, H5F_libver_t); + + /* Call internal set_libver_bounds function */ + if(H5F__set_libver_bounds(f, low, high) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_optional() */ +} /* end H5VL__native_file_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_file_close + * Function: H5VL__native_file_close * * Purpose: Closes a file. * @@ -2143,14 +2213,15 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { int nref; H5F_t *f = (H5F_t *)file; hid_t file_id = H5I_INVALID_HID; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* This routine should only be called when a file ID's ref count drops to zero */ HDassert(H5F_ID_EXISTS(f)); @@ -2164,13 +2235,14 @@ H5VL_native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UN /* Get the file ID corresponding to the H5F_t struct */ if(H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "invalid atom") + /* Get the number of references outstanding for this file ID */ if((nref = H5I_get_ref(file_id, FALSE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't get ID ref count") if(nref == 1) if(H5F__flush(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") - } + } /* end if */ /* Close the file */ if(H5F__close(f) < 0) @@ -2178,11 +2250,11 @@ H5VL_native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UN done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_close() */ +} /* end H5VL__native_file_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_create + * Function: H5VL__native_group_create * * Purpose: Creates a group inside a native h5 file. * @@ -2193,8 +2265,9 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gcpl_id, - hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t gcpl_id, hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ H5G_loc_t loc; /* Location to create group */ @@ -2202,7 +2275,7 @@ H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *na hid_t lcpl_id; void *ret_value; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the property list structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(gcpl_id))) @@ -2228,13 +2301,14 @@ H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *na /* Create the new group & get its ID */ if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") - } + } /* end if */ /* otherwise it's from H5Gcreate */ else { /* Create the new group & get its ID */ if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") - } + } /* end else */ + ret_value = (void *)grp; done: @@ -2250,14 +2324,15 @@ done: /* Decrement refcount on group's object header in memory */ if(H5O_dec_rc_by_loc(oloc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") - } - } + } /* end if */ + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_create() */ +} /* end H5VL__native_group_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_open + * Function: H5VL__native_group_open * * Purpose: Opens a group inside a native h5 file. * @@ -2268,14 +2343,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, - hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t H5_ATTR_UNUSED gapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Location to open group */ H5G_t *grp = NULL; /* New group opend */ void *ret_value; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Set up the location */ if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) @@ -2289,11 +2364,11 @@ H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_open() */ +} /* end H5VL__native_group_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_get + * Function: H5VL__native_group_get * * Purpose: Gets data about a group * @@ -2302,11 +2377,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(get_type) { /* H5Gget_create_plist */ @@ -2319,6 +2395,7 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for group") break; } + /* H5Gget_info */ case H5VL_GROUP_GET_INFO: { @@ -2335,14 +2412,14 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED /* Retrieve the group's information */ if(H5G__obj_info(loc.oloc, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - } + } /* end if */ else if (loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Gget_info_by_name */ /* Retrieve the group's information */ if(H5G__get_info_by_name(&loc, loc_params.loc_data.loc_by_name.name, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - } + } /* end else-if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Gget_info_by_idx */ @@ -2350,23 +2427,23 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED if(H5G__get_info_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, group_info) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") - } break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_get() */ +} /* end H5VL__native_group_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_specific + * Function: H5VL__native_group_specific * * Purpose: Specific operations for groups * @@ -2375,13 +2452,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_group_specific(void *obj, H5VL_group_specific_t specific_type, +H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_t *grp = (H5G_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { case H5VL_GROUP_FLUSH: @@ -2394,6 +2471,7 @@ H5VL_native_group_specific(void *obj, H5VL_group_specific_t specific_type, break; } + case H5VL_GROUP_REFRESH: { hid_t group_id = va_arg(arguments, hid_t); @@ -2404,17 +2482,18 @@ H5VL_native_group_specific(void *obj, H5VL_group_specific_t specific_type, break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_specific() */ +} /* end H5VL__native_group_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_group_close + * Function: H5VL__native_group_close * * Purpose: Closes a group. * @@ -2423,22 +2502,22 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_close((H5G_t *)grp) < 0) HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close group") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_group_close() */ +} /* end H5VL__native_group_close() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_create + * Function: H5VL__native_link_create * * Purpose: Creates an hard/soft/UD/external links. * @@ -2450,13 +2529,14 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, + H5VL_loc_params_t loc_params, hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(lcpl_id))) @@ -2498,14 +2578,15 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc if((ret_value = H5L_create_hard(cur_loc_p, cur_params.loc_data.loc_by_name.name, link_loc_p, loc_params.loc_data.loc_by_name.name, lcpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end if */ else { /* H5Olink */ /* Link to the object */ if(H5L_link(&link_loc, loc_params.loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") - } + } /* end else */ break; } + case H5VL_LINK_CREATE_SOFT: { char *target_name; @@ -2522,6 +2603,7 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") break; } + case H5VL_LINK_CREATE_UD: { H5G_loc_t link_loc; /* Group location for new link */ @@ -2545,16 +2627,18 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") break; } + default: HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "invalid link creation call") - } + } /* end switch */ + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_create() */ +} /* end H5VL__native_link_create() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_copy + * Function: H5VL__native_link_copy * * Purpose: Renames an object within an HDF5 file and copies it to a new * group. The original name SRC is unlinked from the group graph @@ -2571,15 +2655,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, - hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, + hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -2602,11 +2687,11 @@ H5VL_native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_copy() */ +} /* end H5VL__native_link_copy() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_move + * Function: H5VL__native_link_move * * Purpose: Renames an object within an HDF5 file and moves it to a new * group. The original name SRC is unlinked from the group graph @@ -2623,15 +2708,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, - hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t lcpl_id, + hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req) { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(NULL != src_obj && H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -2654,11 +2740,11 @@ H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_move() */ +} /* end H5VL__native_link_move() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_get + * Function: H5VL__native_link_get * * Purpose: Gets certain data about a link * @@ -2671,13 +2757,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_loc_t loc; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -2703,6 +2789,7 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") break; } + /* H5Lget_name_by_idx */ case H5VL_LINK_GET_NAME: { @@ -2717,6 +2804,7 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge break; } + /* H5Lget_val/H5Lget_val_by_idx */ case H5VL_LINK_GET_VAL: { @@ -2739,17 +2827,18 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_get() */ +} /* end H5VL__native_link_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_specific + * Function: H5VL__native_link_specific * * Purpose: Specific operations with links * @@ -2762,12 +2851,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { case H5VL_LINK_EXISTS: @@ -2783,6 +2872,7 @@ H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_spe HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info") break; } + case H5VL_LINK_ITER: { H5G_loc_t loc; @@ -2803,31 +2893,31 @@ H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_spe /* H5Lvisit */ if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") - } + } /* end if */ else { /* H5Literate */ if((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") - } - } + } /* end else */ + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { if(recursive) { /* H5Lvisit_by_name */ if((ret_value = H5G_visit(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") - } + } /* end if */ else { /* H5Literate_by_name */ if((ret_value = H5L_iterate(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") - } - } - else{ + } /* end else */ + } /* end else-if */ + else HGOTO_ERROR(H5E_LINK, H5E_UNSUPPORTED, FAIL, "unknown link iterate params") - } break; } + case H5VL_LINK_DELETE: { H5G_loc_t loc; @@ -2839,28 +2929,28 @@ H5VL_native_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_link_spe if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */ if(H5L_delete(&loc, loc_params.loc_data.loc_by_name.name) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */ - if(H5L_delete_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, loc_params.loc_data.loc_by_idx.idx_type, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") - } + } /* end else-if */ else HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_specific() */ +} /* end H5VL__native_link_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_open + * Function: H5VL__native_object_open * * Purpose: Opens a object inside a native h5 file. * @@ -2873,13 +2963,13 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") @@ -2892,6 +2982,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by name") break; } + case H5VL_OBJECT_BY_IDX: { /* Open the object */ @@ -2900,6 +2991,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by index") break; } + case H5VL_OBJECT_BY_ADDR: { /* Open the object */ @@ -2907,6 +2999,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address") break; } + case H5VL_OBJECT_BY_REF: { hid_t temp_id = H5I_INVALID_HID; @@ -2923,21 +3016,22 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope *opened_type = H5I_get_type(temp_id); if(NULL == (ret_value = H5I_remove(temp_id))) - HDONE_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object") break; } + case H5VL_OBJECT_BY_SELF: default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown open parameters") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_open() */ +} /* end H5VL__native_object_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_copy + * Function: H5VL__native_object_copy * * Purpose: Copys a object inside a native h5 file. * @@ -2950,15 +3044,15 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t src_loc; /* Source object group location */ H5G_loc_t dst_loc; /* Destination group location */ herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* get location for objects */ if(H5G_loc_real(src_obj, loc_params1.obj_type, &src_loc) < 0) @@ -2966,16 +3060,17 @@ H5VL_native_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, const char if(H5G_loc_real(dst_obj, loc_params2.obj_type, &dst_loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - /* Open the object */ + /* Copy the object */ if((ret_value = H5O_copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object") + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_copy() */ +} /* end H5VL__native_object_copy() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_get + * Function: H5VL__native_object_get * * Purpose: Gets certain data about an object * @@ -2987,13 +3082,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ H5G_loc_t loc; /* Location of group */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -3017,6 +3112,7 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ break; } + /* H5Rget_obj_type2 */ case H5VL_REF_GET_TYPE: { @@ -3029,6 +3125,7 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object type") break; } + /* H5Rget_name */ case H5VL_REF_GET_NAME: { @@ -3043,31 +3140,33 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object path") break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") - } + } /* end switch */ + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_get() */ +} /* end H5VL__native_object_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_specific + * Function: H5VL__native_object_specific * - * Purpose: Perform a driver specific operation for an objectibute + * Purpose: Perform a plugin-specific operation for an objectibute * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5G_loc_t loc; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -3084,6 +3183,7 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object break; } + /* H5Oexists_by_name */ case H5VL_OBJECT_EXISTS: { @@ -3092,14 +3192,13 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* Check if the object exists */ if((*ret = H5G_loc_exists(&loc, loc_params.loc_data.loc_by_name.name)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", - loc_params.loc_data.loc_by_name.name) - } - else { + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", loc_params.loc_data.loc_by_name.name) + } /* end if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters") - } break; } + case H5VL_OBJECT_VISIT: { H5_index_t idx_type = va_arg(arguments, H5_index_t); @@ -3113,16 +3212,17 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object /* H5Ovisit */ if((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Ovisit_by_name */ if((ret_value = H5O__visit(&loc, loc_params.loc_data.loc_by_name.name, idx_type, order, op, op_data, fields)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") - } + } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params"); break; } + case H5VL_OBJECT_FLUSH: { hid_t oid = va_arg(arguments, hid_t); @@ -3133,6 +3233,7 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object break; } + case H5VL_OBJECT_REFRESH: { hid_t oid = va_arg(arguments, hid_t); @@ -3144,6 +3245,7 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object break; } + case H5VL_REF_CREATE: { void *ref = va_arg(arguments, void *); @@ -3161,19 +3263,20 @@ H5VL_native_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_object break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_specific() */ +} /* end H5VL__native_object_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_optional + * Function: H5VL__native_object_optional * - * Purpose: Perform a driver specific operation for an objectibute + * Purpose: Perform a plugin-specific operation for an objectibute * * Return: Success: 0 * Failure: -1 @@ -3184,14 +3287,15 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, + void H5_ATTR_UNUSED **req, va_list arguments) { H5VL_object_optional_t optional_type = va_arg(arguments, H5VL_object_optional_t); H5VL_loc_params_t loc_params = va_arg(arguments, H5VL_loc_params_t); H5G_loc_t loc; /* Location of group */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") @@ -3207,12 +3311,12 @@ H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT /* Retrieve the object's information */ if(H5G_loc_info(&loc, ".", obj_info, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */ /* Retrieve the object's information */ if(H5G_loc_info(&loc, loc_params.loc_data.loc_by_name.name, obj_info, fields) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } + } /* end else-if */ else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ @@ -3234,17 +3338,17 @@ H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT if(H5O_get_info(obj_loc.oloc, obj_info, fields) < 0) { H5G_loc_free(&obj_loc); HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") - } + } /* end if */ /* Release the object location */ if(H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") - } - else { + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") - } break; } + /* H5Oget_comment / H5Oget_comment_by_name */ case H5VL_OBJECT_GET_COMMENT: { @@ -3256,16 +3360,16 @@ H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */ if((*ret = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */ if((*ret = H5G_loc_get_comment(&loc, loc_params.loc_data.loc_by_name.name, comment/*out*/, bufsize)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") - } break; } + /* H5Oset_comment */ case H5VL_OBJECT_SET_COMMENT: { @@ -3275,28 +3379,28 @@ H5VL_native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, ".", comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } + } /* end if */ else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */ /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, loc_params.loc_data.loc_by_name.name, comment) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") - } - else { + } /* end else-if */ + else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") - } break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object"); - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_optional() */ +} /* end H5VL__native_object_optional() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_commit + * Function: H5VL__native_datatype_commit * * Purpose: Commits a datatype inside a native h5 file. * @@ -3309,15 +3413,16 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t type_id, - hid_t lcpl_id, hid_t tcpl_id, hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t H5_ATTR_UNUSED tapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5G_loc_t loc; /* Location to commit datatype */ H5T_t *dt; /* Datatype for ID */ H5T_t *type = NULL; /* copy of the original type which will be committed */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* check arguments */ if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) @@ -3351,23 +3456,25 @@ H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char /* H5Tcommit */ if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") - } + } /* end if */ else { /* H5Tcommit_anon */ if(H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") - } + } /* end else */ + ret_value = (void *)type; done: if(NULL == ret_value && type) H5T_close(type); + FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_commit() */ +} /* end H5VL__native_datatype_commit() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_open + * Function: H5VL__native_datatype_open * * Purpose: Opens a named datatype inside a native h5 file. * @@ -3377,14 +3484,14 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, - hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t H5_ATTR_UNUSED tapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { H5T_t *type = NULL; /* Datatype opened in file */ H5G_loc_t loc; /* Group location of object to open */ void *ret_value = NULL; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") @@ -3399,11 +3506,11 @@ H5VL_native_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *n done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_open() */ +} /* end H5VL__native_datatype_open() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_get + * Function: H5VL__native_datatype_get * * Purpose: Gets certain information about a datatype * @@ -3416,13 +3523,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, - hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) +H5VL__native_datatype_get(void *obj, H5VL_datatype_get_t get_type, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5T_t *dt = (H5T_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch (get_type) { case H5VL_DATATYPE_GET_BINARY: @@ -3437,6 +3544,7 @@ H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, *nalloc = (ssize_t) size; break; } + /* H5Tget_create_plist */ case H5VL_DATATYPE_GET_TCPL: { @@ -3447,17 +3555,18 @@ H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, break; } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from datatype") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_get() */ +} /* end H5VL__native_datatype_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_specific + * Function: H5VL__native_datatype_specific * * Purpose: Specific operations for datatype * @@ -3466,13 +3575,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, +H5VL__native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments) { H5T_t *dt = (H5T_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC switch(specific_type) { case H5VL_DATATYPE_FLUSH: @@ -3485,6 +3594,7 @@ H5VL_native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, break; } + case H5VL_DATATYPE_REFRESH: { hid_t type_id = va_arg(arguments, hid_t); @@ -3495,17 +3605,18 @@ H5VL_native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, break; } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") - } + } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_specific() */ +} /* end H5VL__native_datatype_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_close + * Function: H5VL__native_datatype_close * * Purpose: Closes an datatype. * @@ -3518,16 +3629,16 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_datatype_close(void *dt, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_datatype_close(void *dt, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC if(H5T_close((H5T_t*)dt) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close datatype") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_close() */ +} /* end H5VL__native_datatype_close() */ diff --git a/src/H5VLnative.h b/src/H5VLnative.h index 4e33e8a..6751601 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -18,7 +18,7 @@ #define _H5VLnative_H /* Initializer function for native VOL driver */ -#define H5VL_NATIVE (H5VL_native_init()) +#define H5VL_NATIVE (H5VL_native_init(H5P_DEFAULT)) /* Characteristics of the native VOL driver */ #define H5VL_NATIVE_NAME "native" @@ -33,12 +33,12 @@ extern "C" { /* XXX (VOL_MERGE): Poor separation of public and private functionality here */ H5_DLL herr_t H5Pset_fapl_native(hid_t fapl_id); H5_DLL hid_t H5VL_native_get_driver_id(void); -H5_DLL hid_t H5VL_native_init(void); +H5_DLL hid_t H5VL_native_init(hid_t vipl_id); H5_DLL hid_t H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref); -H5_DLL herr_t H5VL_native_unregister(hid_t obj_id); #ifdef __cplusplus } #endif #endif /* _H5VLnative_H */ + diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 98be308..1da5a43 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -26,24 +26,24 @@ /* Library Private Typedefs */ /****************************/ -/* Internal struct to track VOL driver information for objects */ +/* Internal struct to track VOL plugin information for objects */ typedef struct H5VL_t { - const H5VL_class_t *cls; /* Pointer to driver class struct */ + const H5VL_class_t *cls; /* Pointer to plugin class struct */ int64_t nrefs; /* Number of references by objects using this struct */ - hid_t id; /* Identifier for the VOL driver */ + hid_t id; /* Identifier for the VOL plugin */ } H5VL_t; /* Internal vol object structure returned to the API */ typedef struct H5VL_object_t { - void *data; /* Pointer to driver-managed data for this object */ - H5VL_t *driver; /* Pointer to VOL driver struct */ + void *data; /* Pointer to plugin-managed data for this object */ + H5VL_t *plugin; /* Pointer to VOL plugin struct */ } H5VL_object_t; -/* Internal structure to hold the driver ID & info for FAPLs */ -typedef struct H5VL_driver_prop_t { - hid_t driver_id; /* VOL driver's ID */ - const void *driver_info; /* VOL driver info, for open callbacks */ -} H5VL_driver_prop_t; +/* Internal structure to hold the plugin ID & info for FAPLs */ +typedef struct H5VL_plugin_prop_t { + hid_t plugin_id; /* VOL plugin's ID */ + const void *plugin_info; /* VOL plugin info, for open callbacks */ +} H5VL_plugin_prop_t; /*****************************/ /* Library Private Variables */ @@ -55,15 +55,34 @@ typedef struct H5VL_driver_prop_t { /* Common functions */ H5_DLL herr_t H5VL_init(void); -H5_DLL hid_t H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_driver, hbool_t app_ref); +H5_DLL hid_t H5VL_register_id(H5I_type_t type, void *object, H5VL_t *vol_plugin, hbool_t app_ref); H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj); -H5_DLL hid_t H5VL_register(const void *cls, size_t size, hbool_t app_ref); -H5_DLL hid_t H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t driver_id, hbool_t app_ref); -H5_DLL ssize_t H5VL_get_driver_name(hid_t id, char *name/*out*/, size_t size); +H5_DLL hid_t H5VL_register(const void *cls, hbool_t app_ref, hid_t vipl_id); +H5_DLL hid_t H5VL_object_register(void *obj, H5I_type_t obj_type, hid_t plugin_id, hbool_t app_ref); +H5_DLL hid_t H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref); +H5_DLL ssize_t H5VL_get_plugin_name(hid_t id, char *name/*out*/, size_t size); H5_DLL H5VL_object_t *H5VL_get_object(hid_t id); H5_DLL void *H5VL_object(hid_t id); +H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj); H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type); -H5_DLL void *H5VL_driver_object(H5VL_object_t *obj); +H5_DLL void *H5VL_plugin_object(H5VL_object_t *obj); +H5_DLL int H5VL_cmp_plugin_cls(const H5VL_class_t *cls1, const H5VL_class_t *cls); +H5_DLL int H5VL_copy_plugin_info(const H5VL_class_t *plugin, void **dst_info, + const void *src_info); +H5_DLL int H5VL_cmp_plugin_info(const H5VL_class_t *plugin, const void *info1, + const void *info2); +H5_DLL herr_t H5VL_free_plugin_info(const H5VL_class_t *plugin, void *info); +H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *plugin, void *obj, + void **wrap_ctx); +H5_DLL herr_t H5VL_free_wrap_ctx(const H5VL_class_t *plugin, void *wrap_ctx); +H5_DLL herr_t H5VL_set_vol_wrapper(void *obj, const H5VL_t *vol_plugin); +H5_DLL herr_t H5VL_reset_vol_wrapper(void); +H5_DLL void * H5VL_wrap_object(const H5VL_class_t *plugin, void *wrap_ctx, + void *obj); + +/****************************** + * VOL plugin callback wrappers + *****************************/ /* Attribute functions */ H5_DLL void *H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, const H5VL_class_t *cls, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); @@ -128,5 +147,6 @@ H5_DLL herr_t H5VL_datatype_close(void *dt, const H5VL_class_t *cls, hid_t dxpl_ H5_DLL herr_t H5VL_request_cancel(void **req, const H5VL_class_t *cls, H5ES_status_t *status); H5_DLL herr_t H5VL_request_test(void **req, const H5VL_class_t *cls, H5ES_status_t *status); H5_DLL herr_t H5VL_request_wait(void **req, const H5VL_class_t *cls, H5ES_status_t *status); + #endif /* _H5VLprivate_H */ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index d118bcc..e345c2a 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -52,7 +52,7 @@ /* Group creation property names */ #define H5VL_PROP_GRP_LCPL_ID "group_lcpl_id" -/* Default VOL driver value */ +/* Default VOL plugin value */ #define H5VL_VOL_DEFAULT 0 @@ -112,17 +112,17 @@ typedef enum H5VL_datatype_specific_t { typedef enum H5VL_file_get_t { H5VL_FILE_GET_FAPL, /* file access property list */ H5VL_FILE_GET_FCPL, /* file creation property list */ - H5VL_FILE_GET_INTENT, /* file intent */ + H5VL_FILE_GET_INTENT, /* file intent */ H5VL_FILE_GET_NAME, /* file name */ H5VL_FILE_GET_OBJ_COUNT, /* object count in file */ - H5VL_FILE_GET_OBJ_IDS, /* object ids in file */ - H5VL_OBJECT_GET_FILE /* retrieve or resurrect file of object */ + H5VL_FILE_GET_OBJ_IDS /* object ids in file */ } 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_MOUNT, /* Mount a file */ H5VL_FILE_UNMOUNT /* Un-Mount a file */ } H5VL_file_specific_t; @@ -328,57 +328,56 @@ typedef struct H5VL_object_class_t { herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); } H5VL_object_class_t; -/* H5AO routines */ +/* Async operation routines */ typedef struct H5VL_async_class_t { herr_t (*cancel)(void **, H5ES_status_t *); herr_t (*test) (void **, H5ES_status_t *); herr_t (*wait) (void **, H5ES_status_t *); } H5VL_async_class_t; -/* VOL category (internal, external, etc.) - * XXX: This is intended to replace the H5VL_class_value_t struct, which seems - * difficult to manage. It's currently unused so I don't break struct - * compatibility with existing VOLs. - */ -typedef enum H5VL_category_t { - H5VL_INTERNAL, /* Internal VOL driver */ - H5VL_EXTERNAL /* External VOL driver (plugin) */ -} H5VL_category_t; -/* enum value to identify the class of a VOL driver (mostly for comparison purposes) */ +/* enum value to identify the class of a VOL plugin (mostly for comparison purposes) */ typedef enum H5VL_class_value_t { H5_VOL_NATIVE = 0, /* This should be first */ H5_VOL_MAX_LIB_VALUE = 128 /* This should be last */ } H5VL_class_value_t; -/* Class information for each VOL driver */ + +/* Capability flags for plugins */ +#define H5VL_CAP_FLAG_NONE 0 /* No special plugin capabilities */ +#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Plugin is threadsafe */ + + +/* Class information for each VOL plugin */ /* XXX: We should consider adding a UUID/GUID field to this struct * as well as a H5VLregister_by_uuid() API call for people who - * really care about getting a particular VOL driver. + * really care about getting a particular VOL plugin. * XXX: We should also consider adding enough information so that - * files can be opened without specifying the VOL driver. + * files can be opened without specifying the VOL plugin. * e.g.: If we stored a UUID and version, we could search for - * a matching VOL driver so a user did not have to make any + * a matching VOL plugin so a user did not have to make any * H5VL calls. */ typedef struct H5VL_class_t { - /* XXX: How do we identify unique VOL drivers? + /* XXX: How do we identify unique VOL plugin? * This is unclear, but for now we'll keep * all the ID fields from the original VOL * branch. */ - unsigned int version; /* VOL driver version # - * XXX: Is this supposed to be a VOL driver - * version number or a VOL API version - * number? Maybe we need both? - */ - H5VL_class_value_t value; /* value to identify driver */ + unsigned int version; /* VOL plugin API version # */ + H5VL_class_value_t value; /* value to identify plugin */ const char *name; /* Plugin name (MUST be unique!) */ + unsigned cap_flags; /* capability flags for plugin */ herr_t (*initialize)(hid_t vipl_id); /* Plugin initialization callback */ - herr_t (*terminate)(hid_t vtpl_id); /* Plugin termination callback */ - size_t fapl_size; /* size of the vol info in the fapl property */ - void * (*fapl_copy)(const void *info); /* callback to create a copy of the vol info */ - herr_t (*fapl_free)(void *info); /* callback to release the vol info copy */ + herr_t (*terminate)(void); /* Plugin termination callback */ + size_t info_size; /* size of the vol info */ + void * (*info_copy)(const void *info); /* callback to create a copy of the vol info */ + int (*info_cmp)(const void *info1, const void *info2); /* callback to compare vol info */ + herr_t (*info_free)(void *info); /* callback to release the vol info copy */ + void * (*get_object)(const void *obj); /* callback to retrieve underlying object */ + herr_t (*get_wrap_ctx)(const void *obj, void **wrap_ctx); /* callback to retrieve the object wrapping context for the plugin */ + herr_t (*free_wrap_ctx)(void *wrap_ctx); /* callback to release the object wrapping context for the plugin */ + void* (*wrap_object)(void *obj, void *wrap_ctx); /* callback to wrap an object */ /* Data Model */ H5VL_attr_class_t attr_cls; /* attribute class callbacks */ @@ -390,7 +389,9 @@ typedef struct H5VL_class_t { H5VL_object_class_t object_cls; /* object class callbacks */ /* Services */ - H5VL_async_class_t async_cls; /* asynchronous class callbacks */ + H5VL_async_class_t async_cls; /* asynchronous class callbacks */ + + /* Catch-all */ herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); /* Optional callback */ } H5VL_class_t; @@ -407,92 +408,113 @@ typedef struct H5VL_class_t { extern "C" { #endif -/* VOL Driver/Plugin Functionality */ -H5_DLL herr_t H5VLinitialize(hid_t driver_id, hid_t vipl_id); -H5_DLL herr_t H5VLterminate(hid_t driver_id, hid_t vtpl_id); -H5_DLL herr_t H5VLclose(hid_t driver_id); -H5_DLL hid_t H5VLregister(const H5VL_class_t *cls); -H5_DLL hid_t H5VLregister_by_name(const char *driver_name); -H5_DLL herr_t H5VLunregister(hid_t driver_id); +/* VOL Plugin Functionality */ +H5_DLL hid_t H5VLregister(const H5VL_class_t *cls, hid_t vipl_id); +H5_DLL hid_t H5VLregister_by_name(const char *plugin_name, hid_t vipl_id); H5_DLL htri_t H5VLis_registered(const char *name); -H5_DLL hid_t H5VLget_driver_id(const char *name); -H5_DLL ssize_t H5VLget_driver_name(hid_t id, char *name/*out*/, size_t size); -H5_DLL hid_t H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t driver_id); +H5_DLL hid_t H5VLget_plugin_id(const char *name); +H5_DLL ssize_t H5VLget_plugin_name(hid_t id, char *name/*out*/, size_t size); +H5_DLL herr_t H5VLclose(hid_t plugin_id); +H5_DLL herr_t H5VLunregister(hid_t plugin_id); + + +/************************************************************************** + * VOL callback wrappers and helper routines, for VOL plugin authors only * + * (Not part of the public API for application developers) * + **************************************************************************/ + +/* Helper routines for VOL plugin authors */ +H5_DLL hid_t H5VLobject_register(void *obj, H5I_type_t obj_type, hid_t plugin_id); H5_DLL void *H5VLobject(hid_t id); -H5_DLL herr_t H5VLget_object(hid_t obj_id, void **obj); - -/* Attributes */ -H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_read(void *attr, hid_t driver_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_write(void *attr, hid_t driver_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_get(void *obj, hid_t driver_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_close(void *attr, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Datasets */ -H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdataset_read(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); -H5_DLL herr_t H5VLdataset_write(void *dset, hid_t driver_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); -H5_DLL herr_t H5VLdataset_get(void *dset, hid_t driver_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t driver_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdataset_close(void *dset, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Files */ +H5_DLL herr_t H5VLcmp_plugin_cls(int *cmp, hid_t plugin_id1, hid_t plugin_id2); +H5_DLL herr_t H5VLcmp_plugin_info(int *cmp, hid_t plugin_id, const void *info1, + const void *info2); + + +/* Public wrappers for generic callbacks */ +H5_DLL herr_t H5VLinitialize(hid_t plugin_id, hid_t vipl_id); +H5_DLL herr_t H5VLterminate(hid_t plugin_id); +H5_DLL herr_t H5VLget_cap_flags(hid_t plugin_id, unsigned *cap_flags); +H5_DLL herr_t H5VLcopy_plugin_info(hid_t plugin_id, void **dst_vol_info, void *src_vol_info); +H5_DLL herr_t H5VLfree_plugin_info(hid_t plugin_id, void *vol_info); +H5_DLL void *H5VLget_object(void *obj, hid_t plugin_id); +H5_DLL herr_t H5VLget_wrap_ctx(void *obj, hid_t plugin_id, void **wrap_ctx); +H5_DLL herr_t H5VLfree_wrap_ctx(void *wrap_ctx, hid_t plugin_id); +H5_DLL void *H5VLwrap_object(void *obj, hid_t plugin_id, void *wrap_ctx); + +/* Public wrappers for attribute callbacks */ +H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_read(void *attr, hid_t plugin_id, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_write(void *attr, hid_t plugin_id, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_get(void *obj, hid_t plugin_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_close(void *attr, hid_t plugin_id, hid_t dxpl_id, void **req); + +/* Public wrappers for dataset callbacks */ +H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdataset_read(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); +H5_DLL herr_t H5VLdataset_write(void *dset, hid_t plugin_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +H5_DLL herr_t H5VLdataset_get(void *dset, hid_t plugin_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t plugin_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_close(void *dset, hid_t plugin_id, hid_t dxpl_id, void **req); + +/* Public wrappers for file callbacks */ H5_DLL void *H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLfile_get(void *file, hid_t driver_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_specific(void *obj, hid_t driver_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_close(void *file, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Groups */ -H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLgroup_get(void *obj, hid_t driver_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t driver_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLgroup_close(void *grp, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Links */ -H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLfile_get(void *file, hid_t plugin_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_specific(void *obj, hid_t plugin_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_close(void *file, hid_t plugin_id, hid_t dxpl_id, void **req); + +/* Public wrappers for group callbacks */ +H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLgroup_get(void *obj, hid_t plugin_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t plugin_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_close(void *grp, hid_t plugin_id, hid_t dxpl_id, void **req); + +/* Public wrappers for link callbacks */ +H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **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, hid_t driver_id, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLlink_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); - -/* Objects */ -H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t driver_id1, const char *src_name, - void *dst_obj, H5VL_loc_params_t loc_params2, hid_t driver_id2, const char *dst_name, +H5_DLL herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); + +/* Public wrappers for object callbacks */ +H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, hid_t plugin_id1, const char *src_name, + void *dst_obj, H5VL_loc_params_t loc_params2, hid_t plugin_id2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); - -/* Datatypes */ -H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL void *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t driver_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t driver_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t driver_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t driver_id, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t driver_id, hid_t dxpl_id, void **req); - -/* Asynchronous Requests */ -H5_DLL herr_t H5VLrequest_cancel(void **req, hid_t driver_id, H5ES_status_t *status); -H5_DLL herr_t H5VLrequest_test(void **req, hid_t driver_id, H5ES_status_t *status); -H5_DLL herr_t H5VLrequest_wait(void **req, hid_t driver_id, H5ES_status_t *status); +H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); + +/* Public wrappers for named datatype callbacks */ +H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, hid_t plugin_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t plugin_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t plugin_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t plugin_id, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t plugin_id, hid_t dxpl_id, void **req); + +/* Public wrappers for asynchronous request callbacks */ +H5_DLL herr_t H5VLrequest_cancel(void **req, hid_t plugin_id, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_test(void **req, hid_t plugin_id, H5ES_status_t *status); +H5_DLL herr_t H5VLrequest_wait(void **req, hid_t plugin_id, H5ES_status_t *status); #ifdef __cplusplus } #endif #endif /* _H5VLpublic_H */ + @@ -586,7 +586,9 @@ static int H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key) { H5F_t *f = (H5F_t *)obj_ptr; /* File object for operations */ +#ifdef H5_HAVE_PARALLEL H5Z_object_t *object = (H5Z_object_t *)key; +#endif /* H5_HAVE_PARALLEL */ int ret_value = FALSE; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5private.h b/src/H5private.h index 63f6858..b654bae 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2086,10 +2086,11 @@ H5_DLL herr_t H5CX_pop(void); /* * Use this macro for API functions that shouldn't perform _any_ initialization * of the library or an interface, just perform tracing, etc. Examples - * are: H5allocate_memory, H5is_library_threadsafe, etc. + * are: H5allocate_memory, H5is_library_threadsafe, public VOL callback + * wrappers (e.g. H5VLfile_create, H5VLdataset_read, etc.), etc. * */ -#define FUNC_ENTER_API_NOINIT {{ \ +#define FUNC_ENTER_API_NOINIT {{{ \ FUNC_ENTER_API_COMMON \ H5_PUSH_FUNC \ BEGIN_MPE_LOG \ @@ -2102,7 +2103,7 @@ H5_DLL herr_t H5CX_pop(void); * are: H5close, H5check_version, etc. * */ -#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{ \ +#define FUNC_ENTER_API_NOINIT_NOERR_NOFS {{{{ \ FUNC_ENTER_API_VARS \ FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ FUNC_ENTER_API_THREADSAFE; \ @@ -2289,14 +2290,14 @@ H5_DLL herr_t H5CX_pop(void); (void)H5E_dump_api_stack(TRUE); \ FUNC_LEAVE_API_THREADSAFE \ return(ret_value); \ -}} /*end scope from beginning of FUNC_ENTER*/ +}}} /*end scope from beginning of FUNC_ENTER*/ /* Use this macro to match the FUNC_ENTER_API_NOINIT_NOERR_NOFS macro */ #define FUNC_LEAVE_API_NOFS(ret_value) \ FUNC_LEAVE_API_COMMON(ret_value); \ FUNC_LEAVE_API_THREADSAFE \ return(ret_value); \ -}} /*end scope from beginning of FUNC_ENTER*/ +}}}} /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI(ret_value) \ ; \ diff --git a/src/H5trace.c b/src/H5trace.c index 08db09a..a63bdfa 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -2711,9 +2711,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_FILE_GET_OBJ_IDS: HDfprintf(out, "H5VL_FILE_GET_OBJ_IDS"); break; - case H5VL_OBJECT_GET_FILE: - HDfprintf(out, "H5VL_OBJECT_GET_FILE"); - break; default: HDfprintf(out, "%ld", (long)get); break; @@ -2734,6 +2731,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) case H5VL_FILE_FLUSH: HDfprintf(out, "H5VL_FILE_FLUSH"); break; + case H5VL_FILE_REOPEN: + HDfprintf(out, "H5VL_FILE_REOPEN"); + break; case H5VL_FILE_MOUNT: HDfprintf(out, "H5VL_FILE_MOUNT"); break; diff --git a/src/Makefile.am b/src/Makefile.am index 7889e10..6dc24c2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -114,7 +114,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Topaque.c \ H5Torder.c \ H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c H5Tvlen.c H5TS.c \ - H5VL.c H5VLint.c H5VLnative.c \ + H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c \ H5VM.c H5WB.c H5Z.c \ H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \ H5Zscaleoffset.c H5Zszip.c H5Ztrans.c |