summaryrefslogtreecommitdiffstats
path: root/src/H5VLnative_link.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5VLnative_link.c')
-rw-r--r--src/H5VLnative_link.c166
1 files changed, 90 insertions, 76 deletions
diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c
index 72f6cde..042c778 100644
--- a/src/H5VLnative_link.c
+++ b/src/H5VLnative_link.c
@@ -15,8 +15,15 @@
*
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5L_FRIEND /* Suppress error about including H5Lpkg */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Gprivate.h" /* Groups */
@@ -27,6 +34,30 @@
#include "H5VLnative_private.h" /* Native VOL connector */
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5VL__native_link_create
*
@@ -37,20 +68,20 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
+H5VL__native_link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+ void H5_ATTR_UNUSED **req)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (create_type) {
+ switch (args->op_type) {
case H5VL_LINK_CREATE_HARD: {
H5G_loc_t cur_loc;
H5G_loc_t link_loc;
- void * cur_obj = HDva_arg(arguments, void *);
- H5VL_loc_params_t *cur_params = HDva_arg(arguments, H5VL_loc_params_t *);
+ void * cur_obj = args->args.hard.curr_obj;
+ H5VL_loc_params_t *cur_params = &args->args.hard.curr_loc_params;
if (NULL != cur_obj && H5G_loc_real(cur_obj, cur_params->obj_type, &cur_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
@@ -73,46 +104,40 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H
"source and destination should be in the same file.")
/* 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)) < 0)
+ if (H5L__create_hard(cur_loc_p, cur_params->loc_data.loc_by_name.name, link_loc_p,
+ loc_params->loc_data.loc_by_name.name, lcpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else { /* H5Olink */
/* Link to the object */
if (H5L_link(&link_loc, loc_params->loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else */
+
break;
}
case H5VL_LINK_CREATE_SOFT: {
- char * target_name = HDva_arg(arguments, char *);
H5G_loc_t link_loc; /* Group location for new link */
if (H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ if (H5L__create_soft(args->args.soft.target, &link_loc, loc_params->loc_data.loc_by_name.name,
+ lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
- /* Create the link */
- if ((ret_value = H5L__create_soft(target_name, &link_loc, loc_params->loc_data.loc_by_name.name,
- lcpl_id)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
break;
}
case H5VL_LINK_CREATE_UD: {
- H5G_loc_t link_loc; /* Group location for new link */
- H5L_type_t link_type = (H5L_type_t)HDva_arg(arguments, int);
- void * udata = HDva_arg(arguments, void *);
- size_t udata_size = HDva_arg(arguments, size_t);
+ H5G_loc_t link_loc; /* Group location for new link */
if (H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Create link */
- if (H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, udata, udata_size, link_type,
- lcpl_id) < 0)
+ if (H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, args->args.ud.buf,
+ args->args.ud.buf_size, args->args.ud.type, lcpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+
break;
}
@@ -218,8 +243,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_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__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
H5G_loc_t loc;
herr_t ret_value = SUCCEED; /* Return value */
@@ -229,20 +254,19 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_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")
- switch (get_type) {
+ switch (args->op_type) {
/* H5Lget_info/H5Lget_info_by_idx */
case H5VL_LINK_GET_INFO: {
- H5L_info2_t *linfo2 = HDva_arg(arguments, H5L_info2_t *);
-
/* 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, linfo2) < 0)
+ if (loc_params->type == H5VL_OBJECT_BY_NAME) {
+ if (H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, args->args.get_info.linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
- } /* end if */
- else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */
- if (H5L__get_info_by_idx(
- &loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, linfo2) < 0)
+ } /* end if */
+ else if (loc_params->type == H5VL_OBJECT_BY_IDX) {
+ if (H5L__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
+ loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order,
+ loc_params->loc_data.loc_by_idx.n, args->args.get_info.linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
} /* end else-if */
else
@@ -253,15 +277,11 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_
/* H5Lget_name_by_idx */
case H5VL_LINK_GET_NAME: {
- char * name = HDva_arg(arguments, char *);
- size_t size = HDva_arg(arguments, size_t);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
-
- /* Get the link name */
- if ((*ret = H5L__get_name_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, name, size)) < 0)
+ if (H5L__get_name_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
+ loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n,
+ args->args.get_name.name, args->args.get_name.name_size,
+ args->args.get_name.name_len) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
break;
@@ -269,20 +289,17 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_
/* H5Lget_val/H5Lget_val_by_idx */
case H5VL_LINK_GET_VAL: {
- void * buf = HDva_arg(arguments, void *);
- size_t size = HDva_arg(arguments, size_t);
-
/* 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) < 0)
+ if (loc_params->type == H5VL_OBJECT_BY_NAME) {
+ if (H5L__get_val(&loc, loc_params->loc_data.loc_by_name.name, args->args.get_val.buf,
+ args->args.get_val.buf_size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link value")
}
- else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_val_by_idx */
-
- if (H5L__get_val_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, buf, size) < 0)
+ else if (loc_params->type == H5VL_OBJECT_BY_IDX) {
+ if (H5L__get_val_by_idx(
+ &loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n,
+ args->args.get_val.buf, args->args.get_val.buf_size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val")
}
else
@@ -309,35 +326,28 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (specific_type) {
+ switch (args->op_type) {
case H5VL_LINK_EXISTS: {
- hbool_t * exists = HDva_arg(arguments, hbool_t *);
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")
-
- /* Check for the existence of the link */
- if (H5L__exists(&loc, loc_params->loc_data.loc_by_name.name, exists) < 0)
+ if (H5L__exists(&loc, loc_params->loc_data.loc_by_name.name, args->args.exists.exists) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info")
+
break;
}
case H5VL_LINK_ITER: {
- H5G_loc_t loc;
- hbool_t recursive = (hbool_t)HDva_arg(arguments, unsigned);
- H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
- H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
- hsize_t * idx_p = HDva_arg(arguments, hsize_t *);
- H5L_iterate2_t op = HDva_arg(arguments, H5L_iterate2_t);
- void * op_data = HDva_arg(arguments, void *);
+ H5VL_link_iterate_args_t *iter_args = &args->args.iterate;
+ H5G_loc_t loc;
/* Get the location */
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
@@ -345,28 +355,32 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_
/* Visit or iterate over the links */
if (loc_params->type == H5VL_OBJECT_BY_SELF) {
- if (recursive) {
+ if (iter_args->recursive) {
/* H5Lvisit */
- if ((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0)
+ if ((ret_value = H5G_visit(&loc, ".", iter_args->idx_type, iter_args->order,
+ iter_args->op, iter_args->op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
} /* end if */
else {
/* H5Literate */
- if ((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0)
+ if ((ret_value = H5L_iterate(&loc, ".", iter_args->idx_type, iter_args->order,
+ iter_args->idx_p, iter_args->op, iter_args->op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links")
} /* end else */
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) {
- if (recursive) {
+ if (iter_args->recursive) {
/* H5Lvisit_by_name */
- if ((ret_value = H5G_visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order,
- op, op_data)) < 0)
+ if ((ret_value =
+ H5G_visit(&loc, loc_params->loc_data.loc_by_name.name, iter_args->idx_type,
+ iter_args->order, iter_args->op, iter_args->op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
} /* end if */
else {
/* H5Literate_by_name */
- if ((ret_value = H5L_iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order,
- idx_p, op, op_data)) < 0)
+ if ((ret_value = H5L_iterate(&loc, loc_params->loc_data.loc_by_name.name,
+ iter_args->idx_type, iter_args->order, iter_args->idx_p,
+ iter_args->op, iter_args->op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links")
} /* end else */
} /* end else-if */