summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2017-12-07 00:49:38 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2017-12-07 00:49:38 (GMT)
commitb391e160b0429e7758efbb662ba1f89b28b4fe99 (patch)
treeb9a161c9f38e5eaa0139482763ed94e73849feff
parentfd21843b3845b31c6eec8f8ba7e34de06cadfad9 (diff)
parentec1e00a55f7b005fa9d87f92e58bc312286d0b8a (diff)
downloadhdf5-b391e160b0429e7758efbb662ba1f89b28b4fe99.zip
hdf5-b391e160b0429e7758efbb662ba1f89b28b4fe99.tar.gz
hdf5-b391e160b0429e7758efbb662ba1f89b28b4fe99.tar.bz2
Merge pull request #815 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:vol_normalize to develop
* commit 'ec1e00a55f7b005fa9d87f92e58bc312286d0b8a': Normalization with VOL integration branch.
-rw-r--r--src/H5.c24
-rw-r--r--src/H5Fint.c2
-rw-r--r--src/H5Fmount.c7
-rw-r--r--src/H5Fpkg.h25
-rw-r--r--src/H5Fprivate.h4
-rw-r--r--src/H5Fquery.c8
-rw-r--r--src/H5Pprivate.h12
-rw-r--r--src/hdf5.h52
-rw-r--r--test/h5test.c107
9 files changed, 109 insertions, 132 deletions
diff --git a/src/H5.c b/src/H5.c
index f0a222d..b8fd885 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -19,18 +19,18 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACprivate.h" /* Metadata cache */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free lists */
-#include "H5FSprivate.h" /* File free space */
-#include "H5Lprivate.h" /* Links */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5SLprivate.h" /* Skip lists */
-#include "H5Tprivate.h" /* Datatypes */
-#include "H5FSprivate.h" /* File free space */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5FSprivate.h" /* File free space */
+#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5SLprivate.h" /* Skip lists */
+#include "H5Tprivate.h" /* Datatypes */
+#include "H5FSprivate.h" /* File free space */
/****************/
/* Local Macros */
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 0eb1ea9..8212eb5 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -1574,7 +1574,7 @@ H5F__flush_phase2(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closi
*
* Purpose: Flushes cached data.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
herr_t
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 3cd5c21..17d7850 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -25,9 +25,6 @@
#include "H5MMprivate.h" /* Memory management */
/* PRIVATE PROTOTYPES */
-static herr_t H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child,
- hid_t plist_id, hid_t dxpl_id);
-static herr_t H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id);
static void H5F_mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs);
@@ -99,7 +96,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child,
hid_t H5_ATTR_UNUSED plist_id, hid_t dxpl_id)
{
@@ -265,7 +262,7 @@ done:
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id)
{
H5G_t *child_group = NULL; /* Child's group in parent mtab */
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index d702506..b50b4e5 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -360,16 +360,16 @@ struct H5F_file_t {
* to shared H5F_file_t structs.
*/
struct H5F_t {
- char *open_name; /* Name used to open file */
- char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */
- char *extpath; /* Path for searching target external link file */
- H5F_file_t *shared; /* The shared file info */
- unsigned nopen_objs; /* Number of open object headers*/
- H5FO_t *obj_count; /* # of time each object is opened through top file structure */
- hid_t file_id; /* ID of this file */
- hbool_t closing; /* File is in the process of being closed */
- struct H5F_t *parent; /* Parent file that this file is mounted to */
- unsigned nmounts; /* Number of children mounted to this file */
+ char *open_name; /* Name used to open file */
+ char *actual_name; /* Actual name of the file, after resolving symlinks, etc. */
+ char *extpath; /* Path for searching target external link file */
+ H5F_file_t *shared; /* The shared file info */
+ unsigned nopen_objs; /* Number of open object headers */
+ H5FO_t *obj_count; /* # of time each object is opened through top file structure */
+ hid_t file_id; /* ID of this file */
+ hbool_t closing; /* File is in the process of being closed */
+ struct H5F_t *parent; /* Parent file that this file is mounted to */
+ unsigned nmounts; /* Number of children mounted to this file */
#ifdef H5_HAVE_PARALLEL
H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */
hbool_t coll_md_write; /* Do all metadata writes collectively */
@@ -399,11 +399,12 @@ H5_DLL herr_t H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t
H5_DLL herr_t H5F__flush(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t closing);
H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t meta_dxpl_id, hid_t raw_dxpl_id);
H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
-H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len,
- hid_t meta_dxpl_id, hid_t raw_dxpl_id);
+H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len, hid_t meta_dxpl_id, hid_t raw_dxpl_id);
H5_DLL herr_t H5F_close(H5F_t *f);
/* File mount related routines */
+H5_DLL herr_t H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id, hid_t dxpl_id);
+H5_DLL herr_t H5F_unmount(H5G_loc_t *loc, const char *name, hid_t dxpl_id);
H5_DLL herr_t H5F_close_mounts(H5F_t *f);
H5_DLL int H5F_term_unmount_cb(void *obj_ptr, hid_t obj_id, void *key);
H5_DLL herr_t H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 18d0460..daf0a52 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -586,7 +586,7 @@ typedef struct H5F_t H5F_t;
#define H5_SIZEOF_CHKSUM 4
/* v1 B-tree node signature */
-#define H5B_MAGIC "TREE"
+#define H5B_MAGIC "TREE"
/* v2 B-tree signatures */
#define H5B2_HDR_MAGIC "BTHD" /* Header */
@@ -616,7 +616,7 @@ typedef struct H5F_t H5F_t;
#define H5HF_DBLOCK_MAGIC "FHDB" /* Direct block */
/* Global heap signature */
-#define H5HG_MAGIC "GCOL"
+#define H5HG_MAGIC "GCOL"
/* Local heap signature */
#define H5HL_MAGIC "HEAP"
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index cc2399b..61b4183 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -32,10 +32,10 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
/****************/
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index a468464..374c117 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -17,6 +17,9 @@
#ifndef _H5Pprivate_H
#define _H5Pprivate_H
+/* Early typedefs to avoid circular dependencies */
+typedef struct H5P_genplist_t H5P_genplist_t;
+
/* Include package's public header */
#include "H5Ppublic.h"
@@ -52,12 +55,7 @@ typedef enum H5P_coll_md_read_flag_t {
H5P_USER_TRUE = 1
} H5P_coll_md_read_flag_t;
-/* Forward declarations (for prototypes & type definitions) */
-struct H5O_fill_t;
-struct H5T_t;
-
/* Forward declarations for anonymous H5P objects */
-typedef struct H5P_genplist_t H5P_genplist_t;
typedef struct H5P_genclass_t H5P_genclass_t;
typedef enum H5P_plist_type_t {
@@ -145,6 +143,10 @@ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_FACC[1]; /* File access */
/* Library Private Prototypes */
/******************************/
+/* Forward declaration of structs used below */
+struct H5O_fill_t;
+struct H5T_t;
+
/* Package initialization routine */
H5_DLL herr_t H5P_init(void);
diff --git a/src/hdf5.h b/src/hdf5.h
index fc4541a..1709375 100644
--- a/src/hdf5.h
+++ b/src/hdf5.h
@@ -20,35 +20,35 @@
#define _HDF5_H
#include "H5public.h"
-#include "H5Apublic.h" /* Attributes */
-#include "H5ACpublic.h" /* Metadata cache */
-#include "H5Dpublic.h" /* Datasets */
-#include "H5Epublic.h" /* Errors */
-#include "H5Fpublic.h" /* Files */
-#include "H5FDpublic.h" /* File drivers */
-#include "H5Gpublic.h" /* Groups */
-#include "H5Ipublic.h" /* ID management */
-#include "H5Lpublic.h" /* Links */
-#include "H5MMpublic.h" /* Memory management */
-#include "H5Opublic.h" /* Object headers */
-#include "H5Ppublic.h" /* Property lists */
-#include "H5PLpublic.h" /* Plugins */
-#include "H5Rpublic.h" /* References */
-#include "H5Spublic.h" /* Dataspaces */
-#include "H5Tpublic.h" /* Datatypes */
-#include "H5Zpublic.h" /* Data filters */
+#include "H5Apublic.h" /* Attributes */
+#include "H5ACpublic.h" /* Metadata cache */
+#include "H5Dpublic.h" /* Datasets */
+#include "H5Epublic.h" /* Errors */
+#include "H5Fpublic.h" /* Files */
+#include "H5FDpublic.h" /* File drivers */
+#include "H5Gpublic.h" /* Groups */
+#include "H5Ipublic.h" /* ID management */
+#include "H5Lpublic.h" /* Links */
+#include "H5MMpublic.h" /* Memory management */
+#include "H5Opublic.h" /* Object headers */
+#include "H5Ppublic.h" /* Property lists */
+#include "H5PLpublic.h" /* Plugins */
+#include "H5Rpublic.h" /* References */
+#include "H5Spublic.h" /* Dataspaces */
+#include "H5Tpublic.h" /* Datatypes */
+#include "H5Zpublic.h" /* Data filters */
/* Predefined file drivers */
-#include "H5FDcore.h" /* Files stored entirely in memory */
-#include "H5FDdirect.h" /* Linux direct I/O */
-#include "H5FDfamily.h" /* File families */
-#include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */
-#include "H5FDmpi.h" /* MPI-based file drivers */
-#include "H5FDmulti.h" /* Usage-partitioned file family */
-#include "H5FDsec2.h" /* POSIX unbuffered file I/O */
-#include "H5FDstdio.h" /* Standard C buffered I/O */
+#include "H5FDcore.h" /* Files stored entirely in memory */
+#include "H5FDdirect.h" /* Linux direct I/O */
+#include "H5FDfamily.h" /* File families */
+#include "H5FDlog.h" /* sec2 driver with I/O logging (for debugging) */
+#include "H5FDmpi.h" /* MPI-based file drivers */
+#include "H5FDmulti.h" /* Usage-partitioned file family */
+#include "H5FDsec2.h" /* POSIX unbuffered file I/O */
+#include "H5FDstdio.h" /* Standard C buffered I/O */
#ifdef H5_HAVE_WINDOWS
-#include "H5FDwindows.h" /* Windows buffered I/O */
+#include "H5FDwindows.h" /* Win32 I/O */
#endif
#endif
diff --git a/test/h5test.c b/test/h5test.c
index af45589..bbdd58b 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -104,68 +104,6 @@ static herr_t h5_errors(hid_t estack, void *client_data);
static char * h5_fixname_real(const char *base_name, hid_t fapl, const char *suffix,
char *fullname, size_t size, hbool_t nest_printf);
-
-
-/* A non-usable VFD class and its functions.
- *
- * Usable for testing things like ID handling where we shouldn't mess with the real VFDs.
- */
-static H5FD_t *dummy_vfd_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
-static H5FD_t *dummy_vfd_open(const char H5_ATTR_UNUSED *name, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED maxaddr) { return NULL; }
-
-static herr_t dummy_vfd_close(H5FD_t *_file);
-static herr_t dummy_vfd_close(H5FD_t H5_ATTR_UNUSED *_file) { return FAIL; }
-
-static haddr_t dummy_vfd_get_eoa(const H5FD_t *file, H5FD_mem_t type);
-static haddr_t dummy_vfd_get_eoa(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) { return HADDR_UNDEF; }
-
-static herr_t dummy_vfd_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
-static herr_t dummy_vfd_set_eoa(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t H5_ATTR_UNUSED addr) { return FAIL; }
-
-static haddr_t dummy_vfd_get_eof(const H5FD_t *file, H5FD_mem_t type);
-static haddr_t dummy_vfd_get_eof(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) { return HADDR_UNDEF; }
-
-static herr_t dummy_vfd_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf);
-static herr_t dummy_vfd_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf) { return FAIL; }
-
-static herr_t dummy_vfd_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf);
-static herr_t dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { return FAIL; }
-
-static H5FD_class_t dummy_vfd_class_g = {
- "fake", /* name */
- 1, /* maxaddr */
- H5F_CLOSE_WEAK, /* fc_degree */
- NULL, /* terminate */
- NULL, /* sb_size */
- NULL, /* sb_encode */
- NULL, /* sb_decode */
- 0, /* fapl_size */
- NULL, /* fapl_get */
- NULL, /* fapl_copy */
- NULL, /* fapl_free */
- 0, /* dxpl_size */
- NULL, /* dxpl_copy */
- NULL, /* dxpl_free */
- dummy_vfd_open, /* open */
- dummy_vfd_close, /* close */
- NULL, /* cmp */
- NULL, /* query */
- NULL, /* get_type_map */
- NULL, /* alloc */
- NULL, /* free */
- dummy_vfd_get_eoa, /* get_eoa */
- dummy_vfd_set_eoa, /* set_eoa */
- dummy_vfd_get_eof, /* get_eof */
- NULL, /* get_handle */
- dummy_vfd_read, /* read */
- dummy_vfd_write, /* write */
- NULL, /* flush */
- NULL, /* truncate */
- NULL, /* lock */
- NULL, /* unlock */
- H5FD_FLMAP_DEFAULT /* fl_map */
-};
-
/*-------------------------------------------------------------------------
* Function: h5_errors
@@ -1890,6 +1828,33 @@ error:
return FAIL;
} /* h5_wait_message() */
+/* Functions for the dummy VFD class (see below).
+ *
+ * Useful for testing things like ID handling where we shouldn't mess with the
+ * real VFDs.
+ */
+static H5FD_t *dummy_vfd_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
+static H5FD_t *dummy_vfd_open(const char H5_ATTR_UNUSED *name, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED maxaddr) { return NULL; }
+
+static herr_t dummy_vfd_close(H5FD_t *_file);
+static herr_t dummy_vfd_close(H5FD_t H5_ATTR_UNUSED *_file) { return FAIL; }
+
+static haddr_t dummy_vfd_get_eoa(const H5FD_t *file, H5FD_mem_t type);
+static haddr_t dummy_vfd_get_eoa(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) { return HADDR_UNDEF; }
+
+static herr_t dummy_vfd_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
+static herr_t dummy_vfd_set_eoa(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t H5_ATTR_UNUSED addr) { return FAIL; }
+
+static haddr_t dummy_vfd_get_eof(const H5FD_t *file, H5FD_mem_t type);
+static haddr_t dummy_vfd_get_eof(const H5FD_t H5_ATTR_UNUSED *file, H5FD_mem_t H5_ATTR_UNUSED type) { return HADDR_UNDEF; }
+
+static herr_t dummy_vfd_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, void *buf);
+static herr_t dummy_vfd_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, void H5_ATTR_UNUSED *buf) { return FAIL; }
+
+static herr_t dummy_vfd_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf);
+static herr_t dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { return FAIL; }
+
+
/*-------------------------------------------------------------------------
* Function: h5_get_dummy_vfd_class()
*
@@ -1913,12 +1878,24 @@ error:
H5FD_class_t *
h5_get_dummy_vfd_class(void)
{
- H5FD_class_t *vfd_class = NULL;
+ H5FD_class_t *vfd_class = NULL; /* Dummy VFD that will be returned */
- if(NULL == (vfd_class = (H5FD_class_t *)HDmalloc(sizeof(H5FD_class_t))))
+ /* Create the class and initialize everything to zero/NULL */
+ if(NULL == (vfd_class = (H5FD_class_t *)HDcalloc((size_t)1, sizeof(H5FD_class_t))))
TEST_ERROR;
- HDmemcpy(vfd_class, &dummy_vfd_class_g, sizeof(H5FD_class_t));
+ /* Fill in the minimum parameters to make a VFD that
+ * can be registered.
+ */
+ vfd_class->name = "dummy";
+ vfd_class->maxaddr = 1;
+ vfd_class->open = dummy_vfd_open;
+ vfd_class->close = dummy_vfd_close;
+ vfd_class->get_eoa = dummy_vfd_get_eoa;
+ vfd_class->set_eoa = dummy_vfd_set_eoa;
+ vfd_class->get_eof = dummy_vfd_get_eof;
+ vfd_class->read = dummy_vfd_read;
+ vfd_class->write = dummy_vfd_write;
return vfd_class;