hdf5/test/null_vol_connector.c

161 lines
5.0 KiB
C
Raw Normal View History

2018-10-10 23:10:15 +08:00
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://www.hdfgroup.org/licenses. *
2018-10-10 23:10:15 +08:00
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Purpose: A simple virtual object layer (VOL) connector with almost no
* functionality that is used for testing basic plugin handling
* (registration, etc.).
2018-10-10 23:10:15 +08:00
*/
/* For HDF5 plugin functionality */
#include "H5PLextern.h"
2018-10-10 23:10:15 +08:00
/* This connector's header */
#include "null_vol_connector.h"
/* The VOL class struct */
static const H5VL_class_t null_vol_g = {
H5VL_VERSION, /* VOL class struct version */
2020-09-30 22:27:10 +08:00
NULL_VOL_CONNECTOR_VALUE, /* value */
NULL_VOL_CONNECTOR_NAME, /* name */
0, /* connector version */
2020-09-30 22:27:10 +08:00
0, /* capability flags */
NULL, /* initialize */
NULL, /* terminate */
{
/* info_cls */
(size_t)0, /* size */
NULL, /* copy */
NULL, /* compare */
NULL, /* free */
NULL, /* to_str */
NULL, /* from_str */
},
2020-09-30 22:27:10 +08:00
{
/* wrap_cls */
NULL, /* get_object */
NULL, /* get_wrap_ctx */
NULL, /* wrap_object */
NULL, /* unwrap_object */
NULL, /* free_wrap_ctx */
},
2020-09-30 22:27:10 +08:00
{
/* attribute_cls */
NULL, /* create */
NULL, /* open */
NULL, /* read */
NULL, /* write */
NULL, /* get */
NULL, /* specific */
NULL, /* optional */
NULL /* close */
2018-10-10 23:10:15 +08:00
},
2020-09-30 22:27:10 +08:00
{
/* dataset_cls */
NULL, /* create */
NULL, /* open */
NULL, /* read */
NULL, /* write */
NULL, /* get */
NULL, /* specific */
NULL, /* optional */
NULL /* close */
2018-10-10 23:10:15 +08:00
},
2020-09-30 22:27:10 +08:00
{
/* datatype_cls */
NULL, /* commit */
NULL, /* open */
NULL, /* get_size */
NULL, /* specific */
NULL, /* optional */
NULL /* close */
2018-10-10 23:10:15 +08:00
},
2020-09-30 22:27:10 +08:00
{
/* file_cls */
NULL, /* create */
NULL, /* open */
NULL, /* get */
NULL, /* specific */
NULL, /* optional */
NULL /* close */
2018-10-10 23:10:15 +08:00
},
2020-09-30 22:27:10 +08:00
{
/* group_cls */
NULL, /* create */
NULL, /* open */
NULL, /* get */
NULL, /* specific */
NULL, /* optional */
NULL /* close */
2018-10-10 23:10:15 +08:00
},
2020-09-30 22:27:10 +08:00
{
/* link_cls */
NULL, /* create */
NULL, /* copy */
NULL, /* move */
NULL, /* get */
NULL, /* specific */
NULL /* optional */
2018-10-10 23:10:15 +08:00
},
2020-09-30 22:27:10 +08:00
{
/* object_cls */
NULL, /* open */
NULL, /* copy */
NULL, /* get */
NULL, /* specific */
NULL /* optional */
2018-10-10 23:10:15 +08:00
},
2020-09-30 22:27:10 +08:00
{
/* introspect_cls */
NULL, /* get_conn_cls */
NULL, /* get_cap_flags */
2020-09-30 22:27:10 +08:00
NULL, /* opt_query */
Refactor all the 'H5VL_*_optional' callbacks to move the type of operation out of the va_list, so it's at least possible for another connector to know what the operation is and decide whether to implement it or not. Added a new VOL sub-class called "introspect" where callbacks that report information about the connector or container can be placed. Added an 'opt_query' callback to this sub-class, for a connector to report back to the library whether a particular optional callback operation is supported. Also added a 'get_conn_cls' introspection callback, to retrieve the H5VL_class_t of a connector (either the "current" connector, H5VL_GET_CONN_LVL_CURR, or the terminal connector, H5VL_GET_CONN_LVL_TERM). Moved the "post open" operation from a file 'specific' operation to a file 'optional' operation, now that it's possible to detect (with the 'opt_query' introspection callback) whether a VOL connector implements an optional operation, without just returning an error. Added new internal VOL helper routines: H5VL_object_is_native, to determine if an object is in (or is a) native file, and H5VL_file_is_same, to determine if two objects are in (or are) the same terminal VOL connector's container. (And moved the special handling for FILE_IS_EQUAL operation out of internal VOL callback routine into H5VL_file_is_same) Made new dataset 'get' operation for H5Dvlen_get_buf_size, aligning it better with other 'get' operations in API. Fixed several issues with pass-through connectors, which are now passing the 'make check-passthrough-vol' tests again. A bunch of warning and style cleanups as well.
2019-12-20 12:41:37 +08:00
},
2020-09-30 22:27:10 +08:00
{
/* request_cls */
NULL, /* wait */
NULL, /* notify */
NULL, /* cancel */
NULL, /* specific */
NULL, /* optional */
NULL /* free */
2018-10-10 23:10:15 +08:00
},
2020-09-30 22:27:10 +08:00
{
/* blob_cls */
NULL, /* put */
NULL, /* get */
NULL, /* specific */
NULL /* optional */
},
2020-09-30 22:27:10 +08:00
{
/* token_cls */
NULL, /* cmp */
NULL, /* to_str */
NULL /* from_str */
},
2020-09-30 22:27:10 +08:00
NULL /* optional */
2018-10-10 23:10:15 +08:00
};
/* These two functions are necessary to load this plugin using
* the HDF5 library.
*/
2020-09-30 22:27:10 +08:00
H5PL_type_t
H5PLget_plugin_type(void)
{
return H5PL_TYPE_VOL;
}
const void *
H5PLget_plugin_info(void)
{
return &null_vol_g;
}