From b496ac1482d97086112c890a0154ce9e1522a815 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 15 May 2003 14:22:33 -0500 Subject: [svn-r6878] Purpose: Code cleanup Description: Limit the scope on more function prototypes/macros/typedefs. Platforms tested: FreeBSD 4.8 (sleipnir) h5committest not necessary. --- MANIFEST | 2 ++ src/H5.c | 29 +++++++-------- src/H5AC.c | 16 ++++----- src/H5ACprivate.h | 4 +-- src/H5B.c | 32 +++++++++++------ src/H5Bpkg.h | 72 +++++++++++++++++++++++++++++++++++++ src/H5Bprivate.h | 39 ++++---------------- src/H5D.c | 6 ++-- src/H5Distore.c | 3 +- src/H5Dpkg.h | 9 ++++- src/H5Dprivate.h | 2 +- src/H5F.c | 33 +++++++++-------- src/H5Fistore.c | 3 +- src/H5Fpkg.h | 12 ++++--- src/H5Fprivate.h | 27 +++++++------- src/H5G.c | 52 ++++++++++++++++++++------- src/H5Gent.c | 19 +++++----- src/H5Gnode.c | 38 +++++++++++++------- src/H5Gpkg.h | 25 +++---------- src/H5Gprivate.h | 26 ++------------ src/H5HG.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++++------ src/H5HGprivate.h | 81 ++++------------------------------------- src/H5HL.c | 29 +++++++++------ src/H5HLprivate.h | 9 ++--- src/H5I.c | 81 +++++++++++++++++++++++++++++++++++------ src/H5Ipkg.h | 67 ++++++++++++++++++++++++++++++++++ src/H5Iprivate.h | 73 ++----------------------------------- src/H5Oprivate.h | 2 +- src/H5Oshared.c | 9 ++--- src/H5Ostab.c | 15 ++++---- src/H5P.c | 48 ++----------------------- src/H5Pfapl.c | 28 ++++++++++----- src/H5Ppkg.h | 11 ++++++ src/H5Pprivate.h | 21 ++--------- test/tgenprop.c | 4 ++- 35 files changed, 579 insertions(+), 453 deletions(-) create mode 100644 src/H5Bpkg.h create mode 100644 src/H5Ipkg.h diff --git a/MANIFEST b/MANIFEST index 58e2d78..69dbb7c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -834,6 +834,7 @@ ./src/H5ACprivate.h ./src/H5ACpublic.h ./src/H5B.c +./src/H5Bpkg.h ./src/H5Bprivate.h ./src/H5Bpublic.h ./src/H5D.c @@ -906,6 +907,7 @@ ./src/H5HP.c ./src/H5HPprivate.h ./src/H5I.c +./src/H5Ipkg.h ./src/H5Iprivate.h ./src/H5Ipublic.h ./src/H5MF.c diff --git a/src/H5.c b/src/H5.c index bb82264..0b92dfd 100644 --- a/src/H5.c +++ b/src/H5.c @@ -12,20 +12,21 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* private headers */ -#include "H5private.h" /*library */ -#include "H5Bprivate.h" /*B-link trees */ -#include "H5Dprivate.h" /*datasets */ -#include "H5Eprivate.h" /*error handling */ -#include "H5FDprivate.h" /*file driver */ -#include "H5FLprivate.h" /*free lists */ -#include "H5Iprivate.h" /*atoms */ -#include "H5MMprivate.h" /*memory management */ -#include "H5Pprivate.h" /*property lists */ -#include "H5Rpublic.h" /*references */ -#include "H5Sprivate.h" /*data spaces */ -#include "H5Tprivate.h" /*data types */ -#include "H5Zprivate.h" /*filters */ +#define H5I_PACKAGE /*suppress error about including H5Ipkg */ + +#include "H5private.h" /* Generic Functions */ +#include "H5Bprivate.h" /* B-link trees */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5Ipkg.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Rpublic.h" /* References */ +#include "H5Sprivate.h" /* Dataspaces */ +#include "H5Tprivate.h" /* Datatypes */ +#include "H5Zprivate.h" /* I/O pipeline filters */ /* datatypes of predefined drivers needed by H5_trace() */ #include "H5FDmpio.h" diff --git a/src/H5AC.c b/src/H5AC.c index cc30073..41661af 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -36,15 +36,15 @@ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#include "H5private.h" -#include "H5ACprivate.h" +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5Dprivate.h" /* Dataset functions */ -#include "H5Eprivate.h" -#include "H5Fpkg.h" -#include "H5FLprivate.h" /*Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" -#include "H5Pprivate.h" /* Property lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ /* * The MPIO, MPIPOSIX, & FPHDF5 drivers are needed because there are diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 06e3a27..dbe4ec9 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -32,8 +32,8 @@ #include "H5ACpublic.h" /*public prototypes */ /* Pivate headers needed by this header */ -#include "H5private.h" -#include "H5Fprivate.h" +#include "H5private.h" /* Generic Functions */ +#include "H5Fprivate.h" /* File access */ /* * Feature: Define H5AC_DEBUG on the compiler command line if you want to diff --git a/src/H5B.c b/src/H5B.c index 15b4c13..5f244f3 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -97,24 +97,34 @@ *------------------------------------------------------------------------- */ +#define H5B_PACKAGE /*suppress error about including H5Bpkg */ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ /* private headers */ -#include "H5private.h" /*library */ -#include "H5ACprivate.h" /*cache */ -#include "H5Bprivate.h" /*B-link trees */ -#include "H5Eprivate.h" /*error handling */ -#include "H5Fpkg.h" /*file access */ -#include "H5FLprivate.h" /*Free Lists */ -#include "H5Iprivate.h" /*IDs */ -#include "H5MFprivate.h" /*file memory management */ -#include "H5MMprivate.h" /*core memory management */ -#include "H5Pprivate.h" /*property lists */ - +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Bpkg.h" /* B-link trees */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ + +/* Pablo information */ #define PABLO_MASK H5B_mask +/* Local macros */ + #define BOUND(MIN,X,MAX) ((X)<(MIN)?(MIN):((X)>(MAX)?(MAX):(X))) +#define H5B_SIZEOF_HDR(F) \ + (H5B_SIZEOF_MAGIC + /*magic number */ \ + 4 + /*type, level, num entries */ \ + 2*H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */ + +/* Local typedefs */ + /* PRIVATE PROTOTYPES */ static H5B_ins_t H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h new file mode 100644 index 0000000..707285d --- /dev/null +++ b/src/H5Bpkg.h @@ -0,0 +1,72 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * 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 HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol + * Thursday, May 15, 2003 + * + * Purpose: This file contains declarations which are visible only within + * the H5B package. Source files outside the H5B package should + * include H5Bprivate.h instead. + */ +#ifndef H5B_PACKAGE +#error "Do not include this file outside the H5B package!" +#endif + +#ifndef _H5Bpkg_H +#define _H5Bpkg_H + +/* Get package's private header */ +#include "H5Bprivate.h" + +/* Other private headers needed by this file */ + +/**************************/ +/* Package Private Macros */ +/**************************/ + +/****************************/ +/* Package Private Typedefs */ +/****************************/ + +/* + * The B-tree node as stored in memory... + */ +typedef struct H5B_key_t { + hbool_t dirty; /*native key is more recent than raw key */ + uint8_t *rkey; /*ptr into node->page for raw key */ + void *nkey; /*null or ptr into node->native for key */ +} H5B_key_t; + +struct H5B_t { + H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ + /* first field in structure */ + const H5B_class_t *type; /*type of tree */ + size_t sizeof_rkey; /*size of raw (disk) key */ + int ndirty; /*num child ptrs to emit */ + int level; /*node level */ + haddr_t left; /*address of left sibling */ + haddr_t right; /*address of right sibling */ + int nchildren; /*number of child pointers */ + uint8_t *page; /*disk page */ + uint8_t *native; /*array of keys in native format */ + H5B_key_t *key; /*2k+1 key entries */ + haddr_t *child; /*2k child pointers */ +}; + +/******************************/ +/* Package Private Prototypes */ +/******************************/ + +#endif /*_H5Bpkg_H*/ diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index 99f079e..7230a55 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -31,9 +31,9 @@ #include "H5Bpublic.h" /*API prototypes */ /* Private headers needed by this file */ -#include "H5private.h" -#include "H5Fprivate.h" -#include "H5ACprivate.h" /*cache */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Fprivate.h" /* File access */ /* * Feature: Define this constant if you want to check B-tree consistency @@ -46,10 +46,6 @@ #endif #define H5B_MAGIC "TREE" /*tree node magic number */ #define H5B_SIZEOF_MAGIC 4 /*size of magic number */ -#define H5B_SIZEOF_HDR(F) \ - (H5B_SIZEOF_MAGIC + /*magic number */ \ - 4 + /*type, level, num entries */ \ - 2*H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */ typedef enum H5B_ins_t { H5B_INS_ERROR = -1, /*error return value */ @@ -72,6 +68,9 @@ typedef enum H5B_iterate_t { typedef H5B_iterate_t (*H5B_operator_t)(H5F_t *f, hid_t, void *_lt_key, haddr_t addr, void *_rt_key, void *_udata); +/* Typedef for B-tree in memory (defined in H5Bpkg.h) */ +typedef struct H5B_t H5B_t; + /* * Each class of object that can be pointed to by a B-link tree has a * variable of this type that contains class variables and methods. Each @@ -79,7 +78,6 @@ typedef H5B_iterate_t (*H5B_operator_t)(H5F_t *f, hid_t, void *_lt_key, haddr_t * has an array of K values indexed by the `id' class field below. The * array is initialized with the HDF5_BTREE_K_DEFAULT macro. */ -struct H5B_t; /*forward decl */ typedef struct H5B_class_t { H5B_subid_t id; /*id as found in file*/ @@ -110,31 +108,6 @@ typedef struct H5B_class_t { } H5B_class_t; /* - * The B-tree node as stored in memory... - */ -typedef struct H5B_key_t { - hbool_t dirty; /*native key is more recent than raw key */ - uint8_t *rkey; /*ptr into node->page for raw key */ - void *nkey; /*null or ptr into node->native for key */ -} H5B_key_t; - -typedef struct H5B_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ - /* first field in structure */ - const H5B_class_t *type; /*type of tree */ - size_t sizeof_rkey; /*size of raw (disk) key */ - int ndirty; /*num child ptrs to emit */ - int level; /*node level */ - haddr_t left; /*address of left sibling */ - haddr_t right; /*address of right sibling */ - int nchildren; /*number of child pointers */ - uint8_t *page; /*disk page */ - uint8_t *native; /*array of keys in native format */ - H5B_key_t *key; /*2k+1 key entries */ - haddr_t *child; /*2k child pointers */ -} H5B_t; - -/* * Library prototypes. */ H5_DLL herr_t H5B_create (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, diff --git a/src/H5D.c b/src/H5D.c index 499feed..c9f9fce 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -15,7 +15,7 @@ #define H5D_PACKAGE /*suppress error about including H5Dpkg */ #include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Dataset functions */ +#include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5FDprivate.h" /* File drivers */ #include "H5FLprivate.h" /* Free Lists */ @@ -23,8 +23,8 @@ #include "H5HLprivate.h" /* Local heaps */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Sprivate.h" /* Dataspace functions */ -#include "H5Vprivate.h" /* Vector and array functions */ +#include "H5Sprivate.h" /* Dataspaces */ +#include "H5Vprivate.h" /* Vectors and arrays */ /*#define H5D_DEBUG*/ diff --git a/src/H5Distore.c b/src/H5Distore.c index 098e007..a5362cc 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -40,10 +40,11 @@ * entry which is added to the end of the list. */ +#define H5B_PACKAGE /*suppress error about including H5Bpkg */ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ #include "H5private.h" /* Generic Functions */ -#include "H5Bprivate.h" /* B-link trees */ +#include "H5Bpkg.h" /* B-link trees */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 23897dd..5b74873 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -36,6 +36,10 @@ #include "H5Sprivate.h" /* Dataspace functions */ #include "H5Tprivate.h" /* Datatype functions */ +/**************************/ +/* Package Private Macros */ +/**************************/ + /* The number of reserved IDs in dataset ID group */ #define H5D_RESERVED_ATOMS 0 @@ -70,7 +74,10 @@ typedef enum { H5D_ALLOC_WRITE /* Dataset is being extended */ } H5D_time_alloc_t; -/* Package-private functions defined in H5D package */ +/******************************/ +/* Package Private Prototypes */ +/******************************/ + H5_DLL herr_t H5D_alloc_storage (H5F_t *f, hid_t dxpl_id, H5D_t *dset, H5D_time_alloc_t time_alloc, hbool_t update_time, hbool_t full_overwrite); #endif /*_H5Dpkg_H*/ diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 724c349..f2bc489 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -149,7 +149,7 @@ /* Library Private Typedefs */ /****************************/ -/* Typedef for reference counted string (defined in H5Dpkg.h) */ +/* Typedef for dataset in memory (defined in H5Dpkg.h) */ typedef struct H5D_t H5D_t; /* Typedef for dataset storage information */ diff --git a/src/H5F.c b/src/H5F.c index c186db9..1dfaffd 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -37,20 +37,20 @@ #include "H5FDstream.h" /*in-memory files streamed via sockets */ /* Packages needed by this file... */ -#include "H5private.h" /*library functions */ -#include "H5Aprivate.h" /*attributes */ -#include "H5ACprivate.h" /*cache */ -#include "H5Dprivate.h" /*datasets */ -#include "H5Eprivate.h" /*error handling */ -#include "H5Fpkg.h" /*file access */ -#include "H5FDprivate.h" /*file driver */ -#include "H5FLprivate.h" /*Free Lists */ -#include "H5FPprivate.h" /*Flexible Parallel HDF5 */ -#include "H5Iprivate.h" /*object IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5Aprivate.h" /* Attributes */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5FPprivate.h" /* Flexible parallel */ +#include "H5Iprivate.h" /* IDs */ #include "H5Gprivate.h" /* Groups */ -#include "H5MMprivate.h" /*core memory management */ -#include "H5Pprivate.h" /*property lists */ -#include "H5Tprivate.h" /*data types */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5Tprivate.h" /* Datatypes */ #define PABLO_MASK H5F_mask @@ -86,6 +86,7 @@ static haddr_t H5F_locate_signature(H5FD_t *file, hid_t dxpl_id); static herr_t H5F_get_objects(H5F_t *f, unsigned types, hid_t *obj_id_list, unsigned *obj_id_count); static herr_t H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); +static herr_t H5F_get_vfd_handle(H5F_t *file, hid_t fapl, void** file_handle); /* Declare a free list to manage the H5F_t struct */ H5FL_DEFINE_STATIC(H5F_t); @@ -1232,7 +1233,8 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void** file_handle) +herr_t +H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void** file_handle) { H5F_t *file=NULL; herr_t ret_value; @@ -1268,7 +1270,8 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5F_get_vfd_handle(H5F_t *file, hid_t fapl, void**file_handle) +static herr_t +H5F_get_vfd_handle(H5F_t *file, hid_t fapl, void**file_handle) { herr_t ret_value; diff --git a/src/H5Fistore.c b/src/H5Fistore.c index 098e007..a5362cc 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -40,10 +40,11 @@ * entry which is added to the end of the list. */ +#define H5B_PACKAGE /*suppress error about including H5Bpkg */ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ #include "H5private.h" /* Generic Functions */ -#include "H5Bprivate.h" /* B-link trees */ +#include "H5Bpkg.h" /* B-link trees */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 93d26a9..78dcf14 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -27,14 +27,17 @@ #ifndef _H5Fpkg_H #define _H5Fpkg_H +/* Get package's private header */ #include "H5Fprivate.h" -#include "H5FOprivate.h" /* File objects */ - -/* This is a near top-level header! Try not to include much! */ -#include "H5private.h" +/* Other public headers needed by this file */ #include "H5Bpublic.h" /* B-tree header, for H5B_NUM_BTREE_ID */ +/* Other private headers needed by this file */ +#include "H5private.h" /* Generic Functions */ +#include "H5FOprivate.h" /* File objects */ +#include "H5Gprivate.h" /* Groups */ + /* * Feature: Define this constant to be non-zero if you want to enable code * that minimizes the number of calls to lseek(). This has a huge @@ -193,6 +196,7 @@ H5_DLL void H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, uint8_t *l); H5_DLL herr_t H5F_mountpoint(struct H5G_entry_t *find/*in,out*/); H5_DLL herr_t H5F_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth); +H5_DLL herr_t H5F_sieve_overlap_clear(H5F_t *f, haddr_t addr, hsize_t size); /* Functions that operate on indexed storage */ H5_DLL herr_t H5F_istore_init (H5F_t *f); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 26bd833..ac5ba2d 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -19,11 +19,19 @@ #ifndef _H5Fprivate_H #define _H5Fprivate_H +/* Include package's public header */ #include "H5Fpublic.h" -/* This is a near top-level header! Try not to include much! */ -#include "H5FDpublic.h" /*file drivers */ +/* Public headers needed by this file */ +#include "H5FDpublic.h" /* File drivers */ +/* Private headers needed by this file */ + +/****************************/ +/* Library Private Typedefs */ +/****************************/ + +/* Main file structure */ typedef struct H5F_t H5F_t; /*===----------------------------------------------------------------------=== @@ -361,27 +369,22 @@ typedef struct H5F_t H5F_t; #define H5F_MNT_SYM_LOCAL_DEF FALSE /* Forward declarations for prototype arguments */ -struct H5G_entry_t; -struct H5O_layout_t; -struct H5O_efl_t; -struct H5O_pline_t; +struct H5B_class_t; +union H5D_storage_t; struct H5O_fill_t; +struct H5O_layout_t; struct H5P_genplist_t; struct H5S_t; -struct H5B_class_t; -union H5D_storage_t; /* Private functions, not part of the publicly documented API */ H5_DLL herr_t H5F_init(void); -H5_DLL unsigned H5F_get_intent(const H5F_t *f); H5_DLL hid_t H5F_get_driver_id(const H5F_t *f); +H5_DLL unsigned H5F_get_intent(const H5F_t *f); H5_DLL herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum); H5_DLL herr_t H5F_get_obj_count(H5F_t *f, unsigned types, unsigned *obj_id_count); H5_DLL herr_t H5F_get_obj_ids(H5F_t *f, unsigned types, hid_t *obj_id_list); -H5_DLL herr_t H5F_get_vfd_handle(H5F_t *file, hid_t fapl, void** file_handle); H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f); -H5_DLL herr_t H5F_sieve_overlap_clear(H5F_t *f, haddr_t addr, hsize_t size); /* Functions than check file mounting information */ H5_DLL htri_t H5F_is_mount(const H5F_t *file); @@ -457,7 +460,7 @@ H5_DLL void H5F_addr_decode(H5F_t *, const uint8_t** /*in,out*/, H5_DLL herr_t H5F_addr_pack(H5F_t *f, haddr_t *addr_p /*out*/, const unsigned long objno[2]); -/* callback Functions for file access class */ +/* Callback functions for file access class */ H5_DLL herr_t H5F_acs_create(hid_t fapl_id, void *close_data); H5_DLL herr_t H5F_acs_close(hid_t fapl_id, void *close_data); H5_DLL herr_t H5F_acs_copy(hid_t new_fapl_id, hid_t old_fapl_id, diff --git a/src/H5G.c b/src/H5G.c index 1f758ec..2b0287c 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -91,8 +91,8 @@ /* Packages needed by this file... */ #include "H5private.h" /* Generic Functions */ #include "H5Aprivate.h" /* Attributes */ -#include "H5Bprivate.h" /* B-trees */ -#include "H5Dprivate.h" /* Dataset functions */ +#include "H5Bprivate.h" /* B-link trees */ +#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ #include "H5FLprivate.h" /* Free Lists */ @@ -102,8 +102,20 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ +/* Local macros */ #define H5G_INIT_HEAP 8192 #define H5G_RESERVED_ATOMS 0 +#define H5G_SIZE_HINT 256 /*default root grp size hint */ +#define H5G_NLINKS 16 /*max symlinks to follow per lookup */ + +/* + * During name lookups (see H5G_namei()) we sometimes want information about + * a symbolic link or a mount point. The normal operation is to follow the + * symbolic link or mount point and return information about its target. + */ +#define H5G_TARGET_NORMAL 0x0000 +#define H5G_TARGET_SLINK 0x0001 +#define H5G_TARGET_MOUNT 0x0002 #define PABLO_MASK H5G_mask @@ -112,12 +124,7 @@ static int interface_initialize_g = 0; #define INTERFACE_INIT H5G_init_interface static herr_t H5G_init_interface(void); -/* Local variables and typedefs */ -static H5G_typeinfo_t *H5G_type_g = NULL; /*object typing info */ -static size_t H5G_ntypes_g = 0; /*entries in type table */ -static size_t H5G_atypes_g = 0; /*entries allocated */ -static char *H5G_comp_g = NULL; /*component buffer */ -static size_t H5G_comp_alloc_g = 0; /*sizeof component buffer */ +/* Local typedefs */ /* Struct only used by change name callback function */ typedef struct H5G_names_t { @@ -133,7 +140,25 @@ typedef struct H5G_names_t { typedef enum { H5G_NAMEI_TRAVERSE, /* Just traverse groups */ H5G_NAMEI_INSERT /* Insert entry in group */ -}H5G_namei_act_t ; +} H5G_namei_act_t ; + +/* + * This table contains a list of object types, descriptions, and the + * functions that determine if some object is a particular type. The table + * is allocated dynamically. + */ +typedef struct H5G_typeinfo_t { + int type; /*one of the public H5G_* types */ + htri_t (*isa)(H5G_entry_t*, hid_t); /*function to determine type */ + char *desc; /*description of object type */ +} H5G_typeinfo_t; + +/* Local variables */ +static H5G_typeinfo_t *H5G_type_g = NULL; /*object typing info */ +static size_t H5G_ntypes_g = 0; /*entries in type table */ +static size_t H5G_atypes_g = 0; /*entries allocated */ +static char *H5G_comp_g = NULL; /*component buffer */ +static size_t H5G_comp_alloc_g = 0; /*sizeof component buffer */ /* Declare a free list to manage the H5G_t struct */ H5FL_DEFINE(H5G_t); @@ -165,6 +190,9 @@ static herr_t H5G_set_comment(H5G_entry_t *loc, const char *name, const char *buf, hid_t dxpl_id); static int H5G_get_comment(H5G_entry_t *loc, const char *name, size_t bufsize, char *buf, hid_t dxpl_id); +static herr_t H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*, hid_t), + const char *desc); +static H5G_t *H5G_rootof(H5F_t *f); /*------------------------------------------------------------------------- @@ -1033,7 +1061,7 @@ H5G_term_interface(void) * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*, hid_t), const char *_desc) { char *desc = NULL; @@ -1937,7 +1965,7 @@ done: * *------------------------------------------------------------------------- */ -H5G_t * +static H5G_t * H5G_rootof(H5F_t *f) { H5G_t *ret_value; /* Return value */ @@ -3265,7 +3293,7 @@ H5G_replace_ent(void *obj_ptr, hid_t obj_id, const void *key) assert(obj_ptr); /* Get the symbol table entry */ - switch(H5I_GROUP(obj_id)) { + switch(H5I_get_type(obj_id)) { case H5I_GROUP: ent = H5G_entof((H5G_t*)obj_ptr); break; diff --git a/src/H5Gent.c b/src/H5Gent.c index 866cd24..083ed9f 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -19,24 +19,27 @@ #define H5G_PACKAGE #define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#include "H5private.h" -#include "H5Eprivate.h" -#include "H5Fpkg.h" -#include "H5Gpkg.h" -#include "H5HLprivate.h" -#include "H5MMprivate.h" +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5Gpkg.h" /* Groups */ +#include "H5HLprivate.h" /* Local Heaps */ +#include "H5MMprivate.h" /* Memory management */ #define PABLO_MASK H5G_ent_mask static int interface_initialize_g = 0; #define INTERFACE_INIT NULL +/* Private prototypes */ +static herr_t H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type); + /*------------------------------------------------------------------------- * Function: H5G_ent_cache * * Purpose: Returns a pointer to the cache associated with the symbol * table entry. You should modify the cache directly, then call - * H5G_modified() with the new cache type (even if the type is + * H5G_ent_modified() with the new cache type (even if the type is * still the same). * * Return: Success: Ptr to the cache in the symbol table entry. @@ -88,7 +91,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type) { herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index d141b28..dbad83d 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -31,19 +31,33 @@ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ /* Packages needed by this file... */ -#include "H5private.h" /*library */ -#include "H5ACprivate.h" /*cache */ -#include "H5Bprivate.h" /*B-link trees */ -#include "H5Eprivate.h" /*error handling */ -#include "H5Fpkg.h" /*file access */ -#include "H5FLprivate.h" /*Free Lists */ -#include "H5Gpkg.h" /*me */ -#include "H5HLprivate.h" /*local heap */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Bprivate.h" /* B-link trees */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Gpkg.h" /* Groups */ +#include "H5HLprivate.h" /* Local Heaps */ #include "H5Iprivate.h" /* IDs */ -#include "H5MFprivate.h" /*file memory management */ -#include "H5MMprivate.h" /*core memory management */ -#include "H5Oprivate.h" /*header messages */ -#include "H5Pprivate.h" /*property lists */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ + +/* Private typedefs */ + +/* + * Each key field of the B-link tree that points to symbol table + * nodes consists of this structure... + */ +typedef struct H5G_node_key_t { + size_t offset; /*offset into heap for name */ +} H5G_node_key_t; + +/* Private macros */ +#define H5G_NODE_VERS 1 /*symbol table node version number */ +#define H5G_NODE_SIZEOF_HDR(F) (H5G_NODE_SIZEOF_MAGIC + 4) #define PABLO_MASK H5G_node_mask diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 5f9adfb..2bd3bbc 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -27,12 +27,11 @@ #ifndef _H5Gpkg_H #define _H5Gpkg_H -#include "H5ACprivate.h" +/* Get package's private header */ #include "H5Gprivate.h" -#define H5G_NODE_VERS 1 /*symbol table node version number */ -#define H5G_SIZE_HINT 256 /*default root grp size hint */ -#define H5G_NODE_SIZEOF_HDR(F) (H5G_NODE_SIZEOF_MAGIC + 4) +/* Other private headers needed by this file */ +#include "H5ACprivate.h" /* Metadata cache */ /* * A symbol table node is a collection of symbol table entries. It can @@ -48,14 +47,6 @@ typedef struct H5G_node_t { } H5G_node_t; /* - * Each key field of the B-link tree that points to symbol table - * nodes consists of this structure... - */ -typedef struct H5G_node_key_t { - size_t offset; /*offset into heap for name */ -} H5G_node_key_t; - -/* * A group handle passed around through layers of the library within and * above the H5G layer. */ @@ -65,15 +56,6 @@ struct H5G_t { }; /* - * During name lookups (see H5G_namei()) we sometimes want information about - * a symbolic link or a mount point. The normal operation is to follow the - * symbolic link or mount point and return information about its target. - */ -#define H5G_TARGET_NORMAL 0x0000 -#define H5G_TARGET_SLINK 0x0001 -#define H5G_TARGET_MOUNT 0x0002 - -/* * These operations can be passed down from the H5G_stab layer to the * H5G_node layer through the B-tree layer. */ @@ -148,6 +130,7 @@ H5_DLL herr_t H5G_stab_find(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent/*out*/, hid_t dxpl_id); H5_DLL herr_t H5G_stab_insert(H5G_entry_t *grp_ent, const char *name, H5G_entry_t *obj_ent, hid_t dxpl_id); +H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, haddr_t btree_addr, haddr_t heap_addr); H5_DLL herr_t H5G_stab_remove(H5G_entry_t *grp_ent, const char *name, hid_t dxpl_id); /* diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 46a321b..a256ee1 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -31,6 +31,7 @@ #ifndef _H5Gprivate_H #define _H5Gprivate_H +/* Include package's public header */ #include "H5Gpublic.h" /* Private headers needed by this file */ @@ -45,10 +46,10 @@ #ifdef NDEBUG # undef H5G_DEBUG #endif + #define H5G_NODE_MAGIC "SNOD" /*symbol table node magic number */ #define H5G_NODE_SIZEOF_MAGIC 4 /*sizeof symbol node magic number */ #define H5G_NO_CHANGE (-1) /*see H5G_ent_modified() */ -#define H5G_NLINKS 16 /*max symlinks to follow per lookup */ /* * The disk size for a symbol table entry... @@ -114,17 +115,6 @@ typedef struct H5G_entry_t { typedef struct H5G_t H5G_t; -/* - * This table contains a list of object types, descriptions, and the - * functions that determine if some object is a particular type. The table - * is allocated dynamically. - */ -typedef struct H5G_typeinfo_t { - int type; /*one of the public H5G_* types */ - htri_t (*isa)(H5G_entry_t*, hid_t); /*function to determine type */ - char *desc; /*description of object type */ -} H5G_typeinfo_t; - /* Type of operation being performed for call to H5G_replace_name() */ typedef enum { OP_MOVE = 0, /* H5*move call */ @@ -141,15 +131,10 @@ typedef enum { H5G_COPY_DEEP /* Deep copy from source to destination, including duplicating name & old name fields */ } H5G_ent_copy_depth_t; -/* Forward declarations for prototype arguments */ -struct H5O_stab_t; - /* * Library prototypes... These are the ones that other packages routinely * call. */ -H5_DLL herr_t H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*, hid_t), - const char *desc); H5_DLL H5G_entry_t *H5G_loc(hid_t loc_id); H5_DLL herr_t H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_entry); H5_DLL H5G_entry_t *H5G_entof(H5G_t *grp); @@ -157,7 +142,6 @@ H5_DLL H5F_t *H5G_fileof(H5G_t *grp); H5_DLL H5G_t *H5G_open(H5G_entry_t *loc, const char *name, hid_t dxpl_id); H5_DLL H5G_t *H5G_open_oid(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL herr_t H5G_close(H5G_t *grp); -H5_DLL H5G_t *H5G_rootof(H5F_t *f); H5_DLL int H5G_get_type(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL herr_t H5G_get_objinfo(H5G_entry_t *loc, const char *name, hbool_t follow_link, @@ -173,11 +157,6 @@ H5_DLL herr_t H5G_replace_name(int type, H5G_entry_t *loc, H5_DLL herr_t H5G_free_grp_name(H5G_t *grp); /* - * These functions operate on symbol tables themselves. - */ -H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, haddr_t btree_addr, haddr_t heap_addr); - -/* * These functions operate on symbol table nodes. */ H5_DLL herr_t H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, @@ -192,7 +171,6 @@ H5_DLL herr_t H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent); H5_DLL herr_t H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent/*out*/); H5_DLL H5G_cache_t *H5G_ent_cache(H5G_entry_t *ent, H5G_type_t *cache_type); -H5_DLL herr_t H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type); H5_DLL herr_t H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5G_ent_copy_depth_t depth); H5_DLL herr_t H5G_free_ent_name(H5G_entry_t *ent); diff --git a/src/H5HG.c b/src/H5HG.c index 2860f94..f848d87 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -35,20 +35,97 @@ * for a new object based on object size, amount of free space * in the collection, and temporal locality. */ + #define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#include "H5private.h" /*library */ -#include "H5ACprivate.h" /*caching */ -#include "H5Eprivate.h" /*error handling */ -#include "H5Fpkg.h" /*file access */ -#include "H5FLprivate.h" /*Free Lists */ -#include "H5HGprivate.h" /*global heaps */ -#include "H5MFprivate.h" /*file memory management */ -#include "H5MMprivate.h" /*core memory management */ -#include "H5Pprivate.h" /*property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5HGprivate.h" /* Global heaps */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +/* Pablo information */ #define PABLO_MASK H5HG_mask +/* Private macros */ + +/* + * Global heap collection version. + */ +#define H5HG_VERSION 1 + +/* + * Pad all global heap messages to a multiple of eight bytes so we can load + * the entire collection into memory and operate on it there. Eight should + * be sufficient for machines that have alignment constraints because our + * largest data type is eight bytes. + */ +#define H5HG_ALIGNMENT 8 +#define H5HG_ALIGN(X) (H5HG_ALIGNMENT*(((X)+H5HG_ALIGNMENT-1)/ \ + H5HG_ALIGNMENT)) +#define H5HG_ISALIGNED(X) ((X)==H5HG_ALIGN(X)) + +/* + * All global heap collections are at least this big. This allows us to read + * most collections with a single read() since we don't have to read a few + * bytes of header to figure out the size. If the heap is larger than this + * then a second read gets the rest after we've decoded the header. + */ +#define H5HG_MINSIZE 4096 + +/* + * Maximum length of the CWFS list, the list of remembered collections that + * have free space. + */ +#define H5HG_NCWFS 16 + +/* + * The maximum number of links allowed to a global heap object. + */ +#define H5HG_MAXLINK 65535 + +/* + * The size of the collection header, always a multiple of the alignment so + * that the stuff that follows the header is aligned. + */ +#define H5HG_SIZEOF_HDR(f) \ + H5HG_ALIGN(4 + /*magic number */ \ + 1 + /*version number */ \ + 3 + /*reserved */ \ + H5F_SIZEOF_SIZE(f)) /*collection size */ + +/* + * The overhead associated with each object in the heap, always a multiple of + * the alignment so that the stuff that follows the header is aligned. + */ +#define H5HG_SIZEOF_OBJHDR(f) \ + H5HG_ALIGN(2 + /*object id number */ \ + 2 + /*reference count */ \ + 4 + /*reserved */ \ + H5F_SIZEOF_SIZE(f)) /*object data size */ + +/* + * The initial guess for the number of messages in a collection. We assume + * that all objects in that collection are zero length, giving the maximum + * possible number of objects in the collection. The collection itself has + * some overhead and each message has some overhead. The `+2' accounts for + * rounding and for the free space object. + */ +#define H5HG_NOBJS(f,z) (int)((((z)-H5HG_SIZEOF_HDR(f))/ \ + H5HG_SIZEOF_OBJHDR(f)+2)) + +/* + * Makes a global heap object pointer undefined, or checks whether one is + * defined. + */ +#define H5HG_undef(HGP) ((HGP)->idx=0) +#define H5HG_defined(HGP) ((HGP)->idx!=0) + +/* Private typedefs */ + typedef struct H5HG_obj_t { int nrefs; /*reference count */ size_t size; /*total size of object */ @@ -66,6 +143,10 @@ struct H5HG_heap_t { }; /* PRIVATE PROTOTYPES */ +static H5HG_heap_t *H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size); +#ifdef NOT_YET +static void *H5HG_peek(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj); +#endif /* NOT_YET */ /* Metadata cache callbacks */ static H5HG_heap_t *H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udata1, @@ -121,7 +202,7 @@ H5FL_BLK_DEFINE_STATIC(heap_chunk); * *------------------------------------------------------------------------- */ -H5HG_heap_t * +static H5HG_heap_t * H5HG_create (H5F_t *f, hid_t dxpl_id, size_t size) { H5HG_heap_t *heap = NULL; @@ -675,6 +756,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } +#ifdef NOT_YET /*------------------------------------------------------------------------- * Function: H5HG_peek @@ -697,7 +779,7 @@ done: * *------------------------------------------------------------------------- */ -void * +static void * H5HG_peek (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) { H5HG_heap_t *heap = NULL; @@ -736,6 +818,7 @@ H5HG_peek (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) done: FUNC_LEAVE_NOAPI(ret_value); } +#endif /* NOT_YET */ /*------------------------------------------------------------------------- diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index 9546fc1..4915c13 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -19,8 +19,11 @@ #ifndef _H5HGprivate_H #define _H5HGprivate_H +/* Include package's public header */ #include "H5HGpublic.h" -#include "H5Fprivate.h" + +/* Private headers needed by this file. */ +#include "H5Fprivate.h" /* File access */ /* * Each collection has a magic number for some redundancy. @@ -28,89 +31,17 @@ #define H5HG_MAGIC "GCOL" #define H5HG_SIZEOF_MAGIC 4 -/* - * Global heap collection version. - */ -#define H5HG_VERSION 1 - -/* - * Pad all global heap messages to a multiple of eight bytes so we can load - * the entire collection into memory and operate on it there. Eight should - * be sufficient for machines that have alignment constraints because our - * largest data type is eight bytes. - */ -#define H5HG_ALIGNMENT 8 -#define H5HG_ALIGN(X) (H5HG_ALIGNMENT*(((X)+H5HG_ALIGNMENT-1)/ \ - H5HG_ALIGNMENT)) -#define H5HG_ISALIGNED(X) ((X)==H5HG_ALIGN(X)) - -/* - * All global heap collections are at least this big. This allows us to read - * most collections with a single read() since we don't have to read a few - * bytes of header to figure out the size. If the heap is larger than this - * then a second read gets the rest after we've decoded the header. - */ -#define H5HG_MINSIZE 4096 - -/* - * Maximum length of the CWFS list, the list of remembered collections that - * have free space. - */ -#define H5HG_NCWFS 16 - -/* - * The maximum number of links allowed to a global heap object. - */ -#define H5HG_MAXLINK 65535 - -/* - * The size of the collection header, always a multiple of the alignment so - * that the stuff that follows the header is aligned. - */ -#define H5HG_SIZEOF_HDR(f) \ - H5HG_ALIGN(4 + /*magic number */ \ - 1 + /*version number */ \ - 3 + /*reserved */ \ - H5F_SIZEOF_SIZE(f)) /*collection size */ - -/* - * The overhead associated with each object in the heap, always a multiple of - * the alignment so that the stuff that follows the header is aligned. - */ -#define H5HG_SIZEOF_OBJHDR(f) \ - H5HG_ALIGN(2 + /*object id number */ \ - 2 + /*reference count */ \ - 4 + /*reserved */ \ - H5F_SIZEOF_SIZE(f)) /*object data size */ - -/* - * The initial guess for the number of messages in a collection. We assume - * that all objects in that collection are zero length, giving the maximum - * possible number of objects in the collection. The collection itself has - * some overhead and each message has some overhead. The `+2' accounts for - * rounding and for the free space object. - */ -#define H5HG_NOBJS(f,z) (int)((((z)-H5HG_SIZEOF_HDR(f))/ \ - H5HG_SIZEOF_OBJHDR(f)+2)) - -/* - * Makes a global heap object pointer undefined, or checks whether one is - * defined. - */ -#define H5HG_undef(HGP) ((HGP)->idx=0) -#define H5HG_defined(HGP) ((HGP)->idx!=0) - +/* Information to locate object in global heap */ typedef struct H5HG_t { haddr_t addr; /*address of collection */ unsigned idx; /*object ID within collection */ } H5HG_t; +/* Typedef for heap in memory (defined in H5HG.c) */ typedef struct H5HG_heap_t H5HG_heap_t; -H5_DLL H5HG_heap_t *H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size); H5_DLL herr_t H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out*/); -H5_DLL void *H5HG_peek(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj); H5_DLL void *H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object); H5_DLL int H5HG_link(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, int adjust); H5_DLL herr_t H5HG_remove(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj); diff --git a/src/H5HL.c b/src/H5HL.c index 6f5ea8a..3cf24a2 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -30,15 +30,14 @@ */ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ -#include "H5private.h" /*library */ -#include "H5ACprivate.h" /*cache */ -#include "H5Eprivate.h" /*error handling */ -#include "H5Fpkg.h" /*file access */ -#include "H5FLprivate.h" /*Free Lists */ -#include "H5HLprivate.h" /*self */ -#include "H5MFprivate.h" /*file memory management */ -#include "H5MMprivate.h" /*core memory management */ -#include "H5Pprivate.h" /*property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File access */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5HLprivate.h" /* Local Heaps */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ /* Pablo information */ #define PABLO_MASK H5HL_mask @@ -72,6 +71,12 @@ typedef struct H5HL_t { } H5HL_t; /* PRIVATE PROTOTYPES */ +static void *H5HL_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, + void *buf); +#ifdef NOT_YET +static herr_t H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, + const void *buf); +#endif /* NOT_YET */ static H5HL_free_t * H5HL_remove_free(H5HL_t *heap, H5HL_free_t *fl); /* Metadata cache callbacks */ @@ -616,7 +621,7 @@ H5HL_clear(H5HL_t *heap) * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ -void * +static void * H5HL_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, void *buf) { H5HL_t *heap = NULL; @@ -894,6 +899,7 @@ done: FUNC_LEAVE_NOAPI(ret_value); } +#ifdef NOT_YET /*------------------------------------------------------------------------- * Function: H5HL_write @@ -917,7 +923,7 @@ done: * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ -herr_t +static herr_t H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, const void *buf) { H5HL_t *heap = NULL; @@ -944,6 +950,7 @@ H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, co done: FUNC_LEAVE_NOAPI(ret_value); } +#endif /* NOT_YET */ /*------------------------------------------------------------------------- diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h index 23ac438..aa2a2d4 100644 --- a/src/H5HLprivate.h +++ b/src/H5HLprivate.h @@ -27,11 +27,12 @@ #ifndef _H5HLprivate_H #define _H5HLprivate_H +/* Include package's public header */ #include "H5HLpublic.h" /* Private headers needed by this file. */ -#include "H5private.h" -#include "H5Fprivate.h" +#include "H5private.h" /* Generic Functions */ +#include "H5Fprivate.h" /* File access */ /* * Feature: Define H5HL_DEBUG on the compiler command line if you want to @@ -54,13 +55,9 @@ * Library prototypes... */ H5_DLL herr_t H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr/*out*/); -H5_DLL void *H5HL_read(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, - void *buf); H5_DLL const void *H5HL_peek(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset); H5_DLL size_t H5HL_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5HL_write(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size, - const void *buf); H5_DLL herr_t H5HL_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t offset, size_t size); H5_DLL herr_t H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr); H5_DLL herr_t H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, diff --git a/src/H5I.c b/src/H5I.c index 53da76a..0abffa0 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -32,28 +32,86 @@ * 6/10/97 - Moved into HDF5 library */ -#include "H5private.h" -#include "H5Eprivate.h" -#include "H5FLprivate.h" /*Free Lists */ -#include "H5Iprivate.h" -#include "H5MMprivate.h" +#define H5I_PACKAGE /*suppress error about including H5Ipkg */ + +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Ipkg.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ /* Define this to compile in support for dumping ID information */ /* #define H5I_DEBUG_OUTPUT */ #ifndef H5I_DEBUG_OUTPUT -#include "H5Gprivate.h" /*symbol tables */ +#include "H5Gprivate.h" /* Groups */ #else /* H5I_DEBUG_OUTPUT */ #define H5G_PACKAGE /*suppress error message about including H5Gpkg.h */ -#include "H5Gpkg.h" -#include "H5Dprivate.h" /*datasets */ -#include "H5Tprivate.h" /*data types */ +#include "H5Gpkg.h" /* Groups */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Tprivate.h" /* Datatypes */ #endif /* H5I_DEBUG_OUTPUT */ -/* Interface initialialization? */ +/* Pablo information */ #define PABLO_MASK H5I_mask + +/* Interface initialization */ static int interface_initialize_g = 0; #define INTERFACE_INIT H5I_init_interface -static herr_t H5I_init_interface(void); + +/* Local Macros */ + +/* + * Define the following macro for fast hash calculations (but limited + * hash sizes) + */ +#define HASH_SIZE_POWER_2 + +/* Define the following macro for atom caching over all the atoms */ +#define IDS_ARE_CACHED + +#ifdef IDS_ARE_CACHED +# define ID_CACHE_SIZE 4 /*# of previous atoms cached */ +#endif + +#ifdef HASH_SIZE_POWER_2 +/* + * Map an ID to a hash location (assumes s is a power of 2 and smaller + * than the ID_MASK constant). + */ +# define H5I_LOC(a,s) ((hid_t)((size_t)(a)&((s)-1))) +# define POWER_OF_TWO(n) ((((n) - 1) & (n)) == 0 && (n) > 0) +#else +/* + * Map an ID to a hash location. + */ +# define H5I_LOC(a,s) (((hid_t)(a)&ID_MASK)%(s)) +#endif + +/* Combine a Group number and an atom index into an atom */ +#define H5I_MAKE(g,i) ((((hid_t)(g)&GROUP_MASK)< + * Thursday, May 15, 2003 + * + * Purpose: This file contains declarations which are visible only within + * the H5I package. Source files outside the H5I package should + * include H5Iprivate.h instead. + */ +#ifndef H5I_PACKAGE +#error "Do not include this file outside the H5I package!" +#endif + +#ifndef _H5Ipkg_H +#define _H5Ipkg_H + +/* Get package's private header */ +#include "H5Iprivate.h" + +/* Other private headers needed by this file */ + +/**************************/ +/* Package Private Macros */ +/**************************/ + +/* + * Number of bits to use for Group ID in each atom. Increase if H5I_NGROUPS + * becomes too large (an assertion would fail in H5I_init_interface). This is + * the only number that must be changed since all other bit field sizes and + * masks are calculated from GROUP_BITS. + */ +#define GROUP_BITS 5 +#define GROUP_MASK ((1<>ID_BITS) & GROUP_MASK)) + + +/****************************/ +/* Package Private Typedefs */ +/****************************/ + +/******************************/ +/* Package Private Prototypes */ +/******************************/ + +#endif /*_H5Ipkg_H*/ diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index cf43e72..8ef4bf6 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -21,7 +21,8 @@ #ifndef _H5Iprivate_H #define _H5Iprivate_H -#include "H5Ipublic.h" /*include Public Definitions */ +/* Include package's public header */ +#include "H5Ipublic.h" /* Private headers needed by this file */ #include "H5private.h" @@ -43,56 +44,6 @@ #define H5I_GENPROPOBJ_HASHSIZE 128 /* - * Define the following macro for fast hash calculations (but limited - * hash sizes) - */ -#define HASH_SIZE_POWER_2 - -/* Define the following macro for atom caching over all the atoms */ -#define IDS_ARE_CACHED - -#ifdef IDS_ARE_CACHED -# define ID_CACHE_SIZE 4 /*# of previous atoms cached */ -#endif - -/* - * Number of bits to use for Group ID in each atom. Increase if H5I_NGROUPS - * becomes too large (an assertion would fail in H5I_init_interface). This is - * the only number that must be changed since all other bit field sizes and - * masks are calculated from GROUP_BITS. - */ -#define GROUP_BITS 5 -#define GROUP_MASK ((1<>ID_BITS) & GROUP_MASK)) - -#ifdef HASH_SIZE_POWER_2 -/* - * Map an ID to a hash location (assumes s is a power of 2 and smaller - * than the ID_MASK constant). - */ -# define H5I_LOC(a,s) ((hid_t)((size_t)(a)&((s)-1))) -# define POWER_OF_TWO(n) ((((n) - 1) & (n)) == 0 && (n) > 0) -#else -/* - * Map an ID to a hash location. - */ -# define H5I_LOC(a,s) (((hid_t)(a)&ID_MASK)%(s)) -#endif - -/* Combine a Group number and an atom index into an atom */ -#define H5I_MAKE(g,i) ((((hid_t)(g)&GROUP_MASK)<