summaryrefslogtreecommitdiffstats
path: root/src/H5O.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-11-28 20:29:28 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-11-28 20:29:28 (GMT)
commit1b03a4cc34faee03625e2d71c5fd4a7e9a4adf07 (patch)
treefdee34d1d50b03fc89f543b47c98c57cc3f07314 /src/H5O.c
parent1687720a5fe51d32e1544371eaa75af162f35a31 (diff)
downloadhdf5-1b03a4cc34faee03625e2d71c5fd4a7e9a4adf07.zip
hdf5-1b03a4cc34faee03625e2d71c5fd4a7e9a4adf07.tar.gz
hdf5-1b03a4cc34faee03625e2d71c5fd4a7e9a4adf07.tar.bz2
[svn-r12992] Description:
Add fields for tracking attributes on objects to object header prefix, when using the latest version of the format. Reduce size used to store type of header message from 2 bytes to 1. (If we have >256 message types, we probably have a different problem... :-) Also, add "birth" time for object (i.e. creation time) [named to align with similar fields in file systems] Correct bug in H5Gget_objinfo() - retrieve the ctime field from object info, instead of the mtime field. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5O.c')
-rw-r--r--src/H5O.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/H5O.c b/src/H5O.c
index c74e34e..afb7121 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -844,12 +844,32 @@ H5O_new(H5F_t *f, hid_t dxpl_id, size_t chunk_size, H5O_loc_t *loc/*out*/,
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);
/* Initialize version-specific fields */
if(oh->version > H5O_VERSION_1) {
- /* Initialize time fields */
- oh->atime = oh->mtime = oh->ctime = H5_now();
+ /* Initialize all time fields with current time */
+ oh->atime = oh->mtime = oh->ctime = oh->btime = H5_now();
+
+ /* Initialize attribute tracking 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 if */
+ else {
+ /* Reset unused time fields */
+ 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) */
@@ -3861,6 +3881,7 @@ H5O_get_info(H5O_loc_t *oloc, H5O_info_t *oinfo, hid_t dxpl_id)
oinfo->atime = oh->atime;
oinfo->mtime = oh->mtime;
oinfo->ctime = oh->ctime;
+ oinfo->btime = oh->btime;
} /* end if */
else {
/* No information for access & modification fields */
@@ -3870,11 +3891,12 @@ H5O_get_info(H5O_loc_t *oloc, H5O_info_t *oinfo, hid_t dxpl_id)
*/
oinfo->atime = 0;
oinfo->mtime = 0;
+ oinfo->btime = 0;
/* Might be information for modification time */
- if(NULL == H5O_read_real(oloc->file, oh, H5O_MTIME_ID, 0, &oinfo->mtime, dxpl_id)) {
+ if(NULL == H5O_read_real(oloc->file, oh, H5O_MTIME_ID, 0, &oinfo->ctime, dxpl_id)) {
H5E_clear_stack(NULL);
- if(NULL == H5O_read_real(oloc->file, oh, H5O_MTIME_NEW_ID, 0, &oinfo->mtime, dxpl_id)) {
+ if(NULL == H5O_read_real(oloc->file, oh, H5O_MTIME_NEW_ID, 0, &oinfo->ctime, dxpl_id)) {
H5E_clear_stack(NULL);
oinfo->ctime = 0;
} /* end if */
@@ -3920,6 +3942,11 @@ H5O_get_info(H5O_loc_t *oloc, H5O_info_t *oinfo, hid_t dxpl_id)
if(curr_msg->flags & H5O_FLAG_SHARED) \
oinfo->hdr.msg_shared |= type_flag;
} /* end for */
+#ifdef LATER
+/* XXX: Uncomment this when attributes are tracked by the object header */
+ if(oh->version > H5O_VERSION_1)
+ HDassert(oh->nattrs == oinfo->num_attrs);
+#endif /* LATER */
/* Iterate over all the chunks, adding any gaps to the free space */
oinfo->hdr.hdr_size = 0;