summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2015-03-16 17:57:46 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2015-03-16 17:57:46 (GMT)
commitb1cd5f4f8a305b295e3a5aecc5ce7e7d9cd9e8c6 (patch)
treeb15d7ff77e1dde6c79cbe05839ac5344168cd5ab
parent25281fc525faf80c9bf96729d3616c2eded6e9fa (diff)
downloadhdf5-b1cd5f4f8a305b295e3a5aecc5ce7e7d9cd9e8c6.zip
hdf5-b1cd5f4f8a305b295e3a5aecc5ce7e7d9cd9e8c6.tar.gz
hdf5-b1cd5f4f8a305b295e3a5aecc5ce7e7d9cd9e8c6.tar.bz2
[svn-r26460] HDFFV-8520: Add api to control plugins
h5committest
-rw-r--r--MANIFEST1
-rw-r--r--hl/src/H5LTparse.c144
-rw-r--r--hl/src/H5LTparse.h4
-rw-r--r--src/H5PL.c184
-rw-r--r--src/H5PLextern.h15
-rw-r--r--src/H5PLprivate.h17
-rw-r--r--src/H5PLpublic.h53
-rw-r--r--src/Makefile.am2
-rw-r--r--src/Makefile.in2
-rw-r--r--src/hdf5.h3
-rw-r--r--test/plugin.c93
11 files changed, 335 insertions, 183 deletions
diff --git a/MANIFEST b/MANIFEST
index cbd58c2..f1ce7ed 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -742,6 +742,7 @@
./src/H5Ptest.c
./src/H5PL.c
./src/H5PLprivate.h
+./src/H5PLpublic.h
./src/H5PLextern.h
./src/H5R.c
./src/H5Rdeprec.c
diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c
index 36591d3..6ca95c54 100644
--- a/hl/src/H5LTparse.c
+++ b/hl/src/H5LTparse.c
@@ -1641,229 +1641,229 @@ yyreduce:
switch (yyn)
{
case 2:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 101 "H5LTparse.y"
{ memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ }
break;
case 3:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 102 "H5LTparse.y"
{ return (yyval.hid);}
break;
case 13:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 116 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I8BE); }
break;
case 14:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 117 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I8LE); }
break;
case 15:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 118 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I16BE); }
break;
case 16:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 119 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I16LE); }
break;
case 17:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 120 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I32BE); }
break;
case 18:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 121 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I32LE); }
break;
case 19:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 122 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I64BE); }
break;
case 20:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 123 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_I64LE); }
break;
case 21:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 124 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U8BE); }
break;
case 22:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 125 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U8LE); }
break;
case 23:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 126 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U16BE); }
break;
case 24:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 127 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U16LE); }
break;
case 25:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 128 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U32BE); }
break;
case 26:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 129 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U32LE); }
break;
case 27:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 130 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U64BE); }
break;
case 28:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 131 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_STD_U64LE); }
break;
case 29:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 132 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); }
break;
case 30:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 133 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); }
break;
case 31:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 134 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); }
break;
case 32:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 135 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); }
break;
case 33:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 136 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); }
break;
case 34:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 137 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); }
break;
case 35:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 138 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); }
break;
case 36:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 139 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); }
break;
case 37:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 140 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); }
break;
case 38:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 141 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); }
break;
case 39:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 142 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); }
break;
case 40:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 145 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); }
break;
case 41:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 146 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); }
break;
case 42:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 147 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); }
break;
case 43:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 148 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); }
break;
case 44:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 149 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); }
break;
case 45:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 150 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); }
break;
case 46:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 151 "H5LTparse.y"
{ (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); }
break;
case 47:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 155 "H5LTparse.y"
{ csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ }
break;
case 48:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 157 "H5LTparse.y"
{ (yyval.hid) = cmpd_stack[csindex].id;
cmpd_stack[csindex].id = 0;
@@ -1873,13 +1873,13 @@ yyreduce:
break;
case 51:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 166 "H5LTparse.y"
{ cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ }
break;
case 52:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 168 "H5LTparse.y"
{
size_t origin_size, new_size;
@@ -1915,7 +1915,7 @@ yyreduce:
break;
case 53:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 201 "H5LTparse.y"
{
(yyval.sval) = yylval.sval;
@@ -1923,25 +1923,25 @@ yyreduce:
break;
case 54:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 206 "H5LTparse.y"
{ (yyval.ival) = 0; }
break;
case 55:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 208 "H5LTparse.y"
{ (yyval.ival) = yylval.ival; }
break;
case 57:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 212 "H5LTparse.y"
{ asindex++; /*pushd onto the stack*/ }
break;
case 58:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 214 "H5LTparse.y"
{
(yyval.hid) = H5Tarray_create2((yyvsp[(5) - (6)].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims);
@@ -1952,13 +1952,13 @@ yyreduce:
break;
case 61:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 224 "H5LTparse.y"
{ arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ }
break;
case 62:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 225 "H5LTparse.y"
{ unsigned ndims = arr_stack[asindex].ndims;
arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival;
@@ -1968,19 +1968,19 @@ yyreduce:
break;
case 65:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 236 "H5LTparse.y"
{ (yyval.hid) = H5Tvlen_create((yyvsp[(3) - (4)].hid)); H5Tclose((yyvsp[(3) - (4)].hid)); }
break;
case 66:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 241 "H5LTparse.y"
{ is_opq_size = 1; }
break;
case 67:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 242 "H5LTparse.y"
{
size_t size = (size_t)yylval.ival;
@@ -1990,13 +1990,13 @@ yyreduce:
break;
case 68:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 247 "H5LTparse.y"
{ is_opq_tag = 1; }
break;
case 69:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 248 "H5LTparse.y"
{
H5Tset_tag((yyvsp[(7) - (13)].hid), yylval.sval);
@@ -2005,19 +2005,19 @@ yyreduce:
break;
case 70:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 252 "H5LTparse.y"
{ (yyval.hid) = (yyvsp[(7) - (15)].hid); }
break;
case 73:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 260 "H5LTparse.y"
{ is_str_size = 1; }
break;
case 74:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 261 "H5LTparse.y"
{
if((yyvsp[(5) - (6)].ival) == H5T_VARIABLE_TOKEN)
@@ -2029,7 +2029,7 @@ yyreduce:
break;
case 75:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 269 "H5LTparse.y"
{
if((yyvsp[(9) - (10)].ival) == H5T_STR_NULLTERM_TOKEN)
@@ -2042,7 +2042,7 @@ yyreduce:
break;
case 76:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 278 "H5LTparse.y"
{
if((yyvsp[(13) - (14)].ival) == H5T_CSET_ASCII_TOKEN)
@@ -2053,7 +2053,7 @@ yyreduce:
break;
case 77:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 285 "H5LTparse.y"
{
if((yyvsp[(17) - (18)].hid) == H5T_C_S1_TOKEN)
@@ -2064,7 +2064,7 @@ yyreduce:
break;
case 78:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 292 "H5LTparse.y"
{
hid_t str_id = (yyvsp[(19) - (20)].hid);
@@ -2085,67 +2085,67 @@ yyreduce:
break;
case 79:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 309 "H5LTparse.y"
{(yyval.ival) = H5T_VARIABLE_TOKEN;}
break;
case 81:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 312 "H5LTparse.y"
{(yyval.ival) = H5T_STR_NULLTERM_TOKEN;}
break;
case 82:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 313 "H5LTparse.y"
{(yyval.ival) = H5T_STR_NULLPAD_TOKEN;}
break;
case 83:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 314 "H5LTparse.y"
{(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;}
break;
case 84:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 316 "H5LTparse.y"
{(yyval.ival) = H5T_CSET_ASCII_TOKEN;}
break;
case 85:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 317 "H5LTparse.y"
{(yyval.ival) = H5T_CSET_UTF8_TOKEN;}
break;
case 86:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 319 "H5LTparse.y"
{(yyval.hid) = H5T_C_S1_TOKEN;}
break;
case 87:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 320 "H5LTparse.y"
{(yyval.hid) = H5T_FORTRAN_S1_TOKEN;}
break;
case 88:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 324 "H5LTparse.y"
{ is_enum = 1; enum_id = H5Tenum_create((yyvsp[(3) - (4)].hid)); H5Tclose((yyvsp[(3) - (4)].hid)); }
break;
case 89:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 326 "H5LTparse.y"
{ is_enum = 0; /*reset*/ (yyval.hid) = enum_id; }
break;
case 92:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 331 "H5LTparse.y"
{
is_enum_memb = 1; /*indicate member of enum*/
@@ -2158,7 +2158,7 @@ yyreduce:
break;
case 93:
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 340 "H5LTparse.y"
{
char char_val=(char)yylval.ival;
@@ -2205,7 +2205,7 @@ yyreduce:
break;
-/* Line 1792 of yacc.c */
+/* Line 1807 of yacc.c */
#line 2191 "H5LTparse.c"
default: break;
}
diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h
index 1461830..621dacd 100644
--- a/hl/src/H5LTparse.h
+++ b/hl/src/H5LTparse.h
@@ -109,7 +109,7 @@ extern int H5LTyydebug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{
-/* Line 2058 of yacc.c */
+/* Line 2065 of yacc.c */
#line 68 "H5LTparse.y"
int ival; /*for integer token*/
@@ -117,7 +117,7 @@ typedef union YYSTYPE
hid_t hid; /*for hid_t token*/
-/* Line 2058 of yacc.c */
+/* Line 2065 of yacc.c */
#line 122 "H5LTparse.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
diff --git a/src/H5PL.c b/src/H5PL.c
index 96a4415..d691eb5 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -23,11 +23,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5PLprivate.h" /* Plugin */
-#include "H5Zprivate.h" /* Filter pipeline */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5PLprivate.h" /* Plugin */
+#include "H5Zprivate.h" /* Filter pipeline */
+
/****************/
/* Local Macros */
@@ -96,6 +97,7 @@ typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void);
typedef const void *(*H5PL_get_plugin_info_t)(void);
#endif /* H5_HAVE_WIN32_API */
+/* Whether to preload pathnames for plugin libraries */
#define H5PL_DEFAULT_PATH H5_DEFAULT_PLUGINDIR
/* Special symbol to indicate no plugin loading */
@@ -107,9 +109,9 @@ typedef const void *(*H5PL_get_plugin_info_t)(void);
/* Type for the list of info for opened plugin libraries */
typedef struct H5PL_table_t {
- H5PL_type_t pl_type; /* plugin type */
- int pl_id; /* ID for the plugin */
- H5PL_HANDLE handle; /* plugin handle */
+ H5PL_type_t pl_type; /* plugin type */
+ int pl_id; /* ID for the plugin */
+ H5PL_HANDLE handle; /* plugin handle */
} H5PL_table_t;
@@ -139,8 +141,8 @@ static herr_t H5PL__close(H5PL_HANDLE handle);
/*******************/
/* Table for opened plugin libraries */
-static size_t H5PL_table_alloc_g = 0;
-static size_t H5PL_table_used_g = 0;
+static size_t H5PL_table_alloc_g = 0;
+static size_t H5PL_table_used_g = 0;
static H5PL_table_t *H5PL_table_g = NULL;
/* Table of location paths for plugin libraries */
@@ -148,8 +150,8 @@ static char *H5PL_path_table_g[H5PL_MAX_PATH_NUM];
static size_t H5PL_num_paths_g = 0;
static hbool_t H5PL_path_found_g = FALSE;
-/* Whether to preload pathnames for plugin libraries */
-static hbool_t H5PL_no_plugin_g = FALSE;
+/* Enable all plugin libraries */
+static unsigned int H5PL_plugin_g = H5PL_ALL_PLUGIN;
/*--------------------------------------------------------------------------
@@ -176,7 +178,7 @@ H5PL__init_interface(void)
if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) {
/* Special symbal "::" means no plugin during data reading. */
if(!HDstrcmp(preload_path, H5PL_NO_PLUGIN))
- H5PL_no_plugin_g = TRUE;
+ H5PL_plugin_g = 0;
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -184,46 +186,83 @@ H5PL__init_interface(void)
/*-------------------------------------------------------------------------
- * Function: H5PL_no_plugin
+ * Function: H5PLset_loading_state
*
- * Purpose: Quick way for filter module to query whether to load plugin
+ * Purpose: Control the loading of dynamic plugin types.
*
- * Return: TRUE: No plugin loading during data reading
+ * This function will not allow plugin types if the pathname from the HDF5_PLUGIN_PRELOAD
+ * environment variable is set to the special "::" string.
*
- * FALSE: Load plugin during data reading
+ * plugin bit = 0, will prevent the use of that dynamic plugin type.
+ * plugin bit = 1, will allow the use of that dynamic plugin type.
*
- * Programmer: Raymond Lu
- * 20 February 2013
+ * H5PL_TYPE_FILTER changes just dynamic filters
+ * A H5PL_ALL_PLUGIN will enable all dynamic plugin types
+ * A zero value will disable all dynamic plugin types
+ *
+ * Return: Non-negative or success
*
*-------------------------------------------------------------------------
*/
-htri_t
-H5PL_no_plugin(void)
+herr_t
+H5PLset_loading_state(unsigned int plugin_type)
{
- htri_t ret_value;
+ char *preload_path;
+ herr_t ret_value = SUCCEED; /* Return value */
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "Iu", plugin_type);
+ /* change the bit value of the requested plugin type(s) */
+ H5PL_plugin_g = plugin_type;
+ /* check if special ENV variable is set and disable all plugin types */
+ if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) {
+ /* Special symbol "::" means no plugin during data reading. */
+ if(!HDstrcmp(preload_path, H5PL_NO_PLUGIN))
+ H5PL_plugin_g = 0;
+ }
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5PLset_loading_state() */
- FUNC_ENTER_NOAPI(FAIL)
- ret_value = (htri_t)H5PL_no_plugin_g;
+/*-------------------------------------------------------------------------
+ * Function: H5PLget_loading_state
+ *
+ * Purpose: Query state of the loading of dynamic plugin types.
+ *
+ * This function will return the state of the global flag.
+ *
+ * Return: Zero if all plugin types are disabled, negative if all
+ * plugin types are enabled, positive if one or more of the plugin types are enabled.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5PLget_loading_state(unsigned int *plugin_type)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("e", "*Iu", plugin_type);
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5PL_no_plugin() */
+ if(plugin_type)
+ *plugin_type = H5PL_plugin_g;
+ done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5PLget_loading_state() */
/*-------------------------------------------------------------------------
- * Function: H5PL_term_interface
+ * Function: H5PL_term_interface
*
- * Purpose: Terminate the H5PL interface: release all memory, reset all
- * global variables to initial values. This only happens if all
- * types have been destroyed from other interfaces.
+ * Purpose: Terminate the H5PL interface: release all memory, reset all
+ * global variables to initial values. This only happens if all
+ * types have been destroyed from other interfaces.
*
- * Return: Success: Positive if any action was taken that might
- * affect some other interface; zero otherwise.
+ * Return: Success: Positive if any action was taken that might
+ * affect some other interface; zero otherwise.
*
- * Failure: Negative.
+ * Failure: Negative.
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 20 February 2013
*
*-------------------------------------------------------------------------
@@ -238,13 +277,13 @@ H5PL_term_interface(void)
if(H5_interface_initialize_g) {
size_t u; /* Local index variable */
- /* Close opened dynamic libraries */
+ /* Close opened dynamic libraries */
for(u = 0; u < H5PL_table_used_g; u++)
H5PL__close((H5PL_table_g[u]).handle);
- /* Free the table of dynamic libraries */
- H5PL_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_table_g);
- H5PL_table_used_g = H5PL_table_alloc_g = 0;
+ /* Free the table of dynamic libraries */
+ H5PL_table_g = (H5PL_table_t *)H5MM_xfree(H5PL_table_g);
+ H5PL_table_used_g = H5PL_table_alloc_g = 0;
/* Free the table of search paths */
for(u = 0; u < H5PL_num_paths_g; u++)
@@ -253,7 +292,7 @@ H5PL_term_interface(void)
H5PL_num_paths_g = 0;
H5PL_path_found_g = FALSE;
- H5_interface_initialize_g = 0;
+ H5_interface_initialize_g = 0;
i = 1;
} /* end if */
@@ -262,15 +301,15 @@ H5PL_term_interface(void)
/*-------------------------------------------------------------------------
- * Function: H5PL_load
+ * Function: H5PL_load
*
- * Purpose: Given the plugin type and identifier, this function searches
+ * Purpose: Given the plugin type and identifier, this function searches
* and/or loads a dynamic plugin library first among the already
* opened libraries then in the designated location paths.
*
- * Return: Non-NULL on success/NULL on failure
+ * Return: Non-NULL on success/NULL on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 13 February 2013
*
*-------------------------------------------------------------------------
@@ -284,9 +323,14 @@ H5PL_load(H5PL_type_t type, int id)
FUNC_ENTER_NOAPI(NULL)
- /* Check for "no plugins" indicated" */
- if(H5PL_no_plugin_g)
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id)
+ switch (type) {
+ case H5PL_TYPE_FILTER:
+ if((H5PL_plugin_g & H5PL_FILTER_PLUGIN) == 0)
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id)
+ break;
+ default:
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin '%d' is not valid", id)
+ }
/* Initialize the location paths for dynamic libraries, if they aren't
* already set up.
@@ -325,13 +369,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5PL__init_path_table
+ * Function: H5PL__init_path_table
*
- * Purpose: Initialize the path table.
+ * Purpose: Initialize the path table.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* 18 March 2013
*
*-------------------------------------------------------------------------
@@ -380,18 +424,18 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5PL__find
+ * Function: H5PL__find
*
* Purpose: Given a path, this function opens the directory and envokes
* another function to go through all files to find the right
* plugin library. Two function definitions are for Unix and
* Windows.
*
- * Return: TRUE on success,
+ * Return: TRUE on success,
* FALSE on not found,
* negative on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 13 February 2013
*
*-------------------------------------------------------------------------
@@ -491,7 +535,7 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info)
/* Allocate & initialize the path name */
pathname_len = HDstrlen(dir) + HDstrlen(fdFile.cFileName) + 2;
- if(NULL == (pathname = (char *)H5MM_malloc(pathname_len)))
+ if(NULL == (pathname = (char *)H5MM_malloc(pathname_len)))
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path")
HDsnprintf(pathname, pathname_len, "%s\\%s", dir, fdFile.cFileName);
@@ -506,7 +550,7 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info)
HGOTO_DONE(TRUE)
} /* end if */
else
- HDassert(pathname);
+ HDassert(pathname);
pathname = (char *)H5MM_xfree(pathname);
} /* end if */
} while(FindNextFileA(hFind, &fdFile)); /* Find the next file. */
@@ -523,17 +567,17 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5PL__open
+ * Function: H5PL__open
*
* Purpose: Iterates through all files to find the right plugin library.
* It loads the dynamic plugin library and keeps it on the list
- * of loaded libraries.
+ * of loaded libraries.
*
- * Return: TRUE on success,
+ * Return: TRUE on success,
* FALSE on not found,
* negative on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 13 February 2013
*
*-------------------------------------------------------------------------
@@ -611,16 +655,16 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5PL__search_table
+ * Function: H5PL__search_table
*
* Purpose: Search in the list of already opened dynamic libraries
* to see if the one we are looking for is already opened.
*
- * Return: TRUE on success,
+ * Return: TRUE on success,
* FALSE on not found,
* Negative on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 13 February 2013
*
*-------------------------------------------------------------------------
@@ -642,12 +686,12 @@ H5PL__search_table(H5PL_type_t plugin_type, int type_id, const void **info)
const H5Z_class2_t *plugin_info;
if(NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC((H5PL_table_g[i]).handle, "H5PLget_plugin_info")))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info")
- if(NULL == (plugin_info = (const H5Z_class2_t *)(*get_plugin_info)()))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info")
+ if(NULL == (plugin_info = (const H5Z_class2_t *)(*get_plugin_info)()))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get plugin info")
- *info = plugin_info;
+ *info = plugin_info;
HGOTO_DONE(TRUE)
} /* end if */
} /* end for */
@@ -659,13 +703,13 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5PL__close
+ * Function: H5PL__close
*
* Purpose: Closes the handle for dynamic library
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 13 February 2013
*
*-------------------------------------------------------------------------
diff --git a/src/H5PLextern.h b/src/H5PLextern.h
index 7f10575..3264435 100644
--- a/src/H5PLextern.h
+++ b/src/H5PLextern.h
@@ -22,20 +22,6 @@
/* Include HDF5 header */
#include "hdf5.h"
-#ifndef H5_VMS
-
-/*******************/
-/* Public Typedefs */
-/*******************/
-
-/* Plugin type */
-typedef enum H5PL_type_t {
- H5PL_TYPE_ERROR = -1, /*error */
- H5PL_TYPE_FILTER = 0, /*filter */
- H5PL_TYPE_NONE = 1 /*this must be last! */
-} H5PL_type_t;
-
-
/* plugins always export */
#if defined (_MSC_VER) /* MSVC Compiler Case */
#define H5PLUGIN_DLL __declspec(dllexport)
@@ -55,7 +41,6 @@ H5PLUGIN_DLL const void *H5PLget_plugin_info(void);
#ifdef __cplusplus
}
#endif
-#endif /*H5_VMS*/
#endif /* _H5PLextern_H */
diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h
index a1b77ea..77e115b 100644
--- a/src/H5PLprivate.h
+++ b/src/H5PLprivate.h
@@ -19,23 +19,12 @@
#ifndef _H5PLprivate_H
#define _H5PLprivate_H
-/* Keep the following in sync with the package's "external" header */
-
-/*******************/
-/* Public Typedefs */
-/*******************/
-
-/* Plugin type */
-typedef enum H5PL_type_t {
- H5PL_TYPE_ERROR = -1, /*error */
- H5PL_TYPE_FILTER = 0, /*filter */
- H5PL_TYPE_NONE = 1 /*this must be last! */
-} H5PL_type_t;
+/* Include package's public header */
+#include "H5PLpublic.h"
/* Private headers needed by this file */
#include "H5private.h" /* Generic Functions */
-#ifndef H5_VMS
/**************************/
/* Library Private Macros */
@@ -58,8 +47,6 @@ typedef enum H5PL_type_t {
/* Internal API routines */
H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, int type_id);
-H5_DLL htri_t H5PL_no_plugin(void);
-#endif /*H5_VMS*/
#endif /* _H5PLprivate_H */
diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h
new file mode 100644
index 0000000..0296819
--- /dev/null
+++ b/src/H5PLpublic.h
@@ -0,0 +1,53 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Programmer: Raymond Lu <songyulu@hdfgroup.org>
+ * 13 February 2013
+ */
+
+#ifndef _H5PLpublic_H
+#define _H5PLpublic_H
+
+/* Public headers needed by this file */
+#include "H5public.h" /* Generic Functions */
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/* Plugin type used by the plugin library */
+typedef enum H5PL_type_t {
+ H5PL_TYPE_ERROR = -1, /*error */
+ H5PL_TYPE_FILTER = 0, /*filter */
+ H5PL_TYPE_NONE = 1 /*this must be last! */
+} H5PL_type_t;
+
+/* Common dynamic plugin type flags used by the set/get_loading_state functions */
+#define H5PL_FILTER_PLUGIN 0x0001
+#define H5PL_ALL_PLUGIN 0xFFFF
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* plugin state */
+H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_type);
+H5_DLL herr_t H5PLget_loading_state(unsigned int *plugin_type/*out*/);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5PLpublic_H */
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 004a01b..bc94252 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -114,7 +114,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5FDmulti.h H5FDsec2.h H5FDstdio.h \
H5Gpublic.h H5Ipublic.h H5Lpublic.h \
H5MMpublic.h H5Opublic.h H5Ppublic.h \
- H5PLextern.h \
+ H5PLextern.h H5PLpublic.h \
H5Rpublic.h H5Spublic.h \
H5Tpublic.h H5Zpublic.h
diff --git a/src/Makefile.in b/src/Makefile.in
index 31335c8..10a307e 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -813,7 +813,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5FDmulti.h H5FDsec2.h H5FDstdio.h \
H5Gpublic.h H5Ipublic.h H5Lpublic.h \
H5MMpublic.h H5Opublic.h H5Ppublic.h \
- H5PLextern.h \
+ H5PLextern.h H5PLpublic.h \
H5Rpublic.h H5Spublic.h \
H5Tpublic.h H5Zpublic.h
diff --git a/src/hdf5.h b/src/hdf5.h
index ef15063..fb41007 100644
--- a/src/hdf5.h
+++ b/src/hdf5.h
@@ -33,7 +33,8 @@
#include "H5Lpublic.h" /* Links */
#include "H5MMpublic.h" /* Memory management */
#include "H5Opublic.h" /* Object headers */
-#include "H5Ppublic.h" /* Property lists */
+#include "H5Ppublic.h" /* Property lists */
+#include "H5PLpublic.h" /* Plugins */
#include "H5Rpublic.h" /* References */
#include "H5Spublic.h" /* Dataspaces */
#include "H5Tpublic.h" /* Datatypes */
diff --git a/test/plugin.c b/test/plugin.c
index 86bc952..02007d5 100644
--- a/test/plugin.c
+++ b/test/plugin.c
@@ -456,14 +456,14 @@ error:
}
/*-------------------------------------------------------------------------
- * Function: test_read_with_filters
+ * Function: test_read_with_filters
*
- * Purpose: Tests reading dataset created with dynamically loaded filters
+ * Purpose: Tests reading dataset created with dynamically loaded filters
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 14 March 2013
*
*-------------------------------------------------------------------------
@@ -471,7 +471,7 @@ error:
static herr_t
test_read_with_filters(hid_t file)
{
- hid_t dset; /* Dataset ID */
+ hid_t dset; /* Dataset ID */
/*----------------------------------------------------------
* STEP 1: Test deflation by itself.
@@ -526,6 +526,76 @@ error:
}
/*-------------------------------------------------------------------------
+ * Function: test_noread_data
+ *
+ * Purpose: Tests not reading data
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_noread_data(hid_t dataset, int *origin_data)
+{
+ int check[DSET_DIM1][DSET_DIM2];
+ const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
+ int *data_p = origin_data;
+ size_t i, j; /* Local index variables */
+
+ /* Read the dataset back */
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) >= 0)
+ TEST_ERROR;
+
+ PASSED();
+ return 0;
+
+error:
+ return -1;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: test_noread_with_filters
+ *
+ * Purpose: Tests reading dataset created with dynamically loaded filters disabled
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_noread_with_filters(hid_t file)
+{
+ hid_t dset; /* Dataset ID */
+ unsigned plugin_state; /* status of plugins */
+ TESTING("Testing DYNLIB1 filter with plugins disabled");
+
+ /* disable filter plugin */
+ if(H5PLget_loading_state(&plugin_state) < 0) TEST_ERROR
+ plugin_state = plugin_state & ~H5PL_FILTER_PLUGIN;
+ if(H5PLset_loading_state(plugin_state) < 0) TEST_ERROR
+
+ if((dset = H5Dopen2(file,DSET_DYNLIB1_NAME,H5P_DEFAULT)) < 0) TEST_ERROR
+
+ if(test_noread_data(dset, (int *)points_dynlib1) < 0) TEST_ERROR
+
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* re-enable filter plugin */
+ plugin_state = plugin_state | H5PL_FILTER_PLUGIN;
+ if(H5PLset_loading_state(plugin_state) < 0) TEST_ERROR
+
+ return 0;
+
+error:
+ /* re-enable filter plugin */
+ plugin_state = plugin_state | H5PL_FILTER_PLUGIN;
+ if(H5PLset_loading_state(plugin_state) < 0) TEST_ERROR
+ return -1;
+}
+
+/*-------------------------------------------------------------------------
* Function: test_filters_for_groups
*
* Purpose: Tests creating group with dynamically loaded filters
@@ -713,6 +783,17 @@ main(void)
/* Open the groups with filters */
nerrors += (test_groups_with_filters(file) < 0 ? 1 : 0);
+ /* Close the library so that all loaded plugin libraries are unloaded */
+ h5_reset();
+ fapl = h5_fileaccess();
+
+ /* Reopen the file for testing data reading */
+ if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
+
+ /* Read the data with disabled filters */
+ nerrors += (test_noread_with_filters(file) < 0 ? 1 : 0);
+
if(H5Fclose(file) < 0)
TEST_ERROR