mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[svn-r11686] Purpose:
New feature Description: Add in baseline "object copy" code from Peter [in the form of a new API routine: H5Gcopy()]. There's still some work to do (like handling variable- length datatypes and possibly support for references) and it hasn't been tested on mounted files yet, but the core functionality is there and working correctly. I've also got a set of patches to update the 1.6 branch with tweaks to keep the branches mostly in sync, but Elena will kill me if I import them before the 1.6.5 release is out... :-) Platforms tested: FreeBSD 4.11 (sleipnir) h5committested
This commit is contained in:
parent
23e994958b
commit
0891038562
2
MANIFEST
2
MANIFEST
@ -398,6 +398,7 @@
|
||||
./src/H5ACprivate.h
|
||||
./src/H5ACpublic.h
|
||||
./src/H5B.c
|
||||
./src/H5Bcache.c
|
||||
./src/H5Bpkg.h
|
||||
./src/H5Bprivate.h
|
||||
./src/H5Bpublic.h
|
||||
@ -662,6 +663,7 @@
|
||||
./test/noencoder.h5
|
||||
./test/ntypes.c
|
||||
./test/ohdr.c
|
||||
./test/objcopy.c
|
||||
./test/reserved.c
|
||||
./test/space_overflow.c _DO_NOT_DISTRIBUTE_
|
||||
./test/gen_deflate.c _DO_NOT_DISTRIBUTE_
|
||||
|
@ -130,6 +130,9 @@ New Features
|
||||
|
||||
Library:
|
||||
--------
|
||||
- Added H5Gcopy() routine to copy objects between while keeping
|
||||
data in compressed form. QAK - 2005/11/06
|
||||
- Added H5Sextent_equal() routine. QAK - 2005/11/06
|
||||
- Added HSYS_ERROR which retrieves the system error message and pushes
|
||||
it to the error stack. This gives more information of the failed
|
||||
system call. AKC - 2005/08/04
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "H5Aprivate.h"
|
||||
|
||||
/* Other private headers needed by this file */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
#include "H5Sprivate.h" /* Dataspace */
|
||||
#include "H5Tprivate.h" /* Datatype functions */
|
||||
|
||||
@ -54,6 +55,12 @@ struct H5A_t {
|
||||
size_t data_size; /* Size of data on disk */
|
||||
};
|
||||
|
||||
/* Declare extern the free list for H5A_t's */
|
||||
H5FL_EXTERN(H5A_t);
|
||||
|
||||
/* Declare extern a free list to manage blocks of type conversion data */
|
||||
H5FL_BLK_EXTERN(attr_buf);
|
||||
|
||||
/* Function prototypes for H5A package scope */
|
||||
H5_DLL H5A_t *H5A_copy(H5A_t *new_attr, const H5A_t *old_attr, unsigned update_flags);
|
||||
H5_DLL herr_t H5A_free(H5A_t *attr);
|
||||
|
446
src/H5B.c
446
src/H5B.c
@ -14,7 +14,7 @@
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* Created: hdf5btree.c
|
||||
* Created: H5B.c
|
||||
* Jul 10 1997
|
||||
* Robb Matzke <matzke@llnl.gov>
|
||||
*
|
||||
@ -89,41 +89,47 @@
|
||||
* that type of B-tree.
|
||||
*
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* Robb Matzke, 4 Aug 1997
|
||||
* Added calls to H5E.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/****************/
|
||||
/* Module Setup */
|
||||
/****************/
|
||||
|
||||
#define H5B_PACKAGE /*suppress error about including H5Bpkg */
|
||||
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
|
||||
|
||||
|
||||
/* private headers */
|
||||
/***********/
|
||||
/* Headers */
|
||||
/***********/
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5ACprivate.h" /* Metadata cache */
|
||||
#include "H5Bpkg.h" /* B-link trees */
|
||||
#include "H5Dprivate.h" /* Datasets */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5Fpkg.h" /* File access */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
#include "H5Iprivate.h" /* IDs */
|
||||
#include "H5MFprivate.h" /* File memory management */
|
||||
#include "H5MMprivate.h" /* Memory management */
|
||||
#include "H5Pprivate.h" /* Property lists */
|
||||
|
||||
/* Local macros */
|
||||
/****************/
|
||||
/* Local Macros */
|
||||
/****************/
|
||||
#define H5B_SIZEOF_HDR(F) \
|
||||
(H5B_SIZEOF_MAGIC + /*magic number */ \
|
||||
4 + /*type, level, num entries */ \
|
||||
2*H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */
|
||||
#define H5B_NKEY(b,shared,idx) ((b)->native+(shared)->nkey[(idx)])
|
||||
|
||||
/* Local typedefs */
|
||||
/******************/
|
||||
/* Local Typedefs */
|
||||
/******************/
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
/********************/
|
||||
/* Local Prototypes */
|
||||
/********************/
|
||||
static H5B_ins_t H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr,
|
||||
const H5B_class_t *type,
|
||||
uint8_t *lt_key,
|
||||
@ -139,40 +145,34 @@ static herr_t H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt,
|
||||
unsigned *old_bt_flags, haddr_t old_addr,
|
||||
unsigned idx, void *udata, haddr_t *new_addr/*out*/);
|
||||
static H5B_t * H5B_copy(const H5B_t *old_bt);
|
||||
static herr_t H5B_serialize(const H5F_t *f, const H5B_t *bt);
|
||||
#ifdef H5B_DEBUG
|
||||
static herr_t H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type,
|
||||
void *udata);
|
||||
#endif
|
||||
|
||||
/* Metadata cache callbacks */
|
||||
static H5B_t *H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata);
|
||||
static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *b);
|
||||
static herr_t H5B_dest(H5F_t *f, H5B_t *b);
|
||||
static herr_t H5B_clear(H5F_t *f, H5B_t *b, hbool_t destroy);
|
||||
static herr_t H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr);
|
||||
|
||||
/* H5B inherits cache-like properties from H5AC */
|
||||
static const H5AC_class_t H5AC_BT[1] = {{
|
||||
H5AC_BT_ID,
|
||||
(H5AC_load_func_t)H5B_load,
|
||||
(H5AC_flush_func_t)H5B_flush,
|
||||
(H5AC_dest_func_t)H5B_dest,
|
||||
(H5AC_clear_func_t)H5B_clear,
|
||||
(H5AC_size_func_t)H5B_compute_size,
|
||||
}};
|
||||
|
||||
/* Declare a PQ free list to manage the native block information */
|
||||
H5FL_BLK_DEFINE_STATIC(native_block);
|
||||
/*********************/
|
||||
/* Package Variables */
|
||||
/*********************/
|
||||
|
||||
/* Declare a free list to manage the haddr_t sequence information */
|
||||
H5FL_SEQ_DEFINE_STATIC(haddr_t);
|
||||
H5FL_SEQ_DEFINE(haddr_t);
|
||||
|
||||
/* Declare a PQ free list to manage the native block information */
|
||||
H5FL_BLK_DEFINE(native_block);
|
||||
|
||||
/* Declare a free list to manage the H5B_t struct */
|
||||
H5FL_DEFINE(H5B_t);
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
/*****************************/
|
||||
|
||||
/* Declare a free list to manage the H5B_shared_t struct */
|
||||
H5FL_DEFINE(H5B_shared_t);
|
||||
|
||||
/* Declare a free list to manage the H5B_t struct */
|
||||
H5FL_DEFINE_STATIC(H5B_t);
|
||||
/*******************/
|
||||
/* Local Variables */
|
||||
/*******************/
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -263,377 +263,7 @@ done:
|
||||
}
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /*lint !e818 Can't make udata a pointer to const */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_load
|
||||
*
|
||||
* Purpose: Loads a B-tree node from the disk.
|
||||
*
|
||||
* Return: Success: Pointer to a new B-tree node.
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* matzke@llnl.gov
|
||||
* Jun 23 1997
|
||||
*
|
||||
* Modifications:
|
||||
* Robb Matzke, 1999-07-28
|
||||
* The ADDR argument is passed by value.
|
||||
*
|
||||
* Quincey Koziol, 2002-7-180
|
||||
* Added dxpl parameter to allow more control over I/O from metadata
|
||||
* cache.
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static H5B_t *
|
||||
H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
|
||||
{
|
||||
const H5B_class_t *type = (const H5B_class_t *) _type;
|
||||
H5B_t *bt = NULL;
|
||||
H5B_shared_t *shared; /* Pointer to shared B-tree info */
|
||||
uint8_t *p; /* Pointer into raw data buffer */
|
||||
uint8_t *native; /* Pointer to native keys */
|
||||
unsigned u; /* Local index variable */
|
||||
H5B_t *ret_value;
|
||||
|
||||
FUNC_ENTER_NOAPI(H5B_load, NULL)
|
||||
|
||||
/* Check arguments */
|
||||
assert(f);
|
||||
assert(H5F_addr_defined(addr));
|
||||
assert(type);
|
||||
assert(type->get_shared);
|
||||
|
||||
if (NULL==(bt = H5FL_MALLOC(H5B_t)))
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t));
|
||||
if((bt->rc_shared=(type->get_shared)(f, udata))==NULL)
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "can't retrieve B-tree node buffer")
|
||||
shared=H5RC_GET_OBJ(bt->rc_shared);
|
||||
HDassert(shared);
|
||||
if (NULL==(bt->native=H5FL_BLK_MALLOC(native_block,shared->sizeof_keys)) ||
|
||||
NULL==(bt->child=H5FL_SEQ_MALLOC(haddr_t,(size_t)shared->two_k)))
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
|
||||
if (H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page)<0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree node")
|
||||
|
||||
p = shared->page;
|
||||
|
||||
/* magic number */
|
||||
if (HDmemcmp(p, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree signature")
|
||||
p += 4;
|
||||
|
||||
/* node type and level */
|
||||
if (*p++ != (uint8_t)type->id)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree node type")
|
||||
bt->level = *p++;
|
||||
|
||||
/* entries used */
|
||||
UINT16DECODE(p, bt->nchildren);
|
||||
|
||||
/* sibling pointers */
|
||||
H5F_addr_decode(f, (const uint8_t **) &p, &(bt->left));
|
||||
H5F_addr_decode(f, (const uint8_t **) &p, &(bt->right));
|
||||
|
||||
/* the child/key pairs */
|
||||
native=bt->native;
|
||||
for (u = 0; u < bt->nchildren; u++) {
|
||||
/* Decode native key value */
|
||||
if ((type->decode) (f, bt, p, native) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key")
|
||||
p += shared->sizeof_rkey;
|
||||
native += type->sizeof_nkey;
|
||||
|
||||
/* Decode address value */
|
||||
H5F_addr_decode(f, (const uint8_t **) &p, bt->child + u);
|
||||
}
|
||||
|
||||
/* Decode final key */
|
||||
if(bt->nchildren>0) {
|
||||
/* Decode native key value */
|
||||
if ((type->decode) (f, bt, p, native) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key")
|
||||
} /* end if */
|
||||
|
||||
/* Set return value */
|
||||
ret_value = bt;
|
||||
|
||||
done:
|
||||
if (!ret_value && bt)
|
||||
(void)H5B_dest(f,bt);
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /*lint !e818 Can't make udata a pointer to const */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_serialize
|
||||
*
|
||||
* Purpose: Serialize the data structure for writing to disk or
|
||||
* storing on the SAP (for FPHDF5).
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Bill Wendling
|
||||
* wendling@ncsa.uiuc.edu
|
||||
* Sept. 15, 2003
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5B_serialize(const H5F_t *f, const H5B_t *bt)
|
||||
{
|
||||
H5B_shared_t *shared=NULL; /* Pointer to shared B-tree info */
|
||||
unsigned u;
|
||||
uint8_t *p; /* Pointer into raw data buffer */
|
||||
uint8_t *native; /* Pointer to native keys */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5B_serialize, FAIL)
|
||||
|
||||
/* check arguments */
|
||||
assert(f);
|
||||
assert(bt);
|
||||
assert(bt->rc_shared);
|
||||
shared=H5RC_GET_OBJ(bt->rc_shared);
|
||||
HDassert(shared);
|
||||
|
||||
p = shared->page;
|
||||
|
||||
/* magic number */
|
||||
HDmemcpy(p, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC);
|
||||
p += 4;
|
||||
|
||||
/* node type and level */
|
||||
*p++ = (uint8_t)shared->type->id;
|
||||
H5_CHECK_OVERFLOW(bt->level, unsigned, uint8_t);
|
||||
*p++ = (uint8_t)bt->level;
|
||||
|
||||
/* entries used */
|
||||
UINT16ENCODE(p, bt->nchildren);
|
||||
|
||||
/* sibling pointers */
|
||||
H5F_addr_encode(f, &p, bt->left);
|
||||
H5F_addr_encode(f, &p, bt->right);
|
||||
|
||||
/* child keys and pointers */
|
||||
native=bt->native;
|
||||
for (u = 0; u < bt->nchildren; ++u) {
|
||||
/* encode the key */
|
||||
if (shared->type->encode(f, bt, p, native) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key")
|
||||
p += shared->sizeof_rkey;
|
||||
native += shared->type->sizeof_nkey;
|
||||
|
||||
/* encode the child address */
|
||||
H5F_addr_encode(f, &p, bt->child[u]);
|
||||
} /* end for */
|
||||
if(bt->nchildren>0) {
|
||||
/* Encode the final key */
|
||||
if (shared->type->encode(f, bt, p, native) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key")
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_flush
|
||||
*
|
||||
* Purpose: Flushes a dirty B-tree node to disk.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* matzke@llnl.gov
|
||||
* Jun 23 1997
|
||||
*
|
||||
* Modifications:
|
||||
* rky 980828
|
||||
* Only p0 writes metadata to disk.
|
||||
*
|
||||
* Robb Matzke, 1999-07-28
|
||||
* The ADDR argument is passed by value.
|
||||
*
|
||||
* Quincey Koziol, 2002-7-180
|
||||
* Added dxpl parameter to allow more control over I/O from metadata
|
||||
* cache.
|
||||
*
|
||||
* Bill Wendling, 2003-09-15
|
||||
* Separated out the bit of code that serializes the B-Tree
|
||||
* structure.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt)
|
||||
{
|
||||
H5B_shared_t *shared; /* Pointer to shared B-tree info */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5B_flush, FAIL)
|
||||
|
||||
/* check arguments */
|
||||
assert(f);
|
||||
assert(H5F_addr_defined(addr));
|
||||
assert(bt);
|
||||
shared=H5RC_GET_OBJ(bt->rc_shared);
|
||||
HDassert(shared);
|
||||
assert(shared->type);
|
||||
assert(shared->type->encode);
|
||||
|
||||
if (bt->cache_info.is_dirty) {
|
||||
if (H5B_serialize(f, bt) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTSERIALIZE, FAIL, "unable to serialize B-tree")
|
||||
|
||||
/*
|
||||
* Write the disk page. We always write the header, but we don't
|
||||
* bother writing data for the child entries that don't exist or
|
||||
* for the final unchanged children.
|
||||
*/
|
||||
if (H5F_block_write(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree node to disk")
|
||||
|
||||
bt->cache_info.is_dirty = FALSE;
|
||||
} /* end if */
|
||||
|
||||
if (destroy)
|
||||
if (H5B_dest(f,bt) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_dest
|
||||
*
|
||||
* Purpose: Destroys a B-tree node in memory.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* Jan 15 2003
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
static herr_t
|
||||
H5B_dest(H5F_t UNUSED *f, H5B_t *bt)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B_dest)
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
*/
|
||||
assert(bt);
|
||||
assert(bt->rc_shared);
|
||||
|
||||
H5FL_SEQ_FREE(haddr_t,bt->child);
|
||||
H5FL_BLK_FREE(native_block,bt->native);
|
||||
H5RC_DEC(bt->rc_shared);
|
||||
H5FL_FREE(H5B_t,bt);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5B_dest() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_clear
|
||||
*
|
||||
* Purpose: Mark a B-tree node in memory as non-dirty.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* Mar 20 2003
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5B_clear(H5F_t *f, H5B_t *bt, hbool_t destroy)
|
||||
{
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5B_clear)
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
*/
|
||||
assert(bt);
|
||||
|
||||
/* Reset the dirty flag. */
|
||||
bt->cache_info.is_dirty = FALSE;
|
||||
|
||||
if (destroy)
|
||||
if (H5B_dest(f, bt) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5B_clear() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_compute_size
|
||||
*
|
||||
* Purpose: Compute the size in bytes of the specified instance of
|
||||
* H5B_t on disk, and return it in *len_ptr. On failure,
|
||||
* the value of *len_ptr is undefined.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: John Mainzer
|
||||
* 5/13/04
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr)
|
||||
{
|
||||
H5B_shared_t *shared; /* Pointer to shared B-tree info */
|
||||
size_t size;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5B_compute_size)
|
||||
|
||||
/* check arguments */
|
||||
HDassert(f);
|
||||
HDassert(bt);
|
||||
HDassert(bt->rc_shared);
|
||||
shared=H5RC_GET_OBJ(bt->rc_shared);
|
||||
HDassert(shared);
|
||||
HDassert(shared->type);
|
||||
HDassert(size_ptr);
|
||||
|
||||
/* Check node's size */
|
||||
if ((size = H5B_nodesize(f, shared, NULL)) == 0)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, "H5B_nodesize() failed")
|
||||
|
||||
/* Set size value */
|
||||
*size_ptr = size;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5B_H5B_compute_size() */
|
||||
} /* end H5B_create() */ /*lint !e818 Can't make udata a pointer to const */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -749,7 +379,7 @@ done:
|
||||
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
} /* end H5B_find() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -934,7 +564,7 @@ done:
|
||||
HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
} /* end H5B_split() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -1106,7 +736,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr,
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
} /* end H5B_insert() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
31
src/H5B2.c
31
src/H5B2.c
@ -28,15 +28,23 @@
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/****************/
|
||||
/* Module Setup */
|
||||
/****************/
|
||||
|
||||
#define H5B2_PACKAGE /*suppress error about including H5B2pkg */
|
||||
|
||||
/* Private headers */
|
||||
/***********/
|
||||
/* Headers */
|
||||
/***********/
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5B2pkg.h" /* v2 B-trees */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5MFprivate.h" /* File memory management */
|
||||
|
||||
/* Local macros */
|
||||
/****************/
|
||||
/* Local Macros */
|
||||
/****************/
|
||||
|
||||
/* Format overhead for each node (on disk) */
|
||||
#define H5B2_OVERHEAD_SIZE (H5B2_SIZEOF_MAGIC+1) /* Signature + version # */
|
||||
@ -51,9 +59,13 @@
|
||||
/* #define H5B2_DEBUG */
|
||||
|
||||
|
||||
/* Local typedefs */
|
||||
/******************/
|
||||
/* Local Typedefs */
|
||||
/******************/
|
||||
|
||||
/* Local prototypes */
|
||||
/********************/
|
||||
/* Local Prototypes */
|
||||
/********************/
|
||||
|
||||
/* Helper functions */
|
||||
static herr_t H5B2_create_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
|
||||
@ -113,7 +125,9 @@ static herr_t H5B2_assert_internal2(hsize_t parent_all_nrec, H5B2_shared_t *shar
|
||||
#endif /* H5B2_DEBUG */
|
||||
|
||||
|
||||
/* Package variables */
|
||||
/*********************/
|
||||
/* Package Variables */
|
||||
/*********************/
|
||||
|
||||
/* Declare a free list to manage the H5B2_t struct */
|
||||
H5FL_DEFINE(H5B2_t);
|
||||
@ -124,8 +138,13 @@ H5FL_DEFINE(H5B2_internal_t);
|
||||
/* Declare a free list to manage the H5B2_leaf_t struct */
|
||||
H5FL_DEFINE(H5B2_leaf_t);
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
/*****************************/
|
||||
|
||||
/* Static variables */
|
||||
/*******************/
|
||||
/* Local Variables */
|
||||
/*******************/
|
||||
|
||||
/* Declare a free list to manage B-tree node pages to/from disk */
|
||||
H5FL_BLK_DEFINE_STATIC(node_page);
|
||||
|
@ -96,6 +96,10 @@ typedef struct H5B2_class_t {
|
||||
|
||||
} H5B2_class_t;
|
||||
|
||||
/*****************************/
|
||||
/* Library-private Variables */
|
||||
/*****************************/
|
||||
|
||||
/***************************************/
|
||||
/* Library-private Function Prototypes */
|
||||
/***************************************/
|
||||
|
@ -551,7 +551,7 @@ H5BP_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5
|
||||
|
||||
/* Encode the record */
|
||||
if((shared->type->encode)(f, leaf->rec_ptr[u], p, &rec_len) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "can't encode B+ tree record")
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "can't encode B+ tree record")
|
||||
assert(rec_len > 0);
|
||||
p += rec_len;
|
||||
|
||||
@ -561,7 +561,7 @@ H5BP_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5
|
||||
} /* end if */
|
||||
else {
|
||||
HDfprintf(stderr,"%s: attempting to decode fixed-size records from leaf node\n",FUNC);
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_UNSUPPORTED, NULL, "Can't decode records yet!")
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_UNSUPPORTED, FAIL, "Can't decode records yet!")
|
||||
} /* end else */
|
||||
|
||||
#ifdef LATER
|
||||
|
417
src/H5Bcache.c
Normal file
417
src/H5Bcache.c
Normal file
@ -0,0 +1,417 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by the Board of Trustees of the University of Illinois. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
||||
* terms governing use, modification, and redistribution, is contained in *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* Created: H5Bcache.c
|
||||
* Oct 31 2005
|
||||
* Quincey Koziol <koziol@ncsa.uiuc.edu>
|
||||
*
|
||||
* Purpose: Implement B-tree metadata cache methods.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/****************/
|
||||
/* Module Setup */
|
||||
/****************/
|
||||
|
||||
#define H5B_PACKAGE /*suppress error about including H5Bpkg */
|
||||
|
||||
|
||||
/***********/
|
||||
/* Headers */
|
||||
/***********/
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Bpkg.h" /* B-link trees */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
|
||||
/****************/
|
||||
/* Local Macros */
|
||||
/****************/
|
||||
|
||||
/******************/
|
||||
/* Local Typedefs */
|
||||
/******************/
|
||||
|
||||
/********************/
|
||||
/* Local Prototypes */
|
||||
/********************/
|
||||
|
||||
/* General routines */
|
||||
static herr_t H5B_serialize(const H5F_t *f, const H5B_t *bt);
|
||||
|
||||
/* Metadata cache callbacks */
|
||||
static H5B_t *H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata);
|
||||
static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *b);
|
||||
static herr_t H5B_clear(H5F_t *f, H5B_t *b, hbool_t destroy);
|
||||
static herr_t H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr);
|
||||
|
||||
/*********************/
|
||||
/* Package Variables */
|
||||
/*********************/
|
||||
|
||||
/* H5B inherits cache-like properties from H5AC */
|
||||
const H5AC_class_t H5AC_BT[1] = {{
|
||||
H5AC_BT_ID,
|
||||
(H5AC_load_func_t)H5B_load,
|
||||
(H5AC_flush_func_t)H5B_flush,
|
||||
(H5AC_dest_func_t)H5B_dest,
|
||||
(H5AC_clear_func_t)H5B_clear,
|
||||
(H5AC_size_func_t)H5B_compute_size,
|
||||
}};
|
||||
|
||||
/*******************/
|
||||
/* Local Variables */
|
||||
/*******************/
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_serialize
|
||||
*
|
||||
* Purpose: Serialize the data structure for writing to disk or
|
||||
* storing on the SAP (for FPHDF5).
|
||||
*
|
||||
* Return: Success: SUCCEED
|
||||
* Failure: FAIL
|
||||
*
|
||||
* Programmer: Bill Wendling
|
||||
* wendling@ncsa.uiuc.edu
|
||||
* Sept. 15, 2003
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5B_serialize(const H5F_t *f, const H5B_t *bt)
|
||||
{
|
||||
H5B_shared_t *shared=NULL; /* Pointer to shared B-tree info */
|
||||
unsigned u;
|
||||
uint8_t *p; /* Pointer into raw data buffer */
|
||||
uint8_t *native; /* Pointer to native keys */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5B_serialize, FAIL)
|
||||
|
||||
/* check arguments */
|
||||
HDassert(f);
|
||||
HDassert(bt);
|
||||
HDassert(bt->rc_shared);
|
||||
shared=H5RC_GET_OBJ(bt->rc_shared);
|
||||
HDassert(shared);
|
||||
|
||||
p = shared->page;
|
||||
|
||||
/* magic number */
|
||||
HDmemcpy(p, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC);
|
||||
p += 4;
|
||||
|
||||
/* node type and level */
|
||||
*p++ = (uint8_t)shared->type->id;
|
||||
H5_CHECK_OVERFLOW(bt->level, unsigned, uint8_t);
|
||||
*p++ = (uint8_t)bt->level;
|
||||
|
||||
/* entries used */
|
||||
UINT16ENCODE(p, bt->nchildren);
|
||||
|
||||
/* sibling pointers */
|
||||
H5F_addr_encode(f, &p, bt->left);
|
||||
H5F_addr_encode(f, &p, bt->right);
|
||||
|
||||
/* child keys and pointers */
|
||||
native=bt->native;
|
||||
for (u = 0; u < bt->nchildren; ++u) {
|
||||
/* encode the key */
|
||||
if (shared->type->encode(f, bt, p, native) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key")
|
||||
p += shared->sizeof_rkey;
|
||||
native += shared->type->sizeof_nkey;
|
||||
|
||||
/* encode the child address */
|
||||
H5F_addr_encode(f, &p, bt->child[u]);
|
||||
} /* end for */
|
||||
if(bt->nchildren>0) {
|
||||
/* Encode the final key */
|
||||
if (shared->type->encode(f, bt, p, native) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key")
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5B_serialize() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_load
|
||||
*
|
||||
* Purpose: Loads a B-tree node from the disk.
|
||||
*
|
||||
* Return: Success: Pointer to a new B-tree node.
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* matzke@llnl.gov
|
||||
* Jun 23 1997
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static H5B_t *
|
||||
H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
|
||||
{
|
||||
const H5B_class_t *type = (const H5B_class_t *) _type;
|
||||
H5B_t *bt = NULL;
|
||||
H5B_shared_t *shared; /* Pointer to shared B-tree info */
|
||||
uint8_t *p; /* Pointer into raw data buffer */
|
||||
uint8_t *native; /* Pointer to native keys */
|
||||
unsigned u; /* Local index variable */
|
||||
H5B_t *ret_value;
|
||||
|
||||
FUNC_ENTER_NOAPI(H5B_load, NULL)
|
||||
|
||||
/* Check arguments */
|
||||
HDassert(f);
|
||||
HDassert(H5F_addr_defined(addr));
|
||||
HDassert(type);
|
||||
HDassert(type->get_shared);
|
||||
|
||||
if (NULL==(bt = H5FL_MALLOC(H5B_t)))
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t));
|
||||
if((bt->rc_shared=(type->get_shared)(f, udata))==NULL)
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "can't retrieve B-tree node buffer")
|
||||
shared=H5RC_GET_OBJ(bt->rc_shared);
|
||||
HDassert(shared);
|
||||
if (NULL==(bt->native=H5FL_BLK_MALLOC(native_block,shared->sizeof_keys)) ||
|
||||
NULL==(bt->child=H5FL_SEQ_MALLOC(haddr_t,(size_t)shared->two_k)))
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
|
||||
if (H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page)<0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree node")
|
||||
|
||||
p = shared->page;
|
||||
|
||||
/* magic number */
|
||||
if (HDmemcmp(p, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC))
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree signature")
|
||||
p += 4;
|
||||
|
||||
/* node type and level */
|
||||
if (*p++ != (uint8_t)type->id)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree node type")
|
||||
bt->level = *p++;
|
||||
|
||||
/* entries used */
|
||||
UINT16DECODE(p, bt->nchildren);
|
||||
|
||||
/* sibling pointers */
|
||||
H5F_addr_decode(f, (const uint8_t **) &p, &(bt->left));
|
||||
H5F_addr_decode(f, (const uint8_t **) &p, &(bt->right));
|
||||
|
||||
/* the child/key pairs */
|
||||
native=bt->native;
|
||||
for (u = 0; u < bt->nchildren; u++) {
|
||||
/* Decode native key value */
|
||||
if ((type->decode) (f, bt, p, native) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key")
|
||||
p += shared->sizeof_rkey;
|
||||
native += type->sizeof_nkey;
|
||||
|
||||
/* Decode address value */
|
||||
H5F_addr_decode(f, (const uint8_t **) &p, bt->child + u);
|
||||
}
|
||||
|
||||
/* Decode final key */
|
||||
if(bt->nchildren>0) {
|
||||
/* Decode native key value */
|
||||
if ((type->decode) (f, bt, p, native) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key")
|
||||
} /* end if */
|
||||
|
||||
/* Set return value */
|
||||
ret_value = bt;
|
||||
|
||||
done:
|
||||
if (!ret_value && bt)
|
||||
(void)H5B_dest(f,bt);
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5B_load() */ /*lint !e818 Can't make udata a pointer to const */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_flush
|
||||
*
|
||||
* Purpose: Flushes a dirty B-tree node to disk.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* matzke@llnl.gov
|
||||
* Jun 23 1997
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt)
|
||||
{
|
||||
H5B_shared_t *shared; /* Pointer to shared B-tree info */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5B_flush, FAIL)
|
||||
|
||||
/* check arguments */
|
||||
HDassert(f);
|
||||
HDassert(H5F_addr_defined(addr));
|
||||
HDassert(bt);
|
||||
shared=H5RC_GET_OBJ(bt->rc_shared);
|
||||
HDassert(shared);
|
||||
HDassert(shared->type);
|
||||
HDassert(shared->type->encode);
|
||||
|
||||
if (bt->cache_info.is_dirty) {
|
||||
if (H5B_serialize(f, bt) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTSERIALIZE, FAIL, "unable to serialize B-tree")
|
||||
|
||||
/*
|
||||
* Write the disk page. We always write the header, but we don't
|
||||
* bother writing data for the child entries that don't exist or
|
||||
* for the final unchanged children.
|
||||
*/
|
||||
if (H5F_block_write(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to save B-tree node to disk")
|
||||
|
||||
bt->cache_info.is_dirty = FALSE;
|
||||
} /* end if */
|
||||
|
||||
if (destroy)
|
||||
if (H5B_dest(f,bt) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5B_flush() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_dest
|
||||
*
|
||||
* Purpose: Destroys a B-tree node in memory.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* Jan 15 2003
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
herr_t
|
||||
H5B_dest(H5F_t UNUSED *f, H5B_t *bt)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B_dest)
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
*/
|
||||
HDassert(bt);
|
||||
HDassert(bt->rc_shared);
|
||||
|
||||
H5FL_SEQ_FREE(haddr_t,bt->child);
|
||||
H5FL_BLK_FREE(native_block,bt->native);
|
||||
H5RC_DEC(bt->rc_shared);
|
||||
H5FL_FREE(H5B_t,bt);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5B_dest() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_clear
|
||||
*
|
||||
* Purpose: Mark a B-tree node in memory as non-dirty.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* koziol@ncsa.uiuc.edu
|
||||
* Mar 20 2003
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5B_clear(H5F_t *f, H5B_t *bt, hbool_t destroy)
|
||||
{
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5B_clear)
|
||||
|
||||
/*
|
||||
* Check arguments.
|
||||
*/
|
||||
HDassert(bt);
|
||||
|
||||
/* Reset the dirty flag. */
|
||||
bt->cache_info.is_dirty = FALSE;
|
||||
|
||||
if (destroy)
|
||||
if (H5B_dest(f, bt) < 0)
|
||||
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5B_clear() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5B_compute_size
|
||||
*
|
||||
* Purpose: Compute the size in bytes of the specified instance of
|
||||
* H5B_t on disk, and return it in *len_ptr. On failure,
|
||||
* the value of *len_ptr is undefined.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: John Mainzer
|
||||
* 5/13/04
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr)
|
||||
{
|
||||
H5B_shared_t *shared; /* Pointer to shared B-tree info */
|
||||
size_t size;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5B_compute_size)
|
||||
|
||||
/* check arguments */
|
||||
HDassert(f);
|
||||
HDassert(bt);
|
||||
HDassert(bt->rc_shared);
|
||||
shared=H5RC_GET_OBJ(bt->rc_shared);
|
||||
HDassert(shared);
|
||||
HDassert(shared->type);
|
||||
HDassert(size_ptr);
|
||||
|
||||
/* Check node's size */
|
||||
if ((size = H5B_nodesize(f, shared, NULL)) == 0)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, "H5B_nodesize() failed")
|
||||
|
||||
/* Set size value */
|
||||
*size_ptr = size;
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5B_compute_size() */
|
23
src/H5Bpkg.h
23
src/H5Bpkg.h
@ -31,7 +31,7 @@
|
||||
#include "H5Bprivate.h"
|
||||
|
||||
/* Other private headers needed by this file */
|
||||
#include "H5RCprivate.h" /* Reference counted object functions */
|
||||
#include "H5RCprivate.h" /* Reference counted objects */
|
||||
|
||||
/**************************/
|
||||
/* Package Private Macros */
|
||||
@ -41,9 +41,7 @@
|
||||
/* Package Private Typedefs */
|
||||
/****************************/
|
||||
|
||||
/*
|
||||
* The B-tree node as stored in memory...
|
||||
*/
|
||||
/* The B-tree node as stored in memory... */
|
||||
struct H5B_t {
|
||||
H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
|
||||
/* first field in structure */
|
||||
@ -56,8 +54,25 @@ struct H5B_t {
|
||||
haddr_t *child; /*2k child pointers */
|
||||
};
|
||||
|
||||
/*****************************/
|
||||
/* Package Private Variables */
|
||||
/*****************************/
|
||||
|
||||
/* H5B header inherits cache-like properties from H5AC */
|
||||
H5_DLLVAR const H5AC_class_t H5AC_BT[1];
|
||||
|
||||
/* Declare a free list to manage the haddr_t sequence information */
|
||||
H5FL_SEQ_EXTERN(haddr_t);
|
||||
|
||||
/* Declare a PQ free list to manage the native block information */
|
||||
H5FL_BLK_EXTERN(native_block);
|
||||
|
||||
/* Declare a free list to manage the H5B_t struct */
|
||||
H5FL_EXTERN(H5B_t);
|
||||
|
||||
/******************************/
|
||||
/* Package Private Prototypes */
|
||||
/******************************/
|
||||
herr_t H5B_dest(H5F_t *f, H5B_t *b);
|
||||
|
||||
#endif /*_H5Bpkg_H*/
|
||||
|
@ -34,8 +34,13 @@
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5ACprivate.h" /* Metadata cache */
|
||||
#include "H5Fprivate.h" /* File access */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
#include "H5RCprivate.h" /* Reference counted object functions */
|
||||
|
||||
/**************************/
|
||||
/* Library Private Macros */
|
||||
/**************************/
|
||||
|
||||
/*
|
||||
* Feature: Define this constant if you want to check B-tree consistency
|
||||
* after each B-tree operation. Note that this slows down the
|
||||
@ -48,6 +53,19 @@
|
||||
#define H5B_MAGIC "TREE" /*tree node magic number */
|
||||
#define H5B_SIZEOF_MAGIC 4 /*size of magic number */
|
||||
|
||||
/* Define return values from operator callback function for H5B_iterate */
|
||||
/* (Actually, any postive value will cause the iterator to stop and pass back
|
||||
* that positive value to the function that called the iterator)
|
||||
*/
|
||||
#define H5B_ITER_ERROR (-1)
|
||||
#define H5B_ITER_CONT (0)
|
||||
#define H5B_ITER_STOP (1)
|
||||
|
||||
/****************************/
|
||||
/* Library Private Typedefs */
|
||||
/****************************/
|
||||
|
||||
/* Define return values from B-tree insertion callbacks */
|
||||
typedef enum H5B_ins_t {
|
||||
H5B_INS_ERROR = -1, /*error return value */
|
||||
H5B_INS_NOOP = 0, /*insert made no changes */
|
||||
@ -58,14 +76,6 @@ typedef enum H5B_ins_t {
|
||||
H5B_INS_REMOVE = 5 /*remove current node */
|
||||
} H5B_ins_t;
|
||||
|
||||
/* Define return values from operator callback function for H5B_iterate */
|
||||
/* (Actually, any postive value will cause the iterator to stop and pass back
|
||||
* that positive value to the function that called the iterator)
|
||||
*/
|
||||
#define H5B_ITER_ERROR (-1)
|
||||
#define H5B_ITER_CONT (0)
|
||||
#define H5B_ITER_STOP (1)
|
||||
|
||||
/* Define the operator callback function pointer for H5B_iterate() */
|
||||
typedef int (*H5B_operator_t)(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
|
||||
const void *_rt_key, void *_udata);
|
||||
@ -97,7 +107,6 @@ typedef struct H5B_shared_t {
|
||||
typedef struct H5B_class_t {
|
||||
H5B_subid_t id; /*id as found in file*/
|
||||
size_t sizeof_nkey; /*size of native (memory) key*/
|
||||
size_t (*get_sizeof_rkey)(const H5F_t*, const void*); /*raw key size */
|
||||
H5RC_t * (*get_shared)(const H5F_t*, const void*); /*shared info for node */
|
||||
herr_t (*new_node)(H5F_t*, hid_t, H5B_ins_t, void*, void*, void*, haddr_t*);
|
||||
int (*cmp2)(H5F_t*, hid_t, void*, void*, void*); /*compare 2 keys */
|
||||
@ -120,12 +129,19 @@ typedef struct H5B_class_t {
|
||||
herr_t (*decode)(const H5F_t*, const struct H5B_t*, const uint8_t*, void*);
|
||||
herr_t (*encode)(const H5F_t*, const struct H5B_t*, uint8_t*, void*);
|
||||
herr_t (*debug_key)(FILE*, H5F_t*, hid_t, int, int, const void*, const void*);
|
||||
|
||||
} H5B_class_t;
|
||||
|
||||
/*
|
||||
* Library prototypes.
|
||||
*/
|
||||
/*****************************/
|
||||
/* Library-private Variables */
|
||||
/*****************************/
|
||||
|
||||
/* Declare a free list to manage the H5B_shared_t struct */
|
||||
H5FL_EXTERN(H5B_shared_t);
|
||||
|
||||
|
||||
/***************************************/
|
||||
/* Library-private Function Prototypes */
|
||||
/***************************************/
|
||||
H5_DLL size_t H5B_nodesize(const H5F_t *f, const H5B_shared_t *shared,
|
||||
size_t *total_nkey_size);
|
||||
H5_DLL herr_t H5B_create (H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata,
|
||||
|
@ -87,6 +87,10 @@ static herr_t H5D_xfer_xform_close(const char* name, size_t size, void* value);
|
||||
/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */
|
||||
H5D_dxpl_cache_t H5D_def_dxpl_cache;
|
||||
|
||||
/*****************************/
|
||||
/* Library Private Variables */
|
||||
/*****************************/
|
||||
|
||||
/*******************/
|
||||
/* Local Variables */
|
||||
/*******************/
|
||||
|
621
src/H5Distore.c
621
src/H5Distore.c
File diff suppressed because it is too large
Load Diff
@ -271,6 +271,8 @@ H5_DLL ssize_t H5D_istore_writevv(const H5D_io_info_t *io_info,
|
||||
const void *buf);
|
||||
H5_DLL haddr_t H5D_istore_get_addr(const H5D_io_info_t *io_info,
|
||||
struct H5D_istore_ud1_t *_udata);
|
||||
H5_DLL herr_t H5D_istore_copy(H5F_t *f_src, H5O_layout_t *layout_src,
|
||||
H5F_t *f_dst, H5O_layout_t *layout_dst, hid_t dxpl_id);
|
||||
|
||||
/* Functions that operate on external file list (efl) storage */
|
||||
H5_DLL ssize_t H5D_efl_readvv(const H5D_io_info_t *io_info,
|
||||
|
@ -88,29 +88,28 @@ extern "C" {
|
||||
typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim,
|
||||
const hsize_t *point, void *operator_data);
|
||||
|
||||
H5_DLL hid_t H5Dcreate (hid_t file_id, const char *name, hid_t type_id,
|
||||
H5_DLL hid_t H5Dcreate(hid_t file_id, const char *name, hid_t type_id,
|
||||
hid_t space_id, hid_t plist_id);
|
||||
H5_DLL hid_t H5Dopen (hid_t file_id, const char *name);
|
||||
H5_DLL herr_t H5Dclose (hid_t dset_id);
|
||||
H5_DLL hid_t H5Dget_space (hid_t dset_id);
|
||||
H5_DLL herr_t H5Dget_space_status(hid_t dset_id,
|
||||
H5D_space_status_t *allocation);
|
||||
H5_DLL hid_t H5Dget_type (hid_t dset_id);
|
||||
H5_DLL hid_t H5Dget_create_plist (hid_t dset_id);
|
||||
H5_DLL hid_t H5Dopen(hid_t file_id, const char *name);
|
||||
H5_DLL herr_t H5Dclose(hid_t dset_id);
|
||||
H5_DLL hid_t H5Dget_space(hid_t dset_id);
|
||||
H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation);
|
||||
H5_DLL hid_t H5Dget_type(hid_t dset_id);
|
||||
H5_DLL hid_t H5Dget_create_plist(hid_t dset_id);
|
||||
H5_DLL hsize_t H5Dget_storage_size(hid_t dset_id);
|
||||
H5_DLL haddr_t H5Dget_offset(hid_t dset_id);
|
||||
H5_DLL herr_t H5Dread (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
|
||||
H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
|
||||
hid_t file_space_id, hid_t plist_id, void *buf/*out*/);
|
||||
H5_DLL herr_t H5Dwrite (hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
|
||||
H5_DLL herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
|
||||
hid_t file_space_id, hid_t plist_id, const void *buf);
|
||||
H5_DLL herr_t H5Dextend (hid_t dset_id, const hsize_t *size);
|
||||
H5_DLL herr_t H5Dextend(hid_t dset_id, const hsize_t *size);
|
||||
H5_DLL herr_t H5Diterate(void *buf, hid_t type_id, hid_t space_id,
|
||||
H5D_operator_t op, void *operator_data);
|
||||
H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t plist_id, void *buf);
|
||||
H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *size);
|
||||
H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type, void *buf,
|
||||
hid_t buf_type, hid_t space);
|
||||
H5_DLL herr_t H5Dset_extent (hid_t dset_id, const hsize_t *size);
|
||||
H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t *size);
|
||||
H5_DLL herr_t H5Ddebug(hid_t dset_id);
|
||||
|
||||
|
||||
@ -118,4 +117,3 @@ H5_DLL herr_t H5Ddebug(hid_t dset_id);
|
||||
}
|
||||
#endif
|
||||
#endif /* _H5Dpublic_H */
|
||||
|
||||
|
110
src/H5G.c
110
src/H5G.c
@ -91,7 +91,6 @@
|
||||
/* Interface initialization */
|
||||
#define H5_INTERFACE_INIT_FUNC H5G_init_interface
|
||||
|
||||
|
||||
/* Packages needed by this file... */
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Aprivate.h" /* Attributes */
|
||||
@ -108,7 +107,6 @@
|
||||
/* Local macros */
|
||||
#define H5G_INIT_HEAP 8192
|
||||
#define H5G_RESERVED_ATOMS 0
|
||||
#define H5G_SIZE_HINT 256 /*default root grp size hint */
|
||||
|
||||
/*
|
||||
* During name lookups (see H5G_namei()) we sometimes want information about
|
||||
@ -149,6 +147,8 @@ typedef struct H5G_typeinfo_t {
|
||||
char *desc; /*description of object type */
|
||||
} H5G_typeinfo_t;
|
||||
|
||||
/* Package variables */
|
||||
|
||||
/* Local variables */
|
||||
static H5G_typeinfo_t *H5G_type_g = NULL; /*object typing info */
|
||||
static size_t H5G_ntypes_g = 0; /*entries in type table */
|
||||
@ -163,6 +163,9 @@ H5FL_DEFINE(H5G_shared_t);
|
||||
/* Declare extern the PQ free list for the wrapped strings */
|
||||
H5FL_BLK_EXTERN(str_buf);
|
||||
|
||||
/* Declare a free list to manage haddr_t's */
|
||||
H5FL_DEFINE(haddr_t);
|
||||
|
||||
/* Private prototypes */
|
||||
static herr_t H5G_register_type(H5G_obj_t type, htri_t(*isa)(H5G_entry_t*, hid_t),
|
||||
const char *desc);
|
||||
@ -200,6 +203,8 @@ static htri_t H5G_common_path(const H5RS_str_t *fullpath_r,
|
||||
const H5RS_str_t *prefix_r);
|
||||
static H5RS_str_t *H5G_build_fullpath(const H5RS_str_t *prefix_r, const H5RS_str_t *name_r);
|
||||
static int H5G_replace_ent(void *obj_ptr, hid_t obj_id, void *key);
|
||||
static herr_t H5G_copy(H5G_entry_t *ent_src, H5G_entry_t *loc_dst,
|
||||
const char *name_dst, hid_t plist_id);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -1036,6 +1041,50 @@ done:
|
||||
FUNC_LEAVE_API(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Gcopy
|
||||
*
|
||||
* Purpose: Copy an object to destination location
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* June 4, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5Gcopy(hid_t id_src, hid_t loc_dst, const char *name_dst, hid_t plist_id)
|
||||
{
|
||||
H5G_entry_t *ent_src = NULL, *ent_dst=NULL;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_API(H5Gcopy, FAIL)
|
||||
|
||||
/* Check arguments */
|
||||
if(NULL == (ent_src = H5G_loc(id_src)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
|
||||
if(NULL == (ent_dst = H5G_loc(loc_dst)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
|
||||
if(!name_dst || !*name_dst)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
|
||||
|
||||
/* Get correct property list */
|
||||
/* XXX: This is a kludge, to use the datatype creation property list - QAK */
|
||||
if(H5P_DEFAULT == plist_id)
|
||||
plist_id = H5P_DATATYPE_CREATE_DEFAULT;
|
||||
else
|
||||
if(TRUE != H5P_isa_class(plist_id, H5P_DATATYPE_CREATE))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object create property list")
|
||||
|
||||
if(H5G_copy(ent_src, ent_dst, name_dst, plist_id) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Gcopy() */
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
*-------------------------------------------------------------------------
|
||||
@ -4214,3 +4263,60 @@ H5G_unmount(H5G_t *grp)
|
||||
FUNC_LEAVE_NOAPI(SUCCEED);
|
||||
} /* end H5G_unmount() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_copy
|
||||
*
|
||||
* Purpose: Copy an object to destination location
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* June 4, 2005
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5G_copy(H5G_entry_t *ent_src, H5G_entry_t *loc_dst,
|
||||
const char *name_dst, hid_t plist_id)
|
||||
{
|
||||
H5P_genplist_t *oc_plist; /* Property list created */
|
||||
hid_t dxpl_id = H5AC_dxpl_id;
|
||||
H5G_entry_t ent_new;
|
||||
hbool_t entry_inserted = FALSE; /* Flag to indicate that the new entry was inserted into a group */
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5G_copy, FAIL);
|
||||
|
||||
HDassert(ent_src);
|
||||
HDassert(ent_src->file);
|
||||
HDassert(loc_dst);
|
||||
HDassert(loc_dst->file);
|
||||
HDassert(name_dst);
|
||||
|
||||
/* Get the property list */
|
||||
if(NULL == (oc_plist = H5I_object(plist_id)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
|
||||
|
||||
/* Reset group entry for new object */
|
||||
H5G_ent_reset(&ent_new);
|
||||
ent_new.file = loc_dst->file;
|
||||
|
||||
/* copy the object from the source file to the destination file */
|
||||
if(H5O_copy_header(ent_src, &ent_new, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
|
||||
|
||||
/* Insert the new object in the destination file's group */
|
||||
if(H5G_insert(loc_dst, name_dst, &ent_new, dxpl_id, oc_plist) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert the name")
|
||||
entry_inserted = TRUE;
|
||||
|
||||
done:
|
||||
/* Free the ID to name buffers */
|
||||
if(entry_inserted)
|
||||
H5G_free_ent_name(&ent_new);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5G_copy() */
|
||||
|
136
src/H5Gnode.c
136
src/H5Gnode.c
@ -68,7 +68,6 @@ static herr_t H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy);
|
||||
static herr_t H5G_compute_size(const H5F_t *f, const H5G_node_t *sym, size_t *size_ptr);
|
||||
|
||||
/* B-tree callbacks */
|
||||
static size_t H5G_node_sizeof_rkey(const H5F_t *f, const void *_udata);
|
||||
static H5RC_t *H5G_node_get_shared(const H5F_t *f, const void *_udata);
|
||||
static herr_t H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, void *_lt_key,
|
||||
void *_udata, void *_rt_key,
|
||||
@ -109,7 +108,6 @@ const H5AC_class_t H5AC_SNODE[1] = {{
|
||||
H5B_class_t H5B_SNODE[1] = {{
|
||||
H5B_SNODE_ID, /*id */
|
||||
sizeof(H5G_node_key_t), /*sizeof_nkey */
|
||||
H5G_node_sizeof_rkey, /*get_sizeof_rkey */
|
||||
H5G_node_get_shared, /*get_shared */
|
||||
H5G_node_create, /*new */
|
||||
H5G_node_cmp2, /*cmp2 */
|
||||
@ -124,9 +122,6 @@ H5B_class_t H5B_SNODE[1] = {{
|
||||
H5G_node_debug_key, /*debug */
|
||||
}};
|
||||
|
||||
/* Declare a free list to manage the H5B_shared_t struct */
|
||||
H5FL_EXTERN(H5B_shared_t);
|
||||
|
||||
/* Declare a free list to manage the H5G_node_t struct */
|
||||
H5FL_DEFINE_STATIC(H5G_node_t);
|
||||
|
||||
@ -142,33 +137,8 @@ H5FL_SEQ_DEFINE_STATIC(size_t);
|
||||
/* Declare a free list to manage the raw page information */
|
||||
H5FL_BLK_DEFINE_STATIC(grp_page);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_node_sizeof_rkey
|
||||
*
|
||||
* Purpose: Returns the size of a raw B-link tree key for the specified
|
||||
* file.
|
||||
*
|
||||
* Return: Success: Size of the key.
|
||||
*
|
||||
* Failure: never fails
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* matzke@llnl.gov
|
||||
* Jul 14 1997
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static size_t
|
||||
H5G_node_sizeof_rkey(const H5F_t *f, const void UNUSED * udata)
|
||||
{
|
||||
/* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_sizeof_rkey);
|
||||
|
||||
FUNC_LEAVE_NOAPI(H5F_SIZEOF_SIZE(f)); /*the name offset */
|
||||
}
|
||||
/* Declare extern the free list to manage haddr_t's */
|
||||
H5FL_EXTERN(haddr_t);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@ -1803,7 +1773,7 @@ H5G_node_init(H5F_t *f)
|
||||
/* Set up the "global" information for this file's groups */
|
||||
shared->type= H5B_SNODE;
|
||||
shared->two_k=2*H5F_KVALUE(f,H5B_SNODE);
|
||||
shared->sizeof_rkey = H5G_node_sizeof_rkey(f, NULL);
|
||||
shared->sizeof_rkey = H5F_SIZEOF_SIZE(f); /*the name offset */
|
||||
assert(shared->sizeof_rkey);
|
||||
shared->sizeof_rnode = H5B_nodesize(f, shared, &shared->sizeof_keys);
|
||||
assert(shared->sizeof_rnode);
|
||||
@ -1892,6 +1862,106 @@ H5G_node_shared_free (void *_shared)
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5G_node_shared_free() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_node_copy
|
||||
*
|
||||
* Purpose: This function gets called during a group iterate operation
|
||||
* to copy objects of this node into a new location.
|
||||
*
|
||||
* Return: 0(zero) on success/Negative on failure
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* Sept 10, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
int
|
||||
H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
|
||||
const void UNUSED *_rt_key, void *_udata)
|
||||
{
|
||||
H5G_bt_it_ud5_t *udata = (H5G_bt_it_ud5_t *)_udata;
|
||||
const H5HL_t *heap = NULL;
|
||||
H5G_node_t *sn = NULL;
|
||||
unsigned int i; /* Local index variable */
|
||||
int ret_value = H5B_ITER_CONT;
|
||||
|
||||
FUNC_ENTER_NOAPI(H5G_node_copy, H5B_ITER_ERROR)
|
||||
|
||||
/* Check arguments. */
|
||||
HDassert(f);
|
||||
HDassert(H5F_addr_defined(addr));
|
||||
HDassert(udata);
|
||||
|
||||
/* load the symbol table into memory from the source file */
|
||||
if(NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node")
|
||||
|
||||
/* get the base address of the heap */
|
||||
if(NULL == (heap = H5HL_protect(f, dxpl_id, udata->heap_addr)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_ITER_ERROR, "unable to protect symbol name")
|
||||
|
||||
/* copy object in this node one by one */
|
||||
for(i = 0; i < sn->nsyms; i++) {
|
||||
H5G_entry_t ent_new; /* New entry to insert into dest. group */
|
||||
H5G_entry_t *ent_src = &(sn->entry[i]); /* Convenience variable to refer to current source group entry */
|
||||
const char *name; /* Name of source object */
|
||||
|
||||
/* Set up symbol table entry for destination */
|
||||
H5G_ent_reset(&ent_new);
|
||||
ent_new.file = udata->loc_dst->file;
|
||||
|
||||
/* Determine name of source object */
|
||||
name = H5HL_offset_into(f, heap, ent_src->name_off);
|
||||
HDassert(name);
|
||||
|
||||
/* Check if object in source group is a hard link */
|
||||
if(H5F_addr_defined(ent_src->header)) {
|
||||
/* Copy the shared object from source to destination */
|
||||
/* (Increments link count on destination) */
|
||||
if(H5O_copy_header_map(ent_src, &ent_new, dxpl_id, udata->map_list) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5B_ITER_ERROR, "unable to copy object")
|
||||
} /* ( H5F_addr_defined(ent_src->header)) */
|
||||
else if(H5G_CACHED_SLINK == ent_src->type) {
|
||||
/* it is a soft link */
|
||||
H5O_stab_t stab_mesg;
|
||||
size_t offset_link;
|
||||
char *name_link = H5HL_offset_into(f, heap, ent_src->cache.slink.lval_offset);
|
||||
|
||||
/* read the symbol table where the soft link to be inserted */
|
||||
if(NULL == H5O_read(udata->loc_dst, H5O_STAB_ID, 0, &stab_mesg, dxpl_id))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_ITER_ERROR, "unable to determine local heap address")
|
||||
if((size_t)(-1) == (offset_link = H5HL_insert(udata->loc_dst->file, dxpl_id,
|
||||
stab_mesg.heap_addr, HDstrlen(name_link) + 1, name_link)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_ITER_ERROR, "unable to write link value to local heap")
|
||||
H5O_reset (H5O_STAB_ID, &stab_mesg);
|
||||
|
||||
/* Set up soft link to insert */
|
||||
ent_new.type = H5G_CACHED_SLINK;
|
||||
ent_new.cache.slink.lval_offset = offset_link;
|
||||
} /* else if */
|
||||
else
|
||||
HDassert(0 && "Unknown entry type");
|
||||
|
||||
/* Insert the new object in the destination file's group */
|
||||
/* (Don't increment the link count - that's already done above for hard links) */
|
||||
if(H5G_stab_insert(udata->loc_dst, name, &ent_new, FALSE, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5B_ITER_ERROR, "unable to insert the name")
|
||||
|
||||
/* Free the ID to name buffers */
|
||||
H5G_free_ent_name(&ent_new);
|
||||
} /* end of for (i=0; i<sn->nsyms; i++) */
|
||||
|
||||
done:
|
||||
if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name")
|
||||
|
||||
if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
|
||||
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header")
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5G_node_copy() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_node_debug
|
||||
|
18
src/H5Gpkg.h
18
src/H5Gpkg.h
@ -31,8 +31,11 @@
|
||||
#include "H5Gprivate.h"
|
||||
|
||||
/* Other private headers needed by this file */
|
||||
#include "H5ACprivate.h" /* Metadata cache */
|
||||
#include "H5ACprivate.h" /* Metadata cache */
|
||||
#include "H5Oprivate.h" /* Object headers */
|
||||
#include "H5SLprivate.h" /* Skip lists */
|
||||
|
||||
#define H5G_SIZE_HINT 256 /* default root grp size hint */
|
||||
|
||||
/*
|
||||
* A symbol table node is a collection of symbol table entries. It can
|
||||
@ -166,6 +169,13 @@ typedef struct H5G_bt_it_ud4_t {
|
||||
/* upward */
|
||||
} H5G_bt_it_ud4_t;
|
||||
|
||||
/* Data passed to B-tree iteration for copying copy symblol table content */
|
||||
typedef struct H5G_bt_it_ud5_t {
|
||||
H5SL_t *map_list; /* skip list to map copied object addresses */
|
||||
haddr_t heap_addr; /* heap address of the source symbol table */
|
||||
H5G_entry_t *loc_dst; /* group where new object is inserted to */
|
||||
} H5G_bt_it_ud5_t;
|
||||
|
||||
/*
|
||||
* This is the class identifier to give to the B-tree functions.
|
||||
*/
|
||||
@ -187,6 +197,9 @@ H5_DLL herr_t H5G_stab_insert(H5G_entry_t *grp_ent, const char *name,
|
||||
H5G_entry_t *obj_ent, hbool_t inc_link, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, hbool_t adj_link);
|
||||
H5_DLL herr_t H5G_stab_remove(H5G_entry_t *grp_ent, const char *name, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5G_stab_copy_tmp(H5F_t *f_dst, H5O_stab_t *stab_dst,
|
||||
hid_t dxpl_id);
|
||||
|
||||
|
||||
/*
|
||||
* Functions that understand symbol table entries.
|
||||
@ -206,4 +219,7 @@ H5_DLL int H5G_node_name(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t a
|
||||
const void *_rt_key, void *_udata);
|
||||
H5_DLL int H5G_node_type(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
|
||||
const void *_rt_key, void *_udata);
|
||||
H5_DLL int H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr,
|
||||
const void *_rt_key, void *_udata);
|
||||
|
||||
#endif
|
||||
|
@ -14,15 +14,13 @@
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* Created: H5Gproto.h
|
||||
* Created: H5Gpublic.h
|
||||
* Jul 11 1997
|
||||
* Robb Matzke <matzke@llnl.gov>
|
||||
*
|
||||
* Purpose: Public declarations for the H5G package (symbol
|
||||
* tables).
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef _H5Gpublic_H
|
||||
@ -123,6 +121,8 @@ H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize,
|
||||
char *buf);
|
||||
H5_DLL hid_t H5Gcreate_expand(hid_t loc_id, const char *name, hid_t gcpl_id,
|
||||
hid_t gapl_id);
|
||||
H5_DLL herr_t H5Gcopy(hid_t id_src, hid_t loc_dst, const char *name_dst,
|
||||
hid_t plist_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -315,3 +315,50 @@ H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab, hbool_t adj_lin
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value);
|
||||
} /* end H5G_stab_delete() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5G_stab_copy_tmp
|
||||
*
|
||||
* Purpose: copy a group symbol table and memeber objects from SRC file to DST file.
|
||||
*
|
||||
* Return: Non-negative on success
|
||||
* Negative on failure.
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* September 10, 2005
|
||||
*
|
||||
* Note: This routine should be replaced with proper call to "real"
|
||||
* stab creation routine after the "big group revision" checkin
|
||||
* occurs. -QAK
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5G_stab_copy_tmp(H5F_t *f_dst, H5O_stab_t *stab_dst, hid_t dxpl_id)
|
||||
{
|
||||
size_t size_init, name_offset;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5G_stab_copy_tmp, FAIL)
|
||||
|
||||
HDassert(f_dst);
|
||||
HDassert(stab_dst);
|
||||
|
||||
/* create B-tree private heap */
|
||||
size_init = MAX(H5G_SIZE_HINT, H5HL_SIZEOF_FREE(f_dst) + 2);
|
||||
if (H5HL_create(f_dst, dxpl_id, size_init, &(stab_dst->heap_addr))<0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap")
|
||||
|
||||
name_offset = H5HL_insert(f_dst, dxpl_id, stab_dst->heap_addr, 1, "");
|
||||
if ((size_t)(-1)==name_offset)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't initialize heap")
|
||||
assert(0 == name_offset);
|
||||
|
||||
/* create the B-tree */
|
||||
if (H5B_create(f_dst, dxpl_id, H5B_SNODE, NULL, &(stab_dst->btree_addr)) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5G_stab_copy_tmp() */
|
||||
|
531
src/H5O.c
531
src/H5O.c
@ -64,6 +64,12 @@ typedef struct {
|
||||
typedef herr_t (*H5O_operator_int_t)(H5O_mesg_t *mesg/*in,out*/, unsigned idx,
|
||||
unsigned * oh_flags_ptr, void *operator_data/*in,out*/);
|
||||
|
||||
/* Node in skip list to map addresses from one file to another during object header copy */
|
||||
typedef struct H5O_addr_map_t {
|
||||
haddr_t src_addr; /* Address of object in source file */
|
||||
haddr_t dst_addr; /* Address of object in destination file */
|
||||
} H5O_addr_map_t;
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static herr_t H5O_init(H5F_t *f, hid_t dxpl_id, size_t size_hint,
|
||||
H5G_entry_t *ent/*out*/, haddr_t header);
|
||||
@ -107,6 +113,14 @@ static herr_t H5O_write_mesg(H5O_t *oh, unsigned idx, const H5O_class_t *type,
|
||||
unsigned * oh_flags_ptr);
|
||||
static herr_t H5O_iterate_real(const H5G_entry_t *ent, const H5O_class_t *type,
|
||||
H5AC_protect_t prot, hbool_t internal, void *op, void *op_data, hid_t dxpl_id);
|
||||
static void * H5O_copy_mesg_file(const H5O_class_t *type, H5F_t *file_src,
|
||||
void *mesg_src, H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void *udata);
|
||||
static herr_t H5O_post_copy_mesg_file(const H5O_class_t *type, H5F_t *file_src,
|
||||
const void *mesg_src, H5G_entry_t *loc_dst,
|
||||
hid_t dxpl_id, H5SL_t *map_list);
|
||||
static herr_t H5O_copy_header_real(const H5G_entry_t *ent_src,
|
||||
H5G_entry_t *ent_dst /*out */, hid_t dxpl_id, H5SL_t *map_list);
|
||||
static herr_t H5O_copy_free_addrmap_cb(void *item, void *key, void *op_data);
|
||||
|
||||
/* Metadata cache callbacks */
|
||||
static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1,
|
||||
@ -153,6 +167,8 @@ static const H5O_class_t *const message_type_g[] = {
|
||||
H5O_MTIME_NEW, /*0x0012 New Object modification date and time */
|
||||
};
|
||||
|
||||
/* Library private variables */
|
||||
|
||||
/*
|
||||
* An array of functions indexed by symbol table entry cache type
|
||||
* (H5G_type_t) that are called to retrieve constant messages cached in the
|
||||
@ -180,6 +196,9 @@ H5FL_EXTERN(time_t);
|
||||
/* Declare extern the free list for H5O_cont_t's */
|
||||
H5FL_EXTERN(H5O_cont_t);
|
||||
|
||||
/* Declare a free list to manage the H5O_addr_map_t struct */
|
||||
H5FL_DEFINE_STATIC(H5O_addr_map_t);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_init_interface
|
||||
@ -584,12 +603,8 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
|
||||
p += 3; /*reserved*/
|
||||
|
||||
/* Try to detect invalidly formatted object header messages */
|
||||
if (p + mesg_size > oh->chunk[chunkno].image + chunk_size) {
|
||||
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, \
|
||||
"corrupt object header");
|
||||
}
|
||||
|
||||
if (p + mesg_size > oh->chunk[chunkno].image + chunk_size)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "corrupt object header");
|
||||
|
||||
/* Skip header messages we don't know about */
|
||||
/* (Usually from future versions of the library */
|
||||
@ -680,7 +695,6 @@ H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh)
|
||||
int id;
|
||||
unsigned u;
|
||||
H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */
|
||||
H5O_cont_t *cont = NULL;
|
||||
herr_t (*encode)(H5F_t*, uint8_t*, const void*) = NULL;
|
||||
unsigned combine=0; /* Whether to combine the object header prefix & the first chunk */
|
||||
herr_t ret_value=SUCCEED; /* Return value */
|
||||
@ -2259,8 +2273,7 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags, const H5O_class_t *orig_type,
|
||||
HGOTO_ERROR (H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large (16k max)");
|
||||
|
||||
/* Allocate space in the object headed for the message */
|
||||
if ((ret_value = H5O_alloc(f, dxpl_id, oh,
|
||||
orig_type, size, oh_flags_ptr)) == UFAIL)
|
||||
if ((ret_value = H5O_alloc(f, dxpl_id, oh, orig_type, size, oh_flags_ptr)) == UFAIL)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "unable to allocate space for message");
|
||||
|
||||
/* Increment any links in message */
|
||||
@ -3045,8 +3058,8 @@ H5O_alloc_new_chunk(H5F_t *f,
|
||||
H5O_cont_t *cont = NULL; /*native continuation message */
|
||||
int chunkno;
|
||||
unsigned u;
|
||||
unsigned ret_value; /*return value */
|
||||
haddr_t new_chunk_addr;
|
||||
unsigned ret_value; /*return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_alloc_new_chunk);
|
||||
|
||||
@ -3088,10 +3101,8 @@ H5O_alloc_new_chunk(H5F_t *f,
|
||||
* message, then make sure the new chunk has enough room for that
|
||||
* other message.
|
||||
*/
|
||||
if ( found_null < 0 ) {
|
||||
|
||||
if (found_null < 0)
|
||||
size += H5O_SIZEOF_MSGHDR(f) + oh->mesg[found_other].raw_size;
|
||||
}
|
||||
|
||||
/*
|
||||
* The total chunk size must include the requested space plus enough
|
||||
@ -3103,11 +3114,8 @@ H5O_alloc_new_chunk(H5F_t *f,
|
||||
|
||||
/* allocate space in file to hold the new chunk */
|
||||
new_chunk_addr = H5MF_alloc(f, H5FD_MEM_OHDR, dxpl_id, (hsize_t)size);
|
||||
if ( HADDR_UNDEF == new_chunk_addr ) {
|
||||
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, \
|
||||
"unable to allocate space for new chunk");
|
||||
}
|
||||
if(HADDR_UNDEF == new_chunk_addr)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "unable to allocate space for new chunk")
|
||||
|
||||
/*
|
||||
* Create the new chunk giving it a file address.
|
||||
@ -3117,11 +3125,8 @@ H5O_alloc_new_chunk(H5F_t *f,
|
||||
unsigned na = oh->alloc_nchunks + H5O_NCHUNKS;
|
||||
H5O_chunk_t *x = H5FL_SEQ_REALLOC (H5O_chunk_t, oh->chunk, (size_t)na);
|
||||
|
||||
if ( !x ) {
|
||||
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, \
|
||||
"memory allocation failed");
|
||||
}
|
||||
if (!x)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed");
|
||||
oh->alloc_nchunks = na;
|
||||
oh->chunk = x;
|
||||
}
|
||||
@ -3142,11 +3147,8 @@ H5O_alloc_new_chunk(H5F_t *f,
|
||||
unsigned na = oh->alloc_nmesgs + MAX (H5O_NMESGS, 3);
|
||||
H5O_mesg_t *x = H5FL_SEQ_REALLOC (H5O_mesg_t, oh->mesg, (size_t)na);
|
||||
|
||||
if ( !x ) {
|
||||
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, \
|
||||
"memory allocation failed");
|
||||
}
|
||||
if (!x)
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed");
|
||||
oh->alloc_nmesgs = na;
|
||||
oh->mesg = x;
|
||||
|
||||
@ -3211,11 +3213,8 @@ H5O_alloc_new_chunk(H5F_t *f,
|
||||
*/
|
||||
oh->mesg[found_null].type = H5O_CONT;
|
||||
oh->mesg[found_null].dirty = TRUE;
|
||||
if (NULL==(cont = H5FL_MALLOC(H5O_cont_t))) {
|
||||
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, \
|
||||
"memory allocation failed");
|
||||
}
|
||||
if (NULL==(cont = H5FL_MALLOC(H5O_cont_t)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed")
|
||||
cont->addr = oh->chunk[chunkno].addr;
|
||||
cont->size = oh->chunk[chunkno].size;
|
||||
cont->chunkno = chunkno;
|
||||
@ -3226,7 +3225,6 @@ H5O_alloc_new_chunk(H5F_t *f,
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value);
|
||||
|
||||
} /* H5O_alloc_new_chunk() */
|
||||
|
||||
|
||||
@ -3270,7 +3268,7 @@ H5O_alloc(H5F_t *f,
|
||||
size_t size,
|
||||
unsigned * oh_flags_ptr)
|
||||
{
|
||||
unsigned idx = UFAIL;
|
||||
unsigned idx;
|
||||
H5O_mesg_t *msg; /* Pointer to newly allocated message */
|
||||
size_t aligned_size = H5O_ALIGN(size);
|
||||
htri_t tri_result;
|
||||
@ -3310,8 +3308,7 @@ H5O_alloc(H5F_t *f,
|
||||
* Note that in this new version of this function, all chunks
|
||||
* must have file space allocated to them.
|
||||
*/
|
||||
for ( chunkno = 0; chunkno < oh->nchunks; chunkno++ )
|
||||
{
|
||||
for (chunkno = 0; chunkno < oh->nchunks; chunkno++) {
|
||||
HDassert( H5F_addr_defined(oh->chunk[chunkno].addr) );
|
||||
|
||||
tri_result = H5O_alloc_extend_chunk(f, oh, chunkno, size, &idx);
|
||||
@ -3334,13 +3331,9 @@ H5O_alloc(H5F_t *f,
|
||||
/* if idx is still UFAIL, we were not able to extend a chunk.
|
||||
* Create a new one.
|
||||
*/
|
||||
if (idx == UFAIL) {
|
||||
|
||||
if ( (idx = H5O_alloc_new_chunk(f, dxpl_id, oh, size)) == UFAIL ) {
|
||||
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, UFAIL, \
|
||||
"unable to create a new object header data chunk");
|
||||
}
|
||||
if(idx == UFAIL) {
|
||||
if((idx = H5O_alloc_new_chunk(f, dxpl_id, oh, size)) == UFAIL)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, UFAIL, "unable to create a new object header data chunk")
|
||||
}
|
||||
}
|
||||
|
||||
@ -3349,35 +3342,26 @@ H5O_alloc(H5F_t *f,
|
||||
|
||||
/* do we need to split the null message? */
|
||||
if (msg->raw_size > aligned_size) {
|
||||
|
||||
H5O_mesg_t *null_msg; /* Pointer to null message */
|
||||
size_t mesg_size = aligned_size+ H5O_SIZEOF_MSGHDR(f); /* Total size of newly allocated message */
|
||||
|
||||
size_t mesg_size = aligned_size + H5O_SIZEOF_MSGHDR(f);
|
||||
/* Total size of newly allocated message */
|
||||
|
||||
HDassert( msg->raw_size - aligned_size >= H5O_SIZEOF_MSGHDR(f) );
|
||||
HDassert(msg->raw_size - aligned_size >= H5O_SIZEOF_MSGHDR(f));
|
||||
|
||||
if (oh->nmesgs >= oh->alloc_nmesgs) {
|
||||
|
||||
int old_alloc=oh->alloc_nmesgs;
|
||||
unsigned na = oh->alloc_nmesgs + H5O_NMESGS;
|
||||
H5O_mesg_t *x = H5FL_SEQ_REALLOC(H5O_mesg_t, oh->mesg, (size_t)na);
|
||||
|
||||
if (!x) {
|
||||
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, \
|
||||
"memory allocation failed");
|
||||
}
|
||||
oh->alloc_nmesgs = na;
|
||||
oh->mesg = x;
|
||||
if (!x)
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed");
|
||||
oh->alloc_nmesgs = na;
|
||||
oh->mesg = x;
|
||||
|
||||
/* Set new object header info to zeros */
|
||||
HDmemset(&oh->mesg[old_alloc],0,
|
||||
(oh->alloc_nmesgs-old_alloc)*sizeof(H5O_mesg_t));
|
||||
|
||||
/* "Retarget" local 'msg' pointer into newly allocated array
|
||||
* of messages
|
||||
*/
|
||||
/* "Retarget" local 'msg' pointer into newly allocated array of messages */
|
||||
msg=&oh->mesg[idx];
|
||||
}
|
||||
null_msg = &(oh->mesg[oh->nmesgs++]);
|
||||
@ -3402,7 +3386,6 @@ H5O_alloc(H5F_t *f,
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value);
|
||||
|
||||
} /* H5O_alloc() */
|
||||
|
||||
#ifdef NOT_YET
|
||||
@ -4076,6 +4059,432 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_iterate_real() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_copy_mesg_file
|
||||
*
|
||||
* Purpose: Copies a message to file. If MESG is is the null pointer then a null
|
||||
* pointer is returned with no error.
|
||||
*
|
||||
* Return: Success: Ptr to the new message
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* June 4, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
H5O_copy_mesg_file(const H5O_class_t *type, H5F_t *file_src,
|
||||
void *native_src, H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void *udata)
|
||||
{
|
||||
void *ret_value;
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_copy_mesg_file)
|
||||
|
||||
/* check args */
|
||||
HDassert(type);
|
||||
HDassert(type->copy_file);
|
||||
HDassert(file_src);
|
||||
HDassert(native_src);
|
||||
HDassert(file_dst);
|
||||
HDassert(map_list);
|
||||
|
||||
if(NULL == (ret_value = (type->copy_file)(file_src, native_src, file_dst, dxpl_id, map_list, udata)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy object header message to file")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_copy_mesg_file() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_post_copy_mesg_file
|
||||
*
|
||||
* Purpose: Copies what's left to file after the object a meesage is copied.
|
||||
* This function is need for situations like copying symbol tables.
|
||||
* Copying a member of symbol table requires the parent object header
|
||||
* exists in file. For this case, the first round of the message will
|
||||
* create symbol table enttries but will not go deep copying member
|
||||
* objects in the symbol table. The post copy will do that.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* September 28, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_post_copy_mesg_file (const H5O_class_t *type, H5F_t *file_src,
|
||||
const void *mesg_src, H5G_entry_t *loc_dst,
|
||||
hid_t dxpl_id, H5SL_t *map_list)
|
||||
{
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_post_copy_mesg_file)
|
||||
|
||||
/* check args */
|
||||
HDassert(type);
|
||||
HDassert(file_src);
|
||||
HDassert(mesg_src);
|
||||
HDassert(loc_dst->file);
|
||||
HDassert(map_list);
|
||||
|
||||
if(type->post_copy_file && (type->post_copy_file)(file_src, mesg_src, loc_dst, dxpl_id, map_list) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy object header message to file")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5O_post_copy_mesg_file */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_copy_header_real
|
||||
*
|
||||
* Purpose: copy header object from one location to another.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* May 30, 2005
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_copy_header_real(const H5G_entry_t *ent_src,
|
||||
H5G_entry_t *ent_dst /*out */, hid_t dxpl_id, H5SL_t *map_list)
|
||||
{
|
||||
H5O_addr_map_t *addr_map; /* Address mapping of object copied */
|
||||
uint8_t buf[16], *p;
|
||||
H5O_t *oh = NULL;
|
||||
unsigned chunkno = 0, mesgno = 0;
|
||||
size_t chunk_size, hdr_size;
|
||||
haddr_t addr_new;
|
||||
H5O_mesg_t *mesg_src;
|
||||
H5O_chunk_t *chunk;
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_copy_header_real)
|
||||
|
||||
HDassert(ent_src);
|
||||
HDassert(ent_src->file);
|
||||
HDassert(H5F_addr_defined(ent_src->header));
|
||||
HDassert(ent_dst->file);
|
||||
HDassert(map_list);
|
||||
|
||||
if(NULL == (oh = H5AC_protect(ent_src->file, dxpl_id, H5AC_OHDR, ent_src->header, NULL, NULL, H5AC_READ)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
|
||||
|
||||
/* get the size of the file header of the destination file */
|
||||
hdr_size = H5O_SIZEOF_HDR(ent_dst->file);
|
||||
|
||||
/* allocate memory space for the destitnation chunks */
|
||||
if(NULL == (chunk = H5FL_SEQ_MALLOC(H5O_chunk_t, (size_t)oh->nchunks)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
|
||||
|
||||
/* Allocate space for the first chunk */
|
||||
if(HADDR_UNDEF == (addr_new = H5MF_alloc(ent_dst->file, H5FD_MEM_OHDR, dxpl_id, (hsize_t)hdr_size + oh->chunk[0].size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header")
|
||||
|
||||
/* Return the first chunk address */
|
||||
ent_dst->header = addr_new;
|
||||
|
||||
/* Set chunk's address */
|
||||
chunk[0].addr = addr_new + (hsize_t)hdr_size;
|
||||
|
||||
/* Encode header information */
|
||||
p = buf;
|
||||
|
||||
/* encode version */
|
||||
*p++ = H5O_VERSION;
|
||||
|
||||
/* reserved */
|
||||
*p++ = 0;
|
||||
|
||||
/* encode number of messages */
|
||||
UINT16ENCODE(p, oh->nmesgs);
|
||||
|
||||
/* encode link count (at zero initially) */
|
||||
UINT32ENCODE(p, 0);
|
||||
|
||||
/* encode body size */
|
||||
UINT32ENCODE(p, oh->chunk[0].size);
|
||||
|
||||
/* zero to alignment */
|
||||
HDmemset(p, 0, (size_t)(hdr_size-12));
|
||||
|
||||
/* need to allocate all the chunks for the destination before copy the chunk message
|
||||
because continuation chunk message will need to know the chunk address of address of
|
||||
continuation block.
|
||||
*/
|
||||
for(chunkno = 1; chunkno < oh->nchunks; chunkno++) {
|
||||
if(HADDR_UNDEF == (chunk[chunkno].addr = H5MF_alloc(ent_dst->file, H5FD_MEM_OHDR, dxpl_id, (hsize_t)oh->chunk[chunkno].size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header")
|
||||
} /* end for */
|
||||
|
||||
/* Loop through chunks to copy chunk information */
|
||||
for(chunkno = 0; chunkno < oh->nchunks; chunkno++) {
|
||||
chunk_size = oh->chunk[chunkno].size;
|
||||
|
||||
/* copy chunk information */
|
||||
chunk[chunkno].dirty = oh->chunk[chunkno].dirty;
|
||||
chunk[chunkno].size = chunk_size;
|
||||
|
||||
/* create memory image for the new chunk */
|
||||
if(NULL == (chunk[chunkno].image = H5FL_BLK_MALLOC(chunk_image,chunk_size)))
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
|
||||
|
||||
/* copy the chunk image from source to destination in memory */
|
||||
/* (This copies over all the messages which don't require special
|
||||
* callbacks to fix them up.)
|
||||
*/
|
||||
HDmemcpy(chunk[chunkno].image, oh->chunk[chunkno].image, chunk_size);
|
||||
|
||||
/* Loop through messages, to fix up any which refer to addresses in the source file, etc. */
|
||||
for(mesgno = 0; mesgno < oh->nmesgs; mesgno++) {
|
||||
const H5O_class_t *copy_type;
|
||||
|
||||
mesg_src = &(oh->mesg[mesgno]);
|
||||
|
||||
/* check if the message belongs to this chunk */
|
||||
if(mesg_src->chunkno != chunkno)
|
||||
continue;
|
||||
|
||||
if (mesg_src->flags & H5O_FLAG_SHARED)
|
||||
copy_type = H5O_SHARED;
|
||||
else
|
||||
copy_type = mesg_src->type;
|
||||
|
||||
/* copy this message into destination file */
|
||||
HDassert(copy_type);
|
||||
if(copy_type->copy_file) {
|
||||
void *dst_native; /* Pointer to copy of native information for current message */
|
||||
|
||||
/*
|
||||
* Decode the message if necessary. If the message is shared then d
|
||||
* a shared message, ignoring the message type.
|
||||
*/
|
||||
if(NULL == mesg_src->native) {
|
||||
/* Decode the message if necessary */
|
||||
HDassert(copy_type->decode);
|
||||
if(NULL == (mesg_src->native = (copy_type->decode)(ent_src->file, dxpl_id, mesg_src->raw, NULL)))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode a message")
|
||||
} /* end if (NULL == mesg_src->native) */
|
||||
|
||||
/* Copy the source message */
|
||||
if(H5O_CONT_ID == copy_type->id) {
|
||||
if((dst_native = H5O_copy_mesg_file(copy_type, ent_src->file, mesg_src->native,
|
||||
ent_dst->file, dxpl_id, map_list, chunk)) == NULL)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object header message")
|
||||
} /* end if */
|
||||
else {
|
||||
if((dst_native = H5O_copy_mesg_file(copy_type, ent_src->file, mesg_src->native,
|
||||
ent_dst->file, dxpl_id, map_list, NULL)) == NULL)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object header message")
|
||||
} /* end else */
|
||||
|
||||
/* Calculate address in destination raw chunk */
|
||||
p = chunk[chunkno].image + (mesg_src->raw - oh->chunk[chunkno].image);
|
||||
|
||||
/*
|
||||
* Encode the message. If the message is shared then we
|
||||
* encode a Shared Object message instead of the object
|
||||
* which is being shared.
|
||||
*/
|
||||
if((copy_type->encode)(ent_dst->file, p, dst_native) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message")
|
||||
|
||||
/* Release native destination info */
|
||||
H5O_free_real(copy_type, dst_native);
|
||||
} /* end if (mesg_src->type && mesg_src->type->copy_file) */
|
||||
} /* end of mesgno loop */
|
||||
|
||||
/* Write the object header to the file if this is the first chunk */
|
||||
if(chunkno == 0)
|
||||
if(H5F_block_write(ent_dst->file, H5FD_MEM_OHDR, addr_new, hdr_size, dxpl_id, buf) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header hdr to disk")
|
||||
|
||||
/* Write this chunk into disk */
|
||||
if(H5F_block_write(ent_dst->file, H5FD_MEM_OHDR, chunk[chunkno].addr, chunk[chunkno].size, dxpl_id, chunk[chunkno].image) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header data to disk")
|
||||
} /* end of chunkno loop */
|
||||
|
||||
/* Allocate space for the address mapping of the object copied */
|
||||
if(NULL == (addr_map = H5FL_MALLOC(H5O_addr_map_t)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
|
||||
|
||||
/* Insert the address mapping for the new object into the copied list */
|
||||
/* (Do this here, because "post copy" possibly checks it) */
|
||||
addr_map->src_addr = ent_src->header;
|
||||
addr_map->dst_addr = ent_dst->header;
|
||||
if(H5SL_insert(map_list, addr_map, &(addr_map->src_addr)) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list")
|
||||
|
||||
/* "post copy" loop over messages */
|
||||
for(mesgno = 0; mesgno < oh->nmesgs; mesgno++) {
|
||||
const H5O_class_t *copy_type;
|
||||
|
||||
mesg_src = &(oh->mesg[mesgno]);
|
||||
|
||||
if (mesg_src->flags & H5O_FLAG_SHARED)
|
||||
copy_type = H5O_SHARED;
|
||||
else
|
||||
copy_type = mesg_src->type;
|
||||
|
||||
HDassert(copy_type);
|
||||
if(mesg_src->native) {
|
||||
if((H5O_post_copy_mesg_file(copy_type, ent_src->file, mesg_src->native,
|
||||
ent_dst, dxpl_id, map_list)) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object header message")
|
||||
} /* end if */
|
||||
} /* end for */
|
||||
|
||||
done:
|
||||
/* Release pointer to object header itself */
|
||||
if(oh != NULL) {
|
||||
for(chunkno = 0; chunkno < oh->nchunks; chunkno++)
|
||||
H5FL_BLK_FREE(chunk_image, chunk[chunkno].image);
|
||||
H5FL_SEQ_FREE(H5O_chunk_t, chunk);
|
||||
|
||||
if(H5AC_unprotect(ent_src->file, dxpl_id, H5AC_OHDR, ent_src->header, oh, H5AC__NO_FLAGS_SET) < 0)
|
||||
HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header")
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_copy_header_real() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_copy_header_map
|
||||
*
|
||||
* Purpose: Copy header object from one location to another, detecting
|
||||
* already mapped objects, etc.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* November 1, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_copy_header_map(const H5G_entry_t *ent_src,
|
||||
H5G_entry_t *ent_dst /*out */, hid_t dxpl_id, H5SL_t *map_list)
|
||||
{
|
||||
H5O_addr_map_t *addr_map; /* Address mapping of object copied */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_copy_header_map, FAIL)
|
||||
|
||||
/* Sanity check */
|
||||
HDassert(ent_src);
|
||||
HDassert(ent_dst);
|
||||
HDassert(ent_dst->file);
|
||||
HDassert(map_list);
|
||||
|
||||
/* Look up the address of the object to copy in the skip list */
|
||||
addr_map = (H5O_addr_map_t *)H5SL_search(map_list, &(ent_src->header));
|
||||
|
||||
/* Check if address is already in list of objects copied */
|
||||
if(addr_map == NULL) {
|
||||
/* Copy object for the first time */
|
||||
|
||||
/* Copy object referred to */
|
||||
if(H5O_copy_header_real(ent_src, ent_dst, dxpl_id, map_list) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
|
||||
} /* end if */
|
||||
else {
|
||||
/* Object has already been copied, set it's address in destination file */
|
||||
ent_dst->header = addr_map->dst_addr;
|
||||
} /* end else */
|
||||
|
||||
/* Increment destination object's link count */
|
||||
if(H5O_link(ent_dst, 1, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to increment object link count")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_copy_header_map() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5O_copy_free_addrmap_cb
|
||||
PURPOSE
|
||||
Internal routine to free address maps from the skip list for copying objects
|
||||
USAGE
|
||||
herr_t H5O_copy_free_addrmap_cb(item, key, op_data)
|
||||
void *item; IN/OUT: Pointer to addr
|
||||
void *key; IN/OUT: (unused)
|
||||
void *op_data; IN: (unused)
|
||||
RETURNS
|
||||
Returns zero on success, negative on failure.
|
||||
DESCRIPTION
|
||||
Releases the memory for the address.
|
||||
GLOBAL VARIABLES
|
||||
COMMENTS, BUGS, ASSUMPTIONS
|
||||
EXAMPLES
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5O_copy_free_addrmap_cb(void *item, void UNUSED *key, void UNUSED *op_data)
|
||||
{
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_copy_free_addrmap_cb)
|
||||
|
||||
HDassert(item);
|
||||
|
||||
/* Release the item */
|
||||
H5FL_FREE(H5O_addr_map_t, item);
|
||||
|
||||
FUNC_LEAVE_NOAPI(0)
|
||||
} /* H5O_copy_free_addrmap_cb() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_copy_header
|
||||
*
|
||||
* Purpose: copy header object from one location to another.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* May 30, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_copy_header(const H5G_entry_t *ent_src,
|
||||
H5G_entry_t *ent_dst /*out */, hid_t dxpl_id)
|
||||
{
|
||||
H5SL_t *map_list = NULL; /* Skip list to hold address mappings */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER_NOAPI(H5O_copy_header, FAIL)
|
||||
|
||||
HDassert(ent_src);
|
||||
HDassert(ent_src->file);
|
||||
HDassert(H5F_addr_defined(ent_src->header));
|
||||
HDassert(ent_dst->file);
|
||||
|
||||
/* Create a skip list to keep track of which objects are copied */
|
||||
if((map_list = H5SL_create(H5SL_TYPE_HADDR, 0.5, 16)) == NULL)
|
||||
HGOTO_ERROR(H5E_SLIST, H5E_CANTCREATE, FAIL, "cannot make skip list")
|
||||
|
||||
/* copy the object from the source file to the destination file */
|
||||
if(H5O_copy_header_real(ent_src, ent_dst, dxpl_id, map_list) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object")
|
||||
|
||||
done:
|
||||
if(map_list)
|
||||
H5SL_destroy(map_list, H5O_copy_free_addrmap_cb, NULL);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_copy_header() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_debug_id
|
||||
|
101
src/H5Oattr.c
101
src/H5Oattr.c
@ -35,6 +35,8 @@ static herr_t H5O_attr_reset (void *_mesg);
|
||||
static herr_t H5O_attr_free (void *mesg);
|
||||
static herr_t H5O_attr_delete (H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link);
|
||||
static herr_t H5O_attr_link(H5F_t *f, hid_t dxpl_id, const void *_mesg);
|
||||
static void *H5O_attr_copy_file(H5F_t *file_src, void *native_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void *udata);
|
||||
static herr_t H5O_attr_debug (H5F_t *f, hid_t dxpl_id, const void *_mesg,
|
||||
FILE * stream, int indent, int fwidth);
|
||||
|
||||
@ -53,7 +55,9 @@ const H5O_class_t H5O_ATTR[1] = {{
|
||||
H5O_attr_link, /* link method */
|
||||
NULL, /* get share method */
|
||||
NULL, /* set share method */
|
||||
H5O_attr_debug, /* debug the message */
|
||||
H5O_attr_copy_file, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_attr_debug /* debug the message */
|
||||
}};
|
||||
|
||||
/* This is the initial version, which does not have support for shared datatypes */
|
||||
@ -65,12 +69,6 @@ const H5O_class_t H5O_ATTR[1] = {{
|
||||
/* Flags for attribute flag encoding */
|
||||
#define H5O_ATTR_FLAG_TYPE_SHARED 0x01
|
||||
|
||||
/* Declare extern the free list for H5A_t's */
|
||||
H5FL_EXTERN(H5A_t);
|
||||
|
||||
/* Declare extern the free list for attribute data buffers */
|
||||
H5FL_BLK_EXTERN(attr_buf);
|
||||
|
||||
/* Declare external the free list for H5S_t's */
|
||||
H5FL_EXTERN(H5S_t);
|
||||
|
||||
@ -594,6 +592,95 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value);
|
||||
} /* end H5O_attr_link() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_attr_copy_file
|
||||
*
|
||||
* Purpose: Copies a message from _MESG to _DEST in file
|
||||
*
|
||||
* Return: Success: Ptr to _DEST
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* November 1, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
H5O_attr_copy_file(H5F_t UNUSED *file_src, void *native_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void UNUSED *udata)
|
||||
{
|
||||
H5A_t *attr_src = (H5A_t *)native_src;
|
||||
H5A_t *attr_dst = NULL;
|
||||
void *ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_attr_copy_file)
|
||||
|
||||
/* check args */
|
||||
HDassert(attr_src);
|
||||
HDassert(file_dst);
|
||||
HDassert(map_list);
|
||||
|
||||
/* Allocate space for the destination message */
|
||||
if(NULL == (attr_dst = H5FL_CALLOC(H5A_t)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
|
||||
/* Copy the top level of the attribute */
|
||||
*attr_dst = *attr_src;
|
||||
|
||||
/* Don't have an opened group entry for copy */
|
||||
H5G_ent_reset(&(attr_dst->ent));
|
||||
attr_dst->ent_opened = 0;
|
||||
|
||||
/* Copy attribute's name */
|
||||
attr_dst->name = H5MM_strdup(attr_src->name);
|
||||
|
||||
/* Copy attribute's datatype */
|
||||
/* (Start destination datatype as transient, even if source is named) */
|
||||
attr_dst->dt = H5T_copy(attr_src->dt, H5T_COPY_ALL);
|
||||
|
||||
/* Check for named datatype being copied */
|
||||
if(H5T_committed(attr_src->dt)) {
|
||||
H5G_entry_t *ent_src; /* Pointer to source datatype's group entry */
|
||||
H5G_entry_t *ent_dst; /* Pointer to dest. datatype's group entry */
|
||||
|
||||
/* Get group entries for source & destination */
|
||||
ent_src = H5T_entof(attr_src->dt);
|
||||
HDassert(ent_src);
|
||||
ent_dst = H5T_entof(attr_dst->dt);
|
||||
HDassert(ent_dst);
|
||||
|
||||
/* Reset group entry for new object */
|
||||
H5G_ent_reset(ent_dst);
|
||||
ent_dst->file = file_dst;
|
||||
|
||||
/* Copy the shared object from source to destination */
|
||||
if(H5O_copy_header_map(ent_src, ent_dst, dxpl_id, map_list) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object")
|
||||
} /* end if */
|
||||
|
||||
/* Copy the guts of the attribute */
|
||||
attr_dst->ds = H5S_copy(attr_src->ds, FALSE);
|
||||
|
||||
if(attr_src->data) {
|
||||
if(NULL == (attr_dst->data = H5FL_BLK_MALLOC(attr_buf, attr_src->data_size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
|
||||
HDmemcpy(attr_dst->data, attr_src->data, attr_src->data_size);
|
||||
} /* end if */
|
||||
|
||||
/* Set return value */
|
||||
ret_value = attr_dst;
|
||||
|
||||
done:
|
||||
if(!ret_value)
|
||||
if(attr_dst)
|
||||
(void)H5A_free(attr_dst);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5O_attr_copy_file() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
|
@ -60,7 +60,9 @@ const H5O_class_t H5O_BOGUS[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_bogus_debug, /*debug the message */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_bogus_debug /*debug the message */
|
||||
}};
|
||||
|
||||
|
||||
|
@ -42,6 +42,8 @@ static void *H5O_cont_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shar
|
||||
static herr_t H5O_cont_encode(H5F_t *f, uint8_t *p, const void *_mesg);
|
||||
static size_t H5O_cont_size(const H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_cont_free(void *mesg);
|
||||
static void *H5O_cont_copy_file(H5F_t *file_src, void *mesg_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void *udata);
|
||||
static herr_t H5O_cont_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
@ -60,7 +62,9 @@ const H5O_class_t H5O_CONT[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_cont_debug, /*debugging */
|
||||
H5O_cont_copy_file, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_cont_debug /*debugging */
|
||||
}};
|
||||
|
||||
/* Declare the free list for H5O_cont_t's */
|
||||
@ -207,6 +211,54 @@ H5O_cont_free (void *mesg)
|
||||
FUNC_LEAVE_NOAPI(SUCCEED);
|
||||
} /* end H5O_cont_free() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_cont_copy_file
|
||||
*
|
||||
* Purpose: Copies a continuation block message from _MESG to _DEST in file
|
||||
*
|
||||
* Return: Success: Ptr to _DEST
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* September 22, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
H5O_cont_copy_file(H5F_t UNUSED *file_src, void *mesg_src,
|
||||
H5F_t *file_dst, hid_t UNUSED dxpl_id, H5SL_t UNUSED *map_list, void *udata)
|
||||
{
|
||||
H5O_cont_t *cont_src = (H5O_cont_t *) mesg_src;
|
||||
H5O_chunk_t *chunk = (H5O_chunk_t *)udata;
|
||||
H5O_cont_t *cont_dst = NULL;
|
||||
void *ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_cont_copy_file)
|
||||
|
||||
/* check args */
|
||||
HDassert(cont_src);
|
||||
HDassert(file_dst);
|
||||
|
||||
/* Allocate space for the destination cont */
|
||||
if(NULL == (cont_dst = H5FL_MALLOC(H5O_cont_t)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
|
||||
HDmemcpy(cont_dst, cont_src, sizeof(H5O_cont_t));
|
||||
cont_dst->addr = chunk[cont_src->chunkno].addr;
|
||||
|
||||
/* Set return value */
|
||||
ret_value = cont_dst;
|
||||
|
||||
done:
|
||||
if(!ret_value)
|
||||
if(cont_dst)
|
||||
H5FL_FREE(H5O_cont_t, cont_dst);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_cont_copy_file() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_cont_debug
|
||||
|
@ -53,7 +53,9 @@ const H5O_class_t H5O_DTYPE[1] = {{
|
||||
NULL, /* link method */
|
||||
H5O_dtype_get_share, /* get share method */
|
||||
H5O_dtype_set_share, /* set share method */
|
||||
H5O_dtype_debug, /* debug the message */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_dtype_debug /* debug the message */
|
||||
}};
|
||||
|
||||
/* This is the correct version to create all datatypes which don't contain
|
||||
|
87
src/H5Oefl.c
87
src/H5Oefl.c
@ -33,6 +33,8 @@ static herr_t H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_efl_copy(const void *_mesg, void *_dest, unsigned update_flags);
|
||||
static size_t H5O_efl_size(const H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_efl_reset(void *_mesg);
|
||||
static void *H5O_efl_copy_file(H5F_t *file_src, void *mesg_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void *udata);
|
||||
static herr_t H5O_efl_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
@ -51,7 +53,9 @@ const H5O_class_t H5O_EFL[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_efl_debug, /*debug the message */
|
||||
H5O_efl_copy_file, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_efl_debug /*debug the message */
|
||||
}};
|
||||
|
||||
#define H5O_EFL_VERSION 1
|
||||
@ -413,6 +417,86 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_copy_file
|
||||
*
|
||||
* Purpose: Copies an efl message from _MESG to _DEST in file
|
||||
*
|
||||
* Return: Success: Ptr to _DEST
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* September 29, 2005
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
H5O_efl_copy_file(H5F_t UNUSED *file_src, void *mesg_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t UNUSED *map_list, void UNUSED *_udata)
|
||||
{
|
||||
H5O_efl_t *efl_src = (H5O_efl_t *) mesg_src;
|
||||
H5O_efl_t *efl_dst = NULL;
|
||||
size_t idx, size, name_offset, heap_size;
|
||||
void *ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_efl_copy_file)
|
||||
|
||||
/* check args */
|
||||
HDassert(efl_src);
|
||||
HDassert(file_dst);
|
||||
|
||||
/* Allocate space for the destination efl */
|
||||
if(NULL == (efl_dst = H5MM_calloc(sizeof(H5O_efl_t))))
|
||||
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
|
||||
/* Copy the "top level" information */
|
||||
HDmemcpy(efl_dst, efl_src, sizeof(H5O_efl_t));
|
||||
|
||||
/* create name heap */
|
||||
heap_size = H5HL_ALIGN(1);
|
||||
for(idx = 0; idx < efl_src->nused; idx++)
|
||||
heap_size += H5HL_ALIGN(HDstrlen(efl_src->slot[idx].name) + 1);
|
||||
|
||||
if(H5HL_create(file_dst, dxpl_id, heap_size, &efl_dst->heap_addr/*out*/) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't create heap")
|
||||
|
||||
name_offset = H5HL_insert(file_dst, dxpl_id, efl_dst->heap_addr, 1, "");
|
||||
if((size_t)(-1) == name_offset)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "can't initialize heap")
|
||||
HDassert(0 == name_offset);
|
||||
|
||||
/* allocate array of external file entries */
|
||||
if(efl_src->nalloc > 0) {
|
||||
size = efl_src->nalloc * sizeof(H5O_efl_entry_t);
|
||||
if((efl_dst->slot = H5MM_calloc(size)) == NULL)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
|
||||
/* copy content from the source. Need to update later */
|
||||
HDmemcpy(efl_dst->slot, efl_src->slot, size);
|
||||
}
|
||||
|
||||
/* copy the name from the source */
|
||||
for(idx = 0; idx < efl_src->nused; idx++) {
|
||||
efl_dst->slot[idx].name = H5MM_xstrdup(efl_src->slot[idx].name);
|
||||
efl_dst->slot[idx].name_offset = H5HL_insert(file_dst, dxpl_id, efl_dst->heap_addr,
|
||||
HDstrlen(efl_dst->slot[idx].name)+1, efl_dst->slot[idx].name);
|
||||
}
|
||||
|
||||
/* Set return value */
|
||||
ret_value = efl_dst;
|
||||
|
||||
done:
|
||||
if(!ret_value)
|
||||
if(efl_dst)
|
||||
H5MM_xfree(efl_dst);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_efl_debug
|
||||
@ -475,3 +559,4 @@ H5O_efl_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE * s
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,9 @@ const H5O_class_t H5O_FILL[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_fill_debug, /*debug the message */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_fill_debug /*debug the message */
|
||||
}};
|
||||
|
||||
/* This message derives from H5O, for new fill value after version 1.4 */
|
||||
@ -81,7 +83,9 @@ const H5O_class_t H5O_FILL_NEW[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_fill_new_debug, /*debug the message */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_fill_new_debug /*debug the message */
|
||||
}};
|
||||
|
||||
/* Initial version of the "old" fill value information */
|
||||
|
127
src/H5Olayout.c
127
src/H5Olayout.c
@ -18,16 +18,18 @@
|
||||
* Purpose: Messages related to data layout.
|
||||
*/
|
||||
|
||||
#define H5D_PACKAGE /*suppress error about including H5Dpkg */
|
||||
#define H5O_PACKAGE /*suppress error about including H5Opkg */
|
||||
|
||||
|
||||
#include "H5private.h"
|
||||
#include "H5Dprivate.h"
|
||||
#include "H5Eprivate.h"
|
||||
#include "H5FLprivate.h" /*Free Lists */
|
||||
#include "H5private.h" /* Generic Functions */
|
||||
#include "H5Dpkg.h" /* Dataset functions */
|
||||
#include "H5Eprivate.h" /* Error handling */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
#include "H5MFprivate.h" /* File space management */
|
||||
#include "H5MMprivate.h"
|
||||
#include "H5Opkg.h" /* Object header functions */
|
||||
#include "H5MMprivate.h" /* Memory management */
|
||||
#include "H5Opkg.h" /* Object headers */
|
||||
#include "H5Pprivate.h" /* Property lists */
|
||||
|
||||
/* PRIVATE PROTOTYPES */
|
||||
static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh);
|
||||
@ -37,6 +39,8 @@ static size_t H5O_layout_size(const H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_layout_reset(void *_mesg);
|
||||
static herr_t H5O_layout_free(void *_mesg);
|
||||
static herr_t H5O_layout_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link);
|
||||
static void *H5O_layout_copy_file(H5F_t *file_src, void *mesg_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void *udata);
|
||||
static herr_t H5O_layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
@ -55,7 +59,9 @@ const H5O_class_t H5O_LAYOUT[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_layout_debug, /*debug the message */
|
||||
H5O_layout_copy_file, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_layout_debug /*debug the message */
|
||||
}};
|
||||
|
||||
/* For forward and backward compatibility. Version is 1 when space is
|
||||
@ -597,6 +603,113 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value);
|
||||
} /* end H5O_layout_delete() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_layout_copy_file
|
||||
*
|
||||
* Purpose: Copies a data layout message from _MESG to _DEST in file
|
||||
*
|
||||
* Return: Success: Ptr to _DEST
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* July 23, 2005
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
H5O_layout_copy_file(H5F_t *file_src, void *mesg_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t UNUSED *map_list, void UNUSED *_udata)
|
||||
{
|
||||
H5O_layout_t *layout_src = (H5O_layout_t *) mesg_src;
|
||||
H5O_layout_t *layout_dst = NULL;
|
||||
void *ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_layout_copy_file)
|
||||
|
||||
/* check args */
|
||||
HDassert(layout_src);
|
||||
HDassert(file_dst);
|
||||
|
||||
/* Allocate space for the destination layout */
|
||||
if(NULL == (layout_dst = H5FL_MALLOC(H5O_layout_t)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
|
||||
/* Copy the "top level" information */
|
||||
HDmemcpy(layout_dst, layout_src, sizeof(H5O_layout_t));
|
||||
|
||||
/* Copy the layout type specific information */
|
||||
switch(layout_src->type) {
|
||||
case H5D_COMPACT:
|
||||
if(layout_src->u.compact.buf) {
|
||||
if(NULL == (layout_dst->u.compact.buf = H5MM_malloc(layout_src->u.compact.size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset")
|
||||
HDmemcpy(layout_dst->u.compact.buf, layout_src->u.compact.buf, layout_src->u.compact.size);
|
||||
layout_dst->u.compact.dirty = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case H5D_CONTIGUOUS:
|
||||
if(H5F_addr_defined(layout_src->u.contig.addr)) {
|
||||
haddr_t addr_src, addr_dst;
|
||||
unsigned DRAW_BUF_SIZE = 4096;
|
||||
uint8_t buf[4096];
|
||||
size_t nbytes=0, total_nbytes=0;
|
||||
|
||||
/* create layout */
|
||||
if(H5D_contig_create (file_dst, dxpl_id, layout_dst)<0)
|
||||
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to initialize contiguous storage")
|
||||
|
||||
/* copy raw data*/
|
||||
nbytes = total_nbytes = 0;
|
||||
while(total_nbytes < layout_src->u.contig.size) {
|
||||
addr_src = layout_src->u.contig.addr + total_nbytes;
|
||||
addr_dst = layout_dst->u.contig.addr + total_nbytes;
|
||||
|
||||
nbytes = layout_src->u.contig.size-total_nbytes;
|
||||
if(nbytes > DRAW_BUF_SIZE)
|
||||
nbytes = DRAW_BUF_SIZE;
|
||||
total_nbytes += nbytes;
|
||||
|
||||
if(H5F_block_read(file_src, H5FD_MEM_DRAW, addr_src, nbytes, H5P_DATASET_XFER_DEFAULT, buf)<0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unable to read raw data")
|
||||
|
||||
if(H5F_block_write(file_dst, H5FD_MEM_DRAW, addr_dst, nbytes, H5P_DATASET_XFER_DEFAULT, buf)<0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_READERROR, NULL, "unable to write raw data")
|
||||
}
|
||||
} /* if ( H5F_addr_defined(layout_src->u.contig.addr)) */
|
||||
break;
|
||||
|
||||
case H5D_CHUNKED:
|
||||
if(H5F_addr_defined(layout_src->u.chunk.addr)) {
|
||||
|
||||
/* layout is not created in the destination file, undef btree address */
|
||||
layout_dst->u.chunk.addr = HADDR_UNDEF;
|
||||
|
||||
/* create chunked layout */
|
||||
if(H5D_istore_copy(file_src, layout_src, file_dst, layout_dst, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy chunked storage")
|
||||
} /* if ( H5F_addr_defined(layout_srct->u.chunk.addr)) */
|
||||
break;
|
||||
|
||||
default:
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class");
|
||||
} /* end switch */
|
||||
|
||||
/* Set return value */
|
||||
ret_value=layout_dst;
|
||||
|
||||
done:
|
||||
if(!ret_value)
|
||||
if(layout_dst)
|
||||
H5FL_FREE(H5O_layout_t, layout_dst);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_layout_debug
|
||||
|
@ -60,7 +60,9 @@ const H5O_class_t H5O_MTIME[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_mtime_debug, /*debug the message */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_mtime_debug /*debug the message */
|
||||
}};
|
||||
|
||||
/* This message derives from H5O */
|
||||
@ -79,7 +81,9 @@ const H5O_class_t H5O_MTIME_NEW[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_mtime_debug, /*debug the message */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_mtime_debug /*debug the message */
|
||||
}};
|
||||
|
||||
/* Current version of new mtime information */
|
||||
|
@ -57,7 +57,9 @@ const H5O_class_t H5O_NAME[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_name_debug, /*debug the message */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_name_debug /*debug the message */
|
||||
}};
|
||||
|
||||
|
||||
|
@ -46,5 +46,7 @@ const H5O_class_t H5O_NULL[1] = {{
|
||||
NULL, /*no link method */
|
||||
NULL, /*no get share method */
|
||||
NULL, /*no set share method */
|
||||
NULL, /*no debug method */
|
||||
NULL, /*no copy native value to file */
|
||||
NULL, /*no post copy native value to file */
|
||||
NULL /*no debug method */
|
||||
}};
|
||||
|
@ -19,8 +19,11 @@
|
||||
#ifndef _H5Opkg_H
|
||||
#define _H5Opkg_H
|
||||
|
||||
/* Include private header file */
|
||||
#include "H5Oprivate.h" /* Object header functions */
|
||||
/* Get package's private header */
|
||||
#include "H5Oprivate.h" /* Object headers */
|
||||
|
||||
/* Other private headers needed by this file */
|
||||
#include "H5SLprivate.h" /* Skip lists */
|
||||
|
||||
/*
|
||||
* Align messages on 8-byte boundaries because we would like to copy the
|
||||
@ -69,6 +72,8 @@ typedef struct H5O_class_t {
|
||||
herr_t (*link)(H5F_t *, hid_t, const void *); /* Increment any links in file reference by this message */
|
||||
herr_t (*get_share)(H5F_t*, const void*, struct H5O_shared_t*); /* Get shared information */
|
||||
herr_t (*set_share)(H5F_t*, void*, const struct H5O_shared_t*); /* Set shared information */
|
||||
void *(*copy_file)(H5F_t *, void *, H5F_t *, hid_t, H5SL_t *, void *); /*copy native value to file */
|
||||
herr_t (*post_copy_file)(H5F_t *, const void *, H5G_entry_t *, hid_t, H5SL_t *); /*"post copy" action when copying native value to file */
|
||||
herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int);
|
||||
} H5O_class_t;
|
||||
|
||||
|
@ -54,7 +54,9 @@ const H5O_class_t H5O_PLINE[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /* get share method */
|
||||
NULL, /* set share method */
|
||||
H5O_pline_debug, /* debug the message */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_pline_debug /* debug the message */
|
||||
}};
|
||||
|
||||
|
||||
|
@ -28,16 +28,17 @@
|
||||
#define _H5Oprivate_H
|
||||
|
||||
/* Include the public header file for this API */
|
||||
#include "H5Opublic.h" /* Object header functions */
|
||||
#include "H5Opublic.h" /* Object header functions */
|
||||
|
||||
/* Public headers needed by this file */
|
||||
#include "H5Dpublic.h" /* Dataset functions */
|
||||
#include "H5Spublic.h" /* Dataspace functions */
|
||||
#include "H5Dpublic.h" /* Dataset functions */
|
||||
#include "H5Spublic.h" /* Dataspace functions */
|
||||
|
||||
/* Private headers needed by this file */
|
||||
#include "H5HGprivate.h" /* Global heap functions */
|
||||
#include "H5Tprivate.h" /* Datatype functions */
|
||||
#include "H5Zprivate.h" /* I/O pipeline filters */
|
||||
#include "H5FLprivate.h" /* Free Lists */
|
||||
#include "H5HGprivate.h" /* Global heap functions */
|
||||
#include "H5Tprivate.h" /* Datatype functions */
|
||||
#include "H5Zprivate.h" /* I/O pipeline filters */
|
||||
|
||||
/* Object header macros */
|
||||
#define H5O_MIN_SIZE H5O_ALIGN(32) /*min obj header data size */
|
||||
@ -249,6 +250,9 @@ typedef struct H5O_stab_t {
|
||||
typedef herr_t (*H5O_operator_t)(const void *mesg/*in*/, unsigned idx,
|
||||
void *operator_data/*in,out*/);
|
||||
|
||||
/* Forward declarations for prototype arguments */
|
||||
struct H5SL_t;
|
||||
|
||||
/* General message operators */
|
||||
H5_DLL herr_t H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint,
|
||||
H5G_entry_t *ent/*out*/);
|
||||
@ -291,6 +295,10 @@ H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr);
|
||||
H5_DLL herr_t H5O_get_info(H5G_entry_t *ent, H5O_stat_t *ostat, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5O_iterate(const H5G_entry_t *ent, unsigned type_id, H5O_operator_t op,
|
||||
void *op_data, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5O_copy_header(const H5G_entry_t *ent_src,
|
||||
H5G_entry_t *ent_dst /*out */, hid_t dxpl_id);
|
||||
H5_DLL herr_t H5O_copy_header_map(const H5G_entry_t *ent_src,
|
||||
H5G_entry_t *ent_dst /*out */, hid_t dxpl_id, struct H5SL_t *obj_list);
|
||||
H5_DLL herr_t H5O_debug_id(hid_t type_id, H5F_t *f, hid_t dxpl_id, const void *mesg, FILE *stream, int indent, int fwidth);
|
||||
H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
|
||||
int fwidth);
|
||||
|
@ -49,7 +49,9 @@ const H5O_class_t H5O_SDSPACE[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /* get share method */
|
||||
NULL, /* set share method */
|
||||
H5O_sdspace_debug, /* debug the message */
|
||||
NULL, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_sdspace_debug /* debug the message */
|
||||
}};
|
||||
|
||||
/* Initial version of the "old" data space information */
|
||||
|
@ -42,6 +42,8 @@ static void *H5O_shared_copy(const void *_mesg, void *_dest, unsigned update_fla
|
||||
static size_t H5O_shared_size (const H5F_t*, const void *_mesg);
|
||||
static herr_t H5O_shared_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link);
|
||||
static herr_t H5O_shared_link(H5F_t *f, hid_t dxpl_id, const void *_mesg);
|
||||
static void *H5O_shared_copy_file(H5F_t *file_src, void *native_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void *udata);
|
||||
static herr_t H5O_shared_debug (H5F_t*, hid_t dxpl_id, const void*, FILE*, int, int);
|
||||
|
||||
/* This message derives from H5O */
|
||||
@ -59,7 +61,9 @@ const H5O_class_t H5O_SHARED[1] = {{
|
||||
H5O_shared_link, /*link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_shared_debug, /*debug method */
|
||||
H5O_shared_copy_file, /* copy native value to file */
|
||||
NULL, /* post copy native value to file */
|
||||
H5O_shared_debug /*debug method */
|
||||
}};
|
||||
|
||||
/* Old version, with full symbol table entry as link for object header sharing */
|
||||
@ -470,6 +474,63 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value);
|
||||
} /* end H5O_shared_link() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_shared_copy_file
|
||||
*
|
||||
* Purpose: Copies a message from _MESG to _DEST in file
|
||||
*
|
||||
* Return: Success: Ptr to _DEST
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* November 1, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
H5O_shared_copy_file(H5F_t UNUSED *file_src, void *native_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void UNUSED *udata)
|
||||
{
|
||||
H5O_shared_t *shared_src = (H5O_shared_t *)native_src;
|
||||
H5O_shared_t *shared_dst = NULL;
|
||||
void *ret_value; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_shared_copy_file)
|
||||
|
||||
/* check args */
|
||||
HDassert(shared_src);
|
||||
HDassert(file_dst);
|
||||
HDassert(map_list);
|
||||
|
||||
/* Allocate space for the destination message */
|
||||
if(NULL == (shared_dst = H5MM_malloc(sizeof(H5O_shared_t))))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
|
||||
|
||||
/* Can't handle copying message in global heap currently */
|
||||
HDassert(!shared_src->in_gh);
|
||||
shared_dst->in_gh = FALSE;
|
||||
|
||||
/* Reset group entry for new object */
|
||||
H5G_ent_reset(&(shared_dst->u.ent));
|
||||
shared_dst->u.ent.file = file_dst;
|
||||
|
||||
/* Copy the shared object from source to destination */
|
||||
if(H5O_copy_header_map(&(shared_src->u.ent), &(shared_dst->u.ent), dxpl_id, map_list) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object")
|
||||
|
||||
/* Set return value */
|
||||
ret_value = shared_dst;
|
||||
|
||||
done:
|
||||
if(!ret_value)
|
||||
if(shared_dst)
|
||||
H5MM_xfree(shared_dst);
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5O_shared_copy_file() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_shared_debug
|
||||
|
@ -42,8 +42,12 @@ static void *H5O_stab_copy(const void *_mesg, void *_dest, unsigned update_flags
|
||||
static size_t H5O_stab_size(const H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_stab_free(void *_mesg);
|
||||
static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link);
|
||||
static void *H5O_stab_copy_file(H5F_t *file_src, void *native_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t *map_list, void *udata);
|
||||
static herr_t H5O_stab_post_copy_file(H5F_t *file_src, const void *mesg_src,
|
||||
H5G_entry_t *loc_dst, hid_t dxpl_id, H5SL_t *map_list);
|
||||
static herr_t H5O_stab_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg,
|
||||
FILE * stream, int indent, int fwidth);
|
||||
FILE * stream, int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
const H5O_class_t H5O_STAB[1] = {{
|
||||
@ -60,7 +64,9 @@ const H5O_class_t H5O_STAB[1] = {{
|
||||
NULL, /* link method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_stab_debug, /*debug the message */
|
||||
H5O_stab_copy_file, /* copy native value to file */
|
||||
H5O_stab_post_copy_file, /* post copy native value to file */
|
||||
H5O_stab_debug /*debug the message */
|
||||
}};
|
||||
|
||||
/* Declare a free list to manage the H5O_stab_t struct */
|
||||
@ -335,6 +341,95 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O_stab_delete() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_stab_copy_file
|
||||
*
|
||||
* Purpose: Copies a message from _MESG to _DEST in file
|
||||
*
|
||||
* Return: Success: Ptr to _DEST
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* September 10, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
H5O_stab_copy_file(H5F_t UNUSED *file_src, void *native_src,
|
||||
H5F_t *file_dst, hid_t dxpl_id, H5SL_t UNUSED *map_list, void UNUSED *udata)
|
||||
{
|
||||
H5O_stab_t *stab_src = (H5O_stab_t *) native_src;
|
||||
H5O_stab_t *stab_dst = NULL;
|
||||
void *ret_value; /* Return value */
|
||||
|
||||
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")
|
||||
|
||||
if(H5G_stab_copy_tmp(file_dst, stab_dst, dxpl_id) < 0)
|
||||
HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to copy group symbol table")
|
||||
|
||||
/* 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
|
||||
*
|
||||
* Purpose: Copies entries of a symbol table message from _MESG to _DEST in file
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Peter Cao
|
||||
* September 28, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_stab_post_copy_file(H5F_t *file_src, const void *mesg_src,
|
||||
H5G_entry_t *loc_dst, hid_t dxpl_id, H5SL_t *map_list)
|
||||
{
|
||||
H5G_bt_it_ud5_t udata; /* B-tree user data */
|
||||
const H5O_stab_t *stab_src = (const H5O_stab_t *) mesg_src;
|
||||
herr_t ret_value = SUCCEED; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT(H5O_stab_post_copy_file)
|
||||
|
||||
/* check args */
|
||||
HDassert(file_src);
|
||||
HDassert(stab_src);
|
||||
HDassert(loc_dst->file);
|
||||
HDassert(map_list);
|
||||
|
||||
/* Set up B-tree iteration user data */
|
||||
udata.map_list = map_list;
|
||||
udata.heap_addr = stab_src->heap_addr;
|
||||
udata.loc_dst = loc_dst;
|
||||
|
||||
/* Iterate over objects in group, copying them */
|
||||
if((H5B_iterate(file_src, dxpl_id, H5B_SNODE, H5G_node_copy, stab_src->btree_addr, &udata)) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* H5O_stab_post_copy_file() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_stab_debug
|
||||
|
101
src/H5S.c
101
src/H5S.c
@ -39,6 +39,7 @@ static herr_t H5S_set_extent_simple (H5S_t *space, unsigned rank,
|
||||
static htri_t H5S_is_simple(const H5S_t *sdim);
|
||||
static herr_t H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc);
|
||||
static H5S_t *H5S_decode(const unsigned char *buf);
|
||||
static htri_t H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2);
|
||||
|
||||
#ifdef H5S_DEBUG
|
||||
/* Names of the selection names, for debugging */
|
||||
@ -2223,6 +2224,106 @@ done:
|
||||
FUNC_LEAVE_NOAPI(ret_value);
|
||||
} /* end H5S_set_extent_real() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Sextent_equal
|
||||
*
|
||||
* Purpose: Determines if two dataspace extents are equal.
|
||||
*
|
||||
* Return: Success: TRUE if equal, FALSE if unequal
|
||||
*
|
||||
* Failure: Negative
|
||||
*
|
||||
* Programmer: Quincey Koziol
|
||||
* Monday, October 24, 2005
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
htri_t
|
||||
H5Sextent_equal(hid_t space1_id, hid_t space2_id)
|
||||
{
|
||||
const H5S_t *ds1, *ds2; /* Dataspaces to compare */
|
||||
htri_t ret_value;
|
||||
|
||||
FUNC_ENTER_API(H5Sextent_equal, FAIL)
|
||||
H5TRACE2("t","ii",space1_id,space2_id);
|
||||
|
||||
/* check args */
|
||||
if(NULL == (ds1 = H5I_object_verify(space1_id, H5I_DATASPACE)) ||
|
||||
NULL == (ds2 = H5I_object_verify(space2_id, H5I_DATASPACE)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
|
||||
|
||||
/* Check dataspaces for extent's equality */
|
||||
if((ret_value = H5S_extent_equal(ds1, ds2)) < 0)
|
||||
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "dataspace comparison failed")
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_API(ret_value)
|
||||
} /* end H5Sextent_equal() */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
NAME
|
||||
H5S_extent_equal
|
||||
PURPOSE
|
||||
Check if two dataspaces have equal extents
|
||||
USAGE
|
||||
htri_t H5S_extent_equal(ds1, ds2)
|
||||
H5S_t *ds1, *ds2; IN: Dataspace objects to compare
|
||||
RETURNS
|
||||
TRUE if equal, FALSE if unequal on succeess/Negative on failure
|
||||
DESCRIPTION
|
||||
Compare two dataspaces if their extents are identical.
|
||||
--------------------------------------------------------------------------*/
|
||||
static htri_t
|
||||
H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2)
|
||||
{
|
||||
unsigned u; /* Local index variable */
|
||||
htri_t ret_value = TRUE; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(H5S_extent_equal, FAIL)
|
||||
|
||||
/* Check args */
|
||||
HDassert(ds1);
|
||||
HDassert(ds2);
|
||||
|
||||
/* Make certain the dataspaces are the same type */
|
||||
if(ds1->extent.type != ds2->extent.type)
|
||||
HGOTO_DONE(FALSE)
|
||||
|
||||
/* Make certain the dataspaces are the same rank */
|
||||
if(ds1->extent.rank != ds2->extent.rank)
|
||||
HGOTO_DONE(FALSE)
|
||||
|
||||
/* Make certain the dataspaces' current dimensions are the same size */
|
||||
if(ds1->extent.rank > 0) {
|
||||
HDassert(ds1->extent.size);
|
||||
HDassert(ds2->extent.size);
|
||||
for(u = 0; u < ds1->extent.rank; u++) {
|
||||
if(ds1->extent.size[u] != ds2->extent.size[u])
|
||||
HGOTO_DONE(FALSE)
|
||||
} /* end for */
|
||||
} /* end if */
|
||||
|
||||
/* Make certain the dataspaces' maximum dimensions are the same size */
|
||||
if(ds1->extent.rank > 0) {
|
||||
/* Check for no maximum dimensions on dataspaces */
|
||||
if(ds1->extent.max != NULL && ds2->extent.max != NULL) {
|
||||
for(u = 0; u < ds1->extent.rank; u++) {
|
||||
if(ds1->extent.max[u] != ds2->extent.max[u])
|
||||
HGOTO_DONE(FALSE)
|
||||
} /* end for */
|
||||
} /* end if */
|
||||
else
|
||||
if((ds1->extent.max == NULL && ds2->extent.max != NULL) ||
|
||||
(ds1->extent.max != NULL && ds2->extent.max == NULL))
|
||||
HGOTO_DONE(FALSE)
|
||||
} /* end if */
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5S_extent_equal() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5S_debug
|
||||
|
@ -5371,7 +5371,7 @@ H5S_hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_slab
|
||||
hsize_t curr_start;
|
||||
hsize_t curr_low;
|
||||
int outcount;
|
||||
int i;
|
||||
unsigned u;
|
||||
H5S_hyper_dim_t canon_down_span_slab_info[H5S_MAX_RANK];
|
||||
hbool_t ret_value = TRUE;
|
||||
|
||||
@ -5414,17 +5414,17 @@ H5S_hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_slab
|
||||
/* Compare the slab information of the adjacent spans in the down span tree.
|
||||
We have to compare all the sub-tree slab information with the canon_down_span_slab_info.*/
|
||||
|
||||
for( i = 0; i < rank - 1; i++) {
|
||||
curr_down_span_slab_info = &span_slab_info[i];
|
||||
for( u = 0; u < rank - 1; u++) {
|
||||
curr_down_span_slab_info = &span_slab_info[u];
|
||||
|
||||
if(curr_down_span_slab_info->count > 0 && canon_down_span_slab_info[i].count > 0) {
|
||||
if(curr_down_span_slab_info->start != canon_down_span_slab_info[i].start
|
||||
|| curr_down_span_slab_info->stride != canon_down_span_slab_info[i].stride
|
||||
|| curr_down_span_slab_info->block != canon_down_span_slab_info[i].block
|
||||
|| curr_down_span_slab_info->count != canon_down_span_slab_info[i].count)
|
||||
if(curr_down_span_slab_info->count > 0 && canon_down_span_slab_info[u].count > 0) {
|
||||
if(curr_down_span_slab_info->start != canon_down_span_slab_info[u].start
|
||||
|| curr_down_span_slab_info->stride != canon_down_span_slab_info[u].stride
|
||||
|| curr_down_span_slab_info->block != canon_down_span_slab_info[u].block
|
||||
|| curr_down_span_slab_info->count != canon_down_span_slab_info[u].count)
|
||||
HGOTO_DONE(FALSE)
|
||||
} /* end if */
|
||||
else if (!((curr_down_span_slab_info->count == 0) && (canon_down_span_slab_info[i].count == 0)))
|
||||
else if (!((curr_down_span_slab_info->count == 0) && (canon_down_span_slab_info[u].count == 0)))
|
||||
HGOTO_DONE(FALSE)
|
||||
}
|
||||
} /* end if */
|
||||
|
@ -132,6 +132,7 @@ H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
|
||||
H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
|
||||
H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
|
||||
H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id);
|
||||
H5_DLL herr_t H5Sextent_equal(hid_t sid1, hid_t sid2);
|
||||
H5_DLL herr_t H5Sselect_all(hid_t spaceid);
|
||||
H5_DLL herr_t H5Sselect_none(hid_t spaceid);
|
||||
H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
|
||||
|
@ -3459,8 +3459,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to copy entry");
|
||||
} /* end if */
|
||||
else {
|
||||
HDmemset (&(new_dt->ent), 0, sizeof(new_dt->ent));
|
||||
new_dt->ent.header = HADDR_UNDEF;
|
||||
H5G_ent_reset(&(new_dt->ent));
|
||||
} /* end else */
|
||||
|
||||
/* Set return value */
|
||||
|
@ -37,7 +37,8 @@ libhdf5_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_
|
||||
MOSTLYCLEANFILES=H5Tinit.c
|
||||
|
||||
# library sources
|
||||
libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
|
||||
libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5B2.c H5B2cache.c \
|
||||
H5B2dbg.c \
|
||||
H5B2test.c H5BP.c H5BPcache.c H5BPdbg.c H5BPtest.c \
|
||||
H5BT.c H5BTbtree2.c H5BTcache.c H5BTdbg.c H5BTtest.c H5C.c \
|
||||
H5D.c \
|
||||
|
@ -82,10 +82,10 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(settingsdir)" \
|
||||
libLTLIBRARIES_INSTALL = $(INSTALL)
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libhdf5_la_LIBADD =
|
||||
am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5B2.lo \
|
||||
H5B2cache.lo H5B2dbg.lo H5B2test.lo H5BP.lo H5BPcache.lo \
|
||||
H5BPdbg.lo H5BPtest.lo H5BT.lo H5BTbtree2.lo H5BTcache.lo \
|
||||
H5BTdbg.lo H5BTtest.lo H5C.lo H5D.lo H5Dcontig.lo \
|
||||
am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5Bcache.lo \
|
||||
H5B2.lo H5B2cache.lo H5B2dbg.lo H5B2test.lo H5BP.lo \
|
||||
H5BPcache.lo H5BPdbg.lo H5BPtest.lo H5BT.lo H5BTbtree2.lo \
|
||||
H5BTcache.lo H5BTdbg.lo H5BTtest.lo H5C.lo H5D.lo H5Dcontig.lo \
|
||||
H5Dcompact.lo H5Defl.lo H5Dio.lo H5Distore.lo H5Dmpio.lo \
|
||||
H5Dselect.lo H5Dtest.lo H5E.lo H5F.lo H5Fdbg.lo H5Fmount.lo \
|
||||
H5Fsfile.lo H5Fsuper.lo H5FD.lo H5FDcore.lo H5FDfamily.lo \
|
||||
@ -384,7 +384,8 @@ libhdf5_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT
|
||||
MOSTLYCLEANFILES = H5Tinit.c
|
||||
|
||||
# library sources
|
||||
libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
|
||||
libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5Bcache.c H5B2.c H5B2cache.c \
|
||||
H5B2dbg.c \
|
||||
H5B2test.c H5BP.c H5BPcache.c H5BPdbg.c H5BPtest.c \
|
||||
H5BT.c H5BTbtree2.c H5BTcache.c H5BTdbg.c H5BTtest.c H5C.c \
|
||||
H5D.c \
|
||||
@ -563,6 +564,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5BTcache.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5BTdbg.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5BTtest.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Bcache.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5C.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5D.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dcompact.Plo@am__quote@
|
||||
|
@ -34,7 +34,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
|
||||
# This gives them more time to run when tests are executing in parallel.
|
||||
TEST_PROG=testhdf5 lheap ohdr stab gheap btree2 cache b+tree blocktrack sheap \
|
||||
pool hyperslab istore bittests dt_arith \
|
||||
dtypes dsets cmpd_dset extend external links unlink big mtime \
|
||||
dtypes dsets cmpd_dset extend external objcopy links unlink big mtime \
|
||||
fillval mount flush1 flush2 enum \
|
||||
set_extent ttsafe stream_test \
|
||||
getname vfd ntypes dangle dtransform reserved
|
||||
@ -107,7 +107,8 @@ CHECK_CLEANFILES+=cmpd_dset.h5 compact_dataset.h5 dataset.h5 extend.h5 istore.h5
|
||||
family_file000[0-3][0-9].h5 multi_file-[rs].h5 core_file \
|
||||
new_move_[ab].h5 ntypes.h5 dangle.h5 error_test.h5 err_compat.h5 \
|
||||
dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \
|
||||
unlink_chunked.h5 btree2.h5 blocktrack.h5 sheap.h5 b+tree.h5
|
||||
unlink_chunked.h5 btree2.h5 blocktrack.h5 sheap.h5 b+tree.h5 \
|
||||
objcopy_src.h5 objcopy_dst.h5 objcopy_ext.dat
|
||||
|
||||
# Sources for testhdf5 executable
|
||||
testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tconfig.c tfile.c tgenprop.c \
|
||||
|
@ -31,7 +31,7 @@
|
||||
#
|
||||
|
||||
|
||||
SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c fillval.c flush1.c flush2.c gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c gen_new_mtime.c gen_new_super.c gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c pool.c reserved.c set_extent.c sheap.c space_overflow.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c
|
||||
SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c fillval.c flush1.c flush2.c gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c gen_new_mtime.c gen_new_super.c gen_noencoder.c gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c set_extent.c sheap.c space_overflow.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
@ -79,11 +79,11 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \
|
||||
pool$(EXEEXT) hyperslab$(EXEEXT) istore$(EXEEXT) \
|
||||
bittests$(EXEEXT) dt_arith$(EXEEXT) dtypes$(EXEEXT) \
|
||||
dsets$(EXEEXT) cmpd_dset$(EXEEXT) extend$(EXEEXT) \
|
||||
external$(EXEEXT) links$(EXEEXT) unlink$(EXEEXT) big$(EXEEXT) \
|
||||
mtime$(EXEEXT) fillval$(EXEEXT) mount$(EXEEXT) flush1$(EXEEXT) \
|
||||
flush2$(EXEEXT) enum$(EXEEXT) set_extent$(EXEEXT) \
|
||||
ttsafe$(EXEEXT) stream_test$(EXEEXT) getname$(EXEEXT) \
|
||||
vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \
|
||||
external$(EXEEXT) objcopy$(EXEEXT) links$(EXEEXT) \
|
||||
unlink$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) fillval$(EXEEXT) \
|
||||
mount$(EXEEXT) flush1$(EXEEXT) flush2$(EXEEXT) enum$(EXEEXT) \
|
||||
set_extent$(EXEEXT) ttsafe$(EXEEXT) stream_test$(EXEEXT) \
|
||||
getname$(EXEEXT) vfd$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \
|
||||
dtransform$(EXEEXT) reserved$(EXEEXT)
|
||||
@BUILD_ALL_CONDITIONAL_TRUE@am__EXEEXT_2 = gen_deflate$(EXEEXT) \
|
||||
@BUILD_ALL_CONDITIONAL_TRUE@ gen_filters$(EXEEXT) \
|
||||
@ -244,6 +244,10 @@ ntypes_SOURCES = ntypes.c
|
||||
ntypes_OBJECTS = ntypes.$(OBJEXT)
|
||||
ntypes_LDADD = $(LDADD)
|
||||
ntypes_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1)
|
||||
objcopy_SOURCES = objcopy.c
|
||||
objcopy_OBJECTS = objcopy.$(OBJEXT)
|
||||
objcopy_LDADD = $(LDADD)
|
||||
objcopy_DEPENDENCIES = libh5test.la $(am__DEPENDENCIES_1)
|
||||
ohdr_SOURCES = ohdr.c
|
||||
ohdr_OBJECTS = ohdr.$(OBJEXT)
|
||||
ohdr_LDADD = $(LDADD)
|
||||
@ -323,10 +327,10 @@ SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \
|
||||
gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c \
|
||||
gen_new_mtime.c gen_new_super.c gen_noencoder.c \
|
||||
gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c \
|
||||
links.c mount.c mtime.c ntypes.c ohdr.c pool.c reserved.c \
|
||||
set_extent.c sheap.c space_overflow.c stab.c stream_test.c \
|
||||
$(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \
|
||||
vfd.c
|
||||
links.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c \
|
||||
reserved.c set_extent.c sheap.c space_overflow.c stab.c \
|
||||
stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) \
|
||||
unlink.c vfd.c
|
||||
DIST_SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \
|
||||
blocktrack.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c \
|
||||
dt_arith.c dtransform.c dtypes.c enum.c err_compat.c \
|
||||
@ -334,10 +338,10 @@ DIST_SOURCES = $(libh5test_la_SOURCES) b+tree.c big.c bittests.c \
|
||||
gen_deflate.c gen_filters.c gen_new_array.c gen_new_fill.c \
|
||||
gen_new_mtime.c gen_new_super.c gen_noencoder.c \
|
||||
gen_nullspace.c getname.c gheap.c hyperslab.c istore.c lheap.c \
|
||||
links.c mount.c mtime.c ntypes.c ohdr.c pool.c reserved.c \
|
||||
set_extent.c sheap.c space_overflow.c stab.c stream_test.c \
|
||||
$(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \
|
||||
vfd.c
|
||||
links.c mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c \
|
||||
reserved.c set_extent.c sheap.c space_overflow.c stab.c \
|
||||
stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) \
|
||||
unlink.c vfd.c
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
@ -609,7 +613,7 @@ SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
|
||||
# This gives them more time to run when tests are executing in parallel.
|
||||
TEST_PROG = testhdf5 lheap ohdr stab gheap btree2 cache b+tree blocktrack sheap \
|
||||
pool hyperslab istore bittests dt_arith \
|
||||
dtypes dsets cmpd_dset extend external links unlink big mtime \
|
||||
dtypes dsets cmpd_dset extend external objcopy links unlink big mtime \
|
||||
fillval mount flush1 flush2 enum \
|
||||
set_extent ttsafe stream_test \
|
||||
getname vfd ntypes dangle dtransform reserved
|
||||
@ -831,6 +835,9 @@ mtime$(EXEEXT): $(mtime_OBJECTS) $(mtime_DEPENDENCIES)
|
||||
ntypes$(EXEEXT): $(ntypes_OBJECTS) $(ntypes_DEPENDENCIES)
|
||||
@rm -f ntypes$(EXEEXT)
|
||||
$(LINK) $(ntypes_LDFLAGS) $(ntypes_OBJECTS) $(ntypes_LDADD) $(LIBS)
|
||||
objcopy$(EXEEXT): $(objcopy_OBJECTS) $(objcopy_DEPENDENCIES)
|
||||
@rm -f objcopy$(EXEEXT)
|
||||
$(LINK) $(objcopy_LDFLAGS) $(objcopy_OBJECTS) $(objcopy_LDADD) $(LIBS)
|
||||
ohdr$(EXEEXT): $(ohdr_OBJECTS) $(ohdr_DEPENDENCIES)
|
||||
@rm -f ohdr$(EXEEXT)
|
||||
$(LINK) $(ohdr_LDFLAGS) $(ohdr_OBJECTS) $(ohdr_LDADD) $(LIBS)
|
||||
@ -915,6 +922,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mount.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtime.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntypes.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/objcopy.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ohdr.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pool.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reserved.Po@am__quote@
|
||||
|
3350
test/objcopy.c
Executable file
3350
test/objcopy.c
Executable file
File diff suppressed because it is too large
Load Diff
518
test/th5s.c
518
test/th5s.c
@ -1043,6 +1043,522 @@ test_h5s_chunk(void)
|
||||
} /* end for */
|
||||
} /* test_h5s_chunk() */
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_h5s_extent_equal(): Exercise extent comparison code
|
||||
**
|
||||
****************************************************************/
|
||||
static void
|
||||
test_h5s_extent_equal(void)
|
||||
{
|
||||
hid_t null_space; /* Null dataspace */
|
||||
hid_t scalar_space; /* Scalar dataspace */
|
||||
hid_t d1_space1, d1_space2, d1_space3, d1_space4; /* 1-D dataspaces */
|
||||
hid_t d2_space1, d2_space2, d2_space3, d2_space4; /* 2-D dataspaces */
|
||||
hid_t d3_space1, d3_space2, d3_space3, d3_space4; /* 3-D dataspaces */
|
||||
hsize_t d1_dims1[1] = {10}, /* 1-D dimensions */
|
||||
d1_dims2[1] = {20},
|
||||
d1_dims3[1] = {H5S_UNLIMITED};
|
||||
hsize_t d2_dims1[2] = {10, 10}, /* 2-D dimensions */
|
||||
d2_dims2[2] = {20, 20},
|
||||
d2_dims3[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
|
||||
hsize_t d3_dims1[3] = {10, 10, 10}, /* 3-D dimensions */
|
||||
d3_dims2[3] = {20, 20, 20},
|
||||
d3_dims3[3] = {H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED};
|
||||
htri_t ext_equal; /* Whether two dataspace extents are equal */
|
||||
herr_t ret; /* Generic error return */
|
||||
|
||||
/* Create dataspaces */
|
||||
null_space = H5Screate(H5S_NULL);
|
||||
CHECK(null_space, FAIL, "H5Screate");
|
||||
|
||||
scalar_space = H5Screate(H5S_SCALAR);
|
||||
CHECK(scalar_space, FAIL, "H5Screate");
|
||||
|
||||
d1_space1 = H5Screate_simple(1, d1_dims1, NULL);
|
||||
CHECK(d1_space1, FAIL, "H5Screate");
|
||||
d1_space2 = H5Screate_simple(1, d1_dims2, NULL);
|
||||
CHECK(d1_space2, FAIL, "H5Screate");
|
||||
d1_space3 = H5Screate_simple(1, d1_dims1, d1_dims2);
|
||||
CHECK(d1_space3, FAIL, "H5Screate");
|
||||
d1_space4 = H5Screate_simple(1, d1_dims1, d1_dims3);
|
||||
CHECK(d1_space4, FAIL, "H5Screate");
|
||||
|
||||
d2_space1 = H5Screate_simple(2, d2_dims1, NULL);
|
||||
CHECK(d2_space1, FAIL, "H5Screate");
|
||||
d2_space2 = H5Screate_simple(2, d2_dims2, NULL);
|
||||
CHECK(d2_space2, FAIL, "H5Screate");
|
||||
d2_space3 = H5Screate_simple(2, d2_dims1, d2_dims2);
|
||||
CHECK(d2_space3, FAIL, "H5Screate");
|
||||
d2_space4 = H5Screate_simple(2, d2_dims1, d2_dims3);
|
||||
CHECK(d2_space4, FAIL, "H5Screate");
|
||||
|
||||
d3_space1 = H5Screate_simple(3, d3_dims1, NULL);
|
||||
CHECK(d3_space1, FAIL, "H5Screate");
|
||||
d3_space2 = H5Screate_simple(3, d3_dims2, NULL);
|
||||
CHECK(d3_space2, FAIL, "H5Screate");
|
||||
d3_space3 = H5Screate_simple(3, d3_dims1, d3_dims2);
|
||||
CHECK(d3_space3, FAIL, "H5Screate");
|
||||
d3_space4 = H5Screate_simple(3, d3_dims1, d3_dims3);
|
||||
CHECK(d3_space4, FAIL, "H5Screate");
|
||||
|
||||
/* Compare all dataspace combinations */
|
||||
|
||||
/* Compare null dataspace against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(null_space, null_space);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(null_space, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare scalar dataspace against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(scalar_space, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, scalar_space);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(scalar_space, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare small 1-D dataspace w/no max. dims against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(d1_space1, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, d1_space1);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space1, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare larger 1-D dataspace w/no max. dims against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(d1_space2, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, d1_space2);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space2, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare small 1-D dataspace w/fixed max. dims against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(d1_space3, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, d1_space3);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space3, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare small 1-D dataspace w/unlimited max. dims against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(d1_space4, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, d1_space4);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d1_space4, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare small 2-D dataspace w/no max. dims against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(d2_space1, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, d2_space1);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space1, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare larger 2-D dataspace w/no max. dims against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(d2_space2, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, d2_space2);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space2, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare small 2-D dataspace w/fixed max. dims against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(d2_space3, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, d2_space3);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space3, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare small 2-D dataspace w/unlimited max. dims against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(d2_space4, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, d2_space4);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d2_space4, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare small 3-D dataspace w/no max. dims against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(d3_space1, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, d3_space1);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space1, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare larger 2-D dataspace w/no max. dims against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(d3_space2, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, d3_space2);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space2, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare small 2-D dataspace w/fixed max. dims against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(d3_space3, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, d3_space3);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space3, d3_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
|
||||
/* Compare small 2-D dataspace w/unlimited max. dims against all others, including itself */
|
||||
ext_equal = H5Sextent_equal(d3_space4, null_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, scalar_space);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, d1_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, d1_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, d1_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, d1_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, d2_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, d2_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, d2_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, d2_space4);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, d3_space1);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, d3_space2);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, d3_space3);
|
||||
VERIFY(ext_equal, FALSE, "H5Sextent_equal");
|
||||
ext_equal = H5Sextent_equal(d3_space4, d3_space4);
|
||||
VERIFY(ext_equal, TRUE, "H5Sextent_equal");
|
||||
|
||||
/* Close dataspaces */
|
||||
ret = H5Sclose(null_space);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
|
||||
ret = H5Sclose(scalar_space);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
|
||||
ret = H5Sclose(d1_space1);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
ret = H5Sclose(d1_space2);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
ret = H5Sclose(d1_space3);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
ret = H5Sclose(d1_space4);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
|
||||
ret = H5Sclose(d2_space1);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
ret = H5Sclose(d2_space2);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
ret = H5Sclose(d2_space3);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
ret = H5Sclose(d2_space4);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
|
||||
ret = H5Sclose(d3_space1);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
ret = H5Sclose(d3_space2);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
ret = H5Sclose(d3_space3);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
ret = H5Sclose(d3_space4);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
} /* test_h5s_extent_equal() */
|
||||
|
||||
/****************************************************************
|
||||
**
|
||||
** test_h5s(): Main H5S (dataspace) testing routine.
|
||||
@ -1065,6 +1581,8 @@ test_h5s(void)
|
||||
|
||||
/* This test was added later to exercise a bug in chunked I/O */
|
||||
test_h5s_chunk(); /* Exercise bug fix for chunked I/O */
|
||||
|
||||
test_h5s_extent_equal(); /* Test extent comparison code */
|
||||
} /* test_h5s() */
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user