diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2020-08-27 19:42:12 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2020-08-27 19:42:12 (GMT) |
commit | 7137f472072b2241c9442961a540c9fc9f2da183 (patch) | |
tree | 88d2de1e42a2dea88d22de4989b571c16434eabb | |
parent | 18cf44a59520dbd9ad6099d382aec961e1e33d69 (diff) | |
parent | 2d6b43feefed8328d595469b9159af954e29c099 (diff) | |
download | hdf5-7137f472072b2241c9442961a540c9fc9f2da183.zip hdf5-7137f472072b2241c9442961a540c9fc9f2da183.tar.gz hdf5-7137f472072b2241c9442961a540c9fc9f2da183.tar.bz2 |
Merge pull request #2862 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:1_12_vfd_stubs to hdf5_1_12
* commit '2d6b43feefed8328d595469b9159af954e29c099':
Adds HDFS VFD stubs to prevent binary compatibility problems
-rw-r--r-- | src/H5FDhdfs.c | 75 | ||||
-rw-r--r-- | src/H5FDhdfs.h | 10 |
2 files changed, 72 insertions, 13 deletions
diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 29d032e..c604c9c 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -20,6 +20,15 @@ * File System (HDFS). */ +#ifdef H5_HAVE_LIBHDFS +/* This source code file is part of the H5FD driver module + * NOTE: If we're just building the binary compatibility stubs, + * we're never going to really initialize the package, so we + * don't include this. + */ +#include "H5FDdrvr_module.h" +#endif /* H5_HAVE_LIBHDFS */ + #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5FDprivate.h" /* File drivers */ @@ -30,11 +39,19 @@ #ifdef H5_HAVE_LIBHDFS -/* This source code file is part of the H5FD driver module */ -#include "H5FDdrvr_module.h" - -/* HDFS routines */ -#include "hdfs.h" +/* HDFS routines + * Have to turn off -Wstrict-prototypes as this header contains functions + * defined as foo() instead of foo(void), which triggers warnings that HDF5 + * then interprets as errors. + * -Wundef isn't interpreted as an error by HDF5, but the header does do + * some bad symbol interpretation that raises a warning that is out of our + * control. + */ +H5_GCC_DIAG_OFF(strict-prototypes) +H5_GCC_DIAG_OFF(undef) +#include <hdfs.h> +H5_GCC_DIAG_ON(strict-prototypes) +H5_GCC_DIAG_ON(undef) /* toggle function call prints: 1 turns on */ #define HDFS_DEBUG 0 @@ -369,12 +386,12 @@ done: hid_t H5FD_hdfs_init(void) { - hid_t ret_value = H5I_INVALID_HID; /* Return value */ #if HDFS_STATS unsigned int bin_i; #endif + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI(H5I_INVALID_HID) #if HDFS_DEBUG HDfprintf(stdout, "called %s.\n", FUNC); @@ -1724,5 +1741,49 @@ H5FD__hdfs_unlock(H5FD_t H5_ATTR_UNUSED *_file) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__hdfs_unlock() */ + +#else /* H5_HAVE_LIBHDFS */ + +/* No-op stubs to avoid binary compatibility problems with previous + * HDF5 1.10 versions. Non-functional versions of these API calls were + * erroneously included in the library even when the HDFS VFD was not + * configured. + */ +hid_t +H5FD_hdfs_init(void) +{ + /* This should never be called since the header doesn't invoke it */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_LEAVE_NOAPI(H5I_INVALID_HID) +} + +herr_t +H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out) +{ + herr_t ret_value = FAIL; + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "i*x", fapl_id, fa_out); + + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "HDFS VFD not included in the HDF5 library") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} + +herr_t +H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) +{ + herr_t ret_value = FAIL; + + FUNC_ENTER_API_NOINIT + H5TRACE2("e", "i*x", fapl_id, fa); + + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "HDFS VFD not included in the HDF5 library") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} + #endif /* H5_HAVE_LIBHDFS */ diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h index d67ab9e..58d7e6e 100644 --- a/src/H5FDhdfs.h +++ b/src/H5FDhdfs.h @@ -28,11 +28,6 @@ #define H5FD_HDFS (-1) #endif /* H5_HAVE_LIBHDFS */ -#ifdef H5_HAVE_LIBHDFS -#ifdef __cplusplus -extern "C" { -#endif - /**************************************************************************** * * Structure: H5FD_hdfs_fapl_t @@ -112,6 +107,10 @@ typedef struct H5FD_hdfs_fapl_t { int32_t stream_buffer_size; } H5FD_hdfs_fapl_t; +#ifdef __cplusplus +extern "C" { +#endif + H5_DLL hid_t H5FD_hdfs_init(void); H5_DLL herr_t H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_out); H5_DLL herr_t H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa); @@ -119,7 +118,6 @@ H5_DLL herr_t H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa); #ifdef __cplusplus } #endif -#endif /* H5_HAVE_LIBHDFS */ #endif /* ifndef H5FDhdfs_H */ |