Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated H5VOL for HDF5 v1.13 #2945

Closed
wants to merge 15 commits into from
Closed
7 changes: 3 additions & 4 deletions source/h5vol/H5VolReadWrite.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ extern herr_t H5VL_adios2_beginstep(const char *engine_name,

extern herr_t H5VL_adios2_endstep(const char *engine_nane);

static herr_t H5VL_adios2_introspect_opt_query(void *obj, H5VL_subclass_t cls,
int opt_type, hbool_t *supported)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This old signature is actually the correct one, with the hbool_t * changed to a uint64_t * instead.

static herr_t H5VL_adios2_introspect_opt_query(const void *obj, unsigned int *opt_type)
{
*supported = 0;
return 0;
}

Expand All @@ -53,7 +51,8 @@ static const H5VL_class_t H5VL_adios2_def = {
H5VL_ADIOS2_VERSION,
(H5VL_class_value_t)H5VL_ADIOS2_VALUE,
H5VL_ADIOS2_NAME, /* name */
0,
0, /* Version # of connector */
0, /* Capability flags for connector */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also use H5VL_CAP_FLAG_NONE here.

H5VL_adios2_init, /* initialize */
H5VL_adios2_term, /* terminate */
{
Expand Down
42 changes: 26 additions & 16 deletions source/h5vol/H5Vol_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,29 +154,39 @@ void GetFromAttribute(void *attrObj, hid_t *ret_id, H5VL_attr_get_t get_type)
}
}

herr_t H5VL_adios2_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id,
void **req, va_list arguments)
herr_t H5VL_adios2_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id,
void **req)
{
REQUIRE_NOT_NULL_ERR(obj, -1);
H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)obj;

if ((get_type == H5VL_ATTR_GET_SPACE) || (get_type == H5VL_ATTR_GET_TYPE))
switch (args->op_type)
{
hid_t *ret_id = va_arg(arguments, hid_t *);
GetFromAttribute((vol->m_ObjPtr), ret_id, get_type);
case H5VL_ATTR_GET_SPACE:
{
hid_t *ret_id = (hid_t *)args->args.get_space.space_id;
GetFromAttribute((vol->m_ObjPtr), ret_id, args->op_type);
return 0;
}
case H5VL_ATTR_GET_TYPE:
{
hid_t *ret_id = (hid_t *)args->args.get_type.type_id;
GetFromAttribute((vol->m_ObjPtr), ret_id, args->op_type);
return 0;
}
default:
break;
}

const H5VL_loc_params_t *loc_params =
va_arg(arguments, const H5VL_loc_params_t *);
const H5VL_loc_params_t *loc_params = &args->args.get_info.loc_params;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably move this inside the get_info block so that you don't try to access the get_info portion when that's not the operation being performed.

REQUIRE_NOT_NULL_ERR(loc_params, -1);

switch (get_type)
switch (args->op_type)
{
case H5VL_ATTR_GET_NAME:
{
char *buf = va_arg(arguments, char *);
ssize_t *ret_val = va_arg(arguments, ssize_t *);
char *buf = args->args.get_name.buf;
ssize_t *ret_val = (ssize_t*)args->args.get_name.attr_name_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changed to a size_t * with changes in the VOL.


if (H5VL_OBJECT_BY_SELF == loc_params->type)
{
Expand Down Expand Up @@ -222,16 +232,16 @@ herr_t H5VL_adios2_attr_close(void *attr, hid_t dxpl_id, void **req)
}

herr_t H5VL_adios2_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_attr_specific_t specific_type,
hid_t dxpl_id, void **req, va_list arguments)
H5VL_attr_specific_args_t *args,
hid_t dxpl_id, void **req)
{
REQUIRE_NOT_NULL_ERR(obj, -1);
H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)obj;
const char *attr_name = va_arg(arguments, const char *);
const char *attr_name = (const char *)args->args.del.name;
Copy link
Contributor

@jhendersonHDF jhendersonHDF Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't necessarily be safe to retrieve the attribute's name here until you know that the delete operation is the one occurring since the arguments are in a union.

For delete, the attribute name is in args->args.del.name, for exists, it's in args->args.exists.name and for rename it's in args->args.rename.old_name for example.


adios2_attribute *attr = gLocateAttrFrom(vol, attr_name);

switch (specific_type)
switch (args->op_type)
{
case H5VL_ATTR_DELETE:
{
Expand All @@ -250,7 +260,7 @@ herr_t H5VL_adios2_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
}
case H5VL_ATTR_EXISTS:
{
htri_t *ret = va_arg(arguments, htri_t *);
hbool_t *ret = args->args.exists.exists;
if (NULL == attr)
{
*ret = 0;
Expand Down
10 changes: 5 additions & 5 deletions source/h5vol/H5Vol_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,26 @@ herr_t H5VL_adios2_dataset_read(void *dset, hid_t mem_type_id,
return gADIOS2ReadVar(var);
}

herr_t H5VL_adios2_dataset_get(void *dset, H5VL_dataset_get_t get_type,
hid_t dxpl_id, void **req, va_list arguments)
herr_t H5VL_adios2_dataset_get(void *dset, H5VL_dataset_get_args_t *args,
hid_t dxpl_id, void **req)
{
REQUIRE_NOT_NULL_ERR(dset, -1);
H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)dset;
H5VL_VarDef_t *varDef = (H5VL_VarDef_t *)(vol->m_ObjPtr);

switch (get_type)
switch (args->op_type)
{
case H5VL_DATASET_GET_SPACE:
{
hid_t *ret_id = va_arg(arguments, hid_t *);
hid_t *ret_id = (hid_t *)args->args.get_space.space_id;
*ret_id = H5Scopy(varDef->m_ShapeID);
REQUIRE_SUCC_MSG((*ret_id >= 0), -1,
"H5VOL-ADIOS2: Unable to get space id.");
break;
}
case H5VL_DATASET_GET_TYPE:
{
hid_t *ret_id = va_arg(arguments, hid_t *);
hid_t *ret_id = (hid_t *)args->args.get_type.type_id;
*ret_id = H5Tcopy(varDef->m_TypeID);
break;
}
Expand Down
38 changes: 16 additions & 22 deletions source/h5vol/H5Vol_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ extern void *H5VL_adios2_file_open(const char *name, unsigned flags,
hid_t fapl_id, hid_t dxpl_id, void **req);

extern herr_t H5VL_adios2_file_specific(void *file,
H5VL_file_specific_t specific_type,
hid_t dxpl_id, void **req,
va_list arguments);
H5VL_file_specific_args_t *args,
hid_t dxpl_id, void **req);

extern herr_t H5VL_adios2_file_close(void *file, hid_t dxpl_id, void **req);

Expand All @@ -130,17 +129,15 @@ extern herr_t H5VL_adios2_attr_write(void *attr, hid_t mem_type_id,
const void *buf, hid_t dxpl_id,
void **req);

extern herr_t H5VL_adios2_attr_get(void *obj, H5VL_attr_get_t get_type,
hid_t dxpl_id, void **req,
va_list arguments);
extern herr_t H5VL_adios2_attr_get(void *obj, H5VL_attr_get_args_t *args,
hid_t dxpl_id, void **req);

extern herr_t H5VL_adios2_attr_close(void *attr, hid_t dxpl_id, void **req);

extern herr_t H5VL_adios2_attr_specific(void *obj,
const H5VL_loc_params_t *loc_params,
H5VL_attr_specific_t specific_type,
hid_t dxpl_id, void **req,
va_list arguments);
H5VL_attr_specific_args_t *args,
hid_t dxpl_id, void **req);

//
// object functions:
Expand All @@ -153,8 +150,8 @@ extern void *H5VL_adios2_object_open(void *obj,

extern herr_t
H5VL_adios2_object_get(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_object_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req, va_list arguments);
H5VL_object_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req);

// dataset functions:
extern void *H5VL_adios2_dataset_create(void *obj,
Expand All @@ -173,9 +170,8 @@ extern herr_t H5VL_adios2_dataset_read(void *dset, hid_t mem_type_id,
hid_t mem_space_id, hid_t file_space_id,
hid_t plist_id, void *buf, void **req);

extern herr_t H5VL_adios2_dataset_get(void *dset, H5VL_dataset_get_t get_type,
hid_t dxpl_id, void **req,
va_list arguments);
extern herr_t H5VL_adios2_dataset_get(void *dset, H5VL_dataset_get_args_t *args,
hid_t dxpl_id, void **req);

extern herr_t H5VL_adios2_dataset_write(void *dset, hid_t mem_type_id,
hid_t mem_space_id, hid_t file_space_id,
Expand All @@ -189,15 +185,14 @@ extern herr_t H5VL_adios2_dataset_close(void *dset, hid_t dxpl_id, void **req);
//
extern herr_t H5VL_adios2_link_specific(void *obj,
const H5VL_loc_params_t *loc_params,
H5VL_link_specific_t specific_type,
H5VL_link_specific_args_t *args,
hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req,
va_list arguments);
void H5_ATTR_UNUSED **req);

extern herr_t
H5VL_adios2_link_get(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_link_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req, va_list arguments);
H5VL_link_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req);

//
// group functions:
Expand All @@ -215,10 +210,9 @@ extern void *H5VL_adios2_group_open(void *obj,
const char *name, hid_t gapl_id,
hid_t dxpl_id, void **req);

extern herr_t H5VL_adios2_group_get(void *obj, H5VL_group_get_t get_type,
extern herr_t H5VL_adios2_group_get(void *obj, H5VL_group_get_args_t *args,
hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req,
va_list arguments);
void H5_ATTR_UNUSED **req);

//
// general definitions:
Expand Down
4 changes: 2 additions & 2 deletions source/h5vol/H5Vol_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ void *H5VL_adios2_file_open(const char *name, unsigned flags, hid_t fapl_id,
return gFileToVolObj(handle);
}

herr_t H5VL_adios2_file_specific(void *file, H5VL_file_specific_t specific_type,
hid_t dxpl_id, void **req, va_list arguments)
herr_t H5VL_adios2_file_specific(void *file, H5VL_file_specific_args_t *args,
hid_t dxpl_id, void **req)
{
//
// This function is called after H5Fopen/create. Do not remove
Expand Down
11 changes: 5 additions & 6 deletions source/h5vol/H5Vol_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,19 @@ void *H5VL_adios2_group_open(void *obj, const H5VL_loc_params_t *loc_params,
return NULL;
}

herr_t H5VL_adios2_group_get(void *obj, H5VL_group_get_t get_type,
herr_t H5VL_adios2_group_get(void *obj, H5VL_group_get_args_t *args,
hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req, va_list arguments)
void H5_ATTR_UNUSED **req)
{
REQUIRE_NOT_NULL_ERR(obj, -1);
H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)obj;

switch (get_type)
switch (args->op_type)
{
case H5VL_GROUP_GET_INFO:
{
const H5VL_loc_params_t *loc_params =
va_arg(arguments, const H5VL_loc_params_t *);
H5G_info_t *group_info = va_arg(arguments, H5G_info_t *);
const H5VL_loc_params_t *loc_params = &args->args.get_info.loc_params;
H5G_info_t *group_info = args->args.get_info.ginfo;

if (loc_params->type == H5VL_OBJECT_BY_SELF)
{
Expand Down
18 changes: 9 additions & 9 deletions source/h5vol/H5Vol_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
#include "H5Vol_def.h"

herr_t H5VL_adios2_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_link_specific_t specific_type,
H5VL_link_specific_args_t *args,
hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req, va_list arguments)
void H5_ATTR_UNUSED **req)

{
REQUIRE_NOT_NULL_ERR(loc_params, -1);
REQUIRE_NOT_NULL_ERR(obj, -1);

H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)obj;

switch (specific_type)
switch (args->op_type)
{
case H5VL_LINK_EXISTS:
{
if ((GROUP == vol->m_ObjType) || (ROOT == vol->m_ObjType))
{
htri_t *ret = va_arg(arguments, htri_t *);
hbool_t *ret = args->args.exists.exists;

const char *obj_name = loc_params->loc_data.loc_by_name.name;
*ret = gExistsUnderGrp(vol, obj_name);
Expand Down Expand Up @@ -52,21 +52,21 @@ herr_t H5VL_adios2_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
}

herr_t H5VL_adios2_link_get(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_link_get_t get_type,
H5VL_link_get_args_t *args,
hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req, va_list arguments)
void H5_ATTR_UNUSED **req)
{

REQUIRE_NOT_NULL_ERR(loc_params, -1);
REQUIRE_NOT_NULL_ERR(obj, -1);

H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)obj;
switch (get_type)
switch (args->op_type)
{
case H5VL_LINK_GET_NAME:
{
char *name = va_arg(arguments, char *);
ssize_t *ret = va_arg(arguments, ssize_t *);
char *name = args->args.get_name.name;
ssize_t *ret = (ssize_t*)args->args.get_name.name_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to a size_t * with changes in the VOL.


if ((GROUP == vol->m_ObjType) || (ROOT == vol->m_ObjType))
{
Expand Down
9 changes: 4 additions & 5 deletions source/h5vol/H5Vol_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,20 @@ void *H5VL_adios2_object_open(void *obj, const H5VL_loc_params_t *loc_params,
}

herr_t H5VL_adios2_object_get(void *obj, const H5VL_loc_params_t *loc_params,
H5VL_object_get_t get_type,
H5VL_object_get_args_t *args,
hid_t H5_ATTR_UNUSED dxpl_id,
void H5_ATTR_UNUSED **req, va_list arguments)
void H5_ATTR_UNUSED **req)
{
REQUIRE_NOT_NULL_ERR(loc_params, -1);
REQUIRE_NOT_NULL_ERR(obj, -1);

H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)obj;

switch (get_type)
switch (args->op_type)
{
case H5VL_OBJECT_GET_INFO:
{
H5O_info2_t *oinfo = va_arg(arguments, H5O_info2_t *);
// unsigned fields = va_arg(arguments, unsigned);
H5O_info2_t *oinfo = args->args.get_info.oinfo;
if (loc_params->type == H5VL_OBJECT_BY_SELF)
{
oinfo->fileno = 1;
Expand Down