2003-02-17 23:54:15 +08:00
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
|
* Copyright by The HDF Group. *
|
2003-02-17 23:54:15 +08:00
|
|
|
|
* 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 *
|
2007-02-07 22:56:24 +08:00
|
|
|
|
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
|
* access to either file, you may request a copy from help@hdfgroup.org. *
|
2003-02-17 23:54:15 +08:00
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Created: H5Ostab.c
|
|
|
|
|
* Aug 6 1997
|
|
|
|
|
* Robb Matzke <matzke@llnl.gov>
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Symbol table messages.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
2003-02-17 23:54:15 +08:00
|
|
|
|
|
2007-01-23 11:46:31 +08:00
|
|
|
|
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
|
|
|
|
|
#define H5O_PACKAGE /*suppress error about including H5Opkg */
|
2003-02-17 23:54:15 +08:00
|
|
|
|
|
2003-05-16 03:22:33 +08:00
|
|
|
|
#include "H5private.h" /* Generic Functions */
|
|
|
|
|
#include "H5Eprivate.h" /* Error handling */
|
|
|
|
|
#include "H5FLprivate.h" /* Free lists */
|
|
|
|
|
#include "H5Gpkg.h" /* Groups */
|
2005-11-15 10:55:39 +08:00
|
|
|
|
#include "H5HLprivate.h" /* Local Heaps */
|
2003-05-16 03:22:33 +08:00
|
|
|
|
#include "H5Opkg.h" /* Object headers */
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1997-08-10 00:45:59 +08:00
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
/* PRIVATE PROTOTYPES */
|
2008-08-11 23:16:34 +08:00
|
|
|
|
static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags,
|
|
|
|
|
unsigned *ioflags, const uint8_t *p);
|
2007-02-04 15:37:15 +08:00
|
|
|
|
static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
|
2006-12-07 06:19:52 +08:00
|
|
|
|
static void *H5O_stab_copy(const void *_mesg, void *_dest);
|
2007-02-04 15:37:15 +08:00
|
|
|
|
static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
|
2005-08-29 13:36:16 +08:00
|
|
|
|
static herr_t H5O_stab_free(void *_mesg);
|
2007-05-15 04:24:08 +08:00
|
|
|
|
static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg);
|
2007-02-04 15:37:15 +08:00
|
|
|
|
static void *H5O_stab_copy_file(H5F_t *file_src, void *native_src,
|
2007-05-15 04:24:08 +08:00
|
|
|
|
H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, void *udata,
|
|
|
|
|
hid_t dxpl_id);
|
2006-10-02 18:24:03 +08:00
|
|
|
|
static herr_t H5O_stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
|
|
|
|
|
void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info);
|
2003-02-11 01:26:09 +08:00
|
|
|
|
static herr_t H5O_stab_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
|
2005-11-07 11:13:53 +08:00
|
|
|
|
FILE * stream, int indent, int fwidth);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2005-12-04 10:27:37 +08:00
|
|
|
|
/* This message derives from H5O message class */
|
|
|
|
|
const H5O_msg_class_t H5O_MSG_STAB[1] = {{
|
1998-06-05 06:27:11 +08:00
|
|
|
|
H5O_STAB_ID, /*message id number */
|
|
|
|
|
"stab", /*message name for debugging */
|
|
|
|
|
sizeof(H5O_stab_t), /*native message size */
|
2007-05-15 04:24:08 +08:00
|
|
|
|
0, /* messages are sharable? */
|
1998-06-05 06:27:11 +08:00
|
|
|
|
H5O_stab_decode, /*decode message */
|
|
|
|
|
H5O_stab_encode, /*encode message */
|
|
|
|
|
H5O_stab_copy, /*copy the native value */
|
|
|
|
|
H5O_stab_size, /*size of symbol table entry */
|
|
|
|
|
NULL, /*default reset method */
|
2003-04-14 13:03:26 +08:00
|
|
|
|
H5O_stab_free, /* free method */
|
|
|
|
|
H5O_stab_delete, /* file delete method */
|
2003-10-06 05:12:26 +08:00
|
|
|
|
NULL, /* link method */
|
1998-06-05 06:27:11 +08:00
|
|
|
|
NULL, /*set share method */
|
2007-01-17 01:19:11 +08:00
|
|
|
|
NULL, /*can share method */
|
2005-12-04 10:27:37 +08:00
|
|
|
|
NULL, /* pre copy native value to file */
|
2005-11-07 11:13:53 +08:00
|
|
|
|
H5O_stab_copy_file, /* copy native value to file */
|
|
|
|
|
H5O_stab_post_copy_file, /* post copy native value to file */
|
2007-01-19 22:54:46 +08:00
|
|
|
|
NULL, /* get creation index */
|
|
|
|
|
NULL, /* set creation index */
|
2005-11-07 11:13:53 +08:00
|
|
|
|
H5O_stab_debug /*debug the message */
|
1998-02-10 03:37:40 +08:00
|
|
|
|
}};
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2000-08-17 04:13:02 +08:00
|
|
|
|
/* Declare a free list to manage the H5O_stab_t struct */
|
|
|
|
|
H5FL_DEFINE_STATIC(H5O_stab_t);
|
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5O_stab_decode
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Decode a symbol table message and return a pointer to
|
2005-08-29 13:36:16 +08:00
|
|
|
|
* a newly allocated one.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Return: Success: Ptr to new message in native order.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Failure: NULL
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 6 1997
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1998-02-10 03:37:40 +08:00
|
|
|
|
static void *
|
2007-01-23 11:46:31 +08:00
|
|
|
|
H5O_stab_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags,
|
2008-08-11 23:16:34 +08:00
|
|
|
|
unsigned UNUSED *ioflags, const uint8_t *p)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
{
|
2002-08-09 00:52:55 +08:00
|
|
|
|
H5O_stab_t *stab=NULL;
|
|
|
|
|
void *ret_value; /* Return value */
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_decode);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check args */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(p);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* decode */
|
[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
|
|
|
|
if (NULL==(stab = H5FL_CALLOC(H5O_stab_t)))
|
2002-08-09 00:52:55 +08:00
|
|
|
|
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
|
1998-01-17 06:23:43 +08:00
|
|
|
|
H5F_addr_decode(f, &p, &(stab->btree_addr));
|
|
|
|
|
H5F_addr_decode(f, &p, &(stab->heap_addr));
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
/* Set return value */
|
|
|
|
|
ret_value=stab;
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
if(ret_value==NULL) {
|
|
|
|
|
if(stab!=NULL)
|
|
|
|
|
H5FL_FREE(H5O_stab_t,stab);
|
|
|
|
|
} /* end if */
|
|
|
|
|
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5O_stab_encode
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Encodes a symbol table message.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 6 1997
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
2007-02-04 15:37:15 +08:00
|
|
|
|
H5O_stab_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p, const void *_mesg)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
{
|
1998-01-17 06:23:43 +08:00
|
|
|
|
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_encode);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check args */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(p);
|
|
|
|
|
assert(stab);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* encode */
|
1999-07-29 02:25:43 +08:00
|
|
|
|
H5F_addr_encode(f, &p, stab->btree_addr);
|
|
|
|
|
H5F_addr_encode(f, &p, stab->heap_addr);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(SUCCEED);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
}
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5O_stab_copy
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
|
|
|
|
|
* necessary.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Return: Success: Ptr to _DEST
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Failure: NULL
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 6 1997
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
1998-02-10 03:37:40 +08:00
|
|
|
|
static void *
|
2006-12-07 06:19:52 +08:00
|
|
|
|
H5O_stab_copy(const void *_mesg, void *_dest)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
{
|
1998-01-17 06:23:43 +08:00
|
|
|
|
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
|
|
|
|
|
H5O_stab_t *dest = (H5O_stab_t *) _dest;
|
2002-08-09 00:52:55 +08:00
|
|
|
|
void *ret_value; /* Return value */
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2007-02-04 15:37:15 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_copy)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* check args */
|
2007-02-04 15:37:15 +08:00
|
|
|
|
HDassert(stab);
|
|
|
|
|
if(!dest && NULL == (dest = H5FL_MALLOC(H5O_stab_t)))
|
2002-08-09 00:52:55 +08:00
|
|
|
|
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* copy */
|
|
|
|
|
*dest = *stab;
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2002-08-09 00:52:55 +08:00
|
|
|
|
/* Set return value */
|
2007-02-04 15:37:15 +08:00
|
|
|
|
ret_value = dest;
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
|
|
|
|
done:
|
2007-02-04 15:37:15 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
|
|
|
} /* end H5O_stab_copy() */
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5O_stab_size
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Returns the size of the raw message in bytes not counting
|
|
|
|
|
* the message type or size fields, but only the data fields.
|
|
|
|
|
* This function doesn't take into account alignment.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Return: Success: Message data size in bytes without alignment.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-03-18 05:50:32 +08:00
|
|
|
|
* Failure: zero
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 6 1997
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static size_t
|
2007-02-04 15:37:15 +08:00
|
|
|
|
H5O_stab_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void UNUSED *_mesg)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
{
|
2002-08-10 04:48:23 +08:00
|
|
|
|
size_t ret_value; /* Return value */
|
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_size);
|
2002-08-10 04:48:23 +08:00
|
|
|
|
|
|
|
|
|
/* Set return value */
|
|
|
|
|
ret_value=2 * H5F_SIZEOF_ADDR(f);
|
|
|
|
|
|
2003-01-11 04:26:02 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
}
|
2000-08-17 04:13:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: H5O_stab_free
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Free's the message
|
|
|
|
|
*
|
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* Thursday, March 30, 2000
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
|
|
|
|
H5O_stab_free (void *mesg)
|
|
|
|
|
{
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_free);
|
2000-08-17 04:13:02 +08:00
|
|
|
|
|
|
|
|
|
assert (mesg);
|
|
|
|
|
|
|
|
|
|
H5FL_FREE(H5O_stab_t,mesg);
|
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(SUCCEED);
|
2000-08-17 04:13:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
2003-04-14 13:03:26 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: H5O_stab_delete
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Free file space referenced by message
|
|
|
|
|
*
|
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* Thursday, March 20, 2003
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
2007-05-15 04:24:08 +08:00
|
|
|
|
H5O_stab_delete(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh, void *mesg)
|
2003-04-14 13:03:26 +08:00
|
|
|
|
{
|
2006-10-02 18:24:03 +08:00
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
2003-04-14 13:03:26 +08:00
|
|
|
|
|
2005-09-12 14:02:55 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_delete)
|
2003-04-14 13:03:26 +08:00
|
|
|
|
|
|
|
|
|
/* check args */
|
2006-10-02 18:24:03 +08:00
|
|
|
|
HDassert(f);
|
|
|
|
|
HDassert(mesg);
|
2003-04-14 13:03:26 +08:00
|
|
|
|
|
|
|
|
|
/* Free the file space for the symbol table */
|
2007-02-06 06:26:44 +08:00
|
|
|
|
if(H5G_stab_delete(f, dxpl_id, mesg) < 0)
|
2005-09-12 14:02:55 +08:00
|
|
|
|
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free symbol table")
|
2003-04-14 13:03:26 +08:00
|
|
|
|
|
|
|
|
|
done:
|
2005-09-12 14:02:55 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
2003-04-14 13:03:26 +08:00
|
|
|
|
} /* end H5O_stab_delete() */
|
|
|
|
|
|
2005-11-07 11:13:53 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: H5O_stab_copy_file
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Copies a message from _MESG to _DEST in file
|
|
|
|
|
*
|
|
|
|
|
* Return: Success: Ptr to _DEST
|
|
|
|
|
*
|
|
|
|
|
* Failure: NULL
|
|
|
|
|
*
|
2006-06-27 22:45:06 +08:00
|
|
|
|
* Programmer: Peter Cao
|
|
|
|
|
* September 10, 2005
|
2005-11-07 11:13:53 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static void *
|
2007-02-04 15:37:15 +08:00
|
|
|
|
H5O_stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst,
|
2007-05-15 04:24:08 +08:00
|
|
|
|
hbool_t UNUSED *recompute_size, H5O_copy_t UNUSED *cpy_info, void UNUSED *udata,
|
|
|
|
|
hid_t dxpl_id)
|
2005-11-07 11:13:53 +08:00
|
|
|
|
{
|
2005-11-15 10:55:39 +08:00
|
|
|
|
H5O_stab_t *stab_src = (H5O_stab_t *) native_src;
|
|
|
|
|
H5O_stab_t *stab_dst = NULL;
|
|
|
|
|
size_t size_hint; /* Local heap initial size */
|
|
|
|
|
void *ret_value; /* Return value */
|
2005-11-07 11:13:53 +08:00
|
|
|
|
|
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_copy_file)
|
|
|
|
|
|
|
|
|
|
/* check args */
|
|
|
|
|
HDassert(stab_src);
|
|
|
|
|
HDassert(file_dst);
|
|
|
|
|
|
|
|
|
|
/* Allocate space for the destination stab */
|
|
|
|
|
if(NULL == (stab_dst = H5FL_MALLOC(H5O_stab_t)))
|
|
|
|
|
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
|
|
|
|
|
2005-11-15 10:55:39 +08:00
|
|
|
|
/* Get the old local heap's size and use that as the hint for the new heap */
|
|
|
|
|
if(H5HL_get_size(file_src, dxpl_id, stab_src->heap_addr, &size_hint) < 0)
|
|
|
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size")
|
|
|
|
|
|
|
|
|
|
/* Create components of symbol table message */
|
|
|
|
|
if(H5G_stab_create_components(file_dst, stab_dst, size_hint, dxpl_id) < 0)
|
|
|
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components")
|
2005-11-07 11:13:53 +08:00
|
|
|
|
|
|
|
|
|
/* Set return value */
|
|
|
|
|
ret_value = stab_dst;
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
if(!ret_value)
|
|
|
|
|
if(stab_dst)
|
|
|
|
|
H5FL_FREE(H5O_stab_t, stab_dst);
|
|
|
|
|
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
|
|
|
} /* H5O_stab_copy_file() */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: H5O_stab_post_copy_file
|
|
|
|
|
*
|
2005-11-15 10:55:39 +08:00
|
|
|
|
* Purpose: Finish copying a message from between files
|
2005-11-07 11:13:53 +08:00
|
|
|
|
*
|
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
|
|
|
|
*
|
2006-06-27 22:45:06 +08:00
|
|
|
|
* Programmer: Peter Cao
|
|
|
|
|
* September 28, 2005
|
2005-11-07 11:13:53 +08:00
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
2006-06-27 22:45:06 +08:00
|
|
|
|
static herr_t
|
2006-10-02 18:24:03 +08:00
|
|
|
|
H5O_stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_loc_t *dst_oloc,
|
|
|
|
|
void *mesg_dst, hid_t dxpl_id, H5O_copy_t *cpy_info)
|
2005-11-07 11:13:53 +08:00
|
|
|
|
{
|
2005-11-15 10:55:39 +08:00
|
|
|
|
const H5O_stab_t *stab_src = (const H5O_stab_t *)mesg_src;
|
|
|
|
|
H5O_stab_t *stab_dst = (H5O_stab_t *)mesg_dst;
|
2006-11-11 12:15:27 +08:00
|
|
|
|
H5G_bt_it_cpy_t udata; /* B-tree user data */
|
2005-11-07 11:13:53 +08:00
|
|
|
|
herr_t ret_value = SUCCEED; /* Return value */
|
|
|
|
|
|
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_post_copy_file)
|
|
|
|
|
|
|
|
|
|
/* check args */
|
|
|
|
|
HDassert(stab_src);
|
2005-11-15 10:55:39 +08:00
|
|
|
|
HDassert(H5F_addr_defined(dst_oloc->addr));
|
|
|
|
|
HDassert(dst_oloc->file);
|
|
|
|
|
HDassert(stab_dst);
|
2006-06-27 06:01:43 +08:00
|
|
|
|
HDassert(cpy_info);
|
|
|
|
|
|
|
|
|
|
/* If we are performing a 'shallow hierarchy' copy, get out now */
|
|
|
|
|
if(cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth)
|
|
|
|
|
HGOTO_DONE(SUCCEED)
|
2005-11-07 11:13:53 +08:00
|
|
|
|
|
|
|
|
|
/* Set up B-tree iteration user data */
|
2006-10-02 18:24:03 +08:00
|
|
|
|
udata.src_oloc = src_oloc;
|
2005-11-15 10:55:39 +08:00
|
|
|
|
udata.src_heap_addr = stab_src->heap_addr;
|
|
|
|
|
udata.dst_file = dst_oloc->file;
|
|
|
|
|
udata.dst_stab = stab_dst;
|
2006-06-27 06:01:43 +08:00
|
|
|
|
udata.cpy_info = cpy_info;
|
2005-11-07 11:13:53 +08:00
|
|
|
|
|
|
|
|
|
/* Iterate over objects in group, copying them */
|
[svn-r15131] Description:
Finish omnibus chunked dataset I/O refactoring, to separate general
actions on chunked datasets from actions that are specific to using the v1
B-tree index.
Cleaned up a few bugs and added some additional tests also.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.5.2 (amazon) in debug mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
2008-06-04 03:44:12 +08:00
|
|
|
|
if((H5B_iterate(src_oloc->file, dxpl_id, H5B_SNODE, stab_src->btree_addr, H5G_node_copy, &udata)) < 0)
|
2005-11-07 11:13:53 +08:00
|
|
|
|
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed")
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
|
|
|
} /* H5O_stab_post_copy_file() */
|
|
|
|
|
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Function: H5O_stab_debug
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Purpose: Prints debugging info for a symbol table message.
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-10-27 05:18:54 +08:00
|
|
|
|
* Return: Non-negative on success/Negative on failure
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
1998-01-17 06:23:43 +08:00
|
|
|
|
* Programmer: Robb Matzke
|
|
|
|
|
* matzke@llnl.gov
|
|
|
|
|
* Aug 6 1997
|
1997-08-08 03:23:00 +08:00
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
static herr_t
|
2003-02-13 01:04:40 +08:00
|
|
|
|
H5O_stab_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * stream,
|
2001-08-15 06:09:56 +08:00
|
|
|
|
int indent, int fwidth)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
{
|
1998-01-17 06:23:43 +08:00
|
|
|
|
const H5O_stab_t *stab = (const H5O_stab_t *) _mesg;
|
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_debug);
|
1998-01-17 06:23:43 +08:00
|
|
|
|
|
|
|
|
|
/* check args */
|
|
|
|
|
assert(f);
|
|
|
|
|
assert(stab);
|
|
|
|
|
assert(stream);
|
|
|
|
|
assert(indent >= 0);
|
|
|
|
|
assert(fwidth >= 0);
|
|
|
|
|
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
|
|
|
|
|
"B-tree address:", stab->btree_addr);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1999-07-29 02:25:43 +08:00
|
|
|
|
HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth,
|
|
|
|
|
"Name heap address:", stab->heap_addr);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2004-06-23 23:36:35 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(SUCCEED);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
}
|