hdf5/src/H5Gent.c

555 lines
17 KiB
C
Raw Normal View History

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Programmer: Robb Matzke <matzke@llnl.gov>
* Friday, September 19, 1997
*/
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
/* Packages needed by this file... */
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Gpkg.h" /* Groups */
#include "H5HLprivate.h" /* Local Heaps */
2005-11-15 10:55:39 +08:00
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory Management */
2005-11-15 10:55:39 +08:00
/* Private macros */
#define H5G_NO_CHANGE (-1) /*see H5G_ent_modified() */
/* Private prototypes */
#ifdef NOT_YET
static herr_t H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type);
#endif /* NOT_YET */
2005-11-15 10:55:39 +08:00
static herr_t H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent);
static herr_t H5G_ent_decode(H5F_t *f, const uint8_t **pp,
H5G_entry_t *ent/*out*/);
/* Declare extern the PQ free list for the wrapped strings */
H5FL_BLK_EXTERN(str_buf);
/*-------------------------------------------------------------------------
* Function: H5G_ent_modified
*
* Purpose: This function should be called after you make any
* modifications to a symbol table entry cache. Supply the new
* type for the cache. If CACHE_TYPE is the constant
* H5G_NO_CHANGE then the cache type isn't changed--just the
* dirty bit is set.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Friday, September 19, 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
2005-11-15 10:55:39 +08:00
herr_t
H5G_ent_modified(H5G_entry_t *ent, H5G_type_t cache_type)
{
FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_modified)
HDassert(ent);
/* Update cache type, if requested */
if (H5G_NO_CHANGE != cache_type)
ent->type = cache_type;
ent->dirty = TRUE;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5G_ent_modified */
/*-------------------------------------------------------------------------
* Function: H5G_ent_decode_vec
*
* Purpose: Same as H5G_ent_decode() except it does it for an array of
* symbol table entries.
*
* Errors:
* SYM CANTDECODE Can't decode.
*
* Return: Success: Non-negative, with *pp pointing to the first byte
* after the last symbol.
*
* Failure: Negative
*
* Programmer: Robb Matzke
* matzke@llnl.gov
* Jul 18 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n)
{
unsigned u;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_ent_decode_vec, FAIL);
/* check arguments */
assert(f);
assert(pp);
assert(ent);
/* decode entries */
for (u = 0; u < n; u++)
if (H5G_ent_decode(f, pp, ent + u) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode")
done:
FUNC_LEAVE_NOAPI(ret_value);
}
/*-------------------------------------------------------------------------
* Function: H5G_ent_decode
*
* Purpose: Decodes a symbol table entry pointed to by `*pp'.
*
* Errors:
*
* Return: Success: Non-negative with *pp pointing to the first byte
* following the symbol table entry.
*
* Failure: Negative
*
* Programmer: Robb Matzke
* matzke@llnl.gov
* Jul 18 1997
*
* Modifications:
* Robb Matzke, 17 Jul 1998
* Added a 4-byte padding field for alignment and future expansion.
*
*-------------------------------------------------------------------------
*/
2005-11-15 10:55:39 +08:00
static herr_t
[svn-r925] Changes since 19981116 ---------------------- ./INSTALL.parallel [NEW] We're beginning to unify some of the parallel installation steps. This file will contain general information for installing the parallel library. It's not complete yet. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] Check for xdr_int() in libnsl required on Solaris when linking with hdf4. It's found on the Irix system I tested which complains that `-lnsl' didn't resolve any symbols. Oh well. Fixed the order of searching for libdf and libmfhdf for hdf4 linking. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5Z.c Check for compress() in libz in order to find older versions of the library that will still work for hdf4. Added a separate check for compress2() that hdf5 will use. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5.c ./src/H5private.h ./src/H5A.c ./src/H5B.c ./src/H5Bprivate.h ./src/H5D.c ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fmpio.c ./src/H5Fprivate.h ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5Gprivate.h ./src/H5HG.c ./src/H5HL.c ./src/H5O.c ./src/H5Oattr.c ./src/H5Ocomp.c ./src/H5Ocont.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Ofill.c ./src/H5Olayout.c ./src/H5Omtime.c ./src/H5Oname.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5R.c ./src/H5RA.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Snone.c ./src/H5Spoint.c ./src/H5Sprivate.h ./src/H5Sselect.c ./src/H5T.c ./src/H5Tbit.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5V.c ./test/bittests.c ./test/gheap.c ./test/hyperslab.c ./test/istore.c ./test/tmeta.c ./test/trefer.c ./test/tselect.c ./tools/h5debug.c ./tools/h5tols.c Added checks for Posix.1g types like `int8_t'. If not defined then H5private.h defines them. Changed all `int8' etc. to `int8_t'. ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5I.c ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c ./src/H5TB.c ./src/H5Z.c Calling H5*_term_interface() resets interface_initialize_g to FALSE so a subsequent call to H5open() (implied or explicit) reinitializes global variables properly. ./src/H5private.h ./src/H5Oefl.c ./src/H5S.c Changed MAX_SIZET, MAX_SSIZET, MAX_HSIZET, and MAX_HSSIZET to SIZET_MAX, SSIZET_MAX, HSIZET_MAX, and HSSIZE_MAX to they match the Posix.1 constants in <limits.h>. ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5Tprivate.h ./src/H5detect.c Added 36 more integer hardware conversion functions to the type conversion table for conversions to/from `long long' and `unsigned long long'. The `long long' names will be changed shortly to make them portable to Win32. Changed H5T_init() to H5T_native_open() and added an H5T_native_close() to open and close the predefined native data types. Increased the initial size of the type conversion table from 64 to 128 entries. Reordered the 90 new integer conversion functions so the names that are printed favor `int' over `short' or `long' when two of them are the same. ./test/dtypes.c Added hardware and software integer conversion tests for the 56 functions I added recently but not the additional 36 checked in this time. That will come next. Call H5close() after each test so type conversion statistics are easier to follow. Try this: $ HDF5_DEBUG=t ./dtypes Added more debugging output for when things go wrong. ./src/H5private.h Removed trailing carriage-returns inserted by broken operating system ;-)
1998-11-19 02:40:09 +08:00
H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent)
{
[svn-r925] Changes since 19981116 ---------------------- ./INSTALL.parallel [NEW] We're beginning to unify some of the parallel installation steps. This file will contain general information for installing the parallel library. It's not complete yet. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] Check for xdr_int() in libnsl required on Solaris when linking with hdf4. It's found on the Irix system I tested which complains that `-lnsl' didn't resolve any symbols. Oh well. Fixed the order of searching for libdf and libmfhdf for hdf4 linking. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5Z.c Check for compress() in libz in order to find older versions of the library that will still work for hdf4. Added a separate check for compress2() that hdf5 will use. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5.c ./src/H5private.h ./src/H5A.c ./src/H5B.c ./src/H5Bprivate.h ./src/H5D.c ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fmpio.c ./src/H5Fprivate.h ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5Gprivate.h ./src/H5HG.c ./src/H5HL.c ./src/H5O.c ./src/H5Oattr.c ./src/H5Ocomp.c ./src/H5Ocont.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Ofill.c ./src/H5Olayout.c ./src/H5Omtime.c ./src/H5Oname.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5R.c ./src/H5RA.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Snone.c ./src/H5Spoint.c ./src/H5Sprivate.h ./src/H5Sselect.c ./src/H5T.c ./src/H5Tbit.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5V.c ./test/bittests.c ./test/gheap.c ./test/hyperslab.c ./test/istore.c ./test/tmeta.c ./test/trefer.c ./test/tselect.c ./tools/h5debug.c ./tools/h5tols.c Added checks for Posix.1g types like `int8_t'. If not defined then H5private.h defines them. Changed all `int8' etc. to `int8_t'. ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5I.c ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c ./src/H5TB.c ./src/H5Z.c Calling H5*_term_interface() resets interface_initialize_g to FALSE so a subsequent call to H5open() (implied or explicit) reinitializes global variables properly. ./src/H5private.h ./src/H5Oefl.c ./src/H5S.c Changed MAX_SIZET, MAX_SSIZET, MAX_HSIZET, and MAX_HSSIZET to SIZET_MAX, SSIZET_MAX, HSIZET_MAX, and HSSIZE_MAX to they match the Posix.1 constants in <limits.h>. ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5Tprivate.h ./src/H5detect.c Added 36 more integer hardware conversion functions to the type conversion table for conversions to/from `long long' and `unsigned long long'. The `long long' names will be changed shortly to make them portable to Win32. Changed H5T_init() to H5T_native_open() and added an H5T_native_close() to open and close the predefined native data types. Increased the initial size of the type conversion table from 64 to 128 entries. Reordered the 90 new integer conversion functions so the names that are printed favor `int' over `short' or `long' when two of them are the same. ./test/dtypes.c Added hardware and software integer conversion tests for the 56 functions I added recently but not the additional 36 checked in this time. That will come next. Call H5close() after each test so type conversion statistics are easier to follow. Try this: $ HDF5_DEBUG=t ./dtypes Added more debugging output for when things go wrong. ./src/H5private.h Removed trailing carriage-returns inserted by broken operating system ;-)
1998-11-19 02:40:09 +08:00
const uint8_t *p_ret = *pp;
uint32_t tmp;
2005-11-15 10:55:39 +08:00
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_ent_decode)
/* check arguments */
2005-11-15 10:55:39 +08:00
HDassert(f);
HDassert(pp);
HDassert(ent);
ent->file = f;
/* decode header */
H5F_DECODE_LENGTH(f, *pp, ent->name_off);
H5F_addr_decode(f, pp, &(ent->header));
UINT32DECODE(*pp, tmp);
*pp += 4; /*reserved*/
ent->type=(H5G_type_t)tmp;
/* decode scratch-pad */
switch (ent->type) {
case H5G_NOTHING_CACHED:
break;
case H5G_CACHED_STAB:
assert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH);
H5F_addr_decode(f, pp, &(ent->cache.stab.btree_addr));
H5F_addr_decode(f, pp, &(ent->cache.stab.heap_addr));
break;
case H5G_CACHED_SLINK:
UINT32DECODE (*pp, ent->cache.slink.lval_offset);
break;
default:
HDabort();
}
*pp = p_ret + H5G_SIZEOF_ENTRY(f);
2005-11-15 10:55:39 +08:00
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5G_ent_decode() */
/*-------------------------------------------------------------------------
* Function: H5G_ent_encode_vec
*
* Purpose: Same as H5G_ent_encode() except it does it for an array of
* symbol table entries.
*
* Errors:
* SYM CANTENCODE Can't encode.
*
* Return: Success: Non-negative, with *pp pointing to the first byte
* after the last symbol.
*
* Failure: Negative
*
* Programmer: Robb Matzke
* matzke@llnl.gov
* Jul 18 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n)
{
unsigned u;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_ent_encode_vec, FAIL);
/* check arguments */
assert(f);
assert(pp);
assert(ent);
/* encode entries */
for (u = 0; u < n; u++)
if (H5G_ent_encode(f, pp, ent + u) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode");
done:
FUNC_LEAVE_NOAPI(ret_value);
}
/*-------------------------------------------------------------------------
* Function: H5G_ent_encode
*
* Purpose: Encodes the specified symbol table entry into the buffer
* pointed to by *pp.
*
* Errors:
*
* Return: Success: Non-negative, with *pp pointing to the first byte
* after the symbol table entry.
*
* Failure: Negative
*
* Programmer: Robb Matzke
* matzke@llnl.gov
* Jul 18 1997
*
* Modifications:
*
* Robb Matzke, 8 Aug 1997
* Writes zeros for the bytes that aren't used so the file doesn't
* contain junk.
*
*-------------------------------------------------------------------------
*/
2005-11-15 10:55:39 +08:00
static herr_t
[svn-r925] Changes since 19981116 ---------------------- ./INSTALL.parallel [NEW] We're beginning to unify some of the parallel installation steps. This file will contain general information for installing the parallel library. It's not complete yet. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] Check for xdr_int() in libnsl required on Solaris when linking with hdf4. It's found on the Irix system I tested which complains that `-lnsl' didn't resolve any symbols. Oh well. Fixed the order of searching for libdf and libmfhdf for hdf4 linking. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5Z.c Check for compress() in libz in order to find older versions of the library that will still work for hdf4. Added a separate check for compress2() that hdf5 will use. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5.c ./src/H5private.h ./src/H5A.c ./src/H5B.c ./src/H5Bprivate.h ./src/H5D.c ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fmpio.c ./src/H5Fprivate.h ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5Gprivate.h ./src/H5HG.c ./src/H5HL.c ./src/H5O.c ./src/H5Oattr.c ./src/H5Ocomp.c ./src/H5Ocont.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Ofill.c ./src/H5Olayout.c ./src/H5Omtime.c ./src/H5Oname.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5R.c ./src/H5RA.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Snone.c ./src/H5Spoint.c ./src/H5Sprivate.h ./src/H5Sselect.c ./src/H5T.c ./src/H5Tbit.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5V.c ./test/bittests.c ./test/gheap.c ./test/hyperslab.c ./test/istore.c ./test/tmeta.c ./test/trefer.c ./test/tselect.c ./tools/h5debug.c ./tools/h5tols.c Added checks for Posix.1g types like `int8_t'. If not defined then H5private.h defines them. Changed all `int8' etc. to `int8_t'. ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5I.c ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c ./src/H5TB.c ./src/H5Z.c Calling H5*_term_interface() resets interface_initialize_g to FALSE so a subsequent call to H5open() (implied or explicit) reinitializes global variables properly. ./src/H5private.h ./src/H5Oefl.c ./src/H5S.c Changed MAX_SIZET, MAX_SSIZET, MAX_HSIZET, and MAX_HSSIZET to SIZET_MAX, SSIZET_MAX, HSIZET_MAX, and HSSIZE_MAX to they match the Posix.1 constants in <limits.h>. ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5Tprivate.h ./src/H5detect.c Added 36 more integer hardware conversion functions to the type conversion table for conversions to/from `long long' and `unsigned long long'. The `long long' names will be changed shortly to make them portable to Win32. Changed H5T_init() to H5T_native_open() and added an H5T_native_close() to open and close the predefined native data types. Increased the initial size of the type conversion table from 64 to 128 entries. Reordered the 90 new integer conversion functions so the names that are printed favor `int' over `short' or `long' when two of them are the same. ./test/dtypes.c Added hardware and software integer conversion tests for the 56 functions I added recently but not the additional 36 checked in this time. That will come next. Call H5close() after each test so type conversion statistics are easier to follow. Try this: $ HDF5_DEBUG=t ./dtypes Added more debugging output for when things go wrong. ./src/H5private.h Removed trailing carriage-returns inserted by broken operating system ;-)
1998-11-19 02:40:09 +08:00
H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent)
{
[svn-r925] Changes since 19981116 ---------------------- ./INSTALL.parallel [NEW] We're beginning to unify some of the parallel installation steps. This file will contain general information for installing the parallel library. It's not complete yet. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] Check for xdr_int() in libnsl required on Solaris when linking with hdf4. It's found on the Irix system I tested which complains that `-lnsl' didn't resolve any symbols. Oh well. Fixed the order of searching for libdf and libmfhdf for hdf4 linking. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5Z.c Check for compress() in libz in order to find older versions of the library that will still work for hdf4. Added a separate check for compress2() that hdf5 will use. ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./src/H5.c ./src/H5private.h ./src/H5A.c ./src/H5B.c ./src/H5Bprivate.h ./src/H5D.c ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fmpio.c ./src/H5Fprivate.h ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5Gprivate.h ./src/H5HG.c ./src/H5HL.c ./src/H5O.c ./src/H5Oattr.c ./src/H5Ocomp.c ./src/H5Ocont.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Ofill.c ./src/H5Olayout.c ./src/H5Omtime.c ./src/H5Oname.c ./src/H5Oprivate.h ./src/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5R.c ./src/H5RA.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Snone.c ./src/H5Spoint.c ./src/H5Sprivate.h ./src/H5Sselect.c ./src/H5T.c ./src/H5Tbit.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5V.c ./test/bittests.c ./test/gheap.c ./test/hyperslab.c ./test/istore.c ./test/tmeta.c ./test/trefer.c ./test/tselect.c ./tools/h5debug.c ./tools/h5tols.c Added checks for Posix.1g types like `int8_t'. If not defined then H5private.h defines them. Changed all `int8' etc. to `int8_t'. ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5I.c ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c ./src/H5TB.c ./src/H5Z.c Calling H5*_term_interface() resets interface_initialize_g to FALSE so a subsequent call to H5open() (implied or explicit) reinitializes global variables properly. ./src/H5private.h ./src/H5Oefl.c ./src/H5S.c Changed MAX_SIZET, MAX_SSIZET, MAX_HSIZET, and MAX_HSSIZET to SIZET_MAX, SSIZET_MAX, HSIZET_MAX, and HSSIZE_MAX to they match the Posix.1 constants in <limits.h>. ./src/H5T.c ./src/H5Tconv.c ./src/H5Tpkg.h ./src/H5Tprivate.h ./src/H5detect.c Added 36 more integer hardware conversion functions to the type conversion table for conversions to/from `long long' and `unsigned long long'. The `long long' names will be changed shortly to make them portable to Win32. Changed H5T_init() to H5T_native_open() and added an H5T_native_close() to open and close the predefined native data types. Increased the initial size of the type conversion table from 64 to 128 entries. Reordered the 90 new integer conversion functions so the names that are printed favor `int' over `short' or `long' when two of them are the same. ./test/dtypes.c Added hardware and software integer conversion tests for the 56 functions I added recently but not the additional 36 checked in this time. That will come next. Call H5close() after each test so type conversion statistics are easier to follow. Try this: $ HDF5_DEBUG=t ./dtypes Added more debugging output for when things go wrong. ./src/H5private.h Removed trailing carriage-returns inserted by broken operating system ;-)
1998-11-19 02:40:09 +08:00
uint8_t *p_ret = *pp + H5G_SIZEOF_ENTRY(f);
2005-11-15 10:55:39 +08:00
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_ent_encode);
/* check arguments */
assert(f);
assert(pp);
if (ent) {
/* encode header */
H5F_ENCODE_LENGTH(f, *pp, ent->name_off);
H5F_addr_encode(f, pp, ent->header);
UINT32ENCODE(*pp, ent->type);
UINT32ENCODE(*pp, 0); /*reserved*/
/* encode scratch-pad */
switch (ent->type) {
case H5G_NOTHING_CACHED:
break;
case H5G_CACHED_STAB:
assert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH);
H5F_addr_encode(f, pp, ent->cache.stab.btree_addr);
H5F_addr_encode(f, pp, ent->cache.stab.heap_addr);
break;
case H5G_CACHED_SLINK:
UINT32ENCODE (*pp, ent->cache.slink.lval_offset);
break;
default:
HDabort();
}
} else {
H5F_ENCODE_LENGTH(f, *pp, 0);
[svn-r1568] Changes since 19990730 ---------------------- This extensive change is the virtual file layer implementation. I've ported and tested the sec2, family, and core drivers and only ported the mpio driver (Albert will test it). So if you need MPIO I would recommend sticking with the previous version for a while. You will get a few compile warnings about split and stdio drivers not being implemented and possibly tracing information not inserted in some of the drivers. You can safely ignore them but I plan to fix them. I'm still working on the split driver because I just realized that it needs a part of the VFL that isn't written yet. Documentation is being updated also because there were some minor changes (mostly just name changes). It should be available on my web site later this week. ./MANIFEST ./src/Makefile.in ./src/hdf5.h ./src/H5Flow.c [REMOVED] ./src/H5Fstdio.c [REMOVED] ./src/H5Fsec2.c [REMOVED] ./src/H5Fsplit.c [REMOVED] ./src/H5Fmpio.c [REMOVED] ./src/H5Ffamily.c [REMOVED] ./src/H5Fcore.c [REMOVED] ./src/H5MFpublic.h [REMOVED] ./src/H5FD.c [NEW] ./src/H5FDcore.c [NEW] ./src/H5FDcore.h [NEW] ./src/H5FDfamily.c [NEW] ./src/H5FDfamily.h [NEW] ./src/H5FDmpio.c [NEW] ./src/H5FDmpio.h [NEW] ./src/H5FDprivate.h [NEW] ./src/H5FDpublic.h [NEW] ./src/H5FDsec2.c [NEW] ./src/H5FDsec2.h [NEW] Removed/added files for virtual file layer. ./bin/trace ./src/H5.c Removed unused public datatypes and added new VFL public datatypes. Changed an error message. ./config/BlankForm ./config/dec-flags ./config/gnu-flags ./config/hpux10.20 ./config/hpux9.03 ./config/irix5.x ./config/irix6.x ./config/solaris2.x ./config/unicosmk Removed the H5F_OPT_SEEK and H5F_LOW_DFLT constants from the configuration since they're no longer applicable. The default file driver is always the sec2 driver and it always optimizes calls to lseek() or lseek64(). ./config/depend.in C preprocessor errors generated during automatic dependency building are sent to /dev/null to prevent them from appearing twice in the make output. ./src/H5AC.c ./src/H5B.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5HG.c ./src/H5HL.c ./src/H5O.c ./src/H5Oattr.c ./src/H5Odtype.c ./src/H5Oefl.c ./src/H5Oshared.c ./src/H5T.c ./src/H5detect.c ./test/ohdr.c Changed H5F_ADDR_UNDEF to HADDR_UNDEF to be more consistent with the `haddr_t' datatype which is now a public type. ./src/H5D.c ./src/H5P.c ./src/H5Ppublic.h ./src/H5Tconv.c ./test/cmpd_dset.c ./test/dsets.c ./test/overhead.c ./test/tselect.c ./test/tvltypes.c The H5P_DATASET_XFER constant was changed to H5P_DATA_XFER because the properties apply to all types of I/O operations, not just datasets. ./src/H5B.c ./src/H5Bprivate.h ./src/H5D.c ./src/H5Dpublic.h ./src/H5F.c ./src/H5Farray.c ./src/H5Fistore.c ./src/H5Fprivate.h ./src/H5Fpublic.h ./src/H5Gnode.c ./src/H5Gpkg.h ./src/H5HG.c ./src/H5HL.c ./src/H5O.c ./src/H5R.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Smpio.c ./src/H5Spoint.c ./src/H5Sprivate.h ./test/big.c ./test/h5test.c ./test/istore.c ./testpar/t_dset.c ./testpar/t_file.c ./tools/h5debug.c ./tools/h5ls.c Modified to work with the virtual file layer by calling H5FD_* functions instead of H5F_low_* functions and by passing file access and data transfer properties by object ID instead of pointer. Changed H5D_transfer_t to H5FD_mpio_xfer_t since the COLLECTIVE vs. INDEPENDENT transfer mode is specific to the MPIO file driver. Moved MPIO-specific stuff into the MPIO driver. ./src/H5B.c ./src/H5D.c ./src/H5Fprivate.h The H5F_mpio_* private functions were renamed and placed in the H5FDmpio driver except those which appeared in H5Smpio.c. ./src/H5E.c ./src/H5Epublic.h Added major error number H5E_VFL for virtual file layer related errors. ./src/H5F.c ./src/H5Fprivate.h Changed the logic that controls whether the boot block is written. Instead of assuming that the first call to write the boot block is only to allocate space, I've added a function argument which makes this explicit. Changed the way files are compared so that a driver-defined comparison function can be called. Files which belong to different drivers are always considered different. Removed H5F_driver_t since file drivers are now identified by object ID instead of a special non-user-extendible datatype. Removed all the hard-coded low-level file properties which have been replaced by the various file drivers. ./src/H5I.c ./src/H5Iprivate.h Added the H5I_inc_ref() which was removed a few months ago since we finally have a use for it. ./src/H5Ipublic.h Added the H5I_VFL object ID type to identify file drivers in the virtual file layer. ./src/H5MF.c ./src/H5MFprivate.h Moved all the allocation/deallocation code into the virtual file layer which allows file drivers to override much of it. ./src/H5P.c ./src/H5Ppublic.h Moved file driver-specific code into the various file driver files. The H5Pcopy() and H5Pclose() functions make calls into the virtual file driver to manage the memory for driver-specific file access and data transfer properties. ./src/H5private.h ./src/H5public.h The `haddr_t' type is now public. ./test/tfile.c Added a few more comments.
1999-08-11 04:21:32 +08:00
H5F_addr_encode(f, pp, HADDR_UNDEF);
UINT32ENCODE(*pp, H5G_NOTHING_CACHED);
UINT32ENCODE(*pp, 0); /*reserved*/
}
/* fill with zero */
while (*pp < p_ret) *(*pp)++ = 0;
*pp = p_ret;
FUNC_LEAVE_NOAPI(SUCCEED);
}
/*-------------------------------------------------------------------------
2005-11-15 10:55:39 +08:00
* Function: H5G_ent_copy
*
2005-11-15 10:55:39 +08:00
* Purpose: Do a deep copy of symbol table entries
*
2005-11-15 10:55:39 +08:00
* Return: Success: Non-negative
* Failure: Negative
*
2005-11-15 10:55:39 +08:00
* Programmer: Pedro Vicente
* pvn@ncsa.uiuc.edu
* ???day, August ??, 2002
*
2005-11-15 10:55:39 +08:00
* Notes: 'depth' parameter determines how much of the group entry
* structure we want to copy. The values are:
* H5_COPY_SHALLOW - Copy all the fields from the source
* to the destination, including the user path and
* canonical path. (Destination "takes ownership" of
* user and canonical paths)
* H5_COPY_DEEP - Copy all the fields from the source to
* the destination, deep copying the user and canonical
* paths.
*
*-------------------------------------------------------------------------
*/
herr_t
H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth)
{
2005-11-15 10:55:39 +08:00
FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_copy)
[svn-r6252] Purpose: Lots of performance improvements & a couple new internal API interfaces. Description: Performance Improvements: - Cached file offset & length sizes in shared file struct, to avoid constantly looking them up in the FCPL. - Generic property improvements: - Added "revision" number to generic property classes to speed up comparisons. - Changed method of storing properties from using a hash-table to the TBBT routines in the library. - Share the propery names between classes and the lists derived from them. - Removed redundant 'def_value' buffer from each property. - Switching code to use a "copy on write" strategy for properties in each list, where the properties in each list are shared with the properties in the class, until a property's value is changed in a list. - Fixed error in layout code which was allocating too many buffers. - Redefined public macros of the form (H5open()/H5check, <variable>) internally to only be (<variable>), avoiding innumerable useless calls to H5open() and H5check_version(). - Reuse already zeroed buffers in H5F_contig_fill instead of constantly re-zeroing them. - Don't write fill values if writing entire dataset. - Use gettimeofday() system call instead of time() system when checking the modification time of a dataset. - Added reference counted string API and use it for tracking the names of objects opening in a file (for the ID->name code). - Removed redundant H5P_get() calls in B-tree routines. - Redefine H5T datatype macros internally to the library, to avoid calling H5check redundantly. - Keep dataspace information for dataset locally instead of reading from disk each time. Added new module to track open objects in a file, to allow this (which will be useful eventually for some FPH5 metadata caching issues). - Remove H5AC_find macro which was inlining metadata cache lookups, and call function instead. - Remove redundant memset() calls from H5G_namei() routine. - Remove redundant checking of object type when locating objects in metadata cache and rely on the address only. - Create default dataset object to use when default dataset creation property list is used to create datasets, bypassing querying for all the property list values. - Use default I/O vector size when performing raw data with the default dataset transfer property list, instead of querying for I/O vector size. - Remove H5P_DEFAULT internally to the library, replacing it with more specific default property list based on the type of property list needed. - Remove redundant memset() calls in object header message (H5O*) routines. - Remove redunant memset() calls in data I/O routines. - Split free-list allocation routines into malloc() and calloc()- like routines, instead of one combined routine. - Remove lots of indirection in H5O*() routines. - Simplify metadata cache entry comparison routine (used when flushing entire cache out). - Only enable metadata cache statistics when H5AC_DEBUG is turned on, instead of always tracking them. - Simplify address comparison macro (H5F_addr_eq). - Remove redundant metadata cache entry protections during dataset creation by protecting the object header once and making all the modifications necessary for the dataset creation before unprotecting it. - Reduce # of "number of element in extent" computations performed by computing and storing the value during dataspace creation. - Simplify checking for group location's file information, when file has not been involving in file-mounting operations. - Use binary encoding for modification time, instead of ASCII. - Hoist H5HL_peek calls (to get information in a local heap) out of loops in many group routine. - Use static variable for iterators of selections, instead of dynamically allocation them each time. - Lookup & insert new entries in one step, avoiding traversing group's B-tree twice. - Fixed memory leak in H5Gget_objname_idx() routine (tangential to performance improvements, but fixed along the way). - Use free-list for reference counted strings. - Don't bother copying object names into cached group entries, since they are re-created when an object is opened. The benchmark I used to measure these results created several thousand small (2K) datasets in a file and wrote out the data for them. This is Elena's "regular.c" benchmark. These changes resulted in approximately ~4.3x speedup of the development branch when compared to the previous code in the development branch and ~1.4x speedup compared to the release branch. Additionally, these changes reduce the total memory used (code and data) by the development branch by ~800KB, bringing the development branch back into the same ballpark as the release branch. I'll send out a more detailed description of the benchmark results as a followup note. New internal API routines: Added "reference counted strings" API for tracking strings that get used by multiple owners without duplicating the strings. Added "ternary search tree" API for text->object mappings. Platforms tested: Tested h5committest {arabica (fortran), eirene (fortran, C++) modi4 (parallel, fortran)} Other platforms/configurations tested? FreeBSD 4.7 (sleipnir) serial & parallel Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
/* Check arguments */
2005-11-15 10:55:39 +08:00
HDassert(src);
HDassert(dst);
HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP);
/* Copy the top level information */
2005-11-15 10:55:39 +08:00
HDmemcpy(dst, src, sizeof(H5G_entry_t));
/* Deep copy the names */
if(depth == H5_COPY_DEEP) {
2005-11-15 10:55:39 +08:00
/* Nothing currently */
;
} else if(depth == H5_COPY_SHALLOW) {
/* Discarding 'const' qualifier OK - QAK */
H5G_ent_reset((H5G_entry_t *)src);
} /* end if */
2005-11-15 10:55:39 +08:00
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5G_ent_copy() */
/*-------------------------------------------------------------------------
2005-11-15 10:55:39 +08:00
* Function: H5G_ent_reset
*
2005-11-15 10:55:39 +08:00
* Purpose: Reset a symbol table entry to an empty state
*
2005-11-15 10:55:39 +08:00
* Return: Success: Non-negative
* Failure: Negative
*
2005-11-15 10:55:39 +08:00
* Programmer: Quincey Koziol
* ?day, August ??, 2005
*
*-------------------------------------------------------------------------
*/
herr_t
H5G_ent_reset(H5G_entry_t *ent)
{
2005-11-15 10:55:39 +08:00
FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_reset)
/* Check arguments */
HDassert(ent);
/* Clear the symbol table entry to an empty state */
HDmemset(ent, 0, sizeof(H5G_entry_t));
ent->header = HADDR_UNDEF;
2005-11-15 10:55:39 +08:00
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5G_ent_reset() */
/*-------------------------------------------------------------------------
2005-11-15 10:55:39 +08:00
* Function: H5G_ent_convert
*
2005-11-15 10:55:39 +08:00
* Purpose: Convert a link to a symbol table entry
*
2005-11-15 10:55:39 +08:00
* Return: Success: Non-negative, with *pp pointing to the first byte
* after the last symbol.
*
2005-11-15 10:55:39 +08:00
* Failure: Negative
*
2005-11-15 10:55:39 +08:00
* Programmer: Quincey Koziol
* koziol@ncsa.uiuc.edu
* Sep 20 2005
*
*-------------------------------------------------------------------------
*/
herr_t
2005-11-15 10:55:39 +08:00
H5G_ent_convert(H5F_t *f, haddr_t heap_addr, const char *name, const H5O_link_t *lnk,
H5G_entry_t *ent, hid_t dxpl_id)
{
2005-11-15 10:55:39 +08:00
size_t name_offset; /* Offset of name in heap */
herr_t ret_value = SUCCEED; /* Return value */
2005-11-15 10:55:39 +08:00
FUNC_ENTER_NOAPI(H5G_ent_convert, FAIL)
2005-11-15 10:55:39 +08:00
/* check arguments */
HDassert(f);
HDassert(H5F_addr_defined(heap_addr));
HDassert(name);
HDassert(lnk);
/* Reset the new entry */
H5G_ent_reset(ent);
/*
* Add the new name to the heap.
*/
name_offset = H5HL_insert(f, dxpl_id, heap_addr, HDstrlen(name) + 1, name);
if(0 == name_offset || (size_t)(-1) == name_offset)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert symbol name into heap")
ent->name_off = name_offset;
/* Build correct information for symbol table entry based on link type */
switch(lnk->type) {
case H5L_LINK_HARD:
2005-11-15 10:55:39 +08:00
ent->type = H5G_NOTHING_CACHED;
ent->header = lnk->u.hard.addr;
break;
case H5L_LINK_SOFT:
2005-11-15 10:55:39 +08:00
{
size_t lnk_offset; /* Offset to sym-link value */
2005-11-15 10:55:39 +08:00
/* Insert link value into local heap */
if((size_t)(-1) == (lnk_offset = H5HL_insert(f, dxpl_id, heap_addr,
HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap")
ent->type = H5G_CACHED_SLINK;
ent->cache.slink.lval_offset = lnk_offset;
} /* end case */
break;
default:
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type")
} /* end switch */
/* Set the file for the entry */
ent->file = f;
done:
FUNC_LEAVE_NOAPI(ret_value)
2005-11-15 10:55:39 +08:00
} /* end H5G_ent_convert() */
/*-------------------------------------------------------------------------
* Function: H5G_ent_debug
*
* Purpose: Prints debugging information about a symbol table entry.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* matzke@llnl.gov
* Aug 29 1997
*
*-------------------------------------------------------------------------
*/
herr_t
H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * stream,
int indent, int fwidth, haddr_t heap)
{
const char *lval = NULL;
int nested_indent, nested_fwidth;
FUNC_ENTER_NOAPI_NOFUNC(H5G_ent_debug);
/* Calculate the indent & field width values for nested information */
nested_indent=indent+3;
nested_fwidth=MAX(0,fwidth-3);
HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth,
"Name offset into private heap:",
(unsigned long) (ent->name_off));
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
"Object header address:", ent->header);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Dirty:",
ent->dirty ? "Yes" : "No");
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth,
"Cache info type:");
switch (ent->type) {
case H5G_NOTHING_CACHED:
HDfprintf(stream, "Nothing Cached\n");
break;
case H5G_CACHED_STAB:
HDfprintf(stream, "Symbol Table\n");
HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth,
"Cached entry information:");
HDfprintf(stream, "%*s%-*s %a\n", nested_indent, "", nested_fwidth,
"B-tree address:", ent->cache.stab.btree_addr);
HDfprintf(stream, "%*s%-*s %a\n", nested_indent, "", nested_fwidth,
"Heap address:", ent->cache.stab.heap_addr);
break;
case H5G_CACHED_SLINK:
HDfprintf (stream, "Symbolic Link\n");
HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth,
"Cached information:");
HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth,
"Link value offset:",
(unsigned long)(ent->cache.slink.lval_offset));
if (heap>0 && H5F_addr_defined(heap)) {
[svn-r7489] Purpose: Update Description: A lot of modifications for the FPHDF5 stuff: H5AC.c H5ACprivate.h - Removed AC_find (it's replaced with AC_protect and AC_unprotect). Added flushing if it's an FPHDF5 driver and we're doing an AC_set or AC_unprotect with the dirty flag set. H5B.c - Split up the B_flush function into different functions since the one function was doing serialization which is better left as a separate entity. H5D.c - Removed some FPHDF5 code that was incorrect H5F.c - Split up the F_flush function so that it no longer allocates file space. Created new functions (F_init_superblock, F_read_superblock, and F_write_superblock) for greater modularity and so that the FPHDF5 non-captain processes can read the superblock after the captain process writes it. H5FD.c - Error message correction. H5FDfphdf5.c - Removed MPI barrier call that wasn't needed. H5FPclient.c H5FPserver.c - Modified so that if a process requests data that isn't exactly aligned, we can return it if we have the block that contains the requested address. H5G.c H5Gent.c H5Gnode.c H5HL.c H5HLpkg.h H5HLprivate.h H5Oefl.c - Removed the H5HL_peek function since it was doing a (now unsafe) holding of the information in the cache. Replaced with protect and unprotect calls. H5TB.c - Error fix. The TB_dless function wasn't working properly. H5Gstab.c - Format change. H5err.txt H5Edefin.h H5Einit.h H5Epubgen.h H5Eterm.h - Added new error code. Platforms tested: Modi4 (paralle, Fortran) Sol (Fortran) Linux (C++, Fortran) Copper (Parallel, Fortran) Misc. update:
2003-09-19 03:27:27 +08:00
const H5HL_t *heap_ptr;
heap_ptr = H5HL_protect(ent->file, dxpl_id, heap);
lval = H5HL_offset_into(ent->file, heap_ptr, ent->cache.slink.lval_offset);
HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth,
"Link value:",
lval);
H5HL_unprotect(ent->file, dxpl_id, heap_ptr, heap, H5AC__NO_FLAGS_SET);
}
else
HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, "Warning: Invalid heap address given, name not displayed!");
break;
default:
HDfprintf(stream, "*** Unknown symbol type %d\n", ent->type);
break;
}
FUNC_LEAVE_NOAPI(SUCCEED);
}
2005-11-15 10:55:39 +08:00