summaryrefslogtreecommitdiffstats
path: root/src/H5Gprivate.h
blob: 6b8989e9a3b590cc1560df75065d2d084ff056b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*-------------------------------------------------------------------------
 * Copyright (C) 1997	National Center for Supercomputing Applications.
 *                      All rights reserved.
 *
 *-------------------------------------------------------------------------
 *
 * Created:		H5Gprivate.h
 * 			Jul 11 1997
 * 			Robb Matzke <matzke@llnl.gov>
 *
 * Purpose:		Library-visible declarations.
 *
 * Modifications:	
 *
 *-------------------------------------------------------------------------
 */
#ifndef _H5Gprivate_H
#define _H5Gprivate_H
#include <H5Gpublic.h>

/* Private headers needed by this file */
#include <H5private.h>
#include <H5Bprivate.h>
#include <H5Fprivate.h>

/*
 * FEATURE: If this macro is defined then H5G_shadow_check() is occassionally
 *	    (actually, quite often) called to check the consistency of the
 *	    shadow table.  If there's something wrong with the table then
 *	    abort() is called. Shadow table checking is a rather expensive
 *	    operation.
 */
#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_NSHADOWS	10331	/*default size of shadow hash table	*/

/*
 * The disk size for a symbol table entry...
 */
#define H5G_SIZEOF_SCRATCH	24
#define H5G_SIZEOF_ENTRY(F)						      \
   (H5F_SIZEOF_SIZE(F) +	/*offset of name into heap     		*/    \
    H5F_SIZEOF_ADDR(F) +	/*address of object header		*/    \
    4 +				/*entry type				*/    \
    H5G_SIZEOF_SCRATCH)		/*scratch pad space			*/
    
/*
 * Various types of object header information can be cached in a symbol
 * table entry (it's normal home is the object header to which the entry
 * points).  This datatype determines what (if anything) is cached in the
 * symbol table entry.
 */
typedef enum H5G_type_t {
   H5G_NOTHING_CACHED		=0,	/*nothing is cached, must be 0	*/
   H5G_CACHED_SDSPACE		=1,	/*simple data space		*/
   H5G_CACHED_STAB		=2 	/*symbol table, `stab'		*/
} H5G_type_t;

/*
 * A symbol table entry caches these parameters from object header
 * messages...
 */
typedef union H5G_cache_t {
   struct {
      uint32 ndim;		/*number of dimensions			*/
      uint32 dim[4];		/*dimension sizes			*/
   } sdspace;

   struct {
      haddr_t btree_addr;	/*file address of symbol table B-tree	*/
      haddr_t heap_addr;	/*file address of stab name heap	*/
   } stab;
} H5G_cache_t;

/*
 * An H5G_shadow_t is the struct used to describe object headers that
 * are currently open for modification.  It's contents is not
 * important outside H5G.
 */
typedef struct H5G_shadow_t H5G_shadow_t;
typedef struct H5G_entry_t H5G_entry_t;

/*
 * Library prototypes...  These are the ones that other packages routinely
 * call.
 */
H5G_entry_t *H5G_new (H5F_t *f, const char *name, size_t size_hint);
herr_t H5G_set (H5F_t *f, const char *name);
herr_t H5G_push (H5F_t *f, const char *name);
herr_t H5G_pop (H5F_t *f);
H5G_entry_t *H5G_create (H5F_t *f, const char *name, size_t ohdr_hint);
H5G_entry_t *H5G_open (H5F_t *f, const char *name);
herr_t H5G_close (H5F_t *f, H5G_entry_t *ent);
herr_t H5G_find (H5F_t *f, const char *name, H5G_entry_t *grp_ent,
		 H5G_entry_t *ent);
herr_t H5G_ent_encode (H5F_t *f, uint8 **pp, H5G_entry_t *ent);
herr_t H5G_ent_decode (H5F_t *f, const uint8 **pp, H5G_entry_t *ent);

/*
 * These functions operate on symbol table nodes.
 */
herr_t H5G_node_debug (H5F_t *f, const haddr_t *addr, FILE *stream,
		       intn indent, intn fwidth, const haddr_t *heap);

/*
 * These functions operate on shadow entries.
 */
herr_t H5G_shadow_flush (H5F_t *f, hbool_t invalidate);

/*
 * These functions operate on symbol table entries.  They're used primarily
 * in the H5O package where header messages are cached in symbol table
 * entries.  The subclasses of H5O probably don't need them though.
 */
H5G_entry_t *H5G_ent_calloc (void);
herr_t H5G_ent_invalidate (H5G_entry_t *ent);
herr_t H5G_ent_addr (H5G_entry_t *ent, haddr_t *retval/*out*/);
H5G_cache_t *H5G_ent_cache (H5G_entry_t *ent, H5G_type_t *cache_type);
herr_t H5G_ent_modified (H5G_entry_t *ent, H5G_type_t cache_type);
herr_t H5G_ent_debug (H5F_t *f, H5G_entry_t *ent, FILE *stream,
		      intn indent, intn fwidth);

#endif