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 */
|
2009-02-13 02:47:04 +08:00
|
|
|
|
static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
|
|
|
|
|
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,
|
2010-09-22 01:52:12 +08:00
|
|
|
|
H5F_t *file_dst, hbool_t *recompute_size, H5O_copy_t *cpy_info, void *_udata,
|
2007-05-15 04:24:08 +08:00
|
|
|
|
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 *
|
2009-02-13 02:47:04 +08:00
|
|
|
|
H5O_stab_decode(H5F_t *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
|
|
|
|
|
unsigned UNUSED mesg_flags, unsigned UNUSED *ioflags, const uint8_t *p)
|
1997-08-08 03:23:00 +08:00
|
|
|
|
{
|
2008-08-22 04:30:19 +08:00
|
|
|
|
H5O_stab_t *stab = NULL;
|
2002-08-09 00:52:55 +08:00
|
|
|
|
void *ret_value; /* Return value */
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
2008-08-22 04:30:19 +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 */
|
2008-08-22 04:30:19 +08:00
|
|
|
|
HDassert(f);
|
|
|
|
|
HDassert(p);
|
1997-08-08 03:23:00 +08:00
|
|
|
|
|
1998-01-17 06:23:43 +08:00
|
|
|
|
/* decode */
|
2008-08-22 04:30:19 +08:00
|
|
|
|
if(NULL == (stab = H5FL_CALLOC(H5O_stab_t)))
|
|
|
|
|
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 */
|
2008-08-22 04:30:19 +08:00
|
|
|
|
ret_value = stab;
|
2002-08-09 00:52:55 +08:00
|
|
|
|
|
|
|
|
|
done:
|
2008-08-22 04:30:19 +08:00
|
|
|
|
if(ret_value == NULL) {
|
|
|
|
|
if(stab != NULL)
|
2010-04-21 02:26:41 +08:00
|
|
|
|
stab = H5FL_FREE(H5O_stab_t, stab);
|
2002-08-09 00:52:55 +08:00
|
|
|
|
} /* end if */
|
|
|
|
|
|
2008-08-22 04:30:19 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(ret_value)
|
|
|
|
|
} /* end H5O_stab_decode() */
|
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
|
2008-08-22 04:30:19 +08:00
|
|
|
|
H5O_stab_free(void *mesg)
|
2000-08-17 04:13:02 +08:00
|
|
|
|
{
|
2008-08-22 04:30:19 +08:00
|
|
|
|
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_stab_free)
|
2000-08-17 04:13:02 +08:00
|
|
|
|
|
2008-08-22 04:30:19 +08:00
|
|
|
|
HDassert(mesg);
|
2000-08-17 04:13:02 +08:00
|
|
|
|
|
2010-04-21 02:26:41 +08:00
|
|
|
|
mesg = H5FL_FREE(H5O_stab_t, mesg);
|
2000-08-17 04:13:02 +08:00
|
|
|
|
|
2008-08-22 04:30:19 +08:00
|
|
|
|
FUNC_LEAVE_NOAPI(SUCCEED)
|
|
|
|
|
} /* end H5O_stab_free() */
|
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 */
|
2008-08-22 04:30:19 +08:00
|
|
|
|
if(H5G_stab_delete(f, dxpl_id, (const H5O_stab_t *)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,
|
2010-09-22 01:52:12 +08:00
|
|
|
|
hbool_t UNUSED *recompute_size, H5O_copy_t UNUSED *cpy_info, void *_udata,
|
2007-05-15 04:24:08 +08:00
|
|
|
|
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;
|
2010-09-22 01:52:12 +08:00
|
|
|
|
H5G_copy_file_ud_t *udata = (H5G_copy_file_ud_t *)_udata;
|
2005-11-15 10:55:39 +08:00
|
|
|
|
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")
|
2010-09-22 01:52:12 +08:00
|
|
|
|
|
2010-06-16 04:00:22 +08:00
|
|
|
|
/* Set copy metadata tag */
|
|
|
|
|
H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, NULL);
|
2005-11-15 10:55:39 +08:00
|
|
|
|
|
|
|
|
|
/* 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
|
|
|
|
|
2010-06-16 04:00:22 +08:00
|
|
|
|
/* Reset metadata tag */
|
|
|
|
|
H5_END_TAG(NULL);
|
|
|
|
|
|
2010-09-22 01:52:12 +08:00
|
|
|
|
/* Cache stab in udata */
|
|
|
|
|
udata->cache_type = H5G_CACHED_STAB;
|
|
|
|
|
udata->cache.stab.btree_addr = stab_dst->btree_addr;
|
|
|
|
|
udata->cache.stab.heap_addr = stab_dst->heap_addr;
|
|
|
|
|
|
2005-11-07 11:13:53 +08:00
|
|
|
|
/* Set return value */
|
|
|
|
|
ret_value = stab_dst;
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
if(!ret_value)
|
|
|
|
|
if(stab_dst)
|
2010-04-21 02:26:41 +08:00
|
|
|
|
stab_dst = H5FL_FREE(H5O_stab_t, stab_dst);
|
2005-11-07 11:13:53 +08:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|