summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-03-11 01:09:00 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-03-11 01:09:00 (GMT)
commit9129a8452a543482336a85f68ba788691fe50925 (patch)
tree53de6974aecbd5a0a2443d345e8490fa4db5777c
parent051ffe9d61c067549bc1dab94f9de7ea330e64db (diff)
downloadhdf5-9129a8452a543482336a85f68ba788691fe50925.zip
hdf5-9129a8452a543482336a85f68ba788691fe50925.tar.gz
hdf5-9129a8452a543482336a85f68ba788691fe50925.tar.bz2
[svn-r13493] Description:
Eliminate storing default values for "group info" fields. Tested on: FreeBSD/32 6.2 (duty)
-rw-r--r--src/H5Gprivate.h4
-rw-r--r--src/H5Oginfo.c66
-rw-r--r--src/H5Oprivate.h2
-rw-r--r--src/H5Pgcpl.c8
-rw-r--r--test/stab.c8
-rw-r--r--tools/testfiles/h5mkgrp_nested_latest.ls4
-rw-r--r--tools/testfiles/h5mkgrp_nested_mult_latest.ls8
-rw-r--r--tools/testfiles/h5mkgrp_several_latest.ls4
-rw-r--r--tools/testfiles/h5mkgrp_single_latest.ls2
9 files changed, 73 insertions, 33 deletions
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index d6707f7..647f36d 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -82,8 +82,10 @@
/* Defaults for group info values */
#define H5G_CRT_GINFO_LHEAP_SIZE_HINT 0
+#define H5G_CRT_GINFO_STORE_LINK_PHASE_CHANGE FALSE
#define H5G_CRT_GINFO_MAX_COMPACT 8
#define H5G_CRT_GINFO_MIN_DENSE 6
+#define H5G_CRT_GINFO_STORE_EST_ENTRY_INFO FALSE
#define H5G_CRT_GINFO_EST_NUM_ENTRIES 4
#define H5G_CRT_GINFO_EST_NAME_LEN 8
@@ -91,8 +93,10 @@
#define H5G_CRT_GROUP_INFO_NAME "group info"
#define H5G_CRT_GROUP_INFO_SIZE sizeof(H5O_ginfo_t)
#define H5G_CRT_GROUP_INFO_DEF {H5G_CRT_GINFO_LHEAP_SIZE_HINT, \
+ H5G_CRT_GINFO_STORE_LINK_PHASE_CHANGE, \
H5G_CRT_GINFO_MAX_COMPACT, \
H5G_CRT_GINFO_MIN_DENSE, \
+ H5G_CRT_GINFO_STORE_EST_ENTRY_INFO, \
H5G_CRT_GINFO_EST_NUM_ENTRIES, \
H5G_CRT_GINFO_EST_NAME_LEN \
}
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c
index df99882..adeb2d5 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -68,6 +68,11 @@ const H5O_msg_class_t H5O_MSG_GINFO[1] = {{
/* Current version of group info information */
#define H5O_GINFO_VERSION 0
+/* Flags for group info flag encoding */
+#define H5O_GINFO_STORE_PHASE_CHANGE 0x01
+#define H5O_GINFO_STORE_EST_ENTRY_INFO 0x02
+#define H5O_GINFO_ALL_FLAGS (H5O_GINFO_STORE_PHASE_CHANGE | H5O_GINFO_STORE_EST_ENTRY_INFO)
+
/* Declare a free list to manage the H5O_ginfo_t struct */
H5FL_DEFINE_STATIC(H5O_ginfo_t);
@@ -111,14 +116,30 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_fla
/* Get the flags for the group */
flags = *p++;
+ if(flags & ~H5O_GINFO_ALL_FLAGS)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message")
+ ginfo->store_link_phase_change = (flags & H5O_GINFO_STORE_PHASE_CHANGE) ? TRUE : FALSE;
+ ginfo->store_est_entry_info = (flags & H5O_GINFO_STORE_EST_ENTRY_INFO) ? TRUE : FALSE;
/* Get the max. # of links to store compactly & the min. # of links to store densely */
- UINT16DECODE(p, ginfo->max_compact)
- UINT16DECODE(p, ginfo->min_dense)
+ if(ginfo->store_link_phase_change) {
+ UINT16DECODE(p, ginfo->max_compact)
+ UINT16DECODE(p, ginfo->min_dense)
+ } /* end if */
+ else {
+ ginfo->max_compact = H5G_CRT_GINFO_MAX_COMPACT;
+ ginfo->min_dense = H5G_CRT_GINFO_MIN_DENSE;
+ } /* end else */
/* Get the estimated # of entries & name lengths */
- UINT16DECODE(p, ginfo->est_num_entries)
- UINT16DECODE(p, ginfo->est_name_len)
+ if(ginfo->store_est_entry_info) {
+ UINT16DECODE(p, ginfo->est_num_entries)
+ UINT16DECODE(p, ginfo->est_name_len)
+ } /* end if */
+ else {
+ ginfo->est_num_entries = H5G_CRT_GINFO_EST_NUM_ENTRIES;
+ ginfo->est_name_len = H5G_CRT_GINFO_EST_NAME_LEN;
+ } /* end if */
/* Set return value */
ret_value = ginfo;
@@ -149,7 +170,7 @@ static herr_t
H5O_ginfo_encode(H5F_t UNUSED *f, hbool_t UNUSED disable_shared, uint8_t *p, const void *_mesg)
{
const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *) _mesg;
- unsigned char flags = 0; /* Flags for encoding group info */
+ unsigned char flags; /* Flags for encoding group info */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_ginfo_encode)
@@ -161,15 +182,21 @@ H5O_ginfo_encode(H5F_t UNUSED *f, hbool_t UNUSED disable_shared, uint8_t *p, con
*p++ = H5O_GINFO_VERSION;
/* The flags for the group info */
+ flags = ginfo->store_link_phase_change ? H5O_GINFO_STORE_PHASE_CHANGE : 0;
+ flags |= ginfo->store_est_entry_info ? H5O_GINFO_STORE_EST_ENTRY_INFO : 0;
*p++ = flags;
/* Store the max. # of links to store compactly & the min. # of links to store densely */
- UINT16ENCODE(p, ginfo->max_compact)
- UINT16ENCODE(p, ginfo->min_dense)
+ if(ginfo->store_link_phase_change) {
+ UINT16ENCODE(p, ginfo->max_compact)
+ UINT16ENCODE(p, ginfo->min_dense)
+ } /* end if */
/* Estimated # of entries & name lengths */
- UINT16ENCODE(p, ginfo->est_num_entries)
- UINT16ENCODE(p, ginfo->est_name_len)
+ if(ginfo->store_est_entry_info) {
+ UINT16ENCODE(p, ginfo->est_num_entries)
+ UINT16ENCODE(p, ginfo->est_name_len)
+ } /* end if */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_ginfo_encode() */
@@ -231,13 +258,12 @@ done:
* koziol@ncsa.uiuc.edu
* Aug 30 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static size_t
-H5O_ginfo_size(const H5F_t UNUSED *f, hbool_t UNUSED disable_shared, const void UNUSED *_mesg)
+H5O_ginfo_size(const H5F_t UNUSED *f, hbool_t UNUSED disable_shared, const void *_mesg)
{
+ const H5O_ginfo_t *ginfo = (const H5O_ginfo_t *)_mesg;
size_t ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_ginfo_size)
@@ -245,10 +271,14 @@ H5O_ginfo_size(const H5F_t UNUSED *f, hbool_t UNUSED disable_shared, const void
/* Set return value */
ret_value = 1 + /* Version */
1 + /* Flags */
- 2 + /* "Max compact" links */
- 2 + /* "Min dense" links */
- 2 + /* Estimated # of entries in group */
- 2; /* Estimated length of name of entry in group */
+ (ginfo->store_link_phase_change ? (
+ 2 + /* "Max compact" links */
+ 2 /* "Min dense" links */
+ ) : 0) + /* "Min dense" links */
+ (ginfo->store_est_entry_info ? (
+ 2 + /* Estimated # of entries in group */
+ 2 /* Estimated length of name of entry in group */
+ ) : 0);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_ginfo_size() */
@@ -264,8 +294,6 @@ H5O_ginfo_size(const H5F_t UNUSED *f, hbool_t UNUSED disable_shared, const void
* Programmer: Quincey Koziol
* Tuesday, August 30, 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -292,8 +320,6 @@ H5O_ginfo_free(void *mesg)
* koziol@ncsa.uiuc.edu
* Aug 30 2005
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 132dbe7..b829145 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -324,10 +324,12 @@ typedef struct H5O_ginfo_t {
/* "New" format group info (stored) */
/* (storage management info) */
+ hbool_t store_link_phase_change;/* Whether to store the link phase change values */
uint16_t max_compact; /* Maximum # of compact links */
uint16_t min_dense; /* Minimum # of "dense" links */
/* (initial object header size info) */
+ hbool_t store_est_entry_info; /* Whether to store the est. entry values */
uint16_t est_num_entries; /* Estimated # of entries in group */
uint16_t est_name_len; /* Estimated length of entry name */
} H5O_ginfo_t;
diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c
index b1ed560..a4aff51 100644
--- a/src/H5Pgcpl.c
+++ b/src/H5Pgcpl.c
@@ -253,6 +253,10 @@ H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dens
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
/* Update fields */
+ if(max_compact != H5G_CRT_GINFO_MAX_COMPACT || min_dense != H5G_CRT_GINFO_MIN_DENSE)
+ ginfo.store_link_phase_change = TRUE;
+ else
+ ginfo.store_link_phase_change = FALSE;
ginfo.max_compact = max_compact;
ginfo.min_dense = min_dense;
@@ -353,6 +357,10 @@ H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
/* Update fields */
+ if(est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES || est_name_len != H5G_CRT_GINFO_EST_NAME_LEN)
+ ginfo.store_est_entry_info = TRUE;
+ else
+ ginfo.store_est_entry_info = FALSE;
ginfo.est_num_entries = est_num_entries;
ginfo.est_name_len = est_name_len;
diff --git a/test/stab.c b/test/stab.c
index b8044ae..8ec79eb 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -427,9 +427,9 @@ lifecycle(hid_t fapl)
/* Check that the object header is only one chunk and the space has been allocated correctly */
if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR
#ifdef H5_HAVE_LARGE_HSIZET
- if(obj_stat.ohdr.size != 187) TEST_ERROR
+ if(obj_stat.ohdr.size != 183) TEST_ERROR
#else /* H5_HAVE_LARGE_HSIZET */
- if(obj_stat.ohdr.size != 167) TEST_ERROR
+ if(obj_stat.ohdr.size != 163) TEST_ERROR
#endif /* H5_HAVE_LARGE_HSIZET */
if(obj_stat.ohdr.free != 0) TEST_ERROR
if(obj_stat.ohdr.nmesgs != 6) TEST_ERROR
@@ -453,9 +453,9 @@ lifecycle(hid_t fapl)
/* Check that the object header is still one chunk and the space has been allocated correctly */
if(H5Gget_objinfo(gid, ".", FALSE, &obj_stat) < 0) TEST_ERROR
#ifdef H5_HAVE_LARGE_HSIZET
- if(obj_stat.ohdr.size != 187) TEST_ERROR
+ if(obj_stat.ohdr.size != 183) TEST_ERROR
#else /* H5_HAVE_LARGE_HSIZET */
- if(obj_stat.ohdr.size != 167) TEST_ERROR
+ if(obj_stat.ohdr.size != 163) TEST_ERROR
#endif /* H5_HAVE_LARGE_HSIZET */
if(obj_stat.ohdr.free != 112) TEST_ERROR
if(obj_stat.ohdr.nmesgs != 3) TEST_ERROR
diff --git a/tools/testfiles/h5mkgrp_nested_latest.ls b/tools/testfiles/h5mkgrp_nested_latest.ls
index efe8551..f256b84 100644
--- a/tools/testfiles/h5mkgrp_nested_latest.ls
+++ b/tools/testfiles/h5mkgrp_nested_latest.ls
@@ -3,10 +3,10 @@ Expected output for 'h5ls ../testfiles/h5mkgrp_nested_latest.h5'
#############################
Opened "../testfiles/h5mkgrp_nested_latest.h5" with sec2 driver.
/one Group
- Location: 1:422
+ Location: 1:406
Links: 1
Modified: XXXX-XX-XX XX:XX:XX XXX
/one/two Group
- Location: 1:235
+ Location: 1:227
Links: 1
Modified: XXXX-XX-XX XX:XX:XX XXX
diff --git a/tools/testfiles/h5mkgrp_nested_mult_latest.ls b/tools/testfiles/h5mkgrp_nested_mult_latest.ls
index 2771497..9a08774 100644
--- a/tools/testfiles/h5mkgrp_nested_mult_latest.ls
+++ b/tools/testfiles/h5mkgrp_nested_mult_latest.ls
@@ -3,18 +3,18 @@ Expected output for 'h5ls ../testfiles/h5mkgrp_nested_mult_latest.h5'
#############################
Opened "../testfiles/h5mkgrp_nested_mult_latest.h5" with sec2 driver.
/one Group
- Location: 1:422
+ Location: 1:406
Links: 1
Modified: XXXX-XX-XX XX:XX:XX XXX
/one/two Group
- Location: 1:235
+ Location: 1:227
Links: 1
Modified: XXXX-XX-XX XX:XX:XX XXX
/three Group
- Location: 1:796
+ Location: 1:764
Links: 1
Modified: XXXX-XX-XX XX:XX:XX XXX
/three/four Group
- Location: 1:609
+ Location: 1:585
Links: 1
Modified: XXXX-XX-XX XX:XX:XX XXX
diff --git a/tools/testfiles/h5mkgrp_several_latest.ls b/tools/testfiles/h5mkgrp_several_latest.ls
index fbe9aa5..f5d62e0 100644
--- a/tools/testfiles/h5mkgrp_several_latest.ls
+++ b/tools/testfiles/h5mkgrp_several_latest.ls
@@ -3,10 +3,10 @@ Expected output for 'h5ls ../testfiles/h5mkgrp_several_latest.h5'
#############################
Opened "../testfiles/h5mkgrp_several_latest.h5" with sec2 driver.
/one Group
- Location: 1:235
+ Location: 1:227
Links: 1
Modified: XXXX-XX-XX XX:XX:XX XXX
/two Group
- Location: 1:422
+ Location: 1:406
Links: 1
Modified: XXXX-XX-XX XX:XX:XX XXX
diff --git a/tools/testfiles/h5mkgrp_single_latest.ls b/tools/testfiles/h5mkgrp_single_latest.ls
index 4838dfc..6ecc9ca 100644
--- a/tools/testfiles/h5mkgrp_single_latest.ls
+++ b/tools/testfiles/h5mkgrp_single_latest.ls
@@ -3,6 +3,6 @@ Expected output for 'h5ls ../testfiles/h5mkgrp_single_latest.h5'
#############################
Opened "../testfiles/h5mkgrp_single_latest.h5" with sec2 driver.
/latest Group
- Location: 1:235
+ Location: 1:227
Links: 1
Modified: XXXX-XX-XX XX:XX:XX XXX