diff options
Diffstat (limited to 'src')
54 files changed, 985 insertions, 620 deletions
diff --git a/src/H5Apkg.h b/src/H5Apkg.h index 4216fa3..de57e79 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -74,7 +74,7 @@ /****************************/ /* Define the shared attribute structure */ typedef struct H5A_shared_t { - unsigned version; /* Version to encode attribute with */ + uint8_t version; /* Version to encode attribute with */ char *name; /* Attribute's name */ H5T_cset_t encoding; /* Character encoding of attribute name */ diff --git a/src/H5Bcache.c b/src/H5Bcache.c index 99930e6..a3b49e9 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -109,7 +109,7 @@ H5B_serialize(const H5F_t *f, const H5B_t *bt) HDassert(f); HDassert(bt); HDassert(bt->rc_shared); - shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); + shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); p = shared->page; @@ -131,10 +131,10 @@ H5B_serialize(const H5F_t *f, const H5B_t *bt) H5F_addr_encode(f, &p, bt->right); /* child keys and pointers */ - native=bt->native; - for (u = 0; u < bt->nchildren; ++u) { + native = bt->native; + for(u = 0; u < bt->nchildren; ++u) { /* encode the key */ - if (shared->type->encode(f, bt, p, native) < 0) + if(shared->type->encode(f, bt, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key") p += shared->sizeof_rkey; native += shared->type->sizeof_nkey; @@ -142,9 +142,9 @@ H5B_serialize(const H5F_t *f, const H5B_t *bt) /* encode the child address */ H5F_addr_encode(f, &p, bt->child[u]); } /* end for */ - if(bt->nchildren>0) { + if(bt->nchildren > 0) { /* Encode the final key */ - if (shared->type->encode(f, bt, p, native) < 0) + if(shared->type->encode(f, bt, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key") } /* end if */ @@ -187,29 +187,29 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) HDassert(type); HDassert(type->get_shared); - if (NULL==(bt = H5FL_MALLOC(H5B_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + if(NULL == (bt = H5FL_MALLOC(H5B_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t)); - if((bt->rc_shared=(type->get_shared)(f, udata))==NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "can't retrieve B-tree node buffer") - shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); + if(NULL == (bt->rc_shared=(type->get_shared)(f, udata))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't retrieve B-tree node buffer") + shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); - if (NULL==(bt->native=H5FL_BLK_MALLOC(native_block,shared->sizeof_keys)) || - NULL==(bt->child=H5FL_SEQ_MALLOC(haddr_t,(size_t)shared->two_k))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) || + NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - if (H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page)<0) + if(H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page)<0) HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree node") p = shared->page; /* magic number */ - if (HDmemcmp(p, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) + if(HDmemcmp(p, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree signature") p += 4; /* node type and level */ - if (*p++ != (uint8_t)type->id) + if(*p++ != (uint8_t)type->id) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree node type") bt->level = *p++; @@ -221,22 +221,22 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) H5F_addr_decode(f, (const uint8_t **) &p, &(bt->right)); /* the child/key pairs */ - native=bt->native; - for (u = 0; u < bt->nchildren; u++) { + native = bt->native; + for(u = 0; u < bt->nchildren; u++) { /* Decode native key value */ - if ((type->decode) (f, bt, p, native) < 0) + if((type->decode)(f, bt, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key") p += shared->sizeof_rkey; native += type->sizeof_nkey; /* Decode address value */ H5F_addr_decode(f, (const uint8_t **) &p, bt->child + u); - } + } /* end for */ /* Decode final key */ - if(bt->nchildren>0) { + if(bt->nchildren > 0) { /* Decode native key value */ - if ((type->decode) (f, bt, p, native) < 0) + if((type->decode)(f, bt, p, native) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key") } /* end if */ @@ -244,8 +244,8 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) ret_value = bt; done: - if (!ret_value && bt) - (void)H5B_dest(f,bt); + if(!ret_value && bt) + (void)H5B_dest(f, bt); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_load() */ /*lint !e818 Can't make udata a pointer to const */ @@ -286,8 +286,8 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt, uns HDassert(shared->type); HDassert(shared->type->encode); - if (bt->cache_info.is_dirty) { - if (H5B_serialize(f, bt) < 0) + if(bt->cache_info.is_dirty) { + if(H5B_serialize(f, bt) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSERIALIZE, FAIL, "unable to serialize B-tree") /* @@ -295,14 +295,14 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt, uns * bother writing data for the child entries that don't exist or * for the final unchanged children. */ - if (H5F_block_write(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page) < 0) + if(H5F_block_write(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree node to disk") bt->cache_info.is_dirty = FALSE; } /* end if */ - if (destroy) - if (H5B_dest(f,bt) < 0) + if(destroy) + if(H5B_dest(f,bt) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node") done: @@ -356,9 +356,9 @@ H5B_dest(H5F_t *f, H5B_t *bt) /* Release resources for B-tree node */ H5FL_SEQ_FREE(haddr_t, bt->child); - (void)H5FL_BLK_FREE(native_block, bt->native); + bt->native = H5FL_BLK_FREE(native_block, bt->native); H5RC_DEC(bt->rc_shared); - (void)H5FL_FREE(H5B_t, bt); + bt = H5FL_FREE(H5B_t, bt); done: FUNC_LEAVE_NOAPI(ret_value) @@ -393,8 +393,8 @@ H5B_clear(H5F_t *f, H5B_t *bt, hbool_t destroy) /* Reset the dirty flag. */ bt->cache_info.is_dirty = FALSE; - if (destroy) - if (H5B_dest(f, bt) < 0) + if(destroy) + if(H5B_dest(f, bt) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node") done: @@ -417,7 +417,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr) +H5B_compute_size(const H5F_t UNUSED *f, const H5B_t *bt, size_t *size_ptr) { H5B_shared_t *shared; /* Pointer to shared B-tree info */ @@ -427,7 +427,7 @@ H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr) HDassert(f); HDassert(bt); HDassert(bt->rc_shared); - shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); + shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); HDassert(shared->type); HDassert(size_ptr); @@ -437,3 +437,4 @@ H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr) FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B_compute_size() */ + diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index eaf8230..b201023 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -1471,6 +1471,7 @@ H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent /* Reset "fake" storage info */ HDmemset(&storage, 0, sizeof(storage)); + storage.idx_type = H5D_CHUNK_BTREE; /* Allocate the shared structure */ if(H5D_btree_shared_create(f, &storage, ndims) < 0) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 59c2e5d..5acee1f 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -376,7 +376,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_chunk_construct(H5F_t *f, H5D_t *dset) +H5D_chunk_construct(H5F_t UNUSED *f, H5D_t *dset) { const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */ hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ @@ -336,7 +336,7 @@ H5E_get_stack(void) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5E_get_stack) - estack = pthread_getspecific(H5TS_errstk_key_g); + estack = (H5E_t *)pthread_getspecific(H5TS_errstk_key_g); if(!estack) { /* no associated value with current thread - create one */ diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c index d9d0a4c..0ac4807 100644 --- a/src/H5EAdbg.c +++ b/src/H5EAdbg.c @@ -183,7 +183,7 @@ END_FUNC(PKG) /* end H5EA__hdr_debug() */ */ BEGIN_FUNC(PKG, ERR, herr_t, SUCCEED, FAIL, -H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, +H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int indent, int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr)) /* Local variables */ diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index e6c33b1..c8dd34d 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -50,8 +50,10 @@ /* Local Macros */ /****************/ +#ifndef NDEBUG /* Max. # of bits for max. nelmts index */ #define H5EA_MAX_NELMTS_IDX_MAX 64 +#endif /* NDEBUG */ /* # of elements in a data block for a particular super block */ #define H5EA_SBLK_DBLK_NELMTS(s, m) \ diff --git a/src/H5Eint.c b/src/H5Eint.c index 52f8aac..831d51b 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -275,7 +275,7 @@ H5E_walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) fprintf(stream, "thread 0"); } /* end block */ #elif defined(H5_HAVE_THREADSAFE) - fprintf(stream, "thread %lu", HDpthread_self_ulong()); + fprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); #else fprintf(stream, "thread 0"); #endif @@ -392,7 +392,7 @@ H5E_walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) fprintf(stream, "thread 0"); } /* end block */ #elif defined(H5_HAVE_THREADSAFE) - fprintf(stream, "thread %lu", HDpthread_self_ulong()); + fprintf(stream, "thread %lu", (unsigned long)HDpthread_self_ulong()); #else fprintf(stream, "thread 0"); #endif @@ -843,22 +843,6 @@ done: * matzke@llnl.gov * Jul 18 1997 * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed the file creation and access property list to the - * new generic property list. - * - * J Mainzer, Mar 10, 2005 - * Updated for the new metadata cache, and associated - * property list changes. - * - * J Mainzer, Jun 30, 2005 - * Added lf parameter so the shared->lf field can be - * initialized prior to the call to H5AC_create() if a - * new instance of H5F_file_t is created. lf should be - * NULL if shared isn't, and vise versa. - * *------------------------------------------------------------------------- */ static H5F_t * @@ -1040,16 +1024,13 @@ done: * Programmer: Robb Matzke * matzke@llnl.gov * Jul 18 1997 - * Modifications: - * Vailin Choi, April 2, 2008 - * Free f->extpath * *------------------------------------------------------------------------- */ static herr_t H5F_dest(H5F_t *f, hid_t dxpl_id) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5F_dest) @@ -1096,6 +1077,8 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") f->shared->root_grp = NULL; } /* end if */ + + /* Destroy other components of the file */ if(H5AC_dest(f, dxpl_id)) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") @@ -1198,42 +1181,6 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) * Programmer: Robb Matzke * Tuesday, September 23, 1997 * - * Modifications: - * Albert Cheng, 1998-02-05 - * Added the access_parms argument to pass down access template - * information. - * - * Robb Matzke, 1998-02-18 - * The H5F_access_t changed to allow more generality. The low - * level driver is part of the file access template so the TYPE - * argument has been removed. - * - * Robb Matzke, 1999-08-02 - * Rewritten to use the virtual file layer. - * - * Robb Matzke, 1999-08-16 - * Added decoding of file driver information block, which uses a - * formerly reserved address slot in the boot block in order to - * be compatible with previous versions of the file format. - * - * Robb Matzke, 1999-08-20 - * Optimizations for opening a file. If the driver can't - * determine when two file handles refer to the same file then - * we open the file in one step. Otherwise if the first attempt - * to open the file fails then we skip the second attempt if the - * arguments would be the same. - * - * Raymond Lu, 2001-10-14 - * Changed the file creation and access property lists to the - * new generic property list. - * - * Bill Wendling, 2003-03-18 - * Modified H5F_flush call to take one flag instead of - * multiple Boolean flags. - * - * Vailin Choi, 2008-04-02 - * To formulate path for later searching of target file for external link - * via H5_build_extpath(). *------------------------------------------------------------------------- */ H5F_t * @@ -1482,33 +1429,6 @@ done: * * Programmer: Unknown * - * Modifications: - * Robb Matzke, 1997-07-18 - * File struct creation and destruction is through H5F_new() and - * H5F_dest(). Writing the root symbol table entry is done with - * H5G_encode(). - * - * Robb Matzke, 1997-08-29 - * Moved creation of the boot block to H5F_flush(). - * - * Robb Matzke, 1997-09-23 - * Most of the work is now done by H5F_open() since H5Fcreate() - * and H5Fopen() originally contained almost identical code. - * - * Robb Matzke, 1998-02-18 - * Better error checking for the creation and access property - * lists. It used to be possible to swap the two and core the - * library. Also, zero is no longer valid as a default property - * list; one must use H5P_DEFAULT instead. - * - * Robb Matzke, 1999-08-02 - * The file creation and file access property lists are passed - * to the H5F_open() as object IDs. - * - * Raymond Lu, 2001-10-14 - * Changed the file creation and access property list to the - * new generic property list. - * *------------------------------------------------------------------------- */ hid_t @@ -1676,14 +1596,6 @@ done: * Programmer: Robb Matzke * Thursday, August 6, 1998 * - * Modifications: - * Robb Matzke, 1998-10-16 - * Added the `scope' argument. - * - * Bill Wendling, 2003-03-18 - * Modified H5F_flush call to take one flag instead of - * several Boolean flags. - * *------------------------------------------------------------------------- */ herr_t @@ -2556,6 +2468,7 @@ hssize_t H5Fget_freespace(hid_t file_id) { H5F_t *file; /* File object for file ID */ + hsize_t tot_space; /* Amount of free space in the file */ hssize_t ret_value; /* Return value */ FUNC_ENTER_API(H5Fget_freespace, FAIL) @@ -2566,9 +2479,11 @@ H5Fget_freespace(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Go get the actual amount of free space in the file */ - if((ret_value = H5MF_get_freespace(file, H5AC_ind_dxpl_id)) < 0) + if(H5MF_get_freespace(file, H5AC_ind_dxpl_id, &tot_space, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + ret_value = (hssize_t)tot_space; + done: FUNC_LEAVE_API(ret_value) } /* end H5Fget_freespace() */ @@ -2966,6 +2881,7 @@ done: * * Programmer: Vailin Choi * July 11, 2007 + * *------------------------------------------------------------------------- */ herr_t @@ -3003,9 +2919,8 @@ H5Fget_info(hid_t obj_id, H5F_info_t *finfo) HDmemset(finfo, 0, sizeof(H5F_info_t)); /* Check for superblock extension info */ - if(H5F_addr_defined(f->shared->extension_addr)) - if(H5F_super_ext_size(f, H5AC_ind_dxpl_id, &finfo->super_ext_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock extension size") + if(H5F_super_size(f, H5AC_ind_dxpl_id, NULL, &finfo->super_ext_size) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock sizes") /* Check for SOHM info */ if(H5F_addr_defined(f->shared->sohm_addr)) @@ -3015,3 +2930,4 @@ H5Fget_info(hid_t obj_id, H5F_info_t *finfo) done: FUNC_LEAVE_API(ret_value) } /* end H5Fget_info() */ + @@ -561,8 +561,6 @@ done: * Programmer: Robb Matzke * Monday, August 16, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1717,7 +1715,6 @@ H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map) FUNC_ENTER_NOAPI(H5FD_get_fs_type_map, FAIL) /* Sanity check */ - HDassert(file); HDassert(file && file->cls); HDassert(type_map); diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 1d508dc..e259a4e 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -656,8 +656,6 @@ H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out* * Programmer: Raymond Lu * Tuesday, May 10, 2005 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index 52d7eb9..fde8556 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -26,23 +26,8 @@ #define H5_HAVE_VFL 1 /*define a convenient app feature test*/ #define H5FD_VFD_DEFAULT 0 /* Default VFL driver value */ -/* - * Types of allocation requests. The values larger than H5FD_MEM_DEFAULT - * should not change other than adding new types to the end. These numbers - * might appear in files. - */ -typedef enum H5FD_mem_t { - H5FD_MEM_NOLIST = -1, /*must be negative*/ - H5FD_MEM_DEFAULT = 0, /*must be zero*/ - H5FD_MEM_SUPER = 1, - H5FD_MEM_BTREE = 2, - H5FD_MEM_DRAW = 3, - H5FD_MEM_GHEAP = 4, - H5FD_MEM_LHEAP = 5, - H5FD_MEM_OHDR = 6, - - H5FD_MEM_NTYPES /*must be last*/ -} H5FD_mem_t; +/* Types of allocation requests: see H5Fpublic.h */ +typedef enum H5F_mem_t H5FD_mem_t; /* Map "fractal heap" header blocks to 'ohdr' type file memory, since its * a fair amount of work to add a new kind of file memory and they are similar @@ -290,12 +290,12 @@ H5FO_mark(const H5F_t *f, haddr_t addr, hbool_t deleted) PURPOSE Check if an object is marked to be deleted when it is closed USAGE - htri_t H5FO_marked(f,addr) + hbool_t H5FO_marked(f,addr) const H5F_t *f; IN: File opened object is in haddr_t addr; IN: Address of object to delete RETURNS - Returns a TRUE/FALSE on success, negative on failure + Returns a TRUE/FALSE on success DESCRIPTION Checks if the object is currently in the "opened objects" tree and whether its marks for deletion from the file when it is closed. @@ -304,11 +304,11 @@ H5FO_mark(const H5F_t *f, haddr_t addr, hbool_t deleted) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -htri_t +hbool_t H5FO_marked(const H5F_t *f, haddr_t addr) { H5FO_open_obj_t *open_obj; /* Information about open object */ - htri_t ret_value = FAIL; /* Return value */ + hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_NOFUNC(H5FO_marked) @@ -320,7 +320,7 @@ H5FO_marked(const H5F_t *f, haddr_t addr) /* Get the object node from the container */ if(NULL != (open_obj = (H5FO_open_obj_t *)H5SL_search(f->shared->open_objs, &addr))) - ret_value = open_obj->deleted; + ret_value = (htri_t)open_obj->deleted; FUNC_LEAVE_NOAPI(ret_value) } /* end H5FO_marked() */ diff --git a/src/H5FOprivate.h b/src/H5FOprivate.h index 9458a56..4648f02 100644 --- a/src/H5FOprivate.h +++ b/src/H5FOprivate.h @@ -41,7 +41,7 @@ H5_DLL void *H5FO_opened(const H5F_t *f, haddr_t addr); H5_DLL herr_t H5FO_insert(const H5F_t *f, haddr_t addr, void *obj, hbool_t delete_flag); H5_DLL herr_t H5FO_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr); H5_DLL herr_t H5FO_mark(const H5F_t *f, haddr_t addr, hbool_t deleted); -H5_DLL htri_t H5FO_marked(const H5F_t *f, haddr_t addr); +H5_DLL hbool_t H5FO_marked(const H5F_t *f, haddr_t addr); H5_DLL herr_t H5FO_dest(const H5F_t *f); H5_DLL herr_t H5FO_top_create(H5F_t *f); H5_DLL herr_t H5FO_top_incr(const H5F_t *f, haddr_t addr); @@ -386,9 +386,9 @@ HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC); HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") } /* end if */ } /* end if */ - else - /* Sanity check that section info has address */ - HDassert(H5F_addr_defined(fspace->sect_addr)); + else + /* Sanity check that section info has address */ + HDassert(H5F_addr_defined(fspace->sect_addr)); /* Cache the free space section info */ if(H5AC_set(f, dxpl_id, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5FScache.c b/src/H5FScache.c index 5d901e9..a7978f5 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -283,13 +283,6 @@ done: * koziol@ncsa.uiuc.edu * May 2 2006 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * - * *------------------------------------------------------------------------- */ static herr_t diff --git a/src/H5FSdbg.c b/src/H5FSdbg.c index cf165ca..df48240 100644 --- a/src/H5FSdbg.c +++ b/src/H5FSdbg.c @@ -131,7 +131,7 @@ H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Free space client:", (fspace->client == H5FS_CLIENT_FHEAP_ID ? "Fractal heap" : - (fspace->client == H5FS_CLIENT_FILE_ID ? "File Memory Management" : "Unknown"))); + (fspace->client == H5FS_CLIENT_FILE_ID ? "File" : "Unknown"))); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Total free space tracked:", fspace->tot_space); @@ -287,7 +287,7 @@ H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int case H5FS_CLIENT_FILE_ID: #ifdef NOT_YET - if(H5MF_sects_debug(f, dxpl_id, client_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0) + if(H5MF_sects_debug(f, dxpl_id, fs_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections") #endif /* NOT_YET */ break; diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index 6f73b93..e5763a5 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -147,9 +147,13 @@ typedef struct H5FS_stat_t { hsize_t tot_sect_count; /* Total # of sections tracked */ hsize_t serial_sect_count; /* # of serializable sections tracked */ hsize_t ghost_sect_count; /* # of un-serializable sections tracked */ + haddr_t addr; /* Address of free space header on disk */ + hsize_t hdr_size; /* Size of the free-space header on disk */ + haddr_t sect_addr; /* Address of the section info in the file */ + hsize_t alloc_sect_size; /* Allocated size of the section info in the file */ + hsize_t sect_size; /* Size of the section info in the file */ } H5FS_stat_t; - /* Typedef for iteration operations */ typedef herr_t (*H5FS_operator_t)(const H5FS_section_info_t *sect, void *operator_data/*in,out*/); @@ -193,8 +197,7 @@ H5_DLL herr_t H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned new_class); /* Statistics routine */ -H5_DLL herr_t H5FS_stat_info(const H5FS_t *fh, H5FS_stat_t *stats); - +H5_DLL herr_t H5FS_stat_info(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *stats); /* Debugging routines for dumping file structures */ H5_DLL herr_t H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 9ad6c70..51229cb 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -27,6 +27,7 @@ #define H5FS_PACKAGE /*suppress error about including H5FSpkg */ + /***********/ /* Headers */ /***********/ @@ -36,15 +37,11 @@ #include "H5MFprivate.h" /* File memory management */ #include "H5Vprivate.h" /* Vectors and arrays */ + /****************/ /* Local Macros */ /****************/ -/* #define QAK */ - -/* Default starting size of section buffer */ -#define H5FS_SINFO_SIZE_DEFAULT 64 - /******************/ /* Local Typedefs */ @@ -87,6 +84,7 @@ static herr_t H5FS_sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, static htri_t H5FS_sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node); static herr_t H5FS_sect_serialize_size(H5FS_t *fspace); + /*********************/ /* Package Variables */ /*********************/ @@ -178,8 +176,9 @@ done: /* Release bins for skip lists */ if(sinfo->bins) sinfo->bins = H5FL_SEQ_FREE(H5FS_bin_t, sinfo->bins); + /* Release free space section info */ - H5FL_FREE(H5FS_sinfo_t, sinfo); + sinfo = H5FL_FREE(H5FS_sinfo_t, sinfo); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FSstat.c b/src/H5FSstat.c index 7b2cb0d..18635c1 100644 --- a/src/H5FSstat.c +++ b/src/H5FSstat.c @@ -82,7 +82,7 @@ *------------------------------------------------------------------------- */ herr_t -H5FS_stat_info(const H5FS_t *frsp, H5FS_stat_t *stats) +H5FS_stat_info(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *stats) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FS_stat_info) @@ -95,7 +95,11 @@ H5FS_stat_info(const H5FS_t *frsp, H5FS_stat_t *stats) stats->tot_sect_count = frsp->tot_sect_count; stats->serial_sect_count = frsp->serial_sect_count; stats->ghost_sect_count = frsp->ghost_sect_count; - /* can add more metadata statistics for the free-space manager */ + stats->addr = frsp->addr; + stats->hdr_size = H5FS_HEADER_SIZE(f); + stats->sect_addr = frsp->sect_addr; + stats->alloc_sect_size = frsp->alloc_sect_size; + stats->sect_size = frsp->sect_size; FUNC_LEAVE_NOAPI(SUCCEED) } /* H5FS_stat_info() */ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 9529e0c..d4e142b 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -597,7 +597,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, haddr_t addr, +H5F_accum_free(H5F_t *f, hid_t dxpl_id, H5FD_mem_t UNUSED type, haddr_t addr, hsize_t size) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index da7ef24..d0f1b26 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -43,6 +43,7 @@ #include "H5Oprivate.h" /* Object header messages */ #include "H5RCprivate.h" /* Reference counted object functions */ + /* * Feature: Define this constant on the compiler command-line if you want to * see some debugging messages on the debug stream. @@ -67,6 +68,10 @@ #define H5F_FS_MERGE_METADATA 0x01 /* Section can merge with metadata aggregator */ #define H5F_FS_MERGE_RAWDATA 0x02 /* Section can merge with small 'raw' data aggregator */ +/* Macro to abstract checking whether file is using a free space manager */ +#define H5F_HAVE_FREE_SPACE_MANAGER(F) TRUE /* Currently always have a free space manager */ + + /* Structure for metadata & "small [raw] data" block aggregation fields */ struct H5F_blk_aggr_t { unsigned long feature_flag; /* Feature flag type */ @@ -119,8 +124,8 @@ typedef struct H5F_file_t { H5FD_t *lf; /* Lower level file handle for I/O */ unsigned nrefs; /* Ref count for times file is opened */ uint8_t status_flags; /* File status flags */ - unsigned flags; /* Access Permissions for file */ - H5F_mtab_t mtab; /* File mount table */ + unsigned flags; /* Access Permissions for file */ + H5F_mtab_t mtab; /* File mount table */ /* Cached values from FCPL/superblock */ unsigned sym_leaf_k; /* Size of leaves in symbol tables */ @@ -201,6 +206,7 @@ struct H5F_t { unsigned nmounts; /* Number of children mounted to this file */ }; + /*****************************/ /* Package Private Variables */ /*****************************/ @@ -229,7 +235,7 @@ H5_DLL herr_t H5F_mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nop H5_DLL herr_t H5F_super_init(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5F_super_write(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5F_super_read(H5F_t *f, hid_t dxpl_id); -H5_DLL herr_t H5F_super_ext_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_ext_info); +H5_DLL herr_t H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size); /* Metadata accumulator routines */ H5_DLL htri_t H5F_accum_read(const H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 3550a4a..1497f03 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -499,6 +499,7 @@ H5_DLL hbool_t H5F_use_latest_format(const H5F_t *f); H5_DLL H5F_close_degree_t H5F_get_fc_degree(const H5F_t *f); H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f); H5_DLL hbool_t H5F_is_tmp_addr(const H5F_t *f, haddr_t addr); +H5_DLL hbool_t H5F_use_tmp_space(const H5F_t *f); /* Functions that retrieve values from VFD layer */ H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature); diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 16d3c05..5d1c8c8 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -128,6 +128,24 @@ typedef struct H5F_info_t { } sohm; } H5F_info_t; +/* + * Types of allocation requests. The values larger than H5FD_MEM_DEFAULT + * should not change other than adding new types to the end. These numbers + * might appear in files. + */ +typedef enum H5F_mem_t { + H5FD_MEM_NOLIST = -1, /*must be negative*/ + H5FD_MEM_DEFAULT = 0, /*must be zero*/ + H5FD_MEM_SUPER = 1, + H5FD_MEM_BTREE = 2, + H5FD_MEM_DRAW = 3, + H5FD_MEM_GHEAP = 4, + H5FD_MEM_LHEAP = 5, + H5FD_MEM_OHDR = 6, + + H5FD_MEM_NTYPES /*must be last*/ +} H5F_mem_t; + /* Library's file format versions */ typedef enum H5F_libver_t { H5F_LIBVER_EARLIEST, /* Use the earliest possible format for storing objects */ diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 44c1b32..564a088 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -113,8 +113,6 @@ H5F_get_intent(const H5F_t *f) * * Programmer: Vailin Choi, April 2, 2008 * - * Modifications: - * *------------------------------------------------------------------------- */ char * diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 32541ae..f5973e9 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -110,6 +110,10 @@ /********************/ /* Local Prototypes */ /********************/ +static herr_t H5F_super_ext_create(H5F_t *f, hid_t dxpl_id, H5O_loc_t *ext_ptr); +static herr_t H5F_super_ext_open(H5F_t *f, H5O_loc_t *ext_ptr); +static herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create); +static herr_t H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr); /*********************/ @@ -214,6 +218,114 @@ done: /*------------------------------------------------------------------------- + * Function: H5F_super_ext_create + * + * Purpose: Create the superblock extension + * + * Return: Success: non-negative on success + * Failure: Negative + * + * Programmer: Vailin Choi; Feb 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5F_super_ext_create(H5F_t *f, hid_t dxpl_id, H5O_loc_t *ext_ptr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5F_super_ext_create) + + /* Sanity check */ + HDassert(f); + HDassert(ext_ptr); + HDassert(!H5F_addr_defined(f->shared->extension_addr)); + + H5O_loc_reset(ext_ptr); + if(H5O_create(f, dxpl_id, 0, H5P_GROUP_CREATE_DEFAULT, ext_ptr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create superblock extension") + + /* Record the address of the superblock extension */ + f->shared->extension_addr = ext_ptr->addr; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F_super_ext_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_super_ext_open + * + * Purpose: Open an existing superblock extension + * + * Return: Success: non-negative on success + * Failure: Negative + * + * Programmer: Vailin Choi; Feb 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5F_super_ext_open(H5F_t *f, H5O_loc_t *ext_ptr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5F_super_ext_open) + + /* Sanity check */ + HDassert(f); + HDassert(ext_ptr); + HDassert(H5F_addr_defined(f->shared->extension_addr)); + + /* Set up "fake" object location for superblock extension */ + H5O_loc_reset(ext_ptr); + ext_ptr->file = f; + ext_ptr->addr = f->shared->extension_addr; + + /* Open the superblock extension object header */ + if(H5O_open(ext_ptr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to open superblock extension") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F_super_ext_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_super_ext_close + * + * Purpose: Close superblock extension + * + * Return: Success: non-negative on success + * Failure: Negative + * + * Programmer: Vailin Choi; Feb 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5F_super_ext_close) + + /* Sanity check */ + HDassert(f); + HDassert(ext_ptr); + + /* Twiddle the number of open objects to avoid closing the file. */ + f->nopen_objs++; + if(H5O_close(ext_ptr) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close superblock extension") + f->nopen_objs--; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F_super_ext_close() */ + + +/*------------------------------------------------------------------------- * Function: H5F_super_read * * Purpose: Reads the superblock from the file or from the BUF. If @@ -584,14 +696,9 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to set end-of-address marker for file") } /* end if */ - /* Set up "fake" object location for superblock extension */ - H5O_loc_reset(&ext_loc); - ext_loc.file = f; - ext_loc.addr = shared->extension_addr; - /* Open the superblock extension */ - if(H5O_open(&ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open superblock extension") + if(H5F_super_ext_open(f, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to start file's superblock extension") /* Check for the extension having a 'driver info' message */ if((status = H5O_msg_exists(&ext_loc, H5O_DRVINFO_ID, dxpl_id)) < 0) @@ -647,13 +754,9 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id) shared->sym_leaf_k = H5F_CRT_SYM_LEAF_DEF; } /* end if */ - /* Close the extension. Twiddle the number of open objects to avoid - * closing the file (since this will be the only open object). - */ - f->nopen_objs++; - if(H5O_close(&ext_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to close superblock extension") - f->nopen_objs--; + /* Close superblock extension */ + if(H5F_super_ext_close(f, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") } /* end if */ done: @@ -789,12 +892,8 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) * be tuned if more information is added to the superblock * extension. */ - H5O_loc_reset(&ext_loc); - if(H5O_create(f, dxpl_id, 0, H5P_GROUP_CREATE_DEFAULT, &ext_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create superblock extension") - - /* Record the address of the superblock extension */ - f->shared->extension_addr = ext_loc.addr; + if(H5F_super_ext_create(f, dxpl_id, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to start file's superblock extension") /* Create the Shared Object Header Message table and register it with * the metadata cache, if this file supports shared messages. @@ -838,13 +937,9 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update driver info header message") } /* end if */ - /* Twiddle the number of open objects to avoid closing the file - * (since this will be the only open object currently). - */ - f->nopen_objs++; - if(H5O_close(&ext_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close superblock extension") - f->nopen_objs--; + /* Close superblock extension */ + if(H5F_super_ext_close(f, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") } /* end if */ done: @@ -1015,7 +1110,6 @@ H5F_super_write(H5F_t *f, hid_t dxpl_id) /* Check for driver info message */ H5_ASSIGN_OVERFLOW(driver_size, H5FD_sb_size(f->shared->lf), hsize_t, size_t); if(driver_size > 0) { - H5O_loc_t ext_loc; /* "Object location" for superblock extension */ H5O_drvinfo_t drvinfo; /* Driver info */ uint8_t dbuf[H5F_MAX_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */ @@ -1026,28 +1120,11 @@ H5F_super_write(H5F_t *f, hid_t dxpl_id) if(H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information") - /* Set up "fake" object location for superblock extension */ - H5O_loc_reset(&ext_loc); - ext_loc.file = f; - ext_loc.addr = f->shared->extension_addr; - - /* Open the superblock extension */ - if(H5O_open(&ext_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to open superblock extension") - /* Write driver info information to the superblock extension */ drvinfo.len = driver_size; drvinfo.buf = dbuf; - if(H5O_msg_write(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &drvinfo, dxpl_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to update driver info header message") - - /* Close the extension. Twiddle the number of open objects to avoid - * closing the file (since this will be the only open object). - */ - f->nopen_objs++; - if(H5O_close(&ext_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to close superblock extension") - f->nopen_objs--; + if(H5F_super_ext_write_msg(f, dxpl_id, &drvinfo, H5O_DRVINFO_ID, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "unable to update driver info header message") } /* end if */ } /* end if */ @@ -1057,8 +1134,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_super_ext_size - * Get storage size of the superblock extension + * Function: H5F_super_size + * + * Purpose: Get storage size of the superblock and superblock extension * * Return: Success: non-negative on success * Failure: Negative @@ -1068,31 +1146,119 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_ext_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_ext_size) +H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size) { - H5O_loc_t ext_loc; /* "Object location" for superblock extension */ - H5O_info_t oinfo; /* Object info for superblock extension */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5F_super_ext_size, FAIL) + FUNC_ENTER_NOAPI(H5F_super_size, FAIL) /* Sanity check */ HDassert(f); - HDassert(super_ext_size); - /* Set up "fake" object location for superblock extension */ - H5O_loc_reset(&ext_loc); - ext_loc.file = f; - ext_loc.addr = f->shared->extension_addr; + /* Set the superblock size */ + if(super_size) { + H5P_genplist_t *plist; /* File creation property list */ + unsigned super_vers; /* Superblock version */ - /* Get object header info for superblock extension */ - if(H5O_get_info(&ext_loc, dxpl_id, FALSE, &oinfo) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info") + /* Get the shared file creation property list */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Grab values from property list */ + if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super_vers) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get superblock version") + + /* Set the superblock size */ + *super_size = H5F_SUPERBLOCK_SIZE(super_vers, f); + } /* end if */ /* Set the superblock extension size */ - *super_ext_size = oinfo.hdr.space.total; + if(super_ext_size) { + if(H5F_addr_defined(f->shared->extension_addr)) { + H5O_loc_t ext_loc; /* "Object location" for superblock extension */ + H5O_info_t oinfo; /* Object info for superblock extension */ + + /* Set up "fake" object location for superblock extension */ + H5O_loc_reset(&ext_loc); + ext_loc.file = f; + ext_loc.addr = f->shared->extension_addr; + + /* Get object header info for superblock extension */ + if(H5O_get_info(&ext_loc, dxpl_id, FALSE, &oinfo) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info") + + /* Set the superblock extension size */ + *super_ext_size = oinfo.hdr.space.total; + } /* end if */ + else + /* Set the superblock extension size to zero */ + *super_ext_size = (hsize_t)0; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5F_super_size() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_super_ext_write_msg() + * + * Purpose: Write the message with ID to the superblock extension + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; Feb 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create) +{ + H5O_loc_t ext_loc; /* "Object location" for superblock extension */ + htri_t status; /* Indicate whether the message exists or not */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5F_super_ext_write_msg) + + /* Open/create the superblock extension object header */ + if(H5F_addr_defined(f->shared->extension_addr)) { + if(H5F_super_ext_open(f, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension") + } /* end if */ + else { + HDassert(may_create); + if(H5F_super_ext_create(f, dxpl_id, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension") + } /* end else */ + HDassert(H5F_addr_defined(ext_loc.addr)); + + /* Check if message with ID does not exist in the object header */ + if((status = H5O_msg_exists(&ext_loc, id, dxpl_id)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message or message exists") + + /* Check for creating vs. writing */ + if(may_create) { + if(status) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should not exist") + + /* Create the message with ID in the superblock extension */ + if(H5O_msg_create(&ext_loc, id, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, mesg, dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to create the message in object header") + } /* end if */ + else { + if(!status) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should exist") + + /* Update the message with ID in the superblock extension */ + if(H5O_msg_write(&ext_loc, id, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, mesg, dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to write the message in object header") + } /* end else */ + + /* Close the superblock extension object header */ + if(H5F_super_ext_close(f, &ext_loc) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5F_super_ext_size() */ +} /* H5F_super_ext_write_msg() */ diff --git a/src/H5Gcache.c b/src/H5Gcache.c index c17c97f..6d497b6 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -312,7 +312,7 @@ H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5G_node_ /* entries */ if(H5G_ent_encode_vec(f, &p, sym->entry, sym->nsyms) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize") - HDmemset(p, 0, size - (p - node)); + HDmemset(p, 0, size - (size_t)(p - node)); /* Write the serialized symbol table node. */ if(H5F_block_write(f, H5FD_MEM_BTREE, addr, size, dxpl_id, node) < 0) diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c index 9ecd6c1..26773cb 100644 --- a/src/H5Gcompact.c +++ b/src/H5Gcompact.c @@ -523,7 +523,7 @@ H5G_compact_lookup(H5O_loc_t *oloc, const char *name, H5O_link_t *lnk, HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages") /* Determine if we found the link we were looking for */ - ret_value = udata.found; + ret_value = (htri_t)udata.found; done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Glink.c b/src/H5Glink.c index 7051453..37a0ede 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -377,7 +377,7 @@ H5G_link_to_info(const H5O_link_t *lnk, H5L_info_t *info) if((cb_ret = (link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, NULL, (size_t)0)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query buffer size callback returned failure") - info->u.val_size = cb_ret; + info->u.val_size = (size_t)cb_ret; } /* end if */ else info->u.val_size = 0; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index fe381fd..a58c66a 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -299,31 +299,31 @@ static herr_t H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key, void UNUSED *_udata, void *_rt_key, haddr_t *addr_p/*out*/) { - H5G_node_key_t *lt_key = (H5G_node_key_t *) _lt_key; - H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key; - H5G_node_t *sym = NULL; - hsize_t size = 0; - herr_t ret_value=SUCCEED; /* Return value */ + H5G_node_key_t *lt_key = (H5G_node_key_t *)_lt_key; + H5G_node_key_t *rt_key = (H5G_node_key_t *)_rt_key; + H5G_node_t *sym = NULL; + hsize_t size = 0; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5G_node_create); /* * Check arguments. */ - assert(f); - assert(H5B_INS_FIRST == op); + HDassert(f); + HDassert(H5B_INS_FIRST == op); if(NULL == (sym = H5FL_CALLOC(H5G_node_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") size = H5G_node_size_real(f); if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space"); + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space") sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))); - if(NULL==sym->entry) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + if(NULL == sym->entry) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node"); + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node") /* * The left and right symbols in an empty tree are both the * empty string stored at offset zero by the H5G functions. This @@ -339,13 +339,13 @@ done: if(ret_value < 0) { if(sym != NULL) { if(sym->entry != NULL) - H5FL_SEQ_FREE(H5G_entry_t, sym->entry); - (void)H5FL_FREE(H5G_node_t, sym); + sym->entry = H5FL_SEQ_FREE(H5G_entry_t, sym->entry); + sym = H5FL_FREE(H5G_node_t, sym); } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_node_create() */ /*------------------------------------------------------------------------- @@ -636,7 +636,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, */ rt = sn->nsyms; while(lt < rt) { - idx = (lt + rt) / 2; + idx = (int)((lt + rt) / 2); s = base + sn->entry[idx].name_off; /* Check if symbol is already present */ @@ -644,9 +644,9 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "symbol is already present in symbol table") if (cmp < 0) - rt = idx; + rt = (unsigned)idx; else - lt = idx + 1; + lt = (unsigned)(idx + 1); } /* end while */ idx += cmp > 0 ? 1 : 0; @@ -689,15 +689,17 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, insert_into = sn; if(idx == (int)H5F_SYM_LEAF_K(f)) md_key->offset = ent.name_off; - } else { + } /* end if */ + else { idx -= H5F_SYM_LEAF_K(f); insert_into = snrt; - if(idx == (int)H5F_SYM_LEAF_K (f)) { + if(idx == (int)H5F_SYM_LEAF_K(f)) { rt_key->offset = ent.name_off; *rt_key_changed = TRUE; } /* end if */ } /* end else */ - } else { + } /* end if */ + else { /* Where to insert the new entry? */ ret_value = H5B_INS_NOOP; sn_flags |= H5AC__DIRTIED_FLAG; diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 3a911d6..e0a1069 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -35,6 +35,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ #include "H5HFpkg.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ #include "H5Vprivate.h" /* Vectors and arrays */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 4fd527d..d1f2675 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -43,6 +43,7 @@ /* Local Macros */ /****************/ +#ifndef NDEBUG /* Limit on the size of the max. direct block size */ /* (This is limited to 32-bits currently, because I think it's unlikely to * need to be larger, the 32-bit limit for H5V_log2_of2(n), and @@ -55,6 +56,8 @@ * need to be larger, and its encoded with a maxiumum of 16-bits - QAK) */ #define H5HF_WIDTH_LIMIT (64 * 1024) +#endif /* NDEBUG */ + /******************/ /* Local Typedefs */ @@ -219,7 +222,7 @@ H5HF_hdr_finish_init_phase1(H5HF_hdr_t *hdr) HDassert(hdr); /* Compute/cache some values */ - hdr->heap_off_size = H5HF_SIZEOF_OFFSET_BITS(hdr->man_dtable.cparam.max_index); + hdr->heap_off_size = (uint8_t)H5HF_SIZEOF_OFFSET_BITS(hdr->man_dtable.cparam.max_index); if(H5HF_dtable_init(&hdr->man_dtable) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize doubling table info") diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index 60c6c9f..792a865 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -68,20 +68,12 @@ /* Local v2 B-tree operations */ static herr_t H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id); -/* v2 B-tree function callbacks (in H5HFbtree2.c) */ -H5_DLL herr_t H5HF_huge_bt2_indir_found(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_indir_remove(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_filt_indir_found(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_filt_indir_remove(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_dir_remove(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_filt_dir_found(const void *nrecord, void *op_data); -H5_DLL herr_t H5HF_huge_bt2_filt_dir_remove(const void *nrecord, void *op_data); - /* Local 'huge' object support routines */ static hsize_t H5HF_huge_new_id(H5HF_hdr_t *hdr); static herr_t H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, hbool_t is_read, H5HF_operator_t op, void *op_data); + /*********************/ /* Package Variables */ /*********************/ diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index c0fa1e4..8969aae 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -35,6 +35,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ #include "H5HFpkg.h" /* Fractal heaps */ #include "H5MFprivate.h" /* File memory management */ #include "H5Vprivate.h" /* Vectors and arrays */ diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 2997b3a..3fe3ad2 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -351,9 +351,9 @@ typedef struct H5HF_hdr_t { hbool_t huge_ids_direct; /* Flag to indicate that 'huge' object's offset & length are stored directly in heap ID */ size_t tiny_max_len; /* Max. size of tiny objects for this heap */ hbool_t tiny_len_extended; /* Flag to indicate that 'tiny' object's length is stored in extended form (i.e. w/extra byte) */ - unsigned char huge_id_size; /* Size of 'huge' heap IDs (in bytes) */ - unsigned char heap_off_size; /* Size of heap offsets (in bytes) */ - unsigned char heap_len_size; /* Size of heap ID lengths (in bytes) */ + uint8_t huge_id_size; /* Size of 'huge' heap IDs (in bytes) */ + uint8_t heap_off_size; /* Size of heap offsets (in bytes) */ + uint8_t heap_len_size; /* Size of heap ID lengths (in bytes) */ } H5HF_hdr_t; /* Common indirect block doubling table entry */ @@ -640,6 +640,15 @@ H5_DLL herr_t H5HF_huge_remove(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id) H5_DLL herr_t H5HF_huge_term(H5HF_hdr_t *hdr, hid_t dxpl_id); H5_DLL herr_t H5HF_huge_delete(H5HF_hdr_t *hdr, hid_t dxpl_id); +/* 'Huge' object v2 B-tree function callbacks */ +H5_DLL herr_t H5HF_huge_bt2_indir_found(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF_huge_bt2_indir_remove(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF_huge_bt2_filt_indir_found(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF_huge_bt2_filt_indir_remove(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF_huge_bt2_dir_remove(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF_huge_bt2_filt_dir_found(const void *nrecord, void *op_data); +H5_DLL herr_t H5HF_huge_bt2_filt_dir_remove(const void *nrecord, void *op_data); + /* 'Tiny' object routines */ H5_DLL herr_t H5HF_tiny_init(H5HF_hdr_t *hdr); H5_DLL herr_t H5HF_tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, @@ -186,20 +186,18 @@ H5HG_create (H5F_t *f, hid_t dxpl_id, size_t size) heap->addr = addr; heap->size = size; - if (NULL==(heap->chunk = H5FL_BLK_MALLOC (gheap_chunk,size))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, \ - "memory allocation failed"); + if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") #ifdef H5_CLEAR_MEMORY HDmemset(heap->chunk, 0, size); #endif /* H5_CLEAR_MEMORY */ - heap->nalloc = H5HG_NOBJS (f, size); + heap->nalloc = H5HG_NOBJS(f, size); heap->nused = 1; /* account for index 0, which is used for the free object */ - if (NULL==(heap->obj = H5FL_SEQ_MALLOC (H5HG_obj_t,heap->nalloc))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, \ - "memory allocation failed"); + if(NULL == (heap->obj = H5FL_SEQ_MALLOC(H5HG_obj_t, heap->nalloc))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") /* Initialize the header */ - HDmemcpy (heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC); + HDmemcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC); p = heap->chunk + H5_SIZEOF_MAGIC; *p++ = H5HG_VERSION; *p++ = 0; /*reserved*/ @@ -679,13 +677,6 @@ done: * Programmer: Robb Matzke * Monday, March 30, 1998 * - * Modifications: - * - * John Mainzer, 6/8/05 - * Modified the function to use the new dirtied parameter of - * of H5AC_unprotect() instead of modifying the is_dirty - * field of the cache info. - * *------------------------------------------------------------------------- */ void * diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 22374ce..f3d0f3a 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -173,7 +173,8 @@ H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1, nalloc = H5HG_NOBJS(f, heap->size); if(NULL == (heap->obj = H5FL_SEQ_MALLOC(H5HG_obj_t, nalloc))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - heap->obj[0].size = heap->obj[0].nrefs = 0; + heap->obj[0].nrefs = 0; + heap->obj[0].size = 0; heap->obj[0].begin = NULL; heap->nalloc = nalloc; @@ -378,11 +378,11 @@ H5HP_create(H5HP_type_t heap_type) done: /* Error cleanup */ - if(ret_value==NULL) { - if(new_heap!=NULL) { - if(new_heap->heap!=NULL) - H5FL_SEQ_FREE(H5HP_ent_t,new_heap->heap); - (void)H5FL_FREE(H5HP_t,new_heap); + if(NULL ==ret_value) { + if(NULL != new_heap) { + if(NULL != new_heap->heap) + new_heap->heap = H5FL_SEQ_FREE(H5HP_ent_t, new_heap->heap); + new_heap = H5FL_FREE(H5HP_t, new_heap); } /* end if */ } /* end if */ @@ -772,20 +772,20 @@ H5HP_incr(H5HP_t *heap, unsigned amt, void *_obj) assert(heap->heap[0].obj==NULL); /* Get the location of the object in the heap */ - obj_loc=obj->heap_loc; - assert(obj_loc>0 && obj_loc<=heap->nobjs); + obj_loc = obj->heap_loc; + assert(obj_loc > 0 && obj_loc <= heap->nobjs); /* Change the heap object's priority */ - heap->heap[obj_loc].val+=amt; + heap->heap[obj_loc].val += (int)amt; /* Restore heap condition */ - if(heap->type==H5HP_MAX_HEAP) { - if(H5HP_swim_max(heap,obj_loc)<0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); + if(H5HP_MAX_HEAP == heap->type) { + if(H5HP_swim_max(heap, obj_loc) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition") } /* end if */ else { - if(H5HP_sink_min(heap,obj_loc)<0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition"); + if(H5HP_sink_min(heap, obj_loc) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition") } /* end else */ done: @@ -910,10 +910,10 @@ H5HP_close(H5HP_t *heap) HDassert(NULL == heap->heap[0].obj); /* Free internal structures for heap */ - H5FL_SEQ_FREE(H5HP_ent_t, heap->heap); + heap->heap = H5FL_SEQ_FREE(H5HP_ent_t, heap->heap); /* Free actual heap object */ - (void)H5FL_FREE(H5HP_t, heap); + heap = H5FL_FREE(H5HP_t, heap); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HP_close() */ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 8637429..57414c7 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -482,7 +482,7 @@ H5L_extern_query(const char UNUSED * link_name, const void *_udata, size_t udata } /* end if */ /* Set return value */ - ret_value = udata_size; + ret_value = (ssize_t)udata_size; done: FUNC_LEAVE_NOAPI(ret_value) @@ -75,6 +75,10 @@ typedef enum { /* Local Prototypes */ /********************/ +/* Allocator routines */ +static herr_t H5MF_alloc_create(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); +static herr_t H5MF_alloc_close(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); + /*********************/ /* Package Variables */ @@ -195,11 +199,10 @@ H5MF_init_merge_flags(H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5MF_alloc_start + * Function: H5MF_alloc_open * - * Purpose: "Start up" free space for file - open existing free space - * structure if one exists, otherwise create a new free space - * structure + * Purpose: Open an existing free space manager of TYPE for file by + * creating a free-space structure * * Return: Success: non-negative * Failure: negative @@ -208,19 +211,112 @@ H5MF_init_merge_flags(H5F_t *f) * koziol@hdfgroup.org * Jan 8 2008 * - * Modifications: - * Vailin Choi, July 29th, 2008 - * Pass values of alignment and threshold to FS_create() for handling alignment - * *------------------------------------------------------------------------- */ herr_t -H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, hbool_t may_create) +H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) { const H5FS_section_class_t *classes[] = { /* Free space section classes implemented for file */ H5MF_FSPACE_SECT_CLS_SIMPLE}; herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_NOAPI_NOINIT(H5MF_alloc_open) + + /* + * Check arguments. + */ + HDassert(f); + HDassert(f->shared); + HDassert(H5F_addr_defined(f->shared->fs_addr[type])); + HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); + + /* Open an existing free space structure for the file */ + if(NULL == (f->shared->fs_man[type] = H5FS_open(f, dxpl_id, f->shared->fs_addr[type], + NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") + + /* Set the state for the free space manager to "open", if it is now */ + if(f->shared->fs_man[type]) + f->shared->fs_state[type] = H5F_FS_STATE_OPEN; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MF_alloc_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5MF_alloc_create + * + * Purpose: Create free space manager of TYPE for the file by creating + * a free-space structure + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jan 8 2008 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5MF_alloc_create(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) +{ + const H5FS_section_class_t *classes[] = { /* Free space section classes implemented for file */ + H5MF_FSPACE_SECT_CLS_SIMPLE}; + herr_t ret_value = SUCCEED; /* Return value */ + H5FS_create_t fs_create; /* Free space creation parameters */ + + FUNC_ENTER_NOAPI_NOINIT(H5MF_alloc_create) + + /* + * Check arguments. + */ + HDassert(f); + HDassert(f->shared); + HDassert(!H5F_addr_defined(f->shared->fs_addr[type])); + HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); + + /* Set the free space creation parameters */ + fs_create.client = H5FS_CLIENT_FILE_ID; + fs_create.shrink_percent = H5MF_FSPACE_SHRINK; + fs_create.expand_percent = H5MF_FSPACE_EXPAND; + fs_create.max_sect_addr = 1 + H5V_log2_gen((uint64_t)f->shared->maxaddr); + fs_create.max_sect_size = f->shared->maxaddr; + + if(NULL == (f->shared->fs_man[type] = H5FS_create(f, dxpl_id, NULL, + &fs_create, NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") + + + /* Set the state for the free space manager to "open", if it is now */ + if(f->shared->fs_man[type]) + f->shared->fs_state[type] = H5F_FS_STATE_OPEN; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MF_alloc_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5MF_alloc_start + * + * Purpose: Open or create a free space manager of a given type + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Jan 8 2008 + * + *------------------------------------------------------------------------- + */ +herr_t +H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) +{ + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_NOAPI_NOINIT(H5MF_alloc_start) /* @@ -229,50 +325,62 @@ H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, hbool_t may_create) HDassert(f); HDassert(f->shared); - /* Check for creating free space info for the file */ + /* Check if the free space manager exists already */ if(H5F_addr_defined(f->shared->fs_addr[type])) { - /* Open an existing free space structure for the file */ - HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); - if(NULL == (f->shared->fs_man[type] = H5FS_open(f, dxpl_id, f->shared->fs_addr[type], - NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") + /* Open existing free space manager */ + if(H5MF_alloc_open(f, dxpl_id, type) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTOPENOBJ, FAIL, "can't initialize file free space") } /* end if */ else { - /* Check if we are allowed to create the free space manager */ - if(may_create) { - H5FS_create_t fs_create; /* Free space creation parameters */ - - /* Set the free space creation parameters */ - fs_create.client = H5FS_CLIENT_FILE_ID; - fs_create.shrink_percent = H5MF_FSPACE_SHRINK; - fs_create.expand_percent = H5MF_FSPACE_EXPAND; - fs_create.max_sect_addr = 1 + H5V_log2_gen((uint64_t)f->shared->maxaddr); - fs_create.max_sect_size = f->shared->maxaddr; - - /* Create the free space structure for the heap */ - HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); -#ifdef LATER - if(NULL == (f->shared->fs_man[type] = H5FS_create(f, dxpl_id, &f->shared->fs_addr[type], - &fs_create, NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") -#else /* LATER */ - if(NULL == (f->shared->fs_man[type] = H5FS_create(f, dxpl_id, NULL, - &fs_create, NELMTS(classes), classes, f, f->shared->alignment, f->shared->threshold))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") -#endif /* LATER */ - } /* end if */ + /* Create new free space manager */ + if(H5MF_alloc_create(f, dxpl_id, type) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCREATE, FAIL, "can't initialize file free space") } /* end else */ - /* Set the state for the free space manager to "open", if it is now */ - if(f->shared->fs_man[type]) - f->shared->fs_state[type] = H5F_FS_STATE_OPEN; - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF_alloc_start() */ /*------------------------------------------------------------------------- + * Function: H5MF_alloc_close + * + * Purpose: Close an existing free space manager of TYPE for file + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; July 1st, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5MF_alloc_close(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5MF_alloc_close) + + /* + * Check arguments. + */ + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->fs_man[type]); + HDassert(f->shared->fs_state[type] != H5F_FS_STATE_CLOSED); + + /* Close an existing free space structure for the file */ + if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release free space info") + f->shared->fs_man[type] = NULL; + f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MF_alloc_close() */ + + +/*------------------------------------------------------------------------- * Function: H5MF_alloc * * Purpose: Allocate SIZE bytes of file memory and return the relative @@ -309,83 +417,75 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ /* Get free space type from allocation type */ fs_type = H5MF_ALLOC_TO_FS_TYPE(f, alloc_type); - /* Check if the free space manager for the file has been initialized */ - if(!f->shared->fs_man[fs_type]) - if(H5MF_alloc_start(f, dxpl_id, fs_type, FALSE) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize file free space") - - /* Search for large enough space in the free space manager */ - if(f->shared->fs_man[fs_type]) { - H5MF_free_section_t *node; /* Free space section pointer */ - htri_t node_found = FALSE; /* Whether an existing free list node was found */ - - /* Try to get a section from the free space manager */ - if((node_found = H5FS_sect_find(f, dxpl_id, f->shared->fs_man[fs_type], size, (H5FS_section_info_t **)&node)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "error locating free space in file") + /* Check if we are using the free space manager for this file */ + if(H5F_HAVE_FREE_SPACE_MANAGER(f)) { + /* Check if the free space manager for the file has been initialized */ + if(!f->shared->fs_man[fs_type] && H5F_addr_defined(f->shared->fs_addr[fs_type])) + if(H5MF_alloc_open(f, dxpl_id, fs_type) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTOPENOBJ, HADDR_UNDEF, "can't initialize file free space") + + /* Search for large enough space in the free space manager */ + if(f->shared->fs_man[fs_type]) { + H5MF_free_section_t *node; /* Free space section pointer */ + htri_t node_found = FALSE; /* Whether an existing free list node was found */ + + /* Try to get a section from the free space manager */ + if((node_found = H5FS_sect_find(f, dxpl_id, f->shared->fs_man[fs_type], size, (H5FS_section_info_t **)&node)) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "error locating free space in file") #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 1.5, node_found = %t\n", FUNC, node_found); #endif /* H5MF_ALLOC_DEBUG_MORE */ - /* Check for actually finding section */ - if(node_found) { - /* Sanity check */ - HDassert(node); + /* Check for actually finding section */ + if(node_found) { + /* Sanity check */ + HDassert(node); - /* Retrieve return value */ - ret_value = node->sect_info.addr; + /* Retrieve return value */ + ret_value = node->sect_info.addr; - /* Check for eliminating the section */ - if(node->sect_info.size == size) { + /* Check for eliminating the section */ + if(node->sect_info.size == size) { #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 1.6, freeing node\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ - /* Free section node */ - if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, HADDR_UNDEF, "can't free simple section node") - } /* end if */ - else { - H5MF_sect_ud_t udata; /* User data for callback */ + /* Free section node */ + if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, HADDR_UNDEF, "can't free simple section node") + } /* end if */ + else { + H5MF_sect_ud_t udata; /* User data for callback */ - /* Adjust information for section */ - node->sect_info.addr += size; - node->sect_info.size -= size; + /* Adjust information for section */ + node->sect_info.addr += size; + node->sect_info.size -= size; - /* Construct user data for callbacks */ - udata.f = f; - udata.dxpl_id = dxpl_id; - udata.alloc_type = alloc_type; - udata.allow_sect_absorb = TRUE; + /* Construct user data for callbacks */ + udata.f = f; + udata.dxpl_id = dxpl_id; + udata.alloc_type = alloc_type; + udata.allow_sect_absorb = TRUE; #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 1.7, re-adding node, node->sect_info.size = %Hu\n", FUNC, node->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ - /* Re-insert section node into file's free space */ - if(H5FS_sect_add(f, dxpl_id, f->shared->fs_man[fs_type], (H5FS_section_info_t *)node, H5FS_ADD_RETURNED_SPACE, &udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, HADDR_UNDEF, "can't re-add section to file free space") - } /* end else */ + /* Re-insert section node into file's free space */ + if(H5FS_sect_add(f, dxpl_id, f->shared->fs_man[fs_type], (H5FS_section_info_t *)node, H5FS_ADD_RETURNED_SPACE, &udata) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, HADDR_UNDEF, "can't re-add section to file free space") + } /* end else */ - /* Leave now */ - HGOTO_DONE(ret_value) + /* Leave now */ + HGOTO_DONE(ret_value) + } /* end if */ } /* end if */ - } /* end if */ #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 2.0\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ - - /* Couldn't find anything from the free space manager, go allocate some */ - if(alloc_type != H5FD_MEM_DRAW) { - /* Handle metadata differently from "raw" data */ - if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->meta_aggr), &(f->shared->sdata_aggr), alloc_type, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate metadata") } /* end if */ - else { - /* Allocate "raw" data */ - if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->sdata_aggr), &(f->shared->meta_aggr), alloc_type, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate raw data") - } /* end else */ - /* Sanity check for overlapping into file's temporary allocation space */ - HDassert(H5F_addr_le((ret_value + size), f->shared->tmp_addr)); + /* Allocate from the metadata aggregator (or the VFD) */ + if(HADDR_UNDEF == (ret_value = H5MF_aggr_vfd_alloc(f, alloc_type, dxpl_id, size))) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed from aggr/vfd") done: #ifdef H5MF_ALLOC_DEBUG @@ -394,6 +494,7 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF_sects_dump(f, dxpl_id, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF_alloc() */ @@ -531,23 +632,26 @@ HDfprintf(stderr, "%s: Trying to avoid starting up free space manager\n", FUNC); /* If we are deleting the free space manager, leave now, to avoid * [re-]starting it. + * or if file space strategy type is not using a free space manager + * (H5F_FILE_SPACE_AGGR_VFD or H5F_FILE_SPACE_VFD), drop free space + * section on the floor. * * Note: this drops the space to free on the floor... * */ - if(f->shared->fs_state[fs_type] == H5F_FS_STATE_DELETING) -{ + if(f->shared->fs_state[fs_type] == H5F_FS_STATE_DELETING || + !H5F_HAVE_FREE_SPACE_MANAGER(f)) { #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, addr, size); #endif /* H5MF_ALLOC_DEBUG_MORE */ HGOTO_DONE(SUCCEED) -} + } /* end if */ /* There's either already a free space manager, or the freed * space isn't at the end of the file, so start up (or create) * the file space manager */ - if(H5MF_alloc_start(f, dxpl_id, fs_type, TRUE) < 0) + if(H5MF_alloc_start(f, dxpl_id, fs_type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") } /* end if */ HDassert(f->shared->fs_man[fs_type]); @@ -568,14 +672,14 @@ HDfprintf(stderr, "%s: Before H5FS_sect_add()\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ if(H5FS_sect_add(f, dxpl_id, f->shared->fs_man[fs_type], (H5FS_section_info_t *)node, H5FS_ADD_RETURNED_SPACE, &udata) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't add section to file free space") + node = NULL; #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: After H5FS_sect_add()\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ - node = NULL; done: - if(ret_value < 0 && node) - /* On error, free section node allocated */ + /* Release section node, if allocated and not added to section list or merged */ + if(node) if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") @@ -635,8 +739,8 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r fs_type = H5MF_ALLOC_TO_FS_TYPE(f, alloc_type); /* Check if the free space for the file has been initialized */ - if(!f->shared->fs_man[fs_type]) - if(H5MF_alloc_start(f, dxpl_id, fs_type, FALSE) < 0) + if(!f->shared->fs_man[fs_type] && H5F_addr_defined(f->shared->fs_addr[fs_type])) + if(H5MF_alloc_open(f, dxpl_id, fs_type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") /* Check for test block able to block in free space manager */ @@ -670,8 +774,8 @@ H5MF_sects_dump(f, dxpl_id, stderr); * *------------------------------------------------------------------------- */ -hssize_t -H5MF_get_freespace(H5F_t *f, hid_t dxpl_id) +herr_t +H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, hsize_t *meta_size) { haddr_t eoa; /* End of allocated space in the file */ haddr_t ma_addr = HADDR_UNDEF; /* Base "metadata aggregator" address */ @@ -679,8 +783,9 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id) haddr_t sda_addr = HADDR_UNDEF; /* Base "small data aggregator" address */ hsize_t sda_size = 0; /* Size of "small data aggregator" */ hsize_t tot_fs_size = 0; /* Amount of all free space managed */ + hsize_t tot_meta_size = 0; /* Amount of metadata for free space managers */ H5FD_mem_t type; /* Memory type for iteration */ - hssize_t ret_value; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5MF_get_freespace, FAIL) @@ -694,38 +799,53 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") /* Retrieve metadata aggregator info, if available */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") /* Retrieve 'small data' aggregator info, if available */ - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size); + if(H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") /* Iterate over all the free space types that have managers and get each free list's space */ for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { - hsize_t type_fs_size = 0; /* Amount of free space managed for each type */ + hbool_t fs_started = FALSE; - /* Check if the free space for the file has been initialized */ - if(!f->shared->fs_man[type]) - if(H5MF_alloc_start(f, dxpl_id, type, FALSE) < 0) + /* Check if the free space for the file has been initialized */ + if(!f->shared->fs_man[type] && H5F_addr_defined(f->shared->fs_addr[type])) { + if(H5MF_alloc_open(f, dxpl_id, type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") + HDassert(f->shared->fs_man[type]); + fs_started = TRUE; + } /* end if */ - /* Retrieve free space size from free space manager */ - if(f->shared->fs_man[type]) - if((ret_value = H5FS_sect_stats(f->shared->fs_man[type], &type_fs_size, NULL)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space stats") + /* Check if there's free space of this type */ + if(f->shared->fs_man[type]) { + hsize_t type_fs_size = 0; /* Amount of free space managed for each type */ + hsize_t type_meta_size = 0; /* Amount of free space metadata for each type */ - /* Increment total free space for types */ - tot_fs_size += type_fs_size; + /* Retrieve free space size from free space manager */ + if(H5FS_sect_stats(f->shared->fs_man[type], &type_fs_size, NULL) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space stats") + if(H5FS_size(f, f->shared->fs_man[type], &type_meta_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space metadata stats") + + /* Increment total free space for types */ + tot_fs_size += type_fs_size; + tot_meta_size += type_meta_size; + } /* end if */ + + /* Close the free space manager, if we opened it here */ + if(fs_started) + if(H5MF_alloc_close(f, dxpl_id, type) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't close file free space") } /* end for */ - /* Start computing value to return */ - ret_value = tot_fs_size; - /* Check for aggregating metadata allocations */ if(ma_size > 0) { /* Add in the reserved space for metadata to the available free space */ /* (if it's not at the tail of the file) */ if(H5F_addr_ne(ma_addr + ma_size, eoa)) - ret_value += ma_size; + tot_fs_size += ma_size; } /* end if */ /* Check for aggregating small data allocations */ @@ -733,9 +853,15 @@ H5MF_get_freespace(H5F_t *f, hid_t dxpl_id) /* Add in the reserved space for metadata to the available free space */ /* (if it's not at the tail of the file) */ if(H5F_addr_ne(sda_addr + sda_size, eoa)) - ret_value += sda_size; + tot_fs_size += sda_size; } /* end if */ + /* Set the value(s) to return */ + if(tot_space) + *tot_space = tot_fs_size; + if(meta_size) + *meta_size = tot_meta_size; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF_get_freespace() */ @@ -807,6 +933,74 @@ HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); /*------------------------------------------------------------------------- + * Function: H5MF_free_aggrs + * + * Purpose: Reset a block aggregator, returning any space back to file + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi + * July 1st, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5MF_free_aggrs(H5F_t *f, hid_t dxpl_id) +{ + H5F_blk_aggr_t *first_aggr; /* First aggregator to reset */ + H5F_blk_aggr_t *second_aggr; /* Second aggregator to reset */ + haddr_t ma_addr = HADDR_UNDEF; /* Base "metadata aggregator" address */ + hsize_t ma_size = 0; /* Size of "metadata aggregator" */ + haddr_t sda_addr = HADDR_UNDEF; /* Base "small data aggregator" address */ + hsize_t sda_size = 0; /* Size of "small data aggregator" */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5MF_free_aggrs, FAIL) + + /* Check args */ + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->lf); + + /* Retrieve metadata aggregator info, if available */ + if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") + + /* Retrieve 'small data' aggregator info, if available */ + if(H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") + + /* Make certain we release the aggregator that's later in the file first */ + /* (so the file shrinks properly) */ + if(H5F_addr_defined(ma_addr) && H5F_addr_defined(sda_addr)) { + if(H5F_addr_lt(ma_addr, sda_addr)) { + first_aggr = &(f->shared->sdata_aggr); + second_aggr = &(f->shared->meta_aggr); + } /* end if */ + else { + first_aggr = &(f->shared->meta_aggr); + second_aggr = &(f->shared->sdata_aggr); + } /* end else */ + } /* end if */ + else { + first_aggr = &(f->shared->meta_aggr); + second_aggr = &(f->shared->sdata_aggr); + } /* end else */ + + /* Release the unused portion of the metadata and "small data" blocks back + * to the free lists in the file. + */ + if(H5MF_aggr_reset(f, dxpl_id, first_aggr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't reset metadata block") + if(H5MF_aggr_reset(f, dxpl_id, second_aggr) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't reset 'small data' block") +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MF_free_aggrs() */ + + +/*------------------------------------------------------------------------- * Function: H5MF_close * * Purpose: Close the free space tracker(s) for a file @@ -822,12 +1016,6 @@ herr_t H5MF_close(H5F_t *f, hid_t dxpl_id) { H5FD_mem_t type; /* Memory type for iteration */ - H5F_blk_aggr_t *first_aggr; /* First aggregator to reset */ - H5F_blk_aggr_t *second_aggr; /* Second aggregator to reset */ - haddr_t ma_addr = HADDR_UNDEF; /* Base "metadata aggregator" address */ - hsize_t ma_size = 0; /* Size of "metadata aggregator" */ - haddr_t sda_addr = HADDR_UNDEF; /* Base "small data aggregator" address */ - hsize_t sda_size = 0; /* Size of "small data aggregator" */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5MF_close, FAIL) @@ -851,7 +1039,7 @@ HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_add HDfprintf(stderr, "%s: Before closing free space manager\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ if(H5FS_close(f, dxpl_id, f->shared->fs_man[type]) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release free space info") f->shared->fs_man[type] = NULL; f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; } /* end if */ @@ -878,8 +1066,8 @@ HDfprintf(stderr, "%s: Check 2.0 - f->shared->fs_man[%u] = %p, f->shared->fs_add HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Delete free space manager for this type */ - if(H5FS_delete(f, dxpl_id, tmp_fs_addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't delete free space manager") + if(H5FS_delete(f, dxpl_id, tmp_fs_addr) < 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't delete free space manager") /* Shift [back] to closed state */ HDassert(f->shared->fs_state[type] == H5F_FS_STATE_DELETING); @@ -890,42 +1078,8 @@ HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC); } /* end if */ } /* end for */ - /* Retrieve metadata aggregator info, if available */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); -#ifdef H5MF_ALLOC_DEBUG_MORE -HDfprintf(stderr, "%s: ma_addr = %a, ma_size = %Hu, end of ma = %a\n", FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); -#endif /* H5MF_ALLOC_DEBUG_MORE */ - - /* Retrieve 'small data' aggregator info, if available */ - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size); -#ifdef H5MF_ALLOC_DEBUG_MORE -HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); -#endif /* H5MF_ALLOC_DEBUG_MORE */ - - /* Make certain we release the aggregator that's later in the file first */ - /* (so the file shrinks properly) */ - if(H5F_addr_defined(ma_addr) && H5F_addr_defined(sda_addr)) { - if(H5F_addr_lt(ma_addr, sda_addr)) { - first_aggr = &(f->shared->sdata_aggr); - second_aggr = &(f->shared->meta_aggr); - } /* end if */ - else { - first_aggr = &(f->shared->meta_aggr); - second_aggr = &(f->shared->sdata_aggr); - } /* end else */ - } /* end if */ - else { - first_aggr = &(f->shared->meta_aggr); - second_aggr = &(f->shared->sdata_aggr); - } /* end else */ - - /* Release the unused portion of the metadata and "small data" blocks back - * to the free lists in the file. - */ - if(H5MF_aggr_reset(f, dxpl_id, first_aggr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't reset metadata block") - if(H5MF_aggr_reset(f, dxpl_id, second_aggr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't reset 'small data' block") + if(H5MF_free_aggrs(f, dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't free aggregators") done: #ifdef H5MF_ALLOC_DEBUG diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index 0f8a374..0526ef2 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -75,6 +75,66 @@ /*------------------------------------------------------------------------- + * Function: H5MF_aggr_vfd_alloc + * + * Purpose: Allocate SIZE bytes of file memory via H5MF_aggr_alloc() + * and return the relative address where that contiguous chunk + * of file memory exists. + * The TYPE argument describes the purpose for which the storage + * is being requested. + * + * Return: Success: The file address of new chunk. + * Failure: HADDR_UNDEF + * + * Programmer: Vailin Choi; July 1st, 2009 + * (The coding is from H5MF_alloc().) + * + *------------------------------------------------------------------------- + */ +haddr_t +H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size) +{ + haddr_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5MF_aggr_vfd_alloc, HADDR_UNDEF) +#ifdef H5MF_ALLOC_DEBUG +HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); +#endif /* H5MF_ALLOC_DEBUG */ + + /* check arguments */ + HDassert(f); + HDassert(f->shared); + HDassert(f->shared->lf); + HDassert(size > 0); + + /* Couldn't find anything from the free space manager, go allocate some */ + if(alloc_type != H5FD_MEM_DRAW) { + /* Handle metadata differently from "raw" data */ + if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->meta_aggr), &(f->shared->sdata_aggr), alloc_type, size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate metadata") + } /* end if */ + else { + /* Allocate "raw" data */ + if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->sdata_aggr), &(f->shared->meta_aggr), alloc_type, size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate raw data") + } /* end else */ + + /* Sanity check for overlapping into file's temporary allocation space */ + HDassert(H5F_addr_le((ret_value + size), f->shared->tmp_addr)); + +done: +#ifdef H5MF_ALLOC_DEBUG +HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); +#endif /* H5MF_ALLOC_DEBUG */ +#ifdef H5MF_ALLOC_DEBUG_DUMP +H5MF_sects_dump(f, dxpl_id, stderr); +#endif /* H5MF_ALLOC_DEBUG_DUMP */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5MF_aggr_vfd_alloc() */ + + +/*------------------------------------------------------------------------- * Function: H5MF_aggr_alloc * * Purpose: Try to allocate SIZE bytes of memory from an aggregator @@ -86,10 +146,6 @@ * Programmer: Quincey Koziol * Thursday, December 13, 2007 * - * Modifications: - * Vailin Choi, July 29th, 2008 - * The whole routine is modified to handle alignment - * *------------------------------------------------------------------------- */ haddr_t @@ -133,13 +189,13 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz #endif /* H5MF_AGGR_DEBUG */ alignment = f->shared->alignment; - if (!((alignment > 1) && (size >= f->shared->threshold))) + if(!((alignment > 1) && (size >= f->shared->threshold))) alignment = 0; /* no alignment */ - if (alignment && aggr->addr > 0 && aggr->size > 0 && (mis_align = aggr->addr % alignment)) { + if(alignment && aggr->addr > 0 && aggr->size > 0 && (mis_align = aggr->addr % alignment)) { frag_addr = aggr->addr; frag_size = alignment - mis_align; - } + } /* end if */ alloc_type = aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW; other_alloc_type = other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW; @@ -155,7 +211,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") - if ((aggr->addr > 0) && (extended=H5FD_try_extend(f->shared->lf, alloc_type, aggr->addr + aggr->size, ext_size)) < 0) + if ((aggr->addr > 0) && (extended = H5FD_try_extend(f->shared->lf, alloc_type, aggr->addr + aggr->size, ext_size)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") else if (extended) { /* aggr->size is unchanged */ @@ -176,7 +232,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz other_aggr->addr = 0; other_aggr->tot_size = 0; other_aggr->size = 0; - } + } /* end if */ if(HADDR_UNDEF == (new_space = H5FD_alloc(f->shared->lf, dxpl_id, type, size, &eoa_frag_addr, &eoa_frag_size))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block") @@ -193,14 +249,14 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz HDfprintf(stderr, "%s: Allocating block\n", FUNC); #endif /* H5MF_AGGR_DEBUG */ - if (frag_size > (ext_size - size)) + if(frag_size > (ext_size - size)) ext_size += (frag_size - (ext_size - size)); /* Check for overlapping into file's temporary allocation space */ if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") - if ((aggr->addr > 0) && (extended = H5FD_try_extend(f->shared->lf, alloc_type, aggr->addr + aggr->size, ext_size)) < 0) + if((aggr->addr > 0) && (extended = H5FD_try_extend(f->shared->lf, alloc_type, aggr->addr + aggr->size, ext_size)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") else if (extended) { aggr->addr += frag_size; @@ -211,7 +267,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); if(H5F_addr_gt((eoa + aggr->alloc_size), f->shared->tmp_addr)) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") - if ((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && + if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { if(H5FD_free(f->shared->lf, dxpl_id, other_alloc_type, other_aggr->addr, other_aggr->size) < 0) @@ -219,7 +275,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); other_aggr->addr = 0; other_aggr->tot_size = 0; other_aggr->size = 0; - } + } /* end if */ if(HADDR_UNDEF == (new_space = H5FD_alloc(f->shared->lf, dxpl_id, alloc_type, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate aggregation block") @@ -233,7 +289,6 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); aggr->addr = new_space; aggr->size = aggr->alloc_size; aggr->tot_size = aggr->alloc_size; - } /* end else */ /* Allocate space out of the metadata block */ @@ -243,12 +298,12 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); } /* end else */ /* freeing any possible fragment due to file allocation */ - if (eoa_frag_size) + if(eoa_frag_size) if(H5MF_xfree(f, type, dxpl_id, eoa_frag_addr, eoa_frag_size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") /* freeing any possible fragment due to alignment in the block after extension */ - if (extended && frag_size) + if(extended && frag_size) if(H5MF_xfree(f, type, dxpl_id, frag_addr, frag_size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") } /* end if */ @@ -262,7 +317,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); if (frag_size) if(H5MF_xfree(f, type, dxpl_id, frag_addr, frag_size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") - } + } /* end else */ } /* end if */ else { /* Check for overlapping into file's temporary allocation space */ @@ -272,7 +327,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); /* Allocate data from the file */ if(HADDR_UNDEF == (ret_value = H5FD_alloc(f->shared->lf, dxpl_id, type, size, &eoa_frag_addr, &eoa_frag_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") - if (eoa_frag_size) + if(eoa_frag_size) if(H5MF_xfree(f, type, dxpl_id, eoa_frag_addr, eoa_frag_size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") } /* end else */ @@ -426,7 +481,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5MF_aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect, +H5MF_aggr_absorb(const H5F_t UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect, hbool_t allow_sect_absorb) { FUNC_ENTER_NOAPI_NOFUNC(H5MF_aggr_absorb) @@ -549,7 +604,7 @@ herr_t H5MF_aggr_reset(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr) { H5FD_mem_t alloc_type; /* Type of file memory to work with */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5MF_aggr_reset, FAIL) diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index 0e69fd0..de63f56 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -142,8 +142,8 @@ H5_DLLVAR H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1]; /******************************/ /* Allocator routines */ -H5_DLL herr_t H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, - hbool_t may_create); +H5_DLL herr_t H5MF_alloc_open(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); +H5_DLL herr_t H5MF_alloc_start(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type); H5_DLL herr_t H5MF_sects_dump(H5F_t *f, hid_t dxpl_id, FILE *stream); /* 'simple' section routines */ diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 4508199..515fed8 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -60,11 +60,13 @@ /* File space manager routines */ H5_DLL herr_t H5MF_init_merge_flags(H5F_t *f); -H5_DLL hssize_t H5MF_get_freespace(H5F_t *f, hid_t dxpl_id); +H5_DLL herr_t H5MF_get_freespace(H5F_t *f, hid_t dxpl_id, hsize_t *tot_space, + hsize_t *meta_size); H5_DLL herr_t H5MF_close(H5F_t *f, hid_t dxpl_id); /* File space allocation routines */ H5_DLL haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); +H5_DLL haddr_t H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); H5_DLL herr_t H5MF_try_extend(H5F_t *f, hid_t dxpl_id, H5FD_mem_t type, diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 200195a..0dc43c3 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -528,4 +528,3 @@ done: FUNC_LEAVE_NOAPI((H5FS_section_info_t *)ret_value) } /* end H5MF_sect_simple_split() */ - @@ -1450,11 +1450,12 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags) *oh_flags = H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; } /* end else */ } /* end if */ - } else { + } /* end if */ + else { /* A new object, or one that will be deleted */ - if(oh->nlink == 0) { - /* Check if the object is current open, but marked for deletion */ - if(H5FO_marked(f, addr) > 0) { + if(0 == oh->nlink) { + /* Check if the object is currently open, but marked for deletion */ + if(H5FO_marked(f, addr)) { /* Remove "delete me" flag on the object */ if(H5FO_mark(f, addr, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't mark object for deletion") @@ -1497,7 +1498,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags) } /* end if */ /* Set return value */ - ret_value = oh->nlink; + ret_value = (int)oh->nlink; done: FUNC_LEAVE_NOAPI(ret_value); @@ -2935,5 +2936,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_visit() */ - - diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 6eac264..bfc6908 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -163,7 +163,7 @@ H5O_add_gap(H5O_t *oh, unsigned chunkno, unsigned idx, /* Check if we need to extend message table to hold the new null message */ if(oh->nmesgs >= oh->alloc_nmesgs) if(H5O_alloc_msgs(oh, (size_t)1) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "can't allocate more space for messages") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* Increment new gap size */ oh->chunk[chunkno].gap += new_gap_size; @@ -329,7 +329,7 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type, /* Add the gap to the chunk */ if(H5O_add_gap(oh, alloc_msg->chunkno, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, UFAIL, "can't insert gap in chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") } /* end if */ else { size_t new_mesg_size = new_size + H5O_SIZEOF_MSGHDR_OH(oh); /* Total size of newly allocated message */ @@ -338,7 +338,7 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type, /* Check if we need to extend message table to hold the new null message */ if(oh->nmesgs >= oh->alloc_nmesgs) { if(H5O_alloc_msgs(oh, (size_t)1) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "can't allocate more space for messages") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") /* "Retarget" 'alloc_msg' pointer into newly re-allocated array of messages */ alloc_msg = &oh->mesg[null_idx]; @@ -361,7 +361,7 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type, if(H5O_eliminate_gap(oh, null_msg, ((oh->chunk[null_chunkno].image + oh->chunk[null_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[null_chunkno].gap)), oh->chunk[null_chunkno].gap) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, UFAIL, "can't eliminate gap in chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") /* Set the gap size to zero for the chunk */ oh->chunk[null_chunkno].gap = 0; diff --git a/src/H5Ocache.c b/src/H5Ocache.c index d396896..c0c1bfa 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -509,7 +509,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, HDassert(nullcnt == 0); /* Set gap information for chunk */ - oh->chunk[chunkno].gap = (eom_ptr - p); + oh->chunk[chunkno].gap = (size_t)(eom_ptr - p); /* Increment location in chunk */ p += oh->chunk[chunkno].gap; diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 2926c6b..807d147 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -543,7 +543,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, /* Check if the chunk's data portion is too small */ dst_oh_gap = dst_oh_null = 0; if(dst_oh_size < H5O_MIN_SIZE) { - size_t delta = (H5O_MIN_SIZE - dst_oh_size); /* Delta in chunk size needed */ + size_t delta = (size_t)(H5O_MIN_SIZE - dst_oh_size); /* Delta in chunk size needed */ /* Sanity check */ HDassert((oh_dst->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_1); diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 83dbabc..a9812690 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -579,8 +579,8 @@ done: if(ret_value < 0) { if(dt != NULL) { if(dt->shared != NULL) - H5FL_FREE(H5T_shared_t, dt->shared); - H5FL_FREE(H5T_t, dt); + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); + dt = H5FL_FREE(H5T_t, dt); } /* end if */ } /* end if */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index fb4578f..d96f30a 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -67,9 +67,9 @@ * layout is first in the union. These values are overridden in the * H5P_init_def_layout() routine. -QAK */ -#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, H5D_LOPS_COMPACT, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG}} -#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, H5D_LOPS_CONTIG, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG}} -#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, H5D_LOPS_CHUNK, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG}} +#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} +#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} +#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} #endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ /* ======== Dataset creation properties ======== */ @@ -772,7 +772,6 @@ done: static herr_t H5P_init_def_layout(void) { - const H5O_layout_compact_t def_layout_compact = H5D_DEF_LAYOUT_COMPACT_INIT; const H5O_layout_chunk_t def_layout_chunk = H5D_DEF_LAYOUT_CHUNK_INIT; const H5O_storage_compact_t def_store_compact = H5D_DEF_STORAGE_COMPACT_INIT; const H5O_storage_chunk_t def_store_chunk = H5D_DEF_STORAGE_CHUNK_INIT; @@ -780,9 +779,8 @@ H5P_init_def_layout(void) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_init_def_layout) /* Initialize the default layout info for non-contigous layouts */ - H5D_def_layout_compact_g.u.compact = def_layout_compact; H5D_def_layout_compact_g.storage.u.compact = def_store_compact; - H5D_def_layout_chunk_g.u.chunk = def_chunk; + H5D_def_layout_chunk_g.u.chunk = def_layout_chunk; H5D_def_layout_chunk_g.storage.u.chunk = def_store_chunk; /* Note that we've initialized the default values */ diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index a7956e7..4d576c6 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -758,15 +758,15 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_ /* Check arguments */ if(mesg_type_flags > H5O_SHMESG_ALL_FLAG) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unrecognized flags in mesg_type_flags"); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unrecognized flags in mesg_type_flags") /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Read the current number of indexes */ if(H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes") /* Range check */ if(index_num >= nindexes) @@ -784,9 +784,9 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_ /* Write arrays back to plist */ if(H5P_set(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set index type flags"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set index type flags") if(H5P_set(plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set min mesg sizes"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set min mesg sizes") done: FUNC_LEAVE_API(ret_value) @@ -845,7 +845,7 @@ H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type done: FUNC_LEAVE_API(ret_value); -} +} /* end H5Pset_shared_mesg_index() */ /*------------------------------------------------------------------------- @@ -905,7 +905,7 @@ H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_ done: FUNC_LEAVE_API(ret_value); -} +} /* end H5Pset_shared_mesg_phase_change() */ /*------------------------------------------------------------------------- @@ -946,5 +946,5 @@ H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list, unsigned *mi done: FUNC_LEAVE_API(ret_value); -} +} /* end H5Pget_shared_mesg_phase_change() */ diff --git a/src/H5config.h.in b/src/H5config.h.in index 8ac19fc..5877c6d 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -1,5 +1,8 @@ /* src/H5config.h.in. Generated from configure.in by autoheader. */ +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + /* Define if your system generates wrong code for log2 routine. */ #undef BAD_LOG2_CODE_GENERATED @@ -298,7 +301,7 @@ /* Define if `struct timezone' is defined */ #undef HAVE_STRUCT_TIMEZONE -/* Define to 1 if `tm_zone' is member of `struct tm'. */ +/* Define to 1 if `struct tm' is a member of `tm_zone'. */ #undef HAVE_STRUCT_TM_TM_ZONE /* Define if `struct videoconfig' is defined */ @@ -470,6 +473,9 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME +/* Define to the home page for this package. */ +#undef PACKAGE_URL + /* Define to the version of this package. */ #undef PACKAGE_VERSION @@ -639,9 +645,17 @@ /* Check exception handling functions during data conversions */ #undef WANT_DCONV_EXCEPTION -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/src/H5public.h b/src/H5public.h index e49d644..fddb903 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -71,10 +71,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 44 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 45 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "FA_a3" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.44-FA_a3" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.45-FA_a3" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index b6c0ac0..1afd985 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.10.2 from Makefile.am. +# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -36,8 +37,9 @@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c @@ -67,15 +69,30 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs CONFIG_HEADER = H5config.h CONFIG_CLEAN_FILES = libhdf5.settings +CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(settingsdir)" \ "$(DESTDIR)$(includedir)" -libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) libhdf5_la_LIBADD = am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ @@ -143,6 +160,7 @@ H5detect_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/bin/depcomp am__depfiles_maybe = depfiles +am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ @@ -154,12 +172,12 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(libhdf5_la_SOURCES) H5detect.c DIST_SOURCES = $(libhdf5_la_SOURCES) H5detect.c -settingsDATA_INSTALL = $(INSTALL_DATA) DATA = $(settings_DATA) -includeHEADERS_INSTALL = $(INSTALL_HEADER) HEADERS = $(include_HEADERS) ETAGS = etags CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = /home1/packages/automake/automake-1.9.6/bin/aclocal-1.9 -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@ @@ -274,6 +292,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ PATH_SEPARATOR = @PATH_SEPARATOR@ @@ -365,6 +384,7 @@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @@ -413,7 +433,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 34 +LT_VERS_REVISION = 35 LT_VERS_AGE = 0 H5detect_CFLAGS = -g @@ -540,9 +560,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -560,6 +580,7 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): H5config.h: stamp-h1 @if test ! -f $@; then \ @@ -571,7 +592,7 @@ stamp-h1: $(srcdir)/H5config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/H5config.h $(srcdir)/H5config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_srcdir) && $(AUTOHEADER) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ @@ -582,20 +603,24 @@ libhdf5.settings: $(top_builddir)/config.status $(srcdir)/libhdf5.settings.in install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + list2="$$list2 $$p"; \ else :; fi; \ - done + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: @@ -610,11 +635,13 @@ libhdf5.la: $(libhdf5_la_OBJECTS) $(libhdf5_la_DEPENDENCIES) $(libhdf5_la_LINK) -rpath $(libdir) $(libhdf5_la_OBJECTS) $(libhdf5_la_LIBADD) $(LIBS) clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list H5detect$(EXEEXT): $(H5detect_OBJECTS) $(H5detect_DEPENDENCIES) @rm -f H5detect$(EXEEXT) $(H5detect_LINK) $(H5detect_OBJECTS) $(H5detect_LDADD) $(LIBS) @@ -881,35 +908,35 @@ distclean-compile: .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< H5detect-H5detect.o: H5detect.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -MT H5detect-H5detect.o -MD -MP -MF $(DEPDIR)/H5detect-H5detect.Tpo -c -o H5detect-H5detect.o `test -f 'H5detect.c' || echo '$(srcdir)/'`H5detect.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/H5detect-H5detect.Tpo $(DEPDIR)/H5detect-H5detect.Po +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/H5detect-H5detect.Tpo $(DEPDIR)/H5detect-H5detect.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='H5detect.c' object='H5detect-H5detect.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -c -o H5detect-H5detect.o `test -f 'H5detect.c' || echo '$(srcdir)/'`H5detect.c H5detect-H5detect.obj: H5detect.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -MT H5detect-H5detect.obj -MD -MP -MF $(DEPDIR)/H5detect-H5detect.Tpo -c -o H5detect-H5detect.obj `if test -f 'H5detect.c'; then $(CYGPATH_W) 'H5detect.c'; else $(CYGPATH_W) '$(srcdir)/H5detect.c'; fi` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/H5detect-H5detect.Tpo $(DEPDIR)/H5detect-H5detect.Po +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/H5detect-H5detect.Tpo $(DEPDIR)/H5detect-H5detect.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='H5detect.c' object='H5detect-H5detect.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(H5detect_CFLAGS) $(CFLAGS) -c -o H5detect-H5detect.obj `if test -f 'H5detect.c'; then $(CYGPATH_W) 'H5detect.c'; else $(CYGPATH_W) '$(srcdir)/H5detect.c'; fi` @@ -922,37 +949,43 @@ clean-libtool: install-settingsDATA: $(settings_DATA) @$(NORMAL_INSTALL) test -z "$(settingsdir)" || $(MKDIR_P) "$(DESTDIR)$(settingsdir)" - @list='$(settings_DATA)'; for p in $$list; do \ + @list='$(settings_DATA)'; test -n "$(settingsdir)" || list=; \ + for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(settingsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(settingsdir)/$$f'"; \ - $(settingsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(settingsdir)/$$f"; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(settingsdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(settingsdir)" || exit $$?; \ done uninstall-settingsDATA: @$(NORMAL_UNINSTALL) - @list='$(settings_DATA)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(settingsdir)/$$f'"; \ - rm -f "$(DESTDIR)$(settingsdir)/$$f"; \ - done + @list='$(settings_DATA)'; test -n "$(settingsdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(settingsdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(settingsdir)" && rm -f $$files install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" - @list='$(include_HEADERS)'; for p in $$list; do \ + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \ - $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) - @list='$(include_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \ - rm -f "$(DESTDIR)$(includedir)/$$f"; \ - done + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -966,7 +999,7 @@ tags: TAGS TAGS: $(HEADERS) $(SOURCES) H5config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ + set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) H5config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -974,29 +1007,34 @@ TAGS: $(HEADERS) $(SOURCES) H5config.h.in $(TAGS_DEPENDENCIES) \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) H5config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ list='$(SOURCES) $(HEADERS) H5config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -1017,13 +1055,17 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @@ -1057,6 +1099,7 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @@ -1079,6 +1122,8 @@ dvi-am: html: html-am +html-am: + info: info-am info-am: @@ -1087,18 +1132,28 @@ install-data-am: install-includeHEADERS install-settingsDATA install-dvi: install-dvi-am +install-dvi-am: + install-exec-am: install-libLTLIBRARIES install-html: install-html-am +install-html-am: + install-info: install-info-am +install-info-am: + install-man: install-pdf: install-pdf-am +install-pdf-am: + install-ps: install-ps-am +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am @@ -1122,7 +1177,7 @@ ps-am: uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \ uninstall-settingsDATA -.MAKE: install-am install-strip +.MAKE: all check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ clean clean-generic clean-libLTLIBRARIES clean-libtool \ @@ -1406,6 +1461,7 @@ check-vfd: $(LIB) $(PROGS) $(TESTS) HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check || exit 1; \ fi; \ done + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: |