summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c2
-rw-r--r--src/H5Abtree2.c16
-rw-r--r--src/H5Adense.c64
-rw-r--r--src/H5Apkg.h8
-rw-r--r--src/H5D.c16
-rw-r--r--src/H5O.c128
-rw-r--r--src/H5Oalloc.c8
-rw-r--r--src/H5Oattr.c190
-rw-r--r--src/H5Oattribute.c10
-rw-r--r--src/H5Obogus.c2
-rw-r--r--src/H5Ocache.c59
-rw-r--r--src/H5Ocont.c2
-rw-r--r--src/H5Ocopy.c14
-rw-r--r--src/H5Odbg.c8
-rw-r--r--src/H5Odtype.c2
-rw-r--r--src/H5Oefl.c2
-rw-r--r--src/H5Ofill.c4
-rw-r--r--src/H5Oginfo.c2
-rw-r--r--src/H5Olayout.c2
-rw-r--r--src/H5Olinfo.c2
-rw-r--r--src/H5Olink.c2
-rw-r--r--src/H5Omessage.c31
-rw-r--r--src/H5Omtime.c4
-rw-r--r--src/H5Oname.c2
-rw-r--r--src/H5Onull.c38
-rw-r--r--src/H5Opkg.h125
-rw-r--r--src/H5Opline.c2
-rw-r--r--src/H5Oprivate.h27
-rw-r--r--src/H5Osdspace.c2
-rw-r--r--src/H5Oshared.c33
-rw-r--r--src/H5Ostab.c2
-rwxr-xr-xsrc/H5SM.c42
-rwxr-xr-xsrc/H5SMbtree2.c31
-rwxr-xr-xsrc/H5SMpkg.h4
-rwxr-xr-xsrc/H5SMprivate.h2
35 files changed, 507 insertions, 381 deletions
diff --git a/src/H5A.c b/src/H5A.c
index e4300d5..9e25d02 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -427,7 +427,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open")
attr->obj_opened = TRUE;
- /* Create the attribute on the object */
+ /* Insert the attribute into the object header */
if(H5O_attr_create(&(attr->oloc), dxpl_id, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create attribute in object header")
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c
index 5fb37fe..14d7bb9 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -193,7 +193,7 @@ H5A_dense_btree2_name_store(void *_nrecord, const void *_udata)
/* Copy user information info native record */
nrecord->hash = udata->common.name_hash;
nrecord->flags = udata->common.flags;
- HDmemcpy(nrecord->id, udata->id, (size_t)H5A_DENSE_FHEAP_ID_LEN);
+ nrecord->id = udata->id;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A_dense_btree2_name_store() */
@@ -283,7 +283,7 @@ H5A_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec)
HDassert(fheap);
/* Check if the user's link and the B-tree's link have the same name */
- status = H5HF_op(fheap, bt2_udata->dxpl_id, bt2_rec->id, H5A_dense_fh_name_cmp, &fh_udata);
+ status = H5HF_op(fheap, bt2_udata->dxpl_id, &bt2_rec->id, H5A_dense_fh_name_cmp, &fh_udata);
HDassert(status >= 0);
/* Callback will set comparison value */
@@ -318,7 +318,7 @@ H5A_dense_btree2_name_encode(const H5F_t UNUSED *f, uint8_t *raw, const void *_n
/* Encode the record's fields */
UINT32ENCODE(raw, nrecord->hash)
*raw++ = nrecord->flags;
- HDmemcpy(raw, nrecord->id, (size_t)H5A_DENSE_FHEAP_ID_LEN);
+ UINT64ENCODE(raw, nrecord->id);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A_dense_btree2_name_encode() */
@@ -347,7 +347,7 @@ H5A_dense_btree2_name_decode(const H5F_t UNUSED *f, const uint8_t *raw, void *_n
/* Decode the record's fields */
UINT32DECODE(raw, nrecord->hash)
nrecord->flags = *raw++;
- HDmemcpy(nrecord->id, raw, (size_t)H5A_DENSE_FHEAP_ID_LEN);
+ UINT64DECODE(raw, nrecord->id);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A_dense_btree2_name_decode() */
@@ -371,15 +371,11 @@ H5A_dense_btree2_name_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dx
int indent, int fwidth, const void *_nrecord, const void UNUSED *_udata)
{
const H5A_dense_bt2_name_rec_t *nrecord = (const H5A_dense_bt2_name_rec_t *)_nrecord;
- unsigned u; /* Local index variable */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_dense_btree2_name_debug)
- HDfprintf(stream, "%*s%-*s {%lx, ", indent, "", fwidth, "Record:",
- nrecord->hash);
- for(u = 0; u < H5A_DENSE_FHEAP_ID_LEN; u++)
- HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5A_DENSE_FHEAP_ID_LEN - 1) ? " " : ", "));
- HDfprintf(stderr, "%02x}\n", nrecord->flags);
+ HDfprintf(stream, "%*s%-*s {%lx, %Hx, %02x}", indent, "", fwidth, "Record:",
+ nrecord->hash, nrecord->id, nrecord->flags);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A_dense_btree2_name_debug() */
diff --git a/src/H5Adense.c b/src/H5Adense.c
index 1259975..b58a192 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -47,20 +47,6 @@
/* Local Macros */
/****************/
-/* Fractal heap creation parameters for "dense" attribute storage */
-/* (Note that these parameters have been tuned so that the resulting heap ID
- * is exactly 8 bytes. This is an efficient size and is also the same as
- * the size of the shared message heap IDs, think carefully before
- * changing it. -QAK)
- */
-#define H5A_FHEAP_MAN_WIDTH 4
-#define H5A_FHEAP_MAN_START_BLOCK_SIZE 512
-#define H5A_FHEAP_MAN_MAX_DIRECT_SIZE (64 * 1024)
-#define H5A_FHEAP_MAN_MAX_INDEX 40
-#define H5A_FHEAP_MAN_START_ROOT_ROWS 1
-#define H5A_FHEAP_CHECKSUM_DBLOCKS TRUE
-#define H5A_FHEAP_MAX_MAN_SIZE (4 * 1024)
-
/* v2 B-tree creation macros for 'name' field index */
#define H5A_NAME_BT2_NODE_SIZE 512
#define H5A_NAME_BT2_MERGE_PERC 40
@@ -177,7 +163,6 @@ H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
{
H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */
H5HF_t *fheap; /* Fractal heap handle */
- size_t fheap_id_len; /* Fractal heap ID length */
size_t bt2_rrec_size; /* v2 B-tree raw record size */
herr_t ret_value = SUCCEED; /* Return value */
@@ -192,13 +177,13 @@ H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
/* Set fractal heap creation parameters */
/* XXX: Give some control of these to applications? */
HDmemset(&fheap_cparam, 0, sizeof(fheap_cparam));
- fheap_cparam.managed.width = H5A_FHEAP_MAN_WIDTH;
- fheap_cparam.managed.start_block_size = H5A_FHEAP_MAN_START_BLOCK_SIZE;
- fheap_cparam.managed.max_direct_size = H5A_FHEAP_MAN_MAX_DIRECT_SIZE;
- fheap_cparam.managed.max_index = H5A_FHEAP_MAN_MAX_INDEX;
- fheap_cparam.managed.start_root_rows = H5A_FHEAP_MAN_START_ROOT_ROWS;
- fheap_cparam.checksum_dblocks = H5A_FHEAP_CHECKSUM_DBLOCKS;
- fheap_cparam.max_man_size = H5A_FHEAP_MAX_MAN_SIZE;
+ fheap_cparam.managed.width = H5O_FHEAP_MAN_WIDTH;
+ fheap_cparam.managed.start_block_size = H5O_FHEAP_MAN_START_BLOCK_SIZE;
+ fheap_cparam.managed.max_direct_size = H5O_FHEAP_MAN_MAX_DIRECT_SIZE;
+ fheap_cparam.managed.max_index = H5O_FHEAP_MAN_MAX_INDEX;
+ fheap_cparam.managed.start_root_rows = H5O_FHEAP_MAN_START_ROOT_ROWS;
+ fheap_cparam.checksum_dblocks = H5O_FHEAP_CHECKSUM_DBLOCKS;
+ fheap_cparam.max_man_size = H5O_FHEAP_MAX_MAN_SIZE;
/* Create fractal heap for storing attributes */
if(NULL == (fheap = H5HF_create(f, dxpl_id, &fheap_cparam)))
@@ -211,14 +196,19 @@ H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_t *oh)
HDfprintf(stderr, "%s: oh->attr_fheap_addr = %a\n", FUNC, oh->attr_fheap_addr);
#endif /* QAK */
+#ifndef NDEBUG
+{
+ size_t fheap_id_len; /* Fractal heap ID length */
+
/* Retrieve the heap's ID length in the file */
if(H5HF_get_id_len(fheap, &fheap_id_len) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length")
- HDassert(fheap_id_len == H5A_DENSE_FHEAP_ID_LEN);
- HDassert(fheap_id_len == H5SM_FHEAP_ID_LEN); /* Need to be interchangable -QAK */
+ HDassert(fheap_id_len == H5O_FHEAP_ID_LEN);
#ifdef QAK
HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len);
#endif /* QAK */
+}
+#endif /* NDEBUG */
/* Close the fractal heap */
if(H5HF_close(fheap, dxpl_id) < 0)
@@ -227,7 +217,7 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len);
/* Create the name index v2 B-tree */
bt2_rrec_size = 4 + /* Name's hash value */
1 + /* Message flags */
- fheap_id_len; /* Fractal heap ID */
+ H5O_FHEAP_ID_LEN; /* Fractal heap ID */
if(H5B2_create(f, dxpl_id, H5A_BT2_NAME,
(size_t)H5A_NAME_BT2_NODE_SIZE, bt2_rrec_size,
H5A_NAME_BT2_SPLIT_PERC, H5A_NAME_BT2_MERGE_PERC,
@@ -243,7 +233,7 @@ HDfprintf(stderr, "%s: oh->name_bt2_addr = %a\n", FUNC, oh->name_bt2_addr);
if(linfo->index_corder) {
/* Create the creation order index v2 B-tree */
bt2_rrec_size = 8 + /* Creation order value */
- fheap_id_len; /* Fractal heap ID */
+ H5O_FHEAP_ID_LEN; /* Fractal heap ID */
if(H5B2_create(f, dxpl_id, H5A_BT2_CORDER,
(size_t)H5A_CORDER_BT2_NODE_SIZE, bt2_rrec_size,
H5A_CORDER_BT2_SPLIT_PERC, H5A_CORDER_BT2_MERGE_PERC,
@@ -398,7 +388,6 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_t *oh, unsigned mesg_flags,
H5A_bt2_ud_ins_t udata; /* User data for v2 B-tree insertion */
H5HF_t *fheap = NULL; /* Fractal heap handle for attributes */
H5HF_t *shared_fheap = NULL; /* Fractal heap handle for shared header messages */
- uint8_t id[H5A_DENSE_FHEAP_ID_LEN]; /* Heap ID of attribute to insert */
H5O_shared_t sh_mesg; /* Shared object header message */
uint8_t attr_buf[H5A_ATTR_BUF_SIZE]; /* Buffer for serializing message */
void *attr_ptr = NULL; /* Pointer to serialized message */
@@ -447,7 +436,7 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_t *oh, unsigned mesg_flags,
HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't get shared message")
/* Use heap ID for shared message heap */
- udata.id = (const uint8_t *)&sh_mesg.u.heap_id;
+ udata.id = sh_mesg.u.heap_id;
} /* end if */
else {
size_t attr_size; /* Size of serialized attribute in the heap */
@@ -469,11 +458,9 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_t *oh, unsigned mesg_flags,
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute")
/* Insert the serialized attribute into the fractal heap */
- if(H5HF_insert(fheap, dxpl_id, attr_size, attr_ptr, id) < 0)
+ /* (sets the heap ID in the user data) */
+ if(H5HF_insert(fheap, dxpl_id, attr_size, attr_ptr, &udata.id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert attribute into fractal heap")
-
- /* Use heap ID for attribute heap */
- udata.id = id;
} /* end else */
/* Create the callback information for v2 B-tree record insertion */
@@ -553,7 +540,7 @@ H5A_dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't get shared info")
/* Update record's heap ID */
- HDmemcpy(record->id, &op_data->attr->sh_loc.u.heap_id, sizeof(record->id));
+ record->id = op_data->attr->sh_loc.u.heap_id;
/* Note that the record changed */
*changed = TRUE;
@@ -582,14 +569,14 @@ H5A_dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
{
size_t obj_len; /* Length of existing encoded attribute */
- if(H5HF_get_obj_len(op_data->fheap, op_data->dxpl_id, record->id, &obj_len) < 0)
+ if(H5HF_get_obj_len(op_data->fheap, op_data->dxpl_id, &record->id, &obj_len) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get object size")
HDassert(obj_len == attr_size);
}
#endif /* NDEBUG */
/* Update existing attribute in heap */
/* (would be more efficient as fractal heap 'op' callback, but leave that for later -QAK) */
- if(H5HF_write(op_data->fheap, op_data->dxpl_id, record->id, changed, attr_ptr) < 0)
+ if(H5HF_write(op_data->fheap, op_data->dxpl_id, &record->id, changed, attr_ptr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute in heap")
} /* end else */
@@ -910,8 +897,7 @@ H5A_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)
fh_udata.attr = NULL;
/* Call fractal heap 'op' routine, to copy the attribute information */
- if(H5HF_op(fheap, bt2_udata->dxpl_id, record->id,
- H5A_dense_copy_fh_cb, &fh_udata) < 0)
+ if(H5HF_op(fheap, bt2_udata->dxpl_id, &record->id, H5A_dense_copy_fh_cb, &fh_udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPERATE, H5_ITER_ERROR, "heap op callback failed")
/* Check which type of callback to make */
@@ -1098,7 +1084,7 @@ H5A_dense_remove_bt2_cb(const void *_record, void *_bt2_udata)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
/* Remove record from fractal heap */
- if(H5HF_remove(bt2_udata->fheap, bt2_udata->dxpl_id, record->id) < 0)
+ if(H5HF_remove(bt2_udata->fheap, bt2_udata->dxpl_id, &record->id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from fractal heap")
} /* end else */
@@ -1316,7 +1302,7 @@ H5A_dense_delete_bt2_cb(const void *_record, void *_bt2_udata)
fh_udata.attr = NULL;
/* Call fractal heap 'op' routine, to copy the attribute information */
- if(H5HF_op(fheap, bt2_udata->dxpl_id, record->id, H5A_dense_copy_fh_cb, &fh_udata) < 0)
+ if(H5HF_op(fheap, bt2_udata->dxpl_id, &record->id, H5A_dense_copy_fh_cb, &fh_udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPERATE, FAIL, "heap op callback failed")
/* Check for shared attribute */
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index ca4b50d..a3910a9 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -50,9 +50,6 @@
/* Package Private Macros */
/**************************/
-/* Standard length of fractal heap ID for attribute */
-#define H5A_DENSE_FHEAP_ID_LEN 8
-
/****************************/
/* Package Private Typedefs */
@@ -73,6 +70,7 @@ struct H5A_t {
void *data; /* Attribute data (on a temporary basis) */
size_t data_size; /* Size of data on disk */
H5O_shared_t sh_loc; /* Location of shared message */
+ H5O_crt_idx_t crt_idx; /* Attribute's creation index in the object header */
};
/* Typedefs for "dense" attribute storage */
@@ -81,7 +79,7 @@ struct H5A_t {
/* Typedef for native 'name' field index records in the v2 B-tree */
/* (Keep 'id' field first so generic record handling in callbacks works) */
typedef struct H5A_dense_bt2_name_rec_t {
- uint8_t id[H5A_DENSE_FHEAP_ID_LEN]; /* Heap ID for link */
+ H5O_fheap_id_t id; /* Heap ID for attribute */
uint8_t flags; /* Message flags for attribute */
uint32_t hash; /* Hash of 'name' field value */
} H5A_dense_bt2_name_rec_t;
@@ -112,7 +110,7 @@ typedef struct H5A_bt2_ud_common_t {
typedef struct H5A_bt2_ud_ins_t {
/* downward */
H5A_bt2_ud_common_t common; /* Common info for B-tree user data (must be first) */
- const uint8_t *id; /* Heap ID of attribute to insert */
+ H5O_fheap_id_t id; /* Heap ID of attribute to insert */
} H5A_bt2_ud_ins_t;
/* Data structure to hold table of attributes for an object */
diff --git a/src/H5D.c b/src/H5D.c
index 090b0c3..a0304a6 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1195,7 +1195,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
/* fill value variables */
H5D_fill_time_t fill_time;
H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
- H5O_fill_new_t fill = {NULL, 0, NULL, H5D_ALLOC_TIME_LATE, H5D_FILL_TIME_ALLOC, TRUE};
+ H5O_fill_new_t fill; /* Default fill value */
H5D_fill_value_t fill_status;
struct H5O_t *oh = NULL; /* Pointer to dataset's object header */
@@ -1208,6 +1208,12 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
HDassert(file);
HDassert(dset);
+ /* Portably initialize the fill value */
+ HDmemset(&fill, 0, sizeof(H5O_fill_new_t));
+ fill.alloc_time = H5D_ALLOC_TIME_LATE;
+ fill.fill_time = H5D_FILL_TIME_ALLOC;
+ fill.fill_defined = TRUE;
+
/* Set some location variables, for convenience */
oloc = &dset->oloc;
layout = &dset->shared->layout;
@@ -1858,7 +1864,7 @@ done:
static herr_t
H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
{
- H5O_fill_new_t fill = {NULL, 0, NULL, H5D_ALLOC_TIME_LATE, H5D_FILL_TIME_IFSET, TRUE};
+ H5O_fill_new_t fill; /* Default fill value */
unsigned alloc_time_state; /* Allocation time state */
H5O_fill_t *fill_prop; /* Pointer to dataset's fill value area */
H5O_pline_t pline; /* I/O pipeline information */
@@ -1870,6 +1876,12 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id)
/* check args */
HDassert(dataset);
+ /* Portably initialize the fill value */
+ HDmemset(&fill, 0, sizeof(H5O_fill_new_t));
+ fill.alloc_time = H5D_ALLOC_TIME_LATE;
+ fill.fill_time = H5D_FILL_TIME_ALLOC;
+ fill.fill_defined = TRUE;
+
/* (Set the 'vl_type' parameter to FALSE since it doesn't matter from here) */
if(NULL == (dataset->shared = H5D_new(H5P_DATASET_CREATE_DEFAULT, FALSE, FALSE)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
diff --git a/src/H5O.c b/src/H5O.c
index 9470a7f..2101fa3 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -30,6 +30,9 @@
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
+/* Interface initialization */
+#define H5_INTERFACE_INIT_FUNC H5O_init_interface
+
/***********/
/* Headers */
/***********/
@@ -64,8 +67,6 @@
/********************/
static hid_t H5O_open_by_loc(H5G_loc_t *obj_loc, hid_t dxpl_id);
-static herr_t H5O_new(H5F_t *f, hid_t dxpl_id, haddr_t header, size_t chunk_size,
- hid_t ocpl_id, H5O_loc_t *loc/*out*/);
static herr_t H5O_delete_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh);
static const H5O_obj_class_t *H5O_obj_class(H5O_loc_t *loc, hid_t dxpl_id);
static herr_t H5O_obj_type_real(H5O_t *oh, H5O_type_t *obj_type);
@@ -142,6 +143,31 @@ H5FL_EXTERN(time_t);
/*-------------------------------------------------------------------------
+ * Function: H5O_init_interface
+ *
+ * Purpose: Initialize information specific to H5O interface.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, January 18, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_init_interface(void)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_init_interface)
+
+ /* H5O interface sanity checks */
+ HDassert(H5O_MSG_TYPES == NELMTS(H5O_msg_class_g));
+ HDassert(sizeof(H5O_fheap_id_t) == H5O_FHEAP_ID_LEN);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_init_interface() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5Oopen
*
* Purpose: Opens an object within an HDF5 file.
@@ -620,77 +646,27 @@ herr_t
H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id,
H5O_loc_t *loc/*out*/)
{
- haddr_t header; /* Address of object header */
- herr_t ret_value = SUCCEED; /* return value */
-
- FUNC_ENTER_NOAPI(H5O_create, FAIL)
-
- /* check args */
- HDassert(f);
- HDassert(loc);
-
- /* Make certain we allocate at least a reasonable size for the object header */
- size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint));
-
- /* allocate disk space for header and first chunk */
- if(HADDR_UNDEF == (header = H5MF_alloc(f, H5FD_MEM_OHDR, dxpl_id,
- (hsize_t)H5O_SIZEOF_HDR_F(f) + size_hint)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header header")
-
- /* initialize the object header */
- if(H5O_new(f, dxpl_id, header, size_hint, ocpl_id, loc) != SUCCEED)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to initialize object header")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_new
- *
- * Purpose: Initialize a new object header, sets the link count to 0,
- * and caches the header. The object header is opened for
- * write access and should eventually be closed by calling
- * H5O_close().
- *
- * Return: Success: SUCCEED, the LOC argument contains
- * information about the object header,
- * including its address.
- * Failure: FAIL
- *
- * Programmer: Bill Wendling
- * 1, November 2002
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O_new(H5F_t *f, hid_t dxpl_id, haddr_t header, size_t chunk_size,
- hid_t ocpl_id, H5O_loc_t *loc/*out*/)
-{
H5O_t *oh = NULL;
+ haddr_t oh_addr; /* Address of initial object header */
size_t oh_size; /* Size of initial object header */
herr_t ret_value = SUCCEED; /* return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_new)
+ FUNC_ENTER_NOAPI(H5O_create, FAIL)
/* check args */
HDassert(f);
HDassert(loc);
HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
- /* Set up object location */
- loc->file = f;
- loc->addr = header;
+ /* Make certain we allocate at least a reasonable size for the object header */
+ size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint));
/* Allocate the object header and fill in header fields */
- if(NULL == (oh = H5FL_MALLOC(H5O_t)))
+ if(NULL == (oh = H5FL_CALLOC(H5O_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize rudimentary information object object header */
oh->version = H5F_USE_LATEST_FORMAT(f) ? H5O_VERSION_LATEST : H5O_VERSION_1;
- oh->nlink = 0;
- oh->skipped_mesg_size = 0;
oh->sizeof_size = H5F_SIZEOF_SIZE(f);
oh->sizeof_addr = H5F_SIZEOF_ADDR(f);
@@ -714,7 +690,6 @@ H5O_new(H5F_t *f, hid_t dxpl_id, haddr_t header, size_t chunk_size,
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get min. # of dense attributes")
/* Set starting values for attribute info */
- oh->nattrs = 0;
oh->attr_fheap_addr = HADDR_UNDEF;
oh->name_bt2_addr = HADDR_UNDEF;
} /* end if */
@@ -723,16 +698,17 @@ H5O_new(H5F_t *f, hid_t dxpl_id, haddr_t header, size_t chunk_size,
oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
/* Reset unused attribute fields */
- oh->max_compact = 0;
- oh->min_dense = 0;
- oh->nattrs = 0;
oh->attr_fheap_addr = HADDR_UNDEF;
oh->name_bt2_addr = HADDR_UNDEF;
} /* end else */
/* Compute total size of initial object header */
/* (i.e. object header prefix and first chunk) */
- oh_size = H5O_SIZEOF_HDR_OH(oh) + chunk_size;
+ oh_size = H5O_SIZEOF_HDR(oh) + size_hint;
+
+ /* Allocate disk space for header and first chunk */
+ if(HADDR_UNDEF == (oh_addr = H5MF_alloc(f, H5FD_MEM_OHDR, dxpl_id, (hsize_t)oh_size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header header")
/* Create the chunk list */
oh->nchunks = oh->alloc_nchunks = 1;
@@ -741,7 +717,7 @@ H5O_new(H5F_t *f, hid_t dxpl_id, haddr_t header, size_t chunk_size,
/* Initialize the first chunk */
oh->chunk[0].dirty = TRUE;
- oh->chunk[0].addr = loc->addr;
+ oh->chunk[0].addr = oh_addr;
oh->chunk[0].size = oh_size;
oh->chunk[0].gap = 0;
@@ -764,26 +740,29 @@ H5O_new(H5F_t *f, hid_t dxpl_id, haddr_t header, size_t chunk_size,
oh->mesg[0].type = H5O_MSG_NULL;
oh->mesg[0].dirty = TRUE;
oh->mesg[0].native = NULL;
- oh->mesg[0].raw = oh->chunk[0].image + (H5O_SIZEOF_HDR_OH(oh) - H5O_SIZEOF_CHKSUM_OH(oh)) + H5O_SIZEOF_MSGHDR_OH(oh);
- oh->mesg[0].raw_size = chunk_size - H5O_SIZEOF_MSGHDR_OH(oh);
+ oh->mesg[0].raw = oh->chunk[0].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)) + H5O_SIZEOF_MSGHDR_OH(oh);
+ oh->mesg[0].raw_size = size_hint - H5O_SIZEOF_MSGHDR_OH(oh);
oh->mesg[0].chunkno = 0;
/* Cache object header */
- if(H5AC_set(f, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_set(f, dxpl_id, H5AC_OHDR, oh_addr, oh, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to cache object header")
+ /* Set up object location */
+ loc->file = f;
+ loc->addr = oh_addr;
+
/* Open it */
if(H5O_open(loc) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object header")
done:
- if(ret_value < 0 && oh) {
+ if(ret_value < 0 && oh)
if(H5O_dest(f, oh) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_new() */
+} /* end H5O_create() */
/*-------------------------------------------------------------------------
@@ -802,21 +781,24 @@ done:
herr_t
H5O_open(const H5O_loc_t *loc)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5O_open)
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5O_open, FAIL)
/* Check args */
HDassert(loc);
HDassert(loc->file);
#ifdef H5O_DEBUG
- if (H5DEBUG(O))
+ if(H5DEBUG(O))
HDfprintf(H5DEBUG(O), "> %a\n", loc->addr);
#endif
/* Increment open-lock counters */
loc->file->nopen_objs++;
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_open() */
@@ -1848,7 +1830,7 @@ H5O_get_info(H5O_loc_t *oloc, H5O_info_t *oinfo, hid_t dxpl_id)
/* Iterate over all the messages, accumulating message size & type information */
oinfo->num_attrs = 0;
- oinfo->hdr.meta_space = H5O_SIZEOF_HDR_OH(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
+ oinfo->hdr.meta_space = H5O_SIZEOF_HDR(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
oinfo->hdr.mesg_space = 0;
oinfo->hdr.free_space = 0;
oinfo->hdr.msg_present = 0;
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index b1a81aa..bb23c2b 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -838,12 +838,8 @@ done:
*-------------------------------------------------------------------------
*/
unsigned
-H5O_alloc(H5F_t *f,
- hid_t dxpl_id,
- H5O_t *oh,
- const H5O_msg_class_t *type,
- size_t size,
- unsigned * oh_flags_ptr)
+H5O_alloc(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *type,
+ size_t size, unsigned * oh_flags_ptr)
{
size_t aligned_size = H5O_ALIGN_OH(oh, size);
unsigned idx; /* Index of message which fits allocation */
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index d70aab0..a2c6654 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -39,6 +39,8 @@ static void *H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t *mesg_typ
void *native_src, H5F_t *file_dst, hid_t dxpl_id, H5O_copy_t *cpy_info,
void *udata);
static herr_t H5O_attr_set_share(void *_mesg, const H5O_shared_t *sh);
+static herr_t H5O_attr_get_crt_index(const void *_mesg, H5O_crt_idx_t *crt_idx);
+static herr_t H5O_attr_set_crt_index(void *_mesg, H5O_crt_idx_t crt_idx);
static herr_t H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
FILE * stream, int indent, int fwidth);
@@ -62,6 +64,8 @@ const H5O_msg_class_t H5O_MSG_ATTR[1] = {{
H5O_attr_pre_copy_file, /* pre copy native value to file */
H5O_attr_copy_file, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL /* H5O_attr_get_crt_index */, /* get creation index */
+ NULL /* H5O_attr_set_crt_index */, /* set creation index */
H5O_attr_debug /* debug the message */
}};
@@ -741,6 +745,96 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5O_attr_get_share
+ *
+ * Purpose: Gets sharing information from the message
+ *
+ * Return: Shared message on success/NULL on failure
+ *
+ * Programmer: James Laird
+ * Tuesday, October 17, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5O_attr_get_share(const void *_mesg, H5O_shared_t *sh /*out*/)
+{
+ const H5A_t *mesg = (const H5A_t *)_mesg;
+ void *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_get_share)
+
+ HDassert(mesg);
+
+ ret_value = H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_attr_get_share() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_attr_set_share
+ *
+ * Purpose: Sets sharing information for the message
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: James Laird
+ * Tuesday, October 10, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_attr_set_share(void *_mesg/*in,out*/, const H5O_shared_t *sh)
+{
+ H5A_t *mesg = (H5A_t *)_mesg;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_set_share)
+
+ HDassert(mesg);
+ HDassert(sh);
+
+ if(NULL == H5O_msg_copy(H5O_SHARED_ID, sh, &(mesg->sh_loc)))
+ ret_value = FAIL;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_attr_set_share() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_attr_is_shared
+ *
+ * Purpose: Determines if this attribute is shared (committed or a SOHM)
+ * or not.
+ *
+ * Return: TRUE if attribute is shared
+ * FALSE if attribute is not shared
+ * Negative on failure
+ *
+ * Programmer: James Laird
+ * Tuesday, October 17, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5O_attr_is_shared(const void *_mesg)
+{
+ const H5A_t *mesg = (const H5A_t *)_mesg;
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_is_shared)
+
+ HDassert(mesg);
+
+ /* Attributes can't currently be committed, but this should let the
+ * library read a "committed attribute" if we ever create one in
+ * the future.
+ */
+ FUNC_LEAVE_NOAPI(H5O_IS_SHARED(mesg->sh_loc.flags))
+} /* end H5O_attr_is_shared */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_attr_pre_copy_file
*
* Purpose: Perform any necessary actions before copying message between
@@ -914,9 +1008,8 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *mesg_type,
/* Compute shared message size for dataspace */
attr_dst->ds_size = H5O_msg_raw_size(file_dst, H5O_SHARED_ID, &sh_mesg);
}
- else {
+ else
attr_dst->ds_size = H5O_msg_raw_size(file_dst, H5O_SDSPACE_ID, attr_src->ds);
- }
HDassert(attr_dst->ds_size > 0);
/* Compute the size of the data */
@@ -1077,93 +1170,62 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_attr_get_share
+ * Function: H5O_attr_get_crt_index
*
- * Purpose: Gets sharing information from the message
+ * Purpose: Get creation index from the message
*
- * Return: Shared message on success/NULL on failure
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: James Laird
- * Tuesday, October 17, 2006
+ * Programmer: Quincey Koziol
+ * Thursday, January 18, 2007
*
*-------------------------------------------------------------------------
*/
-void *
-H5O_attr_get_share(const void *_mesg, H5O_shared_t *sh /*out*/)
+herr_t
+H5O_attr_get_crt_index(const void *_mesg, H5O_crt_idx_t *crt_idx /*out*/)
{
- const H5A_t *mesg = (const H5A_t *)_mesg;
- void *ret_value = NULL;
+ const H5A_t *attr = (const H5A_t *)_mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_get_share)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_get_crt_index)
- HDassert(mesg);
+ HDassert(attr);
+ HDassert(crt_idx);
- ret_value = H5O_msg_copy(H5O_SHARED_ID, &(mesg->sh_loc), sh);
+ /* Get the attribute's creation index */
+ *crt_idx = attr->crt_idx;
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_get_share() */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_attr_get_crt_index() */
/*-------------------------------------------------------------------------
- * Function: H5O_attr_set_share
+ * Function: H5O_attr_set_crt_index
*
- * Purpose: Sets sharing information for the message
+ * Purpose: Set creation index from the message
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: James Laird
- * Tuesday, October 10, 2006
+ * Programmer: Quincey Koziol
+ * Thursday, January 18, 2007
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5O_attr_set_share(void *_mesg/*in,out*/, const H5O_shared_t *sh)
+herr_t
+H5O_attr_set_crt_index(void *_mesg, H5O_crt_idx_t crt_idx)
{
- H5A_t *mesg = (H5A_t *)_mesg;
- herr_t ret_value = SUCCEED;
+ H5A_t *attr = (H5A_t *)_mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_set_share)
-
- HDassert(mesg);
- HDassert(sh);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_set_crt_index)
- if(NULL == H5O_msg_copy(H5O_SHARED_ID, sh, &(mesg->sh_loc)))
- ret_value = FAIL;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_attr_set_share() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O_attr_is_shared
- *
- * Purpose: Determines if this attribute is shared (committed or a SOHM)
- * or not.
- *
- * Return: TRUE if attribute is shared
- * FALSE if attribute is not shared
- * Negative on failure
- *
- * Programmer: James Laird
- * Tuesday, October 17, 2006
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5O_attr_is_shared(const void *_mesg)
-{
- const H5A_t *mesg = (const H5A_t *)_mesg;
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_is_shared)
+ HDassert(attr);
- HDassert(mesg);
+ /* Set the creation index */
+ attr->crt_idx = crt_idx;
- /* Attributes can't currently be committed, but this should let the
- * library read a "committed attribute" if we ever create one in
- * the future.
- */
- FUNC_LEAVE_NOAPI(H5O_IS_SHARED(mesg->sh_loc.flags))
-} /* end H5O_attr_is_shared */
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_attr_set_crt_index() */
/*--------------------------------------------------------------------------
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 6cc3c02..defc7ba 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -311,6 +311,16 @@ HDfprintf(stderr, "%s: converting attributes to dense storage\n", FUNC);
/* Increment attribute count */
oh->nattrs++;
+ /* Check if the object is tracking creation order on attributes */
+ if(oh->flags & H5P_CRT_ORDER_TRACKED) {
+ /* Check for attribute creation order index on the object wrapping around */
+ if(oh->max_attr_crt_idx == H5O_MAX_CRT_ORDER_IDX)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINC, FAIL, "Attribute creation index can't be incremented")
+
+ /* Set the creation order index on the attribute & incr. creation order index */
+ attr->crt_idx = oh->max_attr_crt_idx++;
+ } /* end if */
+
/* Check for storing attribute with dense storage */
if(H5F_addr_defined(oh->attr_fheap_addr)) {
/* Insert attribute into dense storage */
diff --git a/src/H5Obogus.c b/src/H5Obogus.c
index 21a983e..627977e 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -63,6 +63,8 @@ const H5O_msg_class_t H5O_MSG_BOGUS[1] = {{
NULL, /* pre copy native value to file */
NULL, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_bogus_debug /*debug the message */
}};
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 74083e4..dd09c0a 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -142,6 +142,10 @@ H5O_flush_msgs(H5F_t *f, H5O_t *oh)
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
} /* end for */
+ /* Only encode creation index for version 2+ of format */
+ else {
+ UINT16ENCODE(p, curr_msg->crt_idx);
+ } /* end else */
HDassert(p == curr_msg->raw);
#ifndef NDEBUG
@@ -273,6 +277,9 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
oh->version = *p++;
if(H5O_VERSION_2 != oh->version)
HGOTO_ERROR(H5E_OHDR, H5E_VERSION, NULL, "bad object header version number")
+
+ /* Flags */
+ oh->flags = *p++;
} /* end if */
else {
/* Version */
@@ -304,6 +311,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
H5F_DECODE_LENGTH(f, p, oh->nattrs);
H5F_addr_decode(f, &p, &(oh->attr_fheap_addr));
H5F_addr_decode(f, &p, &(oh->name_bt2_addr));
+ UINT16DECODE(p, oh->max_attr_crt_idx);
} /* end if */
else {
/* Reset unused time fields */
@@ -315,6 +323,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
oh->nattrs = 0;
oh->attr_fheap_addr = HADDR_UNDEF;
oh->name_bt2_addr = HADDR_UNDEF;
+ oh->max_attr_crt_idx = 0;
} /* end else */
/* First chunk size */
@@ -361,7 +370,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
if(chunkno == 0) {
/* First chunk's 'image' includes room for the object header prefix */
oh->chunk[0].addr = addr;
- oh->chunk[0].size = chunk_size + H5O_SIZEOF_HDR_OH(oh);
+ oh->chunk[0].size = chunk_size + H5O_SIZEOF_HDR(oh);
} /* end if */
else {
oh->chunk[chunkno].addr = chunk_addr;
@@ -416,6 +425,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
size_t mesg_size; /* Size of message read in */
unsigned id; /* ID (type) of current message */
uint8_t flags; /* Flags for current message */
+ H5O_crt_idx_t crt_idx = 0; /* Creation index for current message */
/* Decode message prefix info */
if(oh->version == H5O_VERSION_1)
@@ -427,6 +437,8 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
flags = *p++;
if(oh->version == H5O_VERSION_1)
p += 3; /*reserved*/
+ else
+ UINT16DECODE(p, crt_idx);
/* Try to detect invalidly formatted object header message that
* extends past end of chunk.
@@ -470,6 +482,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
oh->mesg[mesgno].type = H5O_msg_class_g[id];
oh->mesg[mesgno].dirty = FALSE;
oh->mesg[mesgno].flags = flags;
+ oh->mesg[mesgno].crt_idx = crt_idx;
oh->mesg[mesgno].native = NULL;
oh->mesg[mesgno].raw = (uint8_t *)p; /* Casting away const OK - QAK */
oh->mesg[mesgno].raw_size = mesg_size;
@@ -615,6 +628,9 @@ H5O_assert(oh);
/* Version */
*p++ = oh->version;
+ /* Flags */
+ *p++ = oh->flags;
+
/* Number of messages */
UINT16ENCODE(p, oh->nmesgs);
@@ -633,9 +649,10 @@ H5O_assert(oh);
H5F_ENCODE_LENGTH(f, p, oh->nattrs);
H5F_addr_encode(f, &p, oh->attr_fheap_addr);
H5F_addr_encode(f, &p, oh->name_bt2_addr);
+ UINT16ENCODE(p, oh->max_attr_crt_idx);
/* Chunk size */
- UINT32ENCODE(p, (oh->chunk[0].size - H5O_SIZEOF_HDR_OH(oh)));
+ UINT32ENCODE(p, (oh->chunk[0].size - H5O_SIZEOF_HDR(oh)));
} /* end if */
else {
/* Version */
@@ -651,13 +668,13 @@ H5O_assert(oh);
UINT32ENCODE(p, oh->nlink);
/* First chunk size */
- UINT32ENCODE(p, (oh->chunk[0].size - H5O_SIZEOF_HDR_OH(oh)));
+ UINT32ENCODE(p, (oh->chunk[0].size - H5O_SIZEOF_HDR(oh)));
/* Zero to alignment */
- HDmemset(p, 0, (size_t)(H5O_SIZEOF_HDR_OH(oh) - 12));
- p += (size_t)(H5O_SIZEOF_HDR_OH(oh) - 12);
+ HDmemset(p, 0, (size_t)(H5O_SIZEOF_HDR(oh) - 12));
+ p += (size_t)(H5O_SIZEOF_HDR(oh) - 12);
} /* end else */
- HDassert((size_t)(p - oh->chunk[0].image) == (size_t)(H5O_SIZEOF_HDR_OH(oh) - H5O_SIZEOF_CHKSUM_OH(oh)));
+ HDassert((size_t)(p - oh->chunk[0].image) == (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)));
/* Mark chunk 0 as dirty, since the object header prefix has been updated */
/* (this could be more sophisticated and track whether any prefix fields
@@ -752,27 +769,31 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh)
HDassert(oh->cache_info.is_dirty == FALSE);
/* destroy chunks */
- for(u = 0; u < oh->nchunks; u++) {
- /* Verify that chunk is clean */
- HDassert(oh->chunk[u].dirty == 0);
+ if(oh->chunk) {
+ for(u = 0; u < oh->nchunks; u++) {
+ /* Verify that chunk is clean */
+ HDassert(oh->chunk[u].dirty == 0);
+
+ oh->chunk[u].image = H5FL_BLK_FREE(chunk_image, oh->chunk[u].image);
+ } /* end for */
- oh->chunk[u].image = H5FL_BLK_FREE(chunk_image, oh->chunk[u].image);
- } /* end for */
- if(oh->chunk)
oh->chunk = (H5O_chunk_t *)H5FL_SEQ_FREE(H5O_chunk_t, oh->chunk);
+ } /* end if */
/* destroy messages */
- for(u = 0; u < oh->nmesgs; u++) {
- /* Verify that message is clean */
- HDassert(oh->mesg[u].dirty == 0);
+ if(oh->mesg) {
+ for(u = 0; u < oh->nmesgs; u++) {
+ /* Verify that message is clean */
+ HDassert(oh->mesg[u].dirty == 0);
+
+ H5O_msg_free_mesg(&oh->mesg[u]);
+ } /* end for */
- H5O_msg_free_mesg(&oh->mesg[u]);
- } /* end for */
- if(oh->mesg)
oh->mesg = (H5O_mesg_t *)H5FL_SEQ_FREE(H5O_mesg_t, oh->mesg);
+ } /* end if */
/* destroy object header */
- H5FL_FREE(H5O_t,oh);
+ H5FL_FREE(H5O_t, oh);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_dest() */
diff --git a/src/H5Ocont.c b/src/H5Ocont.c
index e5000bd..8a83f0a 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -64,6 +64,8 @@ const H5O_msg_class_t H5O_MSG_CONT[1] = {{
NULL, /* pre copy native value to file */
NULL, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_cont_debug /*debugging */
}};
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 4e457ac..8c263f5 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -331,12 +331,12 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object header messages")
/* Allocate the destination object header and fill in header fields */
- if(NULL == (oh_dst = H5FL_MALLOC(H5O_t)))
+ if(NULL == (oh_dst = H5FL_CALLOC(H5O_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize header information */
oh_dst->version = oh_src->version;
- oh_dst->nlink = 0;
+ oh_dst->flags = oh_src->flags;
oh_dst->skipped_mesg_size = oh_src->skipped_mesg_size;
oh_dst->sizeof_size = H5F_SIZEOF_SIZE(oloc_dst->file);
oh_dst->sizeof_addr = H5F_SIZEOF_ADDR(oloc_dst->file);
@@ -412,7 +412,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
}
HDassert(copy_type);
- if(copy_type->pre_copy_file ) {
+ if(copy_type->pre_copy_file) {
/*
* Decode the message if necessary. If the message is shared then do
* a shared message, ignoring the message type.
@@ -547,7 +547,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
/* Calculate how big the destination object header will be on disk.
* This isn't necessarily the same size as the original.
*/
- dst_oh_size = H5O_SIZEOF_HDR_OH(oh_dst);
+ dst_oh_size = H5O_SIZEOF_HDR(oh_dst);
/* Add space for messages. */
for(mesgno = 0; mesgno < oh_dst->nmesgs; mesgno++) {
@@ -573,7 +573,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
* treatment. This has to happen after the destination header has been
* allocated.
*/
- HDassert(H5O_SIZEOF_HDR_OH(oh_src) == H5O_SIZEOF_HDR_OH(oh_dst));
+ HDassert(H5O_SIZEOF_HDR(oh_src) == H5O_SIZEOF_HDR(oh_dst));
HDassert(H5O_SIZEOF_MSGHDR_OH(oh_src) == H5O_SIZEOF_MSGHDR_OH(oh_dst));
msghdr_size = H5O_SIZEOF_MSGHDR_OH(oh_src);
@@ -584,8 +584,8 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
* a magic number that isn't.
*/
HDmemcpy(current_pos, oh_src->chunk[0].image,
- (size_t)(H5O_SIZEOF_HDR_OH(oh_dst) - H5O_SIZEOF_CHKSUM_OH(oh_dst)));
- current_pos += H5O_SIZEOF_HDR_OH(oh_dst) - H5O_SIZEOF_CHKSUM_OH(oh_dst);
+ (size_t)(H5O_SIZEOF_HDR(oh_dst) - H5O_SIZEOF_CHKSUM_OH(oh_dst)));
+ current_pos += H5O_SIZEOF_HDR(oh_dst) - H5O_SIZEOF_CHKSUM_OH(oh_dst);
/* Copy each message that wasn't dirtied above */
null_msgs = 0;
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index 6f32d24..7913f20 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -104,7 +104,7 @@ H5O_assert(const H5O_t *oh)
/* Initialize the tracking variables */
hdr_size = 0;
- meta_space = H5O_SIZEOF_HDR_OH(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
+ meta_space = H5O_SIZEOF_HDR(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
mesg_space = 0;
free_space = 0;
num_attrs = 0;
@@ -163,7 +163,7 @@ H5O_assert(const H5O_t *oh)
/* Make certain that the message is completely in a chunk message area */
HDassert(curr_msg->raw_size <= (oh->chunk[curr_msg->chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[curr_msg->chunkno].gap));
if(curr_msg->chunkno == 0)
- HDassert(curr_msg->raw >= oh->chunk[curr_msg->chunkno].image + (H5O_SIZEOF_HDR_OH(oh) - H5O_SIZEOF_CHKSUM_OH(oh)));
+ HDassert(curr_msg->raw >= oh->chunk[curr_msg->chunkno].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)));
else
HDassert(curr_msg->raw >= oh->chunk[curr_msg->chunkno].image + (H5O_SIZEOF_CHKHDR_OH(oh) - H5O_SIZEOF_CHKSUM_OH(oh)));
HDassert(curr_msg->raw + curr_msg->raw_size <= (oh->chunk[curr_msg->chunkno].image + oh->chunk[curr_msg->chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[curr_msg->chunkno].gap));
@@ -273,7 +273,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
oh->version);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Header size (in bytes):",
- (unsigned)H5O_SIZEOF_HDR_OH(oh));
+ (unsigned)H5O_SIZEOF_HDR(oh));
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Number of links:",
oh->nlink);
@@ -343,7 +343,7 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
if(0 == i) {
if(H5F_addr_ne(oh->chunk[i].addr, addr))
HDfprintf(stream, "*** WRONG ADDRESS!\n");
- chunk_size = oh->chunk[i].size - H5O_SIZEOF_HDR_OH(oh);
+ chunk_size = oh->chunk[i].size - H5O_SIZEOF_HDR(oh);
} /* end if */
else
chunk_size = oh->chunk[i].size;
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index dd7a938..b055e4e 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -65,6 +65,8 @@ const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{
H5O_dtype_pre_copy_file, /* pre copy native value to file */
H5O_dtype_copy_file, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_dtype_debug /* debug the message */
}};
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index 7564e7f..14a8c7a 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -58,6 +58,8 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{
NULL, /* pre copy native value to file */
H5O_efl_copy_file, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_efl_debug /*debug the message */
}};
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index ea08489..62b8625 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -71,6 +71,8 @@ const H5O_msg_class_t H5O_MSG_FILL[1] = {{
NULL, /* pre copy native value to file */
NULL, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_fill_debug /*debug the message */
}};
@@ -94,6 +96,8 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
NULL, /* pre copy native value to file */
NULL, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_fill_new_debug /*debug the message */
}};
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c
index d8a75c1..152f5d3 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -62,6 +62,8 @@ const H5O_msg_class_t H5O_MSG_GINFO[1] = {{
NULL, /* pre copy native value to file */
NULL, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_ginfo_debug /*debug the message */
}};
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index e161d3c..daa303d 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -65,6 +65,8 @@ const H5O_msg_class_t H5O_MSG_LAYOUT[1] = {{
NULL, /* pre copy native value to file */
H5O_layout_copy_file, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_layout_debug /*debug the message */
}};
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index d6267b0..2e62ee2 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -70,6 +70,8 @@ const H5O_msg_class_t H5O_MSG_LINFO[1] = {{
NULL, /* pre copy native value to file */
H5O_linfo_copy_file, /* copy native value to file */
H5O_linfo_post_copy_file, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_linfo_debug /*debug the message */
}};
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 5a58db3..1920635 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -74,6 +74,8 @@ const H5O_msg_class_t H5O_MSG_LINK[1] = {{
H5O_link_pre_copy_file, /* pre copy native value to file */
H5O_link_copy_file, /* copy native value to file */
H5O_link_post_copy_file, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_link_debug /*debug the message */
}};
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index 2e01516..628b3e9 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -61,6 +61,13 @@
HDassert(decode_type->decode); \
if(NULL == ((MSG)->native = (decode_type->decode)((F), (DXPL), (MSG)->raw))) \
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message") \
+ \
+ /* Set the message's "creation index", if it has one */ \
+ if((MSG)->type->set_crt_index) { \
+ /* Set the creation index for the message */ \
+ if(((MSG)->type->set_crt_index)((MSG)->native, (MSG)->crt_idx) < 0) \
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, ERR, "unable to set creation index") \
+ } /* end if */ \
} /* end if */
@@ -1367,8 +1374,7 @@ H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
else {
/* If the message is shared, get the real message it points to */
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)))
+ if(NULL == (native_mesg = H5O_shared_read(f, dxpl_id, idx_msg->native, idx_msg->type, NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unable to read shared message")
native_mesg_alloc = TRUE;
} /* end if */
@@ -1835,8 +1841,9 @@ done:
*-------------------------------------------------------------------------
*/
void *
-H5O_msg_copy_file(const H5O_msg_class_t *copy_type, const H5O_msg_class_t *mesg_type, H5F_t *file_src, void *native_src,
- H5F_t *file_dst, hid_t dxpl_id, hbool_t *shared, H5O_copy_t *cpy_info, void *udata)
+H5O_msg_copy_file(const H5O_msg_class_t *copy_type, const H5O_msg_class_t *mesg_type,
+ H5F_t *file_src, void *native_src, H5F_t *file_dst, hid_t dxpl_id,
+ hbool_t *shared, H5O_copy_t *cpy_info, void *udata)
{
void *native_mesg=NULL;
void *shared_mesg=NULL;
@@ -1848,8 +1855,8 @@ H5O_msg_copy_file(const H5O_msg_class_t *copy_type, const H5O_msg_class_t *mesg_
/* check args */
HDassert(copy_type);
- HDassert(mesg_type);
HDassert(copy_type->copy_file);
+ HDassert(mesg_type);
HDassert(file_src);
HDassert(native_src);
HDassert(file_dst);
@@ -1991,6 +1998,13 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *mesg_flags, const H5O_msg_class_t *o
if((ret_value = H5O_alloc(f, dxpl_id, oh, orig_type, size, oh_flags_ptr)) == UFAIL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "unable to allocate space for message")
+ /* Get the message's "creation index", if it has one */
+ if(orig_type->get_crt_index) {
+ /* Retrieve the creation index for the message */
+ if((orig_type->get_crt_index)(orig_mesg, &oh->mesg[ret_value].crt_idx) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, UFAIL, "unable to retrieve creation index")
+ } /* end if */
+
/* Increment any links in message */
if((*new_type)->link && ((*new_type)->link)(f, dxpl_id, (*new_mesg)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, UFAIL, "unable to adjust shared object link count")
@@ -2138,6 +2152,13 @@ H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_mesg_t *mesg, hbool_t adj_link)
HDassert(type->decode);
if(NULL == (mesg->native = (type->decode)(f, dxpl_id, mesg->raw)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode message")
+
+ /* Set the message's "creation index", if it has one */
+ if(mesg->type->set_crt_index) {
+ /* Set the creation index for the message */
+ if((mesg->type->set_crt_index)(mesg->native, mesg->crt_idx) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set creation index")
+ } /* end if */
} /* end if */
/* Check if this message needs to be removed from the SOHM table if
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index ccff078..77d9c87 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -65,6 +65,8 @@ const H5O_msg_class_t H5O_MSG_MTIME[1] = {{
NULL, /* pre copy native value to file */
NULL, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_mtime_debug /*debug the message */
}};
@@ -89,6 +91,8 @@ const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{
NULL, /* pre copy native value to file */
NULL, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_mtime_debug /*debug the message */
}};
diff --git a/src/H5Oname.c b/src/H5Oname.c
index 2314682..002d7e8 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -62,6 +62,8 @@ const H5O_msg_class_t H5O_MSG_NAME[1] = {{
NULL, /* pre copy native value to file */
NULL, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_name_debug /*debug the message */
}};
diff --git a/src/H5Onull.c b/src/H5Onull.c
index e1d1c6f..5399112 100644
--- a/src/H5Onull.c
+++ b/src/H5Onull.c
@@ -31,23 +31,25 @@
/* This message derives from H5O message class */
const H5O_msg_class_t H5O_MSG_NULL[1] = {{
- H5O_NULL_ID, /*message id number */
- "null", /*message name for debugging */
- 0, /*native message size */
- NULL, /*no decode method */
- NULL, /*no encode method */
- NULL, /*no copy method */
- NULL, /*no size method */
- NULL, /*no reset method */
- NULL, /*no free method */
- NULL, /*no file delete method */
- NULL, /*no link method */
- NULL, /*no get share method */
- NULL, /*no set share method */
- NULL, /*no is_shared method */
- NULL, /*no pre copy native value to file */
- NULL, /*no copy native value to file */
- NULL, /*no post copy native value to file */
- NULL /*no debug method */
+ H5O_NULL_ID, /*message id number */
+ "null", /*message name for debugging */
+ 0, /*native message size */
+ NULL, /*no decode method */
+ NULL, /*no encode method */
+ NULL, /*no copy method */
+ NULL, /*no size method */
+ NULL, /*no reset method */
+ NULL, /*no free method */
+ NULL, /*no file delete method */
+ NULL, /*no link method */
+ NULL, /*no get share method */
+ NULL, /*no set share method */
+ NULL, /*no is_shared method */
+ NULL, /*no pre copy native value to file */
+ NULL, /*no copy native value to file */
+ NULL, /*no post copy native value to file */
+ NULL, /*no get creation index */
+ NULL, /*no set creation index */
+ NULL /*no debug method */
}};
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index ddd7799..a66cad4 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -30,6 +30,8 @@
#define H5O_NMESGS 8 /*initial number of messages */
#define H5O_NCHUNKS 2 /*initial number of chunks */
#define H5O_MIN_SIZE 32 /*min obj header data size */
+#define H5O_MSG_TYPES 19 /* # of types of messages */
+#define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */
/* Versions of object header structure */
@@ -55,7 +57,7 @@
*/
#define H5O_ALIGN_OLD(X) (8 * (((X) + 7) / 8))
#define H5O_ALIGN_VERS(V, X) \
- (((V) == H5O_VERSION_1) ? \
+ (((V) == H5O_VERSION_1) ? \
H5O_ALIGN_OLD(X) \
: \
(X) \
@@ -78,100 +80,106 @@
/*
* Size of object header prefix.
*/
-#define H5O_SIZEOF_HDR_VERS(V,SOFS,SOFA) \
- (((V) == H5O_VERSION_1) ? \
- H5O_ALIGN_OLD(1 + /*version number */ \
- 1 + /*reserved */ \
- 2 + /*number of messages */ \
- 4 + /*reference count */ \
- 4) /*chunk data size */ \
+#define H5O_SIZEOF_HDR(O) \
+ (((O)->version == H5O_VERSION_1) \
+ ? \
+ H5O_ALIGN_OLD(1 + /*version number */ \
+ 1 + /*reserved */ \
+ 2 + /*number of messages */ \
+ 4 + /*reference count */ \
+ 4) /*chunk data size */ \
: \
- (H5O_SIZEOF_MAGIC + /*magic number */ \
- 1 + /*version number */ \
- 2 + /*number of messages */ \
- 4 + /*reference count */ \
- 4 + /*access time */ \
- 4 + /*modification time */ \
- 4 + /*change time */ \
- 4 + /*birth time */ \
- 2 + /*max compact attributes */ \
- 2 + /*min dense attributes */ \
- (SOFS) + /*# of attributes */ \
- (SOFA) + /*addr of attribute heap */ \
- (SOFA) + /*addr of attribute name index */ \
- 4 + /*chunk data size */ \
- H5O_SIZEOF_CHKSUM) /*checksum size */ \
+ (H5O_SIZEOF_MAGIC + /*magic number */ \
+ 1 + /*version number */ \
+ 1 + /*flags */ \
+ 2 + /*number of messages */ \
+ 4 + /*reference count */ \
+ 4 + /*access time */ \
+ 4 + /*modification time */ \
+ 4 + /*change time */ \
+ 4 + /*birth time */ \
+ 2 + /*max compact attributes */ \
+ 2 + /*min dense attributes */ \
+ (O)->sizeof_size + /*# of attributes */ \
+ (O)->sizeof_addr + /*addr of attribute heap */ \
+ (O)->sizeof_addr + /*addr of attribute name index */ \
+ 2 + /*max attr. creation index */ \
+ 4 + /*chunk data size */ \
+ H5O_SIZEOF_CHKSUM) /*checksum size */ \
)
-#define H5O_SIZEOF_HDR_OH(O) \
- H5O_SIZEOF_HDR_VERS((O)->version, (O)->sizeof_size, (O)->sizeof_addr)
-#define H5O_SIZEOF_HDR_F(F) \
- H5O_SIZEOF_HDR_VERS(H5F_USE_LATEST_FORMAT(F) ? H5O_VERSION_LATEST : H5O_VERSION_1, H5F_SIZEOF_SIZE(F), H5F_SIZEOF_ADDR(F))
/*
* Size of object header message prefix
*/
#define H5O_SIZEOF_MSGHDR_VERS(V) \
- (((V) == H5O_VERSION_1) ? \
- H5O_ALIGN_OLD(2 + /*message type */ \
- 2 + /*sizeof message data */ \
- 1 + /*flags */ \
- 3) /*reserved */ \
+ (((V) == H5O_VERSION_1) \
+ ? \
+ H5O_ALIGN_OLD(2 + /*message type */ \
+ 2 + /*sizeof message data */ \
+ 1 + /*flags */ \
+ 3) /*reserved */ \
: \
- (1 + /*message type */ \
- 2 + /*sizeof message data */ \
- 1) /*flags */ \
+ (1 + /*message type */ \
+ 2 + /*sizeof message data */ \
+ 1 + /*flags */ \
+ 2) /*creation index */ \
)
#define H5O_SIZEOF_MSGHDR_OH(O) \
- H5O_SIZEOF_MSGHDR_VERS((O)->version)
+ H5O_SIZEOF_MSGHDR_VERS((O)->version)
#define H5O_SIZEOF_MSGHDR_F(F) \
- H5O_SIZEOF_MSGHDR_VERS(H5F_USE_LATEST_FORMAT(F) ? H5O_VERSION_LATEST : H5O_VERSION_1)
+ H5O_SIZEOF_MSGHDR_VERS(H5F_USE_LATEST_FORMAT(F) ? H5O_VERSION_LATEST : H5O_VERSION_1)
/*
* Size of chunk "header" for each chunk
*/
#define H5O_SIZEOF_CHKHDR_VERS(V) \
- (((V) == H5O_VERSION_1) ? \
- 0 + /*no magic # */ \
- 0 /*no checksum */ \
+ (((V) == H5O_VERSION_1) \
+ ? \
+ 0 + /*no magic # */ \
+ 0 /*no checksum */ \
: \
- H5O_SIZEOF_MAGIC + /*magic # */ \
- H5O_SIZEOF_CHKSUM /*checksum */ \
+ H5O_SIZEOF_MAGIC + /*magic # */ \
+ H5O_SIZEOF_CHKSUM /*checksum */ \
)
#define H5O_SIZEOF_CHKHDR_OH(O) \
- H5O_SIZEOF_CHKHDR_VERS((O)->version)
+ H5O_SIZEOF_CHKHDR_VERS((O)->version)
/*
* Size of checksum for each chunk
*/
#define H5O_SIZEOF_CHKSUM_VERS(V) \
- (((V) == H5O_VERSION_1) ? \
- 0 /*no checksum */ \
+ (((V) == H5O_VERSION_1) \
+ ? \
+ 0 /*no checksum */ \
: \
- H5O_SIZEOF_CHKSUM /*checksum */ \
+ H5O_SIZEOF_CHKSUM /*checksum */ \
)
#define H5O_SIZEOF_CHKSUM_OH(O) \
- H5O_SIZEOF_CHKSUM_VERS((O)->version)
+ H5O_SIZEOF_CHKSUM_VERS((O)->version)
+/* The "message class" type */
struct H5O_msg_class_t {
- unsigned id; /*message type ID on disk */
- const char *name; /*for debugging */
- size_t native_size; /*size of native message */
+ unsigned id; /*message type ID on disk */
+ const char *name; /*for debugging */
+ size_t native_size; /*size of native message */
void *(*decode)(H5F_t*, hid_t, const uint8_t*);
herr_t (*encode)(H5F_t*, uint8_t*, const void*);
- void *(*copy)(const void *, void *); /*copy native value */
+ void *(*copy)(const void *, void *); /*copy native value */
size_t (*raw_size)(const H5F_t*, const void*);/*sizeof encoded message */
- herr_t (*reset)(void *); /*free nested data structs */
- herr_t (*free)(void *); /*free main data struct */
+ herr_t (*reset)(void *); /*free nested data structs */
+ herr_t (*free)(void *); /*free main data struct */
herr_t (*del)(H5F_t *, hid_t, const void *, hbool_t); /* Delete space in file referenced by this message */
herr_t (*link)(H5F_t *, hid_t, const void *); /* Increment any links in file reference by this message */
void *(*get_share)(const void*, struct H5O_shared_t*); /* Get shared information */
herr_t (*set_share)(void*, const struct H5O_shared_t*); /* Set shared information */
- htri_t (*can_share)(const void*); /* Is message allowed to be shared? */
- htri_t (*is_shared)(const void*); /* Is message shared? */
+ htri_t (*can_share)(const void *); /* Is message allowed to be shared? */
+ htri_t (*is_shared)(const void *); /* Is message shared? */
herr_t (*pre_copy_file)(H5F_t *, const H5O_msg_class_t *, const void *, hbool_t *, const H5O_copy_t *, void *); /*"pre copy" action when copying native value to file */
void *(*copy_file)(H5F_t *, const H5O_msg_class_t *, void *, H5F_t *, hid_t, H5O_copy_t *, void *); /*copy native value to file */
herr_t (*post_copy_file)(const H5O_loc_t *, const void *, H5O_loc_t *, void *, hid_t, H5O_copy_t *); /*"post copy" action when copying native value to file */
+ herr_t (*get_crt_index)(const void *, H5O_crt_idx_t *); /* Get message's creation index */
+ herr_t (*set_crt_index)(void *, H5O_crt_idx_t); /* Set message's creation index */
herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int);
};
@@ -179,6 +187,7 @@ typedef struct H5O_mesg_t {
const H5O_msg_class_t *type; /*type of message */
hbool_t dirty; /*raw out of date wrt native */
uint8_t flags; /*message flags */
+ H5O_crt_idx_t crt_idx; /*message creation index */
unsigned chunkno; /*chunk number for this mesg */
void *native; /*native format message */
uint8_t *raw; /*ptr to raw data */
@@ -204,6 +213,7 @@ struct H5O_t {
/* Object information (stored) */
unsigned version; /*version number */
unsigned nlink; /*link count */
+ unsigned flags; /*flags */
/* Time information (stored, for versions > 1) */
time_t atime; /*access time */
@@ -217,8 +227,9 @@ struct H5O_t {
hsize_t nattrs; /* Number of attributes in the group */
haddr_t attr_fheap_addr; /* Address of fractal heap for storing "dense" attributes */
haddr_t name_bt2_addr; /* Address of v2 B-tree for indexing names of attributes */
+ H5O_crt_idx_t max_attr_crt_idx; /* Maximum attribute creation index used */
- /* Message management (stored, in chunks) */
+ /* Message management (stored, encoded in chunks) */
size_t nmesgs; /*number of messages */
size_t alloc_nmesgs; /*number of message slots */
H5O_mesg_t *mesg; /*array of messages */
@@ -272,7 +283,7 @@ typedef union {
H5_DLLVAR const H5AC_class_t H5AC_OHDR[1];
/* Header message ID to class mapping */
-H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[19];
+H5_DLLVAR const H5O_msg_class_t *const H5O_msg_class_g[H5O_MSG_TYPES];
/* Header object ID to class mapping */
H5_DLLVAR const H5O_obj_class_t *const H5O_obj_class_g[3];
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 7ec6e9f..194b8b6 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -63,6 +63,8 @@ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{
H5O_pline_pre_copy_file, /* pre copy native value to file */
NULL, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_pline_debug /* debug the message */
}};
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index e1a08ce..1076441 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -45,13 +45,20 @@
typedef struct H5O_msg_class_t H5O_msg_class_t;
typedef struct H5O_t H5O_t;
-/* 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 seven bytes long
- * but are stored in 8-byte fields in memory.
+/* Values used to create the shared message & attribute heaps */
+/* (Note that these parameters have been tuned so that the resulting heap ID
+ * is exactly 8 bytes. This is an efficient size as it can be stored
+ * directly in an 8 byte integer in memory, think carefully before changing it.
+ * -QAK)
*/
-#define H5SM_FHEAP_ID_LEN 8
-typedef uint64_t H5SM_fheap_id_t;
-
+#define H5O_FHEAP_MAN_WIDTH 4
+#define H5O_FHEAP_MAN_START_BLOCK_SIZE 1024
+#define H5O_FHEAP_MAN_MAX_DIRECT_SIZE (64 * 1024)
+#define H5O_FHEAP_MAN_MAX_INDEX 40
+#define H5O_FHEAP_MAN_START_ROOT_ROWS 1
+#define H5O_FHEAP_CHECKSUM_DBLOCKS TRUE
+#define H5O_FHEAP_MAX_MAN_SIZE (4 * 1024)
+#define H5O_FHEAP_ID_LEN 8
/* Object header macros */
#define H5O_MESG_MAX_SIZE 65536 /*max obj header message size */
@@ -77,6 +84,12 @@ typedef uint64_t H5SM_fheap_id_t;
/* ========= Object Copy properties ============ */
#define H5O_CPY_OPTION_NAME "copy object" /* Copy options */
+/* Typedef for creation indexes */
+typedef uint32_t H5O_crt_idx_t;
+
+/* Fractal heap ID type for shared message & attribute heap IDs. */
+typedef uint64_t H5O_fheap_id_t;
+
/* The object location information for an object */
typedef struct H5O_loc_t {
H5F_t *file; /* File that object header is located within */
@@ -143,7 +156,7 @@ typedef struct H5O_shared_t {
unsigned flags; /* flags describing how message is shared */
union {
H5O_loc_t oloc; /* object location info */
- H5SM_fheap_id_t heap_id; /* ID within the SOHM heap */
+ H5O_fheap_id_t heap_id; /* ID within the SOHM heap */
} u;
} H5O_shared_t;
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index d90ee3f..89bfdda 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -59,6 +59,8 @@ const H5O_msg_class_t H5O_MSG_SDSPACE[1] = {{
H5O_sdspace_pre_copy_file, /* pre copy native value to file */
NULL, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_sdspace_debug /* debug the message */
}};
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index ab341d6..c06871e 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -72,6 +72,8 @@ const H5O_msg_class_t H5O_MSG_SHARED[1] = {{
H5O_shared_pre_copy_file, /* pre copy native value to file */
H5O_shared_copy_file, /* copy native value to file */
NULL, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_shared_debug /*debug method */
}};
@@ -83,7 +85,7 @@ const H5O_msg_class_t H5O_MSG_SHARED[1] = {{
/* Newest version, which recognizes messages that are stored in the heap */
#define H5O_SHARED_VERSION_3 3
-#define H5O_SHARED_VERSION H5O_SHARED_VERSION_3
+#define H5O_SHARED_VERSION_LATEST H5O_SHARED_VERSION_3
/* Size of stack buffer for serialized messages */
#define H5O_MESG_BUF_SIZE 128
@@ -288,20 +290,19 @@ H5O_shared_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *buf)
HDassert(buf);
/* Decode */
- if(NULL == (mesg = H5MM_calloc (sizeof(H5O_shared_t))))
+ if(NULL == (mesg = H5MM_calloc(sizeof(H5O_shared_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Version */
version = *buf++;
- if(version < H5O_SHARED_VERSION_1 || version > H5O_SHARED_VERSION)
+ if(version < H5O_SHARED_VERSION_1 || version > H5O_SHARED_VERSION_LATEST)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for shared object message")
/* Get the shared information flags
* Flags are unused before version 3.
*/
- if(version >= H5O_SHARED_VERSION_2) {
+ if(version >= H5O_SHARED_VERSION_2)
mesg->flags = *buf++;
- }
else {
mesg->flags = H5O_COMMITTED_FLAG;
buf++;
@@ -312,9 +313,8 @@ H5O_shared_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *buf)
buf += 6;
/* Body */
- if(version == H5O_SHARED_VERSION_1) {
+ if(version == H5O_SHARED_VERSION_1)
H5G_obj_ent_decode(f, &buf, &(mesg->u.oloc));
- }
else if (version >= H5O_SHARED_VERSION_2) {
/* If this message is in the heap, copy a heap ID.
* Otherwise, it is a named datatype, so copy an H5O_loc_t.
@@ -382,9 +382,8 @@ H5O_shared_encode(H5F_t *f, uint8_t *buf/*out*/, const void *_mesg)
/* If this message is shared in the heap, we need to use version 3 of the
* encoding and encode the SHARED_IN_HEAP flag.
*/
- if(mesg->flags & H5O_SHARED_IN_HEAP_FLAG || H5F_USE_LATEST_FORMAT(f)) {
- version = H5O_SHARED_VERSION;
- }
+ if(mesg->flags & H5O_SHARED_IN_HEAP_FLAG || H5F_USE_LATEST_FORMAT(f))
+ version = H5O_SHARED_VERSION_LATEST;
else {
HDassert(mesg->flags & H5O_COMMITTED_FLAG);
version = H5O_SHARED_VERSION_2; /* version 1 is no longer used */
@@ -396,12 +395,10 @@ H5O_shared_encode(H5F_t *f, uint8_t *buf/*out*/, const void *_mesg)
/* Encode either the heap ID of the message or the address of the
* object header that holds it.
*/
- if(mesg->flags & H5O_SHARED_IN_HEAP_FLAG) {
+ if(mesg->flags & H5O_SHARED_IN_HEAP_FLAG)
HDmemcpy(buf, &(mesg->u.heap_id), sizeof(mesg->u.heap_id));
- }
- else {
+ else
H5F_addr_encode(f, &buf, mesg->u.oloc.addr);
- }
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_shared_encode() */
@@ -480,15 +477,15 @@ H5O_shared_size(const H5F_t *f, const void *_mesg)
if(shared->flags & H5O_COMMITTED_FLAG)
{
ret_value = 1 + /*version */
- 1 + /*the flags field */
- H5F_SIZEOF_ADDR(f); /*sharing by another obj hdr */
+ 1 + /*the flags field */
+ H5F_SIZEOF_ADDR(f); /*sharing by another obj hdr */
}
else
{
HDassert(shared->flags & H5O_SHARED_IN_HEAP_FLAG);
ret_value = 1 + /*version */
- 1 + /*the flags field */
- H5SM_FHEAP_ID_LEN; /* Shared in the heap */
+ 1 + /*the flags field */
+ H5O_FHEAP_ID_LEN; /* Shared in the heap */
}
FUNC_LEAVE_NOAPI(ret_value);
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index 5865dca..850abab 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -70,6 +70,8 @@ const H5O_msg_class_t H5O_MSG_STAB[1] = {{
NULL, /* pre copy native value to file */
H5O_stab_copy_file, /* copy native value to file */
H5O_stab_post_copy_file, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
H5O_stab_debug /*debug the message */
}};
diff --git a/src/H5SM.c b/src/H5SM.c
index f37b913..11a0305 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -34,19 +34,6 @@
/****************/
/* Local Macros */
/****************/
-/* Values used to create the SOHM heaps */
-/* (Note that these parameters have been tuned so that the resulting heap ID
- * is exactly 8 bytes. This is an efficient size and is also the same as
- * the size of the attribute heap IDs, think carefully before changing it.
- * -QAK)
- */
-#define H5SM_FHEAP_MAN_WIDTH 4
-#define H5SM_FHEAP_MAN_START_BLOCK_SIZE 1024
-#define H5SM_FHEAP_MAN_MAX_DIRECT_SIZE (64 * 1024)
-#define H5SM_FHEAP_MAN_MAX_INDEX 40
-#define H5SM_FHEAP_MAN_START_ROOT_ROWS 1
-#define H5SM_FHEAP_CHECKSUM_DBLOCKS TRUE
-#define H5SM_FHEAP_MAX_MAN_SIZE (4 * 1024)
/******************/
@@ -430,9 +417,6 @@ H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
haddr_t tree_addr=HADDR_UNDEF; /* Address of SOHM B-tree */
H5HF_create_t fheap_cparam; /* Fractal heap creation parameters */
H5HF_t *fheap = NULL;
-#ifndef NDEBUG
- size_t fheap_id_len; /* Size of a fractal heap ID */
-#endif /* NDEBUG */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5SM_create_index, FAIL)
@@ -465,14 +449,14 @@ 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 */
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;
- fheap_cparam.managed.max_direct_size = H5SM_FHEAP_MAN_MAX_DIRECT_SIZE;
- fheap_cparam.managed.max_index = H5SM_FHEAP_MAN_MAX_INDEX;
- fheap_cparam.managed.start_root_rows = H5SM_FHEAP_MAN_START_ROOT_ROWS;
- fheap_cparam.checksum_dblocks = H5SM_FHEAP_CHECKSUM_DBLOCKS;
+ fheap_cparam.managed.width = H5O_FHEAP_MAN_WIDTH;
+ fheap_cparam.managed.start_block_size = H5O_FHEAP_MAN_START_BLOCK_SIZE;
+ fheap_cparam.managed.max_direct_size = H5O_FHEAP_MAN_MAX_DIRECT_SIZE;
+ fheap_cparam.managed.max_index = H5O_FHEAP_MAN_MAX_INDEX;
+ fheap_cparam.managed.start_root_rows = H5O_FHEAP_MAN_START_ROOT_ROWS;
+ fheap_cparam.checksum_dblocks = H5O_FHEAP_CHECKSUM_DBLOCKS;
fheap_cparam.id_len = 0;
- fheap_cparam.max_man_size = H5SM_FHEAP_MAX_MAN_SIZE;
+ fheap_cparam.max_man_size = H5O_FHEAP_MAX_MAN_SIZE;
if(NULL == (fheap = H5HF_create(f, dxpl_id, &fheap_cparam)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to create fractal heap")
@@ -480,11 +464,14 @@ H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address")
#ifndef NDEBUG
+{
+ size_t fheap_id_len; /* Size of a fractal heap ID */
+
/* Sanity check ID length */
if(H5HF_get_id_len(fheap, &fheap_id_len) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length")
- HDassert(fheap_id_len == H5SM_FHEAP_ID_LEN);
- HDassert(sizeof(H5SM_fheap_id_t) == H5SM_FHEAP_ID_LEN);
+ HDassert(fheap_id_len == H5O_FHEAP_ID_LEN);
+}
#endif /* NDEBUG */
done:
@@ -1493,17 +1480,16 @@ H5SM_message_decode(const H5F_t UNUSED *f, const uint8_t *raw, void *_nrecord)
*-------------------------------------------------------------------------
*/
herr_t
-H5SM_reconstitute(H5O_shared_t *sh_mesg, const uint8_t *heap_id)
+H5SM_reconstitute(H5O_shared_t *sh_mesg, H5O_fheap_id_t heap_id)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_reconstitute)
/* Sanity check args */
HDassert(sh_mesg);
- HDassert(heap_id);
/* Set flag for shared message */
sh_mesg->flags = H5O_SHARED_IN_HEAP_FLAG;
- HDmemcpy(&sh_mesg->u.heap_id, heap_id, sizeof(sh_mesg->u.heap_id));
+ sh_mesg->u.heap_id = heap_id;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5SM_reconstitute() */
diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c
index b59304f..8e7b762 100755
--- a/src/H5SMbtree2.c
+++ b/src/H5SMbtree2.c
@@ -36,10 +36,10 @@
/******************/
/* Udata struct for call to H5SM_btree_compare_cb */
-typedef struct H5SM_compare_udata {
+typedef struct H5SM_compare_udata_t {
H5SM_mesg_key_t *key; /* Key; compare this against record in heap */
herr_t ret; /* Return value; set this to result of memcmp */
-} H5SM_compare_udata;
+} H5SM_compare_udata_t;
/********************/
/* Local Prototypes */
@@ -91,7 +91,7 @@ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */
static herr_t
H5SM_btree_compare_cb(const void *obj, size_t obj_len, void *_udata)
{
- H5SM_compare_udata *udata = (H5SM_compare_udata *)_udata;
+ H5SM_compare_udata_t *udata = (H5SM_compare_udata_t *)_udata;
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_btree_compare_cb)
@@ -108,7 +108,8 @@ H5SM_btree_compare_cb(const void *obj, size_t obj_len, void *_udata)
}
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5SM_btree_compare_cb() */
+
/*-------------------------------------------------------------------------
* Function: H5SM_message_compare
@@ -134,7 +135,7 @@ H5SM_message_compare(const void *rec1, const void *rec2)
int64_t hash_diff; /* Has to be able to hold two 32-bit values */
herr_t ret_value = 0;
- FUNC_ENTER_NOAPI_NOINIT(H5SM_message_compare)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_message_compare)
/* JAMES: might be able to spare a sentinel byte instead of worrying about
* refcounts. Here, we need to find a deleted message in a B-tree to
@@ -146,7 +147,7 @@ H5SM_message_compare(const void *rec1, const void *rec2)
hash_diff -= mesg->hash;
/* If the hash values match, make sure the messages are really the same */
- if(0 == hash_diff) {
+ if(0 == hash_diff) {
/* Compare either the heap_ids directly (if the key has one)
* or the encoded buffers
*/
@@ -154,13 +155,13 @@ H5SM_message_compare(const void *rec1, const void *rec2)
{
HDassert(key->encoding == NULL);
ret_value = (herr_t) (key->message.fheap_id - mesg->fheap_id);
- }
+ } /* end if */
else
{
/* Hash values match, but we don't have a heap ID for the key.
* Compare the encoded message with the one in the heap.
*/
- H5SM_compare_udata udata;
+ H5SM_compare_udata_t udata;
herr_t ret;
/* Casting away const OK. -JML */
@@ -171,8 +172,8 @@ H5SM_message_compare(const void *rec1, const void *rec2)
HDassert(ret >= 0);
ret_value = udata.ret;
- }
- }
+ } /* end else */
+ } /* end if */
else {
/* Compress 64-bit hash_diff to fit in an herr_t */
if(hash_diff > 0)
@@ -203,7 +204,7 @@ H5SM_message_compare(const void *rec1, const void *rec2)
static herr_t
H5SM_btree_store(void *native, const void *udata)
{
- H5SM_mesg_key_t *key = (H5SM_mesg_key_t *)udata;
+ const H5SM_mesg_key_t *key = (const H5SM_mesg_key_t *)udata;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_btree_store)
@@ -263,7 +264,7 @@ H5SM_btree_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_btree_debug)
- HDfprintf(stream, "%*s%-*s {%a, %lo, %Hu}\n", indent, "", fwidth, "Record:",
+ HDfprintf(stream, "%*s%-*s {%a, %lo, %Hx}\n", indent, "", fwidth, "Record:",
sohm->fheap_id, sohm->hash, sohm->ref_count);
FUNC_LEAVE_NOAPI(SUCCEED)
@@ -302,10 +303,10 @@ H5SM_incr_ref(void *record, void *op_data, hbool_t *changed)
*changed = TRUE;
if(op_data)
- *(H5SM_fheap_id_t *)op_data = message->fheap_id;
+ *(H5O_fheap_id_t *)op_data = message->fheap_id;
FUNC_LEAVE_NOAPI(SUCCEED)
-}
+} /* end H5SM_incr_ref() */
/*-------------------------------------------------------------------------
@@ -345,7 +346,7 @@ H5SM_decr_ref(void *record, void *op_data, hbool_t *changed)
*(H5SM_sohm_t *)op_data = *message;
FUNC_LEAVE_NOAPI(SUCCEED)
-}
+} /* end H5SM_decr_ref() */
/*-------------------------------------------------------------------------
diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h
index d17f6c5..1010b16 100755
--- a/src/H5SMpkg.h
+++ b/src/H5SMpkg.h
@@ -39,7 +39,7 @@
#define H5SM_SOHM_ENTRY_SIZE(f) (4 /* Hash value */ \
+ 4 /* reference count*/ \
- + sizeof(H5SM_fheap_id_t)) /* size of heap ID on disk */
+ + sizeof(H5O_fheap_id_t)) /* size of heap ID on disk */
#define H5SM_TABLE_SIZE(f) ( H5SM_TABLE_SIZEOF_MAGIC \
+ H5SM_SIZEOF_CHECKSUM) /* Checksum */
@@ -95,7 +95,7 @@
/* Typedef for a SOHM index node */
typedef struct {
uint32_t hash; /* Hash value for OHM */
- H5SM_fheap_id_t fheap_id; /* ID of the OHM in the fractal heap */
+ H5O_fheap_id_t fheap_id; /* ID of the OHM in the fractal heap */
hsize_t ref_count; /* Number of times this message is used */
} H5SM_sohm_t;
diff --git a/src/H5SMprivate.h b/src/H5SMprivate.h
index 679b59f..fab6097 100755
--- a/src/H5SMprivate.h
+++ b/src/H5SMprivate.h
@@ -41,7 +41,7 @@ H5_DLL herr_t H5SM_get_info(H5F_t *f, unsigned *index_flags, unsigned *minsizes,
H5_DLL htri_t H5SM_type_shared(H5F_t *f, unsigned type_id, hid_t dxpl_id);
H5_DLL herr_t H5SM_get_fheap_addr(H5F_t *f, hid_t dxpl_id, unsigned type_id,
haddr_t *fheap_addr);
-H5_DLL herr_t H5SM_reconstitute(H5O_shared_t *sh_mesg, const uint8_t *heap_id);
+H5_DLL herr_t H5SM_reconstitute(H5O_shared_t *sh_mesg, H5O_fheap_id_t heap_id);
H5_DLL herr_t H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
const H5O_shared_t *sh_mesg, hsize_t *ref_count);