summaryrefslogtreecommitdiffstats
path: root/src/H5SMbtree2.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2006-11-17 19:39:14 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2006-11-17 19:39:14 (GMT)
commite215d22a79d497518040d74c1d1bd3fce34780cb (patch)
treeb311e41efd3ee0d23dae8558f94b4530b4f7db44 /src/H5SMbtree2.c
parent5660250f25e8e4cb8f05a838d8d2a6f8466ef55c (diff)
downloadhdf5-e215d22a79d497518040d74c1d1bd3fce34780cb.zip
hdf5-e215d22a79d497518040d74c1d1bd3fce34780cb.tar.gz
hdf5-e215d22a79d497518040d74c1d1bd3fce34780cb.tar.bz2
[svn-r12935] Added list-to-btree conversion, changed SOHM apis, and pushed SOHM table
version and size information into the superblock to eliminate a read when loading it. This is a file format change, and hopefully the last one (knock on wood). Tested on kagiso and Windows (mostly just a SOHM change).
Diffstat (limited to 'src/H5SMbtree2.c')
-rwxr-xr-xsrc/H5SMbtree2.c49
1 files changed, 47 insertions, 2 deletions
diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c
index 7e98b06..666ead7 100755
--- a/src/H5SMbtree2.c
+++ b/src/H5SMbtree2.c
@@ -43,6 +43,7 @@
/* Local Prototypes */
/********************/
+/* JAMES: name these as "H5SM_btree_store", etc? */
static herr_t H5SM_message_store(void *native, const void *udata);
static herr_t H5SM_message_retrieve(void *udata, const void *native);
static herr_t H5SM_message_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
@@ -207,7 +208,7 @@ H5SM_message_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord)
/* Encode the SOHM's fields */
UINT32ENCODE(raw, message->hash);
- UINT16ENCODE(raw, message->ref_count);
+ UINT32ENCODE(raw, message->ref_count);
UINT64ENCODE(raw, message->fheap_id);
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -227,6 +228,7 @@ H5SM_message_encode(const H5F_t *f, uint8_t *raw, const void *_nrecord)
*
*-------------------------------------------------------------------------
*/
+/* JAMES: can we combine this with H5SMcache functions? */
herr_t
H5SM_message_decode(const H5F_t *f, const uint8_t *raw, void *_nrecord)
{
@@ -236,7 +238,7 @@ H5SM_message_decode(const H5F_t *f, const uint8_t *raw, void *_nrecord)
/* Encode the SOHM's fields */
UINT32DECODE(raw, message->hash);
- UINT16DECODE(raw, message->ref_count);
+ UINT32DECODE(raw, message->ref_count);
UINT64DECODE(raw, message->fheap_id);
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -349,3 +351,46 @@ H5SM_decr_ref(void *record, void *op_data, hbool_t *changed)
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5SM_convert_to_list_op
+ *
+ * Purpose: An H5B2_remove_t callback function to convert a SOHM
+ * B-tree index to a list.
+ *
+ * Inserts this record into the list passed through op_data.
+ *
+ * Return: Non-negative on success
+ * Negative on failure
+ *
+ * Programmer: James Laird
+ * Monday, November 6, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5SM_convert_to_list_op(void * record, void *op_data)
+{
+ H5SM_sohm_t *message = (H5SM_sohm_t *) record;
+ H5SM_list_t *list = (H5SM_list_t *) op_data;
+ hsize_t x;
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_convert_to_list_op)
+
+ HDassert(record);
+ HDassert(op_data);
+
+ /* Insert this message into the list */
+ for(x=0; x<list->header->list_to_btree; x++)
+ {
+ if(list->messages[x].hash == H5O_HASH_UNDEF) /* JAMES: is this a valid test? */
+ {
+ HDmemcpy(&(list->messages[x]), message, sizeof(H5SM_sohm_t));
+ break;
+ }
+ }
+
+ /* Increment the number of messages in the list */
+ ++list->header->num_messages;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} \ No newline at end of file