summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Fsuper.c6
-rw-r--r--src/H5Omessage.c3
-rw-r--r--src/H5Oprivate.h16
-rw-r--r--src/H5Opublic.h5
-rw-r--r--src/H5Oshared.c7
-rw-r--r--src/H5Pfcpl.c55
-rwxr-xr-xsrc/H5SM.c16
-rw-r--r--src/H5SMcache.c2
8 files changed, 45 insertions, 65 deletions
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 821981c..d8c5d0e 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -372,12 +372,12 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr,
* fcpl */
if(shared->sohm_addr != HADDR_UNDEF)
{
- unsigned index_flags[H5SM_MAX_NINDEXES] = {0};
- unsigned minsizes[H5SM_MAX_NINDEXES] = {0};
+ unsigned index_flags[H5O_SHMESG_MAX_NINDEXES] = {0};
+ unsigned minsizes[H5O_SHMESG_MAX_NINDEXES] = {0};
unsigned sohm_l2b; /* SOHM list-to-btree cutoff */
unsigned sohm_b2l; /* SOHM btree-to-list cutoff */
- HDassert(shared->sohm_nindexes > 0 && shared->sohm_nindexes <= H5SM_MAX_NINDEXES);
+ HDassert(shared->sohm_nindexes > 0 && shared->sohm_nindexes <= H5O_SHMESG_MAX_NINDEXES);
/* Read in the shared OH message information if there is any */
if(H5SM_get_info(f, index_flags, minsizes, &sohm_l2b, &sohm_b2l, dxpl_id) < 0)
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index 515e131..c7979d4 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -307,8 +307,6 @@ done:
*
*-------------------------------------------------------------------------
*/
-/* JAMES: this will probably get put through its paces when extending shared
- * dataspaces */
herr_t
H5O_msg_write(H5O_loc_t *loc, unsigned type_id, unsigned overwrite,
unsigned mesg_flags, unsigned update_flags, void *mesg, hid_t dxpl_id)
@@ -1362,7 +1360,6 @@ H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
} /* end if */
else {
/* If the message is shared, get the real message it points to */
- /* JAMES: test */
if(idx_msg->flags & H5O_MSG_FLAG_SHARED) {
if(NULL == (native_mesg = H5O_shared_read(f, dxpl_id,
idx_msg->native, idx_msg->type, NULL)))
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 9330d4a..392b223 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -46,21 +46,14 @@ typedef struct H5O_msg_class_t H5O_msg_class_t;
typedef struct H5O_t H5O_t;
/* JAMES: should these be in H5SM_private? or renamed? */
-/* JAMES: causes errors encoding/decoding if this is wrong. Can't be constant. */
+/* Fractal heap ID type for shared message heap IDs. The length of a heap ID
+ * depends on how the heap is configured; currently they're always stored in
+ * 8-byte fields, although only seven bytes are used.
+ */
#define H5SM_FHEAP_ID_LEN 7
-
-/* JAMES: not great? */
typedef uint64_t H5SM_fheap_id_t;
-/* JAMES for debugging */
-#define PRINT_BUF(buf, size) \
- if(1) { size_t x; \
- for(x=0; x<size; ++x) { \
- printf("%d ", *(((uint8_t *) buf) + x)); \
- } printf("\n"); }
-
-
/* Object header macros */
#define H5O_MESG_MAX_SIZE 65536 /*max obj header message size */
#define H5O_ALL (-1) /* Operate on all messages of type */
@@ -150,7 +143,6 @@ typedef struct H5O_shared_t {
H5O_loc_t oloc; /*object location info */
H5SM_fheap_id_t heap_id; /* ID within the SOHM heap */
} u;
- /* JAMES: add hash value? */
} H5O_shared_t;
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index 4d4e59b..9ce8429 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -62,9 +62,8 @@
/* Maximum shared message values. Number of indexes is 8 to allow room to add
* new types of messages.
*/
-/* JAMES: make these H5O* */
-#define H5SM_MAX_NINDEXES 8
-#define H5SM_MAX_LIST_ELEMS 5000
+#define H5O_SHMESG_MAX_NINDEXES 8
+#define H5O_SHMESG_MAX_LIST_SIZE 5000
/*******************/
/* Public Typedefs */
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index 579e08f..4112865 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -223,9 +223,6 @@ H5O_shared_link_adj(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *shared, int adj
/* check args */
HDassert(f);
HDassert(shared);
- /* JAMES
- * NEW THOUGHT: I should increment SOHM ref count here (or in a parallel function)
- */
/*
* The shared message is stored in some other object header.
@@ -562,10 +559,6 @@ H5O_shared_link(H5F_t *f, hid_t dxpl_id, const void *_mesg)
HDassert(f);
HDassert(shared);
- /* JAMES_HEAP: see comment in link_adj. Unneccessary except for shared attributes, I think,
- * and they may yet take care of themselves.
- */
-
/* Increment the reference count on the shared object */
if(H5O_shared_link_adj(f, dxpl_id, shared, 1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count")
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
index 35171e6..549b33f 100644
--- a/src/H5Pfcpl.c
+++ b/src/H5Pfcpl.c
@@ -75,9 +75,9 @@
/* Definitions for shared object header messages */
#define H5F_CRT_SHMSG_NINDEXES_SIZE sizeof(unsigned)
#define H5F_CRT_SHMSG_NINDEXES_DEF (0)
-#define H5F_CRT_SHMSG_INDEX_TYPES_SIZE sizeof(unsigned[H5SM_MAX_NINDEXES])
+#define H5F_CRT_SHMSG_INDEX_TYPES_SIZE sizeof(unsigned[H5O_SHMESG_MAX_NINDEXES])
#define H5F_CRT_SHMSG_INDEX_TYPES_DEF {0,0,0,0,0,0}
-#define H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE sizeof(unsigned[H5SM_MAX_NINDEXES])
+#define H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE sizeof(unsigned[H5O_SHMESG_MAX_NINDEXES])
#define H5F_CRT_SHMSG_INDEX_MINSIZE_DEF {250,250,250,250,250,250}
/* Definitions for shared object header list/btree phase change cutoffs */
#define H5F_CRT_SHMSG_LIST_MAX_SIZE sizeof(unsigned)
@@ -158,8 +158,8 @@ H5P_fcrt_reg_prop(H5P_genclass_t *pclass)
unsigned objectdir_ver = H5F_CRT_OBJ_DIR_VERS_DEF; /* Default object directory version # */
unsigned sharedheader_ver = H5F_CRT_SHARE_HEAD_VERS_DEF; /* Default shared header message version # */
unsigned num_sohm_indexes = H5F_CRT_SHMSG_NINDEXES_DEF;
- unsigned sohm_index_flags[H5SM_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_TYPES_DEF;
- unsigned sohm_index_minsizes[H5SM_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_MINSIZE_DEF;
+ unsigned sohm_index_flags[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_TYPES_DEF;
+ unsigned sohm_index_minsizes[H5O_SHMESG_MAX_NINDEXES] = H5F_CRT_SHMSG_INDEX_MINSIZE_DEF;
unsigned sohm_list_max = H5F_CRT_SHMSG_LIST_MAX_DEF;
unsigned sohm_btree_min = H5F_CRT_SHMSG_BTREE_MIN_DEF;
herr_t ret_value = SUCCEED; /* Return value */
@@ -690,7 +690,9 @@ done:
* zero then shared object header messages are disabled
* for this file.
*
- * These indexes can be configured with JAMES
+ * These indexes can then be configured with
+ * H5Pset_shared_mesg_index. H5Pset_shared_mesg_phase_chage
+ * also controls settings for all indexes.
*
* Return: Non-negative on success/Negative on failure
*
@@ -709,8 +711,8 @@ H5Pset_shared_mesg_nindexes(hid_t plist_id, unsigned nindexes)
H5TRACE2("e", "iIu", plist_id, nindexes);
/* Check argument */
- if (nindexes > H5SM_MAX_NINDEXES)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "number of indexes is greater than H5SM_MAX_NINDEXES");
+ if (nindexes > H5O_SHMESG_MAX_NINDEXES)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "number of indexes is greater than H5O_SHMESG_MAX_NINDEXES");
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE)))
@@ -765,6 +767,9 @@ done:
* message that should be stored in this index and the minimum
* size of a message in the index.
*
+ * INDEX_NUM is zero-indexed (in a file with three indexes,
+ * they are numbered 0, 1, and 2).
+ *
* Return: Non-negative on success/Negative on failure
*
* Programmer: James Laird
@@ -777,16 +782,14 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_
{
H5P_genplist_t *plist; /* Property list pointer */
unsigned nindexes; /* Number of SOHM indexes */
- unsigned type_flags[H5SM_MAX_NINDEXES]; /* Array of mesg_type_flags*/
- unsigned minsizes[H5SM_MAX_NINDEXES]; /* Array of min_mesg_sizes*/
+ unsigned type_flags[H5O_SHMESG_MAX_NINDEXES]; /* Array of mesg_type_flags*/
+ unsigned minsizes[H5O_SHMESG_MAX_NINDEXES]; /* Array of min_mesg_sizes*/
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5Pset_shared_mesg_index, FAIL)
H5TRACE4("e", "iIuIuIu", plist_id, index_num, mesg_type_flags, min_mesg_size);
/* Check arguments */
- if(index_num == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index_num must be at least 1");
if(mesg_type_flags > H5O_MESG_ALL_FLAG)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unrecognized flags in mesg_type_flags");
@@ -799,8 +802,8 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes");
/* Range check */
- if(index_num > nindexes)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index_num is greater than number of indexes in property list");
+ if(index_num >= nindexes)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index_num is too large; no such index");
/* Get arrays of type flags and message sizes */
if(H5P_get(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0)
@@ -809,8 +812,8 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current min sizes")
/* Set values in arrays */
- type_flags[index_num - 1] = mesg_type_flags;
- minsizes[index_num - 1] = min_mesg_size;
+ type_flags[index_num] = mesg_type_flags;
+ minsizes[index_num] = min_mesg_size;
/* Write arrays back to plist */
if(H5P_set(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0)
@@ -842,18 +845,14 @@ H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type
{
H5P_genplist_t *plist; /* Property list pointer */
unsigned nindexes; /* Number of SOHM indexes */
- unsigned type_flags[H5SM_MAX_NINDEXES]; /* Array of mesg_type_flags*/
- unsigned minsizes[H5SM_MAX_NINDEXES]; /* Array of min_mesg_sizes*/
+ unsigned type_flags[H5O_SHMESG_MAX_NINDEXES]; /* Array of mesg_type_flags*/
+ unsigned minsizes[H5O_SHMESG_MAX_NINDEXES]; /* Array of min_mesg_sizes*/
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Pget_shared_mesg_index, FAIL);
H5TRACE4("e", "iIu*Iu*Iu", plist_id, index_num, mesg_type_flags,
min_mesg_size);
- /* Check arguments */
- if(index_num == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index_num must be at least 1")
-
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
@@ -862,7 +861,7 @@ H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type
if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes")
- if(index_num > nindexes)
+ if(index_num >= nindexes)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index_num is greater than number of indexes in property list")
/* Get arrays of type flags and message sizes */
@@ -873,9 +872,9 @@ H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type
/* Get values from arrays */
if(mesg_type_flags)
- *mesg_type_flags = type_flags[index_num - 1];
+ *mesg_type_flags = type_flags[index_num];
if(min_mesg_size)
- *min_mesg_size = minsizes[index_num - 1];
+ *min_mesg_size = minsizes[index_num];
done:
FUNC_LEAVE_API(ret_value);
@@ -917,10 +916,10 @@ H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_
*/
if(max_list + 1 < min_btree)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "minimum B-tree value is greater than maximum list value")
- if(max_list > H5SM_MAX_LIST_ELEMS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max list value is larger than H5SM_MAX_LIST_ELEMS")
- if(min_btree > H5SM_MAX_LIST_ELEMS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "min btree value is larger than H5SM_MAX_LIST_ELEMS")
+ if(max_list > H5O_SHMESG_MAX_LIST_SIZE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max list value is larger than H5O_SHMESG_MAX_LIST_SIZE")
+ if(min_btree > H5O_SHMESG_MAX_LIST_SIZE)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "min btree value is larger than H5O_SHMESG_MAX_LIST_SIZE")
/* Avoid the strange case where max_list == 0 and min_btree == 1, so deleting the
* last message in a B-tree makes it become an empty list.
diff --git a/src/H5SM.c b/src/H5SM.c
index 74315d7..38d1b34 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -73,9 +73,9 @@ static herr_t H5SM_type_to_flag(unsigned type_id, unsigned *type_flag);
/*********************/
H5FL_DEFINE(H5SM_master_table_t);
-H5FL_ARR_DEFINE(H5SM_index_header_t, H5SM_MAX_NINDEXES);
+H5FL_ARR_DEFINE(H5SM_index_header_t, H5O_SHMESG_MAX_NINDEXES);
H5FL_DEFINE(H5SM_list_t);
-H5FL_ARR_DEFINE(H5SM_sohm_t, H5SM_MAX_LIST_ELEMS);
+H5FL_ARR_DEFINE(H5SM_sohm_t, H5O_SHMESG_MAX_LIST_SIZE);
/*****************************/
@@ -111,8 +111,8 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, hid_t dxpl_id)
haddr_t table_addr = HADDR_UNDEF;
unsigned num_indexes;
unsigned list_max, btree_min;
- unsigned index_type_flags[H5SM_MAX_NINDEXES];
- unsigned minsizes[H5SM_MAX_NINDEXES];
+ unsigned index_type_flags[H5O_SHMESG_MAX_NINDEXES];
+ unsigned minsizes[H5O_SHMESG_MAX_NINDEXES];
unsigned type_flags_used;
unsigned x;
hsize_t table_size;
@@ -141,7 +141,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, hid_t dxpl_id)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get SOHM message min sizes")
/* Verify that values are valid */
- if(num_indexes > H5SM_MAX_NINDEXES)
+ if(num_indexes > H5O_SHMESG_MAX_NINDEXES)
HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "number of indexes in property list is too large")
/* Check that type flags weren't duplicated anywhere */
@@ -168,7 +168,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t * fc_plist, hid_t dxpl_id)
* min.
*/
HDassert(list_max + 1 >= btree_min);
- HDassert(table->num_indexes > 0 && table->num_indexes <= H5SM_MAX_NINDEXES);
+ HDassert(table->num_indexes > 0 && table->num_indexes <= H5O_SHMESG_MAX_NINDEXES);
/* Allocate the SOHM indexes as an array. */
if(NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes)))
@@ -439,7 +439,7 @@ H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
{
header->index_type = H5SM_LIST;
- if((list_addr = H5SM_create_list(f, header, dxpl_id)) == HADDR_UNDEF) /* JAMES: only allocate part of the list? */
+ if((list_addr = H5SM_create_list(f, header, dxpl_id)) == HADDR_UNDEF)
HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "list creation failed for SOHM index")
header->index_addr = list_addr;
@@ -937,7 +937,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
if (NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, NULL, header, H5AC_WRITE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
- /* JAMES: not very effecient (gets hash value twice, searches list twice). Refactor. */
+ /* JAMES: not very efficient (gets hash value twice, searches list twice). Refactor. */
/* See if the message is already in the index and get its location */
/* JAMES: should return a pointer to the message */
list_pos = H5SM_find_in_list(list, &key);
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index d4323b0..5e8f58f 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -44,7 +44,7 @@
/* Local Macros */
/****************/
/* JAMES: should this change according to address size? */
-#define H5F_LISTBUF_SIZE H5SM_LIST_SIZEOF_MAGIC + H5SM_MAX_LIST_ELEMS * 16
+#define H5F_LISTBUF_SIZE H5SM_LIST_SIZEOF_MAGIC + H5O_SHMESG_MAX_LIST_SIZE * 16
#define H5SM_LIST_VERSION 0 /* Verion of Shared Object Header Message List Indexes */