diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-11-11 01:40:30 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-11-11 01:40:30 (GMT) |
commit | 4fd41c74e58263080ed83b0e11b3e85e2b58978c (patch) | |
tree | d208e127093768057e4b28d2ff1c1b6b689bb051 /src | |
parent | 17cfef32a08427adc37749000f6a098301e68a73 (diff) | |
download | hdf5-4fd41c74e58263080ed83b0e11b3e85e2b58978c.zip hdf5-4fd41c74e58263080ed83b0e11b3e85e2b58978c.tar.gz hdf5-4fd41c74e58263080ed83b0e11b3e85e2b58978c.tar.bz2 |
[svn-r11707] Purpose:
Code maintenance
Description:
Check in outstanding changes from object copy to keep 1.6 branch as much
in sync w/development branch as possible.
Platforms tested:
FreeBSD 4.11 (sleipnir)
h5committest
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Apkg.h | 7 | ||||
-rw-r--r-- | src/H5B.c | 450 | ||||
-rw-r--r-- | src/H5Bpkg.h | 23 | ||||
-rw-r--r-- | src/H5Bprivate.h | 42 | ||||
-rw-r--r-- | src/H5D.c | 286 | ||||
-rw-r--r-- | src/H5Distore.c | 651 | ||||
-rw-r--r-- | src/H5Dpublic.h | 40 | ||||
-rw-r--r-- | src/H5G.c | 7 | ||||
-rw-r--r-- | src/H5Gnode.c | 36 | ||||
-rw-r--r-- | src/H5Gpkg.h | 4 | ||||
-rw-r--r-- | src/H5Gpublic.h | 4 | ||||
-rw-r--r-- | src/H5O.c | 239 | ||||
-rw-r--r-- | src/H5Oattr.c | 8 | ||||
-rw-r--r-- | src/H5Obogus.c | 2 | ||||
-rw-r--r-- | src/H5Ocont.c | 2 | ||||
-rw-r--r-- | src/H5Odtype.c | 2 | ||||
-rw-r--r-- | src/H5Oefl.c | 2 | ||||
-rw-r--r-- | src/H5Ofill.c | 4 | ||||
-rw-r--r-- | src/H5Olayout.c | 16 | ||||
-rw-r--r-- | src/H5Omtime.c | 4 | ||||
-rw-r--r-- | src/H5Oname.c | 3 | ||||
-rw-r--r-- | src/H5Onull.c | 2 | ||||
-rw-r--r-- | src/H5Opkg.h | 4 | ||||
-rw-r--r-- | src/H5Opline.c | 2 | ||||
-rw-r--r-- | src/H5Oprivate.h | 12 | ||||
-rw-r--r-- | src/H5Osdspace.c | 2 | ||||
-rw-r--r-- | src/H5Oshared.c | 2 | ||||
-rw-r--r-- | src/H5Ostab.c | 4 | ||||
-rw-r--r-- | src/H5T.c | 3 | ||||
-rw-r--r-- | src/Makefile.in | 6 |
30 files changed, 618 insertions, 1251 deletions
diff --git a/src/H5Apkg.h b/src/H5Apkg.h index 976340d..753ad64 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -38,6 +38,7 @@ #include "H5Aprivate.h" /* Other private headers needed by this file */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Sprivate.h" /* Dataspace */ #include "H5Tprivate.h" /* Datatype functions */ @@ -54,6 +55,12 @@ struct H5A_t { size_t data_size; /* Size of data on disk */ }; +/* Declare extern the free list for H5A_t's */ +H5FL_EXTERN(H5A_t); + +/* Declare extern a free list to manage blocks of type conversion data */ +H5FL_BLK_EXTERN(attr_buf); + /* Function prototypes for H5A package scope */ H5_DLL H5A_t *H5A_copy(H5A_t *new_attr, const H5A_t *old_attr, unsigned update_flags); H5_DLL herr_t H5A_free(H5A_t *attr); @@ -14,7 +14,7 @@ /*------------------------------------------------------------------------- * - * Created: hdf5btree.c + * Created: H5B.c * Jul 10 1997 * Robb Matzke <matzke@llnl.gov> * @@ -89,40 +89,47 @@ * that type of B-tree. * * - * Modifications: - * - * Robb Matzke, 4 Aug 1997 - * Added calls to H5E. - * *------------------------------------------------------------------------- */ +/****************/ +/* Module Setup */ +/****************/ + #define H5B_PACKAGE /*suppress error about including H5Bpkg */ #define H5F_PACKAGE /*suppress error about including H5Fpkg */ -/* private headers */ + +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Bpkg.h" /* B-link trees */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ -#include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MFprivate.h" /* File memory management */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ -/* Local macros */ +/****************/ +/* Local Macros */ +/****************/ #define H5B_SIZEOF_HDR(F) \ (H5B_SIZEOF_MAGIC + /*magic number */ \ 4 + /*type, level, num entries */ \ 2*H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */ #define H5B_NKEY(b,shared,idx) ((b)->native+(shared)->nkey[(idx)]) -/* Local typedefs */ +/******************/ +/* Local Typedefs */ +/******************/ -/* PRIVATE PROTOTYPES */ +/********************/ +/* Local Prototypes */ +/********************/ static H5B_ins_t H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, uint8_t *lt_key, @@ -137,40 +144,34 @@ static herr_t H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, haddr_t old_addr, unsigned idx, void *udata, haddr_t *new_addr/*out*/); static H5B_t * H5B_copy(const H5B_t *old_bt); -static herr_t H5B_serialize(const H5F_t *f, const H5B_t *bt); #ifdef H5B_DEBUG static herr_t H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void *udata); #endif -/* Metadata cache callbacks */ -static H5B_t *H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata); -static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *b); -static herr_t H5B_dest(H5F_t *f, H5B_t *b); -static herr_t H5B_clear(H5F_t *f, H5B_t *b, hbool_t destroy); -static herr_t H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr); - -/* H5B inherits cache-like properties from H5AC */ -static const H5AC_class_t H5AC_BT[1] = {{ - H5AC_BT_ID, - (H5AC_load_func_t)H5B_load, - (H5AC_flush_func_t)H5B_flush, - (H5AC_dest_func_t)H5B_dest, - (H5AC_clear_func_t)H5B_clear, - (H5AC_size_func_t)H5B_compute_size, -}}; +/*********************/ +/* Package Variables */ +/*********************/ + +/* Declare a free list to manage the haddr_t sequence information */ +H5FL_SEQ_DEFINE(haddr_t); /* Declare a PQ free list to manage the native block information */ -H5FL_BLK_DEFINE_STATIC(native_block); +H5FL_BLK_DEFINE(native_block); -/* Declare a free list to manage the haddr_t sequence information */ -H5FL_SEQ_DEFINE_STATIC(haddr_t); +/* Declare a free list to manage the H5B_t struct */ +H5FL_DEFINE(H5B_t); + +/*****************************/ +/* Library Private Variables */ +/*****************************/ /* Declare a free list to manage the H5B_shared_t struct */ H5FL_DEFINE(H5B_shared_t); -/* Declare a free list to manage the H5B_t struct */ -H5FL_DEFINE_STATIC(H5B_t); +/*******************/ +/* Local Variables */ +/*******************/ /*------------------------------------------------------------------------- @@ -254,377 +255,7 @@ done: } FUNC_LEAVE_NOAPI(ret_value) -} /*lint !e818 Can't make udata a pointer to const */ - - -/*------------------------------------------------------------------------- - * Function: H5B_load - * - * Purpose: Loads a B-tree node from the disk. - * - * Return: Success: Pointer to a new B-tree node. - * - * Failure: NULL - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 23 1997 - * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Quincey Koziol, 2002-7-180 - * Added dxpl parameter to allow more control over I/O from metadata - * cache. - *------------------------------------------------------------------------- - */ -static H5B_t * -H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) -{ - const H5B_class_t *type = (const H5B_class_t *) _type; - H5B_t *bt = NULL; - H5B_shared_t *shared; /* Pointer to shared B-tree info */ - uint8_t *p; /* Pointer into raw data buffer */ - uint8_t *native; /* Pointer to native keys */ - unsigned u; /* Local index variable */ - H5B_t *ret_value; - - FUNC_ENTER_NOAPI(H5B_load, NULL) - - /* Check arguments */ - assert(f); - assert(H5F_addr_defined(addr)); - assert(type); - assert(type->get_shared); - - 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=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 (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)H5B_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) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree node type") - bt->level = *p++; - - /* entries used */ - UINT16DECODE(p, bt->nchildren); - - /* sibling pointers */ - H5F_addr_decode(f, (const uint8_t **) &p, &(bt->left)); - H5F_addr_decode(f, (const uint8_t **) &p, &(bt->right)); - - /* the child/key pairs */ - native=bt->native; - for (u = 0; u < bt->nchildren; u++) { - /* Decode native key value */ - 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); - } - - /* Decode final key */ - if(bt->nchildren>0) { - /* Decode native key value */ - if ((type->decode) (f, bt, p, native) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key") - } /* end if */ - - /* Set return value */ - ret_value = bt; - -done: - if (!ret_value && bt) - (void)H5B_dest(f,bt); - FUNC_LEAVE_NOAPI(ret_value) -} /*lint !e818 Can't make udata a pointer to const */ - - -/*------------------------------------------------------------------------- - * Function: H5B_serialize - * - * Purpose: Serialize the data structure for writing to disk or - * storing on the SAP (for FPHDF5). - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Bill Wendling - * wendling@ncsa.uiuc.edu - * Sept. 15, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -H5B_serialize(const H5F_t *f, const H5B_t *bt) -{ - H5B_shared_t *shared=NULL; /* Pointer to shared B-tree info */ - unsigned u; - uint8_t *p; /* Pointer into raw data buffer */ - uint8_t *native; /* Pointer to native keys */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5B_serialize, FAIL) - - /* check arguments */ - assert(f); - assert(bt); - assert(bt->rc_shared); - shared=H5RC_GET_OBJ(bt->rc_shared); - HDassert(shared); - - p = shared->page; - - /* magic number */ - HDmemcpy(p, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC); - p += 4; - - /* node type and level */ - *p++ = (uint8_t)shared->type->id; - H5_CHECK_OVERFLOW(bt->level, unsigned, uint8_t); - *p++ = (uint8_t)bt->level; - - /* entries used */ - UINT16ENCODE(p, bt->nchildren); - - /* sibling pointers */ - H5F_addr_encode(f, &p, bt->left); - H5F_addr_encode(f, &p, bt->right); - - /* child keys and pointers */ - native=bt->native; - for (u = 0; u < bt->nchildren; ++u) { - /* encode the key */ - 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; - - /* encode the child address */ - H5F_addr_encode(f, &p, bt->child[u]); - } /* end for */ - if(bt->nchildren>0) { - /* Encode the final key */ - if (shared->type->encode(f, bt, p, native) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5B_flush - * - * Purpose: Flushes a dirty B-tree node to disk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 23 1997 - * - * Modifications: - * rky 980828 - * Only p0 writes metadata to disk. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Quincey Koziol, 2002-7-180 - * Added dxpl parameter to allow more control over I/O from metadata - * cache. - * - * Bill Wendling, 2003-09-15 - * Separated out the bit of code that serializes the B-Tree - * structure. - * - *------------------------------------------------------------------------- - */ -static herr_t -H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt) -{ - H5B_shared_t *shared; /* Pointer to shared B-tree info */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5B_flush, FAIL) - - /* check arguments */ - assert(f); - assert(H5F_addr_defined(addr)); - assert(bt); - shared=H5RC_GET_OBJ(bt->rc_shared); - HDassert(shared); - assert(shared->type); - assert(shared->type->encode); - - if (bt->cache_info.is_dirty) { - if (H5B_serialize(f, bt) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSERIALIZE, FAIL, "unable to serialize B-tree") - - /* - * Write the disk page. We always write the header, but we don't - * 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) - 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) - HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5B_dest - * - * Purpose: Destroys a B-tree node in memory. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Jan 15 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5B_dest(H5F_t UNUSED *f, H5B_t *bt) -{ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B_dest) - - /* - * Check arguments. - */ - assert(bt); - assert(bt->rc_shared); - - H5FL_SEQ_FREE(haddr_t,bt->child); - H5FL_BLK_FREE(native_block,bt->native); - H5RC_DEC(bt->rc_shared); - H5FL_FREE(H5B_t,bt); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5B_dest() */ - - -/*------------------------------------------------------------------------- - * Function: H5B_clear - * - * Purpose: Mark a B-tree node in memory as non-dirty. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Mar 20 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -H5B_clear(H5F_t *f, H5B_t *bt, hbool_t destroy) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT(H5B_clear) - - /* - * Check arguments. - */ - assert(bt); - - /* Reset the dirty flag. */ - bt->cache_info.is_dirty = FALSE; - - if (destroy) - if (H5B_dest(f, bt) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5B_clear() */ - - -/*------------------------------------------------------------------------- - * Function: H5B_compute_size - * - * Purpose: Compute the size in bytes of the specified instance of - * H5B_t on disk, and return it in *len_ptr. On failure, - * the value of *len_ptr is undefined. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 5/13/04 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr) -{ - H5B_shared_t *shared; /* Pointer to shared B-tree info */ - size_t size; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT(H5B_compute_size) - - /* check arguments */ - HDassert(f); - HDassert(bt); - HDassert(bt->rc_shared); - shared=H5RC_GET_OBJ(bt->rc_shared); - HDassert(shared); - HDassert(shared->type); - HDassert(size_ptr); - - /* Check node's size */ - if ((size = H5B_nodesize(f, shared, NULL)) == 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, "H5B_nodesize() failed") - - /* Set size value */ - *size_ptr = size; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5B_H5B_compute_size() */ +} /* end H5B_create() */ /*lint !e818 Can't make udata a pointer to const */ /*------------------------------------------------------------------------- @@ -739,7 +370,7 @@ done: HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node") FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5B_find() */ /*------------------------------------------------------------------------- @@ -901,7 +532,7 @@ done: HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5B_split() */ /*------------------------------------------------------------------------- @@ -1074,7 +705,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5B_insert() */ /*------------------------------------------------------------------------- @@ -1687,12 +1318,11 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type */ if (*lt_key_changed) { bt->cache_info.is_dirty = TRUE; - if (idx>0) { + if (idx>0) /* Don't propagate change out of this B-tree node */ *lt_key_changed = FALSE; - } else { + else HDmemcpy(lt_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey); - } } if (*rt_key_changed) { bt->cache_info.is_dirty = TRUE; diff --git a/src/H5Bpkg.h b/src/H5Bpkg.h index 74fa393..e96161d 100644 --- a/src/H5Bpkg.h +++ b/src/H5Bpkg.h @@ -31,7 +31,7 @@ #include "H5Bprivate.h" /* Other private headers needed by this file */ -#include "H5RCprivate.h" /* Reference counted object functions */ +#include "H5RCprivate.h" /* Reference counted objects */ /**************************/ /* Package Private Macros */ @@ -41,9 +41,7 @@ /* Package Private Typedefs */ /****************************/ -/* - * The B-tree node as stored in memory... - */ +/* The B-tree node as stored in memory... */ struct H5B_t { H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ /* first field in structure */ @@ -56,8 +54,25 @@ struct H5B_t { haddr_t *child; /*2k child pointers */ }; +/*****************************/ +/* Package Private Variables */ +/*****************************/ + +/* H5B header inherits cache-like properties from H5AC */ +H5_DLLVAR const H5AC_class_t H5AC_BT[1]; + +/* Declare a free list to manage the haddr_t sequence information */ +H5FL_SEQ_EXTERN(haddr_t); + +/* Declare a PQ free list to manage the native block information */ +H5FL_BLK_EXTERN(native_block); + +/* Declare a free list to manage the H5B_t struct */ +H5FL_EXTERN(H5B_t); + /******************************/ /* Package Private Prototypes */ /******************************/ +herr_t H5B_dest(H5F_t *f, H5B_t *b); #endif /*_H5Bpkg_H*/ diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index 28494f7..246d0c5 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -34,8 +34,13 @@ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5RCprivate.h" /* Reference counted object functions */ +/**************************/ +/* Library Private Macros */ +/**************************/ + /* * Feature: Define this constant if you want to check B-tree consistency * after each B-tree operation. Note that this slows down the @@ -48,6 +53,19 @@ #define H5B_MAGIC "TREE" /*tree node magic number */ #define H5B_SIZEOF_MAGIC 4 /*size of magic number */ +/* Define return values from operator callback function for H5B_iterate */ +/* (Actually, any postive value will cause the iterator to stop and pass back + * that positive value to the function that called the iterator) + */ +#define H5B_ITER_ERROR (-1) +#define H5B_ITER_CONT (0) +#define H5B_ITER_STOP (1) + +/****************************/ +/* Library Private Typedefs */ +/****************************/ + +/* Define return values from B-tree insertion callbacks */ typedef enum H5B_ins_t { H5B_INS_ERROR = -1, /*error return value */ H5B_INS_NOOP = 0, /*insert made no changes */ @@ -58,14 +76,6 @@ typedef enum H5B_ins_t { H5B_INS_REMOVE = 5 /*remove current node */ } H5B_ins_t; -/* Define return values from operator callback function for H5B_iterate */ -/* (Actually, any postive value will cause the iterator to stop and pass back - * that positive value to the function that called the iterator) - */ -#define H5B_ITER_ERROR (-1) -#define H5B_ITER_CONT (0) -#define H5B_ITER_STOP (1) - /* Define the operator callback function pointer for H5B_iterate() */ typedef int (*H5B_operator_t)(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, const void *_rt_key, void *_udata); @@ -97,7 +107,6 @@ typedef struct H5B_shared_t { typedef struct H5B_class_t { H5B_subid_t id; /*id as found in file*/ size_t sizeof_nkey; /*size of native (memory) key*/ - size_t (*get_sizeof_rkey)(const H5F_t*, const void*); /*raw key size */ H5RC_t * (*get_shared)(const H5F_t*, const void*); /*shared info for node */ herr_t (*new_node)(H5F_t*, hid_t, H5B_ins_t, void*, void*, void*, haddr_t*); int (*cmp2)(H5F_t*, hid_t, void*, void*, void*); /*compare 2 keys */ @@ -120,12 +129,19 @@ typedef struct H5B_class_t { herr_t (*decode)(const H5F_t*, const struct H5B_t*, const uint8_t*, void*); herr_t (*encode)(const H5F_t*, const struct H5B_t*, uint8_t*, void*); herr_t (*debug_key)(FILE*, H5F_t*, hid_t, int, int, const void*, const void*); - } H5B_class_t; -/* - * Library prototypes. - */ +/*****************************/ +/* Library-private Variables */ +/*****************************/ + +/* Declare a free list to manage the H5B_shared_t struct */ +H5FL_EXTERN(H5B_shared_t); + + +/***************************************/ +/* Library-private Function Prototypes */ +/***************************************/ H5_DLL size_t H5B_nodesize(const H5F_t *f, const H5B_shared_t *shared, size_t *total_nkey_size); H5_DLL herr_t H5B_create (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, @@ -12,11 +12,19 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/****************/ +/* Module Setup */ +/****************/ + #define H5D_PACKAGE /*suppress error about including H5Dpkg */ /* Interface initialization */ #define H5_INTERFACE_INIT_FUNC H5D_init_interface + +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ @@ -28,9 +36,30 @@ #include "H5Sprivate.h" /* Dataspaces */ #include "H5Vprivate.h" /* Vectors and arrays */ -/*#define H5D_DEBUG*/ +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/* Internal data structure for computing variable-length dataset's total size */ +typedef struct { + hid_t dataset_id; /* ID of the dataset we are working on */ + hid_t fspace_id; /* ID of the file dataset's dataspace we are working on */ + hid_t mspace_id; /* ID of the memory dataset's dataspace we are working on */ + void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ + void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */ + hid_t xfer_pid; /* ID of the dataset xfer property list */ + hsize_t size; /* Accumulated number of bytes for the selection */ +} H5D_vlen_bufsize_t; + +/********************/ +/* Local Prototypes */ +/********************/ -/* Local functions */ +/* General stuff */ static herr_t H5D_init_storage(H5D_t *dataset, hbool_t full_overwrite, hid_t dxpl_id); static H5D_shared_t * H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); static H5D_t * H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, @@ -42,20 +71,26 @@ static haddr_t H5D_get_offset(const H5D_t *dset); static herr_t H5D_extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id); static herr_t H5D_set_extent(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id); static herr_t H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); + +/* Property list callbacks */ static int H5D_crt_fill_value_cmp(const void *value1, const void *value2, size_t size); static int H5D_crt_ext_file_list_cmp(const void *value1, const void *value2, size_t size); static int H5D_crt_data_pipeline_cmp(const void *value1, const void *value2, size_t size); -/* Internal data structure for computing variable-length dataset's total size */ -typedef struct { - hid_t dataset_id; /* ID of the dataset we are working on */ - hid_t fspace_id; /* ID of the file dataset's dataspace we are working on */ - hid_t mspace_id; /* ID of the memory dataset's dataspace we are working on */ - void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */ - void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */ - hid_t xfer_pid; /* ID of the dataset xfer property list */ - hsize_t size; /* Accumulated number of bytes for the selection */ -} H5D_vlen_bufsize_t; +/*********************/ +/* Package Variables */ +/*********************/ + +/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */ +H5D_dxpl_cache_t H5D_def_dxpl_cache; + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ /* Declare a free list to manage the H5D_t and H5D_shared_t structs */ H5FL_DEFINE_STATIC(H5D_t); @@ -73,9 +108,6 @@ H5FL_BLK_EXTERN(sieve_buf); /* Define a static "default" dataset structure to use to initialize new datasets */ static H5D_shared_t H5D_def_dset; -/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */ -H5D_dxpl_cache_t H5D_def_dxpl_cache; - /*------------------------------------------------------------------------- * Function: H5D_init @@ -89,8 +121,6 @@ H5D_dxpl_cache_t H5D_def_dxpl_cache; * Programmer: Quincey Koziol * Saturday, March 4, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -403,8 +433,6 @@ done: * Programmer: Robb Matzke * Friday, November 20, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -463,8 +491,6 @@ H5D_term_interface(void) * Programmer: Raymond Lu * Tuesday, October 2, 2001 * - * Modification: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -538,8 +564,6 @@ done: * Programmer: Quincey Koziol * Wednesday, July 11, 2001 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -594,8 +618,6 @@ done: * Programmer: Quincey Koziol * Wednesday, January 7, 2004 * - * Modification: - * *------------------------------------------------------------------------- */ static int @@ -650,8 +672,6 @@ done: * Programmer: Quincey Koziol * Wednesday, January 7, 2004 * - * Modification: - * *------------------------------------------------------------------------- */ static int @@ -732,8 +752,6 @@ done: * Programmer: Quincey Koziol * Wednesday, January 7, 2004 * - * Modification: - * *------------------------------------------------------------------------- */ static int @@ -825,7 +843,6 @@ done: * Thursday, August 2, 2001 * * Notes: This same routine is currently used for the 'copy' callback. - * Modifications: * *------------------------------------------------------------------------- */ @@ -876,8 +893,6 @@ done: * Programmer: Raymond Lu * Tuesday, October 2, 2001 * - * Modification: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -930,8 +945,6 @@ done: * Programmer: Quincey Koziol * Wednesday, July 11, 2001 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -1039,27 +1052,16 @@ done: * * Failure: FAIL * - * Errors: - * ARGS BADTYPE Not a data space. - * ARGS BADTYPE Not a dataset creation plist. - * ARGS BADTYPE Not a file. - * ARGS BADTYPE Not a type. - * ARGS BADVALUE No name. - * DATASET CANTINIT Can't create dataset. - * DATASET CANTREGISTER Can't register dataset. - * * Programmer: Robb Matzke * Wednesday, December 3, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t H5Dcreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id) { - H5G_entry_t *loc = NULL; /* Entry for group to insert dataset into */ + H5G_entry_t *loc; /* Entry for group to insert dataset into */ H5D_t *new_dset = NULL; /* New dataset's info */ const H5S_t *space; /* Dataspace for dataset */ hid_t ret_value; /* Return value */ @@ -1068,13 +1070,13 @@ H5Dcreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, H5TRACE5("i","isiii",loc_id,name,type_id,space_id,dcpl_id); /* Check arguments */ - if (NULL == (loc = H5G_loc(loc_id))) + if(NULL == (loc = H5G_loc(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if (!name || !*name) + if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if (H5I_DATATYPE != H5I_get_type(type_id)) + if(H5I_DATATYPE != H5I_get_type(type_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype ID") - if (NULL == (space = H5I_object_verify(space_id,H5I_DATASPACE))) + if(NULL == (space = H5I_object_verify(space_id,H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID") if(H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; @@ -1091,15 +1093,15 @@ H5Dcreate(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") done: - if(ret_value<0) { - if(new_dset!=NULL) { - if(H5D_close(new_dset)<0) + if(ret_value < 0) { + if(new_dset != NULL) { + if(H5D_close(new_dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") } /* end if */ } /* end if */ FUNC_LEAVE_API(ret_value) -} +} /* end H5Dcreate() */ /*------------------------------------------------------------------------- @@ -1113,13 +1115,9 @@ done: * * Failure: FAIL * - * Errors: - * * Programmer: Robb Matzke * Thursday, December 4, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t @@ -1182,15 +1180,9 @@ done: * * Return: Non-negative on success/Negative on failure * - * Errors: - * ARGS BADTYPE Not a dataset. - * DATASET CANTINIT Can't free. - * * Programmer: Robb Matzke * Thursday, December 4, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1234,10 +1226,6 @@ done: * Programmer: Robb Matzke * Wednesday, January 28, 1998 * - * Modifications: - * Robb Matzke, 9 Jun 1998 - * The data space is not constant and is no longer cached by the dataset - * struct. *------------------------------------------------------------------------- */ hid_t @@ -1286,8 +1274,6 @@ done: * * Programmer: Raymond Lu * - * Modification: - * *------------------------------------------------------------------------- */ herr_t @@ -1324,8 +1310,6 @@ done: * * Programmer: Raymond Lu * - * Modification: - * *------------------------------------------------------------------------- */ static herr_t @@ -1392,13 +1376,6 @@ done: * Programmer: Robb Matzke * Tuesday, February 3, 1998 * - * Modifications: - * - * Robb Matzke, 1 Jun 1998 - * If the dataset has a named data type then a handle to the opened data - * type is returned. Otherwise the returned data type is read-only. If - * atomization of the data type fails then the data type is closed. - * *------------------------------------------------------------------------- */ hid_t @@ -1458,13 +1435,6 @@ done: * Programmer: Robb Matzke * Tuesday, February 3, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * The way to retrieve and set property is changed for the - * generic property list. - * *------------------------------------------------------------------------- */ hid_t @@ -1530,8 +1500,6 @@ done: * Programmer: Robb Matzke * Friday, January 30, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -1567,18 +1535,9 @@ done: * * Failure: NULL * - * Errors: - * * Programmer: Quincey Koziol * Monday, October 12, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to query and inialization for generic - * property list. - * *------------------------------------------------------------------------- */ static H5D_shared_t * @@ -1640,13 +1599,9 @@ done: * Return: Success: SUCCEED * Failure: FAIL * - * Errors: - * * Programmer: Quincey Koziol * Thursday, June 24, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1712,13 +1667,9 @@ done: * Return: Success: SUCCEED * Failure: FAIL * - * Errors: - * * Programmer: Bill Wendling * Thursday, October 31, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1952,50 +1903,9 @@ done: * * Failure: NULL * - * Errors: - * DATASET CANTINIT Can't update dataset header. - * DATASET CANTINIT Problem with the dataset name. - * DATASET CANTINIT Fail in file space allocation for - * chunks - * * Programmer: Robb Matzke * Thursday, December 4, 1997 * - * Modifications: - * Robb Matzke, 9 Jun 1998 - * The data space message is no longer cached in the dataset struct. - * - * Robb Matzke, 27 Jul 1998 - * Added the MTIME message to the dataset object header. - * - * Robb Matzke, 1999-10-14 - * The names for the external file list are entered into the heap hear - * instead of when the efl message is encoded, preventing a possible - * infinite recursion situation. - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to retrieve and set property for generic property - * list. - * - * Raymond Lu, 26 Feb 2002 - * A new fill value message is added. Two properties, space allocation - * time and fill value writing time, govern space allocation and fill - * value writing. - * - * Bill Wendling, 1. November 2002 - * Removed the cache updating mechanism. This was done so that it - * can be called separately from the H5D_create function. There were - * two of these mechanisms: one to create and insert into the parent - * group the H5G_entry_t object and the other to update based upon - * whether we're working with an external file or not. Between the - * two, there is a conditional call to allocate space which isn't - * part of updating the cache. - * - * Nat Furrer and James Laird - * June 7, 2004 - * Added checked_filters flag - * *------------------------------------------------------------------------- */ static H5D_t * @@ -2347,8 +2257,6 @@ done: * Programmer: Robb Matzke * Monday, November 2, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ htri_t @@ -2391,13 +2299,9 @@ done: * Return: Success: Dataset ID * Failure: FAIL * - * Errors: - * * Programmer: Quincey Koziol * Friday, December 20, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ H5D_t* @@ -2479,24 +2383,9 @@ done: * * Return: Dataset pointer on success, NULL on failure * - * Errors: - * * Programmer: Quincey Koziol * Monday, October 12, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to set property for generic property list. - * - * Raymond Lu - * Feb 26, 2002 - * A new fill value message and two new properties are added. - * - * Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002 - * Added a deep copy of the symbol table entry - * *------------------------------------------------------------------------- */ static H5D_t * @@ -2758,17 +2647,9 @@ done: * * Return: Non-negative on success/Negative on failure * - * Errors: - * DATASET CANTINIT Couldn't free the type or space, - * but the dataset was freed anyway. - * * Programmer: Robb Matzke * Thursday, December 4, 1997 * - * Modifications: - * Robb Matzke, 9 Jun 1998 - * The data space message is no longer cached in the dataset struct. - * *------------------------------------------------------------------------- */ herr_t @@ -2902,16 +2783,6 @@ done: * Programmer: Robb Matzke * Friday, January 30, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to retrieve property for generic property - * list. - * - * Nat Furrer and James Laird - * June 17, 2004 - * Added check for filter encode capability *------------------------------------------------------------------------- */ static herr_t @@ -2999,8 +2870,6 @@ done: * Programmer: Robb Matzke * Friday, April 24, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ H5G_entry_t * @@ -3026,8 +2895,6 @@ H5D_entof (H5D_t *dataset) * Programmer: Robb Matzke * Thursday, June 4, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ H5T_t * @@ -3055,8 +2922,6 @@ H5D_typeof (const H5D_t *dset) * Programmer: Quincey Koziol * Thursday, October 22, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5F_t * @@ -3082,12 +2947,6 @@ H5D_get_file (const H5D_t *dset) * Programmer: Robb Matzke * Friday, January 16, 1998 * - * Modifications: - * Quincey Koziol - * Thursday, August 22, 2002 - * Moved here from H5F_arr_create and moved more logic into - * this function from places where it was being called. - * *------------------------------------------------------------------------- */ herr_t @@ -3233,13 +3092,6 @@ done: * Programmer: Robb Matzke * Monday, October 5, 1998 * - * Modifications: - * - * Raymond Lu - * Tuesday, October 2, 2001 - * Changed the way to retrieve property for generic property - * list. - * *------------------------------------------------------------------------- */ static herr_t @@ -3320,8 +3172,6 @@ done: * Programmer: Robb Matzke * Wednesday, April 21, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ hsize_t @@ -3358,8 +3208,6 @@ done: * Programmer: Robb Matzke * Wednesday, April 21, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static hsize_t @@ -3410,8 +3258,6 @@ done: * Programmer: Raymond Lu * November 6, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ haddr_t @@ -3448,8 +3294,6 @@ done: * Programmer: Raymond Lu * November 6, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ static haddr_t @@ -3551,8 +3395,6 @@ done: * Programmer: Quincey Koziol * Friday, June 11, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -3597,8 +3439,6 @@ done: * Programmer: Quincey Koziol * Thursday, June 10, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -3648,8 +3488,6 @@ done: * Programmer: Quincey Koziol * Tuesday, August 17, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * @@ -3695,8 +3533,6 @@ done: * Programmer: Quincey Koziol * Tuesday, August 17, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -3755,8 +3591,6 @@ done: * Programmer: Quincey Koziol * Wednesday, August 11, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -3858,8 +3692,6 @@ done: * * Comments: Public function, calls private H5D_set_extent * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -3901,8 +3733,6 @@ done: * * Comments: Private function * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -4016,8 +3846,6 @@ done: * * Date: August 14, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -4110,8 +3938,6 @@ done: * Programmer: Robb Matzke * Wednesday, April 28, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Distore.c b/src/H5Distore.c index a28174b..fff329f 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -40,10 +40,17 @@ * entry which is added to the end of the list. */ +/****************/ +/* Module Setup */ +/****************/ + #define H5B_PACKAGE /*suppress error about including H5Bpkg */ #define H5D_PACKAGE /*suppress error about including H5Dpkg */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Bpkg.h" /* B-link trees */ #include "H5Dpkg.h" /* Datasets */ @@ -59,6 +66,10 @@ #include "H5Sprivate.h" /* Dataspaces */ #include "H5Vprivate.h" /* Vector and array functions */ +/****************/ +/* Local Macros */ +/****************/ + /* * Feature: If this constant is defined then every cache preemption and load * causes a character to be printed on the standard error stream: @@ -91,6 +102,12 @@ */ #define H5D_ISTORE_NDIMS(X) (((X)->sizeof_rkey-8)/8) +#define H5D_HASH(D,ADDR) H5F_addr_hash(ADDR,(D)->cache.chunk.nslots) + +/******************/ +/* Local Typedefs */ +/******************/ + /* Raw data chunks are cached. Each entry in the cache is: */ typedef struct H5D_rdcc_ent_t { hbool_t locked; /*entry is locked in cache */ @@ -127,18 +144,55 @@ typedef struct H5D_istore_key_t { unsigned filter_mask; /*excluded filters */ } H5D_istore_key_t; -typedef struct H5D_istore_ud1_t { +/* + * Common data exchange structure for indexed storage nodes. This structure is + * passed through the B-link tree layer to the methods for the objects + * to which the B-link tree points. + */ +typedef struct H5D_istore_bt_ud_common_t { + /* downward */ H5D_istore_key_t key; /*key values */ - haddr_t addr; /*file address of chunk */ const H5O_layout_t *mesg; /*layout message */ +} H5D_istore_bt_ud_common_t; + +/* + * Data exchange structure for indexed storage nodes. This structure is + * passed through the B-link tree layer to the methods for the objects + * to which the B-link tree points for operations which require no + * additional information. + * + * (Just an alias for the "common" info). + */ +typedef H5D_istore_bt_ud_common_t H5D_istore_ud0_t; + +typedef struct H5D_istore_ud1_t { + H5D_istore_bt_ud_common_t common; /* Common info for B-tree user data (must be first) */ + haddr_t addr; /*file address of chunk */ +} H5D_istore_ud1_t; + +/* B-tree callback info for iteration to total allocated space */ +typedef struct H5D_istore_it_ud1_t { + H5D_istore_bt_ud_common_t common; /* Common info for B-tree user data (must be first) */ hsize_t total_storage; /*output from iterator */ +} H5D_istore_it_ud1_t; + +/* B-tree callback info for iteration to dump node's info */ +typedef struct H5D_istore_it_ud2_t { + H5D_istore_bt_ud_common_t common; /* Common info for B-tree user data (must be first) */ FILE *stream; /*debug output stream */ + hbool_t header_displayed; /* Node's header is displayed? */ +} H5D_istore_it_ud2_t; + +/* B-tree callback info for iteration to prune chunks */ +typedef struct H5D_istore_it_ud3_t { + H5D_istore_bt_ud_common_t common; /* Common info for B-tree user data (must be first) */ hsize_t *dims; /*dataset dimensions */ -} H5D_istore_ud1_t; +} H5D_istore_it_ud3_t; -#define H5D_HASH(D,ADDR) H5F_addr_hash(ADDR,(D)->cache.chunk.nslots) +/********************/ +/* Local Prototypes */ +/********************/ -/* Private prototypes */ static void *H5D_istore_chunk_alloc(size_t size, const H5O_pline_t *pline); static void *H5D_istore_chunk_xfree(void *chk, const H5O_pline_t *pline); static herr_t H5D_istore_shared_create (const H5F_t *f, H5O_layout_t *layout); @@ -153,7 +207,6 @@ static int H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, const void *_lt_key, const void *_rt_key, void *_udata); /* B-tree callbacks */ -static size_t H5D_istore_sizeof_rkey(const H5F_t *f, const void *_udata); static H5RC_t *H5D_istore_get_shared(const H5F_t *f, const void *_udata); static herr_t H5D_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t, void *_lt_key, void *_udata, void *_rt_key, @@ -184,7 +237,6 @@ static herr_t H5D_istore_debug_key(FILE *stream, H5F_t *f, hid_t dxpl_id, H5B_class_t H5B_ISTORE[1] = {{ H5B_ISTORE_ID, /*id */ sizeof(H5D_istore_key_t), /*sizeof_nkey */ - H5D_istore_sizeof_rkey, /*get_sizeof_rkey */ H5D_istore_get_shared, /*get_shared */ H5D_istore_new_node, /*new */ H5D_istore_cmp2, /*cmp2 */ @@ -199,8 +251,17 @@ H5B_class_t H5B_ISTORE[1] = {{ H5D_istore_debug_key, /*debug */ }}; -/* Declare a free list to manage the H5B_shared_t struct */ -H5FL_EXTERN(H5B_shared_t); +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ /* Declare a free list to manage H5F_rdcc_ent_t objects */ H5FL_DEFINE_STATIC(H5D_rdcc_ent_t); @@ -219,45 +280,6 @@ H5FL_BLK_DEFINE_STATIC(chunk_page); /*------------------------------------------------------------------------- - * Function: H5D_istore_sizeof_rkey - * - * Purpose: Returns the size of a raw key for the specified UDATA. The - * size of the key is dependent on the number of dimensions for - * the object to which this B-tree points. The dimensionality - * of the UDATA is the only portion that's referenced here. - * - * Return: Success: Size of raw key in bytes. - * - * Failure: abort() - * - * Programmer: Robb Matzke - * Wednesday, October 8, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static size_t -H5D_istore_sizeof_rkey(const H5F_t UNUSED *f, const void *_udata) -{ - const H5D_istore_ud1_t *udata = (const H5D_istore_ud1_t *) _udata; - size_t nbytes; - - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_sizeof_rkey) - - assert(udata); - assert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); - - nbytes = 4 + /*storage size */ - 4 + /*filter mask */ - udata->mesg->u.chunk.ndims*8; /*dimension indices */ - - FUNC_LEAVE_NOAPI(nbytes) -} /* end H5D_istore_sizeof_rkey() */ - - -/*------------------------------------------------------------------------- * Function: H5D_istore_get_shared * * Purpose: Returns the shared B-tree info for the specified UDATA. @@ -269,21 +291,19 @@ H5D_istore_sizeof_rkey(const H5F_t UNUSED *f, const void *_udata) * Programmer: Quincey Koziol * Monday, July 5, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ static H5RC_t * H5D_istore_get_shared(const H5F_t UNUSED *f, const void *_udata) { - const H5D_istore_ud1_t *udata = (const H5D_istore_ud1_t *) _udata; + const H5D_istore_ud0_t *udata = (const H5D_istore_ud0_t *) _udata; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_get_shared) - assert(udata); - assert(udata->mesg); - assert(udata->mesg->u.chunk.btree_shared); + HDassert(udata); + HDassert(udata->mesg); + HDassert(udata->mesg->u.chunk.btree_shared); /* Increment reference count on B-tree info */ H5RC_INC(udata->mesg->u.chunk.btree_shared); @@ -303,8 +323,6 @@ H5D_istore_get_shared(const H5F_t UNUSED *f, const void *_udata) * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -347,8 +365,6 @@ H5D_istore_decode_key(const H5F_t UNUSED *f, const H5B_t *bt, const uint8_t *raw * Programmer: Robb Matzke * Friday, October 10, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -391,32 +407,27 @@ H5D_istore_encode_key(const H5F_t UNUSED *f, const H5B_t *bt, uint8_t *raw, void * Programmer: Robb Matzke * Thursday, April 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ static herr_t -H5D_istore_debug_key (FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth, +H5D_istore_debug_key(FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth, const void *_key, const void *_udata) { const H5D_istore_key_t *key = (const H5D_istore_key_t *)_key; - const H5D_istore_ud1_t *udata = (const H5D_istore_ud1_t *)_udata; + const H5D_istore_ud0_t *udata = (const H5D_istore_ud0_t *)_udata; unsigned u; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_debug_key) - assert (key); + HDassert(key); - HDfprintf(stream, "%*s%-*s %Zd bytes\n", indent, "", fwidth, - "Chunk size:", key->nbytes); - HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, - "Filter mask:", key->filter_mask); - HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, - "Logical offset:"); - for (u=0; u<udata->mesg->u.chunk.ndims; u++) - HDfprintf (stream, "%s%Hd", u?", ":"", key->offset[u]); - HDfputs ("}\n", stream); + HDfprintf(stream, "%*s%-*s %Zd bytes\n", indent, "", fwidth, "Chunk size:", key->nbytes); + HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", key->filter_mask); + HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); + for(u = 0; u < udata->mesg->u.chunk.ndims; u++) + HDfprintf(stream, "%s%Hd", u?", ":"", key->offset[u]); + HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_istore_debug_key() */ @@ -439,8 +450,6 @@ H5D_istore_debug_key (FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int i * Programmer: Robb Matzke * Thursday, November 6, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -450,15 +459,15 @@ H5D_istore_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda { H5D_istore_key_t *lt_key = (H5D_istore_key_t *) _lt_key; H5D_istore_key_t *rt_key = (H5D_istore_key_t *) _rt_key; - H5D_istore_ud1_t *udata = (H5D_istore_ud1_t *) _udata; + H5D_istore_ud0_t *udata = (H5D_istore_ud0_t *) _udata; int ret_value; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_cmp2) - assert(lt_key); - assert(rt_key); - assert(udata); - assert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + HDassert(lt_key); + HDassert(rt_key); + HDassert(udata); + HDassert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); /* Compare the offsets but ignore the other fields */ ret_value = H5V_vector_cmp_u(udata->mesg->u.chunk.ndims, lt_key->offset, rt_key->offset); @@ -492,8 +501,6 @@ H5D_istore_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda * Programmer: Robb Matzke * Wednesday, October 8, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -503,15 +510,15 @@ H5D_istore_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda { H5D_istore_key_t *lt_key = (H5D_istore_key_t *) _lt_key; H5D_istore_key_t *rt_key = (H5D_istore_key_t *) _rt_key; - H5D_istore_ud1_t *udata = (H5D_istore_ud1_t *) _udata; + H5D_istore_ud0_t *udata = (H5D_istore_ud0_t *) _udata; int ret_value = 0; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_cmp3) - assert(lt_key); - assert(rt_key); - assert(udata); - assert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + HDassert(lt_key); + HDassert(rt_key); + HDassert(udata); + HDassert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); /* Special case for faster checks on 1-D chunks */ /* (Checking for ndims==2 because last dimension is the datatype size) */ @@ -557,8 +564,6 @@ H5D_istore_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda * Programmer: Robb Matzke * Tuesday, October 14, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -570,22 +575,22 @@ H5D_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, H5D_istore_key_t *rt_key = (H5D_istore_key_t *) _rt_key; H5D_istore_ud1_t *udata = (H5D_istore_ud1_t *) _udata; unsigned u; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_new_node) /* check args */ - assert(f); - assert(lt_key); - assert(rt_key); - assert(udata); - assert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims < H5O_LAYOUT_NDIMS); - assert(addr_p); + HDassert(f); + HDassert(lt_key); + HDassert(rt_key); + HDassert(udata); + HDassert(udata->common.mesg->u.chunk.ndims > 0 && udata->common.mesg->u.chunk.ndims < H5O_LAYOUT_NDIMS); + HDassert(addr_p); /* Allocate new storage */ - assert (udata->key.nbytes > 0); - H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t); - if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes))) + HDassert(udata->common.key.nbytes > 0); + H5_CHECK_OVERFLOW(udata->common.key.nbytes ,size_t, hsize_t); + if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->common.key.nbytes))) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "couldn't allocate new file storage") udata->addr = *addr_p; @@ -593,10 +598,10 @@ H5D_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, * The left key describes the storage of the UDATA chunk being * inserted into the tree. */ - lt_key->nbytes = udata->key.nbytes; - lt_key->filter_mask = udata->key.filter_mask; - for (u=0; u<udata->mesg->u.chunk.ndims; u++) - lt_key->offset[u] = udata->key.offset[u]; + lt_key->nbytes = udata->common.key.nbytes; + lt_key->filter_mask = udata->common.key.filter_mask; + for (u=0; u<udata->common.mesg->u.chunk.ndims; u++) + lt_key->offset[u] = udata->common.key.offset[u]; /* * The right key might already be present. If not, then add a zero-width @@ -605,10 +610,10 @@ H5D_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, if (H5B_INS_LEFT != op) { rt_key->nbytes = 0; rt_key->filter_mask = 0; - for (u=0; u<udata->mesg->u.chunk.ndims; u++) { - assert (udata->key.offset[u]+udata->mesg->u.chunk.dim[u] > - udata->key.offset[u]); - rt_key->offset[u] = udata->key.offset[u] + udata->mesg->u.chunk.dim[u]; + for (u=0; u<udata->common.mesg->u.chunk.ndims; u++) { + HDassert(udata->common.key.offset[u]+udata->common.mesg->u.chunk.dim[u] > + udata->common.key.offset[u]); + rt_key->offset[u] = udata->common.key.offset[u] + udata->common.mesg->u.chunk.dim[u]; } } @@ -639,9 +644,6 @@ done: * Programmer: Robb Matzke * Thursday, October 9, 1997 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -652,28 +654,28 @@ H5D_istore_found(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr, const void H5D_istore_ud1_t *udata = (H5D_istore_ud1_t *) _udata; const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *) _lt_key; unsigned u; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_found) /* Check arguments */ - assert(f); - assert(H5F_addr_defined(addr)); - assert(udata); - assert(lt_key); + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(udata); + HDassert(lt_key); /* Is this *really* the requested chunk? */ - for (u=0; u<udata->mesg->u.chunk.ndims; u++) - if (udata->key.offset[u] >= lt_key->offset[u]+udata->mesg->u.chunk.dim[u]) + for(u = 0; u < udata->common.mesg->u.chunk.ndims; u++) + if(udata->common.key.offset[u] >= lt_key->offset[u] + udata->common.mesg->u.chunk.dim[u]) HGOTO_DONE(FAIL) /* Initialize return values */ udata->addr = addr; - udata->key.nbytes = lt_key->nbytes; - udata->key.filter_mask = lt_key->filter_mask; - assert (lt_key->nbytes>0); - for (u = 0; u < udata->mesg->u.chunk.ndims; u++) - udata->key.offset[u] = lt_key->offset[u]; + udata->common.key.nbytes = lt_key->nbytes; + udata->common.key.filter_mask = lt_key->filter_mask; + HDassert(lt_key->nbytes>0); + for(u = 0; u < udata->common.mesg->u.chunk.ndims; u++) + udata->common.key.offset[u] = lt_key->offset[u]; done: FUNC_LEAVE_NOAPI(ret_value) @@ -706,10 +708,6 @@ done: * Programmer: Robb Matzke * Thursday, October 9, 1997 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. The NEW_NODE argument - * is renamed NEW_NODE_P. *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -731,30 +729,30 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, FUNC_ENTER_NOAPI_NOINIT(H5D_istore_insert) /* check args */ - assert(f); - assert(H5F_addr_defined(addr)); - assert(lt_key); - assert(lt_key_changed); - assert(md_key); - assert(udata); - assert(rt_key); - assert(new_node_p); + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(lt_key); + HDassert(lt_key_changed); + HDassert(md_key); + HDassert(udata); + HDassert(rt_key); + HDassert(new_node_p); cmp = H5D_istore_cmp3(f, dxpl_id, lt_key, udata, rt_key); - assert(cmp <= 0); + HDassert(cmp <= 0); if (cmp < 0) { /* Negative indices not supported yet */ HGOTO_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error") - } else if (H5V_vector_eq_u (udata->mesg->u.chunk.ndims, - udata->key.offset, lt_key->offset) && + } else if (H5V_vector_eq_u (udata->common.mesg->u.chunk.ndims, + udata->common.key.offset, lt_key->offset) && lt_key->nbytes>0) { /* * Already exists. If the new size is not the same as the old size * then we should reallocate storage. */ - if (lt_key->nbytes != udata->key.nbytes) { + if (lt_key->nbytes != udata->common.key.nbytes) { /* Currently, the old chunk data is "thrown away" after the space is reallocated, * so avoid data copy in H5MF_realloc() call by just free'ing the space and * allocating new space. @@ -765,19 +763,19 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, * QAK - 11/19/2002 */ #ifdef OLD_WAY - if (HADDR_UNDEF==(*new_node_p=H5MF_realloc(f, H5FD_MEM_DRAW, addr, - (hsize_t)lt_key->nbytes, (hsize_t)udata->key.nbytes))) - HGOTO_ERROR (H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk storage") + if(HADDR_UNDEF == (*new_node_p = H5MF_realloc(f, H5FD_MEM_DRAW, addr, + (hsize_t)lt_key->nbytes, (hsize_t)udata->common.key.nbytes))) + HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk storage") #else /* OLD_WAY */ H5_CHECK_OVERFLOW( lt_key->nbytes ,size_t, hsize_t); - if (H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes)<0) + if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes)<0) HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk") - H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t); - if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes))) + H5_CHECK_OVERFLOW(udata->common.key.nbytes ,size_t, hsize_t); + if(HADDR_UNDEF == (*new_node_p = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->common.key.nbytes))) HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk") #endif /* OLD_WAY */ - lt_key->nbytes = udata->key.nbytes; - lt_key->filter_mask = udata->key.filter_mask; + lt_key->nbytes = udata->common.key.nbytes; + lt_key->filter_mask = udata->common.key.filter_mask; *lt_key_changed = TRUE; udata->addr = *new_node_p; ret_value = H5B_INS_CHANGE; @@ -786,28 +784,28 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, ret_value = H5B_INS_NOOP; } - } else if (H5V_hyper_disjointp(udata->mesg->u.chunk.ndims, - lt_key->offset, udata->mesg->u.chunk.dim, - udata->key.offset, udata->mesg->u.chunk.dim)) { - assert(H5V_hyper_disjointp(udata->mesg->u.chunk.ndims, - rt_key->offset, udata->mesg->u.chunk.dim, - udata->key.offset, udata->mesg->u.chunk.dim)); + } else if (H5V_hyper_disjointp(udata->common.mesg->u.chunk.ndims, + lt_key->offset, udata->common.mesg->u.chunk.dim, + udata->common.key.offset, udata->common.mesg->u.chunk.dim)) { + HDassert(H5V_hyper_disjointp(udata->common.mesg->u.chunk.ndims, + rt_key->offset, udata->common.mesg->u.chunk.dim, + udata->common.key.offset, udata->common.mesg->u.chunk.dim)); /* * Split this node, inserting the new new node to the right of the * current node. The MD_KEY is where the split occurs. */ - md_key->nbytes = udata->key.nbytes; - md_key->filter_mask = udata->key.filter_mask; - for (u=0; u<udata->mesg->u.chunk.ndims; u++) { - assert(0 == udata->key.offset[u] % udata->mesg->u.chunk.dim[u]); - md_key->offset[u] = udata->key.offset[u]; + md_key->nbytes = udata->common.key.nbytes; + md_key->filter_mask = udata->common.key.filter_mask; + for(u = 0; u < udata->common.mesg->u.chunk.ndims; u++) { + HDassert(0 == udata->common.key.offset[u] % udata->common.mesg->u.chunk.dim[u]); + md_key->offset[u] = udata->common.key.offset[u]; } /* * Allocate storage for the new chunk */ - H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t); - if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes))) + H5_CHECK_OVERFLOW(udata->common.key.nbytes ,size_t, hsize_t); + if(HADDR_UNDEF == (*new_node_p = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->common.key.nbytes))) HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "file allocation failed") udata->addr = *new_node_p; ret_value = H5B_INS_RIGHT; @@ -833,12 +831,6 @@ done: * Programmer: Robb Matzke * Wednesday, April 21, 1999 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Quincey Koziol, 2002-04-22 - * Changed to callback from H5B_iterate *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -846,12 +838,12 @@ static int H5D_istore_iter_allocated (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_lt_key, haddr_t UNUSED addr, const void UNUSED *_rt_key, void *_udata) { - H5D_istore_ud1_t *bt_udata = (H5D_istore_ud1_t *)_udata; + H5D_istore_it_ud1_t *udata = (H5D_istore_it_ud1_t *)_udata; const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *)_lt_key; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_iter_allocated) - bt_udata->total_storage += lt_key->nbytes; + udata->total_storage += lt_key->nbytes; FUNC_LEAVE_NOAPI(H5B_ITER_CONT) } /* H5D_istore_iter_allocated() */ @@ -870,12 +862,6 @@ H5D_istore_iter_allocated (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_l * Programmer: Robb Matzke * Wednesday, April 21, 1999 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Quincey Koziol, 2002-04-22 - * Changed to callback from H5B_iterate *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -883,29 +869,25 @@ static int H5D_istore_iter_dump (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_lt_key, haddr_t UNUSED addr, const void UNUSED *_rt_key, void *_udata) { - H5D_istore_ud1_t *bt_udata = (H5D_istore_ud1_t *)_udata; + H5D_istore_it_ud2_t *udata = (H5D_istore_it_ud2_t *)_udata; const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *)_lt_key; unsigned u; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_iter_dump) - if (bt_udata->stream) { - if (0==bt_udata->total_storage) { - fprintf(bt_udata->stream, - " Flags Bytes Address Logical Offset\n"); - fprintf(bt_udata->stream, - " ========== ======== ========== " - "==============================\n"); - } - HDfprintf(bt_udata->stream, " 0x%08x %8Zu %10a [", - lt_key->filter_mask, lt_key->nbytes, addr); - for (u=0; u<bt_udata->mesg->u.chunk.ndims; u++) - HDfprintf(bt_udata->stream, "%s%Hd", u?", ":"", lt_key->offset[u]); - HDfputs("]\n", bt_udata->stream); - - /* Use "total storage" information as flag for printing headers */ - bt_udata->total_storage++; - } + if(udata->stream) { + if(!udata->header_displayed) { + HDfprintf(udata->stream, " Flags Bytes Address Logical Offset\n"); + HDfprintf(udata->stream, " ========== ======== ========== ==============================\n"); + + /* Set flag that the headers has been printed */ + udata->header_displayed = TRUE; + } /* end if */ + HDfprintf(udata->stream, " 0x%08x %8Zu %10a [", lt_key->filter_mask, lt_key->nbytes, addr); + for(u = 0; u < udata->common.mesg->u.chunk.ndims; u++) + HDfprintf(udata->stream, "%s%Hd", (u ? ", " : ""), lt_key->offset[u]); + HDfputs("]\n", udata->stream); + } /* end if */ FUNC_LEAVE_NOAPI(H5B_ITER_CONT) } /* H5D_istore_iter_dump() */ @@ -922,8 +904,6 @@ H5D_istore_iter_dump (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_lt_key * Programmer: Robb Matzke * Monday, May 18, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -963,8 +943,6 @@ done: * Programmer: Robb Matzke * Thursday, May 21, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -987,12 +965,12 @@ H5D_istore_flush_entry(const H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_ if (ent->dirty) { H5D_istore_ud1_t udata; /*pass through B-tree */ - udata.mesg = &io_info->dset->shared->layout; - udata.key.filter_mask = 0; + udata.common.mesg = &io_info->dset->shared->layout; + udata.common.key.filter_mask = 0; udata.addr = HADDR_UNDEF; - udata.key.nbytes = ent->chunk_size; + udata.common.key.nbytes = ent->chunk_size; for (u=0; u<io_info->dset->shared->layout.u.chunk.ndims; u++) - udata.key.offset[u] = ent->offset[u]; + udata.common.key.offset[u] = ent->offset[u]; alloc = ent->alloc_size; /* Should the chunk be filtered before writing it to disk? */ @@ -1018,8 +996,8 @@ H5D_istore_flush_entry(const H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_ point_of_no_return = TRUE; ent->chunk = NULL; } - if (H5Z_pipeline(&(io_info->dset->shared->dcpl_cache.pline), 0, &(udata.key.filter_mask), io_info->dxpl_cache->err_detect, - io_info->dxpl_cache->filter_cb, &(udata.key.nbytes), &alloc, &buf)<0) + if (H5Z_pipeline(&(io_info->dset->shared->dcpl_cache.pline), 0, &(udata.common.key.filter_mask), io_info->dxpl_cache->err_detect, + io_info->dxpl_cache->filter_cb, &(udata.common.key.nbytes), &alloc, &buf)<0) HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed") } @@ -1029,7 +1007,7 @@ H5D_istore_flush_entry(const H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_ */ if (H5B_insert(io_info->dset->ent.file, io_info->dxpl_id, H5B_ISTORE, io_info->dset->shared->layout.u.chunk.addr, &udata)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk") - if (H5F_block_write(io_info->dset->ent.file, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, io_info->dxpl_id, buf)<0) + if (H5F_block_write(io_info->dset->ent.file, H5FD_MEM_DRAW, udata.addr, udata.common.key.nbytes, io_info->dxpl_id, buf)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Mark cache entry as clean */ @@ -1079,11 +1057,6 @@ done: * Programmer: Robb Matzke * Thursday, May 21, 1998 * - * Modifications: - * Pedro Vicente, March 28, 2002 - * Added flush parameter that switches the call to H5F_istore_flush_entry - * The call with FALSE is used by the H5F_istore_prune_by_extent function - * *------------------------------------------------------------------------- */ static herr_t @@ -1146,10 +1119,6 @@ done: * Programmer: Robb Matzke * Thursday, May 21, 1998 * - * Modifications: - * Pedro Vicente, March 28, 2002 - * Added TRUE parameter to the call to H5F_istore_preempt - * *------------------------------------------------------------------------- */ herr_t @@ -1206,10 +1175,6 @@ done: * Programmer: Robb Matzke * Thursday, May 21, 1998 * - * Modifications: - * Pedro Vicente, March 28, 2002 - * Added TRUE parameter to the call to H5F_istore_preempt - * *------------------------------------------------------------------------- */ herr_t @@ -1252,7 +1217,7 @@ H5D_istore_dest (H5D_t *dset, hid_t dxpl_id) HDmemset (rdcc, 0, sizeof(H5D_rdcc_t)); /* Free the raw B-tree node buffer */ - if(dset->shared->layout.u.chunk.btree_shared==NULL) + if(dset->shared->layout.u.chunk.btree_shared==NULL) HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil") if(H5RC_DEC(dset->shared->layout.u.chunk.btree_shared)<0) HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") @@ -1272,23 +1237,17 @@ done: * Programmer: Quincey Koziol * Monday, September 27, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t H5D_istore_shared_create (const H5F_t *f, H5O_layout_t *layout) { - H5D_istore_ud1_t udata; H5B_shared_t *shared; /* Shared B-tree node info */ size_t u; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_istore_shared_create) - /* Initialize "user" data for B-tree callbacks, etc. */ - udata.mesg = layout; - /* Allocate space for the shared structure */ if(NULL==(shared=H5FL_MALLOC(H5B_shared_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for shared B-tree info") @@ -1296,7 +1255,9 @@ H5D_istore_shared_create (const H5F_t *f, H5O_layout_t *layout) /* Set up the "global" information for this file's groups */ shared->type= H5B_ISTORE; shared->two_k=2*H5F_KVALUE(f,H5B_ISTORE); - shared->sizeof_rkey = H5D_istore_sizeof_rkey(f, &udata); + shared->sizeof_rkey = 4 + /*storage size */ + 4 + /*filter mask */ + layout->u.chunk.ndims*8; /*dimension indices */ assert(shared->sizeof_rkey); shared->sizeof_rnode = H5B_nodesize(f, shared, &shared->sizeof_keys); assert(shared->sizeof_rnode); @@ -1331,8 +1292,6 @@ done: * Programmer: Quincey Koziol * Thursday, July 8, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -1367,10 +1326,6 @@ H5D_istore_shared_free (void *_shared) * Programmer: Robb Matzke * Thursday, May 21, 1998 * - * Modifications: - * Pedro Vicente, March 28, 2002 - * TRUE parameter to the call to H5F_istore_preempt - * *------------------------------------------------------------------------- */ static herr_t @@ -1498,13 +1453,6 @@ done: * Programmer: Robb Matzke * Thursday, May 21, 1998 * - * Modifications: - * Robb Matzke, 1999-08-02 - * The split ratios are passed in as part of the data transfer - * property list. - * - * Pedro Vicente, March 28, 2002 - * TRUE parameter to the call to H5F_istore_preempt *------------------------------------------------------------------------- */ static void * @@ -1580,10 +1528,10 @@ H5D_istore_lock(const H5D_io_info_t *io_info, haddr_t chunk_addr; /* Address of chunk on disk */ if(udata!=NULL) - chunk_addr=udata->addr; + chunk_addr = udata->addr; else { /* Point at temporary storage for B-tree pass through */ - udata=&tmp_udata; + udata = &tmp_udata; /* * Not in the cache. Read it from the file and count this as a miss @@ -1593,22 +1541,22 @@ H5D_istore_lock(const H5D_io_info_t *io_info, } /* end else */ if (H5F_addr_defined(chunk_addr)) { - size_t chunk_alloc=0; /*allocated chunk size */ + size_t chunk_alloc = 0; /*allocated chunk size */ /* * The chunk exists on disk. */ /* Chunk size on disk isn't [likely] the same size as the final chunk * size in memory, so allocate memory big enough. */ - chunk_alloc = udata->key.nbytes; + chunk_alloc = udata->common.key.nbytes; if (NULL==(chunk = H5D_istore_chunk_alloc (chunk_alloc,pline))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") - if (H5F_block_read(dset->ent.file, H5FD_MEM_DRAW, chunk_addr, udata->key.nbytes, io_info->dxpl_id, chunk)<0) + if (H5F_block_read(dset->ent.file, H5FD_MEM_DRAW, chunk_addr, udata->common.key.nbytes, io_info->dxpl_id, chunk)<0) HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk") if (pline->nused) - if (H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata->key.filter_mask), io_info->dxpl_cache->err_detect, - io_info->dxpl_cache->filter_cb, &(udata->key.nbytes), &chunk_alloc, &chunk)<0) { + if (H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata->common.key.filter_mask), io_info->dxpl_cache->err_detect, + io_info->dxpl_cache->filter_cb, &(udata->common.key.nbytes), &chunk_alloc, &chunk)<0) { HGOTO_ERROR(H5E_PLINE, H5E_READERROR, NULL, "data pipeline read failed") } #ifdef H5D_ISTORE_DEBUG @@ -1778,10 +1726,6 @@ done: * Programmer: Robb Matzke * Thursday, May 21, 1998 * - * Modifications: - * Robb Matzke, 1999-08-02 - * The split_ratios are passed as part of the data transfer - * property list. *------------------------------------------------------------------------- */ static herr_t @@ -1859,8 +1803,6 @@ done: * Programmer: Quincey Koziol * Wednesday, May 7, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ ssize_t @@ -1878,16 +1820,16 @@ H5D_istore_readvv(const H5D_io_info_t *io_info, FUNC_ENTER_NOAPI(H5D_istore_readvv, FAIL) /* Check args */ - assert(io_info); - assert(dset && H5D_CHUNKED==dset->shared->layout.type); - assert(dset->shared->layout.u.chunk.ndims>0 && dset->shared->layout.u.chunk.ndims<=H5O_LAYOUT_NDIMS); - assert(io_info->dxpl_cache); - assert(io_info->store); - assert(chunk_len_arr); - assert(chunk_offset_arr); - assert(mem_len_arr); - assert(mem_offset_arr); - assert(buf); + HDassert(io_info); + HDassert(dset && H5D_CHUNKED==dset->shared->layout.type); + HDassert(dset->shared->layout.u.chunk.ndims>0 && dset->shared->layout.u.chunk.ndims<=H5O_LAYOUT_NDIMS); + HDassert(io_info->dxpl_cache); + HDassert(io_info->store); + HDassert(chunk_len_arr); + HDassert(chunk_offset_arr); + HDassert(mem_len_arr); + HDassert(mem_offset_arr); + HDassert(buf); /* Get the address of this chunk on disk */ #ifdef QAK @@ -1895,7 +1837,7 @@ HDfprintf(stderr,"%s: io_info->store->chunk.offset={",FUNC); for(u=0; u<dset->shared->layout.u.chunk.ndims; u++) HDfprintf(stderr,"%Hd%s",io_info->store->chunk.offset[u],(u<(dset->shared->layout.u.chunk.ndims-1) ? ", " : "}\n")); #endif /* QAK */ - chunk_addr=H5D_istore_get_addr(io_info, &udata); + chunk_addr = H5D_istore_get_addr(io_info, &udata); #ifdef QAK HDfprintf(stderr,"%s: chunk_addr=%a, chunk_size=%Zu\n",FUNC,chunk_addr,dset->shared->layout.u.chunk.size); HDfprintf(stderr,"%s: chunk_len_arr[%Zu]=%Zu\n",FUNC,*chunk_curr_seq,chunk_len_arr[*chunk_curr_seq]); @@ -2052,8 +1994,6 @@ done: * Programmer: Quincey Koziol * Friday, May 2, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ ssize_t @@ -2062,7 +2002,7 @@ H5D_istore_writevv(const H5D_io_info_t *io_info, size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *buf) { - H5D_t *dset=io_info->dset; /* Local pointer to the dataset info */ + H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ H5D_istore_ud1_t udata; /*B-tree pass-through */ haddr_t chunk_addr; /* Chunk address on disk */ size_t u; /* Local index variables */ @@ -2071,16 +2011,16 @@ H5D_istore_writevv(const H5D_io_info_t *io_info, FUNC_ENTER_NOAPI(H5D_istore_writevv, FAIL) /* Check args */ - assert(io_info); - assert(dset && H5D_CHUNKED==dset->shared->layout.type); - assert(dset->shared->layout.u.chunk.ndims>0 && dset->shared->layout.u.chunk.ndims<=H5O_LAYOUT_NDIMS); - assert(io_info->dxpl_cache); - assert(io_info->store); - assert(chunk_len_arr); - assert(chunk_offset_arr); - assert(mem_len_arr); - assert(mem_offset_arr); - assert(buf); + HDassert(io_info); + HDassert(dset && H5D_CHUNKED==dset->shared->layout.type); + HDassert(dset->shared->layout.u.chunk.ndims>0 && dset->shared->layout.u.chunk.ndims<=H5O_LAYOUT_NDIMS); + HDassert(io_info->dxpl_cache); + HDassert(io_info->store); + HDassert(chunk_len_arr); + HDassert(chunk_offset_arr); + HDassert(mem_len_arr); + HDassert(mem_offset_arr); + HDassert(buf); /* Get the address of this chunk on disk */ #ifdef QAK @@ -2088,7 +2028,7 @@ HDfprintf(stderr,"%s: io_info->store->chunk.offset={",FUNC); for(u=0; u<dset->shared->layout.u.chunk.ndims; u++) HDfprintf(stderr,"%Hd%s",io_info->store->chunk.offset[u],(u<(dset->shared->layout.u.chunk.ndims-1) ? ", " : "}\n")); #endif /* QAK */ - chunk_addr=H5D_istore_get_addr(io_info, &udata); + chunk_addr = H5D_istore_get_addr(io_info, &udata); #ifdef QAK HDfprintf(stderr,"%s: chunk_addr=%a, chunk_size=%Zu\n",FUNC,chunk_addr,dset->shared->layout.u.chunk.size); HDfprintf(stderr,"%s: chunk_len_arr[%Zu]=%Zu\n",FUNC,*chunk_curr_seq,chunk_len_arr[*chunk_curr_seq]); @@ -2207,34 +2147,32 @@ done: * Programmer: Robb Matzke * Tuesday, October 21, 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t -H5D_istore_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ ) +H5D_istore_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */) { - H5D_istore_ud1_t udata; + H5D_istore_ud0_t udata; #ifndef NDEBUG unsigned u; #endif - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5D_istore_create, FAIL) /* Check args */ - assert(f); - assert(layout && H5D_CHUNKED == layout->type); - assert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + HDassert(f); + HDassert(layout && H5D_CHUNKED == layout->type); + HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); #ifndef NDEBUG - for (u = 0; u < layout->u.chunk.ndims; u++) - assert(layout->u.chunk.dim[u] > 0); + for(u = 0; u < layout->u.chunk.ndims; u++) + HDassert(layout->u.chunk.dim[u] > 0); #endif /* Initialize "user" data for B-tree callbacks, etc. */ udata.mesg = layout; - if (H5B_create(f, dxpl_id, H5B_ISTORE, &udata, &(layout->u.chunk.addr)/*out*/) < 0) + if(H5B_create(f, dxpl_id, H5B_ISTORE, &udata, &(layout->u.chunk.addr)/*out*/) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "can't create B-tree") done: @@ -2256,9 +2194,6 @@ done: * Programmer: Robb Matzke * Wednesday, April 21, 1999 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ hsize_t @@ -2269,12 +2204,12 @@ H5D_istore_allocated(H5D_t *dset, hid_t dxpl_id) H5D_rdcc_ent_t *ent; /*cache entry */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache=&_dxpl_cache; /* Data transfer property cache */ - H5D_istore_ud1_t udata; + H5D_istore_it_ud1_t udata; hsize_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5D_istore_allocated, 0) - assert(dset); + HDassert(dset); /* Fill the DXPL cache values for later use */ if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) @@ -2291,12 +2226,12 @@ H5D_istore_allocated(H5D_t *dset, hid_t dxpl_id) } /* end for */ HDmemset(&udata, 0, sizeof udata); - udata.mesg = &dset->shared->layout; + udata.common.mesg = &dset->shared->layout; if (H5B_iterate(dset->ent.file, dxpl_id, H5B_ISTORE, H5D_istore_iter_allocated, dset->shared->layout.u.chunk.addr, &udata)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree") /* Set return value */ - ret_value=udata.total_storage; + ret_value = udata.total_storage; done: FUNC_LEAVE_NOAPI(ret_value) @@ -2315,10 +2250,6 @@ done: * Programmer: Albert Cheng * June 27, 1998 * - * Modifications: - * Modified to return the address instead of returning it through - * a parameter - QAK, 1/30/02 - * *------------------------------------------------------------------------- */ haddr_t @@ -2331,18 +2262,18 @@ H5D_istore_get_addr(const H5D_io_info_t *io_info, H5D_istore_ud1_t *_udata) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_get_addr) - assert(io_info); - assert(io_info->dset); - assert(io_info->dset->shared->layout.u.chunk.ndims > 0); - assert(io_info->store->chunk.offset); + HDassert(io_info); + HDassert(io_info->dset); + HDassert(io_info->dset->shared->layout.u.chunk.ndims > 0); + HDassert(io_info->store->chunk.offset); /* Check for udata struct to return */ - udata = (_udata!=NULL ? _udata : &tmp_udata); + udata = (_udata != NULL ? _udata : &tmp_udata); /* Initialize the information about the chunk we are looking for */ - for (u=0; u<io_info->dset->shared->layout.u.chunk.ndims; u++) - udata->key.offset[u] = io_info->store->chunk.offset[u]; - udata->mesg = &(io_info->dset->shared->layout); + for(u = 0; u < io_info->dset->shared->layout.u.chunk.ndims; u++) + udata->common.key.offset[u] = io_info->store->chunk.offset[u]; + udata->common.mesg = &(io_info->dset->shared->layout); udata->addr = HADDR_UNDEF; /* Go get the chunk information */ @@ -2380,8 +2311,6 @@ done: * Programmer: Quincey Koziol * April 22, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * @@ -2389,7 +2318,7 @@ H5D_istore_chunk_alloc(size_t size, const H5O_pline_t *pline) { void *ret_value=NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_chunk_alloc) + FUNC_ENTER_NOAPI_NOINIT(H5D_istore_chunk_alloc) assert(size); assert(pline); @@ -2415,8 +2344,6 @@ H5D_istore_chunk_alloc(size_t size, const H5O_pline_t *pline) * Programmer: Quincey Koziol * April 22, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * @@ -2458,26 +2385,6 @@ H5D_istore_chunk_xfree(void *chk, const H5O_pline_t *pline) * Programmer: Albert Cheng * June 26, 1998 * - * Modifications: - * rky, 1998-09-23 - * Added barrier to preclude racing with data writes. - * - * rky, 1998-12-07 - * Added Wait-Signal wrapper around unlock-lock critical region - * to prevent race condition (unlock reads, lock writes the - * chunk). - * - * Robb Matzke, 1999-08-02 - * The split_ratios are passed in as part of the data transfer - * property list. - * - * Quincey Koziol, 2002-05-16 - * Rewrote algorithm to allocate & write blocks without using - * lock/unlock code. - * - * Quincey Koziol, 2002-05-17 - * Added feature to avoid writing fill-values if user has indicated - * that they should never be written. *------------------------------------------------------------------------- */ herr_t @@ -2494,7 +2401,6 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) H5D_fill_time_t fill_time; /* When to write fill values */ H5D_fill_value_t fill_status; /* The fill value status */ unsigned should_fill=0; /* Whether fill values should be written */ - H5D_istore_ud1_t udata; /* B-tree pass-through for creating chunk */ void *chunk=NULL; /* Chunk buffer for writing fill values */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache=&_dxpl_cache; /* Data transfer property cache */ @@ -2645,14 +2551,16 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) } /* end if */ if(!chunk_exists) { + H5D_istore_ud1_t udata; /* B-tree pass-through for creating chunk */ + /* Initialize the chunk information */ - udata.mesg = &dset->shared->layout; - udata.key.filter_mask = filter_mask; + udata.common.mesg = &dset->shared->layout; + udata.common.key.filter_mask = filter_mask; udata.addr = HADDR_UNDEF; H5_CHECK_OVERFLOW(chunk_size,hsize_t,size_t); - udata.key.nbytes = (size_t)chunk_size; - for (u=0; u<dset->shared->layout.u.chunk.ndims; u++) - udata.key.offset[u] = chunk_offset[u]; + udata.common.key.nbytes = (size_t)chunk_size; + for(u = 0; u < dset->shared->layout.u.chunk.ndims; u++) + udata.common.key.offset[u] = chunk_offset[u]; /* Allocate the chunk with all processes */ if (H5B_insert(dset->ent.file, dxpl_id, H5B_ISTORE, dset->shared->layout.u.chunk.addr, &udata)<0) @@ -2666,7 +2574,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) /* Write the chunks out from only one process */ /* !! Use the internal "independent" DXPL!! -QAK */ if(H5_PAR_META_WRITE==mpi_rank) { - if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5AC_ind_dxpl_id, chunk)<0) + if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, udata.addr, udata.common.key.nbytes, H5AC_ind_dxpl_id, chunk)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") } /* end if */ @@ -2675,7 +2583,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) } /* end if */ else { #endif /* H5_HAVE_PARALLEL */ - if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, chunk)<0) + if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, udata.addr, udata.common.key.nbytes, dxpl_id, chunk)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") #ifdef H5_HAVE_PARALLEL } /* end else */ @@ -2818,14 +2726,14 @@ done: herr_t H5D_istore_prune_by_extent(const H5D_io_info_t *io_info) { - H5D_t *dset=io_info->dset; /* Local pointer to the dataset info */ + H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ H5D_rdcc_ent_t *ent = NULL, *next = NULL; /*cache entry */ unsigned u; /*counters */ int found; /*remove this entry */ - H5D_istore_ud1_t udata; /*B-tree pass-through */ + H5D_istore_it_ud3_t udata; /*B-tree pass-through */ hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /*current dataspace dimensions */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5D_istore_prune_by_extent, FAIL) @@ -2877,8 +2785,7 @@ H5D_istore_prune_by_extent(const H5D_io_info_t *io_info) */ HDmemset(&udata, 0, sizeof udata); - udata.stream = stdout; - udata.mesg = &dset->shared->layout; + udata.common.mesg = &dset->shared->layout; udata.dims = curr_dims; if(H5B_iterate(dset->ent.file, io_info->dxpl_id, H5B_ISTORE, H5D_istore_prune_extent, dset->shared->layout.u.chunk.addr, &udata) < 0) @@ -2902,8 +2809,6 @@ done: * * Comments: Called by H5D_prune_by_extent * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -2911,11 +2816,10 @@ static int H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t UNUSED addr, const void UNUSED *_rt_key, void *_udata) { - H5D_istore_ud1_t *bt_udata = (H5D_istore_ud1_t *)_udata; + H5D_istore_it_ud3_t *udata = (H5D_istore_it_ud3_t *)_udata; const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *)_lt_key; unsigned u; - H5D_istore_ud1_t udata; - int ret_value=H5B_ITER_CONT; /* Return value */ + int ret_value = H5B_ITER_CONT; /* Return value */ /* The LT_KEY is the left key (the one that describes the chunk). It points to a chunk of * storage that contains the beginning of the logical address space represented by UDATA. @@ -2924,21 +2828,16 @@ H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t UN FUNC_ENTER_NOAPI_NOINIT(H5D_istore_prune_extent) /* Figure out what chunks are no longer in use for the specified extent and release them */ - for(u = 0; u < bt_udata->mesg->u.chunk.ndims - 1; u++) - if((hsize_t)lt_key->offset[u] > bt_udata->dims[u]) { -#ifdef H5D_ISTORE_DEBUG - HDfputs("b-tree:remove:[", bt_udata->stream); - for(u = 0; u < bt_udata->mesg->u.chunk.ndims - 1; u++) - HDfprintf(bt_udata->stream, "%s%Hd", u ? ", " : "", lt_key->offset[u]); - HDfputs("]\n", bt_udata->stream); -#endif + for(u = 0; u < udata->common.mesg->u.chunk.ndims - 1; u++) + if((hsize_t)lt_key->offset[u] > udata->dims[u]) { + H5D_istore_ud0_t bt_udata; - HDmemset(&udata, 0, sizeof udata); - udata.key = *lt_key; - udata.mesg = bt_udata->mesg; + HDmemset(&bt_udata, 0, sizeof bt_udata); + bt_udata.key = *lt_key; + bt_udata.mesg = udata->common.mesg; /* Remove */ - if(H5B_remove(f, dxpl_id, H5B_ISTORE, bt_udata->mesg->u.chunk.addr, &udata) < 0) + if(H5B_remove(f, dxpl_id, H5B_ISTORE, udata->common.mesg->u.chunk.addr, &bt_udata) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_ITER_ERROR, "unable to remove entry") break; } /* end if */ @@ -2962,8 +2861,6 @@ done: * * Comments: Part of H5B_ISTORE * - * Modifications: - * *------------------------------------------------------------------------- */ /* ARGSUSED */ @@ -3012,8 +2909,6 @@ done: * Fot the ones that are allocated we initialize the part that lies outside the boundary * with the fill value. * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -3205,8 +3100,6 @@ done: * Programmer: Quincey Koziol * Thursday, March 20, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -3219,7 +3112,7 @@ H5D_istore_delete(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout) /* Check if the B-tree has been created in the file */ if(H5F_addr_defined(layout->u.chunk.addr)) { H5O_layout_t tmp_layout=*layout;/* Local copy of layout info */ - H5D_istore_ud1_t udata; /* User data for B-tree iterator call */ + H5D_istore_ud0_t udata; /* User data for B-tree iterator call */ /* Set up user data for B-tree deletion */ HDmemset(&udata, 0, sizeof udata); @@ -3257,8 +3150,6 @@ done: * Programmer: Quincey Koziol * Saturday, May 29, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -3358,26 +3249,23 @@ done: * Programmer: Robb Matzke * Wednesday, April 28, 1999 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ herr_t H5D_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsigned ndims, haddr_t addr) { H5O_layout_t layout; - H5D_istore_ud1_t udata; + H5D_istore_it_ud2_t udata; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5D_istore_dump_btree, FAIL) HDmemset(&udata, 0, sizeof udata); layout.u.chunk.ndims = ndims; - udata.mesg = &layout; + udata.common.mesg = &layout; udata.stream = stream; if(stream) - HDfprintf(stream, " Address: %a\n",addr); + HDfprintf(stream, " Address: %a\n", addr); if(H5B_iterate(f, dxpl_id, H5B_ISTORE, H5D_istore_iter_dump, addr, &udata)<0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree") @@ -3399,8 +3287,6 @@ done: * Programmer: Robb Matzke * Thursday, May 21, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -3462,9 +3348,6 @@ done: * Programmer: Robb Matzke * Thursday, April 16, 1998 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ herr_t @@ -3472,20 +3355,22 @@ H5D_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int inden int fwidth, unsigned ndims) { H5O_layout_t layout; - H5D_istore_ud1_t udata; - herr_t ret_value=SUCCEED; /* Return value */ + H5D_istore_ud0_t udata; /* B-tree user data */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5D_istore_debug,FAIL) layout.u.chunk.ndims = ndims; - HDmemset (&udata, 0, sizeof udata); - udata.mesg = &layout; /* Allocate the shared structure */ if(H5D_istore_shared_create(f, &layout)<0) HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") - (void)H5B_debug (f, dxpl_id, addr, stream, indent, fwidth, H5B_ISTORE, &udata); + /* Set up B-tree user data */ + HDmemset(&udata, 0, sizeof udata); + udata.mesg = &layout; + + (void)H5B_debug(f, dxpl_id, addr, stream, indent, fwidth, H5B_ISTORE, &udata); /* Free the raw B-tree node buffer */ if(layout.u.chunk.btree_shared==NULL) diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 3595bf2..0edabb3 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -22,6 +22,14 @@ #include "H5public.h" #include "H5Ipublic.h" +/*****************/ +/* Public Macros */ +/*****************/ + +/*******************/ +/* Public Typedefs */ +/*******************/ + /* Values for the H5D_LAYOUT property */ typedef enum H5D_layout_t { H5D_LAYOUT_ERROR = -1, @@ -65,6 +73,13 @@ typedef enum H5D_fill_value_t { H5D_FILL_VALUE_USER_DEFINED =2 } H5D_fill_value_t; +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ #ifdef __cplusplus extern "C" { #endif @@ -73,33 +88,32 @@ extern "C" { typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); -H5_DLL hid_t H5Dcreate (hid_t file_id, const char *name, hid_t type_id, +H5_DLL hid_t H5Dcreate(hid_t file_id, const char *name, hid_t type_id, hid_t space_id, hid_t plist_id); -H5_DLL hid_t H5Dopen (hid_t file_id, const char *name); -H5_DLL herr_t H5Dclose (hid_t dset_id); -H5_DLL hid_t H5Dget_space (hid_t dset_id); -H5_DLL herr_t H5Dget_space_status(hid_t dset_id, - H5D_space_status_t *allocation); -H5_DLL hid_t H5Dget_type (hid_t dset_id); -H5_DLL hid_t H5Dget_create_plist (hid_t dset_id); +H5_DLL hid_t H5Dopen(hid_t file_id, const char *name); +H5_DLL herr_t H5Dclose(hid_t dset_id); +H5_DLL hid_t H5Dget_space(hid_t dset_id); +H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation); +H5_DLL hid_t H5Dget_type(hid_t dset_id); +H5_DLL hid_t H5Dget_create_plist(hid_t dset_id); H5_DLL hsize_t H5Dget_storage_size(hid_t dset_id); H5_DLL haddr_t H5Dget_offset(hid_t dset_id); -H5_DLL herr_t H5Dread (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, +H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, void *buf/*out*/); -H5_DLL herr_t H5Dwrite (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, +H5_DLL herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf); -H5_DLL herr_t H5Dextend (hid_t dset_id, const hsize_t *size); +H5_DLL herr_t H5Dextend(hid_t dset_id, const hsize_t *size); H5_DLL herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, void *operator_data); H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf); H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size); H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf, hid_t buf_type, hid_t space); -H5_DLL herr_t H5Dset_extent (hid_t dset_id, const hsize_t *size); +H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t *size); H5_DLL herr_t H5Ddebug(hid_t dset_id); #ifdef __cplusplus } #endif -#endif +#endif /* _H5Dpublic_H */ @@ -107,7 +107,6 @@ /* Local macros */ #define H5G_INIT_HEAP 8192 #define H5G_RESERVED_ATOMS 0 -#define H5G_SIZE_HINT 256 /*default root grp size hint */ /* * During name lookups (see H5G_namei()) we sometimes want information about @@ -147,6 +146,8 @@ typedef struct H5G_typeinfo_t { char *desc; /*description of object type */ } H5G_typeinfo_t; +/* Package variables */ + /* Local variables */ static H5G_typeinfo_t *H5G_type_g = NULL; /*object typing info */ static size_t H5G_ntypes_g = 0; /*entries in type table */ @@ -161,6 +162,9 @@ H5FL_DEFINE(H5G_shared_t); /* Declare extern the PQ free list for the wrapped strings */ H5FL_BLK_EXTERN(str_buf); +/* Declare a free list to manage haddr_t's */ +H5FL_DEFINE(haddr_t); + /* Private prototypes */ static herr_t H5G_register_type(int type, htri_t(*isa)(H5G_entry_t*, hid_t), const char *desc); @@ -4039,4 +4043,3 @@ H5G_unmount(H5G_t *grp) FUNC_LEAVE_NOAPI(SUCCEED); } /* end H5G_unmount() */ - diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 38c17aa..60c39b4 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -68,7 +68,6 @@ static herr_t H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy); static herr_t H5G_compute_size(const H5F_t *f, const H5G_node_t *sym, size_t *size_ptr); /* B-tree callbacks */ -static size_t H5G_node_sizeof_rkey(const H5F_t *f, const void *_udata); static H5RC_t *H5G_node_get_shared(const H5F_t *f, const void *_udata); static herr_t H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, void *_lt_key, void *_udata, void *_rt_key, @@ -109,7 +108,6 @@ const H5AC_class_t H5AC_SNODE[1] = {{ H5B_class_t H5B_SNODE[1] = {{ H5B_SNODE_ID, /*id */ sizeof(H5G_node_key_t), /*sizeof_nkey */ - H5G_node_sizeof_rkey, /*get_sizeof_rkey */ H5G_node_get_shared, /*get_shared */ H5G_node_create, /*new */ H5G_node_cmp2, /*cmp2 */ @@ -124,9 +122,6 @@ H5B_class_t H5B_SNODE[1] = {{ H5G_node_debug_key, /*debug */ }}; -/* Declare a free list to manage the H5B_shared_t struct */ -H5FL_EXTERN(H5B_shared_t); - /* Declare a free list to manage the H5G_node_t struct */ H5FL_DEFINE_STATIC(H5G_node_t); @@ -142,33 +137,8 @@ H5FL_SEQ_DEFINE_STATIC(size_t); /* Declare a free list to manage the raw page information */ H5FL_BLK_DEFINE_STATIC(grp_page); - -/*------------------------------------------------------------------------- - * Function: H5G_node_sizeof_rkey - * - * Purpose: Returns the size of a raw B-link tree key for the specified - * file. - * - * Return: Success: Size of the key. - * - * Failure: never fails - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 14 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static size_t -H5G_node_sizeof_rkey(const H5F_t *f, const void UNUSED * udata) -{ - /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_sizeof_rkey); - - FUNC_LEAVE_NOAPI(H5F_SIZEOF_SIZE(f)); /*the name offset */ -} +/* Declare extern the free list to manage haddr_t's */ +H5FL_EXTERN(haddr_t); /*------------------------------------------------------------------------- @@ -1757,7 +1727,7 @@ H5G_node_init(H5F_t *f) /* Set up the "global" information for this file's groups */ shared->type= H5B_SNODE; shared->two_k=2*H5F_KVALUE(f,H5B_SNODE); - shared->sizeof_rkey = H5G_node_sizeof_rkey(f, NULL); + shared->sizeof_rkey = H5F_SIZEOF_SIZE(f); /*the name offset */ assert(shared->sizeof_rkey); shared->sizeof_rnode = H5B_nodesize(f, shared, &shared->sizeof_keys); assert(shared->sizeof_rnode); diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 411fa1a..d68e413 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -31,9 +31,11 @@ #include "H5Gprivate.h" /* Other private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5Oprivate.h" /* Object headers */ +#define H5G_SIZE_HINT 256 /* default root grp size hint */ + /* * A symbol table node is a collection of symbol table entries. It can * be thought of as the lowest level of the B-link tree that points to diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 611ff08..fdf9a96 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -14,15 +14,13 @@ /*------------------------------------------------------------------------- * - * Created: H5Gproto.h + * Created: H5Gpublic.h * Jul 11 1997 * Robb Matzke <matzke@llnl.gov> * * Purpose: Public declarations for the H5G package (symbol * tables). * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5Gpublic_H @@ -148,6 +148,8 @@ static const H5O_class_t *const message_type_g[] = { H5O_MTIME_NEW, /*0x0012 New Object modification date and time */ }; +/* Library private variables */ + /* * An array of functions indexed by symbol table entry cache type * (H5G_type_t) that are called to retrieve constant messages cached in the @@ -1612,6 +1614,7 @@ done: * Aug 6 1997 * * Modifications: + * * Bill Wendling, 2003-09-30 * Protect the object header and pass it into the H5O_find_in_ohdr * function. This is done because the H5O_find_in_ohdr used to @@ -2869,12 +2872,12 @@ H5O_alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size) ret_value=idx; done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* H5O_alloc_extend_chunk() */ /*------------------------------------------------------------------------- - * Function: H5O_alloc_new_chunk + * Function: H5O_alloc_new_chunk * * Purpose: Allocates a new chunk for the object header but doen't * give the new chunk a file address yet. One of the other @@ -2883,18 +2886,18 @@ done: * message, then some message from another chunk is moved into * this chunk to make room. * - * SIZE need not be aligned. + * SIZE need not be aligned. * - * Return: Success: Index number of the null message for the - * new chunk. The null message will be at - * least SIZE bytes not counting the message - * ID or size fields. + * Return: Success: Index number of the null message for the + * new chunk. The null message will be at + * least SIZE bytes not counting the message + * ID or size fields. * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 7 1997 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 7 1997 * * Modifications: * @@ -2903,21 +2906,21 @@ done: static unsigned H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) { - size_t cont_size; /*continuation message size */ - int found_null = (-1); /*best fit null message */ - int found_other = (-1); /*best fit other message */ - unsigned idx; /*message number */ - uint8_t *p = NULL; /*ptr into new chunk */ - H5O_cont_t *cont = NULL; /*native continuation message */ - int chunkno; - unsigned u; - unsigned ret_value; /*return value */ + size_t cont_size; /*continuation message size */ + int found_null = (-1); /*best fit null message */ + int found_other = (-1); /*best fit other message */ + unsigned idx; /*message number */ + uint8_t *p = NULL; /*ptr into new chunk */ + H5O_cont_t *cont = NULL; /*native continuation message */ + int chunkno; + unsigned u; + unsigned ret_value; /*return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_alloc_new_chunk); /* check args */ - assert (oh); - assert (size > 0); + HDassert (oh); + HDassert (size > 0); size = H5O_ALIGN(size); /* @@ -2928,23 +2931,23 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) */ cont_size = H5O_ALIGN (H5F_SIZEOF_ADDR(f) + H5F_SIZEOF_SIZE(f)); for (u=0; u<oh->nmesgs; u++) { - if (H5O_NULL_ID == oh->mesg[u].type->id) { - if (cont_size == oh->mesg[u].raw_size) { - found_null = u; - break; - } else if (oh->mesg[u].raw_size >= cont_size && - (found_null < 0 || - (oh->mesg[u].raw_size < - oh->mesg[found_null].raw_size))) { - found_null = u; - } - } else if (H5O_CONT_ID == oh->mesg[u].type->id) { - /*don't consider continuation messages */ - } else if (oh->mesg[u].raw_size >= cont_size && - (found_other < 0 || - oh->mesg[u].raw_size < oh->mesg[found_other].raw_size)) { - found_other = u; - } + if (H5O_NULL_ID == oh->mesg[u].type->id) { + if (cont_size == oh->mesg[u].raw_size) { + found_null = u; + break; + } else if (oh->mesg[u].raw_size >= cont_size && + (found_null < 0 || + (oh->mesg[u].raw_size < + oh->mesg[found_null].raw_size))) { + found_null = u; + } + } else if (H5O_CONT_ID == oh->mesg[u].type->id) { + /*don't consider continuation messages */ + } else if (oh->mesg[u].raw_size >= cont_size && + (found_other < 0 || + oh->mesg[u].raw_size < oh->mesg[found_other].raw_size)) { + found_other = u; + } } assert(found_null >= 0 || found_other >= 0); @@ -2954,11 +2957,11 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) * other message. */ if (found_null < 0) - size += H5O_SIZEOF_MSGHDR(f) + oh->mesg[found_other].raw_size; + size += H5O_SIZEOF_MSGHDR(f) + oh->mesg[found_other].raw_size; /* * The total chunk size must include the requested space plus enough - * for the message header. This must be at least some minimum and a + * for the message header. This must be at least some minimum and a * multiple of the alignment size. */ size = MAX(H5O_MIN_SIZE, size + H5O_SIZEOF_MSGHDR(f)); @@ -2971,12 +2974,13 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) /* * Create the new chunk without giving it a file address. */ - if (oh->nchunks >= oh->alloc_nchunks) { + if ( oh->nchunks >= oh->alloc_nchunks ) { + unsigned na = oh->alloc_nchunks + H5O_NCHUNKS; H5O_chunk_t *x = H5FL_SEQ_REALLOC (H5O_chunk_t, oh->chunk, (size_t)na); if (!x) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed"); oh->alloc_nchunks = na; oh->chunk = x; } @@ -3003,28 +3007,30 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) /* Set new object header info to zeros */ HDmemset(&oh->mesg[old_alloc], 0, - (oh->alloc_nmesgs-old_alloc)*sizeof(H5O_mesg_t)); + (oh->alloc_nmesgs-old_alloc)*sizeof(H5O_mesg_t)); } /* * Describe the messages of the new chunk. */ if (found_null < 0) { - found_null = u = oh->nmesgs++; - oh->mesg[u].type = H5O_NULL; - oh->mesg[u].dirty = TRUE; - oh->mesg[u].native = NULL; - oh->mesg[u].raw = oh->mesg[found_other].raw; - oh->mesg[u].raw_size = oh->mesg[found_other].raw_size; - oh->mesg[u].chunkno = oh->mesg[found_other].chunkno; - - oh->mesg[found_other].dirty = TRUE; + found_null = u = oh->nmesgs++; + oh->mesg[u].type = H5O_NULL; + oh->mesg[u].dirty = TRUE; + oh->mesg[u].native = NULL; + oh->mesg[u].raw = oh->mesg[found_other].raw; + oh->mesg[u].raw_size = oh->mesg[found_other].raw_size; + oh->mesg[u].chunkno = oh->mesg[found_other].chunkno; + + oh->mesg[found_other].dirty = TRUE; /* Copy the message to the new location */ - HDmemcpy(p+H5O_SIZEOF_MSGHDR(f),oh->mesg[found_other].raw,oh->mesg[found_other].raw_size); - oh->mesg[found_other].raw = p + H5O_SIZEOF_MSGHDR(f); - oh->mesg[found_other].chunkno = chunkno; - p += H5O_SIZEOF_MSGHDR(f) + oh->mesg[found_other].raw_size; - size -= H5O_SIZEOF_MSGHDR(f) + oh->mesg[found_other].raw_size; + HDmemcpy(p + H5O_SIZEOF_MSGHDR(f), + oh->mesg[found_other].raw, + oh->mesg[found_other].raw_size); + oh->mesg[found_other].raw = p + H5O_SIZEOF_MSGHDR(f); + oh->mesg[found_other].chunkno = chunkno; + p += H5O_SIZEOF_MSGHDR(f) + oh->mesg[found_other].raw_size; + size -= H5O_SIZEOF_MSGHDR(f) + oh->mesg[found_other].raw_size; } idx = oh->nmesgs++; oh->mesg[idx].type = H5O_NULL; @@ -3040,19 +3046,19 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) * two null messages. */ if (oh->mesg[found_null].raw_size > cont_size) { - u = oh->nmesgs++; - oh->mesg[u].type = H5O_NULL; - oh->mesg[u].dirty = TRUE; - oh->mesg[u].native = NULL; - oh->mesg[u].raw = oh->mesg[found_null].raw + - cont_size + - H5O_SIZEOF_MSGHDR(f); - oh->mesg[u].raw_size = oh->mesg[found_null].raw_size - - (cont_size + H5O_SIZEOF_MSGHDR(f)); - oh->mesg[u].chunkno = oh->mesg[found_null].chunkno; - - oh->mesg[found_null].dirty = TRUE; - oh->mesg[found_null].raw_size = cont_size; + u = oh->nmesgs++; + oh->mesg[u].type = H5O_NULL; + oh->mesg[u].dirty = TRUE; + oh->mesg[u].native = NULL; + oh->mesg[u].raw = oh->mesg[found_null].raw + + cont_size + + H5O_SIZEOF_MSGHDR(f); + oh->mesg[u].raw_size = oh->mesg[found_null].raw_size - + (cont_size + H5O_SIZEOF_MSGHDR(f)); + oh->mesg[u].chunkno = oh->mesg[found_null].chunkno; + + oh->mesg[found_null].dirty = TRUE; + oh->mesg[found_null].raw_size = cont_size; } /* @@ -3061,7 +3067,7 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) oh->mesg[found_null].type = H5O_CONT; oh->mesg[found_null].dirty = TRUE; if (NULL==(cont = H5FL_MALLOC(H5O_cont_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed") cont->addr = HADDR_UNDEF; cont->size = 0; cont->chunkno = chunkno; @@ -3072,21 +3078,21 @@ H5O_alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size) done: FUNC_LEAVE_NOAPI(ret_value); -} +} /* H5O_alloc_new_chunk() */ /*------------------------------------------------------------------------- - * Function: H5O_alloc + * Function: H5O_alloc * - * Purpose: Allocate enough space in the object header for this message. + * Purpose: Allocate enough space in the object header for this message. * - * Return: Success: Index of message + * Return: Success: Index of message * - * Failure: Negative + * Failure: Negative * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Aug 6 1997 + * Programmer: Robb Matzke + * matzke@llnl.gov + * Aug 6 1997 * * Modifications: * @@ -3097,27 +3103,27 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size) { unsigned idx; H5O_mesg_t *msg; /* Pointer to newly allocated message */ - size_t aligned_size = H5O_ALIGN(size); - unsigned ret_value; /* Return value */ + size_t aligned_size = H5O_ALIGN(size); + unsigned ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5O_alloc); /* check args */ - assert (oh); - assert (type); + HDassert (oh); + HDassert (type); /* look for a null message which is large enough */ for (idx = 0; idx < oh->nmesgs; idx++) { - if (H5O_NULL_ID == oh->mesg[idx].type->id && + if (H5O_NULL_ID == oh->mesg[idx].type->id && oh->mesg[idx].raw_size >= aligned_size) - break; + break; } #ifdef LATER /* * Perhaps if we join adjacent null messages we could make one * large enough... we leave this as an exercise for future - * programmers :-) This isn't a high priority because when an + * programmers :-) This isn't a high priority because when an * object header is read from disk the null messages are combined * anyway. */ @@ -3125,63 +3131,62 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size) /* if we didn't find one, then allocate more header space */ if (idx >= oh->nmesgs) { - unsigned chunkno; + unsigned chunkno; /* * Look for a chunk which hasn't had disk space allocated yet * since we can just increase the size of that chunk. */ for (chunkno = 0; chunkno < oh->nchunks; chunkno++) { - if ((idx = H5O_alloc_extend_chunk(f, oh, chunkno, size)) != UFAIL) { + if ((idx = H5O_alloc_extend_chunk(f, oh, chunkno, size)) != UFAIL) break; - } H5E_clear(); } - /* - * Create a new chunk - */ - if (idx == UFAIL) { + /* if idx is still UFAIL, we were not able to extend a chunk. + * Create a new one. + */ + if(idx == UFAIL) { if ((idx = H5O_alloc_new_chunk(f, oh, size)) == UFAIL) - HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, UFAIL, "unable to create a new object header data chunk"); - } + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, UFAIL, "unable to create a new object header data chunk") + } } /* Set pointer to newly allocated message */ - msg=&oh->mesg[idx]; + msg = &(oh->mesg[idx]); /* do we need to split the null message? */ if (msg->raw_size > aligned_size) { H5O_mesg_t *null_msg; /* Pointer to null message */ size_t mesg_size = aligned_size+ H5O_SIZEOF_MSGHDR(f); /* Total size of newly allocated message */ - assert(msg->raw_size - aligned_size >= H5O_SIZEOF_MSGHDR(f)); + HDassert(msg->raw_size - aligned_size >= H5O_SIZEOF_MSGHDR(f)); - if (oh->nmesgs >= oh->alloc_nmesgs) { - int old_alloc=oh->alloc_nmesgs; - unsigned na = oh->alloc_nmesgs + H5O_NMESGS; - H5O_mesg_t *x = H5FL_SEQ_REALLOC (H5O_mesg_t, oh->mesg, (size_t)na); + if (oh->nmesgs >= oh->alloc_nmesgs) { + int old_alloc=oh->alloc_nmesgs; + unsigned na = oh->alloc_nmesgs + H5O_NMESGS; + H5O_mesg_t *x = H5FL_SEQ_REALLOC(H5O_mesg_t, oh->mesg, (size_t)na); if (!x) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed"); oh->alloc_nmesgs = na; oh->mesg = x; - /* Set new object header info to zeros */ - HDmemset(&oh->mesg[old_alloc],0, - (oh->alloc_nmesgs-old_alloc)*sizeof(H5O_mesg_t)); + /* Set new object header info to zeros */ + HDmemset(&oh->mesg[old_alloc],0, + (oh->alloc_nmesgs-old_alloc)*sizeof(H5O_mesg_t)); /* "Retarget" local 'msg' pointer into newly allocated array of messages */ msg=&oh->mesg[idx]; - } - null_msg=&oh->mesg[oh->nmesgs++]; - null_msg->type = H5O_NULL; - null_msg->dirty = TRUE; - null_msg->native = NULL; - null_msg->raw = msg->raw + mesg_size; - null_msg->raw_size = msg->raw_size - mesg_size; - null_msg->chunkno = msg->chunkno; - msg->raw_size = aligned_size; + } + null_msg = &(oh->mesg[oh->nmesgs++]); + null_msg->type = H5O_NULL; + null_msg->dirty = TRUE; + null_msg->native = NULL; + null_msg->raw = msg->raw + mesg_size; + null_msg->raw_size = msg->raw_size - mesg_size; + null_msg->chunkno = msg->chunkno; + msg->raw_size = aligned_size; } /* initialize the new message */ @@ -3192,11 +3197,11 @@ H5O_alloc(H5F_t *f, H5O_t *oh, const H5O_class_t *type, size_t size) oh->cache_info.is_dirty = TRUE; /* Set return value */ - ret_value=idx; + ret_value = idx; done: FUNC_LEAVE_NOAPI(ret_value); -} +} /* H5O_alloc() */ #ifdef NOT_YET diff --git a/src/H5Oattr.c b/src/H5Oattr.c index abff4f3..ccd9784 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -53,7 +53,7 @@ const H5O_class_t H5O_ATTR[1] = {{ H5O_attr_link, /* link method */ NULL, /* get share method */ NULL, /* set share method */ - H5O_attr_debug, /* debug the message */ + H5O_attr_debug /* debug the message */ }}; /* This is the initial version, which does not have support for shared datatypes */ @@ -65,12 +65,6 @@ const H5O_class_t H5O_ATTR[1] = {{ /* Flags for attribute flag encoding */ #define H5O_ATTR_FLAG_TYPE_SHARED 0x01 -/* Declare extern the free list for H5A_t's */ -H5FL_EXTERN(H5A_t); - -/* Declare extern the free list for attribute data buffers */ -H5FL_BLK_EXTERN(attr_buf); - /* Declare external the free list for H5S_t's */ H5FL_EXTERN(H5S_t); diff --git a/src/H5Obogus.c b/src/H5Obogus.c index 54a52b2..64f94ac 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -60,7 +60,7 @@ const H5O_class_t H5O_BOGUS[1] = {{ NULL, /* link method */ NULL, /*get share method */ NULL, /*set share method */ - H5O_bogus_debug, /*debug the message */ + H5O_bogus_debug /*debug the message */ }}; diff --git a/src/H5Ocont.c b/src/H5Ocont.c index e62ca07..3030827 100644 --- a/src/H5Ocont.c +++ b/src/H5Ocont.c @@ -60,7 +60,7 @@ const H5O_class_t H5O_CONT[1] = {{ NULL, /* link method */ NULL, /*get share method */ NULL, /*set share method */ - H5O_cont_debug, /*debugging */ + H5O_cont_debug /*debugging */ }}; /* Declare the free list for H5O_cont_t's */ diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 8a85b99..cef2cd2 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -53,7 +53,7 @@ const H5O_class_t H5O_DTYPE[1] = {{ NULL, /* link method */ H5O_dtype_get_share, /* get share method */ H5O_dtype_set_share, /* set share method */ - H5O_dtype_debug, /* debug the message */ + H5O_dtype_debug /* debug the message */ }}; /* This is the correct version to create all datatypes which don't contain diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 52b63dd..9f009b7 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -51,7 +51,7 @@ const H5O_class_t H5O_EFL[1] = {{ NULL, /* link method */ NULL, /*get share method */ NULL, /*set share method */ - H5O_efl_debug, /*debug the message */ + H5O_efl_debug /*debug the message */ }}; #define H5O_EFL_VERSION 1 diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 002666f..3dc3dfc 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -63,7 +63,7 @@ const H5O_class_t H5O_FILL[1] = {{ NULL, /* link method */ NULL, /*get share method */ NULL, /*set share method */ - H5O_fill_debug, /*debug the message */ + H5O_fill_debug /*debug the message */ }}; /* This message derives from H5O, for new fill value after version 1.4 */ @@ -81,7 +81,7 @@ const H5O_class_t H5O_FILL_NEW[1] = {{ NULL, /* link method */ NULL, /*get share method */ NULL, /*set share method */ - H5O_fill_new_debug, /*debug the message */ + H5O_fill_new_debug /*debug the message */ }}; /* Initial version of the "old" fill value information */ diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 6195daf..5367b11 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -21,13 +21,13 @@ #define H5O_PACKAGE /*suppress error about including H5Opkg */ -#include "H5private.h" -#include "H5Dprivate.h" -#include "H5Eprivate.h" -#include "H5FLprivate.h" /*Free Lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Dataset functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5MFprivate.h" /* File space management */ -#include "H5MMprivate.h" -#include "H5Opkg.h" /* Object header functions */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ /* PRIVATE PROTOTYPES */ static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); @@ -55,7 +55,7 @@ const H5O_class_t H5O_LAYOUT[1] = {{ NULL, /* link method */ NULL, /*get share method */ NULL, /*set share method */ - H5O_layout_debug, /*debug the message */ + H5O_layout_debug /*debug the message */ }}; /* For forward and backward compatibility. Version is 1 when space is @@ -289,7 +289,7 @@ H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg) else if(mesg->type==H5D_CHUNKED) H5F_addr_encode(f, &p, mesg->u.chunk.addr); - /* dimension size */ + /* Dimension sizes */ if(mesg->type!=H5D_CHUNKED) for (u = 0; u < mesg->unused.ndims; u++) UINT32ENCODE(p, mesg->unused.dim[u]) diff --git a/src/H5Omtime.c b/src/H5Omtime.c index d3c2f3c..aa8c085 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -60,7 +60,7 @@ const H5O_class_t H5O_MTIME[1] = {{ NULL, /* link method */ NULL, /*get share method */ NULL, /*set share method */ - H5O_mtime_debug, /*debug the message */ + H5O_mtime_debug /*debug the message */ }}; /* This message derives from H5O */ @@ -79,7 +79,7 @@ const H5O_class_t H5O_MTIME_NEW[1] = {{ NULL, /* link method */ NULL, /*get share method */ NULL, /*set share method */ - H5O_mtime_debug, /*debug the message */ + H5O_mtime_debug /*debug the message */ }}; /* Current version of new mtime information */ diff --git a/src/H5Oname.c b/src/H5Oname.c index 3934830..c67d5bb 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -32,6 +32,7 @@ #include "H5MMprivate.h" #include "H5Opkg.h" /* Object header functions */ + /* PRIVATE PROTOTYPES */ static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_name_encode(H5F_t *f, uint8_t *p, const void *_mesg); @@ -56,7 +57,7 @@ const H5O_class_t H5O_NAME[1] = {{ NULL, /* link method */ NULL, /*get share method */ NULL, /*set share method */ - H5O_name_debug, /*debug the message */ + H5O_name_debug /*debug the message */ }}; diff --git a/src/H5Onull.c b/src/H5Onull.c index 1d81da8..5308645 100644 --- a/src/H5Onull.c +++ b/src/H5Onull.c @@ -45,5 +45,5 @@ const H5O_class_t H5O_NULL[1] = {{ NULL, /*no link method */ NULL, /*no get share method */ NULL, /*no set share method */ - NULL, /*no debug method */ + NULL /*no debug method */ }}; diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 83889f6..5e15e54 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -19,8 +19,8 @@ #ifndef _H5Opkg_H #define _H5Opkg_H -/* Include private header file */ -#include "H5Oprivate.h" /* Object header functions */ +/* Get package's private header */ +#include "H5Oprivate.h" /* Object headers */ /* * Align messages on 8-byte boundaries because we would like to copy the diff --git a/src/H5Opline.c b/src/H5Opline.c index 280c8db..befc2b4 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -54,7 +54,7 @@ const H5O_class_t H5O_PLINE[1] = {{ NULL, /* link method */ NULL, /* get share method */ NULL, /* set share method */ - H5O_pline_debug, /* debug the message */ + H5O_pline_debug /* debug the message */ }}; diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index c4d88fc..baa7d33 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -28,16 +28,16 @@ #define _H5Oprivate_H /* Include the public header file for this API */ -#include "H5Opublic.h" /* Object header functions */ +#include "H5Opublic.h" /* Object header functions */ /* Public headers needed by this file */ -#include "H5Dpublic.h" /* Dataset functions */ -#include "H5Spublic.h" /* Dataspace functions */ +#include "H5Dpublic.h" /* Dataset functions */ +#include "H5Spublic.h" /* Dataspace functions */ /* Private headers needed by this file */ -#include "H5HGprivate.h" /* Global heap functions */ -#include "H5Tprivate.h" /* Datatype functions */ -#include "H5Zprivate.h" /* I/O pipeline filters */ +#include "H5HGprivate.h" /* Global heap functions */ +#include "H5Tprivate.h" /* Datatype functions */ +#include "H5Zprivate.h" /* I/O pipeline filters */ /* Object header macros */ #define H5O_MIN_SIZE H5O_ALIGN(32) /*min obj header data size */ diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 9f1ba67..733d895 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -49,7 +49,7 @@ const H5O_class_t H5O_SDSPACE[1] = {{ NULL, /* link method */ NULL, /* get share method */ NULL, /* set share method */ - H5O_sdspace_debug, /* debug the message */ + H5O_sdspace_debug /* debug the message */ }}; #define H5O_SDSPACE_VERSION 1 diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 8a0a291..ea0893d 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -59,7 +59,7 @@ const H5O_class_t H5O_SHARED[1] = {{ H5O_shared_link, /*link method */ NULL, /*get share method */ NULL, /*set share method */ - H5O_shared_debug, /*debug method */ + H5O_shared_debug /*debug method */ }}; /* Old version, with full symbol table entry as link for object header sharing */ diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 21391bd..b8617f4 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -43,7 +43,7 @@ static size_t H5O_stab_size(const H5F_t *f, const void *_mesg); static herr_t H5O_stab_free(void *_mesg); static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link); static herr_t H5O_stab_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, - FILE * stream, int indent, int fwidth); + FILE * stream, int indent, int fwidth); /* This message derives from H5O */ const H5O_class_t H5O_STAB[1] = {{ @@ -60,7 +60,7 @@ const H5O_class_t H5O_STAB[1] = {{ NULL, /* link method */ NULL, /*get share method */ NULL, /*set share method */ - H5O_stab_debug, /*debug the message */ + H5O_stab_debug /*debug the message */ }}; /* Declare a free list to manage the H5O_stab_t struct */ @@ -3109,8 +3109,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to copy entry"); } /* end if */ else { - HDmemset (&(new_dt->ent), 0, sizeof(new_dt->ent)); - new_dt->ent.header = HADDR_UNDEF; + H5G_ent_reset(&(new_dt->ent)); } /* end else */ /* Set return value */ diff --git a/src/Makefile.in b/src/Makefile.in index 49f5c3b..1747657 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -30,7 +30,8 @@ LIB=libhdf5.la DISTCLEAN=libhdf5.settings ## Source and object files for the library (lexicographically)... -LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5C.c H5D.c H5Dcontig.c H5Dcompact.c H5Defl.c \ +LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5C.c H5D.c H5Dcontig.c \ + H5Dcompact.c H5Defl.c \ H5Dio.c H5Distore.c H5Dmpio.c H5Dselect.c H5Dtest.c H5E.c H5F.c \ H5Fdbg.c H5Fmount.c H5Fsfile.c H5Fsuper.c H5FD.c \ H5FDcore.c H5FDfamily.c H5FDgass.c H5FDlog.c H5FDmpi.c H5FDmpio.c \ @@ -65,7 +66,8 @@ PUB_HDR=H5public.h H5Apublic.h H5ACpublic.h H5Bpublic.h H5Cpublic.h \ H5Tpublic.h H5Zpublic.h H5pubconf.h hdf5.h H5api_adpt.h ## Other header files (not to be installed)... -PRIVATE_HDR=H5private.h H5Aprivate.h H5Apkg.h H5ACprivate.h H5Bprivate.h \ +PRIVATE_HDR=H5private.h H5Aprivate.h H5Apkg.h H5ACprivate.h H5Bpkg.h \ + H5Bprivate.h \ H5Cprivate.h \ H5Dprivate.h H5Eprivate.h H5Fprivate.h H5FDprivate.h H5FLprivate.h \ H5FOprivate.h H5FSprivate.h H5Gprivate.h H5Gpkg.h \ |