hdf5/src/H5R.c

879 lines
31 KiB
C
Raw Normal View History

/****************************************************************************
* NCSA HDF *
* Software Development Group *
* National Center for Supercomputing Applications *
* University of Illinois at Urbana-Champaign *
* 605 E. Springfield, Champaign IL 61820 *
* *
* For conditions of distribution and use, see the accompanying *
* hdf/COPYING file. *
* *
****************************************************************************/
/* $Id$ */
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5S_PACKAGE /*suppress error about including H5Spkg */
#include "H5private.h" /* Generic Functions */
#include "H5Iprivate.h" /* ID Functions */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* Files */
#include "H5Gprivate.h" /* Groups */
#include "H5HGprivate.h" /* Global Heaps */
#include "H5MMprivate.h" /* Memory Management */
#include "H5Rprivate.h" /* References */
#include "H5Spkg.h" /* Dataspaces */
#include "H5Tprivate.h" /* Datatypes */
/* Interface initialization */
#define PABLO_MASK H5R_mask
#define INTERFACE_INIT H5R_init_interface
static int interface_initialize_g = 0;
static herr_t H5R_init_interface(void);
/* Static functions */
static herr_t H5R_create(void *ref, H5G_entry_t *loc, const char *name,
H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id);
static hid_t H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
static H5S_t * H5R_get_region(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
static int H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref);
/*--------------------------------------------------------------------------
NAME
H5R_init_interface -- Initialize interface-specific information
USAGE
herr_t H5R_init_interface()
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
Initializes any interface-specific data or routines.
--------------------------------------------------------------------------*/
static herr_t
H5R_init_interface(void)
{
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOINIT(H5R_init_interface);
/* Initialize the atom group for the file IDs */
[svn-r936] Changes since 19981119 ---------------------- ./src/H5.c ./src/H5A.c ./src/H5AC.c ./src/H5B.c ./src/H5D.c ./src/H5E.c ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fmpio.c ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gstab.c ./src/H5HG.c ./src/H5HL.c ./src/H5I.c ./src/H5Iprivate.h ./src/H5MF.c ./src/H5MM.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/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Smpio.c ./src/H5Snone.c ./src/H5Spoint.c ./src/H5Sselect.c ./src/H5T.c ./src/H5TB.c ./src/H5Tbit.c ./src/H5Tconv.c ./src/H5V.c ./src/H5Z.c ./src/H5detect.c ./src/H5private.h Most of these changes are because the `interface_initialize_g' variable change from hbool_t to int. It's a one line change. Changed the way the library is closed so we have more control over the order the interfaces are shut down. Instead of registering an atexit() function for every interface in some haphazard order we just register one: H5_term_library() which then calls the H5*_term_interface() functions in a well-defined order. If the library is closed and then reopened repeatedly by calling H5close() and H5open() in a loop we only add one copy of the library termination functions with atexit(). Termination is a two-step process in order to help detect programming errors that would cause an infinite loop caused by the termination of one interface waking up some other previously terminated interface. The first step terminates the interface and *marks it as unusable*. After all interfaces are terminated then we mark them all as usable again. The FUNC_ENTER() macro has been modified to return failure or to dump core (depending on whether NDEBUG is defined) if we try to call an interface while it's shutting down. ./src/H5.c The H5dont_atexit() function returns failure if it's called more than once or if it's called too late. However, the error stack is not automatically printed on failure because the library might not be initialized yet ./test/chunk.c ./test/flush1.c ./test/flush2.c ./test/iopipe.c ./test/overhead.c ./test/ragged.c Changed the extra cast for Win32 so we do floating point division again -- it was just confusion about precedence and associativity of casting and the C coercion rules. Removed extra carriage returns inserted by broken operating system. ./src/H5Ffamily.c Fixed an bug where H5F_fam_write() lowered the EOF marker for one of the family members causing H5F_fam_read() to read zeros. ./test/h5test.h [NEW] ./test/h5test.c [NEW] ./test/Makefile.in ./test/bittests.c ./test/cmpd_dset.c ./test/dsets.c ./test/dtypes.c ./test/extend.c ./test/external.c Support library for test files. This isn't done yet but Katie's contractions are ~10 minutes apart so I figured I better back this stuff up just in case I'm not here next week... Eventually all test files will understand HDF5_DRIVER to name the low level file driver and parameters so we can easily test various drivers. They will also understand HDF5_PREFIX to prepend to the beginning of file names which is necessary for testing ROMIO with various drivers. Also, the cleanup function will know how to use the file name prefix and will understand different file driver naming schemes like file families. I'm not sure they'll understand the `gsf:' type prefixes yet. Note, the external test is completely commented out because I'm in the middle of modifying it. It will still compile and run but it doesn't test anything at the moment.
1998-11-21 11:36:51 +08:00
if (H5I_init_group(H5I_REFERENCE, H5I_REFID_HASHSIZE, H5R_RESERVED_ATOMS,
(H5I_free_t)NULL)<0)
HGOTO_ERROR (H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to initialize interface");
done:
FUNC_LEAVE_NOAPI(ret_value);
[svn-r936] Changes since 19981119 ---------------------- ./src/H5.c ./src/H5A.c ./src/H5AC.c ./src/H5B.c ./src/H5D.c ./src/H5E.c ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fmpio.c ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gstab.c ./src/H5HG.c ./src/H5HL.c ./src/H5I.c ./src/H5Iprivate.h ./src/H5MF.c ./src/H5MM.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/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Smpio.c ./src/H5Snone.c ./src/H5Spoint.c ./src/H5Sselect.c ./src/H5T.c ./src/H5TB.c ./src/H5Tbit.c ./src/H5Tconv.c ./src/H5V.c ./src/H5Z.c ./src/H5detect.c ./src/H5private.h Most of these changes are because the `interface_initialize_g' variable change from hbool_t to int. It's a one line change. Changed the way the library is closed so we have more control over the order the interfaces are shut down. Instead of registering an atexit() function for every interface in some haphazard order we just register one: H5_term_library() which then calls the H5*_term_interface() functions in a well-defined order. If the library is closed and then reopened repeatedly by calling H5close() and H5open() in a loop we only add one copy of the library termination functions with atexit(). Termination is a two-step process in order to help detect programming errors that would cause an infinite loop caused by the termination of one interface waking up some other previously terminated interface. The first step terminates the interface and *marks it as unusable*. After all interfaces are terminated then we mark them all as usable again. The FUNC_ENTER() macro has been modified to return failure or to dump core (depending on whether NDEBUG is defined) if we try to call an interface while it's shutting down. ./src/H5.c The H5dont_atexit() function returns failure if it's called more than once or if it's called too late. However, the error stack is not automatically printed on failure because the library might not be initialized yet ./test/chunk.c ./test/flush1.c ./test/flush2.c ./test/iopipe.c ./test/overhead.c ./test/ragged.c Changed the extra cast for Win32 so we do floating point division again -- it was just confusion about precedence and associativity of casting and the C coercion rules. Removed extra carriage returns inserted by broken operating system. ./src/H5Ffamily.c Fixed an bug where H5F_fam_write() lowered the EOF marker for one of the family members causing H5F_fam_read() to read zeros. ./test/h5test.h [NEW] ./test/h5test.c [NEW] ./test/Makefile.in ./test/bittests.c ./test/cmpd_dset.c ./test/dsets.c ./test/dtypes.c ./test/extend.c ./test/external.c Support library for test files. This isn't done yet but Katie's contractions are ~10 minutes apart so I figured I better back this stuff up just in case I'm not here next week... Eventually all test files will understand HDF5_DRIVER to name the low level file driver and parameters so we can easily test various drivers. They will also understand HDF5_PREFIX to prepend to the beginning of file names which is necessary for testing ROMIO with various drivers. Also, the cleanup function will know how to use the file name prefix and will understand different file driver naming schemes like file families. I'm not sure they'll understand the `gsf:' type prefixes yet. Note, the external test is completely commented out because I'm in the middle of modifying it. It will still compile and run but it doesn't test anything at the moment.
1998-11-21 11:36:51 +08:00
}
/*--------------------------------------------------------------------------
NAME
H5R_term_interface
PURPOSE
Terminate various H5R objects
USAGE
void H5R_term_interface()
RETURNS
void
DESCRIPTION
Release the atom group and any other resources allocated.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Can't report errors...
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
int
[svn-r1169] ./configure.in ./configure [REGENERATED] ./src/H5D.c ./src/H5O.c Removed H5AC, H5B, and H5T from the default list of packages to debug (because they're pretty expensive debugging), and added H5O. Also fixed a bug for undefined variable in H5D when H5S debugging is turned on but H5T debugging is turned off. ./config/conclude.in Fixed installation of header files for building in a directory other than the source directory. This fixes a bug where H5config.h wasn't being installed. ./src/H5.c ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5I.c ./src/H5Iprivate.h ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c ./src/H5TB.c ./src/H5Tprivate.h ./src/H5Z.c ./src/H5detect.c ./src/H5private.h Changed the way the library shuts down again. Now it handles cycles between packages and isn't so sensitive to dependencies between packages. A package might shut down only to be restarted to process a request from some other package being shut down. Loops are detected after 100 iteractions and the shutdown is aborted with a message on standard error. This also makes it a lot easier to debug. ./src/H5A.c Fixed H5A_write() and H5A_read() so they pass a non-null background buffer to the conversion functions. This is necessary when an attribute has a compound data type. ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fsec2.c Reindented new Win32 stuff. ./src/H5Odtype.c Fixed a bug when enumeration types are used in a compound data type. The byte pointer wasn't incremented after the type information was written. ./tools/h5ls.c Compound data types display their total size because it's not always obvious from looking at the members. Scalar attributes show their space as `scalar' instead of `{}'. The index value is not printed for attributes that have only a few values. Instead the word `Data:' is printed on the first line of attribute data. Named types display their data type only if verbose output was requested.
1999-03-30 19:38:34 +08:00
H5R_term_interface(void)
{
int n=0;
FUNC_ENTER_NOINIT(H5R_term_interface);
[svn-r1169] ./configure.in ./configure [REGENERATED] ./src/H5D.c ./src/H5O.c Removed H5AC, H5B, and H5T from the default list of packages to debug (because they're pretty expensive debugging), and added H5O. Also fixed a bug for undefined variable in H5D when H5S debugging is turned on but H5T debugging is turned off. ./config/conclude.in Fixed installation of header files for building in a directory other than the source directory. This fixes a bug where H5config.h wasn't being installed. ./src/H5.c ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5I.c ./src/H5Iprivate.h ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c ./src/H5TB.c ./src/H5Tprivate.h ./src/H5Z.c ./src/H5detect.c ./src/H5private.h Changed the way the library shuts down again. Now it handles cycles between packages and isn't so sensitive to dependencies between packages. A package might shut down only to be restarted to process a request from some other package being shut down. Loops are detected after 100 iteractions and the shutdown is aborted with a message on standard error. This also makes it a lot easier to debug. ./src/H5A.c Fixed H5A_write() and H5A_read() so they pass a non-null background buffer to the conversion functions. This is necessary when an attribute has a compound data type. ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fsec2.c Reindented new Win32 stuff. ./src/H5Odtype.c Fixed a bug when enumeration types are used in a compound data type. The byte pointer wasn't incremented after the type information was written. ./tools/h5ls.c Compound data types display their total size because it's not always obvious from looking at the members. Scalar attributes show their space as `scalar' instead of `{}'. The index value is not printed for attributes that have only a few values. Instead the word `Data:' is printed on the first line of attribute data. Named types display their data type only if verbose output was requested.
1999-03-30 19:38:34 +08:00
if (interface_initialize_g) {
if ((n=H5I_nmembers(H5I_REFERENCE))) {
[svn-r1224] Changes since 19990426 ---------------------- ./tools/h5tools.c ./tools/h5tools.h Finally fixed a long-standing bug that caused core dumps if a compound datum rendered to more than some number of characters (we kept bumping up the limit at the risk of violating stack size limits on some machines). The fix works only on systems that have the vsnprintf() function (otherwise a 4kB limit is imposed, which if violated probably dumps core). If vsnprintf() is present then the library dynamically allocates space for the output string. Also made it possible to control how compound data is rendered across multiple lines of output by allowing the caller to specify where optional line-breaks get inserted. The output functions split up the value at one or more optional line-breaks to prevent it from wrapping around the screen. If a datum doesn't fit on the current line but would fit on the next line then it is printed on the next line regardless of whether optional line-breaks would have prevent wrapping around the screen. This makes it easier to find the beginnings of compound data values. This feature is disabled by default but can be enabled by the application. If a datum doesn't fit on the current line and the previous datum also occupied more than one line then we move to the next line before printing. This makes it easier to find the beginnings of compound data values but prevents the output from looking fragmented if there are only a few long values among mostly short values. This feature is disabled by default but can be enabled by the application. The application can control the printf() formats used for all the native data types. The defaults are what the library used to use: %g, %ld, %lu, %d, and %u ./tools/h5ls.c Compound datatype values can now be split across multiple lines of output instead of just wrapping. Also, when lots of compound values are too long they all start at the beginning of a line. This only required about 10 lines of changes in the setup for tools library calls (I didn't modify the h5dump program because it uses its own version of the tools library that forked off long ago). Added code for Win32 which is unable to cast `unsigned long long' to `double'. If the dataset size exceeds (2^63)-1 then the percent utilization is not displayed (this is easily possible with chunked datasets). This is untested yet. ./configure.in ./src/H5config.h.in ./src/H5.c ./src/H5private.h Check for vsnprintf() and provide a simple, stupid definition if it isn't available. The stupid definition just calls vsprintf() and ignores the second argument. This can result in buffer overflows in h5ls and h5dump since vsprintf() is an unsafe function (and anyone can create an hdf5 file that runs an arbitrary command from h5ls and h5dump in that case)! ./config/conclude.in Remove more *.o files for `make clean' ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5I.c ./src/H5Iprivate.h ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c ./src/H5TB.c Cleaned up a memory leak during H5_term_library() by allowing H5I_clear_group() to skip items that couldn't be freed. This allows the item to remain in the group until we can free it later. ./src/H5F.c The H5F_close_all() function fails if a file cannot be closed.
1999-04-27 22:47:54 +08:00
H5I_clear_group(H5I_REFERENCE, FALSE);
[svn-r1169] ./configure.in ./configure [REGENERATED] ./src/H5D.c ./src/H5O.c Removed H5AC, H5B, and H5T from the default list of packages to debug (because they're pretty expensive debugging), and added H5O. Also fixed a bug for undefined variable in H5D when H5S debugging is turned on but H5T debugging is turned off. ./config/conclude.in Fixed installation of header files for building in a directory other than the source directory. This fixes a bug where H5config.h wasn't being installed. ./src/H5.c ./src/H5A.c ./src/H5D.c ./src/H5F.c ./src/H5G.c ./src/H5I.c ./src/H5Iprivate.h ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5T.c ./src/H5TB.c ./src/H5Tprivate.h ./src/H5Z.c ./src/H5detect.c ./src/H5private.h Changed the way the library shuts down again. Now it handles cycles between packages and isn't so sensitive to dependencies between packages. A package might shut down only to be restarted to process a request from some other package being shut down. Loops are detected after 100 iteractions and the shutdown is aborted with a message on standard error. This also makes it a lot easier to debug. ./src/H5A.c Fixed H5A_write() and H5A_read() so they pass a non-null background buffer to the conversion functions. This is necessary when an attribute has a compound data type. ./src/H5Flow.c ./src/H5Fprivate.h ./src/H5Fsec2.c Reindented new Win32 stuff. ./src/H5Odtype.c Fixed a bug when enumeration types are used in a compound data type. The byte pointer wasn't incremented after the type information was written. ./tools/h5ls.c Compound data types display their total size because it's not always obvious from looking at the members. Scalar attributes show their space as `scalar' instead of `{}'. The index value is not printed for attributes that have only a few values. Instead the word `Data:' is printed on the first line of attribute data. Named types display their data type only if verbose output was requested.
1999-03-30 19:38:34 +08:00
} else {
H5I_destroy_group(H5I_REFERENCE);
interface_initialize_g = 0;
n = 1; /*H5I*/
}
[svn-r936] Changes since 19981119 ---------------------- ./src/H5.c ./src/H5A.c ./src/H5AC.c ./src/H5B.c ./src/H5D.c ./src/H5E.c ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fmpio.c ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gstab.c ./src/H5HG.c ./src/H5HL.c ./src/H5I.c ./src/H5Iprivate.h ./src/H5MF.c ./src/H5MM.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/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Smpio.c ./src/H5Snone.c ./src/H5Spoint.c ./src/H5Sselect.c ./src/H5T.c ./src/H5TB.c ./src/H5Tbit.c ./src/H5Tconv.c ./src/H5V.c ./src/H5Z.c ./src/H5detect.c ./src/H5private.h Most of these changes are because the `interface_initialize_g' variable change from hbool_t to int. It's a one line change. Changed the way the library is closed so we have more control over the order the interfaces are shut down. Instead of registering an atexit() function for every interface in some haphazard order we just register one: H5_term_library() which then calls the H5*_term_interface() functions in a well-defined order. If the library is closed and then reopened repeatedly by calling H5close() and H5open() in a loop we only add one copy of the library termination functions with atexit(). Termination is a two-step process in order to help detect programming errors that would cause an infinite loop caused by the termination of one interface waking up some other previously terminated interface. The first step terminates the interface and *marks it as unusable*. After all interfaces are terminated then we mark them all as usable again. The FUNC_ENTER() macro has been modified to return failure or to dump core (depending on whether NDEBUG is defined) if we try to call an interface while it's shutting down. ./src/H5.c The H5dont_atexit() function returns failure if it's called more than once or if it's called too late. However, the error stack is not automatically printed on failure because the library might not be initialized yet ./test/chunk.c ./test/flush1.c ./test/flush2.c ./test/iopipe.c ./test/overhead.c ./test/ragged.c Changed the extra cast for Win32 so we do floating point division again -- it was just confusion about precedence and associativity of casting and the C coercion rules. Removed extra carriage returns inserted by broken operating system. ./src/H5Ffamily.c Fixed an bug where H5F_fam_write() lowered the EOF marker for one of the family members causing H5F_fam_read() to read zeros. ./test/h5test.h [NEW] ./test/h5test.c [NEW] ./test/Makefile.in ./test/bittests.c ./test/cmpd_dset.c ./test/dsets.c ./test/dtypes.c ./test/extend.c ./test/external.c Support library for test files. This isn't done yet but Katie's contractions are ~10 minutes apart so I figured I better back this stuff up just in case I'm not here next week... Eventually all test files will understand HDF5_DRIVER to name the low level file driver and parameters so we can easily test various drivers. They will also understand HDF5_PREFIX to prepend to the beginning of file names which is necessary for testing ROMIO with various drivers. Also, the cleanup function will know how to use the file name prefix and will understand different file driver naming schemes like file families. I'm not sure they'll understand the `gsf:' type prefixes yet. Note, the external test is completely commented out because I'm in the middle of modifying it. It will still compile and run but it doesn't test anything at the moment.
1998-11-21 11:36:51 +08:00
}
FUNC_LEAVE_NOAPI(n);
[svn-r936] Changes since 19981119 ---------------------- ./src/H5.c ./src/H5A.c ./src/H5AC.c ./src/H5B.c ./src/H5D.c ./src/H5E.c ./src/H5F.c ./src/H5Farray.c ./src/H5Fcore.c ./src/H5Ffamily.c ./src/H5Fistore.c ./src/H5Flow.c ./src/H5Fmpio.c ./src/H5Fsec2.c ./src/H5Fsplit.c ./src/H5Fstdio.c ./src/H5G.c ./src/H5Gent.c ./src/H5Gnode.c ./src/H5Gstab.c ./src/H5HG.c ./src/H5HL.c ./src/H5I.c ./src/H5Iprivate.h ./src/H5MF.c ./src/H5MM.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/H5Osdspace.c ./src/H5Oshared.c ./src/H5Ostab.c ./src/H5P.c ./src/H5R.c ./src/H5RA.c ./src/H5S.c ./src/H5Sall.c ./src/H5Shyper.c ./src/H5Smpio.c ./src/H5Snone.c ./src/H5Spoint.c ./src/H5Sselect.c ./src/H5T.c ./src/H5TB.c ./src/H5Tbit.c ./src/H5Tconv.c ./src/H5V.c ./src/H5Z.c ./src/H5detect.c ./src/H5private.h Most of these changes are because the `interface_initialize_g' variable change from hbool_t to int. It's a one line change. Changed the way the library is closed so we have more control over the order the interfaces are shut down. Instead of registering an atexit() function for every interface in some haphazard order we just register one: H5_term_library() which then calls the H5*_term_interface() functions in a well-defined order. If the library is closed and then reopened repeatedly by calling H5close() and H5open() in a loop we only add one copy of the library termination functions with atexit(). Termination is a two-step process in order to help detect programming errors that would cause an infinite loop caused by the termination of one interface waking up some other previously terminated interface. The first step terminates the interface and *marks it as unusable*. After all interfaces are terminated then we mark them all as usable again. The FUNC_ENTER() macro has been modified to return failure or to dump core (depending on whether NDEBUG is defined) if we try to call an interface while it's shutting down. ./src/H5.c The H5dont_atexit() function returns failure if it's called more than once or if it's called too late. However, the error stack is not automatically printed on failure because the library might not be initialized yet ./test/chunk.c ./test/flush1.c ./test/flush2.c ./test/iopipe.c ./test/overhead.c ./test/ragged.c Changed the extra cast for Win32 so we do floating point division again -- it was just confusion about precedence and associativity of casting and the C coercion rules. Removed extra carriage returns inserted by broken operating system. ./src/H5Ffamily.c Fixed an bug where H5F_fam_write() lowered the EOF marker for one of the family members causing H5F_fam_read() to read zeros. ./test/h5test.h [NEW] ./test/h5test.c [NEW] ./test/Makefile.in ./test/bittests.c ./test/cmpd_dset.c ./test/dsets.c ./test/dtypes.c ./test/extend.c ./test/external.c Support library for test files. This isn't done yet but Katie's contractions are ~10 minutes apart so I figured I better back this stuff up just in case I'm not here next week... Eventually all test files will understand HDF5_DRIVER to name the low level file driver and parameters so we can easily test various drivers. They will also understand HDF5_PREFIX to prepend to the beginning of file names which is necessary for testing ROMIO with various drivers. Also, the cleanup function will know how to use the file name prefix and will understand different file driver naming schemes like file families. I'm not sure they'll understand the `gsf:' type prefixes yet. Note, the external test is completely commented out because I'm in the middle of modifying it. It will still compile and run but it doesn't test anything at the moment.
1998-11-21 11:36:51 +08:00
}
/*--------------------------------------------------------------------------
NAME
H5R_create
PURPOSE
Creates a particular kind of reference for the user
USAGE
herr_t H5R_create(ref, loc, name, ref_type, space)
void *ref; OUT: Reference created
H5G_entry_t *loc; IN: File location used to locate object pointed to
const char *name; IN: Name of object at location LOC_ID of object
pointed to
H5R_type_t ref_type; IN: Type of reference to create
H5S_t *space; IN: Dataspace ID with selection, used for Dataset
Region references.
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
Creates a particular type of reference specified with REF_TYPE, in the
space pointed to by REF. The LOC_ID and NAME are used to locate the object
pointed to and the SPACE_ID is used to choose the region pointed to (for
Dataset Region references).
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type, H5S_t *space, hid_t dxpl_id)
{
H5G_stat_t sb; /* Stat buffer for retrieving OID */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOINIT(H5R_create);
assert(_ref);
assert(loc);
assert(name);
assert(ref_type>H5R_BADTYPE || ref_type<H5R_MAXTYPE);
if (H5G_get_objinfo (loc, name, 0, &sb, dxpl_id)<0)
HGOTO_ERROR (H5E_REFERENCE, H5E_NOTFOUND, FAIL, "unable to stat object");
switch(ref_type) {
case H5R_OBJECT:
{
haddr_t addr;
hobj_ref_t *ref=(hobj_ref_t *)_ref; /* Get pointer to correct type of reference struct */
[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; /* Pointer to OID to store */
/* Set information for reference */
[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
p=(uint8_t *)ref->oid;
H5F_addr_pack(loc->file,&addr,&sb.objno[0]);
H5F_addr_encode(loc->file,&p,addr);
break;
}
case H5R_DATASET_REGION:
{
haddr_t addr;
H5HG_t hobjid; /* Heap object ID */
hdset_reg_ref_t *ref=(hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
hssize_t buf_size; /* Size of buffer needed to serialize selection */
[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; /* Pointer to OID to store */
uint8_t *buf; /* Buffer to store serialized selection in */
unsigned heapid_found; /* Flag for non-zero heap ID found */
unsigned u; /* local index */
/* Set up information for dataset region */
/* Return any previous heap block to the free list if we are garbage collecting */
[svn-r1572] Changes since 19990810 ---------------------- ./MANIFEST ./src/H5FDmulti.c [NEW] ./src/H5FDmulti.h [NEW] ./src/Makefile.in ./src/hdf5.h The split driver was reimplemented as a more general "multi" driver which is capable of splitting data into multiple files like the family driver except the partioning is done by memory usage type instead of address. The H5Pset_fapl_split() function just calls H5Pset_fapl_multi() with arguments which prepare to split the address space into two files: meta and raw data. This is the first version. I plan to allow the open() call to relax a bit which would allow one to open an hdf5 file when only the meta-data file is present. This would allow a very large file to be split and stored on tape and the relatively small meta file to be mirrored on disk to allow limited browsing of the file (any request for raw data would fail). ./src/H5private.h ./src/H5F.c ./src/H5FD.c ./src/H5FDprivate.h ./src/H5FDpublic.h ./src/H5FDcore.c ./src/H5FDfamily.c ./src/H5FDmpio.c ./src/H5FDsec2.c Added the ability for a file driver to store information in the superblock which would be needed if the file were opened again later for reading. The format is driver-defined which allows users to extend it however they like. ./doc/html/H5.format.html Added information about the new driver information block of the superblock. This is where file drivers store information they need in order to reopen the file later. ./src/H5F.c ./src/H5Fprivate.h ./src/H5FD.c ./src/H5FDprivate.h ./src/H5FDpublic.h ./src/H5FDcore.c ./src/H5FDfamily.c ./src/H5FDmpio.c ./src/H5FDsec2.c ./src/H5Fistore.c ./src/H5R.c The file access properties and the file access property list were decoupled, which allows the property list to more cleanly contain properties for various levels of the file and which allows the property list to be modified more cleanly when opening files. ./src/H5.c ./src/H5FDpublic.h Removed H5FD_MEM_META and H5FD_MEM_GROUP since they're never used. ./src/H5D.c Changed the way we detect the MPIO driver in all these special cases. ./src/H5F.c ./src/H5Rpublic.h ./test/tfile.c The default file sizeof(offset) was changed to be a function of haddr_t instead of hsize_t. THE H5RPUBLIC.H DEFINITIONS WILL HAVE PROBLEMS IF THE USER CREATES A FILE WITH NON-DEFAULT OFFSET AND SIZE SIZES! ./src/H5F.c Fixed an uninitialized memory access bug in file closing related to the VFL. ./src/H5T.c ./src/H5Tpublic.h Added an H5T_NATIVE_HADDR predefined datatype which corresponds to the `haddr_t' type. ./test/Makefile.in Reformatted long lines. ./test/big.c ./test/cmpd_dset.c ./test/dsets.c ./test/dtypes.c ./test/extend.c ./test/external.c Removed the H5F_ACC_DEBUG flag from file creation/open calls. ./test/big.c Plugged a memory leak. ./test/h5test.c Added support for the `multi' driver. Removed #warning about not having the stdio driver. Plans are to not implement it since the sec2 driver serves the same purpose and testing didn't show any difference in execution times between the two.
1999-08-18 03:12:59 +08:00
if(loc->file->shared->gc_ref) {
/* Check for an existing heap ID in the reference */
for(u=0, heapid_found=0; u<H5R_DSET_REG_REF_BUF_SIZE; u++)
if(ref->heapid[u]!=0) {
heapid_found=1;
break;
} /* end if */
if(heapid_found!=0) {
/* Return heap block to free list */
} /* end if */
} /* end if */
/* Zero the heap ID out, may leak heap space if user is re-using reference and doesn't have garbage collection on */
HDmemset(ref->heapid,H5R_DSET_REG_REF_BUF_SIZE,0);
/* Get the amount of space required to serialize the selection */
if ((buf_size = (*space->select.serial_size)(space)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection");
/* Increase buffer size to allow for the dataset OID */
buf_size+=sizeof(haddr_t);
/* Allocate the space to store the serialized information */
H5_CHECK_OVERFLOW(buf_size,hssize_t,size_t);
if (NULL==(buf = H5MM_malloc((size_t)buf_size)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
/* Serialize information for dataset OID */
p=(uint8_t *)buf;
H5F_addr_pack(loc->file,&addr,&sb.objno[0]);
H5F_addr_encode(loc->file,&p,addr);
/* Serialize the selection */
if ((*space->select.serialize)(space,p) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection");
/* Save the serialized buffer for later */
H5_CHECK_OVERFLOW(buf_size,hssize_t,size_t);
if(H5HG_insert(loc->file,dxpl_id,(size_t)buf_size,buf,&hobjid)<0)
HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to serialize selection");
/* Serialize the heap ID and index for storage in the file */
p=(uint8_t *)ref->heapid;
H5F_addr_encode(loc->file,&p,hobjid.addr);
INT32ENCODE(p,hobjid.idx);
/* Free the buffer we serialized data in */
H5MM_xfree(buf);
break;
}
case H5R_INTERNAL:
HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "Internal references are not yet supported");
case H5R_BADTYPE:
case H5R_MAXTYPE:
default:
assert("unknown reference type" && 0);
HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)");
} /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5R_create() */
/*--------------------------------------------------------------------------
NAME
H5Rcreate
PURPOSE
Creates a particular kind of reference for the user
USAGE
herr_t H5Rcreate(ref, loc_id, name, ref_type, space_id)
void *ref; OUT: Reference created
hid_t loc_id; IN: Location ID used to locate object pointed to
const char *name; IN: Name of object at location LOC_ID of object
pointed to
H5R_type_t ref_type; IN: Type of reference to create
hid_t space_id; IN: Dataspace ID with selection, used for Dataset
Region references.
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
Creates a particular type of reference specified with REF_TYPE, in the
space pointed to by REF. The LOC_ID and NAME are used to locate the object
pointed to and the SPACE_ID is used to choose the region pointed to (for
Dataset Region references).
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id)
{
H5G_entry_t *loc = NULL; /* File location */
H5S_t *space = NULL; /* Pointer to dataspace containing region */
herr_t ret_value; /* Return value */
FUNC_ENTER_API(H5Rcreate, FAIL);
H5TRACE5("e","xisRti",ref,loc_id,name,ref_type,space_id);
/* Check args */
if(ref==NULL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer");
if (NULL==(loc=H5G_loc (loc_id)))
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a location");
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given");
if(ref_type<=H5R_BADTYPE || ref_type>=H5R_MAXTYPE)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type");
if(ref_type!=H5R_OBJECT && ref_type!=H5R_DATASET_REGION)
HGOTO_ERROR (H5E_ARGS, H5E_UNSUPPORTED, FAIL, "reference type not supported");
if (space_id!=(-1) && (NULL==(space=H5I_object_verify(space_id,H5I_DATASPACE))))
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace");
/* Create reference */
if ((ret_value=H5R_create(ref,loc,name,ref_type,space, H5AC_dxpl_id))<0)
HGOTO_ERROR (H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to create reference");
done:
FUNC_LEAVE_API(ret_value);
} /* end H5Rcreate() */
/*--------------------------------------------------------------------------
NAME
H5R_dereference
PURPOSE
Opens the HDF5 object referenced.
USAGE
hid_t H5R_dereference(ref)
H5F_t *file; IN: File the object being dereferenced is within
H5R_type_t ref_type; IN: Type of reference
void *ref; IN: Reference to open.
RETURNS
Valid ID on success, Negative on failure
DESCRIPTION
Given a reference to some object, open that object and return an ID for
that object.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Currently only set up to work with references to datasets
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static hid_t
H5R_dereference(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
{
H5G_t *group; /* Pointer to group to open */
H5T_t *datatype; /* Pointer to datatype to open */
H5G_entry_t ent; /* Symbol table entry */
[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; /* Pointer to OID to store */
int oid_type; /* type of object being dereferenced */
hid_t ret_value;
FUNC_ENTER_NOINIT(H5R_dereference);
assert(_ref);
assert(ref_type>H5R_BADTYPE || ref_type<H5R_MAXTYPE);
assert(file);
/* Initialize the symbol table entry */
HDmemset(&ent,0,sizeof(H5G_entry_t));
ent.type=H5G_NOTHING_CACHED;
ent.file=file;
switch(ref_type) {
case H5R_OBJECT:
{
hobj_ref_t *ref=(hobj_ref_t *)_ref; /* Only object references currently supported */
/*
* Switch on object type, when we implement that feature, always try to
* open a dataset for now
*/
/* Get the object oid */
p=(uint8_t *)ref->oid;
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(ent.header));
} /* end case */
break;
case H5R_DATASET_REGION:
{
hdset_reg_ref_t *ref=(hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
H5HG_t hobjid; /* Heap object ID */
uint8_t *buf; /* Buffer to store serialized selection in */
/* Get the heap ID for the dataset region */
p=(uint8_t *)ref->heapid;
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(hobjid.addr));
INT32DECODE(p,hobjid.idx);
/* Get the dataset region from the heap (allocate inside routine) */
if((buf=H5HG_read(ent.file,dxpl_id,&hobjid,NULL))==NULL)
HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information");
/* Get the object oid for the dataset */
p=(uint8_t *)buf;
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(ent.header));
/* Free the buffer allocated in H5HG_read() */
H5MM_xfree(buf);
} /* end case */
break;
case H5R_INTERNAL:
HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "Internal references are not yet supported");
case H5R_BADTYPE:
case H5R_MAXTYPE:
default:
assert("unknown reference type" && 0);
HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)");
} /* end switch */
/* Check to make certain that this object hasn't been deleted since the reference was created */
if(H5O_link(&ent,0,dxpl_id)<=0)
HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object");
/* Open the dataset object */
oid_type=H5G_get_type(&ent,dxpl_id);
switch(oid_type) {
case H5G_GROUP:
if ((group=H5G_open_oid(&ent,dxpl_id)) == NULL)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found");
/* Create an atom for the dataset */
if ((ret_value = H5I_register(H5I_GROUP, group)) < 0) {
H5G_close(group);
HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "can't register group");
}
break;
case H5G_TYPE:
if ((datatype=H5T_open_oid(&ent, dxpl_id)) == NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "not found");
/* Create an atom for the dataset */
if ((ret_value = H5I_register(H5I_DATATYPE, datatype)) < 0) {
H5T_close(datatype);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "can't register group");
}
break;
case H5G_DATASET:
[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
/* Open the dataset */
if ((ret_value=H5D_open(&ent,dxpl_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found");
break;
default:
HGOTO_ERROR(H5E_REFERENCE, H5E_BADTYPE, FAIL, "can't identify type of object referenced");
} /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5R_dereference() */
/*--------------------------------------------------------------------------
NAME
H5Rdereference
PURPOSE
Opens the HDF5 object referenced.
USAGE
hid_t H5Rdereference(ref)
hid_t id; IN: Dataset reference object is in or location ID of
object that the dataset is located within.
H5R_type_t ref_type; IN: Type of reference to create
void *ref; IN: Reference to open.
RETURNS
Valid ID on success, Negative on failure
DESCRIPTION
Given a reference to some object, open that object and return an ID for
that object.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
hid_t
H5Rdereference(hid_t id, H5R_type_t ref_type, void *_ref)
{
H5G_entry_t *loc = NULL; /* Symbol table entry */
H5F_t *file=NULL; /* File object */
hid_t ret_value;
FUNC_ENTER_API(H5Rdereference, FAIL);
H5TRACE3("i","iRtx",id,ref_type,_ref);
/* Check args */
if (NULL == (loc = H5G_loc(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location");
if(ref_type<=H5R_BADTYPE || ref_type>=H5R_MAXTYPE)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type");
if(_ref==NULL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer");
/* Get the file pointer from the entry */
file=loc->file;
/* Create reference */
if ((ret_value=H5R_dereference(file, H5AC_dxpl_id, ref_type, _ref))<0)
HGOTO_ERROR (H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object");
done:
FUNC_LEAVE_API(ret_value);
} /* end H5Rdereference() */
/*--------------------------------------------------------------------------
NAME
H5R_get_region
PURPOSE
Retrieves a dataspace with the region pointed to selected.
USAGE
H5S_t *H5R_get_region(file, ref_type, ref)
H5F_t *file; IN: File the object being dereferenced is within
H5R_type_t ref_type; UNUSED
void *ref; IN: Reference to open.
RETURNS
Pointer to the dataspace on success, NULL on failure
DESCRIPTION
Given a reference to some object, creates a copy of the dataset pointed
to's dataspace and defines a selection in the copy which is the region
pointed to.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_t *
H5R_get_region(H5F_t *file, hid_t dxpl_id, H5R_type_t UNUSED ref_type, void *_ref)
{
H5G_entry_t ent; /* Symbol table entry */
uint8_t *p; /* Pointer to OID to store */
hdset_reg_ref_t *ref=(hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
H5HG_t hobjid; /* Heap object ID */
uint8_t *buf; /* Buffer to store serialized selection in */
H5S_t *ret_value;
FUNC_ENTER_NOINIT(H5R_get_region);
assert(_ref);
assert(ref_type==H5R_DATASET_REGION);
assert(file);
/* Initialize the symbol table entry */
HDmemset(&ent,0,sizeof(H5G_entry_t));
ent.type=H5G_NOTHING_CACHED;
ent.file=file;
/* Get the heap ID for the dataset region */
p=(uint8_t *)ref->heapid;
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(hobjid.addr));
INT32DECODE(p,hobjid.idx);
/* Get the dataset region from the heap (allocate inside routine) */
if((buf=H5HG_read(ent.file,dxpl_id,&hobjid,NULL))==NULL)
HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, NULL, "Unable to read dataset region information");
/* Get the object oid for the dataset */
p=(uint8_t *)buf;
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(ent.header));
[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
/* Open and copy the dataset's dataspace */
if ((ret_value=H5S_read(&ent, dxpl_id)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, NULL, "not found");
/* Unserialize the selection */
if (H5S_select_deserialize(ret_value,p) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, NULL, "can't deserialize selection");
/* Free the buffer allocated in H5HG_read() */
H5MM_xfree(buf);
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5R_get_region() */
/*--------------------------------------------------------------------------
NAME
H5Rget_region
PURPOSE
Retrieves a dataspace with the region pointed to selected.
USAGE
hid_t H5Rget_region(id, ref_type, ref)
hid_t id; IN: Dataset reference object is in or location ID of
object that the dataset is located within.
H5R_type_t ref_type; IN: Type of reference to get region of
void *ref; IN: Reference to open.
RETURNS
Valid ID on success, Negative on failure
DESCRIPTION
Given a reference to some object, creates a copy of the dataset pointed
to's dataspace and defines a selection in the copy which is the region
pointed to.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
hid_t
H5Rget_region(hid_t id, H5R_type_t ref_type, void *_ref)
{
H5G_entry_t *loc = NULL; /* Symbol table entry */
H5S_t *space = NULL; /* dataspace object */
H5F_t *file=NULL; /* File object */
hid_t ret_value;
FUNC_ENTER_API(H5Rget_region, FAIL);
H5TRACE3("i","iRtx",id,ref_type,_ref);
/* Check args */
if (NULL == (loc = H5G_loc(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location");
if(ref_type!=H5R_DATASET_REGION)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type");
if(_ref==NULL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer");
/* Get the file pointer from the entry */
file=loc->file;
/* Get the dataspace with the correct region selected */
if ((space=H5R_get_region(file,H5AC_ind_dxpl_id,ref_type,_ref))==NULL)
HGOTO_ERROR (H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create dataspace");
/* Atomize */
if ((ret_value=H5I_register (H5I_DATASPACE, space))<0)
HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom");
done:
FUNC_LEAVE_API(ret_value);
} /* end H5Rget_region() */
#ifdef H5_WANT_H5_V1_4_COMPAT
/*--------------------------------------------------------------------------
NAME
H5R_get_object_type
PURPOSE
Retrieves the type of object that an object reference points to
USAGE
int H5R_get_object_type(file, ref)
H5F_t *file; IN: File the object being dereferenced is within
void *ref; IN: Reference to query.
RETURNS
Success: An object type defined in H5Gpublic.h
Failure: H5G_UNKNOWN
DESCRIPTION
Given a reference to some object, this function returns the type of object
pointed to.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static int
H5R_get_object_type(H5F_t *file, void *_ref)
{
H5G_entry_t ent; /* Symbol table entry */
hobj_ref_t *ref=(hobj_ref_t *)_ref; /* Only object references currently supported */
uint8_t *p; /* Pointer to OID to store */
int ret_value;
FUNC_ENTER_NOINIT(H5R_get_object_type);
assert(ref);
assert(file);
/* Initialize the symbol table entry */
HDmemset(&ent,0,sizeof(H5G_entry_t));
ent.type=H5G_NOTHING_CACHED;
ent.file=file;
/* Get the object oid */
p=(uint8_t *)ref->oid;
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(ent.header));
/* Get the OID type */
ret_value=H5G_get_type(&ent);
#ifdef LATER
done:
#endif /* LATER */
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5R_get_object_type() */
/*--------------------------------------------------------------------------
NAME
H5Rget_object_type
PURPOSE
Retrieves the type of object that an object reference points to
USAGE
int H5Rget_object_type(id, ref)
hid_t id; IN: Dataset reference object is in or location ID of
object that the dataset is located within.
void *ref; IN: Reference to query.
RETURNS
Success: An object type defined in H5Gpublic.h
Failure: H5G_UNKNOWN
DESCRIPTION
Given a reference to some object, this function returns the type of object
pointed to.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
[svn-r1151] Changes since 19990318 ---------------------- ./Makefile.in ./configure.in ./configure [REGENERATED] ./src/H5config.h.in [REGENERATED] ./config/commence.in ./config/conclude.in ./config/dec-osf4.x ./config/depend.in ./config/freebsd ./config/linux-gnu ./config/linux-gnulibc1 ./config/linux-gnulibc2 ./config/solaris2.x ./examples/Makefile.in ./src/Makefile.in ./test/Makefile.in ./testpar/Makefile.in ./tools/Makefile.in ./tools/testh5dump.sh Changes that allow hdf5 to be configured and compiled in a directory other than the source directory. This is especially useful if you want to concurrently compile with different compilers and/or compile flags, or if the hdf5 source is on read-only media like a CDROM. The changes were surprisingly easy ;-) Here's what you can do now... $ mkdir /tmp/build1 # or something $ cd /tmp/build1 $ /cdrom/hdf5/configure # where ever the source is $ make Paul, you'll have to change the testh5toh4 script similar to the way I changed testh5dump.sh. I started working on it but then gave up because of a number of problems: (1) I had to comment out all the tests that let h5toh4 choose the output file name because it always tried to put the output file in the same directory as the input file, (2) if path names are used during the h4 dump then they interfere with the diff. The test works fine when run in the source directory, but try this instead: $ gunzip <hdf5-1.1.67.tar.gz |tar xf - $ chmod -R ugo-w hdf5-1.1.67 $ mkdir build $ cd build $ ../hdf5-1.1.67/configure $ make check Dan, I didn't modify the pablo/Makefile.in because I have no way to test it. I think all you need to do is add a couple lines before the @COMMENCE@ line and add a couple search directories for header files. Anyway, it seems like almost an exact duplicate of the src/Makefile.in, so it shouldn't be a problem... ./Makefile.in Removes a few more temporary files during make clean and distclean. ./configure.in I fixed the creation of the time-stamp files so that the initial make doesn't have to regenerated all the makefiles (only GNU make users will see any change). ./src/H5R.c Changed a return type from `intn' to `int' for an API function. ./src/H5detect.c Added the volatile qualifier to a couple more variables. ./tools/h5tools.c Fixed a compiler warning about an unused local. ./tools/h5toh4.c Initialized `optind' to 1 because it's zero on my system. It should always be one on a unix system. ./tools/testh5toh4 Redirected "broken pipe" messages to /dev/null so outut is formatted correctly.
1999-03-20 04:09:50 +08:00
int
H5Rget_object_type(hid_t id, void *_ref)
{
H5G_entry_t *loc = NULL; /* Symbol table entry */
H5F_t *file=NULL; /* File object */
hid_t ret_value;
FUNC_ENTER_API(H5Rget_object_type, H5G_UNKNOWN);
H5TRACE2("Is","ix",id,_ref);
/* Check args */
if (NULL == (loc = H5G_loc(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location");
if(_ref==NULL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer");
/* Get the file pointer from the entry */
file=loc->file;
/* Get the object information */
if ((ret_value=H5R_get_object_type(file,_ref))<0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type");
done:
FUNC_LEAVE_API(ret_value);
} /* end H5Rget_object_type() */
#endif /* H5_WANT_H5_V1_4_COMPAT */
/*--------------------------------------------------------------------------
NAME
H5R_get_obj_type
PURPOSE
Retrieves the type of object that an object reference points to
USAGE
int H5R_get_obj_type(file, ref_type, ref)
H5F_t *file; IN: File the object being dereferenced is within
H5R_type_t ref_type; IN: Type of reference to query
void *ref; IN: Reference to query.
RETURNS
Success: An object type defined in H5Gpublic.h
Failure: H5G_UNKNOWN
DESCRIPTION
Given a reference to some object, this function returns the type of object
pointed to.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
static int
H5R_get_obj_type(H5F_t *file, hid_t dxpl_id, H5R_type_t ref_type, void *_ref)
{
H5G_entry_t ent; /* Symbol table entry */
uint8_t *p; /* Pointer to OID to store */
int ret_value;
FUNC_ENTER_NOINIT(H5R_get_obj_type);
assert(file);
assert(_ref);
/* Initialize the symbol table entry */
HDmemset(&ent,0,sizeof(H5G_entry_t));
ent.type=H5G_NOTHING_CACHED;
ent.file=file;
switch(ref_type) {
case H5R_OBJECT:
{
hobj_ref_t *ref=(hobj_ref_t *)_ref; /* Only object references currently supported */
/* Get the object oid */
p=(uint8_t *)ref->oid;
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(ent.header));
} /* end case */
break;
case H5R_DATASET_REGION:
{
hdset_reg_ref_t *ref=(hdset_reg_ref_t *)_ref; /* Get pointer to correct type of reference struct */
H5HG_t hobjid; /* Heap object ID */
uint8_t *buf; /* Buffer to store serialized selection in */
/* Get the heap ID for the dataset region */
p=(uint8_t *)ref->heapid;
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(hobjid.addr));
INT32DECODE(p,hobjid.idx);
/* Get the dataset region from the heap (allocate inside routine) */
if((buf=H5HG_read(ent.file,dxpl_id,&hobjid,NULL))==NULL)
HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, H5G_UNKNOWN, "Unable to read dataset region information");
/* Get the object oid for the dataset */
p=(uint8_t *)buf;
H5F_addr_decode(ent.file,(const uint8_t **)&p,&(ent.header));
/* Free the buffer allocated in H5HG_read() */
H5MM_xfree(buf);
} /* end case */
break;
case H5R_INTERNAL:
HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, H5G_UNKNOWN, "Internal references are not yet supported");
case H5R_BADTYPE:
case H5R_MAXTYPE:
default:
assert("unknown reference type" && 0);
HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, H5G_UNKNOWN, "internal error (unknown reference type)");
} /* end switch */
/* Check to make certain that this object hasn't been deleted since the reference was created */
if(H5O_link(&ent,0,dxpl_id)<=0)
HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, H5G_UNKNOWN, "dereferencing deleted object");
/* Get the OID type */
ret_value=H5G_get_type(&ent,dxpl_id);
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5R_get_obj_type() */
/*--------------------------------------------------------------------------
NAME
H5Rget_obj_type
PURPOSE
Retrieves the type of object that an object reference points to
USAGE
int H5Rget_obj_type(id, ref_type, ref)
hid_t id; IN: Dataset reference object is in or location ID of
object that the dataset is located within.
H5R_type_t ref_type; IN: Type of reference to query
void *ref; IN: Reference to query.
RETURNS
Success: An object type defined in H5Gpublic.h
Failure: H5G_UNKNOWN
DESCRIPTION
Given a reference to some object, this function returns the type of object
pointed to.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
int
H5Rget_obj_type(hid_t id, H5R_type_t ref_type, void *_ref)
{
H5G_entry_t *loc = NULL; /* Symbol table entry */
H5F_t *file=NULL; /* File object */
hid_t ret_value;
FUNC_ENTER_API(H5Rget_obj_type, H5G_UNKNOWN);
H5TRACE3("Is","iRtx",id,ref_type,_ref);
/* Check args */
if (NULL == (loc = H5G_loc(id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location");
if(ref_type<=H5R_BADTYPE || ref_type>=H5R_MAXTYPE)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type");
if(_ref==NULL)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer");
/* Get the file pointer from the entry */
file=loc->file;
/* Get the object information */
if ((ret_value=H5R_get_obj_type(file,H5AC_ind_dxpl_id,ref_type,_ref))<0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type");
done:
FUNC_LEAVE_API(ret_value);
} /* end H5Rget_obj_type() */