summaryrefslogtreecommitdiffstats
path: root/src/H5Gprivate.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-11-15 02:55:39 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-11-15 02:55:39 (GMT)
commita1708eb023f2c8f8ac6c2c17bf1e598c8dff956e (patch)
tree34c87a3753b36c4c8d689d58bf456eaf261cd235 /src/H5Gprivate.h
parentbea1e576c5ef5500678f7ce913d835341b625e8f (diff)
downloadhdf5-a1708eb023f2c8f8ac6c2c17bf1e598c8dff956e.zip
hdf5-a1708eb023f2c8f8ac6c2c17bf1e598c8dff956e.tar.gz
hdf5-a1708eb023f2c8f8ac6c2c17bf1e598c8dff956e.tar.bz2
[svn-r11712] Purpose:
New feature Description: Check in baseline for compact group revisions, which radically revises the source code for managing groups and object headers. WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! This initiates the "unstable" phase of the 1.7.x branch, leading up to the 1.8.0 release. Please test this code, but do _NOT_ keep files created with it - the format will change again before the release and you will not be able to read your old files!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! WARNING!!!! Solution: There's too many changes to really describe them all, but some of them include: - Stop abusing the H5G_entry_t structure and split it into two separate structures for non-symbol table node use within the library: H5O_loc_t for object locations in a file and H5G_name_t to store the path to an opened object. H5G_entry_t is now only used for storing symbol table entries on disk. - Retire H5G_namei() in favor of a more general mechanism for traversing group paths and issuing callbacks on objects located. This gets us out of the business of hacking H5G_namei() for new features, generally. - Revised H5O* routines to take a H5O_loc_t instead of H5G_entry_t - Lots more... Platforms tested: h5committested and maybe another dozen configurations.... :-)
Diffstat (limited to 'src/H5Gprivate.h')
-rw-r--r--src/H5Gprivate.h176
1 files changed, 76 insertions, 100 deletions
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 815a76f..b902f98 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -20,11 +20,6 @@
*
* Purpose: Library-visible declarations.
*
- * Modifications: Aug 22, 2002
- * Pedro Vicente <pvn@ncsa.uiuc.edu>
- * Added 'names' field to H5G_entry_t
- * Added H5G_replace_name
- *
*-------------------------------------------------------------------------
*/
@@ -49,8 +44,6 @@
#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...
@@ -65,113 +58,84 @@
/* ========= Group Creation properties ============ */
-/* Definitions for local heap size hint */
+/* Defaults for group info values */
+#define H5G_CRT_GINFO_LHEAP_SIZE_HINT 0
+#define H5G_CRT_GINFO_MAX_COMPACT 8
+#define H5G_CRT_GINFO_MIN_DENSE 6
+#define H5G_CRT_GINFO_EST_NUM_ENTRIES 4
+#define H5G_CRT_GINFO_EST_NAME_LEN 8
+
+/* Definitions for group info settings */
#define H5G_CRT_GROUP_INFO_NAME "group info"
#define H5G_CRT_GROUP_INFO_SIZE sizeof(H5O_ginfo_t)
-#define H5G_CRT_GROUP_INFO_DEF {0, 8, 6, 4, 8}
+#define H5G_CRT_GROUP_INFO_DEF {H5G_CRT_GINFO_LHEAP_SIZE_HINT, \
+ H5G_CRT_GINFO_MAX_COMPACT, \
+ H5G_CRT_GINFO_MIN_DENSE, \
+ H5G_CRT_GINFO_EST_NUM_ENTRIES, \
+ H5G_CRT_GINFO_EST_NAME_LEN}
/* Definitions for creating intermediate groups */
#define H5G_CRT_INTERMEDIATE_GROUP_NAME "intermediate_group"
#define H5G_CRT_INTERMEDIATE_GROUP_SIZE sizeof(unsigned)
#define H5G_CRT_INTERMEDIATE_GROUP_DEF 0
-/*
- * 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_CACHED_ERROR = -1, /*force enum to be signed */
- H5G_NOTHING_CACHED = 0, /*nothing is cached, must be 0 */
- H5G_CACHED_STAB = 1, /*symbol table, `stab' */
- H5G_CACHED_SLINK = 2, /*symbolic link */
-
- H5G_NCACHED = 3 /*THIS MUST BE LAST */
-} H5G_type_t;
+/* Type of operation being performed for call to H5G_name_replace() */
+typedef enum {
+ OP_MOVE = 0, /* H5*move call */
+ OP_UNLINK, /* H5Gunlink call */
+ OP_MOUNT, /* H5Fmount call */
+ OP_UNMOUNT /* H5Funmount call */
+} H5G_names_op_t;
-/*
- * A symbol table entry caches these parameters from object header
- * messages... The values are entered into the symbol table when an object
- * header is created (by hand) and are extracted from the symbol table with a
- * callback function registered in H5O_init_interface(). Be sure to update
- * H5G_ent_decode(), H5G_ent_encode(), and H5G_ent_debug() as well.
- */
-typedef union H5G_cache_t {
- struct {
- haddr_t btree_addr; /*file address of symbol table B-tree*/
- haddr_t heap_addr; /*file address of stab name heap */
- } stab;
+/* Structure to store information about the name an object was opened with */
+typedef struct {
+ H5RS_str_t *user_path_r; /* Path to object, as opened by user */
+ H5RS_str_t *canon_path_r; /* Path to object, as found in file */
+ unsigned user_path_hidden; /* Whether the user's path is valid */
+} H5G_name_t;
- struct {
- size_t lval_offset; /*link value offset */
- } slink;
-} H5G_cache_t;
+/* Forward declarations */
+struct H5P_genplist_t;
+struct H5O_loc_t;
/*
- * A symbol table entry. The two important fields are `name_off' and
- * `header'. The remaining fields are used for caching information that
- * also appears in the object header to which this symbol table entry
- * points.
+ * The "location" of an object in a group hierarchy. This points to an object
+ * location and a group hierarchy path for the object.
*/
-typedef struct H5G_entry_t {
- hbool_t dirty; /*entry out-of-date? */
- H5G_type_t type; /*type of information cached */
- H5G_cache_t cache; /*cached data from object header */
- size_t name_off; /*offset of name within name heap */
- haddr_t header; /*file address of object header */
- H5F_t *file; /*file to which this obj hdr belongs */
- H5RS_str_t *user_path_r; /* Path to object, as opened by user */
- H5RS_str_t *canon_path_r; /* Path to object, as found in file */
- unsigned user_path_hidden; /* Whether the user's path is valid */
-} H5G_entry_t;
+typedef struct {
+ struct H5O_loc_t *oloc; /* Object header location */
+ H5G_name_t *path; /* Group hierarchy path */
+} H5G_loc_t;
typedef struct H5G_t H5G_t;
typedef struct H5G_shared_t H5G_shared_t;
-/* Type of operation being performed for call to H5G_replace_name() */
-typedef enum {
- OP_MOVE = 0, /* H5*move call */
- OP_UNLINK, /* H5Gunlink call */
- OP_MOUNT, /* H5Fmount call */
- OP_UNMOUNT /* H5Funmount call */
-} H5G_names_op_t;
-
/* Depth of group entry copy */
+/* (Also used for group hier. name copies) */
typedef enum {
- H5G_COPY_NULL, /* Null destination names */
- H5G_COPY_LIMITED, /* Limited copy from source to destination, omitting name & old name fields */
H5G_COPY_SHALLOW, /* Copy from source to destination, including name & old name fields */
+ H5G_COPY_CANON, /* Keep user path the same, but deep copy canonical path */
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 H5P_genplist_t;
+} H5G_copy_depth_t;
/*
* Library prototypes... These are the ones that other packages routinely
* call.
*/
-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);
+H5_DLL htri_t H5G_isa(struct H5O_loc_t *loc, hid_t dxpl_id);
+H5_DLL herr_t H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc);
+H5_DLL struct H5O_loc_t *H5G_oloc(H5G_t *grp);
+H5_DLL H5G_name_t * H5G_nameof(H5G_t *grp);
H5_DLL H5F_t *H5G_fileof(H5G_t *grp);
H5_DLL herr_t H5G_free(H5G_t *grp);
-H5_DLL H5G_t *H5G_open(H5G_entry_t *ent, hid_t dxpl_id);
+H5_DLL H5G_t *H5G_open(H5G_loc_t *loc, hid_t dxpl_id);
H5_DLL herr_t H5G_close(H5G_t *grp);
-H5_DLL H5G_obj_t 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,
- H5G_stat_t *statbuf/*out*/, hid_t dxpl_id);
-H5_DLL herr_t H5G_insert(H5G_entry_t *loc, const char *name,
- H5G_entry_t *ent, hid_t dxpl_id, struct H5P_genplist_t *oc_plist);
-H5_DLL herr_t H5G_find(H5G_entry_t *loc, const char *name,
- H5G_entry_t *ent/*out*/, hid_t dxpl_id);
-H5_DLL H5F_t *H5G_insertion_file(H5G_entry_t *loc, const char *name, hid_t dxpl_id);
-H5_DLL herr_t H5G_replace_name(H5G_obj_t type, H5G_entry_t *loc,
- H5RS_str_t *src_name, H5G_entry_t *src_loc,
- H5RS_str_t *dst_name, H5G_entry_t *dst_loc, H5G_names_op_t op);
-H5_DLL herr_t H5G_free_grp_name(H5G_t *grp);
+H5_DLL herr_t H5G_insert(H5G_loc_t *loc, const char *name,
+ H5G_loc_t *obj_loc, hid_t dxpl_id, struct H5P_genplist_t *oc_plist);
+H5_DLL herr_t H5G_get_objinfo(H5G_loc_t *loc, const char *name,
+ hbool_t follow_link, H5G_stat_t *statbuf/*out*/, hid_t dxpl_id);
+H5_DLL H5F_t *H5G_insertion_file(H5G_loc_t *loc, const char *name, hid_t dxpl_id);
+H5_DLL herr_t H5G_free_grp_name(H5G_t *grp);
H5_DLL herr_t H5G_get_shared_count(H5G_t *grp);
H5_DLL herr_t H5G_mount(H5G_t *grp);
H5_DLL herr_t H5G_unmount(H5G_t *grp);
@@ -179,24 +143,36 @@ H5_DLL herr_t H5G_unmount(H5G_t *grp);
/*
* These functions operate on symbol table nodes.
*/
+H5_DLL herr_t H5G_node_close(const H5F_t *f);
H5_DLL herr_t H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream,
int indent, int fwidth, haddr_t heap);
-H5_DLL herr_t H5G_node_init(H5F_t *f);
-H5_DLL herr_t H5G_node_close(const H5F_t *f);
/*
- * 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.
+ * These functions operate on group object locations.
+ */
+/* forward reference for later use */
+H5_DLL herr_t H5G_obj_ent_decode(H5F_t *f, const uint8_t **pp,
+ struct H5O_loc_t *oloc);
+H5_DLL herr_t H5G_obj_ent_encode(H5F_t *f, uint8_t **pp,
+ const struct H5O_loc_t *oloc);
+
+/*
+ * These functions operate on group hierarchy names.
*/
-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 const H5G_cache_t *H5G_ent_cache(const 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_ent_reset(H5G_entry_t *ent);
-H5_DLL herr_t H5G_free_ent_name(H5G_entry_t *ent);
-H5_DLL herr_t H5G_ent_debug(H5F_t *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * stream,
- int indent, int fwidth, haddr_t heap);
+H5_DLL herr_t H5G_name_replace(H5G_obj_t type, H5G_loc_t *loc,
+ H5RS_str_t *src_name, H5G_loc_t *src_loc,
+ H5RS_str_t *dst_name, H5G_loc_t *dst_loc, H5G_names_op_t op);
+H5_DLL herr_t H5G_name_reset(H5G_name_t *name);
+H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5G_copy_depth_t depth);
+H5_DLL herr_t H5G_name_free(H5G_name_t *name);
+
+/*
+ * These functions operate on group "locations"
+ */
+H5_DLL herr_t H5G_loc(hid_t loc_id, H5G_loc_t *loc);
+H5_DLL herr_t H5G_loc_find(H5G_loc_t *loc, const char *name,
+ H5G_loc_t *obj_loc/*out*/, hid_t dxpl_id);
+H5_DLL herr_t H5G_loc_reset(H5G_loc_t *loc);
+H5_DLL herr_t H5G_loc_free(H5G_loc_t *loc);
+
#endif