summaryrefslogtreecommitdiffstats
path: root/src/H5SM.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2007-01-11 19:19:40 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2007-01-11 19:19:40 (GMT)
commitd8e4fcc4104953c58f6dbc0f92992b3684f70c90 (patch)
tree2c2f9d257a08faeae7c26384ca47bdcafcfebe02 /src/H5SM.c
parentba14f838467f787fd4d42185a7e65fc529f84af8 (diff)
downloadhdf5-d8e4fcc4104953c58f6dbc0f92992b3684f70c90.zip
hdf5-d8e4fcc4104953c58f6dbc0f92992b3684f70c90.tar.gz
hdf5-d8e4fcc4104953c58f6dbc0f92992b3684f70c90.tar.bz2
[svn-r13135] Continuing code cleanup.
Moved SOHM table version out of table encoding and completely into superblock. This is a file format change. Added test that extends shared dataspaces. Dynamically allocate arrays in shared message cache code. Clean up comments. Tested on windows, kagiso, smirom.
Diffstat (limited to 'src/H5SM.c')
-rwxr-xr-xsrc/H5SM.c66
1 files changed, 59 insertions, 7 deletions
diff --git a/src/H5SM.c b/src/H5SM.c
index 40e47c7..94d1d67 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -157,10 +157,6 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, hid_t dxpl_id)
*/
HDassert(num_indexes < 256);
table->num_indexes = num_indexes;
- table->version = H5SM_MASTER_TABLE_VERSION;
-
- f->shared->sohm_nindexes = table->num_indexes;
- f->shared->sohm_vers = table->version;
/* Check that list and btree cutoffs make sense. There can't be any
* values greater than the list max but less than the btree min; the
@@ -463,9 +459,6 @@ H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
}
/* Create a heap to hold the shared messages that the list or B-tree will index */
- /* JAMES: this should happen first, so that the list/btree size can scale depending
- * on how big a heap pointer is.
- */
HDmemset(&fheap_cparam, 0, sizeof(fheap_cparam));
fheap_cparam.managed.width = H5SM_FHEAP_MAN_WIDTH;
fheap_cparam.managed.start_block_size = H5SM_FHEAP_MAN_START_BLOCK_SIZE;
@@ -828,6 +821,7 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, unsigned type_id, void *mesg)
HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is immutable")
/* Don't share committed datatypes */
+ /* JAMES: Quincey says this check isn't working! */
if((tri_ret = H5T_committed((H5T_t*) mesg)) > 0)
HGOTO_DONE(FALSE)
else if(tri_ret < 0)
@@ -1421,6 +1415,64 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5SM_message_encode
+ *
+ * Purpose: Serialize a H5SM_sohm_t struct into a buffer RAW.
+ *
+ * Return: Non-negative on success
+ * Negative on failure
+ *
+ * Programmer: James Laird
+ * Monday, November 6, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5SM_message_encode(const H5F_t UNUSED *f, uint8_t *raw, const void *_nrecord)
+{
+ const H5SM_sohm_t *message = (const H5SM_sohm_t *)_nrecord;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_message_encode)
+
+ /* Encode the SOHM's fields */
+ UINT32ENCODE(raw, message->hash);
+ UINT32ENCODE(raw, message->ref_count);
+ UINT64ENCODE(raw, message->fheap_id);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5SM_message_encode */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5SM_message_decode
+ *
+ * Purpose: Read an encoded SOHM message from RAW into an H5SM_sohm_t struct.
+ *
+ * Return: Non-negative on success
+ * Negative on failure
+ *
+ * Programmer: James Laird
+ * Monday, November 6, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5SM_message_decode(const H5F_t UNUSED *f, const uint8_t *raw, void *_nrecord)
+{
+ H5SM_sohm_t *message = (H5SM_sohm_t *)_nrecord;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_message_decode)
+
+ /* Encode the SOHM's fields */
+ UINT32DECODE(raw, message->hash);
+ UINT32DECODE(raw, message->ref_count);
+ UINT64DECODE(raw, message->fheap_id);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5SM_message_decode */
+
+
+/*-------------------------------------------------------------------------
* Function: H5SM_reconstitute
*
* Purpose: Reconstitute a shared object header message structure from