diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2019-06-05 20:04:06 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2019-06-05 20:04:06 (GMT) |
commit | b31a53bfcbea9a0cb157fa0390f3e197d1420493 (patch) | |
tree | 000b1ca72ade49e7aa07aa39e0822263ca1fcfaf /src | |
parent | cb82b6c22262bb7d605e4f723b09bc834282e9c4 (diff) | |
parent | a18727bc77c90a9925cabbde8d8ec46c757c6254 (diff) | |
download | hdf5-b31a53bfcbea9a0cb157fa0390f3e197d1420493.zip hdf5-b31a53bfcbea9a0cb157fa0390f3e197d1420493.tar.gz hdf5-b31a53bfcbea9a0cb157fa0390f3e197d1420493.tar.bz2 |
Merge pull request #1719 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:vipl to develop
* commit 'a18727bc77c90a9925cabbde8d8ec46c757c6254':
Added a VOL initialization property list type.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Pint.c | 105 | ||||
-rw-r--r-- | src/H5Pprivate.h | 1 | ||||
-rw-r--r-- | src/H5Ppublic.h | 4 | ||||
-rw-r--r-- | src/H5VL.c | 22 |
4 files changed, 95 insertions, 37 deletions
diff --git a/src/H5Pint.c b/src/H5Pint.c index b07f42d..04411a5 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -127,62 +127,65 @@ static herr_t H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H * Predefined property list classes. These are initialized at runtime by * H5P__init_package() in this source file. */ -hid_t H5P_CLS_ROOT_ID_g = FAIL; +hid_t H5P_CLS_ROOT_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_ROOT_g = NULL; -hid_t H5P_CLS_OBJECT_CREATE_ID_g = FAIL; +hid_t H5P_CLS_OBJECT_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_OBJECT_CREATE_g = NULL; -hid_t H5P_CLS_FILE_CREATE_ID_g = FAIL; +hid_t H5P_CLS_FILE_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_FILE_CREATE_g = NULL; -hid_t H5P_CLS_FILE_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_FILE_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_FILE_ACCESS_g = NULL; -hid_t H5P_CLS_DATASET_CREATE_ID_g = FAIL; +hid_t H5P_CLS_DATASET_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATASET_CREATE_g = NULL; -hid_t H5P_CLS_DATASET_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_DATASET_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATASET_ACCESS_g = NULL; -hid_t H5P_CLS_DATASET_XFER_ID_g = FAIL; +hid_t H5P_CLS_DATASET_XFER_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATASET_XFER_g = NULL; -hid_t H5P_CLS_FILE_MOUNT_ID_g = FAIL; +hid_t H5P_CLS_FILE_MOUNT_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_FILE_MOUNT_g = NULL; -hid_t H5P_CLS_GROUP_CREATE_ID_g = FAIL; +hid_t H5P_CLS_GROUP_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_GROUP_CREATE_g = NULL; -hid_t H5P_CLS_GROUP_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_GROUP_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g = NULL; -hid_t H5P_CLS_DATATYPE_CREATE_ID_g = FAIL; +hid_t H5P_CLS_DATATYPE_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g = NULL; -hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g = NULL; -hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = FAIL; +hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g = NULL; -hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g = NULL; -hid_t H5P_CLS_OBJECT_COPY_ID_g = FAIL; +hid_t H5P_CLS_OBJECT_COPY_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_OBJECT_COPY_g = NULL; -hid_t H5P_CLS_LINK_CREATE_ID_g = FAIL; +hid_t H5P_CLS_LINK_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_LINK_CREATE_g = NULL; -hid_t H5P_CLS_LINK_ACCESS_ID_g = FAIL; +hid_t H5P_CLS_LINK_ACCESS_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_LINK_ACCESS_g = NULL; -hid_t H5P_CLS_STRING_CREATE_ID_g = FAIL; +hid_t H5P_CLS_STRING_CREATE_ID_g = H5I_INVALID_HID; H5P_genclass_t *H5P_CLS_STRING_CREATE_g = NULL; +hid_t H5P_CLS_VOL_INITIALIZE_ID_g = H5I_INVALID_HID; +H5P_genclass_t *H5P_CLS_VOL_INITIALIZE_g = NULL; /* * Predefined property lists for each predefined class. These are initialized * at runtime by H5P__init_package() in this source file. */ -hid_t H5P_LST_FILE_CREATE_ID_g = FAIL; -hid_t H5P_LST_FILE_ACCESS_ID_g = FAIL; -hid_t H5P_LST_DATASET_CREATE_ID_g = FAIL; -hid_t H5P_LST_DATASET_ACCESS_ID_g = FAIL; -hid_t H5P_LST_DATASET_XFER_ID_g = FAIL; -hid_t H5P_LST_FILE_MOUNT_ID_g = FAIL; -hid_t H5P_LST_GROUP_CREATE_ID_g = FAIL; -hid_t H5P_LST_GROUP_ACCESS_ID_g = FAIL; -hid_t H5P_LST_DATATYPE_CREATE_ID_g = FAIL; -hid_t H5P_LST_DATATYPE_ACCESS_ID_g = FAIL; -hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = FAIL; -hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = FAIL; -hid_t H5P_LST_OBJECT_COPY_ID_g = FAIL; -hid_t H5P_LST_LINK_CREATE_ID_g = FAIL; -hid_t H5P_LST_LINK_ACCESS_ID_g = FAIL; +hid_t H5P_LST_FILE_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_FILE_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATASET_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATASET_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATASET_XFER_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_FILE_MOUNT_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_GROUP_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_GROUP_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATATYPE_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_DATATYPE_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_OBJECT_COPY_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_LINK_CREATE_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_LINK_ACCESS_ID_g = H5I_INVALID_HID; +hid_t H5P_LST_VOL_INITIALIZE_ID_g = H5I_INVALID_HID; /* Root property list class library initialization object */ const H5P_libclass_t H5P_CLS_ROOT[1] = {{ @@ -283,6 +286,26 @@ const H5P_libclass_t H5P_CLS_TACC[1] = {{ NULL /* Class close callback info */ }}; +/* VOL initialization property list class library initialization object */ +/* (move to proper source code file when used for real) */ +const H5P_libclass_t H5P_CLS_VINI[1] = {{ + "VOL initialization", /* Class name for debugging */ + H5P_TYPE_VOL_INITIALIZE, /* Class type */ + + &H5P_CLS_ROOT_g, /* Parent class */ + &H5P_CLS_VOL_INITIALIZE_g, /* Pointer to class */ + &H5P_CLS_VOL_INITIALIZE_ID_g, /* Pointer to class ID */ + &H5P_LST_VOL_INITIALIZE_ID_g, /* Pointer to default property list ID */ + NULL, /* 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 property list classes defined in other code modules */ /* (And not present in src/H5Pprivate.h) */ @@ -331,7 +354,8 @@ static H5P_libclass_t const * const init_class[] = { H5P_CLS_TACC, /* Datatype access */ H5P_CLS_ACRT, /* Attribute creation */ H5P_CLS_AACC, /* Attribute access */ - H5P_CLS_LCRT /* Link creation */ + H5P_CLS_LCRT, /* Link creation */ + H5P_CLS_VINI /* VOL initialization */ }; /* Declare a free list to manage the H5P_genclass_t struct */ @@ -525,7 +549,8 @@ H5P_term_package(void) H5P_LST_OBJECT_COPY_ID_g = H5P_LST_LINK_CREATE_ID_g = H5P_LST_LINK_ACCESS_ID_g = - H5P_LST_FILE_MOUNT_ID_g = (-1); + H5P_LST_VOL_INITIALIZE_ID_g = + H5P_LST_FILE_MOUNT_ID_g = H5I_INVALID_HID; } /* end if */ } /* end if */ @@ -552,6 +577,7 @@ H5P_term_package(void) H5P_CLS_OBJECT_COPY_g = H5P_CLS_LINK_CREATE_g = H5P_CLS_LINK_ACCESS_g = + H5P_CLS_VOL_INITIALIZE_g = H5P_CLS_FILE_MOUNT_g = NULL; H5P_CLS_ROOT_ID_g = @@ -571,7 +597,8 @@ H5P_term_package(void) H5P_CLS_OBJECT_COPY_ID_g = H5P_CLS_LINK_CREATE_ID_g = H5P_CLS_LINK_ACCESS_ID_g = - H5P_CLS_FILE_MOUNT_ID_g = (-1); + H5P_CLS_VOL_INITIALIZE_ID_g = + H5P_CLS_FILE_MOUNT_ID_g = H5I_INVALID_HID; } /* end if */ } /* end if */ @@ -5408,7 +5435,7 @@ H5P__new_plist_of_type(H5P_plist_type_t type) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDcompile_assert(H5P_TYPE_ATTRIBUTE_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); + HDcompile_assert(H5P_TYPE_VOL_INITIALIZE == (H5P_TYPE_MAX_TYPE - 1)); HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_LINK_ACCESS); /* Check arguments */ @@ -5487,6 +5514,10 @@ H5P__new_plist_of_type(H5P_plist_type_t type) class_id = H5P_CLS_LINK_ACCESS_ID_g; break; + case H5P_TYPE_VOL_INITIALIZE: + class_id = H5P_CLS_VOL_INITIALIZE_ID_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 49f7a12..07910c3 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -78,6 +78,7 @@ typedef enum H5P_plist_type_t { H5P_TYPE_LINK_CREATE = 16, H5P_TYPE_LINK_ACCESS = 17, H5P_TYPE_ATTRIBUTE_ACCESS = 18, + H5P_TYPE_VOL_INITIALIZE = 19, H5P_TYPE_MAX_TYPE } H5P_plist_type_t; diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 90e6618..cad2071 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -68,6 +68,7 @@ #define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g) #define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g) #define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g) +#define H5P_VOL_INITIALIZE (H5OPEN H5P_CLS_VOL_INITIALIZE_ID_g) /* * The library's default property lists @@ -87,6 +88,7 @@ #define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g) #define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g) #define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g) +#define H5P_VOL_INITIALIZE_DEFAULT (H5OPEN H5P_LST_VOL_INITIALIZE_ID_g) /* Common creation order flags (for links in groups and attributes on objects) */ #define H5P_CRT_ORDER_TRACKED 0x0001 @@ -195,6 +197,7 @@ H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_OBJECT_COPY_ID_g; H5_DLLVAR hid_t H5P_CLS_LINK_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_ID_g; +H5_DLLVAR hid_t H5P_CLS_VOL_INITIALIZE_ID_g; /* Default roperty list IDs */ /* (Internal to library, do not use! Use macros above) */ @@ -213,6 +216,7 @@ H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_ID_g; H5_DLLVAR hid_t H5P_LST_LINK_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_LINK_ACCESS_ID_g; +H5_DLLVAR hid_t H5P_LST_VOL_INITIALIZE_ID_g; /*********************/ /* Public Prototypes */ @@ -31,6 +31,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ #include "H5VLpkg.h" /* Virtual Object Layer */ /* VOL connectors */ @@ -101,6 +102,13 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id) if (cls->wrap_cls.get_wrap_ctx && !cls->wrap_cls.free_wrap_ctx) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get callback is provided") + /* Check VOL initialization property list */ + if(H5P_DEFAULT == vipl_id) + vipl_id = H5P_VOL_INITIALIZE_DEFAULT; + else + if(TRUE != H5P_isa_class(vipl_id, H5P_VOL_INITIALIZE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list") + /* Register connector */ if((ret_value = H5VL__register_connector(cls, TRUE, vipl_id)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") @@ -138,6 +146,13 @@ H5VLregister_connector_by_name(const char *name, hid_t vipl_id) if (0 == HDstrlen(name)) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "zero-length VOL connector name is disallowed") + /* Check VOL initialization property list */ + if(H5P_DEFAULT == vipl_id) + vipl_id = H5P_VOL_INITIALIZE_DEFAULT; + else + if(TRUE != H5P_isa_class(vipl_id, H5P_VOL_INITIALIZE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list") + /* Register connector */ if((ret_value = H5VL__register_connector_by_name(name, TRUE, vipl_id)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") @@ -173,6 +188,13 @@ H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id) if(value < 0) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "negative VOL connector value is disallowed") + /* Check VOL initialization property list */ + if(H5P_DEFAULT == vipl_id) + vipl_id = H5P_VOL_INITIALIZE_DEFAULT; + else + if(TRUE != H5P_isa_class(vipl_id, H5P_VOL_INITIALIZE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list") + /* Register connector */ if((ret_value = H5VL__register_connector_by_value(value, TRUE, vipl_id)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") |