diff options
-rwxr-xr-x | bin/trace | 23 | ||||
-rw-r--r-- | examples/h5_external_log_native_vol.c | 102 | ||||
-rw-r--r-- | src/H5A.c | 173 | ||||
-rw-r--r-- | src/H5Adeprec.c | 18 | ||||
-rw-r--r-- | src/H5Aint.c | 205 | ||||
-rw-r--r-- | src/H5Apkg.h | 3 | ||||
-rw-r--r-- | src/H5D.c | 50 | ||||
-rw-r--r-- | src/H5Ddeprec.c | 8 | ||||
-rw-r--r-- | src/H5Dint.c | 2 | ||||
-rw-r--r-- | src/H5Dio.c | 4 | ||||
-rw-r--r-- | src/H5F.c | 87 | ||||
-rw-r--r-- | src/H5Fint.c | 4 | ||||
-rw-r--r-- | src/H5Fmount.c | 9 | ||||
-rw-r--r-- | src/H5Fpkg.h | 30 | ||||
-rw-r--r-- | src/H5Fprivate.h | 14 | ||||
-rw-r--r-- | src/H5G.c | 34 | ||||
-rw-r--r-- | src/H5Gdeprec.c | 126 | ||||
-rw-r--r-- | src/H5I.c | 2 | ||||
-rw-r--r-- | src/H5L.c | 163 | ||||
-rw-r--r-- | src/H5Lexternal.c | 2 | ||||
-rw-r--r-- | src/H5Lprivate.h | 3 | ||||
-rw-r--r-- | src/H5O.c | 109 | ||||
-rw-r--r-- | src/H5Ocopy.c | 2 | ||||
-rw-r--r-- | src/H5Opkg.h | 6 | ||||
-rw-r--r-- | src/H5R.c | 16 | ||||
-rw-r--r-- | src/H5Rdeprec.c | 5 | ||||
-rw-r--r-- | src/H5Tcommit.c | 24 | ||||
-rw-r--r-- | src/H5Tdeprec.c | 6 | ||||
-rw-r--r-- | src/H5VL.c | 1315 | ||||
-rw-r--r-- | src/H5VLint.c | 733 | ||||
-rw-r--r-- | src/H5VLnative.c | 1494 | ||||
-rw-r--r-- | src/H5VLprivate.h | 110 | ||||
-rw-r--r-- | src/H5VLpublic.h | 312 | ||||
-rw-r--r-- | src/H5trace.c | 250 | ||||
-rw-r--r-- | test/testfiles/err_compat_1 | 16 |
35 files changed, 2585 insertions, 2875 deletions
@@ -94,17 +94,20 @@ $Source = ""; "unsigned long" => "Ul", "unsigned long long" => "UL", "H5VL_attr_get_t" => "Va", - "H5VL_dataset_get_t" => "Vd", - "H5VL_file_get_t" => "Vf", - "H5VL_file_misc_t" => "Vm", - "H5VL_file_optional_t" => "Vn", - "H5VL_group_get_t" => "Vg", - "H5VL_datatype_get_t" => "Vt", - "H5VL_link_create_type_t" => "Vc", + "H5VL_attr_specific_t" => "Vb", + "H5VL_dataset_get_t" => "Vc", + "H5VL_dataset_specific_t" => "Vd", + "H5VL_datatype_get_t" => "Ve", + "H5VL_datatype_specific_t" => "Vf", + "H5VL_file_get_t" => "Vg", + "H5VL_file_specific_t" => "Vh", + "H5VL_group_get_t" => "Vi", + "H5VL_group_specific_t" => "Vj", + "H5VL_link_create_type_t" => "Vk", "H5VL_link_get_t" => "Vl", - "H5VL_object_misc_t" => "Vx", - "H5VL_object_optional_t" => "Vp", - "H5VL_object_get_t" => "Vo", + "H5VL_link_specific_t" => "Vm", + "H5VL_object_get_t" => "Vn", + "H5VL_object_specific_t" => "Vo", "void" => "x", "FILE" => "x", "H5A_operator_t" => "x", diff --git a/examples/h5_external_log_native_vol.c b/examples/h5_external_log_native_vol.c index a61fdac..658c73a 100644 --- a/examples/h5_external_log_native_vol.c +++ b/examples/h5_external_log_native_vol.c @@ -6,14 +6,10 @@ #define LOG 502
-/* Atrribute callbacks */
-static void *H5VL_log_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 herr_t H5VL_log_attr_close(void *attr, hid_t dxpl_id, void **req);
-
/* Datatype callbacks */
static void *H5VL_log_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_log_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
-static ssize_t H5VL_log_datatype_get_binary(void *obj, unsigned char *buf, size_t size, hid_t dxpl_id, void **req);
+static herr_t H5VL_log_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_log_datatype_close(void *dt, hid_t dxpl_id, void **req);
/* Dataset callbacks */
@@ -33,16 +29,13 @@ static herr_t H5VL_log_file_close(void *file, hid_t dxpl_id, void **req); /* Group callbacks */
static void *H5VL_log_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_log_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_log_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
static herr_t H5VL_log_group_close(void *grp, hid_t dxpl_id, void **req);
/* Link callbacks */
/* Object callbacks */
static void *H5VL_log_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_log_object_visit(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type,
- H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t dxpl_id, void **req);
+static herr_t H5VL_log_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 const H5VL_class_t H5VL_log_g = {
LOG,
@@ -57,63 +50,66 @@ static const H5VL_class_t H5VL_log_g = { NULL, //H5VL_log_attr_open, /* open */
NULL, //H5VL_log_attr_read, /* read */
NULL, //H5VL_log_attr_write, /* write */
- NULL, //H5VL_log_attr_iterate,
NULL, //H5VL_log_attr_get, /* get */
- NULL, //H5VL_log_attr_remove, /* remove */
+ NULL, //H5VL_log_attr_specific, /* specific */
+ NULL, //H5VL_log_attr_optional, /* optional */
NULL //H5VL_log_attr_close /* close */
},
- { /* datatype_cls */
- H5VL_log_datatype_commit, /* commit */
- H5VL_log_datatype_open, /* open */
- H5VL_log_datatype_get_binary, /* get_size */
- NULL,//H5VL_log_datatype_get
- H5VL_log_datatype_close /* close */
- },
{ /* dataset_cls */
- H5VL_log_dataset_create, /* create */
- H5VL_log_dataset_open, /* open */
- H5VL_log_dataset_read, /* read */
- H5VL_log_dataset_write, /* write */
- NULL, //H5VL_log_dataset_set_extent, /* set extent */
- NULL, //H5VL_log_dataset_get, /* get */
- H5VL_log_dataset_close /* close */
+ H5VL_log_dataset_create, /* create */
+ H5VL_log_dataset_open, /* open */
+ H5VL_log_dataset_read, /* read */
+ H5VL_log_dataset_write, /* write */
+ NULL, //H5VL_log_dataset_get, /* get */
+ NULL, //H5VL_log_dataset_specific, /* specific */
+ NULL, //H5VL_log_dataset_optional, /* optional */
+ H5VL_log_dataset_close /* close */
+ },
+ { /* datatype_cls */
+ H5VL_log_datatype_commit, /* commit */
+ H5VL_log_datatype_open, /* open */
+ H5VL_log_datatype_get, /* get_size */
+ NULL, //H5VL_log_datatype_specific, /* specific */
+ NULL, //H5VL_log_datatype_optional, /* optional */
+ H5VL_log_datatype_close /* close */
},
{ /* file_cls */
- H5VL_log_file_create, /* create */
- H5VL_log_file_open, /* open */
- NULL, //H5VL_log_file_flush, /* flush */
- H5VL_log_file_get, /* get */
- NULL, //H5VL_log_file_misc, /* misc */
- NULL, //H5VL_log_file_optional, /* optional */
- H5VL_log_file_close /* close */
+ H5VL_log_file_create, /* create */
+ H5VL_log_file_open, /* open */
+ H5VL_log_file_get, /* get */
+ NULL, //H5VL_log_file_specific, /* specific */
+ NULL, //H5VL_log_file_optional, /* optional */
+ H5VL_log_file_close /* close */
},
{ /* group_cls */
- H5VL_log_group_create, /* create */
- NULL, //H5VL_log_group_open, /* open */
- NULL, //H5VL_log_group_get, /* get */
- H5VL_log_group_close /* close */
+ H5VL_log_group_create, /* create */
+ NULL, //H5VL_log_group_open, /* open */
+ NULL, //H5VL_log_group_get, /* get */
+ NULL, //H5VL_log_group_specific, /* specific */
+ NULL, //H5VL_log_group_optional, /* optional */
+ H5VL_log_group_close /* close */
},
{ /* link_cls */
NULL, //H5VL_log_link_create, /* create */
+ NULL, //H5VL_log_link_copy, /* copy */
NULL, //H5VL_log_link_move, /* move */
- NULL, //H5VL_log_link_iterate, /* iterate */
NULL, //H5VL_log_link_get, /* get */
- NULL //H5VL_log_link_remove /* remove */
+ NULL, //H5VL_log_link_specific, /* specific */
+ NULL, //H5VL_log_link_optional, /* optional */
},
{ /* object_cls */
- H5VL_log_object_open, /* open */
+ H5VL_log_object_open, /* open */
NULL, //H5VL_log_object_copy, /* copy */
- H5VL_log_object_visit, /* visit */
NULL, //H5VL_log_object_get, /* get */
- NULL, //H5VL_log_object_misc, /* misc */
+ H5VL_log_object_specific, /* specific */
NULL, //H5VL_log_object_optional, /* optional */
- NULL //H5VL_log_object_close /* close */
},
{
NULL,
NULL,
NULL
- }
+ },
+ NULL
};
typedef struct H5VL_log_t {
@@ -359,15 +355,15 @@ H5VL_log_datatype_open(void *obj, H5VL_loc_params_t loc_params, const char *name return (void *)dt;
}
-static ssize_t
-H5VL_log_datatype_get_binary(void *obj, unsigned char *buf, size_t size, hid_t dxpl_id, void **req)
+static herr_t
+H5VL_log_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
{
- H5VL_log_t *o = (H5VL_log_t *)obj;
- ssize_t ret_value;
+ H5VL_log_t *o = (H5VL_log_t *)dt;
+ herr_t ret_value;
- ret_value = H5VLdatatype_get_binary(o->under_object, o->under_plugin, buf, size, dxpl_id, req);
+ ret_value = H5VLdatatype_get(o->under_object, o->under_plugin, get_type, dxpl_id, req, arguments);
- printf("------- LOG get_binary\n");
+ printf("------- LOG datatype get\n");
return ret_value;
}
@@ -402,14 +398,14 @@ H5VL_log_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened }
static herr_t
-H5VL_log_object_visit(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type,
- H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t dxpl_id, void **req)
+H5VL_log_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)
{
H5VL_log_t *o = (H5VL_log_t *)obj;
- H5VLobject_visit(o->under_object, loc_params, o->under_plugin, idx_type, order, op, op_data, dxpl_id, req);
+ H5VLobject_specific(o->under_object, loc_params, o->under_plugin, specific_type, dxpl_id, req, arguments);
- printf("------- LOG H5Ovisit\n");
+ printf("------- LOG Object specific\n");
return 1;
}
@@ -275,7 +275,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, /* Create the attribute through the VOL */ if(NULL == (attr = H5VL_attr_create(obj, loc_params, vol_plugin, attr_name, acpl_id, aapl_id, - H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create attribute") /* Get an atom for the attribute */ @@ -284,7 +284,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_attr_close(attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr") FUNC_LEAVE_API(ret_value) @@ -374,7 +374,8 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_create(obj, loc_params, vol_plugin, attr_name, acpl_id, aapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (attr = H5VL_attr_create(obj, loc_params, vol_plugin, attr_name, acpl_id, + aapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create attribute") /* Get an atom for the attribute */ @@ -383,7 +384,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr") FUNC_LEAVE_API(ret_value) } /* H5Acreate_by_name() */ @@ -438,7 +439,8 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, attr_name, aapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, attr_name, aapl_id, + H5AC_ind_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Get an atom for the attribute */ @@ -447,7 +449,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr") FUNC_LEAVE_API(ret_value) } /* H5Aopen() */ @@ -514,7 +516,8 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, attr_name, aapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, attr_name, aapl_id, + H5AC_ind_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Get an atom for the attribute */ @@ -523,7 +526,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr") FUNC_LEAVE_API(ret_value) } /* H5Aopen_by_name() */ @@ -599,7 +602,8 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, NULL, aapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, NULL, aapl_id, + H5AC_ind_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Get an atom for the attribute */ @@ -608,7 +612,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to release attr") FUNC_LEAVE_API(ret_value) } /* H5Aopen_by_idx() */ @@ -651,7 +655,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* write the data through the VOL */ - if((ret_value = H5VL_attr_write(attr, vol_plugin, dtype_id, buf, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_attr_write(attr, vol_plugin, dtype_id, buf, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't read data") done: @@ -696,7 +700,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Read the data through the VOL */ - if((ret_value = H5VL_attr_read(attr, vol_plugin, dtype_id, buf, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_attr_read(attr, vol_plugin, dtype_id, buf, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't read data") done: @@ -739,7 +743,7 @@ H5Aget_space(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the dataspace through the VOL */ - if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_SPACE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) + if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_SPACE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get data space") done: @@ -782,7 +786,7 @@ H5Aget_type(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the datatype through the VOL */ - if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_TYPE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) + if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_TYPE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get type") done: @@ -831,7 +835,7 @@ H5Aget_create_plist(hid_t attr_id) /* get the acpl through the VOL */ if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_ACPL, H5AC_dxpl_id, - H5_EVENT_STACK_NULL, &ret_value) < 0) + H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get acpl") done: @@ -885,7 +889,8 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the name through the VOL */ - if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_NAME, H5AC_dxpl_id, H5_EVENT_STACK_NULL, loc_params, buf_size, buf, &ret_value) < 0) + if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_NAME, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + loc_params, buf_size, buf, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get name") done: @@ -955,20 +960,10 @@ 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 through the VOL */ - if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_GET_NAME, H5AC_dxpl_id, H5_EVENT_STACK_NULL, + if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_GET_NAME, H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get name") -#if 0 - if(H5VL_object_misc(loc_id, H5VL_ATTR_OPEN_BY_IDX, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &attr_id, - obj_name, idx_type, order, n, H5P_DEFAULT, lapl_id) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to open attribute") - - /* get the name through the VOL */ - if(H5VL_attr_get(attr_id, H5VL_ATTR_GET_NAME, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value, size, name) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get name") -#endif - done: FUNC_LEAVE_API(ret_value) } /* end H5Aget_name_by_idx() */ @@ -1003,14 +998,14 @@ H5Aget_storage_size(hid_t attr_id) /* check arguments */ if(NULL == (attr = (void *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(attr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "ID does not contain VOL information") /* get the storage size through the VOL */ - if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_STORAGE_SIZE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) + if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_STORAGE_SIZE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, 0, "unable to get acpl") done: @@ -1054,7 +1049,8 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) loc_params.obj_type = H5I_get_type(attr_id); /* get the attribute info through the VOL */ - if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_INFO, H5AC_dxpl_id, H5_EVENT_STACK_NULL, loc_params, ainfo) < 0) + if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_INFO, H5AC_ind_dxpl_id, + H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info") done: @@ -1115,24 +1111,10 @@ 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 info through the VOL */ - if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_GET_INFO, H5AC_dxpl_id, H5_EVENT_STACK_NULL, loc_params, ainfo, attr_name) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info") - -#if 0 - /* Open the attribute through the VOL */ - if((attr_id = H5VL_attr_open(loc_id, loc_params, attr_name, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to open attribute") - - /* get the attribute info through the VOL */ - if(H5VL_attr_get(attr_id, H5VL_ATTR_GET_INFO, H5AC_dxpl_id, H5_EVENT_STACK_NULL, ainfo) < 0) + if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_GET_INFO, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + loc_params, ainfo, attr_name) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info") - /* release resources */ - if(attr_id > 0 && H5VL_attr_close(attr_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") - -#endif - done: FUNC_LEAVE_API(ret_value) } /* end H5Aget_info_by_name() */ @@ -1198,33 +1180,10 @@ 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 info through the VOL */ - if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_GET_INFO, H5AC_dxpl_id, H5_EVENT_STACK_NULL, + if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_GET_INFO, H5AC_ind_dxpl_id, H5_REQUEST_NULL, loc_params, ainfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info") -#if 0 - /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") - - /* Get the attribute information */ - if(H5A_get_info(attr, ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") - - /* open the attribute through the VOL */ - if(H5VL_object_misc(loc_id, H5VL_ATTR_OPEN_BY_IDX, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &attr_id, - obj_name, idx_type, order, n, H5P_DEFAULT, lapl_id) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to open attribute") - - /* get the attribute info through the VOL */ - if(H5VL_attr_get(attr_id, H5VL_ATTR_GET_INFO, H5AC_dxpl_id, H5_EVENT_STACK_NULL, ainfo) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info") - - /* Release resources */ - if(attr_id && H5VL_attr_close(attr_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") -#endif - done: FUNC_LEAVE_API(ret_value) } /* end H5Aget_info_by_idx() */ @@ -1274,8 +1233,8 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* rename the attribute info through the VOL */ - if(H5VL_object_misc(obj, loc_params, vol_plugin, H5VL_ATTR_RENAME, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - old_name, new_name) < 0) + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_RENAME, + H5AC_dxpl_id, H5_REQUEST_NULL, old_name, new_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } done: @@ -1340,8 +1299,9 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* rename the attribute info through the VOL */ - if(H5VL_object_misc(obj, loc_params, vol_plugin, H5VL_ATTR_RENAME, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - old_attr_name, new_attr_name) < 0) + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_RENAME, + H5AC_dxpl_id, H5_REQUEST_NULL, + old_attr_name, new_attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1414,17 +1374,18 @@ H5Aiterate2(hid_t loc_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(loc_id); - /* get the file object */ - if(NULL == (obj = (void *)H5I_object(loc_id))) + /* get the loc object */ + if(NULL == (obj = (void *)H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the links through the VOL */ - if((ret_value = H5VL_attr_iterate(obj, loc_params, vol_plugin, idx_type, order, idx, - op, op_data, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_ITER, + H5AC_dxpl_id, H5_REQUEST_NULL, + idx_type, order, idx, op, op_data)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "attribute iteration failed") done: FUNC_LEAVE_API(ret_value) @@ -1482,7 +1443,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, void *obj = NULL; /* object token of loc_id */ H5VL_t *vol_plugin; /* VOL plugin information */ H5VL_loc_params_t loc_params; - herr_t ret_value; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE8("e", "i*sIiIo*hx*xi", loc_id, obj_name, idx_type, order, idx, op, @@ -1508,16 +1469,17 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, loc_params.loc_data.loc_by_name.name = obj_name; loc_params.loc_data.loc_by_name.lapl_id = lapl_id; - /* get the file object */ - if(NULL == (obj = (void *)H5I_object(loc_id))) + /* get the loc object */ + if(NULL == (obj = (void *)H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the links through the VOL */ - if((ret_value = H5VL_attr_iterate(obj, loc_params, vol_plugin, idx_type, order, idx, - op, op_data, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_ITER, + H5AC_dxpl_id, H5_REQUEST_NULL, + idx_type, order, idx, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "attribute iteration failed") done: @@ -1566,8 +1528,9 @@ H5Adelete(hid_t loc_id, const char *name) if(NULL == (obj = (void *)H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Open the attribute through the VOL */ - if(H5VL_attr_remove(obj, loc_params, vol_plugin, name, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + /* Delete the attribute through the VOL */ + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_DELETE, + H5AC_dxpl_id, H5_REQUEST_NULL, name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1628,8 +1591,9 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(NULL == (obj = (void *)H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Open the attribute through the VOL */ - if(H5VL_attr_remove(obj, loc_params, vol_plugin, attr_name, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + /* Delete the attribute through the VOL */ + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_DELETE, + H5AC_dxpl_id, H5_REQUEST_NULL, attr_name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1703,21 +1667,11 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(NULL == (obj = (void *)H5VL_get_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") - /* Open the attribute through the VOL */ - if(H5VL_attr_remove(obj, loc_params, vol_plugin, NULL, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + /* Delete the attribute through the VOL */ + if((ret_value = H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_DELETE, + H5AC_dxpl_id, H5_REQUEST_NULL, NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") -#if 0 - loc_params.type = H5VL_OBJECT_BY_NAME; - loc_params.loc_data.loc_by_name.name = obj_name; - loc_params.loc_data.loc_by_name.lapl_id = lapl_id; - - /* get the attribute info through the VOL */ - if(H5VL_object_misc(loc_id, H5VL_ATTR_DELETE_BY_IDX, H5AC_dxpl_id, H5_EVENT_STACK_NULL, loc_params, - idx_type, order, n) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info") -#endif - done: FUNC_LEAVE_API(ret_value) } /* H5Adelete_by_idx() */ @@ -1800,10 +1754,10 @@ H5Aexists(hid_t obj_id, const char *attr_name) loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(obj_id); - /* get the attribute info through the VOL */ - if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_EXISTS, H5AC_dxpl_id, H5_EVENT_STACK_NULL, loc_params, attr_name, &ret_value) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info") - + /* Check existence of attribute through the VOL */ + if(H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_EXISTS, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, attr_name, &ret_value) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: FUNC_LEAVE_API(ret_value) } /* H5Aexists() */ @@ -1859,9 +1813,10 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, loc_params.loc_data.loc_by_name.lapl_id = lapl_id; loc_params.obj_type = H5I_get_type(loc_id); - /* get the attribute info through the VOL */ - if(H5VL_attr_get(obj, vol_plugin, H5VL_ATTR_EXISTS, H5AC_dxpl_id, H5_EVENT_STACK_NULL, loc_params, attr_name, &ret_value) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get attribute info") + /* Check existence of attribute through the VOL */ + if(H5VL_attr_specific(obj, loc_params, vol_plugin, H5VL_ATTR_EXISTS, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, attr_name, &ret_value) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: FUNC_LEAVE_API(ret_value) @@ -1890,7 +1845,7 @@ H5A_close_attr(void *attr, H5VL_t *vol_plugin) FUNC_ENTER_NOAPI_NOINIT /* Close the attr through the VOL*/ - if((ret_value = H5VL_attr_close(attr, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_attr_close(attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "unable to close attribute") done: diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index f40a19c..24cee31 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -205,7 +205,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_create(obj, loc_params, vol_plugin, name, plist_id, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (attr = H5VL_attr_create(obj, loc_params, vol_plugin, name, plist_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create attribute") /* Get an atom for the attribute */ @@ -214,7 +214,7 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* H5Acreate1() */ @@ -272,7 +272,8 @@ H5Aopen_name(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, name, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, name, H5P_DEFAULT, + H5AC_ind_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open attribute") /* Get an atom for the attribute */ @@ -281,7 +282,7 @@ H5Aopen_name(hid_t loc_id, const char *name) done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* H5Aopen_name() */ @@ -341,7 +342,8 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the attribute through the VOL */ - if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, NULL, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (attr = H5VL_attr_open(obj, loc_params, vol_plugin, NULL, H5P_DEFAULT, + H5AC_ind_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open attribute") /* Get an atom for the attribute */ @@ -350,7 +352,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) done: if (ret_value < 0 && attr) - if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_attr_close (attr, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* H5Aopen_idx() */ @@ -397,8 +399,8 @@ H5Aget_num_attrs(hid_t loc_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the group info through the VOL using the location token */ - if(H5VL_object_get(obj, loc_params, vol_plugin, H5VL_OBJECT_GET_INFO, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, &oinfo) < 0) + if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + H5VL_OBJECT_GET_INFO, loc_params, &oinfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") ret_value = oinfo.num_attrs; diff --git a/src/H5Aint.c b/src/H5Aint.c index f5c44cd..f67e6f4 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -2420,3 +2420,208 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A_rename_by_name() */ + + +/*------------------------------------------------------------------------- + * Function: H5A_iterate + * + * Purpose: Iterates through attrs in an object + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * June, 2013 + * + *------------------------------------------------------------------------- + */ +herr_t H5A_iterate(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type, + H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data) +{ + H5G_loc_t loc; /* Object location */ + H5G_loc_t obj_loc; /* Location used to open group */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ + hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ + hid_t obj_loc_id = (-1); /* ID for object located */ + H5A_attr_iter_op_t attr_op; /* Attribute operator */ + hsize_t start_idx; /* Index of attribute to start iterating at */ + hsize_t last_attr; /* Index of last attribute examined */ + void *temp_obj = NULL; + H5I_type_t obj_type; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* check arguments */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Build attribute operator info */ + attr_op.op_type = H5A_ATTR_OP_APP2; + attr_op.u.app_op2 = op; + + /* Call attribute iteration routine */ + last_attr = start_idx = (idx ? *idx : 0); + + /* Iterate over the attributess */ + if(loc_params.type == H5VL_OBJECT_BY_SELF) { + if((obj_loc_id = H5VL_native_register(loc_params.obj_type, obj, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") +#if 0 + /* Build the vol plugin struct */ + if(NULL == (vol_plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + vol_plugin->cls = &H5VL_native_g; + vol_plugin->nrefs = 1; + vol_plugin->id = H5VL_NATIVE_g; + if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") + + /* Get an atom for the object */ + if((obj_loc_id = H5I_register2(loc_params.obj_type, obj, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object") +#endif + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { + /* Set up opened group location to fill in */ + obj_loc.oloc = &obj_oloc; + obj_loc.path = &obj_path; + H5G_loc_reset(&obj_loc); + + /* Find the object's location */ + if(H5G_loc_find(&loc, loc_params.loc_data.loc_by_name.name, &obj_loc/*out*/, + loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found"); + loc_found = TRUE; + + /* Open the object */ + if((obj_loc_id = H5O_open_by_loc(&obj_loc, loc_params.loc_data.loc_by_name.lapl_id, + H5AC_ind_dxpl_id, TRUE)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object"); + + /* get the native object from the ID created by the object header and create + a "VOL object" ID */ + obj_type = H5I_get_type(obj_loc_id); + if(NULL == (temp_obj = H5I_remove(obj_loc_id))) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object"); + /* Get an atom for the object */ + if((obj_loc_id = H5VL_native_register(obj_type, temp_obj, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype"); + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown link iterate params"); + } + + /* Do the real iteration */ + if((ret_value = H5O_attr_iterate(obj_loc_id, H5AC_ind_dxpl_id, idx_type, order, + start_idx, &last_attr, &attr_op, op_data)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes"); + + /* Set the last attribute information */ + if(idx) + *idx = last_attr; + +done: + /* Release resources */ + if(loc_params.type == H5VL_OBJECT_BY_SELF) { + if(H5VL_native_unregister(obj_loc_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to decrement vol plugin ref count") + if(obj_loc_id >= 0 && NULL == H5I_remove(obj_loc_id)) + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free identifier"); + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { + if(obj_loc_id >= 0) { + if(H5I_dec_app_ref(obj_loc_id) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object"); + } /* end if */ + else if(loc_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location"); + } + else { + HDONE_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown link iterate params"); + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5A_iterate() */ + + +/*------------------------------------------------------------------------- + * Function: H5A_delete + * + * Purpose: Deletes an attribute from a location + * + * Return: Success: 0 + * Failure: -1, attr not deleted. + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5A_delete(void *obj, H5VL_loc_params_t loc_params, const char *attr_name) +{ + H5G_loc_t loc; /* Object location */ + H5G_loc_t obj_loc; /* Location used to open group */ + H5G_name_t obj_path; /* Opened object group hier. path */ + H5O_loc_t obj_oloc; /* Opened object object location */ + hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* check arguments */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + if(H5VL_OBJECT_BY_SELF == loc_params.type) { /* H5Adelete */ + /* Delete the attribute from the location */ + if(H5O_attr_remove(loc.oloc, attr_name, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + } + else if(H5VL_OBJECT_BY_NAME == loc_params.type) { /* H5Adelete_by_name */ + /* Set up opened group location to fill in */ + obj_loc.oloc = &obj_oloc; + obj_loc.path = &obj_path; + H5G_loc_reset(&obj_loc); + + /* Find the object's location */ + if(H5G_loc_find(&loc, loc_params.loc_data.loc_by_name.name, &obj_loc/*out*/, + loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") + loc_found = TRUE; + + /* Delete the attribute from the location */ + if(H5O_attr_remove(obj_loc.oloc, attr_name, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + } + else if(H5VL_OBJECT_BY_IDX == loc_params.type) { /* H5Adelete_by_idx */ + /* Set up opened group location to fill in */ + obj_loc.oloc = &obj_oloc; + obj_loc.path = &obj_path; + H5G_loc_reset(&obj_loc); + + /* Find the object's location */ + if(H5G_loc_find(&loc, loc_params.loc_data.loc_by_idx.name, &obj_loc/*out*/, + loc_params.loc_data.loc_by_idx.lapl_id, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") + loc_found = TRUE; + + /* Delete the attribute from the location */ + if(H5O_attr_remove_by_idx(obj_loc.oloc, 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, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute remove parameters") + } + +done: + /* Release resources */ + if(loc_found && H5G_loc_free(&obj_loc) < 0) + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5A_delete() */ diff --git a/src/H5Apkg.h b/src/H5Apkg.h index efa2b74..2c984d0 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -209,6 +209,9 @@ H5_DLL herr_t H5A_rename_by_name(H5G_loc_t loc, const char *obj_name, const char const char *new_attr_name, hid_t lapl_id); H5_DLL htri_t H5A_exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name, hid_t lapl_id); +H5_DLL herr_t H5A_iterate(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type, + H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, void *op_data); +H5_DLL herr_t H5A_delete(void *obj, H5VL_loc_params_t loc_params, const char *attr_name); /* Attribute "dense" storage routines */ H5_DLL herr_t H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo); @@ -198,15 +198,15 @@ 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); - /* get the file object */ - if(NULL == (obj = (void *)H5VL_get_object(loc_id))) + /* get the location object */ + if(NULL == (obj = (void *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_create(obj, loc_params, vol_plugin, name, dcpl_id, dapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (dset = H5VL_dataset_create(obj, loc_params, vol_plugin, name, dcpl_id, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Get an atom for the dataset */ @@ -215,7 +215,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, done: if (ret_value < 0 && dset) - if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate2() */ @@ -298,7 +298,7 @@ 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); /* get the file object */ - if(NULL == (obj = (void *)H5VL_get_object(loc_id))) + if(NULL == (obj = (void *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") /* get the plugin pointer */ @@ -306,7 +306,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_create(obj, loc_params, vol_plugin, NULL, dcpl_id, dapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (dset = H5VL_dataset_create(obj, loc_params, vol_plugin, NULL, dcpl_id, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Get an atom for the dataset */ @@ -315,7 +315,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, done: if (ret_value < 0 && dset) - if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate_anon() */ @@ -365,7 +365,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* get the file object */ - if(NULL == (obj = (void *)H5VL_get_object(loc_id))) + if(NULL == (obj = (void *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") /* get the plugin pointer */ @@ -373,7 +373,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (dset = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") /* Get an atom for the dataset */ @@ -382,7 +382,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) done: if (ret_value < 0 && dset) - if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ @@ -465,7 +465,7 @@ H5Dget_space(hid_t dset_id) /* get the dataspace through the VOL */ if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_SPACE, H5AC_dxpl_id, - H5_EVENT_STACK_NULL, &ret_value) < 0) + H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get data space") done: @@ -506,7 +506,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) /* Read data space address through the VOL and return */ if((ret_value = H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_SPACE_STATUS, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, allocation)) < 0) + H5AC_ind_dxpl_id, H5_REQUEST_NULL, allocation)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get space status") done: @@ -548,7 +548,7 @@ H5Dget_type(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the datatype through the VOL */ - if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_TYPE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) + if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_TYPE, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get datatype") done: @@ -590,7 +590,7 @@ H5Dget_create_plist(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_DCPL, H5AC_dxpl_id, - H5_EVENT_STACK_NULL, &ret_value) < 0) + H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataset creation properties") done: @@ -648,7 +648,7 @@ H5Dget_access_plist(hid_t dset_id) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_DAPL, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) + if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_DAPL, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataset access properties") done: @@ -686,13 +686,14 @@ H5Dget_storage_size(hid_t dset_id) /* Check args */ if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "ID does not contain VOL information") /* get storage size through the VOL */ - if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_STORAGE_SIZE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) + if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_STORAGE_SIZE, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, 0, "unable to get storage size") done: @@ -726,13 +727,13 @@ H5Dget_offset(hid_t dset_id) /* Check args */ if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "ID does not contain VOL information") /* get offset through the VOL */ - if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_OFFSET, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) + if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_OFFSET, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, HADDR_UNDEF, "unable to get offset") done: @@ -940,7 +941,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, /* Get a copy of the dataspace ID */ if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_SPACE, H5AC_dxpl_id, - H5_EVENT_STACK_NULL, &vlen_bufsize.fspace_id) < 0) + H5_REQUEST_NULL, &vlen_bufsize.fspace_id) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy dataspace") /* Create a scalar for the memory dataspace */ @@ -1034,7 +1035,8 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* set the extent through the VOL */ - if((ret_value = H5VL_dataset_set_extent(dset, vol_plugin, size, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_dataset_specific(dset, vol_plugin, H5VL_DATASET_SET_EXTENT, + H5AC_dxpl_id, H5_REQUEST_NULL, size)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset") done: @@ -1064,7 +1066,7 @@ H5D_close_dataset(void *dset, H5VL_t *vol_plugin) FUNC_ENTER_NOAPI_NOINIT /* Close the dataset through the VOL */ - if((ret_value = H5VL_dataset_close(dset, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_dataset_close(dset, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close dataset") done: diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 11e1f6e..9df3317 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -207,7 +207,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, /* Create the dataset through the VOL */ if(NULL == (dset = H5VL_dataset_create(obj, loc_params, vol_plugin, name, dcpl_id, - H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Get an atom for the dataset */ @@ -216,7 +216,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, done: if (ret_value < 0 && dset) - if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dcreate1() */ @@ -268,7 +268,7 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the dataset through the VOL */ - if(NULL == (dset = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (dset = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Get an atom for the dataset */ @@ -277,7 +277,7 @@ H5Dopen1(hid_t loc_id, const char *name) done: if (ret_value < 0 && dset) - if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_dataset_close (dset, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Dopen1() */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 853240d..534a050 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2088,7 +2088,7 @@ H5D__vlen_get_buf_size(void UNUSED *elem, hid_t type_id, unsigned UNUSED ndim, c if(H5VL_dataset_read(vlen_bufsize->dset, vlen_bufsize->vol_plugin, type_id, vlen_bufsize->mspace_id, vlen_bufsize->fspace_id, vlen_bufsize->xfer_pid, - vlen_bufsize->fl_tbuf, H5_EVENT_STACK_NULL) < 0) + vlen_bufsize->fl_tbuf, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") done: diff --git a/src/H5Dio.c b/src/H5Dio.c index 3afdb04..c5bfb19 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -166,7 +166,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* Read the data through the VOL */ if((ret_value = H5VL_dataset_read(dset, vol_plugin, mem_type_id, mem_space_id, - file_space_id, plist_id, buf, H5_EVENT_STACK_NULL)) < 0) + file_space_id, plist_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") done: @@ -269,7 +269,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* Write the data through the VOL */ if((ret_value = H5VL_dataset_write(dset, vol_plugin, mem_type_id, mem_space_id, - file_space_id, dxpl_id, buf, H5_EVENT_STACK_NULL)) < 0) + file_space_id, dxpl_id, buf, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") done: @@ -218,7 +218,7 @@ H5Fget_create_plist(hid_t file_id) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_FCPL, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) + if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_FCPL, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file creation properties") done: @@ -252,7 +252,6 @@ H5Fget_access_plist(hid_t file_id) { H5VL_t *vol_plugin; void *file; - H5P_genplist_t *plist = NULL; /* Property list pointer */ hid_t fapl_id = FAIL; hid_t ret_value; /* Return value */ @@ -267,7 +266,7 @@ H5Fget_access_plist(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") if(H5VL_file_get(file, vol_plugin, H5VL_FILE_GET_FAPL, H5AC_dxpl_id, - H5_EVENT_STACK_NULL, &fapl_id) < 0) + H5_REQUEST_NULL, &fapl_id) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file creation properties") ret_value = fapl_id; @@ -339,7 +338,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_OBJ_COUNT, H5AC_dxpl_id, - H5_EVENT_STACK_NULL, types, &ret_value) < 0) + H5_REQUEST_NULL, types, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object count in file(s)") } /* iterate over all open files and get the obj count for each */ @@ -450,7 +449,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list) if(NULL == (obj = (void *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_OBJ_IDS, H5AC_dxpl_id, H5_EVENT_STACK_NULL, + if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_OBJ_IDS, H5AC_dxpl_id, H5_REQUEST_NULL, types, max_objs, oid_list, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object count in file(s)") } @@ -526,8 +525,8 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if((ret_value = H5VL_file_optional(obj, vol_plugin, H5VL_FILE_GET_VFD_HANDLE, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, file_handle, fapl)) < 0) + if(H5VL_file_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_FILE_GET_VFD_HANDLE, file_handle, fapl) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle") done: @@ -569,8 +568,8 @@ H5Fis_accessible(const char *name, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") /* Call into the VOL to check if file is accessible */ - if(H5VL_file_misc(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5AC_dxpl_id, - H5_EVENT_STACK_NULL, fapl_id, name, &ret_value) < 0) + if(H5VL_file_specific(NULL, NULL, H5VL_FILE_IS_ACCESSIBLE, H5AC_dxpl_id, + H5_REQUEST_NULL, fapl_id, name, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file handle") done: @@ -643,7 +642,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* create a new file or truncate an existing file through the VOL */ if(NULL == (file = H5VL_file_create(&vol_plugin, filename, flags, fcpl_id, fapl_id, - H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") /* Get an atom for the file with the VOL information as the auxilary struct*/ @@ -719,7 +718,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") /* Open the file through the VOL layer */ - if(NULL == (file = H5VL_file_open(&vol_plugin, filename, flags, fapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (file = H5VL_file_open(&vol_plugin, filename, flags, fapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") /* Get an atom for the file with the VOL information as the auxilary struct*/ @@ -750,8 +749,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) { H5VL_t *vol_plugin; void *obj; - H5I_type_t obj_type; - H5VL_loc_params_t loc_params; + H5I_type_t obj_type; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -771,10 +769,8 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) if(NULL == (obj = (void *)H5VL_get_object(object_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - loc_params.type = H5VL_OBJECT_BY_SELF; - loc_params.obj_type = obj_type; - - if((ret_value = H5VL_file_flush(obj, loc_params, vol_plugin, scope, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if(H5VL_file_specific(obj, vol_plugin, H5VL_FILE_FLUSH, H5AC_dxpl_id, + H5_REQUEST_NULL, obj_type, scope) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") done: @@ -846,7 +842,7 @@ H5F_close_file(void *file, H5VL_t *vol_plugin) FUNC_ENTER_NOAPI_NOINIT /* Close the file through the VOL*/ - if((ret_value = H5VL_file_close(file, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_file_close(file, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -894,12 +890,17 @@ H5Freopen(hid_t file_id) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj, vol_plugin, H5VL_FILE_REOPEN, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &file) < 0) + if(H5VL_file_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_FILE_REOPEN, &file) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") if (NULL == file) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") + vol_plugin->nrefs ++; + if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") + /* Get an atom for the file with the VOL information as the auxilary struct*/ if((ret_value = H5I_register2(H5I_FILE, file, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") @@ -943,7 +944,8 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if((ret_value = H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_INTENT, H5AC_dxpl_id, H5_EVENT_STACK_NULL, intent_flags)) < 0) + if((ret_value = H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_INTENT, + H5AC_dxpl_id, H5_REQUEST_NULL, intent_flags)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file intent") } @@ -984,7 +986,8 @@ H5Fget_freespace(hid_t file_id) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj, vol_plugin, H5VL_FILE_GET_FREE_SPACE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) + if(H5VL_file_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + H5VL_FILE_GET_FREE_SPACE, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file free space") done: @@ -1026,8 +1029,8 @@ H5Fget_filesize(hid_t file_id, hsize_t *size) if(NULL == (file = (void *)H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - if((ret_value = H5VL_file_optional(file, vol_plugin, H5VL_FILE_GET_SIZE, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, size)) < 0) + if(H5VL_file_optional(file, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_FILE_GET_SIZE, size) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file size") done: @@ -1095,8 +1098,8 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get image through the VOL */ - if(H5VL_file_optional(file, vol_plugin, H5VL_FILE_GET_FILE_IMAGE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - buf_ptr, &ret_value, buf_len) < 0) + if(H5VL_file_optional(file, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_FILE_GET_FILE_IMAGE, buf_ptr, &ret_value, buf_len) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file image") done: @@ -1144,8 +1147,8 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if((ret_value = H5VL_file_optional(obj, vol_plugin, H5VL_FILE_GET_MDC_CONF, H5AC_dxpl_id, - H5_EVENT_STACK_NULL, config_ptr)) < 0) + if(H5VL_file_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_FILE_GET_MDC_CONF, config_ptr) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get mdc configuration") done: @@ -1185,7 +1188,8 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj, vol_plugin, H5VL_FILE_SET_MDC_CONFIG, H5AC_dxpl_id, H5_EVENT_STACK_NULL, config_ptr) < 0) + if(H5VL_file_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_FILE_SET_MDC_CONFIG, config_ptr) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "uanvle to set MDC configuration") done: @@ -1230,8 +1234,8 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if((ret_value = H5VL_file_optional(file, vol_plugin, H5VL_FILE_GET_MDC_HR, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, hit_rate_ptr)) < 0) + if(H5VL_file_optional(file, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_FILE_GET_MDC_HR, hit_rate_ptr) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC hit rate") done: @@ -1276,8 +1280,8 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if((ret_value = H5VL_file_optional(file, vol_plugin, H5VL_FILE_GET_MDC_SIZE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, max_size_ptr, - min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr)) < 0) + if(H5VL_file_optional(file, vol_plugin, H5AC_dxpl_id, 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_INTERNAL, H5E_CANTGET, FAIL, "unable to get MDC size") done: @@ -1323,7 +1327,8 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) if(NULL == (obj = (void *)H5I_object(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_optional(obj, vol_plugin, H5VL_FILE_RESET_MDC_HIT_RATE, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_file_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_FILE_RESET_MDC_HIT_RATE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate") done: @@ -1358,8 +1363,8 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) { H5VL_t *vol_plugin = NULL; void *obj = NULL; - ssize_t ret_value; H5I_type_t type; + ssize_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE3("Zs", "ixz", obj_id, name, size); @@ -1378,7 +1383,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) if(NULL == (obj = (void *)H5VL_get_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_NAME, H5AC_dxpl_id, H5_EVENT_STACK_NULL, + if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_NAME, H5AC_dxpl_id, H5_REQUEST_NULL, type, size, name, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file name") @@ -1433,8 +1438,8 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) if(NULL == (obj = (void *)H5VL_get_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if((ret_value = H5VL_file_optional(obj, vol_plugin, H5VL_FILE_GET_INFO, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - type, finfo)) < 0) + if(H5VL_file_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + H5VL_FILE_GET_INFO, type, finfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file info") done: FUNC_LEAVE_API(ret_value) @@ -1477,8 +1482,8 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_file_optional(file, vol_plugin, H5VL_FILE_GET_FREE_SECTIONS, H5AC_dxpl_id, H5_EVENT_STACK_NULL, sect_info, - &ret_value, type, nsects) < 0) + if(H5VL_file_optional(file, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + H5VL_FILE_GET_FREE_SECTIONS, sect_info, &ret_value, type, nsects) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get file free sections") done: FUNC_LEAVE_API(ret_value) @@ -1517,8 +1522,8 @@ H5Fclear_elink_file_cache(hid_t file_id) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(file_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - - if(H5VL_file_optional(file, vol_plugin, H5VL_FILE_CLEAR_ELINK_CACHE, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_file_optional(file, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_FILE_CLEAR_ELINK_CACHE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") done: diff --git a/src/H5Fint.c b/src/H5Fint.c index a3c1e1e..8224d90 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -280,7 +280,7 @@ H5F_get_obj_count_cb(void UNUSED *obj_ptr, hid_t obj_id, void *key) if(NULL == (obj = (void *)H5I_object_verify(obj_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file id") - if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_OBJ_COUNT, H5AC_dxpl_id, H5_EVENT_STACK_NULL, + if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_OBJ_COUNT, H5AC_dxpl_id, H5_REQUEST_NULL, udata->types, &obj_count) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, H5_ITER_ERROR, "unable to get object count in file(s)") @@ -355,7 +355,7 @@ H5F_get_obj_ids_cb(void UNUSED *obj_ptr, hid_t obj_id, void *key) if(NULL == (obj = (void *)H5I_object_verify(obj_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_OBJ_IDS, H5AC_dxpl_id, H5_EVENT_STACK_NULL, + if(H5VL_file_get(obj, vol_plugin, H5VL_FILE_GET_OBJ_IDS, H5AC_dxpl_id, H5_REQUEST_NULL, udata->types, udata->max_objs, udata->oid_list, &obj_count) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, H5_ITER_ERROR, "unable to get object count in file(s)") diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 590275a..500852d 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -499,7 +499,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* check if both objects are associated with the same VOL plugin */ - if (vol_plugin1->cls != vol_plugin2->cls) + if (vol_plugin1->cls->value != vol_plugin2->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL plugin") /* get the group/file object */ @@ -509,8 +509,8 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) if(NULL == (file = (void *)H5I_object(child_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if((ret_value = H5VL_file_misc(obj, vol_plugin1, H5VL_FILE_MOUNT, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - type, name, file, plist_id)) < 0) + if(H5VL_file_specific(obj, vol_plugin1, H5VL_FILE_MOUNT, H5AC_dxpl_id, + H5_REQUEST_NULL, type, name, file, plist_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") done: @@ -565,7 +565,8 @@ H5Funmount(hid_t loc_id, const char *name) if(NULL == (obj = (void *)H5I_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") - if((ret_value = H5VL_file_misc(obj, vol_plugin, H5VL_FILE_UNMOUNT, H5AC_dxpl_id, H5_EVENT_STACK_NULL, type, name)) < 0) + if(H5VL_file_specific(obj, vol_plugin, H5VL_FILE_UNMOUNT, H5AC_dxpl_id, + H5_REQUEST_NULL, type, name) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") done: diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 7565823..a44c0d7 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -272,6 +272,36 @@ struct H5F_t { unsigned nmounts; /* Number of children mounted to this file */ }; +/* types for file optional VOL operations */ +typedef enum H5VL_file_optional_t { + H5VL_FILE_CLEAR_ELINK_CACHE, /* Clear external link cache */ + H5VL_FILE_GET_FILE_IMAGE, /* file image */ + 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_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_RESET_MDC_HIT_RATE, /* get metadata cache hit rate */ + H5VL_FILE_SET_MDC_CONFIG /* set metadata cache configuration */ +} H5VL_file_optional_t; + +/* User data for traversal routine to get ID counts */ +typedef struct { + ssize_t *obj_count; /* number of objects counted so far */ + unsigned types; /* types of objects to be counted */ +} H5F_trav_obj_cnt_t; + +/* User data for traversal routine to get ID lists */ +typedef struct { + size_t max_objs; + hid_t *oid_list; + ssize_t *obj_count; /* number of objects counted so far */ + unsigned types; /* types of objects to be counted */ +} H5F_trav_obj_ids_t; /*****************************/ /* Package Private Variables */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 9eb37b2..5076712 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -34,19 +34,6 @@ /* Library Private Macros */ /**************************/ -/* User data for traversal routine to get ID counts */ -typedef struct { - ssize_t *obj_count; /* number of objects counted so far */ - unsigned types; /* types of objects to be counted */ -} H5F_trav_obj_cnt_t; - -/* User data for traversal routine to get ID lists */ -typedef struct { - size_t max_objs; - hid_t *oid_list; - ssize_t *obj_count; /* number of objects counted so far */ - unsigned types; /* types of objects to be counted */ -} H5F_trav_obj_ids_t; /* * Encode and decode macros for file meta-data. @@ -588,7 +575,6 @@ typedef struct H5F_io_info_t { const struct H5P_genplist_t *dxpl; /* DXPL object */ } H5F_io_info_t; - /*****************************/ /* Library-private Variables */ /*****************************/ @@ -329,7 +329,8 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the group through the VOL */ - if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin, name, gcpl_id, gapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin, name, gcpl_id, gapl_id, + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") /* Get an atom for the group */ @@ -338,7 +339,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g done: if (ret_value < 0 && grp) - if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gcreate2() */ @@ -417,7 +418,8 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the group through the VOL */ - if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin, NULL, gcpl_id, gapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin, NULL, gcpl_id, gapl_id, + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") /* Get an atom for the group */ @@ -426,7 +428,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) done: if (ret_value < 0 && grp) - if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gcreate_anon() */ @@ -484,7 +486,8 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the group through the VOL */ - if(NULL == (grp = H5VL_group_open(obj, loc_params, vol_plugin, name, gapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (grp = H5VL_group_open(obj, loc_params, vol_plugin, name, gapl_id, + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Get an atom for the group */ @@ -493,7 +496,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) done: if (ret_value < 0 && grp) - if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gopen2() */ @@ -533,7 +536,8 @@ H5Gget_create_plist(hid_t grp_id) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(grp_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_group_get(grp, vol_plugin, H5VL_GROUP_GET_GCPL, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) + if(H5VL_group_get(grp, vol_plugin, H5VL_GROUP_GET_GCPL, H5AC_dxpl_id, H5_REQUEST_NULL, + &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group creation properties") done: @@ -584,8 +588,8 @@ H5Gget_info(hid_t loc_id, H5G_info_t *grp_info) loc_params.obj_type = id_type; /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_group_get(obj, vol_plugin, H5VL_GROUP_GET_INFO, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - loc_params, grp_info)) < 0) + if((ret_value = H5VL_group_get(obj, vol_plugin, H5VL_GROUP_GET_INFO, H5AC_ind_dxpl_id, + H5_REQUEST_NULL, loc_params, grp_info)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -642,8 +646,8 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_group_get(obj, vol_plugin, H5VL_GROUP_GET_INFO, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - loc_params, grp_info)) < 0) + if((ret_value = H5VL_group_get(obj, vol_plugin, H5VL_GROUP_GET_INFO, H5AC_ind_dxpl_id, + H5_REQUEST_NULL, loc_params, grp_info)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -709,8 +713,8 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_group_get(obj, vol_plugin, H5VL_GROUP_GET_INFO, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - loc_params, grp_info)) < 0) + if((ret_value = H5VL_group_get(obj, vol_plugin, H5VL_GROUP_GET_INFO, H5AC_ind_dxpl_id, + H5_REQUEST_NULL, loc_params, grp_info)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -751,7 +755,7 @@ H5Gclose(hid_t group_id) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") #if 0 /* Close the group through the VOL */ - if(H5VL_group_close(group_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_group_close(group_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") #endif @@ -782,7 +786,7 @@ H5G_close_group(void *grp, H5VL_t *vol_plugin) FUNC_ENTER_NOAPI_NOINIT /* Close the group through the VOL*/ - if((ret_value = H5VL_group_close(grp, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_group_close(grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group") done: diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 7c6feb2..f1451a9 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -287,7 +287,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) /* Create the group through the VOL */ if(NULL == (grp = H5VL_group_create(obj, loc_params, vol_plugin, name, tmp_gcpl, - H5P_GROUP_ACCESS_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + H5P_GROUP_ACCESS_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") /* Get an atom for the group */ @@ -299,7 +299,7 @@ done: if(H5I_dec_ref(tmp_gcpl) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release property list") if (ret_value < 0 && grp) - if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") FUNC_LEAVE_API(ret_value) @@ -351,7 +351,8 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Create the group through the VOL */ - if(NULL == (grp = H5VL_group_open(obj, loc_params, vol_plugin, name, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (grp = H5VL_group_open(obj, loc_params, vol_plugin, name, H5P_DEFAULT, + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") /* Get an atom for the group */ @@ -360,7 +361,7 @@ H5Gopen1(hid_t loc_id, const char *name) done: if (ret_value < 0 && grp) - if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_group_close (grp, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") FUNC_LEAVE_API(ret_value) } /* end H5Gopen1() */ @@ -424,7 +425,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Create the link through the VOL */ if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, NULL, loc_params2, vol_plugin, - lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { @@ -450,7 +451,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Create the link through the VOL */ if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj, loc_params, vol_plugin, - lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else if */ else @@ -531,7 +532,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Create the link through the VOL */ if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, obj2, loc_params2, (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), - lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end if */ else if(type == H5L_TYPE_SOFT) { @@ -562,7 +563,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, /* Create the link through the VOL */ if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj, loc_params, vol_plugin, - lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + lcpl_id, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") } /* end else if */ else @@ -610,7 +611,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) /* Create the link through the VOL */ if((ret_value = H5VL_link_move(obj, loc_params1, NULL, loc_params2, vol_plugin, - FALSE, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -676,7 +677,7 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Move the link through the VOL */ if((ret_value = H5VL_link_move(obj1, loc_params1, obj2, loc_params2, (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), - FALSE, H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + H5P_DEFAULT, H5P_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -718,8 +719,9 @@ H5Gunlink(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Delete the link through the VOL */ - if((ret_value = H5VL_link_remove(obj, loc_params, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") + if(H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_DELETE, + H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link") done: FUNC_LEAVE_API(ret_value) @@ -763,7 +765,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) /* Get the link info through the VOL */ if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_VAL, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, buf, size)) < 0) + H5AC_ind_dxpl_id, H5_REQUEST_NULL, buf, size)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link value") done: @@ -791,6 +793,93 @@ done: herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment) { + H5G_loc_t loc; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "i*s*s", loc_id, name, comment); + + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!name || !*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + + if(H5G_loc_set_comment(&loc, name, comment, H5P_DEFAULT, H5AC_dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Gset_comment() */ + + +/*------------------------------------------------------------------------- + * Function: H5Gget_comment + * + * Purpose: Return at most BUFSIZE characters of the comment for the + * specified object. If BUFSIZE is large enough to hold the + * entire comment then the comment string will be null + * terminated, otherwise it will not. If the object does not + * have a comment value then no bytes are copied to the BUF + * buffer. + * + * Note: Deprecated in favor of H5Oget_comment/H5Oget_comment_by_name + * + * Return: Success: Number of characters in the comment counting + * the null terminator. The value returned may + * be larger than the BUFSIZE argument. + * + * Failure: Negative + * + * Programmer: Robb Matzke + * Monday, July 20, 1998 + * + *------------------------------------------------------------------------- + */ +int +H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) +{ + H5G_loc_t loc; + int ret_value; + + FUNC_ENTER_API(FAIL) + H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf); + + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if(!name || !*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + if(bufsize > 0 && !buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified") + + if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get comment value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_comment() */ + +#if 0 + +/*------------------------------------------------------------------------- + * Function: H5Gset_comment + * + * Purpose: Gives the specified object a comment. The COMMENT string + * should be a null terminated string. An object can have only + * one comment at a time. Passing NULL for the COMMENT argument + * will remove the comment property from the object. + * + * Note: Deprecated in favor of H5Oset_comment/H5Oset_comment_by_name + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Monday, July 20, 1998 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Gset_comment(hid_t loc_id, const char *name, const char *comment) +{ void *obj = NULL; /* object token of loc_id */ H5VL_t *vol_plugin; /* VOL plugin information */ H5VL_loc_params_t loc_params; @@ -815,7 +904,8 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* set comment on object through the VOL */ - if(H5VL_object_misc(obj, loc_params, vol_plugin, H5VL_OBJECT_SET_COMMENT, H5AC_dxpl_id, H5_EVENT_STACK_NULL, comment) < 0) + if(H5VL_object_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value") done: @@ -875,8 +965,8 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_object_get(obj, loc_params, vol_plugin, H5VL_OBJECT_GET_COMMENT, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - buf, bufsize, &size) < 0) + if(H5VL_object_optional(obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL, + H5VL_OBJECT_GET_COMMENT, loc_params, buf, bufsize, &size) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object comment") ret_value = (int)size; @@ -884,6 +974,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) done: FUNC_LEAVE_API(ret_value) } /* end H5Gget_comment() */ +#endif /*------------------------------------------------------------------------- @@ -1239,7 +1330,8 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a group") /* Call internal function */ - if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, + idx, name, size, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name") done: @@ -2282,7 +2282,7 @@ H5Iget_file_id(hid_t obj_id) } /* Get the file through the VOL */ - if(H5VL_file_get(obj, vol_plugin, H5VL_OBJECT_GET_FILE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, type, &file) < 0) + if(H5VL_file_get(obj, vol_plugin, H5VL_OBJECT_GET_FILE, H5AC_dxpl_id, H5_REQUEST_NULL, type, &file) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to get file") if (NULL == file) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") @@ -327,9 +327,9 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, } /* Move the link through the VOL */ - if((ret_value = H5VL_link_move(obj1, loc_params1, obj2, loc_params2, - (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), - FALSE, lcpl_id, lapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if(H5VL_link_move(obj1, loc_params1, obj2, loc_params2, + (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), + lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -418,9 +418,9 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, } /* Move the link through the VOL */ - if((ret_value = H5VL_link_move(obj1, loc_params1, obj2, loc_params2, - (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), - TRUE, lcpl_id, lapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if(H5VL_link_copy(obj1, loc_params1, obj2, loc_params2, + (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), + lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") done: FUNC_LEAVE_API(ret_value) @@ -496,8 +496,8 @@ H5Lcreate_soft(const char *link_target, 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, obj, loc_params, vol_plugin, - lcpl_id, lapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_SOFT, obj, loc_params, vol_plugin, + lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -598,9 +598,9 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, 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, obj2, loc_params2, - (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), - lcpl_id, lapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, obj2, loc_params2, + (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), + lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -684,8 +684,8 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value from plist") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, obj, loc_params, vol_plugin, - lcpl_id, lapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_UD, obj, loc_params, vol_plugin, + lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -738,8 +738,9 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Delete the link through the VOL */ - if((ret_value = H5VL_link_remove(obj, loc_params, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") + if(H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_DELETE, + H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link") done: FUNC_LEAVE_API(ret_value) @@ -806,8 +807,9 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Delete the link through the VOL */ - if((ret_value = H5VL_link_remove(obj, loc_params, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") + if(H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_DELETE, + H5AC_dxpl_id, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link") done: FUNC_LEAVE_API(ret_value) @@ -867,8 +869,8 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the link info through the VOL */ - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_VAL, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, buf, size)) < 0) + if(H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_VAL, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link value") done: @@ -937,8 +939,8 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the link info through the VOL */ - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_VAL, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, buf, size)) < 0) + if(H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_VAL, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, buf, size) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link value") done: @@ -992,7 +994,8 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* check link existence through the VOL */ - if(H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_EXISTS, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) + if(H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_EXISTS, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1047,8 +1050,8 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the link info through the VOL */ - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_INFO, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, linfo)) < 0) + if(H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_INFO, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1113,8 +1116,8 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the link info through the VOL */ - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_INFO, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - linfo)) < 0) + if(H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_INFO, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, linfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link info") done: @@ -1309,8 +1312,8 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the link info through the VOL */ - if((H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_NAME, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - name, size, &ret_value)) < 0) + if(H5VL_link_get(obj, loc_params, vol_plugin, H5VL_LINK_GET_NAME, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, name, size, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get link name") done: @@ -1375,8 +1378,9 @@ H5Literate(hid_t id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the links through the VOL */ - if((ret_value = H5VL_link_iterate(obj, loc_params, vol_plugin, FALSE, idx_type, order, idx_p, - op, op_data, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_ITER, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, + FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1448,8 +1452,9 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the links through the VOL */ - if((ret_value = H5VL_link_iterate(obj, loc_params, vol_plugin, FALSE, idx_type, order, idx_p, - op, op_data, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_ITER, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, + FALSE, idx_type, order, idx_p, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1521,9 +1526,10 @@ H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the links through the VOL */ - if((ret_value = H5VL_link_iterate(obj, loc_params, vol_plugin, TRUE, idx_type, order, NULL, - op, op_data, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") + if((ret_value = H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_ITER, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, + TRUE, idx_type, order, NULL, op, op_data)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visit failed") done: FUNC_LEAVE_API(ret_value) @@ -1599,9 +1605,10 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* visit the links through the VOL */ - if((ret_value = H5VL_link_iterate(obj, loc_params, vol_plugin, TRUE, idx_type, order, NULL, - op, op_data, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") + if((ret_value = H5VL_link_specific(obj, loc_params, vol_plugin, H5VL_LINK_ITER, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, + TRUE, idx_type, order, NULL, op, op_data)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visit failed") done: FUNC_LEAVE_API(ret_value) @@ -3443,3 +3450,83 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5L_link_copy_file() */ + +/*------------------------------------------------------------------------- + * Function: H5L_iterate + * + * Purpose: Iterates through links in a group + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * August, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t H5L_iterate(void *obj, H5VL_loc_params_t loc_params, hbool_t recursive, + H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, + H5L_iterate_t op, void *op_data, hid_t dxpl_id) +{ + H5G_loc_t loc; + herr_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + if(!recursive) { + H5G_link_iterate_t lnk_op; /* Link operator */ + hsize_t last_lnk; /* Index of last object looked at */ + hsize_t idx; /* Internal location to hold index */ + + /* Set up iteration beginning/end info */ + idx = (idx_p == NULL ? 0 : *idx_p); + last_lnk = 0; + + /* Build link operator info */ + lnk_op.op_type = H5G_LINK_OP_NEW; + lnk_op.op_func.op_new = op; + + /* Iterate over the links */ + if(loc_params.type == H5VL_OBJECT_BY_SELF) { + if((ret_value = H5G_iterate(&loc, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, + H5P_LINK_ACCESS_DEFAULT, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { + if((ret_value = H5G_iterate(&loc, loc_params.loc_data.loc_by_name.name, + idx_type, order, idx, &last_lnk, &lnk_op, op_data, + loc_params.loc_data.loc_by_name.lapl_id, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown link iterate params") + } + + /* Set the index we stopped at */ + if(idx_p) + *idx_p = last_lnk; + } + else { + /* Call internal group visitation routine */ + if(loc_params.type == H5VL_OBJECT_BY_SELF) { + if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data, + H5P_LINK_ACCESS_DEFAULT, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { + if((ret_value = H5G_visit(&loc, loc_params.loc_data.loc_by_name.name, + idx_type, order, op, op_data, + loc_params.loc_data.loc_by_name.lapl_id, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown link visit params") + } + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_iterate() */ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 11968f1..1947d58 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -634,7 +634,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, /* Create the link through the VOL */ if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_UD, obj, loc_params, vol_plugin, - lcpl_id, lapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") done: diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index e4cb328..badd18e 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -144,6 +144,9 @@ H5_DLL herr_t H5L_get_val(H5G_loc_t *loc, const char *name, void *buf/*out*/, H5_DLL herr_t H5L_get_val_by_idx(H5G_loc_t *loc, const char *name, void *udata, hid_t lapl_id, hid_t dxpl_id); H5_DLL herr_t H5L_register_external(void); +H5_DLL herr_t H5L_iterate(void *obj, H5VL_loc_params_t loc_params, hbool_t recursive, + H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, + H5L_iterate_t op, void *op_data, hid_t dxpl_id); /* User-defined link functions */ H5_DLL herr_t H5L_register(const H5L_class_t *cls); @@ -240,26 +240,25 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - loc_params.type = H5VL_OBJECT_BY_NAME; - loc_params.loc_data.loc_by_name.name = name; - loc_params.loc_data.loc_by_name.lapl_id = lapl_id; - loc_params.obj_type = H5I_get_type(loc_id); - /* get the file object */ if(NULL == (obj = (void *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") + loc_params.type = H5VL_OBJECT_BY_NAME; + loc_params.loc_data.loc_by_name.name = name; + loc_params.loc_data.loc_by_name.lapl_id = lapl_id; + loc_params.obj_type = H5I_get_type(loc_id); + /* Open the object through the VOL */ if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, - H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") - if ((ret_value = H5VL_object_register(opened_obj, opened_type, vol_plugin, TRUE)) < 0) + if((ret_value = H5VL_object_register(opened_obj, opened_type, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle") - done: FUNC_LEAVE_API(ret_value) } /* end H5Oopen() */ @@ -332,10 +331,10 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, /* Open the object through the VOL */ if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, - H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") - if ((ret_value = H5VL_object_register(opened_obj, opened_type, vol_plugin, TRUE)) < 0) + if((ret_value = H5VL_object_register(opened_obj, opened_type, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle") done: @@ -403,10 +402,11 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Open the object through the VOL */ - if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") - if ((ret_value = H5VL_object_register(opened_obj, opened_type, vol_plugin, TRUE)) < 0) + if((ret_value = H5VL_object_register(opened_obj, opened_type, vol_plugin, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle") done: @@ -509,9 +509,9 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set property value for target id") /* Create the link through the VOL */ - if((ret_value = H5VL_link_create(H5VL_LINK_CREATE_HARD, obj2, loc_params2, - (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), - lcpl_id, lapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if(H5VL_link_create(H5VL_LINK_CREATE_HARD, obj2, loc_params2, + (vol_plugin1!=NULL ? vol_plugin1 : vol_plugin2), + lcpl_id, lapl_id, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -561,8 +561,8 @@ H5Oincr_refcount(hid_t object_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* change the ref count through the VOL */ - if(H5VL_object_misc(obj, loc_params, vol_plugin, H5VL_OBJECT_CHANGE_REF_COUNT, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, 1) < 0) + if(H5VL_object_specific(obj, loc_params, vol_plugin, H5VL_OBJECT_CHANGE_REF_COUNT, + H5AC_dxpl_id, H5_REQUEST_NULL, 1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -612,8 +612,8 @@ H5Odecr_refcount(hid_t object_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* change the ref count through the VOL */ - if(H5VL_object_misc(obj, loc_params, vol_plugin, H5VL_OBJECT_CHANGE_REF_COUNT, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, -1) < 0) + if(H5VL_object_specific(obj, loc_params, vol_plugin, H5VL_OBJECT_CHANGE_REF_COUNT, + H5AC_dxpl_id, H5_REQUEST_NULL, -1) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -667,8 +667,8 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* change the ref count through the VOL */ - if(H5VL_object_get(obj, loc_params, vol_plugin, H5VL_OBJECT_EXISTS, H5AC_dxpl_id, - H5_EVENT_STACK_NULL, &ret_value) < 0) + if(H5VL_object_specific(obj, loc_params, vol_plugin, H5VL_OBJECT_EXISTS, + H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -715,8 +715,8 @@ H5Oget_info(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, H5VL_OBJECT_GET_INFO, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, oinfo)) < 0) + if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + H5VL_OBJECT_GET_INFO, loc_params, oinfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -773,8 +773,8 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, H5VL_OBJECT_GET_INFO, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, oinfo)) < 0) + if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + H5VL_OBJECT_GET_INFO, loc_params, oinfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -840,8 +840,8 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the group info through the VOL using the location token */ - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, H5VL_OBJECT_GET_INFO, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, oinfo)) < 0) + if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + H5VL_OBJECT_GET_INFO, loc_params, oinfo) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -888,7 +888,8 @@ H5Oset_comment(hid_t obj_id, const char *comment) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* set comment on object through the VOL */ - if(H5VL_object_misc(obj, loc_params, vol_plugin, H5VL_OBJECT_SET_COMMENT, H5AC_dxpl_id, H5_EVENT_STACK_NULL, comment) < 0) + if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value") done: @@ -947,7 +948,8 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* set comment on object through the VOL */ - if(H5VL_object_misc(obj, loc_params, vol_plugin, H5VL_OBJECT_SET_COMMENT, H5AC_dxpl_id, H5_EVENT_STACK_NULL, comment) < 0) + if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + H5VL_OBJECT_SET_COMMENT, loc_params, comment) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to set comment value") done: @@ -992,8 +994,8 @@ H5Oget_comment(hid_t loc_id, char *comment, size_t bufsize) if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_object_get(obj, loc_params, vol_plugin, H5VL_OBJECT_GET_COMMENT, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - comment, bufsize, &ret_value) < 0) + if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object comment") done: @@ -1050,8 +1052,8 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - if(H5VL_object_get(obj, loc_params, vol_plugin, H5VL_OBJECT_GET_COMMENT, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - comment, bufsize, &ret_value) < 0) + if(H5VL_object_optional(obj, vol_plugin, H5AC_ind_dxpl_id, H5_REQUEST_NULL, + H5VL_OBJECT_GET_COMMENT, loc_params, comment, bufsize, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get object info") done: @@ -1122,8 +1124,9 @@ H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the objects through the VOL */ - if((ret_value = H5VL_object_visit(obj, loc_params, vol_plugin, idx_type, order, op, op_data, - H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_object_specific(obj, loc_params, vol_plugin, H5VL_OBJECT_VISIT, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, + idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1204,8 +1207,9 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* iterate over the objects through the VOL */ - if((ret_value = H5VL_object_visit(obj, loc_params, vol_plugin, idx_type, order, op, - op_data, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_object_specific(obj, loc_params, vol_plugin, H5VL_OBJECT_VISIT, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, + idx_type, order, op, op_data)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") done: @@ -1269,12 +1273,6 @@ H5Oclose(hid_t object_id) break; } /* end switch */ -#if 0 - /* Close the object through the VOL */ - if(H5VL_object_close(object_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close object") -#endif - done: FUNC_LEAVE_API(ret_value) } /* end H5Oclose() */ @@ -3494,34 +3492,15 @@ H5O_visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, { void *temp_obj = NULL; H5I_type_t obj_type; - obj_type = H5I_get_type(obj_id); - if(NULL == (temp_obj = H5I_remove(obj_id))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") - /* Get an atom for the datatype */ - if((obj_id = H5VL_native_register(obj_type, temp_obj, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") - } -#if 0 - /* if this is a named datatype, we need to create the two-fold datatype - to be comaptible with the VOL */ - if(H5I_DATATYPE == H5I_get_type(obj_id)) { - H5T_t *type = NULL; - void *temp_obj = NULL; + obj_type = H5I_get_type(obj_id); if(NULL == (temp_obj = H5I_remove(obj_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") - /* Copy the dataset's datatype */ - if(NULL == (type = H5T_copy((H5T_t *)temp_obj, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy datatype") - - H5T_set_vol_object(type, temp_obj); - /* Get an atom for the datatype */ - if((obj_id = H5VL_native_register(H5I_DATATYPE, type, TRUE)) < 0) + if((obj_id = H5VL_native_register(obj_type, temp_obj, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype") } -#endif /* Make callback for starting object */ if((ret_value = op(obj_id, ".", &oinfo, op_data)) < 0) diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 687a9e6..f408d80 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -254,7 +254,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Open the object through the VOL */ if((ret_value = H5VL_object_copy(obj1, loc_params1, vol_plugin1, src_name, obj2, loc_params2, vol_plugin2, dst_name, - ocpypl_id, lcpl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + ocpypl_id, lcpl_id, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to copy object") done: diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 9319a28..f990fdd 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -381,6 +381,12 @@ typedef struct H5O_chk_cache_ud_t { H5O_common_cache_ud_t common; /* Common object header cache callback info */ } H5O_chk_cache_ud_t; +/* types for object optional VOL operations */ +typedef enum H5VL_object_optional_t { + H5VL_OBJECT_GET_COMMENT, /* get object comment */ + H5VL_OBJECT_GET_INFO, /* get object info */ + H5VL_OBJECT_SET_COMMENT /* set object comment */ +} H5VL_object_optional_t; /* H5O object header inherits cache-like properties from H5AC */ H5_DLLVAR const H5AC_class_t H5AC_OHDR[1]; @@ -381,8 +381,9 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* create the ref through the VOL */ - if(ret_value = H5VL_object_misc(obj, loc_params, vol_plugin, H5VL_REF_CREATE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - ref, name, ref_type, space_id) < 0) + if(ret_value = H5VL_object_specific(obj, loc_params, vol_plugin, H5VL_REF_CREATE, + H5AC_dxpl_id, H5_REQUEST_NULL, + ref, name, ref_type, space_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") done: @@ -609,7 +610,8 @@ 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); /* Open the object through the VOL */ - if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to dereference object") /* Get an atom for the object */ @@ -741,8 +743,8 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* Get the space id through the VOL */ - if(H5VL_object_get(obj, loc_params, vol_plugin, H5VL_REF_GET_REGION, H5AC_dxpl_id, H5_EVENT_STACK_NULL, - &ret_value, ref_type, ref) < 0) + if(H5VL_object_get(obj, loc_params, vol_plugin, H5VL_REF_GET_REGION, + H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value, ref_type, ref) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -889,7 +891,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, /* get the object type through the VOL */ if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, H5VL_REF_GET_TYPE, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, obj_type, ref_type, ref)) < 0) + H5AC_ind_dxpl_id, H5_REQUEST_NULL, obj_type, ref_type, ref)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: @@ -1063,7 +1065,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get the object type through the VOL */ - if(H5VL_object_get(obj, loc_params, vol_plugin, H5VL_REF_GET_NAME, H5AC_dxpl_id, H5_EVENT_STACK_NULL, + if(H5VL_object_get(obj, loc_params, vol_plugin, H5VL_REF_GET_NAME, H5AC_dxpl_id, H5_REQUEST_NULL, &ret_value, name, size, ref_type, _ref) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") done: diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 57b31aa..1581168 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -186,7 +186,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) /* get the object type through the VOL */ if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, H5VL_REF_GET_TYPE, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, &obj_type, ref_type, ref)) < 0) + H5AC_ind_dxpl_id, H5_REQUEST_NULL, &obj_type, ref_type, ref)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group info") /* Set return value */ @@ -252,7 +252,8 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) loc_params.obj_type = H5I_get_type(obj_id); /* Open the object through the VOL */ - if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (opened_obj = H5VL_object_open(obj, loc_params, vol_plugin, &opened_type, + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open object") /* Get an atom for the object */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 0f840e0..efc443d 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -174,7 +174,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, /* commit the datatype through the VOL */ if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin, name, type_id, lcpl_id, - tcpl_id, tapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + tcpl_id, tapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to commit datatype") /* attach the vol object created using the commit call to the @@ -337,7 +337,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) /* commite the datatype through the VOL */ if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin, NULL, type_id, H5P_DEFAULT, - tcpl_id, tapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + tcpl_id, tapl_id, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to commit datatype") /* set the committed type object to the VOL pluging pointer in the H5T_t struct */ @@ -621,7 +621,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) /* Create the datatype through the VOL */ if(NULL == (dt = H5VL_datatype_open(obj, loc_params, vol_plugin, name, tapl_id, - H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open datatype") /* Get an atom for the datatype */ @@ -630,7 +630,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) done: if (ret_value < 0 && dt) - if(H5VL_datatype_close (dt, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_datatype_close (dt, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Topen2() */ @@ -695,7 +695,7 @@ H5Tget_create_plist(hid_t dtype_id) /* get the rest of the plist through the VOL */ if(H5VL_datatype_get(type, vol_plugin, H5VL_DATATYPE_GET_TCPL, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) + H5AC_ind_dxpl_id, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get datatype") } /* end if */ @@ -959,18 +959,18 @@ H5VL_create_datatype(void *dt_obj, H5VL_t *vol_plugin, hbool_t app_ref) FUNC_ENTER_NOAPI(FAIL) /* get required buf size for encoding the datatype */ - if((nalloc = H5VL_datatype_get_binary(dt_obj, vol_plugin, NULL, 0, - H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get datatype size") + if(H5VL_datatype_get(dt_obj, vol_plugin, H5VL_DATATYPE_GET_BINARY, + H5AC_dxpl_id, H5_REQUEST_NULL, &nalloc, NULL, 0) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get datatype serialized size") /* allocate buffer to store binary description of the datatype */ if (NULL == (buf = (void *) H5MM_malloc ((size_t)nalloc))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate space for datatype") /* get binary description of the datatype */ - if((nalloc = H5VL_datatype_get_binary(dt_obj, vol_plugin, buf, (size_t) nalloc, - H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get datatype size") + if(H5VL_datatype_get(dt_obj, vol_plugin, H5VL_DATATYPE_GET_BINARY, + H5AC_dxpl_id, H5_REQUEST_NULL, &nalloc, buf, (size_t)nalloc) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get serialized datatype") if(NULL == (dt = H5T_decode(buf))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't decode datatype") @@ -1011,7 +1011,7 @@ H5T_close_datatype(void *type, H5VL_t *vol_plugin) /* Close the datatype through the VOL*/ if (NULL != dt->vol_obj) - if((ret_value = H5VL_datatype_close(dt->vol_obj, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_datatype_close(dt->vol_obj, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") done: diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 0b6ff5a..addbdfe 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -180,7 +180,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) /* commit the datatype through the VOL */ if (NULL == (dt = H5VL_datatype_commit(obj, loc_params, vol_plugin, name, type_id, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, - H5P_DATATYPE_ACCESS_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + H5P_DATATYPE_ACCESS_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to commit datatype") /* attach the vol object created using the commit call to the @@ -241,7 +241,7 @@ H5Topen1(hid_t loc_id, const char *name) /* Create the datatype through the VOL */ if(NULL == (dt = H5VL_datatype_open(obj, loc_params, vol_plugin, name, - H5P_DATATYPE_ACCESS_DEFAULT, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) + H5P_DATATYPE_ACCESS_DEFAULT, H5AC_dxpl_id, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open datatype") /* Get an atom for the datatype */ @@ -250,7 +250,7 @@ H5Topen1(hid_t loc_id, const char *name) done: if (ret_value < 0 && dt) - if(H5VL_datatype_close (dt, vol_plugin, H5AC_dxpl_id, H5_EVENT_STACK_NULL) < 0) + if(H5VL_datatype_close (dt, vol_plugin, H5AC_dxpl_id, H5_REQUEST_NULL) < 0) HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_API(ret_value) } /* end H5Topen1() */ @@ -437,7 +437,6 @@ done: * Purpose: Creates an attribute through the VOL * * Return: Success: pointer to the new attr. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -447,7 +446,7 @@ done: */ void * H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -455,7 +454,7 @@ H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, con if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, vol_plugin, name, acpl_id, aapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, vol_plugin, name, acpl_id, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create attribute") done: @@ -469,7 +468,6 @@ done: * Purpose: Opens an attribute through the VOL * * Return: Success: pointer to the new attr. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -479,7 +477,7 @@ done: */ void * H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t aapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -487,7 +485,7 @@ H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, vol_plugin, name, aapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, vol_plugin, name, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open attribute") done: @@ -509,7 +507,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VLattr_read(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, void *buf, hid_t dxpl_id, void UNUSED **req) +herr_t H5VLattr_read(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -517,7 +515,7 @@ herr_t H5VLattr_read(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, void *bu if (NULL == attr || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_read(attr, vol_plugin, mem_type_id, buf, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_attr_read(attr, vol_plugin, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read attribute") done: @@ -531,7 +529,6 @@ done: * Purpose: Writes data to attr through the VOL * * Return: Success: Non Negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -539,7 +536,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VLattr_write(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void UNUSED **req) +herr_t H5VLattr_write(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -547,7 +544,7 @@ herr_t H5VLattr_write(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, const v if (NULL == attr || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_write(attr, vol_plugin, mem_type_id, buf, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_attr_write(attr, vol_plugin, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write attribute") done: @@ -556,44 +553,47 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLattr_iterate + * Function: H5VLattr_get * - * Purpose: Iterate over attrs in a group + * Purpose: Get specific information about the attribute through the VOL * * Return: Success: non negative * Failure: negative * * Programmer: Mohamad Chaarawi - * June, 2013 + * March, 2012 * *------------------------------------------------------------------------- */ -herr_t H5VLattr_iterate(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *n, - H5A_operator2_t op, void *op_data, hid_t dxpl_id, void UNUSED **req) +herr_t +H5VLattr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*x*xVai**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_iterate(obj, loc_params, vol_plugin, idx_type, order, n, - op, op_data, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Attr iteration failed") + + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->attr_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr get' method") + if((ret_value = (vol_plugin->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) -} /* end H5VLattr_iterate() */ + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_get() */ /*------------------------------------------------------------------------- - * Function: H5VLattr_get + * Function: H5VLattr_specific * - * Purpose: Get specific information about the attribute through the VOL + * Purpose: specific operation on attributes through the VOL * * Return: Success: non negative - * * Failure: negative * * Programmer: Mohamad Chaarawi @@ -602,118 +602,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVai**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); + H5TRACE7("e", "*xx*xVbi**xx", obj, loc_params, vol_plugin, specific_type, + dxpl_id, req, arguments); if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Aexists/exists_by_name */ - case H5VL_ATTR_EXISTS: - { - H5VL_loc_params_t loc_params = va_arg (arguments, H5VL_loc_params_t); - char *attr_name = va_arg (arguments, char *); - htri_t *ret = va_arg (arguments, htri_t *); - - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - loc_params, attr_name, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - break; - } - /* H5Aget_space */ - case H5VL_ATTR_GET_SPACE: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - break; - } - /* H5Aget_type */ - case H5VL_ATTR_GET_TYPE: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - break; - } - /* H5Aget_create_plist */ - case H5VL_ATTR_GET_ACPL: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - break; - } - /* H5Aget_name */ - case H5VL_ATTR_GET_NAME: - { - H5VL_loc_params_t loc_params = va_arg (arguments, H5VL_loc_params_t); - size_t buf_size = va_arg (arguments, size_t); - char *buf = va_arg (arguments, char *); - ssize_t *ret_val = va_arg (arguments, ssize_t *); - - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - loc_params, buf_size, buf, ret_val)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - break; - } - /* H5Aget_info */ - case H5VL_ATTR_GET_INFO: - { - H5VL_loc_params_t loc_params = va_arg (arguments, H5VL_loc_params_t); - H5A_info_t *ainfo = va_arg (arguments, H5A_info_t *); - - if(H5VL_OBJECT_BY_SELF == loc_params.type) { - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, loc_params, ainfo)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - } - else if(H5VL_OBJECT_BY_NAME == loc_params.type) { - char *attr_name = va_arg (arguments, char *); - - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, loc_params, ainfo, attr_name)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - } - else if(H5VL_OBJECT_BY_IDX == loc_params.type) { - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, loc_params, ainfo)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - } - 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 *); - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from attr") - } + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->attr_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr specific' method") + if((ret_value = (vol_plugin->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) -} /* end H5VLattr_get() */ +} /* end H5VLattr_specific() */ /*------------------------------------------------------------------------- - * Function: H5VLattr_remove - * - * Purpose: Removes an attribute through the VOL + * Function: H5VLattr_optional * - * Return: Success: Non Negative + * Purpose: optional operation specific to plugins. * - * Failure: Negative + * Return: Success: non negative + * Failure: negative * * Programmer: Mohamad Chaarawi * March, 2012 @@ -721,23 +640,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - const char *attr_name, hid_t dxpl_id, void UNUSED **req) +H5VLattr_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xx*x*si**x", obj, loc_params, vol_plugin, attr_name, dxpl_id, - req); + H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_remove(obj, loc_params, vol_plugin, attr_name, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to remove attribute") + + /* Have to bypass the H5VLint layer due to unknown val_list arguments */ + if(NULL == vol_plugin->cls->attr_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr optional' method") + if((ret_value = (vol_plugin->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) -} /* end H5VLattr_remove() */ +} /* end H5VLattr_optional() */ /*------------------------------------------------------------------------- @@ -746,7 +667,6 @@ done: * Purpose: Closes an attribute through the VOL * * Return: Success: Non Negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -755,7 +675,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +H5VLattr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -764,7 +684,7 @@ H5VLattr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) if (NULL == attr || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_close(attr, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_attr_close(attr, vol_plugin, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close attribute") done: @@ -778,7 +698,6 @@ done: * Purpose: Commits a datatype to the file through the VOL * * Return: Success: Positive - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -788,7 +707,7 @@ done: */ void * H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void UNUSED **req) + 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 */ @@ -797,7 +716,7 @@ H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, vol_plugin, name, type_id, - lcpl_id, tcpl_id, tapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to commit datatype") done: @@ -811,7 +730,6 @@ done: * Purpose: Opens a named datatype through the VOL * * Return: Success: User ID of the datatype. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -821,7 +739,7 @@ done: */ void * H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t tapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t tapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -829,7 +747,7 @@ H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, c if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, vol_plugin, name, tapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, vol_plugin, name, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open datatype") done: @@ -838,35 +756,74 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLdatatype_get_binary + * Function: H5VLdatatype_specific + * + * Purpose: specific operation on datatypes through the VOL + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 * - * Purpose: gets required size to serialize datatype description + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_specific(void *obj, H5VL_t *vol_plugin, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*x*xVfi**xx", obj, vol_plugin, specific_type, dxpl_id, req, + arguments); + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + + if(NULL == vol_plugin->cls->datatype_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype specific' method") + if((ret_value = (vol_plugin->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) +} /* end H5VLdatatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_optional * - * Return: Success: size needed + * Purpose: optional operation specific to plugins. * - * Failure: negative + * Return: Success: non negative + * Failure: negative * * Programmer: Mohamad Chaarawi * March, 2012 * *------------------------------------------------------------------------- */ -ssize_t -H5VLdatatype_get_binary(void *obj, H5VL_t *vol_plugin, void *buf, size_t size, hid_t dxpl_id, void UNUSED **req) +herr_t +H5VLdatatype_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) { - ssize_t ret_value = FAIL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("Zs", "*x*x*xzi**x", obj, vol_plugin, buf, size, dxpl_id, req); + H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_datatype_get_binary(obj, vol_plugin, buf, size, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to encode datatype") + + if(NULL == vol_plugin->cls->datatype_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype optional' method") + if((ret_value = (vol_plugin->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) -} /* end H5VLdatatype_get_binary() */ +} /* end H5VLdatatype_optional() */ /*------------------------------------------------------------------------- @@ -875,7 +832,6 @@ done: * Purpose: Get specific information about the datatype through the VOL * * Return: Success: non negative - * * Failure: negative * * Programmer: Mohamad Chaarawi @@ -885,30 +841,21 @@ done: */ herr_t H5VLdatatype_get(void *obj, H5VL_t *vol_plugin, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void UNUSED **req, va_list arguments) + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVti**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*x*xVei**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Tget_create_plist */ - case H5VL_DATATYPE_GET_TCPL: - { - hid_t *new_tcpl_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_datatype_get(obj, vol_plugin, get_type, dxpl_id, - H5_EVENT_STACK_NULL, new_tcpl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get datatype information") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from datatype") - } + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype get' method") + if((ret_value = (vol_plugin->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) @@ -929,7 +876,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +H5VLdatatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -938,7 +885,7 @@ H5VLdatatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **re if (NULL == dt || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_datatype_close(dt, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_datatype_close(dt, vol_plugin, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close datatype") done: @@ -952,7 +899,6 @@ done: * Purpose: Creates a dataset through the VOL * * Return: Success: pointer to dataset - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -962,7 +908,7 @@ done: */ void * H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -971,7 +917,7 @@ H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, vol_plugin, name, - dcpl_id, dapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + dcpl_id, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create dataset") done: @@ -985,7 +931,6 @@ done: * Purpose: Opens a dataset through the VOL * * Return: Success: pointer to dataset - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -995,7 +940,7 @@ done: */ void * H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t dapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -1003,7 +948,7 @@ H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, co if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open dataset") done: @@ -1015,9 +960,8 @@ done: * Function: H5VLdataset_read * * Purpose: Reads data from dataset through the VOL -* - * Return: Success: Non Negative * + * Return: Success: Non Negative * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -1027,7 +971,7 @@ done: */ herr_t H5VLdataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, void *buf, void UNUSED **req) + hid_t file_space_id, hid_t plist_id, void *buf, void **req) { herr_t ret_value = SUCCEED; @@ -1038,7 +982,7 @@ H5VLdataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_sp if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") if((ret_value = H5VL_dataset_read(dset, vol_plugin, mem_type_id, mem_space_id, file_space_id, - plist_id, buf, H5_EVENT_STACK_NULL)) < 0) + plist_id, buf, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") done: @@ -1052,7 +996,6 @@ done: * Purpose: Writes data from dataset through the VOL * * Return: Success: Non Negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -1062,7 +1005,7 @@ done: */ herr_t H5VLdataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, void UNUSED **req) + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) { herr_t ret_value = SUCCEED; @@ -1073,7 +1016,7 @@ H5VLdataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_s if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") if((ret_value = H5VL_dataset_write(dset, vol_plugin, mem_type_id, mem_space_id, file_space_id, - plist_id, buf, H5_EVENT_STACK_NULL)) < 0) + plist_id, buf, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") done: @@ -1082,13 +1025,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLdataset_set_extent - * - * Purpose: Modifies the dimensions of a dataset + * Function: H5VLdataset_get * - * Return: Success: Non Negative + * Purpose: Get specific information about the dataset through the VOL * - * Failure: Negative + * Return: Success: non negative + * Failure: negative * * Programmer: Mohamad Chaarawi * March, 2012 @@ -1096,30 +1038,35 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_set_extent(void *dset, H5VL_t *vol_plugin, const hsize_t size[], hid_t dxpl_id, void UNUSED **req) +H5VLdataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*x*x*hi**x", dset, vol_plugin, size, dxpl_id, req); + H5TRACE6("e", "*x*xVci**xx", dset, vol_plugin, get_type, dxpl_id, req, + arguments); if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_dataset_set_extent(dset, vol_plugin, size, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to set extent of dataset") + + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->dataset_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset get' method") + if((ret_value = (vol_plugin->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) -} /* end H5VLdataset_set_extent() */ +} /* end H5VLdataset_get() */ /*------------------------------------------------------------------------- - * Function: H5VLdataset_get + * Function: H5VLdataset_specific * - * Purpose: Get specific information about the dataset through the VOL + * Purpose: specific operation on datasets through the VOL * * Return: Success: non negative - * * Failure: negative * * Programmer: Mohamad Chaarawi @@ -1128,88 +1075,61 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLdataset_specific(void *obj, H5VL_t *vol_plugin, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVdi**xx", dset, vol_plugin, get_type, dxpl_id, req, + H5TRACE6("e", "*x*xVdi**xx", obj, vol_plugin, specific_type, dxpl_id, req, arguments); - if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Dget_space */ - case H5VL_DATASET_GET_SPACE: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - /* H5Dget_space_statuc */ - case H5VL_DATASET_GET_SPACE_STATUS: - { - H5D_space_status_t *allocation = va_arg (arguments, H5D_space_status_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, allocation)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - /* H5Dget_type */ - case H5VL_DATASET_GET_TYPE: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - /* H5Dget_create_plist */ - case H5VL_DATASET_GET_DCPL: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - /* H5Dget_access_plist */ - case H5VL_DATASET_GET_DAPL: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - /* H5Dget_storage_size */ - case H5VL_DATASET_GET_STORAGE_SIZE: - { - hsize_t *ret = va_arg (arguments, hsize_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - /* H5Dget_offset */ - case H5VL_DATASET_GET_OFFSET: - { - haddr_t *ret = va_arg (arguments, haddr_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset") - } + if(NULL == vol_plugin->cls->dataset_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset specific' method") + if((ret_value = (vol_plugin->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) -} /* end H5VLdataset_get() */ +} /* end H5VLdataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + + if(NULL == vol_plugin->cls->dataset_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset optional' method") + if((ret_value = (vol_plugin->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) +} /* end H5VLdataset_optional() */ /*------------------------------------------------------------------------- @@ -1218,7 +1138,6 @@ done: * Purpose: Closes a dataset through the VOL * * Return: Success: Non Negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -1227,7 +1146,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +H5VLdataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -1236,7 +1155,7 @@ H5VLdataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **r if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_dataset_close(dset, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_dataset_close(dset, vol_plugin, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close dataset") done: @@ -1250,7 +1169,6 @@ done: * Purpose: Creates a file through the VOL * * Return: Success: pointer to file. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -1260,13 +1178,13 @@ done: */ void * H5VLfile_create(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t fapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ FUNC_ENTER_API(NULL) - if(NULL == (ret_value = H5VL_file_create(vol_plugin, name, flags, fcpl_id, fapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_file_create(vol_plugin, name, flags, fcpl_id, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") done: @@ -1280,7 +1198,6 @@ done: * Purpose: Opens a file through the VOL. * * Return: Success: pointer to file. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -1289,13 +1206,13 @@ done: *------------------------------------------------------------------------- */ void * -H5VLfile_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void UNUSED **req) +H5VLfile_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ FUNC_ENTER_API(NULL) - if(NULL == (ret_value = H5VL_file_open(vol_plugin, name, flags, fapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_file_open(vol_plugin, name, flags, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") done: @@ -1304,45 +1221,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLfile_flush - * - * Purpose: Flushes a file through the VOL - * - * Return: Success: Non Negative - * - * Failure: Negative - * - * Programmer: Mohamad Chaarawi - * February, 2012 - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLfile_flush(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - H5F_scope_t scope, hid_t dxpl_id, void UNUSED **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xx*xFsi**x", obj, loc_params, vol_plugin, scope, dxpl_id, req); - - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_file_flush(obj, loc_params, vol_plugin, scope, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to flush file") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLfile_flush() */ - - -/*------------------------------------------------------------------------- * Function: H5VLfile_get * * Purpose: Get specific information about the file through the VOL * * Return: Success: non negative - * * Failure: negative * * Programmer: Mohamad Chaarawi @@ -1351,94 +1234,23 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLfile_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVfi**xx", file, vol_plugin, get_type, dxpl_id, req, + H5TRACE6("e", "*x*xVgi**xx", file, vol_plugin, get_type, dxpl_id, req, arguments); if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Fget_access_plist */ - case H5VL_FILE_GET_FAPL: - { - hid_t *plist_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, plist_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - /* H5Fget_create_plist */ - case H5VL_FILE_GET_FCPL: - { - hid_t *plist_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, plist_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - /* H5Fget_obj_count */ - case H5VL_FILE_GET_OBJ_COUNT: - { - unsigned types = va_arg (arguments, unsigned); - ssize_t *ret = va_arg (arguments, ssize_t *); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, types, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - /* H5Fget_obj_ids */ - case H5VL_FILE_GET_OBJ_IDS: - { - unsigned types = va_arg (arguments, unsigned); - size_t max_objs = va_arg (arguments, size_t); - hid_t *oid_list = va_arg (arguments, hid_t *); - ssize_t *ret = va_arg (arguments, ssize_t *); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, types, max_objs, - oid_list, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - /* H5Fget_intent */ - case H5VL_FILE_GET_INTENT: - { - unsigned *ret = va_arg (arguments, unsigned *); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - /* H5Fget_name */ - case H5VL_FILE_GET_NAME: - { - H5I_type_t type = va_arg (arguments, H5I_type_t); - size_t size = va_arg (arguments, size_t); - char *name = va_arg (arguments, char *); - ssize_t *ret = va_arg (arguments, ssize_t *); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, type, size, - name, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - /* H5I_get_file_id */ - case H5VL_OBJECT_GET_FILE: - { - H5I_type_t type = va_arg (arguments, H5I_type_t); - void **ret = va_arg (arguments, void **); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, type, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information") - } /* end switch */ + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->file_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file get' method") + if((ret_value = (vol_plugin->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) @@ -1446,9 +1258,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLfile_misc + * Function: H5VLfile_specific * - * Purpose: perform a specified operation through the VOL + * Purpose: perform File specific operations through the VOL * * Return: Success: non negative * Failure: negative @@ -1459,60 +1271,49 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_misc(void *file, H5VL_t *vol_plugin, H5VL_file_misc_t misc_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLfile_specific(void *file, H5VL_t *vol_plugin, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVmi**xx", file, vol_plugin, misc_type, dxpl_id, req, + H5TRACE6("e", "*x*xVhi**xx", file, vol_plugin, specific_type, dxpl_id, req, arguments); - if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + H5P_genplist_t *plist; /* Property list pointer */ + hid_t vol_id; /* VOL plugin identigier attached to fapl_id */ + H5VL_class_t *vol_cls; /* VOL class of vol_id */ + hid_t fapl_id; - switch (misc_type) { - /* H5Fmount */ - case H5VL_FILE_MOUNT: - { - H5I_type_t type = va_arg (arguments, H5I_type_t); - const char *name = va_arg (arguments, const char *); - H5F_t *child = va_arg (arguments, H5F_t *); - hid_t plist_id = va_arg (arguments, hid_t); - - if((ret_value = H5VL_file_misc(file, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, - type, name, child, plist_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - - break; - } - /* H5Fmount */ - case H5VL_FILE_UNMOUNT: - { - H5I_type_t type = va_arg (arguments, H5I_type_t); - const char *name = va_arg (arguments, const char *); - - if((ret_value = H5VL_file_misc(file, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, type, name)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fis_accessible */ - case H5VL_FILE_IS_ACCESSIBLE: - { - hid_t fapl_id = va_arg (arguments, hid_t); - const char *name = va_arg (arguments, const char *); - htri_t *ret = va_arg (arguments, htri_t *); - - if((ret_value = H5VL_file_misc(file, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, fapl_id, name, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") - } + fapl_id = va_arg (arguments, hid_t); + + /* 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_get(plist, H5F_ACS_VOL_ID_NAME, &vol_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol plugin") + + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object(vol_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL ID") + if((ret_value = (vol_cls->file_cls.specific) + (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") + } + else { + if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + + if(NULL == vol_plugin->cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file specific' method") + if((ret_value = (vol_plugin->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") + } done: FUNC_LEAVE_API(ret_value) -} /* end H5VLfile_misc() */ +} /* end H5VLfile_specific() */ /*------------------------------------------------------------------------- @@ -1529,145 +1330,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_optional(void *file, H5VL_t *vol_plugin, H5VL_file_optional_t optional_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLfile_optional(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVni**xx", file, vol_plugin, optional_type, dxpl_id, req, - arguments); + H5TRACE5("e", "*x*xi**xx", file, vol_plugin, dxpl_id, req, arguments); if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (optional_type) { - /* H5Fget_filesize */ - case H5VL_FILE_GET_SIZE: - { - hsize_t *ret = va_arg (arguments, hsize_t *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_file_image */ - case H5VL_FILE_GET_FILE_IMAGE: - { - void *buf_ptr = va_arg (arguments, void *); - ssize_t *ret = va_arg (arguments, ssize_t *); - size_t buf_len = va_arg (arguments, size_t ); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, - buf_ptr, ret, buf_len)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_freespace */ - case H5VL_FILE_GET_FREE_SPACE: - { - hssize_t *ret = va_arg (arguments, hssize_t *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - case H5VL_FILE_GET_FREE_SECTIONS: - { - H5F_sect_info_t *sect_info = va_arg (arguments, H5F_sect_info_t *); - ssize_t *ret = va_arg (arguments, ssize_t *); - H5F_mem_t type = va_arg (arguments, H5F_mem_t); - size_t nsects = va_arg (arguments, size_t); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, - sect_info, ret, type, nsects)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_info2 */ - case H5VL_FILE_GET_INFO: - { - H5I_type_t type = va_arg (arguments, H5I_type_t); - H5F_info2_t *finfo = va_arg (arguments, H5F_info2_t *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, type, finfo)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_mdc_config */ - case H5VL_FILE_GET_MDC_CONF: - { - H5AC_cache_config_t *config_ptr = va_arg (arguments, H5AC_cache_config_t *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, config_ptr)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_mdc_hit_rate */ - case H5VL_FILE_GET_MDC_HR: - { - double *hit_rate_ptr = va_arg (arguments, double *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, hit_rate_ptr)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_mdc_size */ - case H5VL_FILE_GET_MDC_SIZE: - { - size_t *max_size_ptr = va_arg (arguments, size_t *); - size_t *min_clean_size_ptr = va_arg (arguments, size_t *); - size_t *cur_size_ptr = va_arg (arguments, size_t *); - int *cur_num_entries_ptr = va_arg (arguments, int *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, max_size_ptr, - min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_vfd_handle */ - case H5VL_FILE_GET_VFD_HANDLE: - { - void **file_handle = va_arg (arguments, void **); - hid_t fapl = va_arg (arguments, hid_t); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, file_handle, fapl)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fclear_elink_file_cache */ - case H5VL_FILE_CLEAR_ELINK_CACHE: - { - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Freopen */ - case H5VL_FILE_REOPEN: - { - void **ret = va_arg (arguments, void **); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Freset_mdc_hit_rate_stats */ - case H5VL_FILE_RESET_MDC_HIT_RATE: - { - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - case H5VL_FILE_SET_MDC_CONFIG: - { - H5AC_cache_config_t *config_ptr = va_arg (arguments, H5AC_cache_config_t *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, config_ptr)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") - } + if(NULL == vol_plugin->cls->file_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file optional' method") + if((ret_value = (vol_plugin->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) @@ -1680,7 +1356,6 @@ done: * Purpose: Closes a file through the VOL * * Return: Success: Non Negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -1689,7 +1364,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +H5VLfile_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -1698,7 +1373,7 @@ H5VLfile_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_file_close(file, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_file_close(file, vol_plugin, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close file") done: @@ -1710,7 +1385,6 @@ done: * Function: H5VLgroup_create * * Purpose: Creates a group through the VOL - * * Return: Success: pointer to new group. * * Failure: NULL @@ -1722,7 +1396,7 @@ done: */ void * H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -1731,7 +1405,7 @@ H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, co if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") if(NULL == (ret_value = H5VL_group_create(obj, loc_params, vol_plugin, name, - gcpl_id, gapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") done: @@ -1745,7 +1419,6 @@ done: * Purpose: Opens a group through the VOL * * Return: Success: pointer to new group. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -1755,7 +1428,7 @@ done: */ void * H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t gapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t gapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -1764,7 +1437,7 @@ H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, cons if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") if(NULL == (ret_value = H5VL_group_open(obj, loc_params, vol_plugin, name, - gapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") done: @@ -1778,7 +1451,6 @@ done: * Purpose: Get specific information about the group through the VOL * * Return: Success: non negative - * * Failure: negative * * Programmer: Mohamad Chaarawi @@ -1787,39 +1459,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLgroup_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVgi**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*x*xVii**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Gget_create_plist */ - case H5VL_GROUP_GET_GCPL: - { - hid_t *new_gcpl_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_group_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, new_gcpl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get group information") - break; - } - /* H5Gget_info */ - case H5VL_GROUP_GET_INFO: - { - H5VL_loc_params_t loc_params = va_arg (arguments, H5VL_loc_params_t); - H5G_info_t *grp_info = va_arg (arguments, H5G_info_t *); - - if((ret_value = H5VL_group_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, loc_params, grp_info)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get group information") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group") - } + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->group_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group get' method") + if((ret_value = (vol_plugin->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) @@ -1827,12 +1482,82 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLgroup_specific + * + * Purpose: specific operation on groups through the VOL + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_specific(void *obj, H5VL_t *vol_plugin, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*x*xVji**xx", obj, vol_plugin, specific_type, dxpl_id, req, + arguments); + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + + if(NULL == vol_plugin->cls->group_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group specific' method") + if((ret_value = (vol_plugin->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) +} /* end H5VLgroup_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + + if(NULL == vol_plugin->cls->group_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group optional' method") + if((ret_value = (vol_plugin->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) +} /* end H5VLgroup_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VLgroup_close * * Purpose: Closes a group through the VOL * * Return: Success: Non Negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -1841,7 +1566,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +H5VLgroup_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -1850,7 +1575,7 @@ H5VLgroup_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) if(NULL == grp || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_group_close(grp, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_group_close(grp, vol_plugin, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close group") done: @@ -1872,17 +1597,17 @@ done: */ herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void UNUSED **req) + H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("e", "Vc*xx*xiii**x", create_type, obj, loc_params, vol_plugin, + H5TRACE8("e", "Vk*xx*xiii**x", create_type, obj, loc_params, vol_plugin, lcpl_id, lapl_id, dxpl_id, req); if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_link_create(create_type, obj, loc_params, vol_plugin, lcpl_id, lapl_id, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_link_create(create_type, obj, loc_params, vol_plugin, lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -1891,9 +1616,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLlink_move + * Function: H5VLlink_copy * - * Purpose: Copy or move a link from src to dst. + * Purpose: Copy a link from src to dst. * * Return: Non-negative on success/Negative on failure * @@ -1902,9 +1627,9 @@ done: * *------------------------------------------------------------------------- */ -H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, - hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void UNUSED **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, H5VL_t *vol_plugin, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1912,45 +1637,44 @@ H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void * if(NULL == src_obj || NULL == dst_obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, vol_plugin, - copy_flag, lcpl_id, lapl_id, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") + if((ret_value = H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, vol_plugin, + lcpl_id, lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to copy object") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLlink_move() */ +} /* end H5VLlink_copy() */ /*------------------------------------------------------------------------- - * Function: H5VLlink_iterate + * Function: H5VLlink_move * - * Purpose: Iterate over links in a group + * Purpose: Move a link from src to dst. * - * Return: Success: non negative - * Failure: negative + * Return: Non-negative on success/Negative on failure * * Programmer: Mohamad Chaarawi - * May, 2012 + * April, 2012 * *------------------------------------------------------------------------- */ -herr_t H5VLlink_iterate(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - hbool_t recursive, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, - H5L_iterate_t op, void *op_data, hid_t dxpl_id, void UNUSED **req) +H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + if(NULL == src_obj || NULL == dst_obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_link_iterate(obj, loc_params, vol_plugin, recursive, idx_type, order, idx, - op, op_data, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Link iteration failed") + if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, vol_plugin, + 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) -} /* end H5VLlink_iterate() */ + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_move() */ /*------------------------------------------------------------------------- @@ -1969,7 +1693,7 @@ done: */ herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_get_t get_type, - hid_t dxpl_id, void UNUSED **req, va_list arguments) + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; @@ -1980,50 +1704,11 @@ H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_l if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Lexists */ - case H5VL_LINK_EXISTS: - { - htri_t *ret = va_arg (arguments, htri_t *); - - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get link information") - break; - } - /* H5Lget_info/H5Lget_info_by_idx */ - case H5VL_LINK_GET_INFO: - { - H5L_info_t *linfo = va_arg (arguments, H5L_info_t *); - - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, linfo)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get link information") - break; - } - /* H5Lget_name_by_idx */ - case H5VL_LINK_GET_NAME: - { - char *name = va_arg (arguments, char *); - size_t size = va_arg (arguments, size_t); - ssize_t *ret = va_arg (arguments, ssize_t *); - - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - name, size, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get link information") - break; - } - /* H5Lget_val/H5Lget_val_by_idx */ - case H5VL_LINK_GET_VAL: - { - void *buf = va_arg (arguments, void *); - size_t size = va_arg (arguments, size_t); - - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, buf, size)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get link information") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link") - } + if(NULL == vol_plugin->cls->link_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link get' method") + if((ret_value = (vol_plugin->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) @@ -2031,31 +1716,76 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLlink_remove + * Function: H5VLlink_specific * - * Purpose: Removes a link through the VOL. + * Purpose: specific operation on links through the VOL * - * Return: Non-negative on success/Negative on failure + * Return: Success: non negative + * Failure: negative * * Programmer: Mohamad Chaarawi - * April, 2012 + * March, 2012 * *------------------------------------------------------------------------- */ -H5_DLL herr_t H5VLlink_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +herr_t +H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*xx*xVmi**xx", obj, loc_params, vol_plugin, specific_type, + dxpl_id, req, arguments); - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->link_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link specific' method") + if((ret_value = (vol_plugin->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) +} /* end H5VLlink_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_link_remove(obj, loc_params, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to remove link") + + /* Have to bypass the H5VLint layer due to unknown val_list arguments */ + if(NULL == vol_plugin->cls->link_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link optional' method") + if((ret_value = (vol_plugin->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) -} /* end H5VLlink_remove() */ +} /* end H5VLlink_optional() */ /*------------------------------------------------------------------------- @@ -2064,7 +1794,6 @@ done: * Purpose: Opens a object through the VOL * * Return: Success: User ID of the new object. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -2074,7 +1803,7 @@ done: */ void * H5VLobject_open(void *obj, H5VL_loc_params_t params, H5VL_t *vol_plugin, H5I_type_t *opened_type, - hid_t dxpl_id, void UNUSED **req) + hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -2082,7 +1811,7 @@ H5VLobject_open(void *obj, H5VL_loc_params_t params, H5VL_t *vol_plugin, H5I_typ if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_object_open(obj, params, vol_plugin, opened_type, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_object_open(obj, params, vol_plugin, opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") done: @@ -2106,7 +1835,7 @@ done: herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void UNUSED **req) + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -2120,7 +1849,7 @@ H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") if((ret_value = H5VL_object_copy(src_obj, loc_params1, vol_plugin1, src_name, dst_obj, loc_params2, vol_plugin2, dst_name, - ocpypl_id, lcpl_id, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + ocpypl_id, lcpl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") done: @@ -2129,37 +1858,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLobject_visit - * - * Purpose: Iterate over links in a group - * - * Return: Success: non negative - * Failure: negative - * - * Programmer: Mohamad Chaarawi - * May, 2012 - * - *------------------------------------------------------------------------- - */ -herr_t H5VLobject_visit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5_index_t idx_type, - H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t dxpl_id, void UNUSED **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_object_visit(obj, loc_params, vol_plugin, idx_type, order, - op, op_data, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLobject_visit() */ - - -/*------------------------------------------------------------------------- * Function: H5VLobject_get * * Purpose: Get specific information about the object through the VOL @@ -2175,89 +1873,22 @@ done: */ herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_get_t get_type, - hid_t dxpl_id, void UNUSED **req, va_list arguments) + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xx*xVoi**xx", obj, loc_params, vol_plugin, get_type, dxpl_id, + H5TRACE7("e", "*xx*xVni**xx", obj, loc_params, vol_plugin, get_type, dxpl_id, req, arguments); if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Oexists_by_name */ - case H5VL_OBJECT_EXISTS: - { - htri_t *ret = va_arg (arguments, htri_t *); - - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */ - case H5VL_OBJECT_GET_INFO: - { - H5O_info_t *obj_info = va_arg (arguments, H5O_info_t *); - - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, obj_info)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Oget_comment / H5Oget_comment_by_name */ - case H5VL_OBJECT_GET_COMMENT: - { - char *comment = va_arg (arguments, char *); - size_t bufsize = va_arg (arguments, size_t); - ssize_t *ret = va_arg (arguments, ssize_t *); - - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - comment, bufsize, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Rget_region */ - case H5VL_REF_GET_REGION: - { - hid_t *ret = va_arg (arguments, hid_t *); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - void *ref = va_arg (arguments, void *); - - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - ret, ref_type, ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Rget_obj_type2 */ - case H5VL_REF_GET_TYPE: - { - H5O_type_t *obj_type = va_arg (arguments, H5O_type_t *); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - void *ref = va_arg (arguments, void *); - - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - obj_type, ref_type, ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Rget_name */ - case H5VL_REF_GET_NAME: - { - ssize_t *ret = va_arg (arguments, ssize_t *); - char *name = va_arg (arguments, char *); - size_t size = va_arg (arguments, size_t); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - void *ref = va_arg (arguments, void *); - - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - ret, name, size, ref_type, ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") - } + if(NULL == vol_plugin->cls->object_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object get' method") + if((ret_value = (vol_plugin->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) @@ -2265,9 +1896,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLobject_misc + * Function: H5VLobject_specific * - * Purpose: perform a plugin specific operation + * Purpose: specific operation on objects through the VOL * * Return: Success: non negative * Failure: negative @@ -2278,77 +1909,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_misc(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_misc_t misc_type, - hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xx*xVxi**xx", obj, loc_params, vol_plugin, misc_type, dxpl_id, - req, arguments); + H5TRACE7("e", "*xx*xVoi**xx", obj, loc_params, vol_plugin, specific_type, + dxpl_id, req, arguments); if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (misc_type) { - /* H5Arename/rename_by_name */ - case H5VL_ATTR_RENAME: - { - const char *old_name = va_arg (arguments, const char *); - const char *new_name = va_arg (arguments, const char *); - - if((ret_value = H5VL_object_misc(obj, loc_params, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, - old_name, new_name)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Oincr_refcount / H5Odecr_refcount */ - case H5VL_OBJECT_CHANGE_REF_COUNT: - { - int update_ref = va_arg (arguments, int); - - if((ret_value = H5VL_object_misc(obj, loc_params, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, update_ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Oset_comment */ - case H5VL_OBJECT_SET_COMMENT: - { - const char *comment = va_arg (arguments, char *); - - if((ret_value = H5VL_object_misc(obj, loc_params, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, comment)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - case H5VL_REF_CREATE: - { - void *ref = va_arg (arguments, void *); - const char *name = va_arg (arguments, char *); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - hid_t space_id = va_arg (arguments, hid_t); - - if((ret_value = H5VL_object_misc(obj, loc_params, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, - ref, name, ref_type, space_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") - } + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object specific' method") + if((ret_value = (vol_plugin->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) -} /* end H5VLobject_misc() */ +} /* end H5VLobject_specific() */ /*------------------------------------------------------------------------- - * Function: H5VLobject_close - * - * Purpose: Closes a object through the VOL + * Function: H5VLobject_optional * - * Return: Success: Non Negative + * Purpose: optional operation specific to plugins. * - * Failure: Negative + * Return: Success: non negative + * Failure: negative * * Programmer: Mohamad Chaarawi * March, 2012 @@ -2356,21 +1947,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_close(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +H5VLobject_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xx*xi**x", obj, loc_params, vol_plugin, dxpl_id, req); + H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_object_close(obj, loc_params, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close object") + + /* Have to bypass the H5VLint layer due to unknown val_list arguments */ + if(NULL == vol_plugin->cls->object_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object optional' method") + if((ret_value = (vol_plugin->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) -} /* end H5VLobject_close() */ +} /* end H5VLobject_optional() */ /*------------------------------------------------------------------------- diff --git a/src/H5VLint.c b/src/H5VLint.c index b619b4b..01d4bbb 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -448,7 +448,7 @@ done: */ void * H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -460,7 +460,7 @@ H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, co /* call the corresponding VOL create callback */ if(NULL == (ret_value = (vol_plugin->cls->attr_cls.create) - (obj, loc_params, name, acpl_id, aapl_id, dxpl_id, H5_REQUEST_NULL))) + (obj, loc_params, name, acpl_id, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") vol_plugin->nrefs ++; @@ -488,7 +488,7 @@ done: */ void * H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t aapl_id, hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -499,7 +499,7 @@ H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, cons HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `attr open' method") /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->attr_cls.open) - (obj, loc_params, name, aapl_id, dxpl_id, H5_REQUEST_NULL))) + (obj, loc_params, name, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") vol_plugin->nrefs ++; @@ -526,7 +526,7 @@ done: *------------------------------------------------------------------------- */ herr_t H5VL_attr_read(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, void *buf, - hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -534,8 +534,7 @@ herr_t H5VL_attr_read(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, void *b if(NULL == vol_plugin->cls->attr_cls.read) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr read' method") - - if((ret_value = (vol_plugin->cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = (vol_plugin->cls->attr_cls.read)(attr, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "read failed") done: @@ -558,7 +557,7 @@ done: *------------------------------------------------------------------------- */ herr_t H5VL_attr_write(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, const void *buf, - hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -566,7 +565,7 @@ herr_t H5VL_attr_write(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, const if(NULL == vol_plugin->cls->attr_cls.write) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr write' method") - if((ret_value = (vol_plugin->cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = (vol_plugin->cls->attr_cls.write)(attr, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "write failed") done: @@ -575,42 +574,46 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_attr_iterate + * Function: H5VL_attr_get * - * Purpose: Iterate over attrs in an object + * Purpose: Get specific information about the attribute through the VOL * * Return: Success: non negative + * * Failure: negative * * Programmer: Mohamad Chaarawi - * June, 2013 + * March, 2012 * *------------------------------------------------------------------------- */ -herr_t -H5VL_attr_iterate(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *n, - H5A_operator2_t op, void *op_data, hid_t dxpl_id, hid_t UNUSED estack_id) +herr_t +H5VL_attr_get(void *obj, H5VL_t *vol_plugin, 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 == vol_plugin->cls->attr_cls.iterate) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr iterate' method") - if((ret_value = (vol_plugin->cls->attr_cls.iterate) - (obj, loc_params, idx_type, order, n, op, op_data, dxpl_id, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "iteration failed") + if(NULL == vol_plugin->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 = (vol_plugin->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_iterate() */ +} /* end H5VL_attr_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_attr_get + * Function: H5VL_attr_specific * - * Purpose: Get specific information about the attribute through the VOL + * Purpose: specific operation on attributes through the VOL * * Return: Success: non negative * @@ -622,58 +625,61 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, - hid_t dxpl_id, hid_t estack_id, ...) +H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + 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 == vol_plugin->cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr get' method") + if(NULL == vol_plugin->cls->attr_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr specific' method") - va_start (arguments, estack_id); - if((ret_value = (vol_plugin->cls->attr_cls.get) - (obj, get_type, dxpl_id, H5_REQUEST_NULL, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_start (arguments, req); + if((ret_value = (vol_plugin->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_get() */ +} /* end H5VL_attr_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_attr_remove + * Function: H5VL_attr_optional * - * Purpose: Removes an attribute through the VOL + * Purpose: optional operation specific to plugins. * - * Return: Success: Non Negative + * Return: Success: non negative * - * Failure: Negative + * Failure: negative * * Programmer: Mohamad Chaarawi * March, 2012 * *------------------------------------------------------------------------- */ -herr_t -H5VL_attr_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - const char *attr_name, hid_t dxpl_id, hid_t UNUSED estack_id) +herr_t +H5VL_attr_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...) { - herr_t ret_value = SUCCEED; + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->attr_cls.remove) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr remove' method") - if((ret_value = (vol_plugin->cls->attr_cls.remove)(obj, loc_params, attr_name, dxpl_id, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDELETE, FAIL, "remove failed") + if(NULL == vol_plugin->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 = (vol_plugin->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_remove() */ +} /* end H5VL_attr_optional() */ /*------------------------------------------------------------------------- @@ -691,7 +697,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t UNUSED estack_id) +H5VL_attr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -699,7 +705,7 @@ H5VL_attr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t UNUSED esta if(NULL == vol_plugin->cls->attr_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr close' method") - if((ret_value = (vol_plugin->cls->attr_cls.close)(attr, dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = (vol_plugin->cls->attr_cls.close)(attr, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") vol_plugin->nrefs --; @@ -730,7 +736,7 @@ done: void * H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, - hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -742,7 +748,7 @@ H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin /* call the corresponding VOL commit callback */ if(NULL == (ret_value = (vol_plugin->cls->datatype_cls.commit) - (obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, H5_REQUEST_NULL))) + (obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "commit failed") vol_plugin->nrefs ++; @@ -770,7 +776,7 @@ done: */ void * H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t tapl_id, hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t tapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -782,7 +788,7 @@ H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->datatype_cls.open) - (obj, loc_params, name, tapl_id, dxpl_id, H5_REQUEST_NULL))) + (obj, loc_params, name, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") vol_plugin->nrefs ++; @@ -795,73 +801,111 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_datatype_get_binary + * Function: H5VL_datatype_get * - * Purpose: gets required size to serialize datatype description + * Purpose: Get specific information about the datatype through the VOL * - * Return: Success: size needed + * Return: Success: non negative * - * Failure: negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * June, 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_get(void *obj, H5VL_t *vol_plugin, 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) + + if(NULL == vol_plugin->cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype get' method") + va_start (arguments, req); + if((ret_value = (vol_plugin->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 * * Programmer: Mohamad Chaarawi * March, 2012 * *------------------------------------------------------------------------- */ -ssize_t -H5VL_datatype_get_binary(void *obj, H5VL_t *vol_plugin, void *buf, size_t size, - hid_t dxpl_id, hid_t UNUSED estack_id) +herr_t +H5VL_datatype_specific(void *obj, H5VL_t *vol_plugin, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, ...) { - ssize_t ret_value = FAIL; + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - /* check if the type specific corresponding VOL open callback exists */ - if(NULL == vol_plugin->cls->datatype_cls.get_binary) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "no datatype get_binary callback"); - /* call the corresponding VOL open callback */ - if((ret_value = (vol_plugin->cls->datatype_cls.get_binary)(obj, buf, size, dxpl_id, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "get binary failed") + if(NULL == vol_plugin->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 = (vol_plugin->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_get_binary() */ +} /* end H5VL_datatype_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_datatype_get + * Function: H5VL_datatype_optional * - * Purpose: Get specific information about the datatype through the VOL + * Purpose: optional operation specific to plugins. * * Return: Success: non negative * * Failure: negative * * Programmer: Mohamad Chaarawi - * June, 2013 + * March, 2012 * *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_get(void *obj, H5VL_t *vol_plugin, H5VL_datatype_get_t get_type, - hid_t dxpl_id, hid_t estack_id, ...) +H5VL_datatype_optional(void *obj, H5VL_t *vol_plugin, 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 == vol_plugin->cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype get' method") - va_start (arguments, estack_id); - if((ret_value = (vol_plugin->cls->datatype_cls.get)(obj, get_type, dxpl_id, - H5_REQUEST_NULL, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + if(NULL == vol_plugin->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 = (vol_plugin->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_get() */ +} /* end H5VL_datatype_optional() */ /*------------------------------------------------------------------------- @@ -878,7 +922,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t UNUSED estack_id) +H5VL_datatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -889,7 +933,7 @@ H5VL_datatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t UNUSED es HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype close' method") /* call the corresponding VOL close callback */ - if((ret_value = (vol_plugin->cls->datatype_cls.close)(dt, dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = (vol_plugin->cls->datatype_cls.close)(dt, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") if(H5I_dec_ref(vol_plugin->id) < 0) @@ -919,7 +963,7 @@ done: */ void * H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -931,7 +975,7 @@ H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, /* call the corresponding VOL create callback */ if(NULL == (ret_value = (vol_plugin->cls->dataset_cls.create) - (obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, H5_REQUEST_NULL))) + (obj, loc_params, name, dcpl_id, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") vol_plugin->nrefs ++; @@ -959,7 +1003,7 @@ done: */ void * H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t dapl_id, hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -971,7 +1015,7 @@ H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, c /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->dataset_cls.open) - (obj, loc_params, name, dapl_id, dxpl_id, H5_REQUEST_NULL))) + (obj, loc_params, name, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") vol_plugin->nrefs ++; @@ -999,7 +1043,7 @@ done: */ herr_t H5VL_dataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, void *buf, hid_t UNUSED estack_id) + hid_t file_space_id, hid_t plist_id, void *buf, void **req) { herr_t ret_value = SUCCEED; @@ -1008,7 +1052,7 @@ H5VL_dataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_s if(NULL == vol_plugin->cls->dataset_cls.read) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset read' method") if((ret_value = (vol_plugin->cls->dataset_cls.read) - (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, H5_REQUEST_NULL)) < 0) + (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: @@ -1032,7 +1076,7 @@ done: */ herr_t H5VL_dataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, hid_t UNUSED estack_id) + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) { herr_t ret_value = SUCCEED; @@ -1041,7 +1085,7 @@ H5VL_dataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_ if(NULL == vol_plugin->cls->dataset_cls.write) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset write' method") if((ret_value = (vol_plugin->cls->dataset_cls.write) - (dset, mem_type_id, mem_space_id, file_space_id, plist_id, buf, H5_REQUEST_NULL)) < 0) + (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: @@ -1050,41 +1094,45 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_dataset_set_extent + * Function: H5VL_dataset_get * - * Purpose: Modifies the dimensions of a dataset + * Purpose: Get specific information about the dataset through the VOL * - * Return: Success: Non Negative + * Return: Success: non negative * - * Failure: Negative + * Failure: negative * * Programmer: Mohamad Chaarawi * March, 2012 * *------------------------------------------------------------------------- */ -herr_t -H5VL_dataset_set_extent(void *dset, H5VL_t *vol_plugin, const hsize_t size[], - hid_t dxpl_id, hid_t UNUSED estack_id) +herr_t +H5VL_dataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, ...) { - herr_t ret_value = SUCCEED; + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->dataset_cls.set_extent) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset set_extent' method") - if((ret_value = (vol_plugin->cls->dataset_cls.set_extent)(dset, size, dxpl_id, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "set_extent failed") + if(NULL == vol_plugin->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 = (vol_plugin->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_set_extent() */ +} /* end H5VL_dataset_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_dataset_get + * Function: H5VL_dataset_specific * - * Purpose: Get specific information about the dataset through the VOL + * Purpose: specific operation on datasets through the VOL * * Return: Success: non negative * @@ -1096,25 +1144,61 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, - hid_t dxpl_id, hid_t estack_id, ...) +H5VL_dataset_specific(void *obj, H5VL_t *vol_plugin, 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 == vol_plugin->cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset get' method") + if(NULL == vol_plugin->cls->dataset_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset specific' method") - va_start (arguments, estack_id); - if((ret_value = (vol_plugin->cls->dataset_cls.get)(dset, get_type, dxpl_id, H5_REQUEST_NULL, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_start (arguments, req); + if((ret_value = (vol_plugin->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_get() */ +} /* end H5VL_dataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_optional(void *obj, H5VL_t *vol_plugin, 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 == vol_plugin->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 = (vol_plugin->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() */ /*------------------------------------------------------------------------- @@ -1132,7 +1216,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t UNUSED estack_id) +H5VL_dataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -1140,7 +1224,7 @@ H5VL_dataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t UNUSED e if(NULL == vol_plugin->cls->dataset_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dset close' method") - if((ret_value = (vol_plugin->cls->dataset_cls.close)(dset, dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = (vol_plugin->cls->dataset_cls.close)(dset, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") done: @@ -1173,7 +1257,7 @@ done: */ void * H5VL_file_create(H5VL_t **plugin, const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t fapl_id, hid_t dxpl_id, void **req) { H5P_genplist_t *plist; /* Property list pointer */ hid_t vol_id; /* VOL plugin identigier attached to fapl_id */ @@ -1196,7 +1280,7 @@ H5VL_file_create(H5VL_t **plugin, const char *name, unsigned flags, hid_t fcpl_i if(NULL == vol_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 = (vol_cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, H5_REQUEST_NULL))) + if(NULL == (ret_value = (vol_cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") /* Build the vol plugin struct */ @@ -1231,7 +1315,7 @@ done: */ void * H5VL_file_open(H5VL_t **plugin, const char *name, unsigned flags, hid_t fapl_id, - hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t dxpl_id, void **req) { H5P_genplist_t *plist; /* Property list pointer */ hid_t vol_id; /* VOL plugin identigier attached to fapl_id */ @@ -1254,7 +1338,7 @@ H5VL_file_open(H5VL_t **plugin, const char *name, unsigned flags, hid_t fapl_id, if(NULL == vol_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 = (vol_cls->file_cls.open)(name, flags, fapl_id, dxpl_id, H5_REQUEST_NULL))) + if(NULL == (ret_value = (vol_cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "open failed") /* Build the vol plugin struct */ @@ -1274,38 +1358,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_file_flush - * - * Purpose: Flushes a file through the VOL - * - * Return: Success: Non Negative - * - * Failure: Negative - * - * Programmer: Mohamad Chaarawi - * February, 2012 - * - *------------------------------------------------------------------------- - */ -herr_t -H5VL_file_flush(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5F_scope_t scope, - hid_t dxpl_id, hid_t UNUSED estack_id) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == vol_plugin->cls->file_cls.flush) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file flush' method") - if((ret_value = (vol_plugin->cls->file_cls.flush)(obj, loc_params, scope, dxpl_id, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTFLUSH, FAIL, "flush failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_file_flush() */ - - -/*------------------------------------------------------------------------- * Function: H5VL_file_get * * Purpose: Get specific information about the file through the VOL @@ -1321,7 +1373,7 @@ done: */ herr_t H5VL_file_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, - hid_t dxpl_id, hid_t estack_id, ...) + hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; @@ -1331,8 +1383,8 @@ H5VL_file_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, if(NULL == vol_plugin->cls->file_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file get' method") - va_start(arguments, estack_id); - if((ret_value = (vol_plugin->cls->file_cls.get)(file, get_type, dxpl_id, H5_REQUEST_NULL, arguments)) < 0) + va_start(arguments, req); + if((ret_value = (vol_plugin->cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") va_end(arguments); @@ -1342,9 +1394,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_file_misc + * Function: H5VL_file_specific * - * Purpose: perform a specified operation through the VOL + * Purpose: perform File specific operations through the VOL * * Return: Success: non negative * Failure: negative @@ -1355,22 +1407,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_misc(void *file, H5VL_t *vol_plugin, H5VL_file_misc_t misc_type, - hid_t dxpl_id, hid_t estack_id, ...) +H5VL_file_specific(void *file, H5VL_t *vol_plugin, 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 (misc_type == H5VL_FILE_IS_ACCESSIBLE) { + if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { H5P_genplist_t *plist; /* Property list pointer */ hid_t vol_id; /* VOL plugin identigier attached to fapl_id */ H5VL_class_t *vol_cls; /* VOL class of vol_id */ va_list tmp_args; /* argument list passed from the API call */ hid_t fapl_id; - va_start (tmp_args, estack_id); + va_start (tmp_args, req); fapl_id = va_arg (tmp_args, hid_t); va_end (tmp_args); @@ -1383,26 +1435,26 @@ H5VL_file_misc(void *file, H5VL_t *vol_plugin, H5VL_file_misc_t misc_type, if(NULL == (vol_cls = (H5VL_class_t *)H5I_object(vol_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL ID") - va_start (arguments, estack_id); - if((ret_value = (vol_cls->file_cls.misc) - (file, misc_type, dxpl_id, H5_REQUEST_NULL, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "misc failed") + va_start (arguments, req); + if((ret_value = (vol_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 == vol_plugin->cls->file_cls.misc) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file misc' method") + if(NULL == vol_plugin->cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file specific' method") - va_start (arguments, estack_id); - if((ret_value = (vol_plugin->cls->file_cls.misc) - (file, misc_type, dxpl_id, H5_REQUEST_NULL, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "misc failed") + va_start (arguments, req); + if((ret_value = (vol_plugin->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_misc() */ +} /* end H5VL_file_specific() */ /*------------------------------------------------------------------------- @@ -1419,8 +1471,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_optional(void *file, H5VL_t *vol_plugin, H5VL_file_optional_t optional_type, - hid_t dxpl_id, hid_t estack_id, ...) +H5VL_file_optional(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; @@ -1430,18 +1481,11 @@ H5VL_file_optional(void *file, H5VL_t *vol_plugin, H5VL_file_optional_t optional if(NULL == vol_plugin->cls->file_cls.optional) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file optional' method") - va_start (arguments, estack_id); - if((ret_value = (vol_plugin->cls->file_cls.optional)(file, optional_type, dxpl_id, H5_REQUEST_NULL, arguments)) < 0) + va_start (arguments, req); + if((ret_value = (vol_plugin->cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "optional failed") va_end (arguments); - /* if the get_type is a named datatype, attach the vol info to it */ - if(H5VL_FILE_REOPEN == optional_type) { - vol_plugin->nrefs ++; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") - } - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_optional() */ @@ -1462,7 +1506,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t UNUSED estack_id) +H5VL_file_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -1470,7 +1514,7 @@ H5VL_file_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t UNUSED esta if(NULL == vol_plugin->cls->file_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file close' method") - if((ret_value = (vol_plugin->cls->file_cls.close)(file, dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = (vol_plugin->cls->file_cls.close)(file, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "close failed") vol_plugin->nrefs --; @@ -1500,7 +1544,7 @@ done: */ void * H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -1512,7 +1556,7 @@ H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, c /* call the corresponding VOL create callback */ if(NULL == (ret_value = (vol_plugin->cls->group_cls.create) - (obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, H5_REQUEST_NULL))) + (obj, loc_params, name, gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "create failed") vol_plugin->nrefs ++; @@ -1540,7 +1584,7 @@ done: */ void * H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t gapl_id, hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t gapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -1550,7 +1594,7 @@ H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, con HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "vol plugin has no `group open' method") if(NULL == (ret_value = (vol_plugin->cls->group_cls.open) - (obj, loc_params, name, gapl_id, dxpl_id, H5_REQUEST_NULL))) + (obj, loc_params, name, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") vol_plugin->nrefs ++; @@ -1578,7 +1622,7 @@ done: */ herr_t H5VL_group_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, - hid_t dxpl_id, hid_t estack_id, ...) + hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; @@ -1588,9 +1632,9 @@ H5VL_group_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, if(NULL == vol_plugin->cls->group_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group get' method") - va_start (arguments, estack_id); + va_start (arguments, req); if((ret_value = (vol_plugin->cls->group_cls.get) - (obj, get_type, dxpl_id, H5_REQUEST_NULL, arguments)) < 0) + (obj, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") va_end (arguments); @@ -1600,6 +1644,78 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_group_specific + * + * Purpose: specific operation on groups through the VOL + * + * Return: Success: non negative + * + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_specific(void *obj, H5VL_t *vol_plugin, 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 == vol_plugin->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 = (vol_plugin->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 + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_group_optional(void *obj, H5VL_t *vol_plugin, 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 == vol_plugin->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 = (vol_plugin->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 @@ -1614,7 +1730,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t UNUSED estack_id) +H5VL_group_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -1622,7 +1738,7 @@ H5VL_group_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t UNUSED esta if(NULL == vol_plugin->cls->group_cls.close) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group close' method") - if((ret_value = (vol_plugin->cls->group_cls.close)(grp, dxpl_id, H5_REQUEST_NULL)) < 0) + if((ret_value = (vol_plugin->cls->group_cls.close)(grp, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") vol_plugin->nrefs --; @@ -1650,7 +1766,7 @@ done: */ herr_t H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, hid_t UNUSED estack_id) + H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1661,7 +1777,7 @@ H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link create' method") /* call the corresponding VOL create callback */ if((ret_value = (vol_plugin->cls->link_cls.create) - (create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, H5_REQUEST_NULL)) < 0) + (create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link create failed") done: @@ -1670,9 +1786,45 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_link_copy + * + * Purpose: Copys a link from src to dst. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * April, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + 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 == vol_plugin->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 = (vol_plugin->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: Copy or move a link from src to dst. + * Purpose: Moves a link from src to dst. * * Return: Non-negative on success/Negative on failure * @@ -1683,8 +1835,8 @@ done: */ herr_t H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, hbool_t copy_flag, - hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, hid_t UNUSED estack_id) + H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1696,8 +1848,8 @@ H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, /* call the corresponding VOL move callback */ if((ret_value = (vol_plugin->cls->link_cls.move) - (src_obj, loc_params1, dst_obj, loc_params2, copy_flag, lcpl_id, - lapl_id, dxpl_id, H5_REQUEST_NULL)) < 0) + (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: @@ -1706,107 +1858,112 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_link_iterate + * Function: H5VL_link_get * - * Purpose: Iterate over links in a group + * Purpose: Get specific information about the link through the VOL * * Return: Success: non negative + * * Failure: negative * * Programmer: Mohamad Chaarawi - * May, 2012 + * April, 2012 * *------------------------------------------------------------------------- */ -herr_t -H5VL_link_iterate(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - hbool_t recursive, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, - H5L_iterate_t op, void *op_data, hid_t dxpl_id, hid_t UNUSED estack_id) +herr_t +H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, 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 == vol_plugin->cls->link_cls.iterate) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link iterate' method") + if(NULL == vol_plugin->cls->link_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link get' method") - if((ret_value = (vol_plugin->cls->link_cls.iterate) - (obj, loc_params, recursive, idx_type, order, idx, op, op_data, dxpl_id, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "iteration failed") + va_start (arguments, req); + if((ret_value = (vol_plugin->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_iterate() */ + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_link_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_link_get + * Function: H5VL_link_specific * - * Purpose: Get specific information about the link through the VOL + * Purpose: specific operation on links through the VOL * * Return: Success: non negative * * Failure: negative * * Programmer: Mohamad Chaarawi - * April, 2012 + * March, 2012 * *------------------------------------------------------------------------- */ herr_t -H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_get_t get_type, - hid_t dxpl_id, hid_t estack_id, ...) +H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + 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 == vol_plugin->cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link get' method") + if(NULL == vol_plugin->cls->link_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link specific' method") - va_start (arguments, estack_id); - if((ret_value = (vol_plugin->cls->link_cls.get) - (obj, loc_params, get_type, dxpl_id, H5_REQUEST_NULL, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + va_start (arguments, req); + if((ret_value = (vol_plugin->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_get() */ +} /* end H5VL_link_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_link_remove + * Function: H5VL_link_optional * - * Purpose: Removes a link through the VOL. + * Purpose: optional operation specific to plugins. * - * Return: Non-negative on success/Negative on failure + * Return: Success: non negative + * + * Failure: negative * * Programmer: Mohamad Chaarawi - * April, 2012 + * March, 2012 * *------------------------------------------------------------------------- */ -herr_t -H5VL_link_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - hid_t dxpl_id, hid_t UNUSED estack_id) +herr_t +H5VL_link_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...) { - herr_t ret_value = SUCCEED; /* Return value */ + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - /* check if the corresponding VOL remove callback exists */ - if(NULL == vol_plugin->cls->link_cls.remove) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link remove' method") + if(NULL == vol_plugin->cls->link_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link optional' method") - /* call the corresponding VOL remove callback */ - if((ret_value = (vol_plugin->cls->link_cls.remove)(obj, loc_params, dxpl_id, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "link remove failed") + va_start (arguments, req); + if((ret_value = (vol_plugin->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_remove() */ +} /* end H5VL_link_optional() */ /*------------------------------------------------------------------------- @@ -1825,7 +1982,7 @@ done: */ void * H5VL_object_open(void *obj, H5VL_loc_params_t params, H5VL_t *vol_plugin, H5I_type_t *opened_type, - hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -1837,7 +1994,7 @@ H5VL_object_open(void *obj, H5VL_loc_params_t params, H5VL_t *vol_plugin, H5I_ty /* call the corresponding VOL open callback */ if(NULL == (ret_value = (vol_plugin->cls->object_cls.open) - (obj, params, opened_type, dxpl_id, H5_REQUEST_NULL))) + (obj, params, opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") vol_plugin->nrefs++; @@ -1865,7 +2022,7 @@ done: herr_t H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, hid_t UNUSED estack_id) + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -1880,7 +2037,7 @@ H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugi if((ret_value = (vol_plugin1->cls->object_cls.copy) (src_obj, loc_params1, src_name, dst_obj, loc_params2, dst_name, ocpypl_id, - lcpl_id, dxpl_id, H5_REQUEST_NULL)) < 0) + lcpl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "copy failed") done: @@ -1889,39 +2046,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_object_visit - * - * Purpose: Iterate over links in a group - * - * Return: Success: non negative - * Failure: negative - * - * Programmer: Mohamad Chaarawi - * May, 2012 - * - *------------------------------------------------------------------------- - */ -herr_t H5VL_object_visit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, - void *op_data, hid_t dxpl_id, hid_t UNUSED estack_id) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - if(NULL == vol_plugin->cls->object_cls.visit) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object visit' method") - - if((ret_value = (vol_plugin->cls->object_cls.visit) - (obj, loc_params, idx_type, order, op, op_data, dxpl_id, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "object visitation failed") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_object_visit() */ - - -/*------------------------------------------------------------------------- * Function: H5VL_object_get * * Purpose: Get specific information about the object through the VOL @@ -1937,7 +2061,7 @@ done: */ herr_t H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_get_t get_type, - hid_t dxpl_id, hid_t estack_id, ...) + hid_t dxpl_id, void **req, ...) { va_list arguments; /* argument list passed from the API call */ herr_t ret_value = SUCCEED; @@ -1947,9 +2071,9 @@ H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5V if(NULL == vol_plugin->cls->object_cls.get) HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object get' method") - va_start (arguments, estack_id); + va_start (arguments, req); if((ret_value = (vol_plugin->cls->object_cls.get) - (obj, loc_params, get_type, dxpl_id, H5_REQUEST_NULL, arguments)) < 0) + (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") va_end (arguments); @@ -1959,9 +2083,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_object_misc + * Function: H5VL_object_specific * - * Purpose: perform a plugin specific operation + * Purpose: specific operation on objects through the VOL * * Return: Success: non negative * Failure: negative @@ -1972,36 +2096,36 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_misc(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_misc_t misc_type, - hid_t dxpl_id, hid_t estack_id, ...) +H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + 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 == vol_plugin->cls->object_cls.misc) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object misc' method") + if(NULL == vol_plugin->cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object specific' method") - va_start (arguments, estack_id); - if((ret_value = (vol_plugin->cls->object_cls.misc) - (obj, loc_params, misc_type, dxpl_id, H5_REQUEST_NULL, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "misc failed") + va_start (arguments, req); + if((ret_value = (vol_plugin->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_misc() */ +} /* end H5VL_object_specific() */ /*------------------------------------------------------------------------- - * Function: H5VL_object_close + * Function: H5VL_object_optional * - * Purpose: Closes a object through the VOL + * Purpose: optional operation specific to plugins. * - * Return: Success: Non Negative + * Return: Success: non negative * - * Failure: Negative + * Failure: negative * * Programmer: Mohamad Chaarawi * March, 2012 @@ -2009,21 +2133,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_close(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - hid_t dxpl_id, hid_t UNUSED estack_id) +H5VL_object_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...) { - herr_t ret_value = SUCCEED; + va_list arguments; /* argument list passed from the API call */ + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - if(NULL == vol_plugin->cls->object_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object close' method") - if((ret_value = (vol_plugin->cls->object_cls.close)(obj, loc_params, dxpl_id, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "close failed") + if(NULL == vol_plugin->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 = (vol_plugin->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_close() */ +} /* end H5VL_object_optional() */ /*------------------------------------------------------------------------- diff --git a/src/H5VLnative.c b/src/H5VLnative.c index ccf6a58..1dc6bcc 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -68,17 +68,13 @@ static void *H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, co 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_iterate(void *obj, H5VL_loc_params_t loc_params, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *n, - H5A_operator2_t op, void *op_data, 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_remove(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t dxpl_id, void **req); +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); /* 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 ssize_t H5VL_native_datatype_get_binary(void *obj, void *buf, size_t size, 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_close(void *dt, hid_t dxpl_id, void **req); @@ -89,17 +85,16 @@ static herr_t H5VL_native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_ 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, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); -static herr_t H5VL_native_dataset_set_extent(void *dset, const hsize_t size[], 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_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_flush(void *obj, H5VL_loc_params_t loc_params, H5F_scope_t scope, 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_misc(void *file, H5VL_file_misc_t misc_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_file_optional(void *file, H5VL_file_optional_t optional_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 */ @@ -111,26 +106,23 @@ 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, 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, + 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, void *dst_obj, H5VL_loc_params_t loc_params2, - hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_native_link_iterate(void *obj, H5VL_loc_params_t loc_params, hbool_t recursive, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, - H5L_iterate_t op, void *op_data, hid_t dxpl_id, void **req); + 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_remove(void *obj, H5VL_loc_params_t loc_params, hid_t dxpl_id, void **req); +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, 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_visit(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type, - H5_iter_order_t order, H5O_iterate_t op, void *op_data, 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_misc(void *obj, H5VL_loc_params_t loc_params, H5VL_object_misc_t misc_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_object_optional(void *obj, H5VL_loc_params_t loc_params, H5VL_object_optional_t optional_type, hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL_native_object_close(void *obj, H5VL_loc_params_t loc_params, hid_t dxpl_id, void **req); +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 H5VL_class_t H5VL_native_g = { NATIVE, @@ -145,33 +137,34 @@ static H5VL_class_t H5VL_native_g = { H5VL_native_attr_open, /* open */ H5VL_native_attr_read, /* read */ H5VL_native_attr_write, /* write */ - H5VL_native_attr_iterate, /* iterate */ H5VL_native_attr_get, /* get */ - H5VL_native_attr_remove, /* remove */ + H5VL_native_attr_specific, /* specific */ + NULL, /* optional */ H5VL_native_attr_close /* close */ }, - { /* datatype_cls */ - H5VL_native_datatype_commit, /* commit */ - H5VL_native_datatype_open, /* open */ - H5VL_native_datatype_get_binary, /* get_binary */ - H5VL_native_datatype_get, /* get */ - H5VL_native_datatype_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_set_extent, /* set extent */ H5VL_native_dataset_get, /* get */ + H5VL_native_dataset_specific, /* specific */ + NULL, /* optional */ H5VL_native_dataset_close /* close */ }, + { /* datatype_cls */ + H5VL_native_datatype_commit, /* commit */ + H5VL_native_datatype_open, /* open */ + H5VL_native_datatype_get, /* get */ + NULL, /* specific */ + NULL, /* optional */ + H5VL_native_datatype_close /* close */ + }, { /* file_cls */ H5VL_native_file_create, /* create */ H5VL_native_file_open, /* open */ - H5VL_native_file_flush, /* flush */ H5VL_native_file_get, /* get */ - H5VL_native_file_misc, /* misc */ + H5VL_native_file_specific, /* specific */ H5VL_native_file_optional, /* optional */ H5VL_native_file_close /* close */ }, @@ -179,29 +172,31 @@ static H5VL_class_t H5VL_native_g = { H5VL_native_group_create, /* create */ H5VL_native_group_open, /* open */ H5VL_native_group_get, /* get */ + NULL, /* specific */ + NULL, /* optional */ 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_iterate, /* iterate */ H5VL_native_link_get, /* get */ - H5VL_native_link_remove /* remove */ + H5VL_native_link_specific, /* specific */ + NULL /* optional */ }, { /* object_cls */ H5VL_native_object_open, /* open */ H5VL_native_object_copy, /* copy */ - H5VL_native_object_visit, /* visit */ H5VL_native_object_get, /* get */ - H5VL_native_object_misc, /* misc */ - H5VL_native_object_optional, /* optional */ - H5VL_native_object_close /* close */ + H5VL_native_object_specific, /* specific */ + H5VL_native_object_optional /* optional */ }, { /* async_cls */ NULL, /* cancel */ NULL, /* test */ NULL /* wait */ - } + }, + NULL }; @@ -398,8 +393,15 @@ H5VL_native_register(H5I_type_t type, void *obj, hbool_t app_ref) if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") - if ((ret_value = H5VL_object_register(obj, type, vol_plugin, app_ref)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle") + /* Get an atom for the object */ + if(type == H5I_DATATYPE && ((H5T_t *)obj)->vol_obj == NULL) { + if ((ret_value = H5VL_object_register(obj, type, vol_plugin, app_ref)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle") + } + else { + if((ret_value = H5I_register2(type, obj, vol_plugin, app_ref)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object") + } done: if(ret_value < 0) { @@ -413,6 +415,41 @@ done: } /* H5VL_native_register */ +/*--------------------------------------------------------------------------- + * Function: H5VL_native_unregister + * + * Purpose: utility routine to decrement ref count on Native VOL plugin + * + * Returns: Non-negative on success or negative on failure + * + * Programmer: Mohamad Chaarawi + * August, 2014 + * + *--------------------------------------------------------------------------- + */ +herr_t +H5VL_native_unregister(hid_t obj_id) +{ + H5VL_t *vol_plugin; /* VOL plugin information */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + /* get the plugin pointer */ + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") + + vol_plugin->nrefs--; + if(H5I_dec_ref(vol_plugin->id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") + if(0 == vol_plugin->nrefs) + H5MM_free(vol_plugin); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5VL_native_unregister */ + + /*------------------------------------------------------------------------- * Function: H5Pset_fapl_native * @@ -460,7 +497,7 @@ 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 UNUSED aapl_id, hid_t UNUSED dxpl_id, void UNUSED **req) + hid_t UNUSED aapl_id, hid_t dxpl_id, void UNUSED **req) { H5G_loc_t loc; /* Object location */ H5G_loc_t obj_loc; /* Location used to open group */ @@ -500,7 +537,7 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Acreate */ /* Go do the real work for attaching the attribute to the dataset */ - if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, H5AC_dxpl_id))) + if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") } else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Acreate_by_name */ @@ -519,7 +556,7 @@ H5VL_native_attr_create(void *obj, H5VL_loc_params_t loc_params, const char *att loc_found = TRUE; /* Go do the real work for attaching the attribute to the dataset */ - if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, H5AC_dxpl_id))) + if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") } else { @@ -550,7 +587,7 @@ done: */ static void * H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, - hid_t UNUSED aapl_id, hid_t UNUSED dxpl_id, void UNUSED **req) + hid_t UNUSED aapl_id, hid_t dxpl_id, void UNUSED **req) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ @@ -564,7 +601,7 @@ H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_ if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Aopen */ /* Read in attribute from object header */ - if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to load attribute info from object header for attribute: '%s'", attr_name) /* Finish initializing attribute */ if(H5A_open_common(&loc, attr) < 0) @@ -573,7 +610,7 @@ H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_ 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, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id))) + loc_params.loc_data.loc_by_name.lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") } else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Aopen_by_idx */ @@ -582,7 +619,7 @@ H5VL_native_attr_open(void *obj, H5VL_loc_params_t loc_params, const char *attr_ 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, - loc_params.loc_data.loc_by_idx.lapl_id, H5AC_ind_dxpl_id))) + loc_params.loc_data.loc_by_idx.lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute") } else { @@ -609,7 +646,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t UNUSED dxpl_id, void UNUSED **req) +H5VL_native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void UNUSED **req) { H5T_t *mem_type; /* Memory datatype */ herr_t ret_value; /* Return value */ @@ -619,7 +656,7 @@ H5VL_native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t UNUSED dxpl_i 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, H5AC_dxpl_id)) < 0) + if((ret_value = H5A_read((H5A_t*)attr, mem_type, buf, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: @@ -640,7 +677,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t UNUSED dxpl_id, void UNUSED **req) +H5VL_native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void UNUSED **req) { H5T_t *mem_type; /* Memory datatype */ herr_t ret_value; /* Return value */ @@ -650,7 +687,7 @@ H5VL_native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t UNUSED 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, H5AC_dxpl_id)) < 0) + if((ret_value = H5A_write((H5A_t*)attr, mem_type, buf, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") done: @@ -659,132 +696,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_iterate - * - * Purpose: Iterates through attrs in an object - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Mohamad Chaarawi - * June, 2013 - * - *------------------------------------------------------------------------- - */ -static herr_t H5VL_native_attr_iterate(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type, - H5_iter_order_t order, hsize_t *idx, H5A_operator2_t op, - void *op_data, hid_t UNUSED dxpl_id, void UNUSED **req) -{ - H5G_loc_t loc; /* Object location */ - H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ - hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ - hid_t obj_loc_id = (-1); /* ID for object located */ - H5A_attr_iter_op_t attr_op; /* Attribute operator */ - hsize_t start_idx; /* Index of attribute to start iterating at */ - hsize_t last_attr; /* Index of last attribute examined */ - void *temp_obj = NULL; - H5I_type_t obj_type; - H5VL_t *vol_plugin = NULL; /* VOL plugin information */ - herr_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* check arguments */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - - /* Build attribute operator info */ - attr_op.op_type = H5A_ATTR_OP_APP2; - attr_op.u.app_op2 = op; - - /* Call attribute iteration routine */ - last_attr = start_idx = (idx ? *idx : 0); - - /* Iterate over the attributess */ - if(loc_params.type == H5VL_OBJECT_BY_SELF) { - /* Build the vol plugin struct */ - if(NULL == (vol_plugin = (H5VL_t *)H5MM_calloc(sizeof(H5VL_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - vol_plugin->cls = &H5VL_native_g; - vol_plugin->nrefs = 1; - vol_plugin->id = H5VL_NATIVE_g; - if(H5I_inc_ref(vol_plugin->id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "unable to increment ref count on VOL plugin") - - /* Get an atom for the object */ - if((obj_loc_id = H5I_register2(loc_params.obj_type, obj, vol_plugin, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register object") - } - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { - /* Set up opened group location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); - - /* Find the object's location */ - if(H5G_loc_find(&loc, loc_params.loc_data.loc_by_name.name, &obj_loc/*out*/, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found"); - loc_found = TRUE; - - /* Open the object */ - if((obj_loc_id = H5O_open_by_loc(&obj_loc, loc_params.loc_data.loc_by_name.lapl_id, - H5AC_ind_dxpl_id, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object"); - - /* get the native object from the ID created by the object header and create - a "VOL object" ID */ - obj_type = H5I_get_type(obj_loc_id); - if(NULL == (temp_obj = H5I_remove(obj_loc_id))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object"); - /* Get an atom for the object */ - if((obj_loc_id = H5VL_native_register(obj_type, temp_obj, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register datatype"); - } - else { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown link iterate params"); - } - - /* Do the real iteration */ - if((ret_value = H5O_attr_iterate(obj_loc_id, H5AC_ind_dxpl_id, idx_type, order, - start_idx, &last_attr, &attr_op, op_data)) < 0) - HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); - - /* Set the last attribute information */ - if(idx) - *idx = last_attr; - -done: - /* Release resources */ - if(loc_params.type == H5VL_OBJECT_BY_SELF) { - if(obj_loc_id >= 0 && NULL == H5I_remove(obj_loc_id)) - HDONE_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to free identifier"); - - vol_plugin->nrefs--; - if(H5I_dec_ref(vol_plugin->id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL plugin") - if(0 == vol_plugin->nrefs) - H5MM_free(vol_plugin); - } - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { - if(obj_loc_id >= 0) { - if(H5I_dec_app_ref(obj_loc_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object"); - } /* end if */ - else if(loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location"); - } - else { - HDONE_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown link iterate params"); - } - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_iterate() */ - - -/*------------------------------------------------------------------------- * Function: H5VL_native_attr_get * * Purpose: Gets certain information about an attribute @@ -798,42 +709,13 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t UNUSED dxpl_id, void UNUSED **req, va_list arguments) +H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT switch (get_type) { - /* H5Aexists/exists_by_name */ - case H5VL_ATTR_EXISTS: - { - H5VL_loc_params_t loc_params = va_arg (arguments, H5VL_loc_params_t); - char *attr_name = va_arg (arguments, char *); - htri_t *ret = va_arg (arguments, htri_t *); - H5G_loc_t loc; - - /* check arguments */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - - if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Aexists */ - /* Check if the attribute exists */ - if((*ret = H5O_attr_exists(loc.oloc, attr_name, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - } - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aopen_by_name */ - /* Check if the attribute exists */ - if((*ret = H5A_exists_by_name(loc, loc_params.loc_data.loc_by_name.name, - attr_name, - loc_params.loc_data.loc_by_name.lapl_id)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") - } - else { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters") - } - break; - } /* H5Aget_space */ case H5VL_ATTR_GET_SPACE: { @@ -893,7 +775,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t UNUSED dxpl_id, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, loc_params.loc_data.loc_by_idx.lapl_id, - H5AC_ind_dxpl_id))) + dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the length of the name */ @@ -939,7 +821,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t UNUSED dxpl_id, if(NULL == (attr = H5A_open_by_name(&loc, loc_params.loc_data.loc_by_name.name, attr_name, loc_params.loc_data.loc_by_name.lapl_id, - H5AC_ind_dxpl_id))) + dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ @@ -963,7 +845,7 @@ H5VL_native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t UNUSED dxpl_id, loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, loc_params.loc_data.loc_by_idx.lapl_id, - H5AC_ind_dxpl_id))) + dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ @@ -998,85 +880,106 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_native_attr_remove + * Function: H5VL_native_attr_specific * - * Purpose: Deletes an attribute from a location + * Purpose: Specific operations for attributes * * Return: Success: 0 - * Failure: -1, attr not deleted. + * Failure: -1 * * Programmer: Mohamad Chaarawi - * March, 2012 + * August, 2014 * *------------------------------------------------------------------------- */ -static herr_t -H5VL_native_attr_remove(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, - hid_t UNUSED dxpl_id, void UNUSED **req) +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 UNUSED **req, va_list arguments) { - H5G_loc_t loc; /* Object location */ - H5G_loc_t obj_loc; /* Location used to open group */ - H5G_name_t obj_path; /* Opened object group hier. path */ - H5O_loc_t obj_oloc; /* Opened object object location */ - hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - /* check arguments */ - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + switch (specific_type) { + case H5VL_ATTR_DELETE: + { + char *attr_name = va_arg (arguments, char *); - if(H5VL_OBJECT_BY_SELF == loc_params.type) { /* H5Adelete */ - /* Delete the attribute from the location */ - if(H5O_attr_remove(loc.oloc, attr_name, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - } - else if(H5VL_OBJECT_BY_NAME == loc_params.type) { /* H5Adelete_by_name */ - /* Set up opened group location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); + if(H5A_delete(obj, loc_params, attr_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute") + break; + } + case H5VL_ATTR_EXISTS: + { + const char *attr_name = va_arg (arguments, const char *); + htri_t *ret = va_arg (arguments, htri_t *); + H5G_loc_t loc; - /* Find the object's location */ - if(H5G_loc_find(&loc, loc_params.loc_data.loc_by_name.name, &obj_loc/*out*/, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") - loc_found = TRUE; + /* check arguments */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - /* Delete the attribute from the location */ - if(H5O_attr_remove(obj_loc.oloc, attr_name, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - } - else if(H5VL_OBJECT_BY_IDX == loc_params.type) { /* H5Adelete_by_idx */ - /* Set up opened group location to fill in */ - obj_loc.oloc = &obj_oloc; - obj_loc.path = &obj_path; - H5G_loc_reset(&obj_loc); + if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Aexists */ + /* Check if the attribute exists */ + if((*ret = H5O_attr_exists(loc.oloc, attr_name, dxpl_id)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") + } + else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Aopen_by_name */ + /* Check if the attribute exists */ + if((*ret = H5A_exists_by_name(loc, loc_params.loc_data.loc_by_name.name, attr_name, + loc_params.loc_data.loc_by_name.lapl_id)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") + } + 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); + H5_iter_order_t order = va_arg (arguments, H5_iter_order_t); + hsize_t *idx = va_arg (arguments, hsize_t *); + H5A_operator2_t op = va_arg (arguments, H5A_operator2_t); + void *op_data = va_arg (arguments, void *); - /* Find the object's location */ - if(H5G_loc_find(&loc, loc_params.loc_data.loc_by_idx.name, &obj_loc/*out*/, - loc_params.loc_data.loc_by_idx.lapl_id, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") - loc_found = TRUE; + if((ret_value = H5A_iterate(obj, loc_params, idx_type, order, idx, op, op_data)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes") + break; + } + /* H5Arename/rename_by_name */ + case H5VL_ATTR_RENAME: + { + const char *old_name = va_arg (arguments, const char *); + const char *new_name = va_arg (arguments, const char *); + H5G_loc_t loc; - /* Delete the attribute from the location */ - if(H5O_attr_remove_by_idx(obj_loc.oloc, 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, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") - } - else { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute remove parameters") - } + /* check arguments */ + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Arename */ + /* Call attribute rename routine */ + if(H5O_attr_rename(loc.oloc, dxpl_id, old_name, new_name) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + } + 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, loc_params.loc_data.loc_by_name.lapl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters") + } + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } done: - /* Release resources */ - if(loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_attr_remove() */ +} /* end H5VL_native_attr_specific() */ /*------------------------------------------------------------------------- @@ -1122,7 +1025,7 @@ 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 tapl_id, hid_t UNUSED dxpl_id, void UNUSED **req) + hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void UNUSED **req) { H5G_loc_t loc; /* Location to commit datatype */ H5T_t *dt; /* Datatype for ID */ @@ -1160,12 +1063,12 @@ H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char if(NULL != name) { /* H5Tcommit */ /* Commit the type */ - if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, H5AC_dxpl_id) < 0) + if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") } else { /* H5Tcommit_anon */ /* Commit the type */ - if(H5T__commit(loc.oloc->file, type, tcpl_id, H5AC_dxpl_id) < 0) + if(H5T__commit(loc.oloc->file, type, tcpl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") /* Release the datatype's object header */ @@ -1177,7 +1080,7 @@ H5VL_native_datatype_commit(void *obj, H5VL_loc_params_t loc_params, const char HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, NULL, "unable to get object location of committed datatype") /* Decrement refcount on committed datatype's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") } /* end if */ } @@ -1253,38 +1156,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_native_datatype_get_binary - * - * Purpose: gets size required to encode the datatype - * - * Return: Success: datatype id. - * Failure: -1 - * - * Programmer: Mohamad Chaarawi - * March, 2012 - * - *------------------------------------------------------------------------- - */ -static ssize_t -H5VL_native_datatype_get_binary(void *obj, void *buf, size_t size, hid_t UNUSED dxpl_id, void UNUSED **req) -{ - H5T_t *type = (H5T_t *)obj; - size_t nalloc = size; - ssize_t ret_value = FAIL; - - FUNC_ENTER_NOAPI_NOINIT - - if(H5T_encode(type, (unsigned char *)buf, &nalloc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine serialized length of datatype") - - ret_value = (ssize_t) nalloc; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_datatype_get_binary() */ - - -/*------------------------------------------------------------------------- * Function: H5VL_native_datatype_get * * Purpose: Gets certain information about a datatype @@ -1299,7 +1170,7 @@ done: */ static herr_t H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, - hid_t UNUSED dxpl_id, void UNUSED **req, va_list arguments) + hid_t dxpl_id, void UNUSED **req, va_list arguments) { H5T_t *dt = (H5T_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ @@ -1307,6 +1178,18 @@ H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, FUNC_ENTER_NOAPI_NOINIT switch (get_type) { + case H5VL_DATATYPE_GET_BINARY: + { + ssize_t *nalloc = va_arg (arguments, ssize_t *); + void *buf = va_arg (arguments, void *); + size_t size = va_arg (arguments, size_t); + + if(H5T_encode(dt, (unsigned char *)buf, &size) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine serialized length of datatype") + + *nalloc = (ssize_t) size; + break; + } /* H5Tget_create_plist */ case H5VL_DATATYPE_GET_TCPL: { @@ -1327,7 +1210,7 @@ H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list"); /* Retrieve any object creation properties */ - if(H5O_get_create_plist(&dt->oloc, H5AC_ind_dxpl_id, tcpl_plist) < 0) + if(H5O_get_create_plist(&dt->oloc, dxpl_id, tcpl_plist) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info"); *ret_id = tcpl_id; @@ -1385,7 +1268,7 @@ 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 UNUSED dxpl_id, void UNUSED **req) + hid_t dapl_id, hid_t dxpl_id, void UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ H5G_loc_t loc; /* Object location to insert dataset into */ @@ -1419,14 +1302,14 @@ H5VL_native_dataset_create(void *obj, H5VL_loc_params_t loc_params, const char * /* H5Dcreate_anon */ if(NULL == name) { /* build and open the new dataset */ - if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") } /* 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, H5AC_dxpl_id))) + dcpl_id, dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") } ret_value = (void *)dset; @@ -1442,7 +1325,7 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get object location of dataset") /* Decrement refcount on dataset's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") } /* end if */ } @@ -1612,36 +1495,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_native_dataset_set_extent - * - * Purpose: Set Extent of dataset - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Mohamad Chaarawi - * March, 2012 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5VL_native_dataset_set_extent(void *obj, const hsize_t size[], hid_t UNUSED dxpl_id, void UNUSED **req) -{ - H5D_t *dset = (H5D_t *)obj; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Private function */ - if(H5D__set_extent(dset, size, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extend dataset") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_dataset_set_extent() */ - - -/*------------------------------------------------------------------------- * Function: H5VL_native_dataset_get * * Purpose: Gets certain information about a dataset @@ -1655,7 +1508,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t UNUSED dxpl_id, void UNUSED **req, va_list arguments) +H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, + void UNUSED **req, va_list arguments) { H5D_t *dset = (H5D_t *)obj; herr_t ret_value = SUCCEED; /* Return value */ @@ -1679,7 +1533,7 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t UNUSED dxp H5D_space_status_t *allocation = va_arg (arguments, H5D_space_status_t *); /* Read data space address and return */ - if(H5D__get_space_status(dset, allocation, H5AC_ind_dxpl_id) < 0) + if(H5D__get_space_status(dset, allocation, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status") break; @@ -1720,7 +1574,7 @@ H5VL_native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t UNUSED dxp hsize_t *ret = va_arg (arguments, hsize_t *); /* Set return value */ - if(H5D__get_storage_size(dset, H5AC_ind_dxpl_id, ret) < 0) + if(H5D__get_storage_size(dset, dxpl_id, ret) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataset's storage") break; } @@ -1745,6 +1599,47 @@ done: /*------------------------------------------------------------------------- + * Function: H5VL_native_dataset_specific + * + * Purpose: Specific operations for datasets + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Mohamad Chaarawi + * August, 2014 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL_native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void UNUSED **req, va_list arguments) +{ + H5D_t *dset = (H5D_t *)obj; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + switch (specific_type) { + /* H5Dspecific_space */ + case H5VL_DATASET_SET_EXTENT: + { + const hsize_t *size = va_arg (arguments, const hsize_t *); + + if(H5D__set_extent(dset, size, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset") + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_native_dataset_specific() */ + + +/*------------------------------------------------------------------------- * Function: H5VL_native_dataset_close * * Purpose: Closes a dataset. @@ -1787,7 +1682,7 @@ done: */ static void * H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, - hid_t UNUSED dxpl_id, void UNUSED **req) + hid_t dxpl_id, void UNUSED **req) { H5F_t *new_file = NULL; void *ret_value = NULL; @@ -1804,7 +1699,7 @@ H5VL_native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t f flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; /* Create the file */ - if(NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id, H5AC_dxpl_id))) + if(NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file") new_file->id_exists = TRUE; @@ -1832,7 +1727,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t UNUSED dxpl_id, void UNUSED **req) +H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void UNUSED **req) { H5F_t *new_file = NULL; void *ret_value = NULL; @@ -1840,7 +1735,7 @@ H5VL_native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t UNU FUNC_ENTER_NOAPI_NOINIT /* Open the file */ - if(NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) + if(NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") new_file->id_exists = TRUE; @@ -1854,58 +1749,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_native_file_flush - * - * Purpose: Flushs a native HDF5 file. - * - * Return: Success: 0 - * Failure: -1, file not flushed. - * - * Programmer: Mohamad Chaarawi - * February, 2012 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5VL_native_file_flush(void *obj, H5VL_loc_params_t loc_params, H5F_scope_t scope, hid_t UNUSED dxpl_id, void UNUSED **req) -{ - H5F_t *f = NULL; /* File to flush */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - if(NULL == (f = H5VL_native_get_file(obj, loc_params.obj_type))) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - } - - /* Flush the file */ - /* - * Nothing to do if the file is read only. This determination is - * made at the shared open(2) flags level, implying that opening a - * file twice, once for read-only and once for read-write, and then - * calling H5Fflush() with the read-only handle, still causes data - * to be flushed. - */ - if(H5F_ACC_RDWR & H5F_INTENT(f)) { - /* Flush other files, depending on scope */ - if(H5F_SCOPE_GLOBAL == scope) { - /* Call the flush routine for mounted file hierarchies */ - if(H5F_flush_mounts(f, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") - } /* end if */ - else { - /* Call the flush routine, for this file */ - if(H5F_flush(f, H5AC_dxpl_id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") - } /* end else */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_flush() */ - - -/*------------------------------------------------------------------------- * Function: H5VL_native_file_get * * Purpose: Gets certain data about a file @@ -2056,7 +1899,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_native_file_misc + * Function: H5VL_native_file_specific * * Purpose: Perform an operation * @@ -2069,13 +1912,47 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_misc(void *obj, H5VL_file_misc_t misc_type, hid_t UNUSED dxpl_id, void UNUSED **req, va_list arguments) +H5VL_native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, + void UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - switch (misc_type) { + switch (specific_type) { + /* H5Fmount */ + case H5VL_FILE_FLUSH: + { + H5I_type_t type = va_arg (arguments, H5I_type_t); + H5F_scope_t scope = va_arg (arguments, H5F_scope_t); + H5F_t *f = NULL; /* File to flush */ + + 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 + * made at the shared open(2) flags level, implying that opening a + * file twice, once for read-only and once for read-write, and then + * calling H5Fflush() with the read-only handle, still causes data + * to be flushed. + */ + + if(H5F_ACC_RDWR & H5F_INTENT(f)) { + /* Flush other files, depending on scope */ + if(H5F_SCOPE_GLOBAL == scope) { + /* Call the flush routine for mounted file hierarchies */ + if(H5F_flush_mounts(f, dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") + } /* end if */ + else { + /* Call the flush routine, for this file */ + if(H5F_flush(f, dxpl_id, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") + } /* end else */ + } /* end if */ + break; + } /* H5Fmount */ case H5VL_FILE_MOUNT: { @@ -2089,7 +1966,7 @@ H5VL_native_file_misc(void *obj, H5VL_file_misc_t misc_type, hid_t UNUSED dxpl_i HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") } /* Do the mount */ - if(H5F_mount(&loc, name, child, plist_id, H5AC_dxpl_id) < 0) + if(H5F_mount(&loc, name, child, plist_id, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") break; @@ -2105,7 +1982,7 @@ H5VL_native_file_misc(void *obj, H5VL_file_misc_t misc_type, hid_t UNUSED dxpl_i HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") } /* Unmount */ - if(H5F_unmount(&loc, name, H5AC_dxpl_id) < 0) + if(H5F_unmount(&loc, name, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") break; @@ -2123,12 +2000,12 @@ H5VL_native_file_misc(void *obj, H5VL_file_misc_t misc_type, hid_t UNUSED dxpl_i break; } default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_file_misc() */ +} /* end H5VL_native_file_specific() */ /*------------------------------------------------------------------------- @@ -2145,10 +2022,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t UNUSED dxpl_id, - void UNUSED **req, va_list arguments) +H5VL_native_file_optional(void *obj, hid_t dxpl_id, void 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 @@ -2192,7 +2069,7 @@ H5VL_native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t U f = (H5F_t *)obj; /* Go get the actual amount of free space in the file */ - if(H5MF_get_freespace(f, H5AC_ind_dxpl_id, &tot_space, NULL) < 0) + if(H5MF_get_freespace(f, dxpl_id, &tot_space, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") *ret = (hssize_t)tot_space; break; @@ -2206,8 +2083,7 @@ H5VL_native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t U f = (H5F_t *)obj; /* Go get the free-space section information in the file */ - if((*ret = H5MF_get_free_sections(f, H5AC_ind_dxpl_id, - type, nsects, sect_info)) < 0) + if((*ret = H5MF_get_free_sections(f, dxpl_id, type, nsects, sect_info)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") break; } @@ -2231,18 +2107,18 @@ H5VL_native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t U HDmemset(finfo, 0, sizeof(*finfo)); /* Get the size of the superblock and any superblock extensions */ - if(H5F_super_size(f, H5AC_ind_dxpl_id, &finfo->super.super_size, + if(H5F_super_size(f, dxpl_id, &finfo->super.super_size, &finfo->super.super_ext_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock sizes") /* Get the size of any persistent free space */ - if(H5MF_get_freespace(f, H5AC_ind_dxpl_id, &finfo->free.tot_space, + if(H5MF_get_freespace(f, dxpl_id, &finfo->free.tot_space, &finfo->free.meta_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve free space information") /* Check for SOHM info */ if(H5F_addr_defined(f->shared->sohm_addr)) - if(H5SM_ih_size(f, H5AC_ind_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) + if(H5SM_ih_size(f, dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve SOHM index & heap storage info") /* Set version # fields */ @@ -2348,7 +2224,7 @@ H5VL_native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t U break; } default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") } done: @@ -2370,7 +2246,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_file_close(void *file, hid_t UNUSED dxpl_id, void UNUSED **req) +H5VL_native_file_close(void *file, hid_t dxpl_id, void UNUSED **req) { int nref; H5F_t *f = (H5F_t *)file; @@ -2393,7 +2269,7 @@ H5VL_native_file_close(void *file, hid_t UNUSED dxpl_id, void UNUSED **req) 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, H5AC_dxpl_id, FALSE) < 0) + if(H5F_flush(f, dxpl_id, FALSE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") } /* end if */ @@ -2421,7 +2297,7 @@ done: */ 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 UNUSED dxpl_id, void UNUSED **req) + hid_t gapl_id, hid_t dxpl_id, void UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ H5G_loc_t loc; /* Location to create group */ @@ -2451,13 +2327,13 @@ H5VL_native_group_create(void *obj, H5VL_loc_params_t loc_params, const char *na HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info, H5AC_dxpl_id))) + if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") } /* 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, gapl_id, H5AC_dxpl_id))) + if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") } ret_value = (void *)grp; @@ -2473,7 +2349,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTGET, NULL, "unable to get object location of group") /* Decrement refcount on group's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "unable to decrement refcount on newly created object") } /* end if */ } @@ -2495,7 +2371,8 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t UNUSED dxpl_id, void UNUSED **req) +H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t gapl_id, hid_t dxpl_id, void UNUSED **req) { H5G_loc_t loc; /* Location to open group */ H5G_t *grp = NULL; /* New group opend */ @@ -2507,7 +2384,7 @@ H5VL_native_group_open(void *obj, H5VL_loc_params_t loc_params, const char *name HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") /* Open the group */ - if((grp = H5G__open_name(&loc, name, gapl_id, H5AC_dxpl_id)) == NULL) + if((grp = H5G__open_name(&loc, name, gapl_id, dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group") ret_value = (void *)grp; @@ -2531,7 +2408,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t UNUSED dxpl_id, void UNUSED **req, va_list arguments) +H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2560,7 +2437,7 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t UNUSED dxpl_id if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Gget_info */ /* Retrieve the group's information */ - if(H5G__obj_info(loc.oloc, grp_info, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(loc.oloc, grp_info, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") } else if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Gget_info_by_name */ @@ -2575,11 +2452,11 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t UNUSED dxpl_id /* Find the group object */ if(H5G_loc_find(&loc, loc_params.loc_data.loc_by_name.name, &grp_loc/*out*/, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id) < 0) + loc_params.loc_data.loc_by_name.lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") /* Retrieve the group's information */ - if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) { + if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, dxpl_id) < 0) { H5G_loc_free(&grp_loc); HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") } @@ -2604,11 +2481,11 @@ H5VL_native_group_get(void *obj, H5VL_group_get_t get_type, hid_t UNUSED dxpl_id loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, &grp_loc/*out*/, loc_params.loc_data.loc_by_idx.lapl_id, - H5AC_ind_dxpl_id) < 0) + dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") /* Retrieve the group's information */ - if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) { + if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, dxpl_id) < 0) { H5G_loc_free(&grp_loc); HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") } @@ -2673,7 +2550,7 @@ 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 lapl_id, hid_t UNUSED dxpl_id, void UNUSED **req) + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void UNUSED **req) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2719,13 +2596,13 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc /* Create the link */ 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, lapl_id, H5AC_dxpl_id)) < 0) + lcpl_id, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") } else { /* H5Olink */ /* Link to the object */ if(H5L_link(&link_loc, loc_params.loc_data.loc_by_name.name, &cur_loc, lcpl_id, - lapl_id, H5AC_dxpl_id) < 0) + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") } break; @@ -2743,7 +2620,7 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc /* Create the link */ if((ret_value = H5L_create_soft(target_name, &link_loc, loc_params.loc_data.loc_by_name.name, - lcpl_id, lapl_id, H5AC_dxpl_id)) < 0) + lcpl_id, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") break; } @@ -2766,7 +2643,7 @@ H5VL_native_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc /* Create link */ if(H5L_create_ud(&link_loc, loc_params.loc_data.loc_by_name.name, udata, udata_size, - link_type, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + link_type, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") break; } @@ -2779,9 +2656,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_native_link_move + * Function: H5VL_native_link_copy * - * Purpose: Renames an object within an HDF5 file and moves it to a new + * 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 * and then inserted with the new name DST (which can specify a * new path for the object) as an atomic operation. The names @@ -2796,9 +2673,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, +H5VL_native_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, - hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, hid_t UNUSED dxpl_id, void UNUSED **req) + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void UNUSED **req) { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; @@ -2819,96 +2696,67 @@ H5VL_native_link_move(void *src_obj, H5VL_loc_params_t loc_params1, else if(NULL == dst_obj) dst_loc_p = src_loc_p; - /* Move/Copy the link */ + /* Copy the link */ if(H5L_move(src_loc_p, loc_params1.loc_data.loc_by_name.name, dst_loc_p, loc_params2.loc_data.loc_by_name.name, - copy_flag, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + TRUE, lcpl_id, lapl_id, dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_move() */ +} /* end H5VL_native_link_copy() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_link_iterate + * Function: H5VL_native_link_move * - * Purpose: Iterates through links in a group + * 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 + * and then inserted with the new name DST (which can specify a + * new path for the object) as an atomic operation. The names + * are interpreted relative to SRC_LOC_ID and + * DST_LOC_ID, which are either file IDs or group ID. * - * Return: Success: 0 - * Failure: -1 + * Return: Non-negative on success/Negative on failure * * Programmer: Mohamad Chaarawi - * May, 2012 + * April, 2012 * *------------------------------------------------------------------------- */ -static herr_t H5VL_native_link_iterate(void *obj, H5VL_loc_params_t loc_params, hbool_t recursive, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, - H5L_iterate_t op, void *op_data, hid_t UNUSED dxpl_id, void UNUSED **req) +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 UNUSED **req) { - H5G_loc_t loc; - herr_t ret_value; /* Return value */ + 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 - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + 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") + if(NULL != dst_obj && 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") - if(!recursive) { - H5G_link_iterate_t lnk_op; /* Link operator */ - hsize_t last_lnk; /* Index of last object looked at */ - hsize_t idx; /* Internal location to hold index */ - - /* Set up iteration beginning/end info */ - idx = (idx_p == NULL ? 0 : *idx_p); - last_lnk = 0; - - /* Build link operator info */ - lnk_op.op_type = H5G_LINK_OP_NEW; - lnk_op.op_func.op_new = op; - - /* Iterate over the links */ - if(loc_params.type == H5VL_OBJECT_BY_SELF) { - if((ret_value = H5G_iterate(&loc, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, - H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") - } - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { - if((ret_value = H5G_iterate(&loc, loc_params.loc_data.loc_by_name.name, - idx_type, order, idx, &last_lnk, &lnk_op, op_data, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") - } - else { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown link iterate params") - } + /* Set up src & dst location pointers */ + src_loc_p = &src_loc; + dst_loc_p = &dst_loc; + if(NULL == src_obj) + src_loc_p = dst_loc_p; + else if(NULL == dst_obj) + dst_loc_p = src_loc_p; - /* Set the index we stopped at */ - if(idx_p) - *idx_p = last_lnk; - } - else { - /* Call internal group visitation routine */ - if(loc_params.type == H5VL_OBJECT_BY_SELF) { - if((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data, - H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") - } - else if(loc_params.type == H5VL_OBJECT_BY_NAME) { - if((ret_value = H5G_visit(&loc, loc_params.loc_data.loc_by_name.name, - idx_type, order, op, op_data, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") - } - else { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown link visit params") - } - } + /* Move the link */ + if(H5L_move(src_loc_p, loc_params1.loc_data.loc_by_name.name, + dst_loc_p, loc_params2.loc_data.loc_by_name.name, + FALSE, lcpl_id, lapl_id, dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_iterate() */ +} /* end H5VL_native_link_move() */ /*------------------------------------------------------------------------- @@ -2926,7 +2774,7 @@ done: */ static herr_t H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, - hid_t UNUSED dxpl_id, void UNUSED **req, va_list arguments) + hid_t dxpl_id, void UNUSED **req, va_list arguments) { H5G_loc_t loc; herr_t ret_value = SUCCEED; /* Return value */ @@ -2937,17 +2785,6 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") switch (get_type) { - /* H5Lexists */ - case H5VL_LINK_EXISTS: - { - htri_t *ret = va_arg (arguments, htri_t *); - - /* Check for the existence of the link */ - if((*ret = H5L_exists(&loc, loc_params.loc_data.loc_by_name.name, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") - break; - } /* H5Lget_info/H5Lget_info_by_idx */ case H5VL_LINK_GET_INFO: { @@ -2956,7 +2793,7 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge /* Get the link information */ if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */ if(H5L_get_info(&loc, loc_params.loc_data.loc_by_name.name, linfo, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id) < 0) + loc_params.loc_data.loc_by_name.lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") } else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */ @@ -2966,10 +2803,10 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge udata.idx_type = loc_params.loc_data.loc_by_idx.idx_type; udata.order = loc_params.loc_data.loc_by_idx.order; udata.n = loc_params.loc_data.loc_by_idx.n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.linfo = linfo; if(H5L_get_info_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, &udata, - loc_params.loc_data.loc_by_idx.lapl_id, H5AC_ind_dxpl_id) < 0) + loc_params.loc_data.loc_by_idx.lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") } else @@ -2988,14 +2825,14 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge udata.idx_type = loc_params.loc_data.loc_by_idx.idx_type; udata.order = loc_params.loc_data.loc_by_idx.order; udata.n = loc_params.loc_data.loc_by_idx.n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.name = name; udata.size = size; udata.name_len = -1; /* Get the link name */ if(H5L_get_name_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, &udata, - loc_params.loc_data.loc_by_idx.lapl_id, H5AC_ind_dxpl_id) < 0) + loc_params.loc_data.loc_by_idx.lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") *ret = udata.name_len; @@ -3010,7 +2847,7 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge /* Get the link information */ if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Lget_val */ if(H5L_get_val(&loc, loc_params.loc_data.loc_by_name.name, buf, size, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id) < 0) + loc_params.loc_data.loc_by_name.lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link value") } else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Lget_val_by_idx */ @@ -3020,12 +2857,12 @@ H5VL_native_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t ge udata.idx_type = loc_params.loc_data.loc_by_idx.idx_type; udata.order = loc_params.loc_data.loc_by_idx.order; udata.n = loc_params.loc_data.loc_by_idx.n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.buf = buf; udata.size = size; if(H5L_get_val_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, &udata, - loc_params.loc_data.loc_by_idx.lapl_id, H5AC_ind_dxpl_id) < 0) + loc_params.loc_data.loc_by_idx.lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link val") } else @@ -3043,57 +2880,92 @@ done: /*------------------------------------------------------------------------- - * Function: H5VL_native_link_remove + * Function: H5VL_native_link_specific * - * Purpose: Removes the specified NAME from the group graph and - * decrements the link count for the object to which NAME - * points. If the link count reaches zero then all file-space - * associated with the object will be reclaimed (but if the - * object is open, then the reclamation of the file space is - * delayed until all handles to the object are closed). + * Purpose: Specific operations with links * - * Return: Non-negative on success/Negative on failure + * Return: Success: 0 + * Failure: -1 * * Programmer: Mohamad Chaarawi * April, 2012 * *------------------------------------------------------------------------- */ -static herr_t -H5VL_native_link_remove(void *obj, H5VL_loc_params_t loc_params, hid_t UNUSED dxpl_id, void UNUSED **req) +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 UNUSED **req, va_list arguments) { - H5G_loc_t loc; /* Object location */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + switch (specific_type) { + case H5VL_LINK_EXISTS: + { + htri_t *ret = va_arg (arguments, htri_t *); + H5G_loc_t loc; - /* Unlink */ - if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */ - if(H5L_delete(&loc, loc_params.loc_data.loc_by_name.name, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") - } - else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */ - H5L_trav_rmbi_t udata; /* User data for callback */ - - /* Set up user data for unlink operation */ - udata.idx_type = loc_params.loc_data.loc_by_idx.idx_type; - udata.order = loc_params.loc_data.loc_by_idx.order; - udata.n = loc_params.loc_data.loc_by_idx.n; - udata.dxpl_id = H5AC_dxpl_id; - - if(H5L_delete_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, &udata, - loc_params.loc_data.loc_by_idx.lapl_id, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Check for the existence of the link */ + if((*ret = H5L_exists(&loc, loc_params.loc_data.loc_by_name.name, + loc_params.loc_data.loc_by_name.lapl_id, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to specific link info") + break; + } + case H5VL_LINK_ITER: + { + hbool_t recursive = va_arg (arguments, hbool_t); + H5_index_t idx_type = va_arg (arguments, H5_index_t); + H5_iter_order_t order = va_arg (arguments, H5_iter_order_t); + hsize_t *idx_p = va_arg (arguments, hsize_t *); + H5L_iterate_t op = va_arg (arguments, H5L_iterate_t); + void *op_data = va_arg (arguments, void *); + + if((ret_value = H5L_iterate(obj, loc_params, recursive, idx_type, order, + idx_p, op, op_data, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "error iterating over links") + break; + } + case H5VL_LINK_DELETE: + { + H5G_loc_t loc; + + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + + /* Unlink */ + if(loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */ + if(H5L_delete(&loc, loc_params.loc_data.loc_by_name.name, + loc_params.loc_data.loc_by_name.lapl_id, dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + } + else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */ + H5L_trav_rmbi_t udata; /* User data for callback */ + + /* Set up user data for unlink operation */ + udata.idx_type = loc_params.loc_data.loc_by_idx.idx_type; + udata.order = loc_params.loc_data.loc_by_idx.order; + udata.n = loc_params.loc_data.loc_by_idx.n; + udata.dxpl_id = dxpl_id; + + if(H5L_delete_by_idx(&loc, loc_params.loc_data.loc_by_idx.name, &udata, + loc_params.loc_data.loc_by_idx.lapl_id, dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + } + else + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + break; + } + default: + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") } - else - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_link_remove() */ +} /* end H5VL_native_link_specific() */ /*------------------------------------------------------------------------- @@ -3111,7 +2983,7 @@ done: */ static void * H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, - hid_t UNUSED dxpl_id, void UNUSED **req) + hid_t dxpl_id, void UNUSED **req) { H5G_loc_t loc; H5G_loc_t obj_loc; /* Location used to open group */ @@ -3147,13 +3019,13 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope 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, &obj_loc/*out*/, loc_params.loc_data.loc_by_idx.lapl_id, - H5AC_dxpl_id) < 0) + dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "group not found") loc_found = TRUE; /* Open the object */ if((temp_id = H5O_open_by_loc(&obj_loc, loc_params.loc_data.loc_by_idx.lapl_id, - H5AC_dxpl_id, TRUE)) < 0) + dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object") break; } @@ -3172,7 +3044,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope /* Open the object */ if((temp_id = H5O_open_by_loc(&obj_loc, H5P_LINK_ACCESS_DEFAULT, - H5AC_dxpl_id, TRUE)) < 0) + dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object") break; } @@ -3185,7 +3057,7 @@ H5VL_native_object_open(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *ope /* Create reference */ if((temp_id = H5R_dereference(file, loc_params.loc_data.loc_by_ref.lapl_id, - H5AC_dxpl_id, + dxpl_id, loc_params.loc_data.loc_by_ref.ref_type, loc_params.loc_data.loc_by_ref._ref, TRUE)) < 0) @@ -3247,58 +3119,11 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_native_object_copy() */ - - /*------------------------------------------------------------------------- - * Function: H5VL_native_object_visit - * - * Purpose: Iterates through all objects linked to an object - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Mohamad Chaarawi - * May, 2012 - * - *------------------------------------------------------------------------- - */ -static herr_t H5VL_native_object_visit(void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type, - H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t UNUSED dxpl_id, void UNUSED **req) -{ - H5G_loc_t loc; - herr_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - - /* Call internal object visitation routine */ - if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Ovisit */ - if((ret_value = H5O_visit(&loc, ".", idx_type, order, op, op_data, - H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "object visitation failed") - } - 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, loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "object visitation failed") - } - else { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params") - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_visit() */ - -#if 0 - -/*------------------------------------------------------------------------- - * Function: H5VL_native_object_lookup + * Function: H5VL_native_object_get * - * Purpose: Lookup the object location in the file + * Purpose: Gets certain data about a file * * Return: Success: 0 * Failure: -1 @@ -3309,172 +3134,72 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_lookup(hid_t loc_id, H5VL_loc_type_t lookup_type, void **loc_token, - hid_t UNUSED dxpl_id, void 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 dxpl_id, void UNUSED **req, va_list arguments) { - H5G_loc_t loc; - H5G_loc_t *obj_loc; - H5G_loc_t **location = (H5G_loc_t **)loc_token; - haddr_t obj_addr; herr_t ret_value = SUCCEED; /* Return value */ + H5G_loc_t loc; /* Location of group */ FUNC_ENTER_NOAPI_NOINIT - *location = (H5G_loc_t *) H5MM_malloc (sizeof (H5G_loc_t)); - - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") - - obj_loc = *location; - obj_loc->oloc = (H5O_loc_t *) H5MM_malloc (sizeof (H5O_loc_t)); - obj_loc->path = (H5G_name_t *) H5MM_malloc (sizeof (H5G_name_t)); - H5G_loc_reset(obj_loc); + if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - switch (lookup_type) { - case H5VL_OBJECT_BY_SELF: - obj_loc->oloc->addr = loc.oloc->addr; - obj_loc->oloc->file = loc.oloc->file; - obj_loc->oloc->holding_file = loc.oloc->holding_file; - obj_loc->path = loc.path; - break; - case H5VL_OBJECT_BY_NAME: + switch (get_type) { + /* H5Rget_region */ + case H5VL_REF_GET_REGION: { - char *name = va_arg (arguments, char *); - hid_t lapl_id = va_arg (arguments, hid_t); + hid_t *ret = va_arg (arguments, hid_t *); + H5R_type_t UNUSED ref_type = va_arg (arguments, H5R_type_t); + void *ref = va_arg (arguments, void *); + H5S_t *space = NULL; /* Dataspace object */ - HDassert(name && *name); + /* Get the dataspace with the correct region selected */ + if((space = H5R_get_region(loc.oloc->file, dxpl_id, ref)) == NULL) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create dataspace") - /* Find the object's location */ - if((ret_value = H5G_loc_find(&loc, name, obj_loc, lapl_id, H5AC_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") - break; - } - case H5VL_OBJECT_BY_IDX: - { - char *group_name = va_arg (arguments, char *); - H5_index_t idx_type = va_arg (arguments, H5_index_t); - H5_iter_order_t order = va_arg (arguments, H5_iter_order_t); - hsize_t n = va_arg (arguments, hsize_t); - hid_t lapl_id = va_arg (arguments, hid_t); + /* Atomize */ + if((*ret = H5I_register (H5I_DATASPACE, space, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") - /* Find the object's location, according to the order in the index */ - if((ret_value = H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, - obj_loc/*out*/, lapl_id, H5AC_dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") break; } - case H5VL_OBJECT_BY_ADDR: + /* H5Rget_obj_type2 */ + case H5VL_REF_GET_TYPE: { - obj_addr = va_arg (arguments, haddr_t); - obj_loc->oloc->addr = obj_addr; - obj_loc->oloc->file = loc.oloc->file; - obj_loc->oloc->holding_file = loc.oloc->holding_file; + H5O_type_t *obj_type = va_arg (arguments, H5O_type_t *); + H5R_type_t ref_type = va_arg (arguments, H5R_type_t); + void *ref = va_arg (arguments, void *); + + /* Get the object information */ + if(H5R_get_obj_type(loc.oloc->file, dxpl_id, ref_type, ref, obj_type) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object type") break; } - case H5VL_OBJECT_BY_REF: + /* H5Rget_name */ + case H5VL_REF_GET_NAME: { - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - void *_ref = va_arg (arguments, void *); - H5F_t *file = NULL; /* File object */ - - /* Get the file pointer from the entry */ - file = loc.oloc->file; + ssize_t *ret = va_arg (arguments, ssize_t *); + char *name = va_arg (arguments, char *); + size_t size = va_arg (arguments, size_t); + H5R_type_t ref_type = va_arg (arguments, H5R_type_t); + void *ref = va_arg (arguments, void *); - HDassert(_ref); - HDassert(ref_type > H5R_BADTYPE || ref_type < H5R_MAXTYPE); - HDassert(file); - - switch(ref_type) { - case H5R_OBJECT: - obj_loc->oloc->addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */ - obj_loc->oloc->file = loc.oloc->file; - obj_loc->oloc->holding_file = loc.oloc->holding_file; - break; - - case H5R_DATASET_REGION: - { - H5HG_t hobjid; /* Heap object ID */ - uint8_t *buf; /* Buffer to store serialized selection in */ - const uint8_t *p; /* Pointer to OID to store */ - - /* Get the heap ID for the dataset region */ - p = (const uint8_t *)_ref; - H5F_addr_decode(file, &p, &(hobjid.addr)); - INT32DECODE(p, hobjid.idx); - - /* Get the dataset region from the heap (allocate inside routine) */ - if(NULL == (buf = (uint8_t *)H5HG_read(file, H5AC_dxpl_id, - &hobjid, NULL, NULL))) - HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") - - /* Get the object oid for the dataset */ - p = buf; - //H5F_addr_decode(file, &p, &(obj_addr)); - H5F_addr_decode(file, &p, &(obj_loc->oloc->addr)); - obj_loc->oloc->file = file; - /* Free the buffer allocated in H5HG_read() */ - H5MM_xfree(buf); - } /* end case */ - break; - - case H5R_BADTYPE: - case H5R_MAXTYPE: - default: - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") - } /* end switch */ + /* Get name */ + if((*ret = H5R_get_name(&loc, H5P_DEFAULT, dxpl_id, ref_type, ref, name, size)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object path") break; } default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't lookup this object") - } /* end switch */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_lookup() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_native_object_free_loc - * - * Purpose: Free the location token - * - * Return: Success: non negative - * Failure: negative - * - * Programmer: Mohamad Chaarawi - * May, 2012 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5VL_native_object_free_loc(void *location, hid_t UNUSED dxpl_id, void UNUSED **req) -{ - H5G_loc_t *obj_loc = (H5G_loc_t *)location; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - if(H5G_loc_free(obj_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - - if(NULL != obj_loc->oloc) { - H5MM_free(obj_loc->oloc); - } - if(NULL != obj_loc->path) { - H5MM_free(obj_loc->path); - } - if(NULL != obj_loc) { - H5MM_free(obj_loc); + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") } - done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_free_loc() */ -#endif +} /* end H5VL_native_object_get() */ /*------------------------------------------------------------------------- - * Function: H5VL_native_object_misc + * Function: H5VL_native_object_specific * * Purpose: Perform a plugin specific operation for an objectibute * @@ -3487,8 +3212,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_misc(void *obj, H5VL_loc_params_t loc_params, H5VL_object_misc_t misc_type, - hid_t UNUSED dxpl_id, void 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 dxpl_id, void UNUSED **req, va_list arguments) { H5G_loc_t loc; herr_t ret_value = SUCCEED; /* Return value */ @@ -3498,66 +3223,57 @@ H5VL_native_object_misc(void *obj, H5VL_loc_params_t loc_params, H5VL_object_mis if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - switch (misc_type) { - /* H5Arename/rename_by_name */ - case H5VL_ATTR_RENAME: - { - const char *old_name = va_arg (arguments, const char *); - const char *new_name = va_arg (arguments, const char *); - - if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Arename */ - /* Call attribute rename routine */ - if(H5O_attr_rename(loc.oloc, H5AC_dxpl_id, old_name, new_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } - 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, loc_params.loc_data.loc_by_name.lapl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") - } - else { - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters") - } - break; - } + switch (specific_type) { /* H5Oincr_refcount / H5Odecr_refcount */ case H5VL_OBJECT_CHANGE_REF_COUNT: { int update_ref = va_arg (arguments, int); H5O_loc_t *oloc = loc.oloc; - /* Get the object's oloc so we can adjust its link count - if((oloc = H5O_get_loc(loc_id)) == NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADVALUE, FAIL, "unable to get object location from ID") - */ - - if(H5O_link(oloc, update_ref, H5AC_dxpl_id) < 0) + if(H5O_link(oloc, update_ref, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") break; } - /* H5Oset_comment */ - case H5VL_OBJECT_SET_COMMENT: + /* H5Oexists_by_name */ + case H5VL_OBJECT_EXISTS: { - const char *comment = va_arg (arguments, char *); + htri_t *ret = va_arg (arguments, htri_t *); - if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oset_comment */ - /* (Re)set the object's comment */ - if(H5G_loc_set_comment(&loc, ".", comment, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") - } - 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, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + 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, + loc_params.loc_data.loc_by_name.lapl_id, dxpl_id)) < 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_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") + 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); + H5_iter_order_t order = va_arg (arguments, H5_iter_order_t); + H5O_iterate_t op = va_arg (arguments, H5O_iterate_t); + void *op_data = va_arg (arguments, void *); + + /* Call internal object visitation routine */ + if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Ovisit */ + if((ret_value = H5O_visit(&loc, ".", idx_type, order, op, op_data, + H5P_LINK_ACCESS_DEFAULT, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "object visitation failed") + } + 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, loc_params.loc_data.loc_by_name.lapl_id, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "object visitation failed") + } + else + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params"); + break; + } case H5VL_REF_CREATE: { void *ref = va_arg (arguments, void *); @@ -3570,7 +3286,7 @@ H5VL_native_object_misc(void *obj, H5VL_loc_params_t loc_params, H5VL_object_mis HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") /* Create reference */ - if((ret_value = H5R_create(ref, &loc, name, ref_type, space, H5AC_dxpl_id)) < 0) + if(H5R_create(ref, &loc, name, ref_type, space, dxpl_id) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to create reference") break; @@ -3581,7 +3297,7 @@ H5VL_native_object_misc(void *obj, H5VL_loc_params_t loc_params, H5VL_object_mis done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_misc() */ +} /* end H5VL_native_object_specific() */ /*------------------------------------------------------------------------- @@ -3598,67 +3314,19 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL_native_object_optional(void UNUSED *obj, H5VL_loc_params_t UNUSED loc_params, - H5VL_object_optional_t optional_type, hid_t UNUSED dxpl_id, void UNUSED **req, va_list UNUSED arguments) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - switch (optional_type) { - case H5VL_OPTIONAL: - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object"); - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_optional() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_native_object_get - * - * Purpose: Gets certain data about a file - * - * Return: Success: 0 - * Failure: -1 - * - * Programmer: Mohamad Chaarawi - * March, 2012 - * - *------------------------------------------------------------------------- - */ -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 UNUSED **req, va_list arguments) +H5VL_native_object_optional(void *obj, hid_t dxpl_id, void UNUSED **req, va_list arguments) { - herr_t ret_value = SUCCEED; /* Return value */ + 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 if(H5G_loc_real(obj, loc_params.obj_type, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") - switch (get_type) { - /* H5Oexists_by_name */ - case H5VL_OBJECT_EXISTS: - { - htri_t *ret = va_arg (arguments, htri_t *); - - 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, - loc_params.loc_data.loc_by_name.lapl_id, dxpl_id)) < 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_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters") - } - break; - } + switch (optional_type) { /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */ case H5VL_OBJECT_GET_INFO: { @@ -3667,13 +3335,13 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */ /* Retrieve the object's information */ if(H5G_loc_info(&loc, ".", TRUE, obj_info, H5P_LINK_ACCESS_DEFAULT, - H5AC_ind_dxpl_id) < 0) + dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") } 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, TRUE, obj_info, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id) < 0) + loc_params.loc_data.loc_by_name.lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") } else if(loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ @@ -3692,11 +3360,11 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ loc_params.loc_data.loc_by_idx.order, loc_params.loc_data.loc_by_idx.n, &obj_loc/*out*/, loc_params.loc_data.loc_by_idx.lapl_id, - H5AC_ind_dxpl_id) < 0) + dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") /* Retrieve the object's information */ - if(H5O_get_info(obj_loc.oloc, H5AC_ind_dxpl_id, TRUE, obj_info) < 0) { + if(H5O_get_info(obj_loc.oloc, dxpl_id, TRUE, obj_info) < 0) { H5G_loc_free(&obj_loc); HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve object info") } @@ -3720,12 +3388,12 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ /* Retrieve the object's comment */ if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */ if((*ret = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize, - H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) + H5P_LINK_ACCESS_DEFAULT, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") } 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, - loc_params.loc_data.loc_by_name.lapl_id, H5AC_ind_dxpl_id)) < 0) + loc_params.loc_data.loc_by_name.lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") } else { @@ -3733,103 +3401,31 @@ H5VL_native_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_ } break; } - /* H5Rget_region */ - case H5VL_REF_GET_REGION: - { - hid_t *ret = va_arg (arguments, hid_t *); - H5R_type_t UNUSED ref_type = va_arg (arguments, H5R_type_t); - void *ref = va_arg (arguments, void *); - H5S_t *space = NULL; /* Dataspace object */ - - /* Get the dataspace with the correct region selected */ - if((space = H5R_get_region(loc.oloc->file, H5AC_ind_dxpl_id, ref)) == NULL) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create dataspace") - - /* Atomize */ - if((*ret = H5I_register (H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") - - break; - } - /* H5Rget_obj_type2 */ - case H5VL_REF_GET_TYPE: - { - H5O_type_t *obj_type = va_arg (arguments, H5O_type_t *); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - void *ref = va_arg (arguments, void *); - - /* Get the object information */ - if(H5R_get_obj_type(loc.oloc->file, H5AC_ind_dxpl_id, ref_type, ref, obj_type) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object type") - break; - } - /* H5Rget_name */ - case H5VL_REF_GET_NAME: + /* H5Oset_comment */ + case H5VL_OBJECT_SET_COMMENT: { - ssize_t *ret = va_arg (arguments, ssize_t *); - char *name = va_arg (arguments, char *); - size_t size = va_arg (arguments, size_t); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - void *ref = va_arg (arguments, void *); + const char *comment = va_arg (arguments, char *); - /* Get name */ - if((*ret = H5R_get_name(&loc, H5P_DEFAULT, H5AC_dxpl_id, ref_type, ref, name, size)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object path") + if(loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Oset_comment */ + /* (Re)set the object's comment */ + if(H5G_loc_set_comment(&loc, ".", comment, H5P_LINK_ACCESS_DEFAULT, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + } + 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, + loc_params.loc_data.loc_by_name.lapl_id, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + } + else { + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") + } break; } default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object"); } -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5VL_native_object_close - * - * Purpose: Closes a object. - * - * Return: Success: 0 - * Failure: -1, object not closed. - * - * Programmer: Mohamad Chaarawi - * March, 2012 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5VL_native_object_close(void UNUSED *obj, H5VL_loc_params_t loc_params, hid_t UNUSED dxpl_id, void UNUSED **req) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - /* Get the type of the object and close it in the correct way */ - switch(loc_params.obj_type) { - case H5I_GROUP: - case H5I_DATATYPE: - case H5I_DATASET: - break; - case H5I_UNINIT: - case H5I_BADID: - case H5I_FILE: - case H5I_DATASPACE: - case H5I_ATTR: - 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_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)") - break; - } /* end switch */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5VL_native_object_close() */ +} /* end H5VL_native_object_optional() */ diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 73916df..005e362 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -52,65 +52,63 @@ H5_DLL ssize_t H5VL_get_plugin_name(hid_t id, char *name/*out*/, size_t size); H5_DLL void *H5VL_get_object(hid_t id); H5_DLL herr_t H5VL_close(H5VL_class_t *vol_plugin); -H5_DLL void *H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, hid_t estack_id); -H5_DLL void *H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t aapl_id, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_attr_read(void *attr, H5VL_t *vol_plugin, hid_t dtype_id, void *buf, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_attr_write(void *attr, H5VL_t *vol_plugin, hid_t dtype_id, const void *buf, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_attr_iterate(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *n, - H5A_operator2_t op, void *op_data, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_attr_get(void *attr, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, hid_t dxpl_id, hid_t estack_id, ...); -H5_DLL herr_t H5VL_attr_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *attr_name, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_attr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t estack_id); - -H5_DLL void *H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, hid_t estack_id); -H5_DLL void *H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t dapl_id, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_dataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, hid_t estack_id); -H5_DLL herr_t H5VL_dataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, hid_t estack_id); -H5_DLL herr_t H5VL_dataset_set_extent(void *dset, H5VL_t *vol_plugin, const hsize_t size[], hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_dataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, hid_t dxpl_id, hid_t estack_id, ...); -H5_DLL herr_t H5VL_dataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t estack_id); - -H5_DLL void *H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, hid_t estack_id); -H5_DLL void *H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t tapl_id, hid_t dxpl_id, hid_t estack_id); -H5_DLL ssize_t H5VL_datatype_get_binary(void *obj, H5VL_t *vol_plugin, void *buf, size_t size, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_datatype_get(void *dt, H5VL_t *vol_plugin, H5VL_datatype_get_t get_type, hid_t dxpl_id, hid_t estack_id, ...); -H5_DLL herr_t H5VL_datatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t estack_id); - -H5_DLL void *H5VL_file_create(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, hid_t estack_id); -H5_DLL void *H5VL_file_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_file_flush(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5F_scope_t scope, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_file_misc(void *file, H5VL_t *vol_plugin, H5VL_file_misc_t misc_type, hid_t dxpl_id, hid_t estack_id, ...); -H5_DLL herr_t H5VL_file_optional(void *file, H5VL_t *vol_plugin, H5VL_file_optional_t optional_type, hid_t dxpl_id, hid_t estack_id, ...); -H5_DLL herr_t H5VL_file_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, hid_t dxpl_id, hid_t estack_id, ...); -H5_DLL herr_t H5VL_file_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t estack_id); - -H5_DLL void *H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, hid_t estack_id); -H5_DLL void *H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t gapl_id, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_group_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_group_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, hid_t dxpl_id, hid_t estack_id, ...); - -H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, hid_t estack_id); +H5_DLL void *H5VL_attr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_attr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_read(void *attr, H5VL_t *vol_plugin, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_write(void *attr, H5VL_t *vol_plugin, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_attr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_attr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); + +H5_DLL void *H5VL_dataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_dataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_dataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); +H5_DLL herr_t H5VL_dataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +H5_DLL herr_t H5VL_dataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_specific(void *obj, H5VL_t *vol_plugin, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_dataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); + +H5_DLL void *H5VL_datatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_datatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_datatype_get(void *dt, H5VL_t *vol_plugin, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_specific(void *obj, H5VL_t *vol_plugin, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_datatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); + +H5_DLL void *H5VL_file_create(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_file_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_file_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_specific(void *obj, H5VL_t *vol_plugin, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_file_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); + +H5_DLL void *H5VL_group_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL void *H5VL_group_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_group_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_specific(void *obj, H5VL_t *vol_plugin, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_group_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); + +H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_copy(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_link_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, - hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_link_iterate(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - hbool_t recursive, H5_index_t idx_type, H5_iter_order_t order, - hsize_t *idx, H5L_iterate_t op, void *op_data, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_get_t get_type, hid_t dxpl_id, hid_t estack_id, ...); -H5_DLL herr_t H5VL_link_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t estack_id); - -H5_DLL void *H5VL_object_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5I_type_t *opened_type, hid_t dxpl_id, hid_t estack_id); + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_link_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_link_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); + +H5_DLL void *H5VL_object_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5I_type_t *opened_type, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_object_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_object_visit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_get_t get_type, hid_t dxpl_id, hid_t estack_id, ...); -H5_DLL herr_t H5VL_object_misc(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_misc_t misc_type, hid_t dxpl_id, hid_t estack_id, ...); -H5_DLL herr_t H5VL_object_optional(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_misc_t optional_type, hid_t dxpl_id, hid_t estack_id, ...); -//H5_DLL herr_t H5VL_object_lookup(hid_t uid, H5VL_loc_type_t lookup_type, void **location, hid_t dxpl_id, hid_t estack_id, ...); -//H5_DLL herr_t H5VL_object_free_loc(hid_t loc_id, void *location, hid_t dxpl_id, hid_t estack_id); -H5_DLL herr_t H5VL_object_close(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t dxpl_id, hid_t estack_id); + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VL_object_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...); +H5_DLL herr_t H5VL_object_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, ...); H5_DLL herr_t H5VL_request_cancel(void **req, H5VL_t *vol_plugin, H5ES_status_t *status); H5_DLL herr_t H5VL_request_test(void **req, H5VL_t *vol_plugin, H5ES_status_t *status); @@ -127,5 +125,5 @@ H5_DLL herr_t H5G_close_group(void *grp, H5VL_t *vol_plugin); H5_DLL herr_t H5T_close_datatype(void *dt, H5VL_t *vol_plugin); 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); #endif /* _H5VLprivate_H */ diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h index a18e2c2..73c5b6a 100644 --- a/src/H5VLpublic.h +++ b/src/H5VLpublic.h @@ -51,29 +51,52 @@ /* Group creation property names */ #define H5VL_PROP_GRP_LCPL_ID "group_lcpl_id" -/* types for all attr get API routines */ +/* types for attribute GET callback */ typedef enum H5VL_attr_get_t { - H5VL_ATTR_EXISTS, /* H5Aexists */ - H5VL_ATTR_GET_SPACE, /* dataspace */ - H5VL_ATTR_GET_TYPE, /* datatype */ H5VL_ATTR_GET_ACPL, /* creation property list */ + H5VL_ATTR_GET_INFO, /* info */ H5VL_ATTR_GET_NAME, /* access property list */ + H5VL_ATTR_GET_SPACE, /* dataspace */ H5VL_ATTR_GET_STORAGE_SIZE, /* storage size */ - H5VL_ATTR_GET_INFO /* attribute info */ + H5VL_ATTR_GET_TYPE /* datatype */ } H5VL_attr_get_t; -/* types for all dataset get API routines */ +/* types for attribute SPECFIC callback */ +typedef enum H5VL_attr_specific_t { + H5VL_ATTR_DELETE, /* H5Adelete(_by_name/idx) */ + H5VL_ATTR_EXISTS, /* H5Aexists(_by_name) */ + H5VL_ATTR_ITER, /* H5Aiterate(_by_name) */ + H5VL_ATTR_RENAME /* H5Arename(_by_name) */ +} H5VL_attr_specific_t; + +/* types for dataset GET callback */ typedef enum H5VL_dataset_get_t { + H5VL_DATASET_GET_DAPL, /* access property list */ + H5VL_DATASET_GET_DCPL, /* creation property list */ + H5VL_DATASET_GET_OFFSET, /* offset */ H5VL_DATASET_GET_SPACE, /* dataspace */ H5VL_DATASET_GET_SPACE_STATUS, /* space status */ - H5VL_DATASET_GET_TYPE, /* datatype */ - H5VL_DATASET_GET_DCPL, /* creation property list */ - H5VL_DATASET_GET_DAPL, /* access property list */ H5VL_DATASET_GET_STORAGE_SIZE, /* storage size */ - H5VL_DATASET_GET_OFFSET /* offset */ + H5VL_DATASET_GET_TYPE /* datatype */ } H5VL_dataset_get_t; -/* types for all file get API routines */ +/* types for dataset SPECFIC callback */ +typedef enum H5VL_dataset_specific_t { + H5VL_DATASET_SET_EXTENT /* H5Dset_extent */ +} H5VL_dataset_specific_t; + +/* types for datatype GET callback */ +typedef enum H5VL_datatype_get_t { + H5VL_DATATYPE_GET_BINARY, /* get serialized form of transient type */ + H5VL_DATATYPE_GET_TCPL /* datatype creation property list */ +} H5VL_datatype_get_t; + +/* types for datatype SPECFIC callback */ +typedef enum H5VL_datatype_specific_t { + H5VL_DATATYPE_SPECIFIC_INVALID +} H5VL_datatype_specific_t; + +/* types for file GET callback */ typedef enum H5VL_file_get_t { H5VL_FILE_GET_FAPL, /* file access property list */ H5VL_FILE_GET_FCPL, /* file creation property list */ @@ -84,40 +107,24 @@ typedef enum H5VL_file_get_t { H5VL_OBJECT_GET_FILE /* retrieve or resurrect file of object */ } H5VL_file_get_t; -/* types for all file misc operations */ -typedef enum H5VL_file_misc_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_MOUNT, /* Mount a file */ - H5VL_FILE_UNMOUNT, /* Un-Mount a file */ - H5VL_FILE_IS_ACCESSIBLE /* Check if a file is accessible */ -} H5VL_file_misc_t; - -/* types for all file optional operations */ -typedef enum H5VL_file_optional_t { - H5VL_FILE_CLEAR_ELINK_CACHE, /* Clear external link cache */ - H5VL_FILE_GET_FILE_IMAGE, /* file image */ - 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_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_RESET_MDC_HIT_RATE, /* get metadata cache hit rate */ - H5VL_FILE_SET_MDC_CONFIG /* set metadata cache configuration */ -} H5VL_file_optional_t; - -/* types for all group get API routines */ + H5VL_FILE_UNMOUNT /* Un-Mount a file */ +} H5VL_file_specific_t; + +/* types for group GET callback */ typedef enum H5VL_group_get_t { - H5VL_GROUP_GET_GCPL, /* group creation property list */ - H5VL_GROUP_GET_INFO /* group info */ + H5VL_GROUP_GET_GCPL, /* group creation property list */ + H5VL_GROUP_GET_INFO /* group info */ } H5VL_group_get_t; -/* types for all datatype get API routines */ -typedef enum H5VL_datatype_get_t { - H5VL_DATATYPE_GET_TCPL /* datatype creation property list */ -} H5VL_datatype_get_t; +/* types for group SPECFIC callback */ +typedef enum H5VL_group_specific_t { + H5VL_GROUP_SPECIFIC_INVALID +} H5VL_group_specific_t; /* link create types for VOL */ typedef enum H5VL_link_create_type_t { @@ -126,37 +133,35 @@ typedef enum H5VL_link_create_type_t { H5VL_LINK_CREATE_UD } H5VL_link_create_type_t; -/* types for all link get API routines */ +/* types for link GET callback */ typedef enum H5VL_link_get_t { - H5VL_LINK_EXISTS, /* link existence */ H5VL_LINK_GET_INFO, /* link info */ H5VL_LINK_GET_NAME, /* link name */ H5VL_LINK_GET_VAL /* link value */ } H5VL_link_get_t; -/* types for all object general operations */ -typedef enum H5VL_object_misc_t { - H5VL_ATTR_RENAME, /* H5Arename */ - H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */ - H5VL_OBJECT_SET_COMMENT, /* H5Oset_comment(_by_name) */ - H5VL_REF_CREATE /* H5Rcreate */ -} H5VL_object_misc_t; - -/* types for all object general operations */ -typedef enum H5VL_object_optional_t { - H5VL_OPTIONAL -} H5VL_object_optional_t; +/* types for link SPECIFIC callback */ +typedef enum H5VL_link_specific_t { + H5VL_LINK_DELETE, /* H5Ldelete(_by_idx) */ + H5VL_LINK_EXISTS, /* link existence */ + H5VL_LINK_ITER /* H5Literate/visit(_by_name) */ +} H5VL_link_specific_t; -/* types for all object get API routines */ +/* types for object GET callback */ typedef enum H5VL_object_get_t { - H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */ - H5VL_OBJECT_GET_INFO, /* object info */ - H5VL_OBJECT_GET_COMMENT, /* object comment */ + H5VL_REF_GET_NAME, /* object name */ H5VL_REF_GET_REGION, /* dataspace of region */ - H5VL_REF_GET_TYPE, /* type of object */ - H5VL_REF_GET_NAME /* object name */ + H5VL_REF_GET_TYPE /* type of object */ } H5VL_object_get_t; +/* types for object SPECIFIC callback */ +typedef enum H5VL_object_specific_t { + H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */ + H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */ + H5VL_OBJECT_VISIT, /* H5Ovisit(_by_name) */ + H5VL_REF_CREATE /* H5Rcreate */ +} H5VL_object_specific_t; + /* types for different ways that objects are located in an HDF5 container */ typedef enum H5VL_loc_type_t { H5VL_OBJECT_BY_SELF, @@ -199,65 +204,78 @@ typedef struct H5VL_loc_params_t { struct H5VL_loc_by_idx loc_by_idx; struct H5VL_loc_by_addr loc_by_addr; struct H5VL_loc_by_ref loc_by_ref; - }loc_data; + } loc_data; } H5VL_loc_params_t; #define H5VL_VOL_DEFAULT 0 /* Default VOL plugin value */ /* H5A routines */ typedef struct H5VL_attr_class_t { - void *(*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); - void *(*open) (void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t aapl_id, hid_t dxpl_id, void **req); - herr_t (*read) (void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req); - herr_t (*write) (void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); - herr_t (*iterate) (void *obj, H5VL_loc_params_t loc_params, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *n, - H5A_operator2_t op, void *op_data, hid_t dxpl_id, void **req); - herr_t (*get) (void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*remove)(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, hid_t dxpl_id, void **req); + void *(*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); + void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char *attr_name, + hid_t aapl_id, hid_t dxpl_id, void **req); + herr_t (*read)(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req); + herr_t (*write)(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_loc_params_t loc_params, H5VL_attr_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); herr_t (*close) (void *attr, hid_t dxpl_id, void **req); } H5VL_attr_class_t; +/* H5D routines */ +typedef struct H5VL_dataset_class_t { + void *(*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); + void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t dapl_id, hid_t dxpl_id, void **req); + herr_t (*read)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, + hid_t xfer_plist_id, void * buf, void **req); + herr_t (*write)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, + hid_t xfer_plist_id, const void * buf, void **req); + herr_t (*get)(void *obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*close) (void *dset, hid_t dxpl_id, void **req); +} H5VL_dataset_class_t; + /* H5T routines*/ typedef struct H5VL_datatype_class_t { - void *(*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); - void *(*open) (void *obj, H5VL_loc_params_t loc_params, const char * name, hid_t tapl_id, hid_t dxpl_id, void **req); - ssize_t (*get_binary) (void *obj, void *buf, size_t size, hid_t dxpl_id, void **req); + void *(*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); + void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char * name, + hid_t tapl_id, hid_t dxpl_id, void **req); herr_t (*get) (void *obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); herr_t (*close) (void *dt, hid_t dxpl_id, void **req); } H5VL_datatype_class_t; -/* H5D routines */ -typedef struct H5VL_dataset_class_t { - void *(*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); - void *(*open) (void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); - herr_t (*read) (void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t xfer_plist_id, void * buf, void **req); - herr_t (*write) (void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t xfer_plist_id, const void * buf, void **req); - herr_t (*set_extent) (void *dset, const hsize_t size[], hid_t dxpl_id, void **req); - herr_t (*get) (void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*close) (void *dset, hid_t dxpl_id, void **req); -} H5VL_dataset_class_t; - /* H5F routines */ typedef struct H5VL_file_class_t { - void *(*create)(const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id, void **req); - void *(*open) (const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); - herr_t (*flush) (void *obj, H5VL_loc_params_t loc_params, H5F_scope_t scope, hid_t dxpl_id, void **req); - herr_t (*get) (void *obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*misc) (void *obj, H5VL_file_misc_t misc_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*optional)(void *obj, H5VL_file_optional_t op_type, hid_t dxpl_id, void **req, va_list arguments); + void *(*create)(const char *name, unsigned flags, hid_t fcpl_id, + hid_t fapl_id, hid_t dxpl_id, void **req); + void *(*open)(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); herr_t (*close) (void *file, hid_t dxpl_id, void **req); } H5VL_file_class_t; /* H5G routines */ typedef struct H5VL_group_class_t { - void *(*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); - void *(*open) (void *obj, H5VL_loc_params_t loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); - herr_t (*get) (void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + void *(*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); + void *(*open)(void *obj, H5VL_loc_params_t loc_params, const char *name, + hid_t gapl_id, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); herr_t (*close) (void *grp, hid_t dxpl_id, void **req); } H5VL_group_class_t; @@ -265,28 +283,31 @@ typedef struct H5VL_group_class_t { typedef struct H5VL_link_class_t { herr_t (*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); - herr_t (*move) (void *src_obj, H5VL_loc_params_t loc_params1, - void *dst_obj, H5VL_loc_params_t loc_params2, - hbool_t copy_flag, hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req); - herr_t (*iterate) (void *obj, H5VL_loc_params_t loc_params, hbool_t recursive, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, - H5L_iterate_t op, void *op_data, hid_t dxpl_id, void **req); - herr_t (*get) (void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*remove)(void *obj, H5VL_loc_params_t loc_params, hid_t dxpl_id, void **req); + herr_t (*copy)(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, + hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req); + herr_t (*move)(void *src_obj, H5VL_loc_params_t loc_params1, + void *dst_obj, H5VL_loc_params_t loc_params2, + hid_t lcpl, hid_t lapl, hid_t dxpl_id, void **req); + herr_t (*get)(void *obj, H5VL_loc_params_t loc_params, H5VL_link_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_loc_params_t loc_params, H5VL_link_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); } H5VL_link_class_t; /* H5O routines */ typedef struct H5VL_object_class_t { - void *(*open) (void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); - herr_t (*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); - herr_t (*visit) (void *obj, H5VL_loc_params_t loc_params, H5_index_t idx_type, - H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t dxpl_id, void **req); - herr_t (*get) (void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*misc) (void *obj, H5VL_loc_params_t loc_params, H5VL_object_misc_t misc_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*optional)(void *obj, H5VL_loc_params_t loc_params, H5VL_object_optional_t op_type, hid_t dxpl_id, void **req, va_list arguments); - herr_t (*close) (void *obj, H5VL_loc_params_t loc_params, hid_t dxpl_id, void **req); + void *(*open)(void *obj, H5VL_loc_params_t loc_params, H5I_type_t *opened_type, + hid_t dxpl_id, void **req); + herr_t (*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); + herr_t (*get)(void *obj, H5VL_loc_params_t loc_params, H5VL_object_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*specific)(void *obj, H5VL_loc_params_t loc_params, H5VL_object_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments); + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); } H5VL_object_class_t; /* H5AO routines */ @@ -311,14 +332,19 @@ typedef struct H5VL_class_t { size_t fapl_size; void * (*fapl_copy)(const void *info); herr_t (*fapl_free)(void *info); + + /* Data Model */ H5VL_attr_class_t attr_cls; - H5VL_datatype_class_t datatype_cls; H5VL_dataset_class_t dataset_cls; + H5VL_datatype_class_t datatype_cls; H5VL_file_class_t file_cls; H5VL_group_class_t group_cls; H5VL_link_class_t link_cls; H5VL_object_class_t object_cls; + + /* Services */ H5VL_async_class_t async_cls; + herr_t (*optional)(void *obj, hid_t dxpl_id, void **req, va_list arguments); } H5VL_class_t; /* @@ -337,69 +363,63 @@ typedef struct H5VL_t { extern "C" { #endif -/* ATTRIBUTE OBJECT ROUTINES */ H5_DLL void *H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *attr_name, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLattr_read(void *attr, H5VL_t *vol_plugin, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLattr_write(void *attr, H5VL_t *vol_plugin, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_iterate(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *n, H5A_operator2_t op, void *op_data, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLattr_get(void *attr, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLattr_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *attr_name, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLattr_get(void *obj, H5VL_t *vol_plugin, 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, H5VL_t *vol_plugin, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLattr_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLattr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); -/* DATASE OBJECT ROUTINES */ H5_DLL void *H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf, void **req); -H5_DLL herr_t H5VLdataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req); -H5_DLL herr_t H5VLdataset_set_extent(void *dset, H5VL_t *vol_plugin, const hsize_t size[], hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLdataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf, void **req); +H5_DLL herr_t H5VLdataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req); H5_DLL herr_t H5VLdataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_specific(void *obj, H5VL_t *vol_plugin, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdataset_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLdataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); -/* DATATYPE OBJECT ROUTINES */ H5_DLL void *H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -H5_DLL ssize_t H5VLdatatype_get_binary(void *obj, H5VL_t *vol_plugin, void *buf, size_t size, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLdatatype_get(void *obj, H5VL_t *vol_plugin, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_get(void *dt, H5VL_t *vol_plugin, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_specific(void *obj, H5VL_t *vol_plugin, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLdatatype_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLdatatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); -/* FILE OBJECT ROUTINES */ H5_DLL void *H5VLfile_create(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VLfile_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLfile_flush(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5F_scope_t scope, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLfile_misc(void *file, H5VL_t *vol_plugin, H5VL_file_misc_t misc_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLfile_optional(void *file, H5VL_t *vol_plugin, H5VL_file_optional_t optional_type, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLfile_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_specific(void *obj, H5VL_t *vol_plugin, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLfile_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLfile_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); -/* GROUP OBJECT ROUTINES */ H5_DLL void *H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLgroup_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLgroup_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_specific(void *obj, H5VL_t *vol_plugin, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLgroup_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); -/* LINK OBJECT ROUTINES */ H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t 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, H5VL_t *vol_plugin, + 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, H5VL_t *vol_plugin, - hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLlink_iterate(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - hbool_t recursive, H5_index_t idx_type, H5_iter_order_t order, - hsize_t *idx, H5L_iterate_t op, void *op_data, hid_t dxpl_id, void **req); + 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, H5VL_t *vol_plugin, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLlink_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLlink_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); -/* OBJECT ROUTINES */ H5_DLL void *H5VLobject_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5I_type_t *opened_type, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VLobject_visit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t dxpl_id, void **req); H5_DLL herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_misc(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_misc_t misc_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_optional(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_misc_t optional_type, hid_t dxpl_id, void **req, va_list arguments); -H5_DLL herr_t H5VLobject_close(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t dxpl_id, void **req); +H5_DLL herr_t H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments); +H5_DLL herr_t H5VLobject_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments); H5_DLL herr_t H5VLrequest_cancel(void **req, H5VL_t *vol_plugin, H5ES_status_t *status); H5_DLL herr_t H5VLrequest_test(void **req, H5VL_t *vol_plugin, H5ES_status_t *status); diff --git a/src/H5trace.c b/src/H5trace.c index 4b33898..ddf376c 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -2434,9 +2434,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...) H5VL_attr_get_t get = (H5VL_attr_get_t)va_arg(ap, int); switch(get) { - case H5VL_ATTR_EXISTS: - fprintf(out, "H5VL_ATTR_EXISTS"); - break; case H5VL_ATTR_GET_SPACE: fprintf(out, "H5VL_ATTR_GET_SPACE"); break; @@ -2461,7 +2458,36 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; - case 'd': + case 'b': + if(ptr) { + if(vp) + fprintf (out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5VL_attr_specific_t specific = (H5VL_attr_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_ATTR_DELETE: + fprintf(out, "H5VL_ATTR_DELETE"); + break; + case H5VL_ATTR_EXISTS: + fprintf(out, "H5VL_ATTR_EXISTS"); + break; + case H5VL_ATTR_ITER: + fprintf(out, "H5VL_ATTR_ITER"); + break; + case H5VL_ATTR_RENAME: + fprintf(out, "H5VL_ATTR_RENAME"); + break; + default: + fprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'c': if(ptr) { if(vp) fprintf (out, "0x%lx", (unsigned long)vp); @@ -2499,6 +2525,49 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; + case 'd': + if(ptr) { + if(vp) + fprintf (out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5VL_dataset_specific_t specific = (H5VL_dataset_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_DATASET_SET_EXTENT: + fprintf(out, "H5VL_DATASET_SPECIFIC_SPACE"); + break; + default: + fprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'e': + if(ptr) { + if(vp) + fprintf (out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5VL_datatype_get_t get = (H5VL_datatype_get_t)va_arg(ap, int); + + switch(get) { + case H5VL_DATATYPE_GET_BINARY: + fprintf(out, "H5VL_DATATYPE_GET_BINARY"); + break; + case H5VL_DATATYPE_GET_TCPL: + fprintf(out, "H5VL_DATATYPE_GET_TCPL"); + break; + default: + fprintf(out, "%ld", (long)get); + break; + } /* end switch */ + } /* end else */ + break; case 'f': if(ptr) { if(vp) @@ -2507,6 +2576,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { + H5VL_datatype_specific_t specific = (H5VL_datatype_specific_t)va_arg(ap, int); + + switch(specific) { + case H5VL_DATATYPE_SPECIFIC_INVALID: + default: + fprintf(out, "%ld", (long)specific); + break; + } /* end switch */ + } /* end else */ + break; + case 'g': + if(ptr) { + if(vp) + fprintf (out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { H5VL_file_get_t get = (H5VL_file_get_t)va_arg(ap, int); switch(get) { @@ -2537,7 +2624,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; - case 'm': + case 'h': if(ptr) { if(vp) fprintf (out, "0x%lx", (unsigned long)vp); @@ -2545,9 +2632,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - H5VL_file_misc_t misc = (H5VL_file_misc_t)va_arg(ap, int); + H5VL_file_specific_t specific = (H5VL_file_specific_t)va_arg(ap, int); - switch(misc) { + switch(specific) { + case H5VL_FILE_FLUSH: + fprintf(out, "H5VL_FILE_FLUSH"); + break; case H5VL_FILE_MOUNT: fprintf(out, "H5VL_FILE_MOUNT"); break; @@ -2558,68 +2648,12 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "H5VL_FILE_IS_ACCESSIBLE"); break; default: - fprintf(out, "%ld", (long)misc); + fprintf(out, "%ld", (long)specific); break; } /* end switch */ } /* end else */ break; - case 'n': - if(ptr) { - if(vp) - fprintf (out, "0x%lx", (unsigned long)vp); - else - fprintf(out, "NULL"); - } /* end if */ - else { - H5VL_file_optional_t op = (H5VL_file_optional_t)va_arg(ap, int); - - switch(op) { - case H5VL_FILE_CLEAR_ELINK_CACHE: - fprintf(out, "H5VL_FILE_CLEAR_ELINK_CACHE"); - break; - case H5VL_FILE_GET_FILE_IMAGE: - fprintf(out, "H5VL_FILE_GET_FILE_IMAGE"); - break; - case H5VL_FILE_GET_FREE_SECTIONS: - fprintf(out, "H5VL_FILE_GET_FREE_SECTIONS"); - break; - case H5VL_FILE_GET_FREE_SPACE: - fprintf(out, "H5VL_FILE_GET_FREE_SPACE"); - break; - case H5VL_FILE_GET_INFO: - fprintf(out, "H5VL_FILE_GET_INFO"); - break; - case H5VL_FILE_GET_MDC_CONF: - fprintf(out, "H5VL_FILE_GET_MDC_CONF"); - break; - case H5VL_FILE_GET_MDC_HR: - fprintf(out, "H5VL_FILE_GET_MDC_HR"); - break; - case H5VL_FILE_GET_MDC_SIZE: - fprintf(out, "H5VL_FILE_GET_MDC_SIZE"); - break; - case H5VL_FILE_GET_SIZE: - fprintf(out, "H5VL_FILE_GET_SIZE"); - break; - case H5VL_FILE_GET_VFD_HANDLE: - fprintf(out, "H5VL_FILE_GET_VFD_HANDLE"); - break; - case H5VL_FILE_REOPEN: - fprintf(out, "H5VL_FILE_REOPEN"); - break; - case H5VL_FILE_RESET_MDC_HIT_RATE: - fprintf(out, "H5VL_FILE_RESET_MDC_HIT_RATE"); - break; - case H5VL_FILE_SET_MDC_CONFIG: - fprintf(out, "H5VL_FILE_SET_MDC_CONFIG"); - break; - default: - fprintf(out, "%ld", (long)op); - break; - } /* end switch */ - } /* end else */ - break; - case 'g': + case 'i': if(ptr) { if(vp) fprintf (out, "0x%lx", (unsigned long)vp); @@ -2642,7 +2676,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; - case 't': + case 'j': if(ptr) { if(vp) fprintf (out, "0x%lx", (unsigned long)vp); @@ -2650,19 +2684,17 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - H5VL_datatype_get_t get = (H5VL_datatype_get_t)va_arg(ap, int); + H5VL_group_specific_t specific = (H5VL_group_specific_t)va_arg(ap, int); - switch(get) { - case H5VL_DATATYPE_GET_TCPL: - fprintf(out, "H5VL_DATATYPE_GET_TCPL"); - break; + switch(specific) { + case H5VL_GROUP_SPECIFIC_INVALID: default: - fprintf(out, "%ld", (long)get); + fprintf(out, "%ld", (long)specific); break; } /* end switch */ } /* end else */ break; - case 'c': + case 'k': if(ptr) { if(vp) fprintf (out, "0x%lx", (unsigned long)vp); @@ -2699,9 +2731,6 @@ H5_trace(const double *returning, const char *func, const char *type, ...) H5VL_link_get_t get = (H5VL_link_get_t)va_arg(ap, int); switch(get) { - case H5VL_LINK_EXISTS: - fprintf(out, "H5VL_LINK_EXISTS"); - break; case H5VL_LINK_GET_INFO: fprintf(out, "H5VL_LINK_GET_INFO"); break; @@ -2717,7 +2746,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end switch */ } /* end else */ break; - case 'x': + case 'm': if(ptr) { if(vp) fprintf (out, "0x%lx", (unsigned long)vp); @@ -2725,29 +2754,25 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - H5VL_object_misc_t misc = (H5VL_object_misc_t)va_arg(ap, int); + H5VL_link_specific_t specific = (H5VL_link_specific_t)va_arg(ap, int); - switch(misc) { - case H5VL_ATTR_RENAME: - fprintf(out, "H5VL_ATTR_RENAME"); + switch(specific) { + case H5VL_LINK_DELETE: + fprintf(out, "H5VL_LINK_DELETE"); break; - case H5VL_OBJECT_CHANGE_REF_COUNT: - fprintf(out, "H5VL_OBJECT_CHANGE_REF_COUNT"); - break; - case H5VL_OBJECT_SET_COMMENT: - fprintf(out, "H5VL_OBJECT_SET_COMMENT"); + case H5VL_LINK_EXISTS: + fprintf(out, "H5VL_LINK_EXISTS"); break; - case H5VL_REF_CREATE: - fprintf(out, "H5VL_REF_CREATE"); + case H5VL_LINK_ITER: + fprintf(out, "H5VL_LINK_ITER"); break; default: - fprintf(out, "%ld", (long)misc); + fprintf(out, "%ld", (long)specific); break; } /* end switch */ } /* end else */ break; - - case 'p': + case 'n': if(ptr) { if(vp) fprintf (out, "0x%lx", (unsigned long)vp); @@ -2755,19 +2780,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - H5VL_object_optional_t op = (H5VL_object_optional_t)va_arg(ap, int); + H5VL_object_get_t get = (H5VL_object_get_t)va_arg(ap, int); - switch(op) { - case H5VL_OPTIONAL: - fprintf(out, "H5VL_OPTIONAL"); + switch(get) { + case H5VL_REF_GET_REGION: + fprintf(out, "H5VL_REF_GET_REGION"); + break; + case H5VL_REF_GET_TYPE: + fprintf(out, "H5VL_REF_GET_TYPE"); + break; + case H5VL_REF_GET_NAME: + fprintf(out, "H5VL_REF_GET_NAME"); break; default: - fprintf(out, "%ld", (long)op); + fprintf(out, "%ld", (long)get); break; } /* end switch */ } /* end else */ break; - case 'o': if(ptr) { if(vp) @@ -2776,29 +2806,23 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } /* end if */ else { - H5VL_object_get_t get = (H5VL_object_get_t)va_arg(ap, int); + H5VL_object_specific_t specific = (H5VL_object_specific_t)va_arg(ap, int); - switch(get) { + switch(specific) { + case H5VL_OBJECT_CHANGE_REF_COUNT: + fprintf(out, "H5VL_OBJECT_CHANGE_REF_COUNT"); + break; case H5VL_OBJECT_EXISTS: fprintf(out, "H5VL_OBJECT_EXISTS"); break; - case H5VL_OBJECT_GET_INFO: - fprintf(out, "H5VL_OBJECT_GET_INFO"); - break; - case H5VL_OBJECT_GET_COMMENT: - fprintf(out, "H5VL_OBJECT_GET_COMMENT"); - break; - case H5VL_REF_GET_REGION: - fprintf(out, "H5VL_REF_GET_REGION"); - break; - case H5VL_REF_GET_TYPE: - fprintf(out, "H5VL_REF_GET_TYPE"); + case H5VL_OBJECT_VISIT: + fprintf(out, "H5VL_OBJECT_VISIT"); break; - case H5VL_REF_GET_NAME: - fprintf(out, "H5VL_REF_GET_NAME"); + case H5VL_REF_CREATE: + fprintf(out, "H5VL_REF_CREATE"); break; default: - fprintf(out, "%ld", (long)get); + fprintf(out, "%ld", (long)specific); break; } /* end switch */ } /* end else */ diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index 35b6906..d4ba66b 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -15,15 +15,9 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dcreate2(): not a location ID major: Invalid arguments to routine minor: Inappropriate type - #001: (file name) line (number) in H5VL_get_object(): invalid identifier - major: Invalid arguments to routine - minor: Inappropriate type ********* Print error stack in customized way ********* - error #000: (file name) in H5VL_get_object(): line (number) - major: Invalid arguments to routine - minor: Inappropriate type - error #001: (file name) in H5Dcreate2(): line (number) + error #000: (file name) in H5Dcreate2(): line (number) major: Invalid arguments to routine minor: Inappropriate type @@ -33,19 +27,13 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Can't get value ********* Print error stack in customized way ********* - error #000: (file name) in H5VL_get_object(): line (number) - major: Invalid arguments to routine - minor: Inappropriate type - error #001: (file name) in H5Dcreate2(): line (number) + error #000: (file name) in H5Dcreate2(): line (number) major: Invalid arguments to routine minor: Inappropriate type HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Dcreate2(): not a location ID major: Invalid arguments to routine minor: Inappropriate type - #001: (file name) line (number) in H5VL_get_object(): invalid identifier - major: Invalid arguments to routine - minor: Inappropriate type HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in main(): Error test failed |