summaryrefslogtreecommitdiffstats
path: root/src/H5Iprivate.h
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1999-02-20 16:18:51 (GMT)
committerRobb Matzke <matzke@llnl.gov>1999-02-20 16:18:51 (GMT)
commite2e5476fa5449ec941ff19f07bada9725431688f (patch)
tree33f6af7c15322663582c4a736dc0e9b087f38530 /src/H5Iprivate.h
parent35a62b068bc6b124004d331c3e949d571682417a (diff)
downloadhdf5-e2e5476fa5449ec941ff19f07bada9725431688f.zip
hdf5-e2e5476fa5449ec941ff19f07bada9725431688f.tar.gz
hdf5-e2e5476fa5449ec941ff19f07bada9725431688f.tar.bz2
[svn-r1087] Changes since 19990218
---------------------- ./src/H5F.c ./src/H5private.h ./src/H5Ipublic.h ./src/H5O.c Fixed a rather nasty bug with file closing that caused the file boot block to be updated incorrectly, effectively truncating the file. The bug I fixed was triggered by: 1. Create a file, F 2. Open an object, X 3. Close file F 4. Reopen file F for read/write. 5. Create and close some objects 6. Close file F 7. Close library (exit). Step 3 pended the close because object X is still open, but the file ID was removed from the H5I_FILE ID group. Step 4 created a new file because it didn't see any matching file on the H5I_FILE ID group. Step 5 extends the file. Step 6 writes the new file boot block to disk. Step 7 closes object X and completes the close from step 3, writing the old boot block information to disk. The new behavior is that step 3 moves the file from the H5I_FILE group to the H5I_FILE_CLOSING group. Step 4 searches both groups and finds the file. Step 5 extends the file using the same H5F_file_t struct as step 3. Step 6 closes the H5F_t struct opened in step 3 but not the H5F_file_t struct shared by steps 1 and 3. Step 7 closes object X which closes the H5F_file_t from step 1, flushing the boot block which was shared by all steps. ./src/H5F.c Added some bulletproofing to file reference counting and removed comments which no longer apply. Added H5F_flush_all() and H5F_close_all() which apply to all files. ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5I.c ./src/H5Iprivate.h ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c Added the new H5I_free_t data type to describe the function type to be passed as the `free_func' argument to H5I_init_group(). ./src/H5I.c Bulletproofed the object removal functions. Removed comments which no longer apply. Changed global variable names so they don't violate the naming scheme. Added H5I_debug() that prints the contents of an ID group. Removed H5I_inc_ref() because it isn't used. Reindented a couple of functions. ./src/H5.c ./src/H5G.c ./src/H5Ipublic.h Changed H5I_MAXID to H5I_NGROUPS to better relect the fact that it's the total number of valid ID groups. ./src/H5Shyper.c Changed hyperslab offset arrays to signed quantities to get rid of warnings on DEC cluster. ./src/H5Flow.c ./src/H5Fprivate.h Changed the objno argument of H5F_addr_pack() to be unsigned to get rid of warnings on DEC cluster.
Diffstat (limited to 'src/H5Iprivate.h')
-rw-r--r--src/H5Iprivate.h87
1 files changed, 47 insertions, 40 deletions
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index 4d3e4ef..a41a3d6 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -1,13 +1,13 @@
/****************************************************************************
- * NCSA HDF *
- * Software Development Group *
- * National Center for Supercomputing Applications *
- * University of Illinois at Urbana-Champaign *
- * 605 E. Springfield, Champaign IL 61820 *
- * *
- * For conditions of distribution and use, see the accompanying *
- * hdf/COPYING file. *
- * *
+ * NCSA HDF *
+ * Software Development Group *
+ * National Center for Supercomputing Applications *
+ * University of Illinois at Urbana-Champaign *
+ * 605 E. Springfield, Champaign IL 61820 *
+ * *
+ * For conditions of distribution and use, see the accompanying *
+ * hdf/COPYING file. *
+ * *
****************************************************************************/
/*-----------------------------------------------------------------------------
@@ -19,51 +19,60 @@
#ifndef _H5Iprivate_H
#define _H5Iprivate_H
-#include <H5Ipublic.h> /*include Public Definitions */
+#include <H5Ipublic.h> /*include Public Definitions */
/* Private headers needed by this file */
#include <H5private.h>
/* Default sizes of the hash-tables for various atom groups */
-#define H5I_ERRSTACK_HASHSIZE 64
-#define H5I_FILEID_HASHSIZE 64
-#define H5I_TEMPID_HASHSIZE 64
-#define H5I_DATATYPEID_HASHSIZE 64
-#define H5I_DATASPACEID_HASHSIZE 64
-#define H5I_DATASETID_HASHSIZE 64
-#define H5I_OID_HASHSIZE 64
-#define H5I_GROUPID_HASHSIZE 64
-#define H5I_ATTRID_HASHSIZE 64
-#define H5I_TEMPBUFID_HASHSIZE 64
-#define H5I_RAGGED_HASHSIZE 64
-#define H5I_REFID_HASHSIZE 64
+#define H5I_ERRSTACK_HASHSIZE 64
+#define H5I_FILEID_HASHSIZE 64
+#define H5I_TEMPID_HASHSIZE 64
+#define H5I_DATATYPEID_HASHSIZE 64
+#define H5I_DATASPACEID_HASHSIZE 64
+#define H5I_DATASETID_HASHSIZE 64
+#define H5I_OID_HASHSIZE 64
+#define H5I_GROUPID_HASHSIZE 64
+#define H5I_ATTRID_HASHSIZE 64
+#define H5I_TEMPBUFID_HASHSIZE 64
+#define H5I_RAGGED_HASHSIZE 64
+#define H5I_REFID_HASHSIZE 64
+
+/*
+ * Function for freeing objects. This function will be called with an object
+ * ID group number (object type) and a pointer to the object. The function
+ * should free the object and return non-negative to indicate that the object
+ * can be removed from the ID group. If the function returns negative
+ * (failure) then the object will remain in the ID group.
+ */
+typedef herr_t (*H5I_free_t)(void*);
+
+/* Type of the function to compare objects & keys */
+typedef intn (*H5I_search_func_t)(void *obj, const void *key);
/* Atom information structure used */
typedef struct H5I_id_info_t {
- hid_t id; /* ID for this info */
- uintn count; /* ref. count for this atom */
- void *obj_ptr; /* pointer associated with the atom */
- struct H5I_id_info_t *next; /* link to next atom (in case of hash-clash)*/
+ hid_t id; /* ID for this info */
+ uintn count; /* ref. count for this atom */
+ void *obj_ptr; /* pointer associated with the atom */
+ struct H5I_id_info_t *next; /* link to next atom (in case of hash-clash)*/
} H5I_id_info_t;
/* ID group structure used */
typedef struct {
- uintn count; /*# of times this group has been initialized */
- uintn reserved; /*# of IDs to reserve for constant IDs */
- uintn wrapped; /*whether the id count has wrapped around */
- size_t hash_size; /*sizeof the hash table to store the IDs in*/
- uintn ids; /*current number of IDs held */
- uintn nextid; /*ID to use for the next atom */
- herr_t (*free_func)(void*);/*func to call to release object */
- H5I_id_info_t **id_list; /*pointer to an array of ptrs to IDs */
+ uintn count; /*# of times this group has been initialized*/
+ uintn reserved; /*# of IDs to reserve for constant IDs */
+ uintn wrapped; /*whether the id count has wrapped around */
+ size_t hash_size; /*sizeof the hash table to store the IDs in */
+ uintn ids; /*current number of IDs held */
+ uintn nextid; /*ID to use for the next atom */
+ H5I_free_t free_func; /*release object method */
+ H5I_id_info_t **id_list; /*pointer to an array of ptrs to IDs */
} H5I_id_group_t;
-/* Type of the function to compare objects & keys */
-typedef intn (*H5I_search_func_t) (void * obj, const void * key);
-
/* Private Functions in H5I.c */
__DLL__ intn H5I_init_group(H5I_type_t grp, size_t hash_size, uintn reserved,
- herr_t (*free_func)(void *));
+ H5I_free_t func);
__DLL__ herr_t H5I_destroy_group(H5I_type_t grp);
__DLL__ hid_t H5I_register(H5I_type_t grp, void *object);
__DLL__ void *H5I_object(hid_t id);
@@ -72,6 +81,4 @@ __DLL__ void *H5I_remove(hid_t id);
__DLL__ void *H5I_search(H5I_type_t grp, H5I_search_func_t func,
const void *key);
__DLL__ intn H5I_dec_ref(hid_t id);
-__DLL__ hid_t H5I_inc_ref(hid_t id);
-
#endif