diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-10-03 00:54:33 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-10-03 00:54:33 (GMT) |
commit | e9ea7e8eaf0627f863d8a5f7805fdbb4334a67b0 (patch) | |
tree | 541b769b58cd16e4b297cd8f5abee0fb820a2802 /src/H5F.c | |
parent | 84a4166e72abac9eb08a7daa3f67c90227641cda (diff) | |
download | hdf5-e9ea7e8eaf0627f863d8a5f7805fdbb4334a67b0.zip hdf5-e9ea7e8eaf0627f863d8a5f7805fdbb4334a67b0.tar.gz hdf5-e9ea7e8eaf0627f863d8a5f7805fdbb4334a67b0.tar.bz2 |
[svn-r12708] Description:
Add the "use the latest version of the format" support to datatype
messages. And a regression test to check that it's working.
Also, found that we have been over-allocating space for compound datatype
messages (when they have array datatypes or can use the latest version of the
format) and trimmed the size back.
Clean up datatype & dataspace encode/decode routines by having them
allocate & release "fake" file structures, which gets them out of needing to
"know" about the internals of file structures.
Other minor whitespace/formatting cleanups, etc.
Tested on:
Linux/32 2.6 (chicago)
Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5F.c')
-rw-r--r-- | src/H5F.c | 56 |
1 files changed, 36 insertions, 20 deletions
@@ -26,7 +26,6 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ #include "H5FDprivate.h" /* File drivers */ -#include "H5FLprivate.h" /* Free lists */ #include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -73,10 +72,10 @@ static herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned fla static herr_t H5F_close(H5F_t *f); /* Declare a free list to manage the H5F_t struct */ -H5FL_DEFINE_STATIC(H5F_t); +H5FL_DEFINE(H5F_t); /* Declare a free list to manage the H5F_file_t struct */ -H5FL_DEFINE_STATIC(H5F_file_t); +H5FL_DEFINE(H5F_file_t); /*------------------------------------------------------------------------- @@ -1450,7 +1449,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) FUNC_ENTER_NOAPI_NOINIT(H5F_new) if(NULL == (f = H5FL_CALLOC(H5F_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") f->file_id = -1; if(shared) { @@ -1459,7 +1458,8 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) } /* end if */ else { HDassert(lf != NULL); - f->shared = H5FL_CALLOC(H5F_file_t); + if(NULL == (f->shared = H5FL_CALLOC(H5F_file_t))) + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared file structure") f->shared->super_addr = HADDR_UNDEF; f->shared->base_addr = HADDR_UNDEF; f->shared->freespace_addr = HADDR_UNDEF; @@ -2856,11 +2856,6 @@ H5F_sizeof_addr(const H5F_t *f) * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> * September 29, 2000 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * *------------------------------------------------------------------------- */ size_t @@ -2873,7 +2868,7 @@ H5F_sizeof_size(const H5F_t *f) assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->sizeof_size) -} +} /* H5F_sizeof_size() */ /*------------------------------------------------------------------------- @@ -2892,9 +2887,6 @@ H5F_sizeof_size(const H5F_t *f) * slu@ncsa.uiuc.edu * Oct 14 2001 * - * Modifications: - * Quincey Koziol, 2001-10-15 - * Added this header and removed unused ret_value variable. *------------------------------------------------------------------------- */ unsigned @@ -2907,7 +2899,7 @@ H5F_sym_leaf_k(const H5F_t *f) assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->sym_leaf_k) -} +} /* end H5F_sym_leaf_k() */ /*------------------------------------------------------------------------- @@ -2926,9 +2918,6 @@ H5F_sym_leaf_k(const H5F_t *f) * slu@ncsa.uiuc.edu * Oct 14 2001 * - * Modifications: - * Quincey Koziol, 2001-10-15 - * Added this header and removed unused ret_value variable. *------------------------------------------------------------------------- */ unsigned @@ -3455,8 +3444,6 @@ H5F_gc_ref(const H5F_t *f) * koziol@ncsa.uiuc.edu * May 25 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t @@ -3473,6 +3460,35 @@ H5F_get_fcpl(const H5F_t *f) /*------------------------------------------------------------------------- + * Function: H5F_use_latest_format + * + * Purpose: Retrieve the 'use the latest version of the format' flag for + * the file. + * + * Return: Success: Non-negative, the 'use the latest format' flag + * + * Failure: (can't happen) + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Oct 2 2006 + * + *------------------------------------------------------------------------- + */ +hbool_t +H5F_use_latest_format(const H5F_t *f) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_use_latest_format) + + HDassert(f); + HDassert(f->shared); + + FUNC_LEAVE_NOAPI(f->shared->latest_format) +} /* end H5F_use_latest_format() */ + + +/*------------------------------------------------------------------------- * Function: H5F_block_read * * Purpose: Reads some data from a file/server/etc into a buffer. |