diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/H5FF.c | 190 | ||||
-rw-r--r-- | src/H5Pencdec.c | 2 | ||||
-rw-r--r-- | src/H5Pint.c | 14 | ||||
-rw-r--r-- | src/H5Pprivate.h | 5 | ||||
-rw-r--r-- | src/H5Ppublic.h | 4 | ||||
-rw-r--r-- | src/H5Pvcpl.c | 413 | ||||
-rw-r--r-- | src/H5Q.c | 2 | ||||
-rw-r--r-- | src/H5V.c | 659 | ||||
-rw-r--r-- | src/H5VLiod.c | 749 | ||||
-rw-r--r-- | src/H5VLiod_analysis.c | 21 | ||||
-rw-r--r-- | src/H5VLiod_client.c | 15 | ||||
-rw-r--r-- | src/H5VLiod_client.h | 22 | ||||
-rw-r--r-- | src/H5VLiod_common.h | 47 | ||||
-rw-r--r-- | src/H5VLiod_encdec.c | 185 | ||||
-rw-r--r-- | src/H5VLiod_obj.c | 215 | ||||
-rw-r--r-- | src/H5VLiod_server.c | 56 | ||||
-rw-r--r-- | src/H5VLiod_server.h | 14 | ||||
-rw-r--r-- | src/H5VLiod_view.c | 321 | ||||
-rw-r--r-- | src/H5Vprivate.h | 32 | ||||
-rw-r--r-- | src/H5Vpublic.h | 68 | ||||
-rw-r--r-- | src/H5private.h | 1 | ||||
-rw-r--r-- | src/Makefile.am | 8 | ||||
-rw-r--r-- | src/Makefile.in | 90 |
24 files changed, 2878 insertions, 259 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0b64414..d3f3133 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -463,6 +463,7 @@ SET (H5P_SRCS ${HDF5_SRC_DIR}/H5Pfcpl.c ${HDF5_SRC_DIR}/H5Pfmpl.c ${HDF5_SRC_DIR}/H5Pgcpl.c + ${HDF5_SRC_DIR}/H5Pvcpl.c ${HDF5_SRC_DIR}/H5Pmcpl.c ${HDF5_SRC_DIR}/H5Pmapl.c ${HDF5_SRC_DIR}/H5Pint.c @@ -645,6 +646,7 @@ IF (HDF5_ENABLE_EFF) ${HDF5_SRC_DIR}/H5ES.c ${HDF5_SRC_DIR}/H5RC.c ${HDF5_SRC_DIR}/H5TR.c + ${HDF5_SRC_DIR}/H5V.c ) SET (H5FF_HDRS ${HDF5_SRC_DIR}/H5ASpublic.h @@ -653,6 +655,7 @@ IF (HDF5_ENABLE_EFF) ${HDF5_SRC_DIR}/H5ESpublic.h ${HDF5_SRC_DIR}/H5RCpublic.h ${HDF5_SRC_DIR}/H5TRpublic.h + ${HDF5_SRC_DIR}/H5Vpublic.h ) IDE_GENERATED_PROPERTIES ("H5FF" "${H5FF_HDRS}" "${H5FF_SRCS}" ) SET (H5VL_SRCS @@ -672,6 +675,7 @@ IF (HDF5_ENABLE_EFF) ${HDF5_SRC_DIR}/H5VLiod_map.c ${HDF5_SRC_DIR}/H5VLiod_trans.c ${HDF5_SRC_DIR}/H5VLiod_encdec.c + ${HDF5_SRC_DIR}/H5VLiod_view.c ${HDF5_SRC_DIR}/H5VLiod_analysis.c ) SET (H5VL_HDRS @@ -2688,196 +2688,18 @@ done: herr_t H5Oget_token(hid_t obj_id, void *token, size_t *token_size) { - H5VL_iod_object_t *obj = NULL; /* object token of loc_id */ - iod_obj_id_t iod_id, mdkv_id, attrkv_id; - H5O_type_t type; - uint8_t *buf_ptr = (uint8_t *)token; - size_t dt_size = 0, space_size = 0; - H5T_t *dt = NULL; - H5S_t *space = NULL; - size_t keytype_size = 0, valtype_size; - H5T_t *kt = NULL, *vt = NULL; + void *obj = NULL; /* object token of loc_id */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "i*x*z", obj_id, token, token_size); /* get the file object */ - if(NULL == (obj = (H5VL_iod_object_t *)H5VL_get_object(obj_id))) + if(NULL == (obj = (void *)H5VL_get_object(obj_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); - *token_size = sizeof(iod_obj_id_t)*3 + sizeof(H5O_type_t); - - switch(obj->obj_type) { - case H5I_GROUP: - iod_id = ((const H5VL_iod_group_t *)obj)->remote_group.iod_id; - mdkv_id = ((const H5VL_iod_group_t *)obj)->remote_group.mdkv_id; - attrkv_id = ((const H5VL_iod_group_t *)obj)->remote_group.attrkv_id; - type = H5O_TYPE_GROUP; - break; - case H5I_DATASET: - { - H5VL_iod_dset_t *dset = (H5VL_iod_dset_t *)obj; - - iod_id = dset->remote_dset.iod_id; - mdkv_id = dset->remote_dset.mdkv_id; - attrkv_id = dset->remote_dset.attrkv_id; - type = H5O_TYPE_DATASET; - - if(NULL == (dt = (H5T_t *)H5I_object_verify(dset->remote_dset.type_id, - H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a datatype") - if(NULL == (space = (H5S_t *)H5I_object_verify(dset->remote_dset.space_id, - H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a dataspace") - - if(H5T_encode(dt, NULL, &dt_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") - - if(H5S_encode(space, NULL, &space_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace") - - *token_size += dt_size + space_size + sizeof(size_t)*2; - - break; - } - case H5I_DATATYPE: - { - H5VL_iod_dtype_t *dtype = (H5VL_iod_dtype_t *)obj; - - iod_id = dtype->remote_dtype.iod_id; - mdkv_id = dtype->remote_dtype.mdkv_id; - attrkv_id = dtype->remote_dtype.attrkv_id; - type = H5O_TYPE_NAMED_DATATYPE; - - if(NULL == (dt = (H5T_t *)H5I_object_verify(dtype->remote_dtype.type_id, - H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a datatype") - - if(H5T_encode(dt, NULL, &dt_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") - - *token_size += dt_size + sizeof(size_t); - - break; - } - case H5I_MAP: - { - H5VL_iod_map_t *map = (H5VL_iod_map_t *)obj; - - iod_id = map->remote_map.iod_id; - mdkv_id = map->remote_map.mdkv_id; - attrkv_id = map->remote_map.attrkv_id; - type = H5O_TYPE_MAP; - - if(NULL == (kt = (H5T_t *)H5I_object_verify(map->remote_map.keytype_id, - H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a datatype") - - if(H5T_encode(kt, NULL, &keytype_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") - - if(NULL == (vt = (H5T_t *)H5I_object_verify(map->remote_map.valtype_id, - H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a datatype") - - if(H5T_encode(vt, NULL, &valtype_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") - - *token_size += keytype_size + valtype_size + sizeof(size_t)*2; - - 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_ES: - case H5I_RC: - case H5I_TR: - case H5I_QUERY: - 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_SYM, H5E_CANTINIT, FAIL, "bad object"); - } - - if(token) { - HDmemcpy(buf_ptr, &iod_id, sizeof(iod_obj_id_t)); - buf_ptr += sizeof(iod_obj_id_t); - HDmemcpy(buf_ptr, &mdkv_id, sizeof(iod_obj_id_t)); - buf_ptr += sizeof(iod_obj_id_t); - HDmemcpy(buf_ptr, &attrkv_id, sizeof(iod_obj_id_t)); - buf_ptr += sizeof(iod_obj_id_t); - HDmemcpy(buf_ptr, &type, sizeof(H5O_type_t)); - buf_ptr += sizeof(H5O_type_t); - - switch(obj->obj_type) { - case H5I_GROUP: - break; - case H5I_DATASET: - HDmemcpy(buf_ptr, &dt_size, sizeof(size_t)); - buf_ptr += sizeof(size_t); - if(H5T_encode(dt, buf_ptr, &dt_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") - buf_ptr += dt_size; - - HDmemcpy(buf_ptr, &space_size, sizeof(size_t)); - buf_ptr += sizeof(size_t); - if(H5S_encode(space, buf_ptr, &space_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace") - buf_ptr += space_size; - break; - case H5I_DATATYPE: - HDmemcpy(buf_ptr, &dt_size, sizeof(size_t)); - buf_ptr += sizeof(size_t); - if(H5T_encode(dt, buf_ptr, &dt_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") - buf_ptr += dt_size; - break; - case H5I_MAP: - HDmemcpy(buf_ptr, &keytype_size, sizeof(size_t)); - buf_ptr += sizeof(size_t); - if(H5T_encode(kt, buf_ptr, &keytype_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") - buf_ptr += keytype_size; - - HDmemcpy(buf_ptr, &valtype_size, sizeof(size_t)); - buf_ptr += sizeof(size_t); - if(H5T_encode(vt, buf_ptr, &valtype_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") - buf_ptr += valtype_size; - 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_ES: - case H5I_RC: - case H5I_TR: - case H5I_QUERY: - 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_SYM, H5E_CANTINIT, FAIL, "bad object"); - } - } + if(H5VL_iod_get_token(obj, token, token_size) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to get object token"); done: FUNC_LEAVE_API(ret_value) @@ -2885,7 +2707,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Oopen_by_addr_ff + * Function: H5Oopen_by_token * * Purpose: This function opens an object using its address within the * HDF5 file, similar to an HDF5 hard link. The open object @@ -2953,7 +2775,7 @@ H5Oopen_by_token(const void *token, hid_t trans_id, hid_t estack_id) done: FUNC_LEAVE_API(ret_value) -} /* end H5Oopen_by_addr_ff() */ +} /* end H5Oopen_by_token() */ /*------------------------------------------------------------------------- diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index a937feb..a058fa0 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -886,7 +886,7 @@ H5P__decode(const void *buf) /* Get the type of the property list */ type = (H5P_plist_type_t)*p++; - if(type <= H5P_TYPE_USER || type > H5P_TYPE_TRANSACTION_FINISH) + if(type <= H5P_TYPE_USER || type > H5P_TYPE_VIEW_CREATE) HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "bad type of encoded information: %u", (unsigned)type) /* Create new property list of the specified type */ diff --git a/src/H5Pint.c b/src/H5Pint.c index cccc5a4..2a1410f 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -128,6 +128,7 @@ hid_t H5P_CLS_STRING_CREATE_g = FAIL; hid_t H5P_CLS_READ_CONTEXT_ACQUIRE_g = FAIL; hid_t H5P_CLS_TRANSACTION_START_g = FAIL; hid_t H5P_CLS_TRANSACTION_FINISH_g = FAIL; +hid_t H5P_CLS_VIEW_CREATE_g = FAIL; /* * Predefined property lists for each predefined class. These are initialized @@ -152,6 +153,7 @@ hid_t H5P_LST_LINK_ACCESS_g = FAIL; hid_t H5P_LST_READ_CONTEXT_ACQUIRE_g = FAIL; hid_t H5P_LST_TRANSACTION_START_g = FAIL; hid_t H5P_LST_TRANSACTION_FINISH_g = FAIL; +hid_t H5P_LST_VIEW_CREATE_g = FAIL; /* Root property list class library initialization object */ const H5P_libclass_t H5P_CLS_ROOT[1] = {{ @@ -239,6 +241,7 @@ H5_DLLVAR const H5P_libclass_t H5P_CLS_LCRT[1]; /* Link creation */ H5_DLLVAR const H5P_libclass_t H5P_CLS_RCACC[1]; /* Read Context acquire */ H5_DLLVAR const H5P_libclass_t H5P_CLS_TRSCC[1]; /* Transaction start */ H5_DLLVAR const H5P_libclass_t H5P_CLS_TRFCC[1]; /* Transaction finish */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_VCRT[1]; /* View create */ /*****************************/ /* Library Private Variables */ @@ -279,6 +282,7 @@ static H5P_libclass_t const * const init_class[] = { H5P_CLS_RCACC, /* Read Context acquire */ H5P_CLS_TRSCC, /* Transaction start */ H5P_CLS_TRFCC, /* Transaction finish */ + H5P_CLS_VCRT, /* View create */ H5P_CLS_LCRT /* Link creation */ }; @@ -603,6 +607,7 @@ H5P_term_interface(void) H5P_LST_READ_CONTEXT_ACQUIRE_g = H5P_LST_TRANSACTION_START_g = H5P_LST_TRANSACTION_FINISH_g = + H5P_LST_VIEW_CREATE_g = H5P_LST_FILE_MOUNT_g = (-1); } /* end if */ } /* end if */ @@ -634,6 +639,7 @@ H5P_term_interface(void) H5P_CLS_READ_CONTEXT_ACQUIRE_g = H5P_CLS_TRANSACTION_START_g = H5P_CLS_TRANSACTION_FINISH_g = + H5P_CLS_VIEW_CREATE_g = H5P_CLS_FILE_MOUNT_g = (-1); } /* end if */ } /* end if */ @@ -5082,8 +5088,8 @@ H5P__new_plist_of_type(H5P_plist_type_t type) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDcompile_assert(H5P_TYPE_TRANSACTION_FINISH == (H5P_TYPE_MAX_TYPE - 1)); - HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_TRANSACTION_FINISH); + HDcompile_assert(H5P_TYPE_VIEW_CREATE == (H5P_TYPE_MAX_TYPE - 1)); + HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_VIEW_CREATE); /* Check arguments */ if(type == H5P_TYPE_USER) @@ -5177,6 +5183,10 @@ H5P__new_plist_of_type(H5P_plist_type_t type) class_id = H5P_CLS_TRANSACTION_FINISH_g; break; + case H5P_TYPE_VIEW_CREATE: + class_id = H5P_CLS_VIEW_CREATE_g; + break; + case H5P_TYPE_USER: /* shut compiler warnings up */ case H5P_TYPE_ROOT: case H5P_TYPE_MAX_TYPE: diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 2d78d5c..8774923 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -71,8 +71,9 @@ typedef enum H5P_plist_type_t { H5P_TYPE_MAP_CREATE = 18, H5P_TYPE_MAP_ACCESS = 19, H5P_TYPE_READ_CONTEXT_ACQUIRE = 20, - H5P_TYPE_TRANSACTION_START = 21, - H5P_TYPE_TRANSACTION_FINISH = 22, + H5P_TYPE_TRANSACTION_START = 21, + H5P_TYPE_TRANSACTION_FINISH = 22, + H5P_TYPE_VIEW_CREATE = 23, H5P_TYPE_MAX_TYPE } H5P_plist_type_t; diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 6ff9fca..cd49237 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -74,6 +74,7 @@ #define H5P_RC_ACQUIRE (H5OPEN H5P_CLS_READ_CONTEXT_ACQUIRE_g) #define H5P_TR_START (H5OPEN H5P_CLS_TRANSACTION_START_g) #define H5P_TR_FINISH (H5OPEN H5P_CLS_TRANSACTION_FINISH_g) +#define H5P_VIEW_CREATE (H5OPEN H5P_CLS_VIEW_CREATE_g) /* * The library's default property lists @@ -97,6 +98,7 @@ #define H5P_RC_ACQUIRE_DEFAULT (H5OPEN H5P_LST_READ_CONTEXT_ACQUIRE_g) #define H5P_TR_START_DEFAULT (H5OPEN H5P_LST_TRANSACTION_START_g) #define H5P_TR_FINISH_DEFAULT (H5OPEN H5P_LST_TRANSACTION_FINISH_g) +#define H5P_VIEW_CREATE_DEFAULT (H5OPEN H5P_LST_VIEW_CREATE_g) /* Common creation order flags (for links in groups and attributes on objects) */ #define H5P_CRT_ORDER_TRACKED 0x0001 @@ -205,6 +207,7 @@ H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_g; H5_DLLVAR hid_t H5P_CLS_READ_CONTEXT_ACQUIRE_g; H5_DLLVAR hid_t H5P_CLS_TRANSACTION_START_g; H5_DLLVAR hid_t H5P_CLS_TRANSACTION_FINISH_g; +H5_DLLVAR hid_t H5P_CLS_VIEW_CREATE_g; /* Default roperty list IDs */ /* (Internal to library, do not use! Use macros above) */ @@ -227,6 +230,7 @@ H5_DLLVAR hid_t H5P_LST_LINK_ACCESS_g; H5_DLLVAR hid_t H5P_LST_READ_CONTEXT_ACQUIRE_g; H5_DLLVAR hid_t H5P_LST_TRANSACTION_START_g; H5_DLLVAR hid_t H5P_LST_TRANSACTION_FINISH_g; +H5_DLLVAR hid_t H5P_LST_VIEW_CREATE_g; /*********************/ /* Public Prototypes */ diff --git a/src/H5Pvcpl.c b/src/H5Pvcpl.c new file mode 100644 index 0000000..7073112 --- /dev/null +++ b/src/H5Pvcpl.c @@ -0,0 +1,413 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5Pvcpl.c + * February 2014 + * Mohamad Chaarawi <chaarawi@hdfgroup.org> + * + * Purpose: View creation property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ +#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Sprivate.h" /* Dataspaces */ +#include "H5Vprivate.h" /* Views */ +#include "H5Ppkg.h" /* Property lists */ + + +/****************/ +/* Local Macros */ +/****************/ + +/* ======== View creation properties ======== */ +/* Definitions for create intermediate groups flag */ +#define H5V_CRT_ELMT_SCOPE_SIZE sizeof(unsigned) +#define H5V_CRT_ELMT_SCOPE_DEF -1 +#define H5V_CRT_ELMT_SCOPE_ENC H5P_vcrt_elmt_scope_enc +#define H5V_CRT_ELMT_SCOPE_DEC H5P_vcrt_elmt_scope_dec +#define H5V_CRT_ELMT_SCOPE_DEL H5P_vcrt_elmt_scope_del +#define H5V_CRT_ELMT_SCOPE_COPY H5P_vcrt_elmt_scope_copy +#define H5V_CRT_ELMT_SCOPE_CMP H5P_vcrt_elmt_scope_cmp +#define H5V_CRT_ELMT_SCOPE_CLOSE H5P_vcrt_elmt_scope_close + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Property class callbacks */ +static herr_t H5P_vcrt_reg_prop(H5P_genclass_t *pclass); + +static herr_t H5P_vcrt_elmt_scope_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P_vcrt_elmt_scope_dec(const void **_pp, void *value); +static herr_t H5P_vcrt_elmt_scope_del(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P_vcrt_elmt_scope_copy(const char* name, size_t size, void* value); +static int H5P_vcrt_elmt_scope_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P_vcrt_elmt_scope_close(const char* name, size_t size, void* value); + +/*********************/ +/* Package Variables */ +/*********************/ + +/* View creation property list class library initialization object */ +const H5P_libclass_t H5P_CLS_VCRT[1] = {{ + "view create", /* Class name for debugging */ + H5P_TYPE_VIEW_CREATE, /* Class type */ + &H5P_CLS_STRING_CREATE_g, /* Parent class ID */ + &H5P_CLS_VIEW_CREATE_g, /* Pointer to class ID */ + &H5P_LST_VIEW_CREATE_g, /* Pointer to default property list ID */ + H5P_vcrt_reg_prop, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Property value defaults */ +static const hid_t H5V_def_elmt_scope_g = H5V_CRT_ELMT_SCOPE_DEF; /* Default setting for creating intermediate groups */ + + + +/*------------------------------------------------------------------------- + * Function: H5P_vcrt_reg_prop + * + * Purpose: Register the dataset creation property list class's properties + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * October 31, 2006 + *------------------------------------------------------------------------- + */ +herr_t +H5P_vcrt_reg_prop(H5P_genclass_t *pclass) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Register elmt region dataspace scope */ + if(H5P_register_real(pclass, H5V_CRT_ELMT_SCOPE_NAME, H5V_CRT_ELMT_SCOPE_SIZE, &H5V_def_elmt_scope_g, + NULL, NULL, NULL, H5V_CRT_ELMT_SCOPE_ENC, H5V_CRT_ELMT_SCOPE_DEC, + H5V_CRT_ELMT_SCOPE_DEL, H5V_CRT_ELMT_SCOPE_COPY, H5V_CRT_ELMT_SCOPE_CMP, H5V_CRT_ELMT_SCOPE_CLOSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_vcrt_reg_prop() */ + + +/*-------------------------------------------------------------------------- + * Function: H5P_vcrt_elmt_scope_del + * + * Purpose: Close the dataspace for vcpl + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *-------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_vcrt_elmt_scope_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value) +{ + hid_t space_id; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(value); + + space_id = (*(const hid_t *)value); + + if((space_id >= 0) && (H5I_dec_ref(space_id) < 0)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for dataspace scope") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_vcrt_elmt_scope_del() */ + + +/*-------------------------------------------------------------------------- + * Function: H5P_vcrt_elmt_scope_copy + * + * Purpose: Copy the dataspace + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *-------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_vcrt_elmt_scope_copy(const char UNUSED *name, size_t UNUSED size, void *value) +{ + hid_t space_id; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(value); + + space_id = (*(const hid_t *)value); + + if(space_id > H5P_DEFAULT) { + H5S_t *space = NULL, *new_space = NULL; + + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataspace") + + /* Copy */ + if(NULL == (new_space = H5S_copy(space, FALSE, TRUE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace") + + /* Atomize */ + if(((*(hid_t *)value) = H5I_register (H5I_DATASPACE, new_space, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_vcrt_elmt_scope_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_vcrt_elmt_scope_cmp + * + * Purpose: Callback routine which is called whenever the elmt dataspace + * region property in the vcpl + * + * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *------------------------------------------------------------------------- + */ +static int +H5P_vcrt_elmt_scope_cmp(const void *value1, const void *value2, size_t UNUSED size) +{ + const hid_t *space1_id = (const hid_t *)value1; + const hid_t *space2_id = (const hid_t *)value2; + H5S_t *ds1 = NULL, *ds2 = NULL; + htri_t result; + int ret_value = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* check args */ + if(NULL == (ds1 = (H5S_t *)H5I_object_verify(*space1_id, H5I_DATASPACE)) || + NULL == (ds2 = (H5S_t *)H5I_object_verify(*space2_id, H5I_DATASPACE))) + HGOTO_DONE(-1); + + /* Check dataspaces for extent's equality */ + if((result = H5S_extent_equal(ds1, ds2)) < 0) + HGOTO_DONE(-1); + + if(TRUE == result) + ret_value = 0; + else + ret_value = -1; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_vcrt_elmt_scope_cmp() */ + + +/*-------------------------------------------------------------------------- + * Function: H5P_vcrt_elmt_scope_close + * + * Purpose: Close the dataspace for vcpl + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *-------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_vcrt_elmt_scope_close(const char UNUSED *name, size_t UNUSED size, void *value) +{ + hid_t space_id; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(value); + + space_id = (*(const hid_t *)value); + + if((space_id >= 0) && (H5I_dec_ref(space_id) < 0)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for dataspace scope") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_vcrt_elmt_scope_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_vcrt_elmt_scope_enc + * + * Purpose: Callback routine which is called whenever the dataspace scope + * property in the vcpl is encoded + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P_vcrt_elmt_scope_enc(const void *value, void **_pp, size_t *size) +{ + const hid_t *space_id = (const hid_t *)value; /* Property to encode */ + uint8_t **pp = (uint8_t **)_pp; + H5S_t *space; + hbool_t non_default_space = FALSE; /* Whether the FAPL is non-default */ + size_t enc_size = 0; /* FAPL's encoded size */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Check for non-default FAPL */ + if(*space_id != -1) { + if(NULL == (space = (H5S_t *)H5I_object_verify(*space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get dataspace") + non_default_space = TRUE; + } /* end if */ + + if(NULL != *pp) { + /* Store whether the FAPL is non-default */ + *(*pp)++ = (uint8_t)non_default_space; + } /* end if */ + + /* Encode the property list, if non-default */ + /* (if *pp == NULL, will only compute the size) */ + if(non_default_space) { + if(H5S_encode(space, *pp, &enc_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode dataspace") + if(*pp) + *pp += enc_size; + } /* end if */ + + *size += (1 + enc_size); /* Non-default flag, plus encoded property list size */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_vcrt_elmt_scope_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_vcrt_elmt_scope_dec + * + * Purpose: Callback routine which is called whenever the dataspace scope + * property in the vcpl is decoded + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P_vcrt_elmt_scope_dec(const void **_pp, void *_value) +{ + hid_t *space_id = (hid_t *)_value; /* The elink FAPL value */ + const uint8_t **pp = (const uint8_t **)_pp; + hbool_t non_default_space; /* Whether the FAPL is non-default */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(pp); + HDassert(*pp); + HDassert(space_id); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* Determine if the FAPL is non-default */ + non_default_space = (hbool_t)*(*pp)++; + + if(non_default_space) { + H5S_t *space; /* Pointer to property list */ + size_t enc_size = 0; /* Encoded size of property list */ + + /* Decode the property list */ + if(NULL == (space = H5S_decode(*pp))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode dataspace") + + /* Register the type and return the ID */ + if((*space_id = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, FAIL, "unable to register dataspace") + + /* Compute the encoded size of the property list */ + if(H5S_encode(space, NULL, &enc_size) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't compute encoded property list size") + + *pp += enc_size; + } /* end if */ + else + *space_id = -1; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_vcrt_elmt_scope_dec() */ @@ -984,7 +984,7 @@ H5Q_apply_link_name(H5Q_t *query, hbool_t *result, const char *name) herr_t H5Qencode(hid_t query_id, void *buf, size_t *nalloc) { - H5Q_t *query; + H5Q_t *query = NULL; herr_t ret_value; FUNC_ENTER_API(FAIL) diff --git a/src/H5V.c b/src/H5V.c new file mode 100644 index 0000000..17f5281 --- /dev/null +++ b/src/H5V.c @@ -0,0 +1,659 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/****************/ +/* Module Setup */ +/****************/ + +/* Interface initialization */ +#define H5_INTERFACE_INIT_FUNC H5V_init_interface + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5ESprivate.h" /* Event Stacks */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5VMprivate.h" /* Memory management */ +#include "H5Vprivate.h" /* Views */ +#include "H5VLprivate.h" /* VOL plugins */ +#include "H5VLiod_client.h" /* IOD VOL plugin */ + +#ifdef H5_HAVE_EFF + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + +/* VIEW ID class */ +static const H5I_class_t H5I_VIEW_CLS[1] = {{ + H5I_VIEW, /* ID class value */ + 0, /* Class flags */ + 0, /* # of reserved IDs for class */ + (H5I_free_t)H5V_close, /* Callback routine for closing objects of this class */ + NULL /* Callback routine for closing auxilary objects of this class */ +}}; + + +/*------------------------------------------------------------------------- + * Function: H5V_init + * + * Purpose: Initialize the interface from some other package. + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * July 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5V_init(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + /* FUNC_ENTER() does all the work */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5V_init() */ + + +/*-------------------------------------------------------------------------- +NAME + H5V_init_interface -- Initialize interface-specific information +USAGE + herr_t H5V_init_interface() + +RETURNS + Non-negative on success/Negative on failure +DESCRIPTION + Initializes any interface-specific data or routines. + +--------------------------------------------------------------------------*/ +static herr_t +H5V_init_interface(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* + * Create attribute ID type. + */ + if(H5I_register_type(H5I_VIEW_CLS) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5V_init_interface() */ + + +/*-------------------------------------------------------------------------- + NAME + H5V_term_interface + PURPOSE + Terminate various H5V objects + USAGE + void H5V_term_interface() + RETURNS + DESCRIPTION + Release any other resources allocated. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + Can't report errors... + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +int +H5V_term_interface(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(H5_interface_initialize_g) { + if((n = H5I_nmembers(H5I_VIEW))>0) { + (void)H5I_clear_type(H5I_VIEW, FALSE, FALSE); + } else { + (void)H5I_dec_type_ref(H5I_VIEW); + H5_interface_initialize_g = 0; + n = 1; + } + } + FUNC_LEAVE_NOAPI(n) +} /* H5V_term_interface() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_view_elmt_scope + * + * Purpose: Sets the view creation property for the scope of + * constructing an element region. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * February, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_view_elmt_scope(hid_t vcpl_id, hid_t space_id) +{ + H5P_genplist_t *plist; + H5S_t *space = NULL, *new_space = NULL; + hid_t new_space_id; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ii", vcpl_id, space_id); + + /* Check arguments */ + if(NULL == (plist = H5P_object_verify(vcpl_id, H5P_VIEW_CREATE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a view create property list"); + + /* Get the current view create property list for the region scope */ + if(H5P_get(plist, H5V_CRT_ELMT_SCOPE_NAME, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get dataspace") + + /* Close the current dataspace if set */ + if((space_id != -1) && (H5I_dec_ref(space_id) < 0)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close atom for dataspace") + + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataspace") + + /* Copy */ + if(NULL == (new_space = H5S_copy(space, FALSE, TRUE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace") + + /* Atomize */ + if((new_space_id = H5I_register (H5I_DATASPACE, new_space, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") + + /* Set the view create property list for the region scope */ + if(H5P_set(plist, H5V_CRT_ELMT_SCOPE_NAME, &new_space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set dataspace scope for vcpl") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_view_elmt_scope() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_view_elmt_scope + * + * Purpose: Gets the view creation property for the scope of + * constructing an element region. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * February, 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_view_elmt_scope(hid_t vcpl_id, hid_t *_space_id) +{ + H5P_genplist_t *plist; /* Property list pointer */ + hid_t space_id; + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*i", vcpl_id, _space_id); + + if(NULL == _space_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid return pointer") + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(vcpl_id, H5P_VIEW_CREATE))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + if(H5P_get(plist, H5V_CRT_ELMT_SCOPE_NAME, &space_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get dataspace scope for view") + + if(space_id >= 0) { + H5S_t *space = NULL, *new_space = NULL; + + if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataspace") + + /* Copy */ + if(NULL == (new_space = H5S_copy(space, FALSE, TRUE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace") + + /* Atomize */ + if((space_id = H5I_register (H5I_DATASPACE, new_space, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom") + } + + *_space_id = space_id; + +done: + FUNC_LEAVE_API(ret_value); +} /* end H5Pget_view_elmt_scope() */ + + +/*------------------------------------------------------------------------- + * Function: H5Vcreate_ff + * + * Purpose: The H5Vcreate routine creates a new view object from a + * query object. The view looks under loc_id and applies + * the query there. + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *------------------------------------------------------------------------- + */ +hid_t +H5Vcreate_ff(hid_t loc_id, hid_t query_id, hid_t vcpl_id, hid_t rcxt_id, hid_t estack_id) +{ + H5_priv_request_t *request = NULL; /* private request struct inserted in event queue */ + void **req = NULL; /* pointer to plugin generate requests (Stays NULL if plugin does not support async */ + void *view = NULL; /* pointer to view object created */ + void *obj = NULL; /* object token of loc_id */ + H5VL_t *vol_plugin; /* VOL plugin information */ + hid_t ret_value; + + FUNC_ENTER_API(FAIL) + H5TRACE5("i", "iiiii", loc_id, query_id, vcpl_id, rcxt_id, estack_id); + + /* Get correct property list */ + if(H5P_DEFAULT == vcpl_id) + vcpl_id = H5P_VIEW_CREATE_DEFAULT; + else + if(TRUE != H5P_isa_class(vcpl_id, H5P_VIEW_CREATE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not view creation property list") + + /* get the object */ + if(NULL == (obj = (void *)H5VL_get_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object/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") + + if(vol_plugin->cls->value != IOD) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "only IOD plugin supports VIEW objects for now") + + if(estack_id != H5_EVENT_STACK_NULL) { + /* create the private request */ + if(NULL == (request = (H5_priv_request_t *)H5MM_calloc(sizeof(H5_priv_request_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + request->req = NULL; + req = &request->req; + request->next = NULL; + request->vol_plugin = vol_plugin; + vol_plugin->nrefs ++; + } + + /* call the IOD specific private routine to create a view object */ + if(NULL == (view = H5VL_iod_view_create(obj, query_id, vcpl_id, rcxt_id, req))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create view") + + if(request && *req) { + if(H5ES_insert(estack_id, request) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to insert request in event stack") + } + + /* Get an atom for the view */ + if((ret_value = H5I_register2(H5I_VIEW, view, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize view handle") + +done: + if (ret_value < 0 && view) + if(H5V_close (view) < 0) + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release view") + FUNC_LEAVE_API(ret_value) +} /* end H5Vcreate_ff */ + + +/*------------------------------------------------------------------------- + * Function: H5Vget_query + * + * Purpose: Returns the query used to construct the view. + * Returned query must be closed with H5Qclose(). + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Vget_query(hid_t view_id, hid_t *query_id) +{ + H5VL_iod_view_t *view = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(NULL == query_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid return pointer") + + /* Check args */ + if(NULL == (view = (H5VL_iod_view_t *)H5I_object_verify(view_id, H5I_VIEW))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an view ID"); + + if(H5I_inc_ref(view->query_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count"); + + *query_id = view->query_id; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Vget_query */ + + +/*------------------------------------------------------------------------- + * Function: H5Vget_counts + * + * Purpose: Returns the query used to construct the view. + * Returned query must be closed with H5Qclose(). + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Vget_counts(hid_t view_id, hsize_t *attr_count, hsize_t *obj_count, hsize_t *elem_region_count) +{ + H5VL_iod_view_t *view = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + /* Check args */ + if(NULL == (view = (H5VL_iod_view_t *)H5I_object_verify(view_id, H5I_VIEW))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an view ID"); + + if(NULL != attr_count) + *attr_count = view->attr_info.count; + if(NULL != obj_count) + *obj_count = view->obj_info.count; + if(NULL != elem_region_count) + *elem_region_count = view->region_info.count; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Vget_counts */ + + +/*------------------------------------------------------------------------- + * Function: H5Vget_location_ff + * + * Purpose: Returns the root location where the view was constructed on. + * Musr be closed with H5Oclose (or corresponding object close op). + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Vget_location_ff(hid_t view_id, hid_t *loc_id, hid_t estack_id) +{ + H5VL_t *vol_plugin = NULL; /* VOL plugin pointer this event queue should use */ + H5_priv_request_t *request = NULL; /* private request struct inserted in event queue */ + void **req = NULL; /* pointer to plugin generate requests (Stays NULL if plugin does not support async */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5VL_iod_view_t *view = NULL; + H5TR_t tr; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + if(NULL == loc_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid return pointer") + + /* Check args */ + if(NULL == (view = (H5VL_iod_view_t *)H5I_object_verify(view_id, H5I_VIEW))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an view ID"); + + /* get the plugin pointer */ + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(view_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information"); + + if(estack_id != H5_EVENT_STACK_NULL) { + /* create the private request */ + if(NULL == (request = (H5_priv_request_t *)H5MM_calloc(sizeof(H5_priv_request_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + request->req = NULL; + req = &request->req; + request->next = NULL; + request->vol_plugin = vol_plugin; + vol_plugin->nrefs ++; + } + + tr.file = view->file; + tr.trans_num = view->c_version; + + if(NULL == (opened_obj = H5VL_iod_obj_open_token(view->loc_info.buf, + &tr, &opened_type, req))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open object"); + + if(request && *req) { + /* insert in stack */ + if(H5ES_insert(estack_id, request) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to insert request in event stack"); + } + + vol_plugin->nrefs ++; + /* create hid_t for opened object */ + if ((*loc_id = 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 H5Vget_location_ff */ + + +/*------------------------------------------------------------------------- + * Function: H5Vget_elem_regions_ff + * + * Purpose: Returns the root location where the view was constructed on. + * Musr be closed with H5Oclose (or corresponding object close op). + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Vget_elem_regions_ff(hid_t view_id, hsize_t start, hsize_t count, hid_t dataset_id[], + hid_t dataspace_id[], hid_t estack_id) +{ + H5VL_t *vol_plugin = NULL; /* VOL plugin pointer this event queue should use */ + H5VL_iod_view_t *view = NULL; + hsize_t i, k = 0; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + + /* Check args */ + if(NULL == (view = (H5VL_iod_view_t *)H5I_object_verify(view_id, H5I_VIEW))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an view ID"); + + if(start >= view->region_info.count || start+count > view->region_info.count) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "start/count out of range") + + /* get the plugin pointer */ + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(view_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information"); + + for(i=start; i<count; i++) { + H5_priv_request_t *request = NULL; /* private request struct inserted in event queue */ + void **req = NULL; /* pointer to plugin generate requests (Stays NULL if plugin does not support async */ + H5I_type_t opened_type; + void *opened_obj = NULL; + H5TR_t tr; + + if(estack_id != H5_EVENT_STACK_NULL) { + /* create the private request */ + if(NULL == (request = (H5_priv_request_t *)H5MM_calloc(sizeof(H5_priv_request_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + request->req = NULL; + req = &request->req; + request->next = NULL; + request->vol_plugin = vol_plugin; + vol_plugin->nrefs ++; + } + + tr.file = view->file; + tr.trans_num = view->c_version; + + if(NULL == (opened_obj = H5VL_iod_obj_open_token(view->region_info.tokens[i].buf, + &tr, &opened_type, req))) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open object"); + + HDassert(H5I_DATASET == opened_type); + + if(request && *req) { + /* insert in stack */ + if(H5ES_insert(estack_id, request) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "failed to insert request in event stack"); + } + + vol_plugin->nrefs ++; + /* create hid_t for opened object */ + if ((dataset_id[k] = H5VL_object_register(opened_obj, opened_type, vol_plugin, TRUE)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize object handle"); + + if(H5I_inc_ref(view->region_info.regions[i], TRUE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, FAIL, "can't increment ID ref count"); + dataspace_id[k] = view->region_info.regions[i]; + + k++; + } +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Vget_elem_regions_ff */ + + +/*------------------------------------------------------------------------- + * Function: H5Vclose + * + * Purpose: + * The H5Vclose routine terminates access to a view, given by + * view_id. + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Vclose(hid_t view_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "i", view_id); + + /* Check args */ + if(NULL == H5I_object_verify(view_id,H5I_VIEW)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an view ID") + + if(H5I_dec_app_ref(view_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close view") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Vclose_ff */ + + +/*------------------------------------------------------------------------- + * Function: H5V_close + * + * Purpose: Closes the specified view. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * February 2014 + * + *------------------------------------------------------------------------- + */ +herr_t +H5V_close(void *view) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + if((ret_value = H5VL_iod_view_close((H5VL_iod_view_t *)view)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close view") + +done: + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5V_close() */ + +#endif /* H5_HAVE_EFF */ diff --git a/src/H5VLiod.c b/src/H5VLiod.c index 7308184..1dbd8d0 100644 --- a/src/H5VLiod.c +++ b/src/H5VLiod.c @@ -105,7 +105,7 @@ static hg_id_t H5VL_TR_ABORT_ID; static hg_id_t H5VL_PREFETCH_ID; static hg_id_t H5VL_EVICT_ID; static hg_id_t H5VL_CANCEL_OP_ID; - +static hg_id_t H5VL_VIEW_CREATE_ID; /* global AXE list struct */ typedef struct H5VL_iod_axe_list_t { @@ -770,6 +770,8 @@ EFF_init(MPI_Comm comm, MPI_Info UNUSED info) H5VL_PREFETCH_ID = MERCURY_REGISTER("prefetch", prefetch_in_t, hrpl_t); H5VL_EVICT_ID = MERCURY_REGISTER("evict", evict_in_t, ret_t); + H5VL_VIEW_CREATE_ID = MERCURY_REGISTER("view_create", view_create_in_t, view_create_out_t); + H5VL_CANCEL_OP_ID = MERCURY_REGISTER("cancel_op", uint64_t, uint8_t); /* forward the init call to the ION and wait for its completion */ @@ -6408,6 +6410,214 @@ done: FUNC_LEAVE_NOAPI(ret_value) }/* end H5VL_iod_obj_open_token() */ +/*------------------------------------------------------------------------- + * Function: H5VL_iod_get_token + * + * Purpose: Private version of H5Oget_token. + * + * Return: Success: Non-negative with the link value in BUF. + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * August 2013 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_iod_get_token(void *_obj, void *token, size_t *token_size) +{ + H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; + iod_obj_id_t iod_id, mdkv_id, attrkv_id; + H5O_type_t type; + uint8_t *buf_ptr = (uint8_t *)token; + size_t dt_size = 0, space_size = 0; + H5T_t *dt = NULL; + H5S_t *space = NULL; + size_t keytype_size = 0, valtype_size; + H5T_t *kt = NULL, *vt = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + *token_size = sizeof(iod_obj_id_t)*3 + sizeof(H5O_type_t); + + switch(obj->obj_type) { + case H5I_GROUP: + iod_id = ((const H5VL_iod_group_t *)obj)->remote_group.iod_id; + mdkv_id = ((const H5VL_iod_group_t *)obj)->remote_group.mdkv_id; + attrkv_id = ((const H5VL_iod_group_t *)obj)->remote_group.attrkv_id; + type = H5O_TYPE_GROUP; + break; + case H5I_DATASET: + { + H5VL_iod_dset_t *dset = (H5VL_iod_dset_t *)obj; + + iod_id = dset->remote_dset.iod_id; + mdkv_id = dset->remote_dset.mdkv_id; + attrkv_id = dset->remote_dset.attrkv_id; + type = H5O_TYPE_DATASET; + + if(NULL == (dt = (H5T_t *)H5I_object_verify(dset->remote_dset.type_id, + H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a datatype") + if(NULL == (space = (H5S_t *)H5I_object_verify(dset->remote_dset.space_id, + H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a dataspace") + + if(H5T_encode(dt, NULL, &dt_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + + if(H5S_encode(space, NULL, &space_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace") + + *token_size += dt_size + space_size + sizeof(size_t)*2; + + break; + } + case H5I_DATATYPE: + { + H5VL_iod_dtype_t *dtype = (H5VL_iod_dtype_t *)obj; + + iod_id = dtype->remote_dtype.iod_id; + mdkv_id = dtype->remote_dtype.mdkv_id; + attrkv_id = dtype->remote_dtype.attrkv_id; + type = H5O_TYPE_NAMED_DATATYPE; + + if(NULL == (dt = (H5T_t *)H5I_object_verify(dtype->remote_dtype.type_id, + H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a datatype") + + if(H5T_encode(dt, NULL, &dt_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + + *token_size += dt_size + sizeof(size_t); + + break; + } + case H5I_MAP: + { + H5VL_iod_map_t *map = (H5VL_iod_map_t *)obj; + + iod_id = map->remote_map.iod_id; + mdkv_id = map->remote_map.mdkv_id; + attrkv_id = map->remote_map.attrkv_id; + type = H5O_TYPE_MAP; + + if(NULL == (kt = (H5T_t *)H5I_object_verify(map->remote_map.keytype_id, + H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a datatype") + + if(H5T_encode(kt, NULL, &keytype_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + + if(NULL == (vt = (H5T_t *)H5I_object_verify(map->remote_map.valtype_id, + H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a datatype") + + if(H5T_encode(vt, NULL, &valtype_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + + *token_size += keytype_size + valtype_size + sizeof(size_t)*2; + + 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_ES: + case H5I_RC: + case H5I_TR: + case H5I_QUERY: + case H5I_VIEW: + 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_SYM, H5E_CANTINIT, FAIL, "bad object"); + } + + if(token) { + HDmemcpy(buf_ptr, &iod_id, sizeof(iod_obj_id_t)); + buf_ptr += sizeof(iod_obj_id_t); + HDmemcpy(buf_ptr, &mdkv_id, sizeof(iod_obj_id_t)); + buf_ptr += sizeof(iod_obj_id_t); + HDmemcpy(buf_ptr, &attrkv_id, sizeof(iod_obj_id_t)); + buf_ptr += sizeof(iod_obj_id_t); + HDmemcpy(buf_ptr, &type, sizeof(H5O_type_t)); + buf_ptr += sizeof(H5O_type_t); + + switch(obj->obj_type) { + case H5I_GROUP: + break; + case H5I_DATASET: + HDmemcpy(buf_ptr, &dt_size, sizeof(size_t)); + buf_ptr += sizeof(size_t); + if(H5T_encode(dt, buf_ptr, &dt_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + buf_ptr += dt_size; + + HDmemcpy(buf_ptr, &space_size, sizeof(size_t)); + buf_ptr += sizeof(size_t); + if(H5S_encode(space, buf_ptr, &space_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace") + buf_ptr += space_size; + break; + case H5I_DATATYPE: + HDmemcpy(buf_ptr, &dt_size, sizeof(size_t)); + buf_ptr += sizeof(size_t); + if(H5T_encode(dt, buf_ptr, &dt_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + buf_ptr += dt_size; + break; + case H5I_MAP: + HDmemcpy(buf_ptr, &keytype_size, sizeof(size_t)); + buf_ptr += sizeof(size_t); + if(H5T_encode(kt, buf_ptr, &keytype_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + buf_ptr += keytype_size; + + HDmemcpy(buf_ptr, &valtype_size, sizeof(size_t)); + buf_ptr += sizeof(size_t); + if(H5T_encode(vt, buf_ptr, &valtype_size) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + buf_ptr += valtype_size; + 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_ES: + case H5I_RC: + case H5I_TR: + case H5I_QUERY: + case H5I_VIEW: + 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_SYM, H5E_CANTINIT, FAIL, "bad object"); + } + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_iod_get_token() */ + /*------------------------------------------------------------------------- * Function: H5VL_iod_object_open @@ -6803,6 +7013,363 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_object_open */ +#if 0 + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_object_open_by_addr + * + * Purpose: Opens a object inside IOD file. + * + * Return: Success: object id. + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * February, 2014 + * + *------------------------------------------------------------------------- + */ +static void * +H5VL_iod_object_open_by_addr(void *_obj, iod_obj_id_t iod_id, H5I_type_t obj_type, + hid_t rcxt_id, void **req) +{ + H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; /* location object to open the group */ + H5RC_t *rc = NULL; + size_t num_parents = 0; + char *loc_name = NULL; + object_open_by_addr_in_t input; + object_open_by_addr_out_t output; + H5VL_iod_remote_object_t remote_obj; /* generic remote object structure */ + H5VL_iod_dset_t *dset = NULL; /* the dataset object that is created and passed to the user */ + H5VL_iod_attr_t *attr = NULL; /* the attribute object that is created and passed to the user */ + H5VL_iod_dtype_t *dtype = NULL; /* the datatype object that is created and passed to the user */ + H5VL_iod_group_t *grp = NULL; /* the group object that is created and passed to the user */ + H5VL_iod_map_t *map = NULL; /* the map object that is created and passed to the user */ + H5VL_iod_request_t **parent_reqs = NULL; + void *ret_value; + + FUNC_ENTER_NOAPI_NOINIT + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a READ CONTEXT ID") + + /* set the input structure for the HG encode routine */ + input.coh = obj->file->remote_file.coh; + input.rcxt_num = rc->c_version; + input.cs_scope = obj->file->md_integrity_scope; + input.iod_id = iod_id; + + switch(obj_type) { + case H5I_DATASET: + /* allocate the dataset object that is returned to the user */ + if(NULL == (dset = H5FL_CALLOC(H5VL_iod_dset_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + + dset->remote_dset.iod_oh.rd_oh.cookie = remote_obj.iod_oh.rd_oh.cookie; + dset->remote_dset.iod_oh.wr_oh.cookie = remote_obj.iod_oh.wr_oh.cookie; + dset->remote_dset.iod_id = remote_obj.iod_id; + dset->remote_dset.mdkv_id = remote_obj.mdkv_id; + dset->remote_dset.attrkv_id = remote_obj.attrkv_id; + dset->remote_dset.dcpl_id = remote_obj.cpl_id; + dset->remote_dset.type_id = remote_obj.id1; + dset->remote_dset.space_id = remote_obj.id2; + + if(dset->remote_dset.dcpl_id == H5P_DEFAULT){ + dset->remote_dset.dcpl_id = H5Pcopy(H5P_DATASET_CREATE_DEFAULT); + } + + HDassert(dset->remote_dset.dcpl_id); + HDassert(dset->remote_dset.type_id); + HDassert(dset->remote_dset.space_id); + + /* setup the local dataset struct */ + /* store the entire path of the dataset locally */ + if(obj->obj_name) { + size_t obj_name_len = HDstrlen(obj->obj_name); + size_t name_len = HDstrlen(loc_params.loc_data.loc_by_name.name); + + if (NULL == (dset->common.obj_name = (char *)HDmalloc(obj_name_len + name_len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate"); + HDmemcpy(dset->common.obj_name, obj->obj_name, obj_name_len); + HDmemcpy(dset->common.obj_name+obj_name_len, + loc_params.loc_data.loc_by_name.name, name_len); + dset->common.obj_name[obj_name_len+name_len] = '\0'; + } + + if((dset->dapl_id = H5Pcopy(H5P_DATASET_CREATE_DEFAULT)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "failed to copy dapl"); + + /* set common object parameters */ + dset->common.obj_type = H5I_DATASET; + dset->common.file = obj->file; + dset->common.file->nopen_objs ++; + + ret_value = (void *)dset; + break; + case H5I_DATATYPE: + /* allocate the dataset object that is returned to the user */ + if(NULL == (dtype = H5FL_CALLOC(H5VL_iod_dtype_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + + dtype->remote_dtype.iod_oh.rd_oh.cookie = remote_obj.iod_oh.rd_oh.cookie; + dtype->remote_dtype.iod_oh.wr_oh.cookie = remote_obj.iod_oh.wr_oh.cookie; + dtype->remote_dtype.iod_id = remote_obj.iod_id; + dtype->remote_dtype.mdkv_id = remote_obj.mdkv_id; + dtype->remote_dtype.attrkv_id = remote_obj.attrkv_id; + dtype->remote_dtype.tcpl_id = remote_obj.cpl_id; + dtype->remote_dtype.type_id = remote_obj.id1; + + if(dtype->remote_dtype.tcpl_id == H5P_DEFAULT){ + dtype->remote_dtype.tcpl_id = H5Pcopy(H5P_DATATYPE_CREATE_DEFAULT); + } + + HDassert(dtype->remote_dtype.tcpl_id); + HDassert(dtype->remote_dtype.type_id); + + /* setup the local dataset struct */ + /* store the entire path of the dataset locally */ + if(obj->obj_name) { + size_t obj_name_len = HDstrlen(obj->obj_name); + size_t name_len = HDstrlen(loc_params.loc_data.loc_by_name.name); + + if (NULL == (dtype->common.obj_name = (char *)HDmalloc + (obj_name_len + name_len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate"); + HDmemcpy(dtype->common.obj_name, obj->obj_name, obj_name_len); + HDmemcpy(dtype->common.obj_name+obj_name_len, + loc_params.loc_data.loc_by_name.name, name_len); + dtype->common.obj_name[obj_name_len+name_len] = '\0'; + } + + if((dtype->tapl_id = H5Pcopy(H5P_DATATYPE_CREATE_DEFAULT)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "failed to copy dapl"); + + /* set common object parameters */ + dtype->common.obj_type = H5I_DATATYPE; + dtype->common.file = obj->file; + dtype->common.file->nopen_objs ++; + + ret_value = (void *)dtype; + break; + case H5I_GROUP: + /* allocate the dataset object that is returned to the user */ + if(NULL == (grp = H5FL_CALLOC(H5VL_iod_group_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + + grp->remote_group.iod_oh.rd_oh.cookie = remote_obj.iod_oh.rd_oh.cookie; + grp->remote_group.iod_oh.wr_oh.cookie = remote_obj.iod_oh.wr_oh.cookie; + grp->remote_group.iod_id = remote_obj.iod_id; + grp->remote_group.mdkv_id = remote_obj.mdkv_id; + grp->remote_group.attrkv_id = remote_obj.attrkv_id; + grp->remote_group.gcpl_id = remote_obj.cpl_id; + + if(grp->remote_group.gcpl_id == H5P_DEFAULT){ + grp->remote_group.gcpl_id = H5Pcopy(H5P_GROUP_CREATE_DEFAULT); + } + + HDassert(grp->remote_group.gcpl_id); + + /* setup the local dataset struct */ + /* store the entire path of the dataset locally */ + if(obj->obj_name) { + size_t obj_name_len = HDstrlen(obj->obj_name); + size_t name_len = HDstrlen(loc_params.loc_data.loc_by_name.name); + + if (NULL == (grp->common.obj_name = (char *)HDmalloc(obj_name_len + name_len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate"); + HDmemcpy(grp->common.obj_name, obj->obj_name, obj_name_len); + HDmemcpy(grp->common.obj_name+obj_name_len, + loc_params.loc_data.loc_by_name.name, name_len); + grp->common.obj_name[obj_name_len+name_len] = '\0'; + } + + if((grp->gapl_id = H5Pcopy(H5P_GROUP_CREATE_DEFAULT)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "failed to copy gapl"); + + /* set common object parameters */ + grp->common.obj_type = H5I_GROUP; + grp->common.file = obj->file; + grp->common.file->nopen_objs ++; + + ret_value = (void *)grp; + break; + case H5I_MAP: + /* allocate the dataset object that is returned to the user */ + if(NULL == (map = H5FL_CALLOC(H5VL_iod_map_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + + map->remote_map.iod_oh.rd_oh.cookie = remote_obj.iod_oh.rd_oh.cookie; + map->remote_map.iod_oh.wr_oh.cookie = remote_obj.iod_oh.wr_oh.cookie; + map->remote_map.iod_id = remote_obj.iod_id; + map->remote_map.mdkv_id = remote_obj.mdkv_id; + map->remote_map.attrkv_id = remote_obj.attrkv_id; + map->remote_map.mcpl_id = remote_obj.cpl_id; + map->remote_map.keytype_id = remote_obj.id1; + map->remote_map.valtype_id = remote_obj.id2; + + if(map->remote_map.mcpl_id == H5P_DEFAULT){ + map->remote_map.mcpl_id = H5Pcopy(H5P_MAP_CREATE_DEFAULT); + } + + /* setup the local dataset struct */ + /* store the entire path of the dataset locally */ + if(obj->obj_name) { + size_t obj_name_len = HDstrlen(obj->obj_name); + size_t name_len = HDstrlen(loc_params.loc_data.loc_by_name.name); + + if (NULL == (map->common.obj_name = (char *)HDmalloc(obj_name_len + name_len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate"); + HDmemcpy(map->common.obj_name, obj->obj_name, obj_name_len); + HDmemcpy(map->common.obj_name+obj_name_len, + loc_params.loc_data.loc_by_name.name, name_len); + map->common.obj_name[obj_name_len+name_len] = '\0'; + } + + if((map->mapl_id = H5Pcopy(H5P_MAP_ACCESS_DEFAULT)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "failed to copy mapl"); + + /* set common object parameters */ + map->common.obj_type = H5I_MAP; + map->common.file = obj->file; + map->common.file->nopen_objs ++; + + ret_value = (void *)map; + 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_ES: + case H5I_RC: + case H5I_TR: + case H5I_QUERY: + case H5I_VIEW: + 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, NULL, "not a valid file object (dataset, map, group, or datatype)") + break; + } + + /* H5Oopen has to be synchronous */ + if(H5VL__iod_create_and_forward(H5VL_OBJECT_OPEN_ID, HG_OBJECT_OPEN, + obj, 1, num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, + &remote_obj, &remote_obj, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship object open"); + +done: + if(NULL == ret_value) { + switch(remote_obj.obj_type) { + case H5I_DATASET: + if(dset->common.obj_name) { + HDfree(dset->common.obj_name); + dset->common.obj_name = NULL; + } + if(dset->common.comment) { + HDfree(dset->common.comment); + dset->common.comment = NULL; + } + if(dset->remote_dset.type_id != FAIL && H5I_dec_ref(dset->remote_dset.type_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "failed to close dtype"); + if(dset->remote_dset.space_id != FAIL && H5I_dec_ref(dset->remote_dset.space_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "failed to close dspace"); + if(dset->remote_dset.dcpl_id != FAIL && H5I_dec_ref(dset->remote_dset.dcpl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "failed to close plist"); + if(dset->dapl_id != FAIL && H5I_dec_ref(dset->dapl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "failed to close plist"); + if(dset) + dset = H5FL_FREE(H5VL_iod_dset_t, dset); + break; + case H5I_DATATYPE: + /* free dtype components */ + if(dtype->common.obj_name) { + HDfree(dtype->common.obj_name); + dtype->common.obj_name = NULL; + } + if(dtype->common.comment) { + HDfree(dtype->common.comment); + dtype->common.comment = NULL; + } + if(dtype->remote_dtype.tcpl_id != FAIL && H5I_dec_ref(dtype->remote_dtype.tcpl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "failed to close plist"); + if(dtype->tapl_id != FAIL && H5I_dec_ref(dtype->tapl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "failed to close plist"); + if(dtype->remote_dtype.type_id != FAIL && H5I_dec_ref(dtype->remote_dtype.type_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "failed to close dtype"); + if(dtype) + dtype = H5FL_FREE(H5VL_iod_dtype_t, dtype); + break; + case H5I_GROUP: + if(grp->common.obj_name) { + HDfree(grp->common.obj_name); + grp->common.obj_name = NULL; + } + if(grp->common.comment) { + HDfree(grp->common.comment); + grp->common.comment = NULL; + } + if(grp->gapl_id != FAIL && H5I_dec_ref(grp->gapl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "failed to close plist"); + if(grp->remote_group.gcpl_id != FAIL && + H5I_dec_ref(grp->remote_group.gcpl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "failed to close plist"); + if(grp) + grp = H5FL_FREE(H5VL_iod_group_t, grp); + break; + case H5I_MAP: + /* free map components */ + if(map->common.obj_name) { + HDfree(map->common.obj_name); + map->common.obj_name = NULL; + } + if(map->common.comment) { + HDfree(map->common.comment); + map->common.comment = NULL; + } + if(map->remote_map.keytype_id != FAIL && H5I_dec_ref(map->remote_map.keytype_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "failed to close dtype"); + if(map->remote_map.valtype_id != FAIL && H5I_dec_ref(map->remote_map.valtype_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "failed to close dtype"); + if(map) + map = H5FL_FREE(H5VL_iod_map_t, map); + 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_ES: + case H5I_RC: + case H5I_TR: + case H5I_QUERY: + case H5I_VIEW: + case H5I_GENPROP_CLS: + case H5I_GENPROP_LST: + case H5I_ERROR_CLASS: + case H5I_ERROR_MSG: + case H5I_ERROR_STACK: + case H5I_NTYPES: + default: + HDONE_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "not a valid object type"); + } /* end switch */ + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_iod_object_open_by_addr */ +#endif + /*------------------------------------------------------------------------- * Function: H5VL_iod_object_copy @@ -9248,4 +9815,184 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_wait() */ + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_view_create + * + * Purpose: Creates a view from a query on an iod h5 file. + * + * Return: Success: view + * Failure: NULL + * + * Programmer: Mohamad Chaarawi + * February, 2014 + * + *------------------------------------------------------------------------- + */ +void * +H5VL_iod_view_create(void *_obj, hid_t query_id, hid_t vcpl_id, hid_t rcxt_id, void **req) +{ + H5VL_iod_object_t *obj = (H5VL_iod_object_t *)_obj; /* location object to create the view */ + H5VL_iod_view_t *view = NULL; /* the view object that is created and passed to the user */ + view_create_in_t input; + iod_obj_id_t iod_id, mdkv_id; + iod_handles_t iod_oh; + H5VL_iod_request_t **parent_reqs = NULL; + size_t num_parents = 0; + H5RC_t *rc = NULL; + H5P_genplist_t *plist = NULL; + void *ret_value = NULL; + + FUNC_ENTER_NOAPI_NOINIT + + /* Get the view creation plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(vcpl_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID"); + + /* get the RC object */ + if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a READ CONTEXT ID"); + + /* allocate parent request array */ + if(NULL == (parent_reqs = (H5VL_iod_request_t **) + H5MM_malloc(sizeof(H5VL_iod_request_t *) * 2))) + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, NULL, "can't allocate parent req element"); + + /* retrieve parent requests */ + if(H5VL_iod_get_parent_requests(obj, (H5VL_iod_req_info_t *)rc, parent_reqs, &num_parents) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to retrieve parent requests"); + + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh, &mdkv_id, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current location view info"); + + /* MSC - If location object not opened yet, wait for it. */ + if(IOD_OBJ_INVALID == iod_id) { + /* Synchronously wait on the request attached to the dataset */ + if(H5VL_iod_request_wait(obj->file, obj->request) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't wait on HG request"); + obj->request = NULL; + /* retrieve IOD info of location object */ + if(H5VL_iod_get_loc_info(obj, &iod_id, &iod_oh, &mdkv_id, NULL) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "Failed to resolve current location view info"); + } + + /* allocate the view object that is returned to the user */ + if(NULL == (view = H5FL_CALLOC(H5VL_iod_view_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate object struct"); + + /* set the input structure for the HG encode routine */ + input.coh = obj->file->remote_file.coh; + input.loc_id = iod_id; + input.loc_oh = iod_oh; + input.loc_mdkv_id = mdkv_id; + input.query_id = query_id; + input.vcpl_id = vcpl_id; + input.obj_type = obj->obj_type; + input.rcxt_num = rc->c_version; + input.cs_scope = obj->file->md_integrity_scope; + + /* initialize View object */ + view->file = obj->file; + view->c_version = rc->c_version; + + /* store a token for the location object */ + view->loc_info.buf_size = 0; + if(H5VL_iod_get_token(obj, NULL, &view->loc_info.buf_size) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to get location token"); + if(NULL == (view->loc_info.buf = HDmalloc(view->loc_info.buf_size * sizeof(void *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate token buffer"); + if(H5VL_iod_get_token(obj, view->loc_info.buf, &view->loc_info.buf_size) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to get location token"); + + /* store the query ID */ + view->query_id = query_id; + if(H5I_inc_ref(query_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINC, NULL, "can't increment ID ref count"); + + /* copy property list */ + if((view->vcpl_id = H5Pcopy(vcpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "failed to copy vcpl"); + + /* Initialize the view types to be obtained from server */ + view->attr_info.count = 0; + view->attr_info.tokens = NULL; + view->obj_info.count = 0; + view->obj_info.tokens = NULL; + view->region_info.count = 0; + view->region_info.tokens = NULL; + + view->valid_view = FALSE; + +#if H5VL_IOD_DEBUG + printf("View Create at IOD ID %"PRIu64", axe id %"PRIu64"\n", + iod_id, g_axe_id); +#endif + + if(H5VL__iod_create_and_forward(H5VL_VIEW_CREATE_ID, HG_VIEW_CREATE, + obj, 0, num_parents, parent_reqs, + (H5VL_iod_req_info_t *)rc, &input, view, view, req) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship view create"); + + ret_value = (void *)view; + +done: + /* If the operation is synchronous and it failed at the server, or + it failed locally, then cleanup and return fail */ + if(NULL == ret_value) { + if(view->vcpl_id != FAIL && H5I_dec_ref(view->vcpl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, "failed to close plist"); + if(view) + view = H5FL_FREE(H5VL_iod_view_t, view); + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_iod_view_create() */ + +herr_t +H5VL_iod_view_close(H5VL_iod_view_t *view) +{ + hsize_t i; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + for(i=0 ; i<view->region_info.count ; i++) { + free(view->region_info.tokens[i].buf); + H5Sclose(view->region_info.regions[i]); + } + + for(i=0 ; i<view->obj_info.count ; i++) { + free(view->obj_info.tokens[i].buf); + } + + for(i=0 ; i<view->attr_info.count ; i++) { + free(view->attr_info.tokens[i].buf); + } + + if(view->region_info.tokens) + free(view->region_info.tokens); + + if(view->region_info.regions) + free(view->region_info.regions); + + if(view->obj_info.tokens) + free(view->obj_info.tokens); + + if(view->attr_info.tokens) + free(view->attr_info.tokens); + + if(view->loc_info.buf) + free(view->loc_info.buf); + + if (H5I_dec_app_ref(view->query_id) < 0) + HGOTO_ERROR(H5E_QUERY, H5E_CANTDEC, FAIL, "unable to decrement ref count on query"); + if (H5I_dec_app_ref(view->vcpl_id) < 0) + HGOTO_ERROR(H5E_QUERY, H5E_CANTDEC, FAIL, "unable to decrement ref count on vcpl"); + + view = H5FL_FREE(H5VL_iod_view_t, view); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_iod_view_create() */ #endif /* H5_HAVE_EFF */ diff --git a/src/H5VLiod_analysis.c b/src/H5VLiod_analysis.c index a40f64d..efa172d 100644 --- a/src/H5VLiod_analysis.c +++ b/src/H5VLiod_analysis.c @@ -20,6 +20,7 @@ #include "H5VLiod_server.h" #include "H5Qpublic.h" +#include "H5Vpublic.h" #ifdef H5_HAVE_PYTHON #include <Python.h> @@ -28,13 +29,6 @@ #ifdef H5_HAVE_EFF -/* User data for dataspace iteration to query elements. */ -typedef struct { - size_t num_elmts; - hid_t query_id; - hid_t space_query; -} H5VL__iod_get_query_data_t; - /* do not change order */ typedef struct { analysis_farm_out_t farm_out; @@ -70,7 +64,6 @@ herr_t H5VL__iod_combine(const char *combine_script, size_t num_targets, hid_t data_type_id, void **combine_data, size_t *combine_num_elmts, hid_t *combine_data_type_id); - #endif static herr_t H5VL__iod_farm_split(iod_handle_t coh, iod_obj_id_t obj_id, iod_trans_id_t rtid, @@ -81,8 +74,8 @@ static herr_t H5VL__iod_farm_split(iod_handle_t coh, iod_obj_id_t obj_id, iod_tr static hid_t H5VL__iod_get_space_layout(coords_t coords, iod_size_t num_cells, hid_t space_id); -static herr_t H5VL__iod_get_query_data_cb(void *elem, hid_t type_id, unsigned ndim, - const hsize_t *point, void *_udata); +herr_t H5VL__iod_get_query_data_cb(void *elem, hid_t type_id, unsigned ndim, + const hsize_t *point, void *_udata); static herr_t H5VL__iod_get_query_data(iod_handle_t coh, iod_obj_id_t dset_id, iod_trans_id_t rtid, hid_t query_id, @@ -862,12 +855,12 @@ H5VL_iod_server_analysis_execute_cb(AXE_engine_t UNUSED axe_engine, if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_OBJ_DATATYPE, - NULL, NULL, &type_id) < 0) + 7, NULL, &type_id) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve datatype"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, - NULL, NULL, &space_id) < 0) + 7, NULL, &space_id) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace"); /*******************************************/ @@ -1154,7 +1147,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5VL__iod_get_query_data_cb(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *_udata) { @@ -1164,8 +1157,6 @@ H5VL__iod_get_query_data_cb(void *elem, hid_t type_id, unsigned ndim, FUNC_ENTER_NOAPI_NOINIT - HDassert(ndim == 1); - /* Apply the query */ if(H5Qapply(udata->query_id, &result, type_id, elem) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "unable to apply query to data element"); diff --git a/src/H5VLiod_client.c b/src/H5VLiod_client.c index 1940816..6cc70e0 100644 --- a/src/H5VLiod_client.c +++ b/src/H5VLiod_client.c @@ -1611,6 +1611,20 @@ H5VL_iod_request_complete(H5VL_iod_file_t *file, H5VL_iod_request_t *req) H5VL_iod_request_delete(file, req); break; } + case HG_VIEW_CREATE: + { + H5VL_iod_view_t *view = (H5VL_iod_view_t *)req->data; + + if(FALSE == view->valid_view) { + HERROR(H5E_FUNC, H5E_CANTINIT, "failed to create view\n"); + req->status = H5ES_STATUS_FAIL; + req->state = H5VL_IOD_COMPLETED; + } + + req->data = NULL; + H5VL_iod_request_delete(file, req); + break; + } case HG_LINK_ITERATE: case HG_OBJECT_VISIT: case HG_MAP_ITERATE: @@ -2035,6 +2049,7 @@ H5VL_iod_request_cancel(H5VL_iod_file_t *file, H5VL_iod_request_t *req) break; } case HG_PREFETCH: + case HG_VIEW_CREATE: req->data = NULL; H5VL_iod_request_delete(file, req); break; diff --git a/src/H5VLiod_client.h b/src/H5VLiod_client.h index 4de6041..653f8f5 100644 --- a/src/H5VLiod_client.h +++ b/src/H5VLiod_client.h @@ -94,7 +94,8 @@ typedef enum H5RQ_type_t { HG_TR_SKIP, HG_TR_ABORT, HG_PREFETCH, - HG_EVICT + HG_EVICT, + HG_VIEW_CREATE } H5RQ_type_t; /* the client IOD VOL request struct */ @@ -271,6 +272,20 @@ typedef struct H5VL_iod_dtype_t { hid_t tapl_id; } H5VL_iod_dtype_t; +/* struct that contains the information about a View object */ +typedef struct H5VL_iod_view_t { + /* Do NOT change the order of the parameters */ + hbool_t valid_view; + region_info_t region_info; + obj_info_t obj_info; + attr_info_t attr_info; + loc_info_t loc_info; + struct H5VL_iod_file_t *file; + uint64_t c_version; + hid_t query_id; + hid_t vcpl_id; +} H5VL_iod_view_t; + /* information about an attr IO request */ typedef struct H5VL_iod_attr_io_info_t { int *status; @@ -422,6 +437,7 @@ H5_DLL herr_t H5VL_iod_map_close(void *map, void **req); H5_DLL void * H5VL_iod_obj_open_token(const void *token, H5TR_t *tr, H5I_type_t *opened_type, void **req); +H5_DLL herr_t H5VL_iod_get_token(void *obj, void *token, size_t *token_size); /* private routines for RC */ H5_DLL herr_t H5VL_iod_rc_acquire(H5VL_iod_file_t *file, H5RC_t *rc, @@ -442,6 +458,10 @@ H5_DLL herr_t H5VL_iod_prefetch(void *obj, hid_t rcxt_id, hrpl_t *replica_id, hid_t apl_id, void **req); H5_DLL herr_t H5VL_iod_evict(void *obj, uint64_t c_version, hid_t apl_id, void **req); +H5_DLL void * H5VL_iod_view_create(void *_obj, hid_t query_id, hid_t vcpl_id, + hid_t rcxt_id, void **req); +H5_DLL herr_t H5VL_iod_view_close(H5VL_iod_view_t *view); + H5_DLL herr_t H5VL_iod_analysis_execute(const char *file_name, const char *obj_name, hid_t query_id, const char *split_script, const char *combine_script, void **req); diff --git a/src/H5VLiod_common.h b/src/H5VLiod_common.h index fa73306..b1118a6 100644 --- a/src/H5VLiod_common.h +++ b/src/H5VLiod_common.h @@ -100,6 +100,24 @@ typedef struct iod_handles_t { iod_handle_t wr_oh; } iod_handles_t; +typedef struct region_info_t { + hsize_t count; + binary_buf_t *tokens; + hid_t *regions; +} region_info_t; + +typedef struct attr_info_t { + hsize_t count; + binary_buf_t *tokens; +} attr_info_t; + +typedef struct obj_info_t { + hsize_t count; + binary_buf_t *tokens; +} obj_info_t; + +typedef binary_buf_t loc_info_t; + #endif /* H5_HAVE_EFF */ H5_DLL int H5VL_iod_get_type_info(hid_t type_id, H5VL_iod_type_info_t *type_info); @@ -138,6 +156,9 @@ H5_DLL int hg_proc_linfo_t(hg_proc_t proc, void *data); H5_DLL int hg_proc_oinfo_t(hg_proc_t proc, void *data); H5_DLL int hg_proc_coords_t(hg_proc_t proc, void *data); H5_DLL int hg_proc_hrpl_t(hg_proc_t proc, void *data); +H5_DLL int hg_proc_region_info_t(hg_proc_t proc, void *data); +H5_DLL int hg_proc_obj_info_t(hg_proc_t proc, void *data); +H5_DLL int hg_proc_attr_info_t(hg_proc_t proc, void *data); MERCURY_GEN_PROC(analysis_execute_in_t, ((axe_t)(axe_info)) @@ -166,12 +187,10 @@ MERCURY_GEN_PROC(analysis_farm_out_t, ((hid_t)(type_id)) ((size_t)(num_elmts))) MERCURY_GEN_PROC(analysis_transfer_in_t, - ((hg_bulk_t)(bulk_handle)) - ((uint64_t)(axe_id)) - ) + ((hg_bulk_t)(bulk_handle)) + ((uint64_t)(axe_id))) MERCURY_GEN_PROC(analysis_transfer_out_t, - ((int32_t)(ret)) - ) + ((int32_t)(ret))) MERCURY_GEN_PROC(eff_init_in_t, ((uint32_t)(proc_num))) @@ -727,5 +746,23 @@ MERCURY_GEN_PROC(evict_in_t, ((iod_handles_t)(iod_oh)) ((iod_obj_id_t)(iod_id))) +MERCURY_GEN_PROC(view_create_in_t, + ((axe_t)(axe_info)) + ((iod_handle_t)(coh)) + ((uint32_t)(cs_scope)) + ((iod_handles_t)(loc_oh)) + ((iod_obj_id_t)(loc_id)) + ((iod_obj_id_t)(loc_mdkv_id)) + ((uint64_t)(rcxt_num)) + ((int32_t)(obj_type)) + ((hid_t)(vcpl_id)) + ((hid_t)(query_id))) + +MERCURY_GEN_PROC(view_create_out_t, + ((hbool_t)(valid_view)) + ((region_info_t)(region_info)) + ((obj_info_t)(obj_info)) + ((attr_info_t)(attr_info))) + #endif /* H5_HAVE_EFF */ #endif /* _H5VLiod_common_H */ diff --git a/src/H5VLiod_encdec.c b/src/H5VLiod_encdec.c index 3d086e1..84b5be7 100644 --- a/src/H5VLiod_encdec.c +++ b/src/H5VLiod_encdec.c @@ -934,4 +934,189 @@ int hg_proc_coords_t(hg_proc_t proc, void *data) return ret; } + +int hg_proc_region_info_t(hg_proc_t proc, void *data) +{ + int ret = HG_SUCCESS; + hsize_t i; + hg_proc_op_t op; + region_info_t *region_info = (region_info_t *) data; + + ret = hg_proc_uint64_t(proc, ®ion_info->count); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + + op = hg_proc_get_op(proc); + + switch(op) { + case HG_ENCODE: + for(i=0 ; i<region_info->count ; i++) { + ret = hg_proc_binary_buf_t(proc, ®ion_info->tokens[i]); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + ret = hg_proc_hid_t(proc, ®ion_info->regions[i]); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + } + break; + case HG_DECODE: + if(region_info->count) { + region_info->tokens = (binary_buf_t *)malloc + (sizeof(binary_buf_t) * (size_t)region_info->count); + region_info->regions = (hid_t *)malloc (sizeof(hid_t) * (size_t)region_info->count); + } + for(i=0 ; i<region_info->count ; i++) { + ret = hg_proc_binary_buf_t(proc, ®ion_info->tokens[i]); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + ret = hg_proc_hid_t(proc, ®ion_info->regions[i]); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + } + break; + case HG_FREE: + /* + for(i=0 ; i<region_info->count ; i++) { + ret = hg_proc_binary_buf_t(proc, ®ion_info->tokens[i]); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + ret = hg_proc_hid_t(proc, ®ion_info->regions[i]); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + } + if(region_info->count) { + free(region_info->tokens); + free(region_info->regions); + } + */ + break; + default: + return HG_FAIL; + } + + return ret; +} + +int hg_proc_obj_info_t(hg_proc_t proc, void *data) +{ + int ret = HG_SUCCESS; + hsize_t i; + hg_proc_op_t op; + obj_info_t *obj_info = (obj_info_t *) data; + + ret = hg_proc_uint64_t(proc, &obj_info->count); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + + op = hg_proc_get_op(proc); + + switch(op) { + case HG_ENCODE: + for(i=0 ; i<obj_info->count ; i++) { + ret = hg_proc_binary_buf_t(proc, &obj_info->tokens[i]); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + } + break; + case HG_DECODE: + if(obj_info->count) { + obj_info->tokens = (binary_buf_t *)malloc + (sizeof(binary_buf_t) * (size_t)obj_info->count); + } + for(i=0 ; i<obj_info->count ; i++) { + ret = hg_proc_binary_buf_t(proc, &obj_info->tokens[i]); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + } + break; + case HG_FREE: + break; + default: + return HG_FAIL; + } + + return ret; +} + +int hg_proc_attr_info_t(hg_proc_t proc, void *data) +{ + int ret = HG_SUCCESS; + hsize_t i; + hg_proc_op_t op; + attr_info_t *attr_info = (attr_info_t *) data; + + ret = hg_proc_uint64_t(proc, &attr_info->count); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + + op = hg_proc_get_op(proc); + + switch(op) { + case HG_ENCODE: + for(i=0 ; i<attr_info->count ; i++) { + ret = hg_proc_binary_buf_t(proc, &attr_info->tokens[i]); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + } + break; + case HG_DECODE: + if(attr_info->count) { + attr_info->tokens = (binary_buf_t *)malloc + (sizeof(binary_buf_t) * (size_t)attr_info->count); + } + for(i=0 ; i<attr_info->count ; i++) { + ret = hg_proc_binary_buf_t(proc, &attr_info->tokens[i]); + if (ret != HG_SUCCESS) { + HG_ERROR_DEFAULT("Proc error"); + ret = HG_FAIL; + return ret; + } + } + break; + case HG_FREE: + break; + default: + return HG_FAIL; + } + + return ret; +} + + #endif /* H5_HAVE_EFF */ diff --git a/src/H5VLiod_obj.c b/src/H5VLiod_obj.c index 2ec9340..ad8dee5 100644 --- a/src/H5VLiod_obj.c +++ b/src/H5VLiod_obj.c @@ -979,4 +979,219 @@ done: FUNC_LEAVE_NOAPI_VOID } /* end H5VL_iod_server_object_get_comment_cb() */ +#if 0 + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_server_object_open_by_addr_cb + * + * Purpose: Opens an existing object in the container + * + * Return: Success: SUCCEED + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * February, 2014 + * + *------------------------------------------------------------------------- + */ +void +H5VL_iod_server_object_open_by_addr_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) +{ + op_data_t *op_data = (op_data_t *)_op_data; + object_op_in_t *input = (object_op_in_t *)op_data->input; + object_open_out_t output; + iod_handle_t coh = input->coh; /* the container handle */ + iod_obj_id_t obj_id = input->iod_id; /* The ID of the object */ + iod_trans_id_t rtid = input->rcxt_num; + uint32_t cs_scope = input->cs_scope; + iod_handles_t obj_oh; /* The handle for object */ + iod_handle_t mdkv_oh; + scratch_pad sp; + iod_checksum_t sp_cs = 0; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if H5VL_IOD_DEBUG + fprintf(stderr, "Start Object Open By addr on %"PRIx64"\n", obj_id); +#endif + + if (iod_obj_open_read(coh, obj_id, rtid, NULL, &obj_oh.rd_oh, NULL) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't opeb obejct for read"); + if (iod_obj_open_write(coh, obj_id, rtid, NULL, &obj_oh.wr_oh, NULL) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open object for write"); + + /* get scratch pad of the object */ + if(iod_obj_get_scratch(obj_oh.rd_oh, rtid, &sp, &sp_cs, NULL) < 0) + HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't get scratch pad for object"); + + if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { + /* verify scratch pad integrity */ + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); + } + + /* open the metadata KV */ + if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) + HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open MDKV"); + + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_OBJECT_TYPE, H5VL_IOD_KEY_OBJ_TYPE, + cs_scope, NULL, &output.obj_type) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve link count"); + + switch(output.obj_type) { + case H5I_MAP: + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &output.cpl_id) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve mcpl"); + + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, + H5VL_IOD_KEY_MAP_KEY_TYPE, + cs_scope, NULL, &output.id1) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve link count"); + + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, + H5VL_IOD_KEY_MAP_VALUE_TYPE, + cs_scope, NULL, &output.id2) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve link count"); + break; + case H5I_GROUP: + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &output.cpl_id) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dcpl"); + output.id1 = FAIL; + output.id2 = FAIL; + break; + case H5I_DATASET: + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &output.cpl_id) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dcpl"); + + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_OBJ_DATATYPE, + cs_scope, NULL, &output.id1) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve datatype"); + + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, + cs_scope, NULL, &output.id2) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace"); + break; + case H5I_ATTR: + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, H5VL_IOD_KEY_OBJ_DATATYPE, + cs_scope, NULL, &output.id1) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve datatype"); + + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, + cs_scope, NULL, &output.id2) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace"); + break; + case H5I_DATATYPE: + { + size_t buf_size; /* size of serialized datatype */ + void *buf = NULL; + iod_mem_desc_t *mem_desc = NULL; /* memory descriptor used for reading */ + iod_blob_iodesc_t *file_desc = NULL; /* file descriptor used to write */ + iod_checksum_t dt_cs = 0, blob_cs = 0; + iod_size_t key_size, val_size; + iod_checksum_t iod_cs[2]; + + key_size = strlen(H5VL_IOD_KEY_DTYPE_SIZE); + val_size = sizeof(iod_size_t); + + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &output.cpl_id) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dcpl"); + + /* retrieve blob size metadata from scratch pad */ + if(iod_kv_get_value(mdkv_oh, rtid, H5VL_IOD_KEY_DTYPE_SIZE, key_size, + &buf_size, &val_size, iod_cs, NULL) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "datatype size lookup failed"); + + if(cs_scope & H5_CHECKSUM_IOD) { + if(H5VL_iod_verify_kv_pair(H5VL_IOD_KEY_DTYPE_SIZE, key_size, + &buf_size, val_size, iod_cs) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Corruption detected when reading metadata from IOD"); + } + + if(NULL == (buf = malloc(buf_size))) + HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate BLOB read buffer"); + + /* create memory descriptor for writing */ + mem_desc = (iod_mem_desc_t *)malloc(sizeof(iod_mem_desc_t) + + sizeof(iod_mem_frag_t)); + mem_desc->nfrag = 1; + mem_desc->frag[0].addr = buf; + mem_desc->frag[0].len = (iod_size_t)buf_size; + + /* create file descriptor for writing */ + file_desc = (iod_blob_iodesc_t *)malloc(sizeof(iod_blob_iodesc_t) + + sizeof(iod_blob_iofrag_t)); + file_desc->nfrag = 1; + file_desc->frag[0].offset = 0; + file_desc->frag[0].len = (iod_size_t)buf_size; + + /* read the serialized type value from the BLOB object */ + if(iod_blob_read(obj_oh.rd_oh, rtid, NULL, mem_desc, file_desc, + &blob_cs, NULL) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read BLOB object"); + + if(blob_cs && (cs_scope & H5_CHECKSUM_IOD)) { + /* calculate a checksum for the datatype */ + dt_cs = H5_checksum_crc64(buf, buf_size); + + /* Verify checksum against one given by IOD */ + if(blob_cs != dt_cs) + HGOTO_ERROR2(H5E_SYM, H5E_READERROR, FAIL, "Data Corruption detected when reading datatype"); + } + + /* decode the datatype */ + if((output.id1 = H5Tdecode(buf)) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "unable to decode datatype"); + output.id2 = FAIL; + + free(mem_desc); + free(file_desc); + free(buf); + break; + } + default: + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Invalid object type"); + } + + /* close the metadata scratch pad */ + if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object"); + + output.iod_id = obj_id; + output.mdkv_id = sp[0]; + output.attrkv_id = sp[1]; + output.iod_oh.rd_oh.cookie = obj_oh.rd_oh.cookie; + output.iod_oh.wr_oh.cookie = obj_oh.wr_oh.cookie; + +#if H5VL_IOD_DEBUG + fprintf(stderr, "Done with object open, sending response to client\n"); +#endif + + HG_Handler_start_output(op_data->hg_handle, &output); + +done: + if(ret_value < 0) { + output.iod_oh.rd_oh.cookie = IOD_OH_UNDEFINED; + output.iod_oh.wr_oh.cookie = IOD_OH_UNDEFINED; + output.iod_id = IOD_OBJ_INVALID; + output.cpl_id = FAIL; + output.id1 = FAIL; + output.id2 = FAIL; + HG_Handler_start_output(op_data->hg_handle, &output); + } + + input = (object_op_in_t *)H5MM_xfree(input); + op_data = (op_data_t *)H5MM_xfree(op_data); + + FUNC_LEAVE_NOAPI_VOID +} /* end H5VL_iod_server_object_open_by_addr_cb() */ +#endif + #endif /* H5_HAVE_EFF */ diff --git a/src/H5VLiod_server.c b/src/H5VLiod_server.c index ad71811..3ed9a42 100644 --- a/src/H5VLiod_server.c +++ b/src/H5VLiod_server.c @@ -205,6 +205,9 @@ EFF__mercury_register_callbacks(void) MERCURY_HANDLER_REGISTER("evict", H5VL_iod_server_evict, evict_in_t, ret_t); + MERCURY_HANDLER_REGISTER("view_create", H5VL_iod_server_view_create, + view_create_in_t, view_create_out_t); + MERCURY_HANDLER_REGISTER("cancel_op", H5VL_iod_server_cancel_op, uint64_t, uint8_t); } @@ -3792,4 +3795,57 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_iod_server_evict() */ + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_server_view_create + * + * Purpose: Function shipper registered call for object view_create. + * Inserts the real worker routine into the Async Engine. + * + * Return: Success: HG_SUCCESS + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * February, 2014 + * + *------------------------------------------------------------------------- + */ +int +H5VL_iod_server_view_create(hg_handle_t handle) +{ + op_data_t *op_data = NULL; + view_create_in_t *input; + int ret_value = HG_SUCCESS; + + FUNC_ENTER_NOAPI_NOINIT + + if(NULL == (op_data = (op_data_t *)H5MM_malloc(sizeof(op_data_t)))) + HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(NULL == (input = (view_create_in_t *)H5MM_malloc(sizeof(view_create_in_t)))) + HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, HG_FAIL, "can't allocate axe op_data struct"); + + if(HG_FAIL == HG_Handler_get_input(handle, input)) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, HG_FAIL, "can't get input parameters"); + + if(NULL == engine) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, HG_FAIL, "AXE engine not started"); + + if(input->axe_info.count && + H5VL__iod_server_finish_axe_tasks(engine, input->axe_info.start_range, + input->axe_info.count) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, HG_FAIL, "Unable to cleanup AXE tasks"); + + op_data->hg_handle = handle; + op_data->input = (void *)input; + + if (AXE_SUCCEED != AXEcreate_task(engine, input->axe_info.axe_id, + input->axe_info.num_parents, input->axe_info.parent_axe_ids, + 0, NULL, H5VL_iod_server_view_create_cb, op_data, NULL)) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, HG_FAIL, "can't insert task into async engine"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_iod_server_view_create() */ + #endif /* H5_HAVE_EFF */ diff --git a/src/H5VLiod_server.h b/src/H5VLiod_server.h index c9b1f28..d49e323 100644 --- a/src/H5VLiod_server.h +++ b/src/H5VLiod_server.h @@ -73,6 +73,13 @@ typedef struct H5VL_iod_link_t { iod_obj_id_t iod_id; /* The ID of the object the link points to */ } H5VL_iod_link_t; +/* User data for dataspace iteration to query elements. */ +typedef struct { + size_t num_elmts; + hid_t query_id; + hid_t space_query; +} H5VL__iod_get_query_data_t; + extern iod_obj_id_t ROOT_ID; extern int num_ions_g; extern int my_rank_g; @@ -152,6 +159,7 @@ H5_DLL int H5VL_iod_server_trans_skip(hg_handle_t handle); H5_DLL int H5VL_iod_server_trans_abort(hg_handle_t handle); H5_DLL int H5VL_iod_server_prefetch(hg_handle_t handle); H5_DLL int H5VL_iod_server_evict(hg_handle_t handle); +H5_DLL int H5VL_iod_server_view_create(hg_handle_t handle); H5_DLL void H5VL_iod_server_analysis_execute_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], @@ -392,6 +400,10 @@ H5_DLL void H5VL_iod_server_evict_cb(AXE_engine_t axe_engine, size_t num_n_parents, AXE_task_t n_parents[], size_t num_s_parents, AXE_task_t s_parents[], void *op_data); +H5_DLL void H5VL_iod_server_view_create_cb(AXE_engine_t axe_engine, + size_t num_n_parents, AXE_task_t n_parents[], + size_t num_s_parents, AXE_task_t s_parents[], + void *op_data); /* Helper routines used several times in different places */ H5_DLL herr_t H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t loc_handle, @@ -432,5 +444,7 @@ H5_DLL herr_t H5VL__iod_server_final_io(iod_handle_t iod_oh, hid_t space_id, siz hbool_t write_op, void *buf, size_t buf_size, iod_checksum_t cs, uint32_t cs_scope, iod_trans_id_t tid); +H5_DLL herr_t H5VL__iod_get_query_data_cb(void *elem, hid_t type_id, unsigned ndim, + const hsize_t *point, void *_udata); #endif /* H5_HAVE_EFF */ #endif /* _H5VLiod_server_H */ diff --git a/src/H5VLiod_view.c b/src/H5VLiod_view.c index cf91ee0..62bc9af 100644 --- a/src/H5VLiod_view.c +++ b/src/H5VLiod_view.c @@ -23,8 +23,329 @@ #include "H5VLiod_server.h" +#include "H5Qpublic.h" +#include "H5Vpublic.h" + #ifdef H5_HAVE_EFF +static hid_t H5VL__iod_get_elmt_region(iod_handle_t coh, iod_obj_id_t dset_id, + iod_trans_id_t rtid, hid_t query_id, + hid_t vcpl_id, uint32_t cs_scope, binary_buf_t *token); + +static herr_t +H5VL__iod_get_token(H5O_type_t obj_type, iod_obj_id_t iod_id, iod_obj_id_t mdkv_id, + iod_obj_id_t attrkv_id, hid_t cpl_id, hid_t id1, hid_t id2, + binary_buf_t *token); + +/*------------------------------------------------------------------------- + * Function: H5VL_iod_server_view_create_cb + * + * Purpose: Create a View from a query on a location in the container. + * + * Return: Success: SUCCEED + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +void +H5VL_iod_server_view_create_cb(AXE_engine_t UNUSED axe_engine, + size_t UNUSED num_n_parents, AXE_task_t UNUSED n_parents[], + size_t UNUSED num_s_parents, AXE_task_t UNUSED s_parents[], + void *_op_data) +{ + op_data_t *op_data = (op_data_t *)_op_data; + view_create_in_t *input = (view_create_in_t *)op_data->input; + view_create_out_t output; + iod_handle_t coh = input->coh; /* the container handle */ + iod_handles_t loc_handle = input->loc_oh; /* The handle for current object - could be undefined */ + iod_obj_id_t loc_id = input->loc_id; /* The ID of the current location object */ + iod_obj_id_t mdkv_id = input->loc_mdkv_id; /* The ID of the metadata KV of the location */ + H5I_type_t obj_type = input->obj_type; + hid_t query_id = input->query_id; + hid_t vcpl_id; + iod_trans_id_t rtid = input->rcxt_num; + uint32_t cs_scope = input->cs_scope; + iod_handle_t mdkv_oh; + scratch_pad sp; + iod_ret_t ret; + hid_t region = FAIL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + +#if H5VL_IOD_DEBUG + fprintf(stderr, "Start View create on OID %"PRIx64"\n", loc_id); +#endif + + if(H5P_DEFAULT == input->vcpl_id) + input->vcpl_id = H5Pcopy(H5P_VIEW_CREATE_DEFAULT); + vcpl_id = input->vcpl_id; + + if(H5I_DATASET == obj_type) { + output.region_info.count = 1; + output.region_info.tokens = (binary_buf_t *)malloc(sizeof(binary_buf_t)); + output.region_info.regions = (hid_t *)malloc(sizeof(hid_t)); + + if((output.region_info.regions[0] = + H5VL__iod_get_elmt_region(coh, loc_id, rtid, query_id, vcpl_id, + cs_scope, output.region_info.tokens)) < 0) + HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't get region from query"); + + output.valid_view = TRUE; + output.obj_info.count = 0; + output.obj_info.tokens = NULL; + output.attr_info.count = 0; + output.attr_info.tokens = NULL; + + } + else { + /* MSC - for now this is only what is supported */ + assert(0); + } + +done: + if(SUCCEED != ret_value) { + output.valid_view = FALSE; + output.region_info.count = 0; + output.region_info.tokens = NULL; + output.region_info.regions = NULL; + output.obj_info.count = 0; + output.obj_info.tokens = NULL; + output.attr_info.count = 0; + output.attr_info.tokens = NULL; + } + + HG_Handler_start_output(op_data->hg_handle, &output); + + input = (view_create_in_t *)H5MM_xfree(input); + op_data = (op_data_t *)H5MM_xfree(op_data); + + FUNC_LEAVE_NOAPI_VOID +} /* end H5VL_iod_server_view_create_cb() */ + +static hid_t +H5VL__iod_get_elmt_region(iod_handle_t coh, iod_obj_id_t dset_id, + iod_trans_id_t rtid, hid_t query_id, hid_t vcpl_id, + uint32_t cs_scope, binary_buf_t *token) +{ + iod_handle_t dset_oh, mdkv_oh; + scratch_pad sp; + size_t nelmts; + size_t elmt_size=0, buf_size=0; + H5VL__iod_get_query_data_t udata; + void *buf = NULL; + hid_t type_id=0, space_id=0, dset_space_id=0, dcpl_id=0; + hbool_t use_region_scope = TRUE; + iod_checksum_t sp_cs = 0; + hid_t ret_value = FAIL; + + FUNC_ENTER_NOAPI_NOINIT + + /* Check if VCPL has a dataspace specified; otherwise, read the entire dataset. */ + if(H5Pget_view_elmt_scope(vcpl_id, &space_id) < 0) + HGOTO_ERROR2(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve vcpl region scope");; + + /* open the array object */ + if(iod_obj_open_read(coh, dset_id, rtid, NULL, &dset_oh, NULL) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open array object fo read"); + + /* get scratch pad */ + if(iod_obj_get_scratch(dset_oh, rtid, &sp, &sp_cs, NULL) < 0) + HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't get scratch pad for object"); + + if(sp_cs && (cs_scope & H5_CHECKSUM_IOD)) { + /* verify scratch pad integrity */ + if(H5VL_iod_verify_scratch_pad(&sp, sp_cs) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Scratch Pad failed integrity check"); + } + + /* open the metadata scratch pad */ + if(iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL) < 0) + HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); + + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, + H5VL_IOD_KEY_OBJ_DATATYPE, + 7, NULL, &type_id) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve datatype"); + + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, + H5VL_IOD_KEY_OBJ_DATASPACE, + 7, NULL, &dset_space_id) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dataspace"); + + if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, + cs_scope, NULL, &dcpl_id) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve dcpl"); + + if(space_id < 0) { + use_region_scope = FALSE; + space_id = dset_space_id; + } + + if(iod_obj_close(mdkv_oh, NULL, NULL) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object"); + + nelmts = (size_t) H5Sget_select_npoints(space_id); + elmt_size = H5Tget_size(type_id); + buf_size = nelmts * elmt_size; + + /* allocate buffer to hold data */ + if(NULL == (buf = malloc(buf_size))) + HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate read buffer"); + + /* read the data selection from IOD. */ + elmt_size = H5Tget_size(type_id); + if(H5VL__iod_server_final_io(dset_oh, space_id, elmt_size, FALSE, + buf, buf_size, (uint64_t)0, 0, rtid) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_READERROR, FAIL, "can't read from array object"); + + if(iod_obj_close(dset_oh, NULL, NULL) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't close Array object"); + + if(FAIL == (udata.space_query = H5Scopy(space_id))) + HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace"); + if(H5Sselect_none(udata.space_query) < 0) + HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to reset selection"); + + udata.query_id = query_id; + udata.num_elmts = 0; + + /* iterate over every element and apply the query on it. If the + query is not satisfied, then remove it from the query selection */ + if(H5Diterate(buf, type_id, space_id, H5VL__iod_get_query_data_cb, &udata) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "failed to compute buffer size"); + + ret_value = udata.space_query; + + if(H5VL__iod_get_token(H5O_TYPE_DATASET, dset_id, sp[0], sp[1], dcpl_id, type_id, + dset_space_id, token) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "failed to get object token"); + +done: + if(space_id && H5Sclose(space_id) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace"); + if(use_region_scope) { + if(dset_space_id && H5Sclose(dset_space_id) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace"); + } + if(type_id && H5Tclose(type_id) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to release datatype") + if(dcpl_id && H5Pclose(dcpl_id) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to release property list") + + if(buf != NULL) + free(buf); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__iod_get_elmt_region() */ + +static herr_t +H5VL__iod_get_token(H5O_type_t obj_type, iod_obj_id_t iod_id, iod_obj_id_t mdkv_id, + iod_obj_id_t attrkv_id, hid_t cpl_id, hid_t id1, hid_t id2, + binary_buf_t *token) +{ + size_t dt_size = 0, space_size = 0; + size_t keytype_size = 0, valtype_size; + uint8_t *buf_ptr = NULL; + size_t token_size = 0; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + token_size = sizeof(iod_obj_id_t)*3 + sizeof(H5O_type_t); + + switch(obj_type) { + case H5O_TYPE_GROUP: + break; + case H5O_TYPE_DATASET: + if(H5Tencode(id1, NULL, &dt_size) < 0) + HGOTO_ERROR2(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); + + if(H5Sencode(id2, NULL, &space_size) < 0) + HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace"); + + token_size += dt_size + space_size + sizeof(size_t)*2; + break; + case H5O_TYPE_NAMED_DATATYPE: + if(H5Tencode(id1, NULL, &dt_size) < 0) + HGOTO_ERROR2(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); + + token_size += dt_size + sizeof(size_t); + break; + case H5O_TYPE_MAP: + if(H5Tencode(id1, NULL, &keytype_size) < 0) + HGOTO_ERROR2(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); + + if(H5Tencode(id2, NULL, &valtype_size) < 0) + HGOTO_ERROR2(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); + + token_size += keytype_size + valtype_size + sizeof(size_t)*2; + break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "bad object"); + } + + token->buf_size = token_size; + token->buf = malloc(token_size); + buf_ptr = (uint8_t *)token->buf; + + HDmemcpy(buf_ptr, &iod_id, sizeof(iod_obj_id_t)); + buf_ptr += sizeof(iod_obj_id_t); + HDmemcpy(buf_ptr, &mdkv_id, sizeof(iod_obj_id_t)); + buf_ptr += sizeof(iod_obj_id_t); + HDmemcpy(buf_ptr, &attrkv_id, sizeof(iod_obj_id_t)); + buf_ptr += sizeof(iod_obj_id_t); + HDmemcpy(buf_ptr, &obj_type, sizeof(H5O_type_t)); + buf_ptr += sizeof(H5O_type_t); + + switch(obj_type) { + case H5O_TYPE_GROUP: + break; + case H5O_TYPE_DATASET: + HDmemcpy(buf_ptr, &dt_size, sizeof(size_t)); + buf_ptr += sizeof(size_t); + if(H5Tencode(id1, buf_ptr, &dt_size) < 0) + HGOTO_ERROR2(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); + buf_ptr += dt_size; + + HDmemcpy(buf_ptr, &space_size, sizeof(size_t)); + buf_ptr += sizeof(size_t); + if(H5Sencode(id2, buf_ptr, &space_size) < 0) + HGOTO_ERROR2(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace"); + buf_ptr += space_size; + break; + case H5O_TYPE_NAMED_DATATYPE: + HDmemcpy(buf_ptr, &dt_size, sizeof(size_t)); + buf_ptr += sizeof(size_t); + if(H5Tencode(id1, buf_ptr, &dt_size) < 0) + HGOTO_ERROR2(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); + buf_ptr += dt_size; + break; + case H5O_TYPE_MAP: + HDmemcpy(buf_ptr, &keytype_size, sizeof(size_t)); + buf_ptr += sizeof(size_t); + if(H5Tencode(id1, buf_ptr, &keytype_size) < 0) + HGOTO_ERROR2(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); + buf_ptr += keytype_size; + + HDmemcpy(buf_ptr, &valtype_size, sizeof(size_t)); + buf_ptr += sizeof(size_t); + if(H5Tencode(id2, buf_ptr, &valtype_size) < 0) + HGOTO_ERROR2(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); + buf_ptr += valtype_size; + break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "bad object"); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__iod_get_token() */ + #if 0 static herr_t H5VL__iod_server_construct_view(iod_handle_t coh, iod_obj_id_t loc_id, diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h new file mode 100644 index 0000000..01280a2 --- /dev/null +++ b/src/H5Vprivate.h @@ -0,0 +1,32 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This file contains private information about the H5V module + */ +#ifndef _H5Vprivate_H +#define _H5Vprivate_H + +/* Include package's public header */ +#include "H5Vpublic.h" + +/* Private headers needed by this file */ +#include "H5private.h" /* Generic Functions */ + +herr_t H5V_init(void); + +H5_DLL herr_t H5V_close(void *view); + +#endif /* _H5Vprivate_H */ diff --git a/src/H5Vpublic.h b/src/H5Vpublic.h new file mode 100644 index 0000000..a7d4ceb --- /dev/null +++ b/src/H5Vpublic.h @@ -0,0 +1,68 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This file contains function prototypes for each exported function in the + * H5V module. + */ +#ifndef _H5Vpublic_H +#define _H5Vpublic_H + +/* System headers needed by this file */ + +/* Public headers needed by this file */ +#include "H5public.h" +#include "H5Ipublic.h" + +/*****************/ +/* Public Macros */ +/*****************/ + +#define H5V_CRT_ELMT_SCOPE_NAME "element_scope" + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/********************/ +/* Public Variables */ +/********************/ + + +#ifdef __cplusplus +extern "C" { +#endif + +/*********************/ +/* Public Prototypes */ +/*********************/ + +H5_DLL herr_t H5Pset_view_elmt_scope(hid_t vcpl_id, hid_t space_id); +H5_DLL herr_t H5Pget_view_elmt_scope(hid_t vcpl_id, hid_t *space_id); + +/* API wrappers */ +H5_DLL hid_t H5Vcreate_ff(hid_t loc_id, hid_t query_id, hid_t vcpl_id, hid_t rcxt_id, hid_t estack_id); +H5_DLL herr_t H5Vget_query(hid_t view_id, hid_t *query_id); +H5_DLL herr_t H5Vget_counts(hid_t view_id, hsize_t *attr_count, hsize_t *obj_count, hsize_t *elem_region_count); +H5_DLL herr_t H5Vget_location_ff(hid_t view_id, hid_t *location_id, hid_t estack_id); +H5_DLL herr_t H5Vget_attrs_ff(hid_t view_id, hsize_t start, hsize_t count, hid_t attr_id[], hid_t estack_id); +H5_DLL herr_t H5Vget_objs_ff(hid_t view_id, hsize_t start, hsize_t count, hid_t obj_id[], hid_t estack_id); +H5_DLL herr_t H5Vget_elem_regions_ff(hid_t view_id, hsize_t start, hsize_t count, + hid_t dataset_id[], hid_t dataspace_id[], hid_t estack_id); +H5_DLL herr_t H5Vclose(hid_t view_id); + +#ifdef __cplusplus +} +#endif +#endif /* _H5Vpublic_H */ diff --git a/src/H5private.h b/src/H5private.h index 0e3df0d..42c617f 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2394,6 +2394,7 @@ H5_DLL int H5E_term_interface(void); H5_DLL int H5ES_term_interface(void); H5_DLL int H5RC_term_interface(void); H5_DLL int H5TR_term_interface(void); +H5_DLL int H5V_term_interface(void); H5_DLL int H5F_term_interface(void); H5_DLL int H5FS_term_interface(void); H5_DLL int H5G_term_interface(void); diff --git a/src/Makefile.am b/src/Makefile.am index 8511b96..071b415 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -61,11 +61,11 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5VL.c H5VLint.c H5VLnative.c \ H5VLiod.c H5VLiod_common.c H5VLiod_client.c H5VLiod_server.c H5VLiod_encdec.c H5VLiod_util.c \ H5VLiod_file.c H5VLiod_group.c H5VLiod_map.c H5VLiod_dset.c H5VLiod_dtype.c \ - H5VLiod_attr.c H5VLiod_link.c H5VLiod_obj.c H5VLiod_trans.c H5VLiod_analysis.c \ + H5VLiod_attr.c H5VLiod_link.c H5VLiod_obj.c H5VLiod_trans.c H5VLiod_view.c H5VLiod_analysis.c \ H5FD.c H5FDcore.c \ H5FDdirect.c H5FDfamily.c H5FDint.c H5FDlog.c H5FDmpi.c H5FDmpio.c \ H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \ - H5FF.c H5ES.c H5RC.c H5TR.c H5M.c H5AS.c\ + H5FF.c H5ES.c H5RC.c H5TR.c H5M.c H5AS.c H5V.c\ H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c H5FSstat.c H5FStest.c \ H5G.c H5Gbtree2.c H5Gcache.c \ H5Gcompact.c H5Gdense.c H5Gdeprec.c H5Gent.c \ @@ -92,7 +92,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \ H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ - H5Pgcpl.c H5Pmcpl.c H5Pmapl.c H5Pint.c H5Prcapl.c H5Ptrspl.c H5Ptrfpl.c \ + H5Pgcpl.c H5Pvcpl.c H5Pmcpl.c H5Pmapl.c H5Pint.c H5Prcapl.c H5Ptrspl.c H5Ptrfpl.c \ H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \ H5PL.c \ H5Q.c \ @@ -123,7 +123,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h H5FDmpiposix.h \ H5FDmulti.h H5FDsec2.h H5FDstdio.h \ H5VLpublic.h H5VLnative.h H5VLiod.h \ - H5FFpublic.h H5ESpublic.h H5RCpublic.h H5TRpublic.h H5Mpublic.h H5ASpublic.h\ + H5FFpublic.h H5ESpublic.h H5RCpublic.h H5TRpublic.h H5Mpublic.h H5ASpublic.h H5Vpublic.h\ H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h \ diff --git a/src/Makefile.in b/src/Makefile.in index 595b0dd..854edbf 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -142,45 +142,46 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ H5VLiod_util.lo H5VLiod_file.lo H5VLiod_group.lo \ H5VLiod_map.lo H5VLiod_dset.lo H5VLiod_dtype.lo \ H5VLiod_attr.lo H5VLiod_link.lo H5VLiod_obj.lo \ - H5VLiod_trans.lo H5VLiod_analysis.lo H5FD.lo H5FDcore.lo \ - H5FDdirect.lo H5FDfamily.lo H5FDint.lo H5FDlog.lo H5FDmpi.lo \ - H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo H5FDsec2.lo \ - H5FDspace.lo H5FDstdio.lo H5FF.lo H5ES.lo H5RC.lo H5TR.lo \ - H5M.lo H5AS.lo H5FL.lo H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo \ - H5FSsection.lo H5FSstat.lo H5FStest.lo H5G.lo H5Gbtree2.lo \ - H5Gcache.lo H5Gcompact.lo H5Gdense.lo H5Gdeprec.lo H5Gent.lo \ - H5Gint.lo H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo \ - H5Goh.lo H5Groot.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo \ - H5HF.lo H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \ - H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \ - H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \ - H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HGquery.lo \ - H5HL.lo H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HP.lo H5I.lo \ - H5Itest.lo H5L.lo H5Lexternal.lo H5lib_settings.lo H5MF.lo \ - H5MFaggr.lo H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo \ - H5MPtest.lo H5O.lo H5Oainfo.lo H5Oalloc.lo H5Oattr.lo \ - H5Oattribute.lo H5Obogus.lo H5Obtreek.lo H5Ocache.lo \ - H5Ochunk.lo H5Ocont.lo H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo \ - H5Odtype.lo H5Oefl.lo H5Ofill.lo H5Ofsinfo.lo H5Oginfo.lo \ - H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo \ - H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \ - H5Oshared.lo H5Ostab.lo H5Oshmesg.lo H5Otest.lo H5Ounknown.lo \ - H5P.lo H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo \ - H5Pdxpl.lo H5Pencdec.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo \ - H5Pgcpl.lo H5Pmcpl.lo H5Pmapl.lo H5Pint.lo H5Prcapl.lo \ - H5Ptrspl.lo H5Ptrfpl.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo \ - H5Pocpypl.lo H5Pstrcpl.lo H5Ptest.lo H5PL.lo H5Q.lo H5R.lo \ - H5Rdeprec.lo H5UC.lo H5RS.lo H5S.lo H5Sall.lo H5Sdbg.lo \ - H5Shyper.lo H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo \ - H5Stest.lo H5SL.lo H5SM.lo H5SMbtree2.lo H5SMcache.lo \ - H5SMmessage.lo H5SMtest.lo H5ST.lo H5T.lo H5Tarray.lo \ - H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo \ - H5Tdbg.lo H5Tdeprec.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo \ - H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Toh.lo \ - H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo \ - H5Tvisit.lo H5Tvlen.lo H5TS.lo H5VM.lo H5WB.lo H5Z.lo \ - H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \ - H5Zszip.lo H5Zscaleoffset.lo H5Ztrans.lo + H5VLiod_trans.lo H5VLiod_view.lo H5VLiod_analysis.lo H5FD.lo \ + H5FDcore.lo H5FDdirect.lo H5FDfamily.lo H5FDint.lo H5FDlog.lo \ + H5FDmpi.lo H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo \ + H5FDsec2.lo H5FDspace.lo H5FDstdio.lo H5FF.lo H5ES.lo H5RC.lo \ + H5TR.lo H5M.lo H5AS.lo H5V.lo H5FL.lo H5FO.lo H5FS.lo \ + H5FScache.lo H5FSdbg.lo H5FSsection.lo H5FSstat.lo H5FStest.lo \ + H5G.lo H5Gbtree2.lo H5Gcache.lo H5Gcompact.lo H5Gdense.lo \ + H5Gdeprec.lo H5Gent.lo H5Gint.lo H5Glink.lo H5Gloc.lo \ + H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Groot.lo H5Gstab.lo \ + H5Gtest.lo H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo \ + H5HFdbg.lo H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo \ + H5HFiblock.lo H5HFiter.lo H5HFman.lo H5HFsection.lo \ + H5HFspace.lo H5HFstat.lo H5HFtest.lo H5HFtiny.lo H5HG.lo \ + H5HGcache.lo H5HGdbg.lo H5HGquery.lo H5HL.lo H5HLcache.lo \ + H5HLdbg.lo H5HLint.lo H5HP.lo H5I.lo H5Itest.lo H5L.lo \ + H5Lexternal.lo H5lib_settings.lo H5MF.lo H5MFaggr.lo \ + H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo \ + H5Oainfo.lo H5Oalloc.lo H5Oattr.lo H5Oattribute.lo H5Obogus.lo \ + H5Obtreek.lo H5Ocache.lo H5Ochunk.lo H5Ocont.lo H5Ocopy.lo \ + H5Odbg.lo H5Odrvinfo.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo \ + H5Ofsinfo.lo H5Oginfo.lo H5Olayout.lo H5Olinfo.lo H5Olink.lo \ + H5Omessage.lo H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo \ + H5Orefcount.lo H5Osdspace.lo H5Oshared.lo H5Ostab.lo \ + H5Oshmesg.lo H5Otest.lo H5Ounknown.lo H5P.lo H5Pacpl.lo \ + H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo H5Pdxpl.lo H5Pencdec.lo \ + H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo H5Pgcpl.lo H5Pvcpl.lo \ + H5Pmcpl.lo H5Pmapl.lo H5Pint.lo H5Prcapl.lo H5Ptrspl.lo \ + H5Ptrfpl.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo \ + H5Pstrcpl.lo H5Ptest.lo H5PL.lo H5Q.lo H5R.lo H5Rdeprec.lo \ + H5UC.lo H5RS.lo H5S.lo H5Sall.lo H5Sdbg.lo H5Shyper.lo \ + H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo \ + H5SL.lo H5SM.lo H5SMbtree2.lo H5SMcache.lo H5SMmessage.lo \ + H5SMtest.lo H5ST.lo H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo \ + H5Tcompound.lo H5Tconv.lo H5Tcset.lo H5Tdbg.lo H5Tdeprec.lo \ + H5Tenum.lo H5Tfields.lo H5Tfixed.lo H5Tfloat.lo H5Tinit.lo \ + H5Tnative.lo H5Toffset.lo H5Toh.lo H5Topaque.lo H5Torder.lo \ + H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo H5Tvisit.lo H5Tvlen.lo \ + H5TS.lo H5VM.lo H5WB.lo H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo \ + H5Znbit.lo H5Zshuffle.lo H5Zszip.lo H5Zscaleoffset.lo \ + H5Ztrans.lo libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -587,11 +588,11 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5VL.c H5VLint.c H5VLnative.c \ H5VLiod.c H5VLiod_common.c H5VLiod_client.c H5VLiod_server.c H5VLiod_encdec.c H5VLiod_util.c \ H5VLiod_file.c H5VLiod_group.c H5VLiod_map.c H5VLiod_dset.c H5VLiod_dtype.c \ - H5VLiod_attr.c H5VLiod_link.c H5VLiod_obj.c H5VLiod_trans.c H5VLiod_analysis.c \ + H5VLiod_attr.c H5VLiod_link.c H5VLiod_obj.c H5VLiod_trans.c H5VLiod_view.c H5VLiod_analysis.c \ H5FD.c H5FDcore.c \ H5FDdirect.c H5FDfamily.c H5FDint.c H5FDlog.c H5FDmpi.c H5FDmpio.c \ H5FDmpiposix.c H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c \ - H5FF.c H5ES.c H5RC.c H5TR.c H5M.c H5AS.c\ + H5FF.c H5ES.c H5RC.c H5TR.c H5M.c H5AS.c H5V.c\ H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSsection.c H5FSstat.c H5FStest.c \ H5G.c H5Gbtree2.c H5Gcache.c \ H5Gcompact.c H5Gdense.c H5Gdeprec.c H5Gent.c \ @@ -618,7 +619,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \ H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ - H5Pgcpl.c H5Pmcpl.c H5Pmapl.c H5Pint.c H5Prcapl.c H5Ptrspl.c H5Ptrfpl.c \ + H5Pgcpl.c H5Pvcpl.c H5Pmcpl.c H5Pmapl.c H5Pint.c H5Prcapl.c H5Ptrspl.c H5Ptrfpl.c \ H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \ H5PL.c \ H5Q.c \ @@ -649,7 +650,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h H5FDmpiposix.h \ H5FDmulti.h H5FDsec2.h H5FDstdio.h \ H5VLpublic.h H5VLnative.h H5VLiod.h \ - H5FFpublic.h H5ESpublic.h H5RCpublic.h H5TRpublic.h H5Mpublic.h H5ASpublic.h\ + H5FFpublic.h H5ESpublic.h H5RCpublic.h H5TRpublic.h H5Mpublic.h H5ASpublic.h H5Vpublic.h\ H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5MMpublic.h H5Opublic.h H5Ppublic.h \ H5PLextern.h \ @@ -1003,6 +1004,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ptest.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ptrfpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ptrspl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pvcpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Q.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5R.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5RC.Plo@am__quote@ @@ -1051,6 +1053,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tvisit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Tvlen.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5UC.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5V.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VL.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod.Plo@am__quote@ @@ -1069,6 +1072,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_server.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_trans.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_util.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLiod_view.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VLnative.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5VM.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5WB.Plo@am__quote@ |