diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-03-11 01:09:00 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-03-11 01:09:00 (GMT) |
commit | 9129a8452a543482336a85f68ba788691fe50925 (patch) | |
tree | 53de6974aecbd5a0a2443d345e8490fa4db5777c /src | |
parent | 051ffe9d61c067549bc1dab94f9de7ea330e64db (diff) | |
download | hdf5-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)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Gprivate.h | 4 | ||||
-rw-r--r-- | src/H5Oginfo.c | 66 | ||||
-rw-r--r-- | src/H5Oprivate.h | 2 | ||||
-rw-r--r-- | src/H5Pgcpl.c | 8 |
4 files changed, 60 insertions, 20 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; |