summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-08-12 18:13:27 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-08-12 18:13:27 (GMT)
commitc85063bfad5a6ca624afe59be8cf26c241523eeb (patch)
tree835a2a8ed752ec5c13d985afb25c76b89b35573d /src
parent5112232ddf96f7b8b7dca86ce91dc05f3470c682 (diff)
downloadhdf5-c85063bfad5a6ca624afe59be8cf26c241523eeb.zip
hdf5-c85063bfad5a6ca624afe59be8cf26c241523eeb.tar.gz
hdf5-c85063bfad5a6ca624afe59be8cf26c241523eeb.tar.bz2
[svn-r5872] Purpose:
Code cleanup Description: Move get/set routines for each type of property list (file creation, dataset creation, file access and dataset transfer) into their own source code module. Platforms tested: FreeBSD 4.6 (sleipnir)
Diffstat (limited to 'src')
-rw-r--r--src/H5P.c3676
-rw-r--r--src/H5Pdcpl.c1172
-rw-r--r--src/H5Pdxpl.c750
-rw-r--r--src/H5Pfapl.c1287
-rw-r--r--src/H5Pfcpl.c609
-rw-r--r--src/Makefile.in7
6 files changed, 3822 insertions, 3679 deletions
diff --git a/src/H5P.c b/src/H5P.c
index eb63276..bfa1fe7 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -16,19 +16,13 @@
/* Private header files */
#include "H5private.h" /* Generic Functions */
-#include "H5Bprivate.h" /* B-tree subclass names */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Ppkg.h" /* Property lists */
-/* Default file driver - see H5Pget_driver() */
-#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */
-
/* Pablo mask */
#define PABLO_MASK H5P_mask
@@ -580,3676 +574,6 @@ done:
} /* H5Pcopy() */
-/*-------------------------------------------------------------------------
- * Function: H5Pget_version
- *
- * Purpose: Retrieves version information for various parts of a file.
- *
- * BOOT: The file boot block.
- * HEAP: The global heap.
- * FREELIST: The global free list.
- * STAB: The root symbol table entry.
- * SHHDR: Shared object headers.
- *
- * Any (or even all) of the output arguments can be null
- * pointers.
- *
- * Return: Success: Non-negative, version information is returned
- * through the arguments.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Change to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_version(hid_t plist_id, int *boot/*out*/, int *freelist/*out*/,
- int *stab/*out*/, int *shhdr/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pget_version, FAIL);
- H5TRACE5("e","ixxxx",plist_id,boot,freelist,stab,shhdr);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if (boot)
- if(H5P_get(plist, H5F_CRT_BOOT_VERS_NAME, boot) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get boot version");
- if (freelist)
- if(H5P_get(plist, H5F_CRT_FREESPACE_VERS_NAME, freelist) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space version");
- if (stab)
- if(H5P_get(plist, H5F_CRT_OBJ_DIR_VERS_NAME, stab) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object directory version");
- if (shhdr)
- if(H5P_get(plist, H5F_CRT_SHARE_HEAD_VERS_NAME, shhdr) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get shared-header version");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_userblock
- *
- * Purpose: Sets the userblock size field of a file creation property
- * list.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, January 6, 1998
- *
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_userblock(hid_t plist_id, hsize_t size)
-{
- unsigned i;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_userblock, FAIL);
- H5TRACE2("e","ih",plist_id,size);
-
- /* Check that the userblock size is a power of two */
- for (i=8; i<8*sizeof(hsize_t); i++) {
- hsize_t p2 = 8==i ? 0 : ((hsize_t)1<<i);
-
- if (size == p2)
- break;
- }
- if (i>=8*sizeof(hsize_t))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "userblock size is not valid");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set value */
- if(H5P_set(plist, H5F_CRT_USER_BLOCK_NAME, &size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set user block");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_userblock
- *
- * Purpose: Queries the size of a user block in a file creation property
- * list.
- *
- * Return: Success: Non-negative, size returned through SIZE argument.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_userblock(hid_t plist_id, hsize_t *size)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_userblock, FAIL);
- H5TRACE2("e","i*h",plist_id,size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get value */
- if (size)
- if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,"can't get user block");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_alignment
- *
- * Purpose: Sets the alignment properties of a file access property list
- * so that any file object >= THRESHOLD bytes will be aligned on
- * an address which is a multiple of ALIGNMENT. The addresses
- * are relative to the end of the user block; the alignment is
- * calculated by subtracting the user block size from the
- * absolute file address and then adjusting the address to be a
- * multiple of ALIGNMENT.
- *
- * Default values for THRESHOLD and ALIGNMENT are one, implying
- * no alignment. Generally the default values will result in
- * the best performance for single-process access to the file.
- * For MPI-IO and other parallel systems, choose an alignment
- * which is a multiple of the disk block size.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, June 9, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed file access property list mechanism to the new
- * generic property list.
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_alignment, FAIL);
- H5TRACE3("e","ihh",fapl_id,threshold,alignment);
-
- /* Check args */
- if (alignment<1)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "alignment must be positive");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if(H5P_set(plist, H5F_ACS_ALIGN_THRHD_NAME, &threshold) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set threshold");
- if(H5P_set(plist, H5F_ACS_ALIGN_NAME, &alignment) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_alignment
- *
- * Purpose: Returns the current settings for alignment properties from a
- * file access property list. The THRESHOLD and/or ALIGNMENT
- * pointers may be null pointers.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, June 9, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_alignment(hid_t fapl_id, hsize_t *threshold/*out*/,
- hsize_t *alignment/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pget_alignment, FAIL);
- H5TRACE3("e","ixx",fapl_id,threshold,alignment);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if (threshold)
- if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, threshold) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get threshold");
- if (alignment)
- if(H5P_get(plist, H5F_ACS_ALIGN_NAME, alignment) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_sizes
- *
- * Purpose: Sets file size-of addresses and sizes. PLIST_ID should be a
- * file creation property list. A value of zero causes the
- * property to not change.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, January 6, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_sizes, FAIL);
- H5TRACE3("e","izz",plist_id,sizeof_addr,sizeof_size);
-
- /* Check arguments */
- if (sizeof_addr) {
- if (sizeof_addr != 2 && sizeof_addr != 4 &&
- sizeof_addr != 8 && sizeof_addr != 16)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file haddr_t size is not valid");
- }
- if (sizeof_size) {
- if (sizeof_size != 2 && sizeof_size != 4 &&
- sizeof_size != 8 && sizeof_size != 16)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file size_t size is not valid");
- }
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set value */
- if (sizeof_addr)
- if(H5P_set(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &sizeof_addr) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for an address");
- if (sizeof_size)
- if(H5P_set(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &sizeof_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for object ");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_sizes
- *
- * Purpose: Returns the size of address and size quantities stored in a
- * file according to a file creation property list. Either (or
- * even both) SIZEOF_ADDR and SIZEOF_SIZE may be null pointers.
- *
- * Return: Success: Non-negative, sizes returned through arguments.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_sizes(hid_t plist_id,
- size_t *sizeof_addr /*out */ , size_t *sizeof_size /*out */ )
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_sizes, FAIL);
- H5TRACE3("e","ixx",plist_id,sizeof_addr,sizeof_size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if (sizeof_addr)
- if(H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, sizeof_addr) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for an address");
- if (sizeof_size)
- if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, sizeof_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for object ");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-#ifdef H5_WANT_H5_V1_4_COMPAT
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_sym_k
- *
- * Purpose: IK is one half the rank of a tree that stores a symbol
- * table for a group. Internal nodes of the symbol table are on
- * average 75% full. That is, the average rank of the tree is
- * 1.5 times the value of IK.
- *
- * LK is one half of the number of symbols that can be stored in
- * a symbol table node. A symbol table node is the leaf of a
- * symbol table tree which is used to store a group. When
- * symbols are inserted randomly into a group, the group's
- * symbol table nodes are 75% full on average. That is, they
- * contain 1.5 times the number of symbols specified by LK.
- *
- * Either (or even both) of IK and LK can be zero in which case
- * that value is left unchanged.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, January 6, 1998
- *
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_sym_k(hid_t plist_id, int ik, int lk)
-{
- int btree_k[H5B_NUM_BTREE_ID];
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pset_sym_k, FAIL);
- H5TRACE3("e","iIsIs",plist_id,ik,lk);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if (ik > 0) {
- if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes");
- btree_k[H5B_SNODE_ID] = ik;
- if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree nodes");
- }
- if (lk > 0)
- if(H5P_set(plist, H5F_CRT_SYM_LEAF_NAME, &lk) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for symbol table leaf nodes");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_sym_k
- *
- * Purpose: Retrieves the symbol table B-tree 1/2 rank (IK) and the
- * symbol table leaf node 1/2 size (LK). See H5Pset_sym_k() for
- * details. Either (or even both) IK and LK may be null
- * pointers.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_sym_k(hid_t plist_id, int *ik /*out */ , int *lk /*out */ )
-{
- int btree_k[H5B_NUM_BTREE_ID];
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pget_sym_k, FAIL);
- H5TRACE3("e","ixx",plist_id,ik,lk);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if (ik) {
- if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree nodes");
- *ik = btree_k[H5B_SNODE_ID];
- }
- if (lk)
- if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, lk) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for symbol table leaf nodes");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-#else /* H5_WANT_H5_V1_4_COMPAT */
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_sym_k
- *
- * Purpose: IK is one half the rank of a tree that stores a symbol
- * table for a group. Internal nodes of the symbol table are on
- * average 75% full. That is, the average rank of the tree is
- * 1.5 times the value of IK.
- *
- * LK is one half of the number of symbols that can be stored in
- * a symbol table node. A symbol table node is the leaf of a
- * symbol table tree which is used to store a group. When
- * symbols are inserted randomly into a group, the group's
- * symbol table nodes are 75% full on average. That is, they
- * contain 1.5 times the number of symbols specified by LK.
- *
- * Either (or even both) of IK and LK can be zero in which case
- * that value is left unchanged.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, January 6, 1998
- *
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_sym_k(hid_t plist_id, int ik, unsigned lk)
-{
- int btree_k[H5B_NUM_BTREE_ID];
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pset_sym_k, FAIL);
- H5TRACE3("e","iIsIu",plist_id,ik,lk);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if (ik > 0) {
- if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes");
- btree_k[H5B_SNODE_ID] = ik;
- if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree nodes");
- }
- if (lk > 0)
- if(H5P_set(plist, H5F_CRT_SYM_LEAF_NAME, &lk) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for symbol table leaf nodes");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_sym_k
- *
- * Purpose: Retrieves the symbol table B-tree 1/2 rank (IK) and the
- * symbol table leaf node 1/2 size (LK). See H5Pset_sym_k() for
- * details. Either (or even both) IK and LK may be null
- * pointers.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_sym_k(hid_t plist_id, int *ik /*out */ , unsigned *lk /*out */ )
-{
- int btree_k[H5B_NUM_BTREE_ID];
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pget_sym_k, FAIL);
- H5TRACE3("e","ixx",plist_id,ik,lk);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if (ik) {
- if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree nodes");
- *ik = btree_k[H5B_SNODE_ID];
- }
- if (lk)
- if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, lk) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for symbol table leaf nodes");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-#endif /* H5_WANT_H5_V1_4_COMPAT */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_istore_k
- *
- * Purpose: IK is one half the rank of a tree that stores chunked raw
- * data. On average, such a tree will be 75% full, or have an
- * average rank of 1.5 times the value of IK.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, January 6, 1998
- *
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_istore_k(hid_t plist_id, int ik)
-{
- int btree_k[H5B_NUM_BTREE_ID];
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pset_istore_k, FAIL);
- H5TRACE2("e","iIs",plist_id,ik);
-
- /* Check arguments */
- if (ik <= 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value must be positive");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set value */
- if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes");
- btree_k[H5B_ISTORE_ID] = ik;
- if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree interanl nodes");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_istore_k
- *
- * Purpose: Queries the 1/2 rank of an indexed storage B-tree. See
- * H5Pset_istore_k() for details. The argument IK may be the
- * null pointer.
- *
- * Return: Success: Non-negative, size returned through IK
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
- *
- * Raymond Lu, Oct 14, 2001
- * Changed to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_istore_k(hid_t plist_id, int *ik /*out */ )
-{
- int btree_k[H5B_NUM_BTREE_ID];
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_istore_k, FAIL);
- H5TRACE2("e","ix",plist_id,ik);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get value */
- if (ik) {
- if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes");
- *ik = btree_k[H5B_ISTORE_ID];
- }
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_layout
- *
- * Purpose: Sets the layout of raw data in the file.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, January 6, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and set property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_layout(hid_t plist_id, H5D_layout_t layout)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_layout, FAIL);
- H5TRACE2("e","iDl",plist_id,layout);
-
- /* Check arguments */
- if (layout < 0 || layout >= H5D_NLAYOUTS)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "raw data layout method is not valid");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set value */
- if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_layout
- *
- * Purpose: Retrieves layout type of a dataset creation property list.
- *
- * Return: Success: The layout type
- *
- * Failure: H5D_LAYOUT_ERROR (negative)
- *
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and get property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-H5D_layout_t
-H5Pget_layout(hid_t plist_id)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- H5D_layout_t ret_value=H5D_LAYOUT_ERROR;
-
- FUNC_ENTER_API(H5Pget_layout, H5D_LAYOUT_ERROR);
- H5TRACE1("Dl","i",plist_id);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5D_LAYOUT_ERROR, "can't find object for ID");
-
- /* Get value */
- if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &ret_value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5D_LAYOUT_ERROR, "can't get layout");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_chunk
- *
- * Purpose: Sets the number of dimensions and the size of each chunk to
- * the values specified. The dimensionality of the chunk should
- * match the dimensionality of the data space.
- *
- * As a side effect, the layout method is changed to
- * H5D_CHUNKED.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, January 6, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and set property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
-{
- int i;
- hsize_t real_dims[H5O_LAYOUT_NDIMS]; /* Full-sized array to hold chunk dims */
- H5D_layout_t layout;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_chunk, FAIL);
- H5TRACE3("e","iIs*[a1]h",plist_id,ndims,dim);
-
- /* Check arguments */
- if (ndims <= 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk dimensionality must be positive");
- if (ndims > H5S_MAX_RANK)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk dimensionality is too large");
- if (!dim)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no chunk dimensions specified");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Initialize chunk dims to 0s */
- HDmemset(real_dims,0,H5O_LAYOUT_NDIMS*sizeof(hsize_t));
- for (i=0; i<ndims; i++) {
- if (dim[i] <= 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be positive");
- real_dims[i]=dim[i]; /* Store user's chunk dimensions */
- }
-
- layout = H5D_CHUNKED;
- if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout");
- if(H5P_set(plist, H5D_CRT_CHUNK_DIM_NAME, &ndims) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set chunk dimensionanlity");
- if(H5P_set(plist, H5D_CRT_CHUNK_SIZE_NAME, real_dims) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set chunk size");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_chunk
- *
- * Purpose: Retrieves the chunk size of chunked layout. The chunk
- * dimensionality is returned and the chunk size in each
- * dimension is returned through the DIM argument. At most
- * MAX_NDIMS elements of DIM will be initialized.
- *
- * Return: Success: Positive Chunk dimensionality.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Wednesday, January 7, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and set property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-int
-H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/)
-{
- int i;
- int ndims;
- H5D_layout_t layout;
- hsize_t chunk_size[32];
- H5P_genplist_t *plist; /* Property list pointer */
- int ret_value;
-
- FUNC_ENTER_API(H5Pget_chunk, FAIL);
- H5TRACE3("Is","iIsx",plist_id,max_ndims,dim);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout");
- if(H5D_CHUNKED != layout)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout");
-
- if(H5P_get(plist, H5D_CRT_CHUNK_SIZE_NAME, chunk_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get chunk size");
- if(H5P_get(plist, H5D_CRT_CHUNK_DIM_NAME, &ndims) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get chunk dimensionality");
-
- /* Get the dimension sizes */
- for (i=0; i<ndims && i<max_ndims && dim; i++)
- dim[i] = chunk_size[i];
-
- /* Set the return value */
- ret_value=ndims;
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_external
- *
- * Purpose: Adds an external file to the list of external files. PLIST_ID
- * should be an object ID for a dataset creation property list.
- * NAME is the name of an external file, OFFSET is the location
- * where the data starts in that file, and SIZE is the number of
- * bytes reserved in the file for the data.
- *
- * If a dataset is split across multiple files then the files
- * should be defined in order. The total size of the dataset is
- * the sum of the SIZE arguments for all the external files. If
- * the total size is larger than the size of a dataset then the
- * dataset can be extended (provided the data space also allows
- * the extending).
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, March 3, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and set property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size)
-{
- int idx;
- hsize_t total, tmp;
- H5O_efl_t efl;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pset_external, FAIL);
- H5TRACE4("e","isoh",plist_id,name,offset,size);
-
- /* Check arguments */
- if (!name || !*name)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given");
- if (offset<0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "negative external file offset");
- if (size<=0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "zero size");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list");
- if(efl.nused > 0 && H5O_EFL_UNLIMITED==efl.slot[efl.nused-1].size)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "previous file size is unlimited");
-
- if (H5O_EFL_UNLIMITED!=size) {
- for (idx=0, total=size; idx<efl.nused; idx++, total=tmp) {
- tmp = total + efl.slot[idx].size;
- if (tmp <= total)
- HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "total external data size overflowed");
- } /* end for */
- } /* end if */
-
-
- /* Add to the list */
- if (efl.nused >= efl.nalloc) {
- int na = efl.nalloc + H5O_EFL_ALLOC;
- H5O_efl_entry_t *x = H5MM_realloc (efl.slot, na*sizeof(H5O_efl_entry_t));
-
- if (!x)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
- efl.nalloc = na;
- efl.slot = x;
- }
- idx = efl.nused;
- efl.slot[idx].name_offset = 0; /*not entered into heap yet*/
- efl.slot[idx].name = H5MM_xstrdup (name);
- efl.slot[idx].offset = offset;
- efl.slot[idx].size = size;
- efl.nused++;
-
- if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set external file list");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_external_count
- *
- * Purpose: Returns the number of external files for this dataset.
- *
- * Return: Success: Number of external files
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Tuesday, March 3, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and set property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-int
-H5Pget_external_count(hid_t plist_id)
-{
- H5O_efl_t efl;
- H5P_genplist_t *plist; /* Property list pointer */
- int ret_value; /* return value */
-
- FUNC_ENTER_API(H5Pget_external_count, FAIL);
- H5TRACE1("Is","i",plist_id);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get value */
- if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list");
-
- /* Set return value */
- ret_value=efl.nused;
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_external
- *
- * Purpose: Returns information about an external file. External files
- * are numbered from zero to N-1 where N is the value returned
- * by H5Pget_external_count(). At most NAME_SIZE characters are
- * copied into the NAME array. If the external file name is
- * longer than NAME_SIZE with the null terminator, then the
- * return value is not null terminated (similar to strncpy()).
- *
- * If NAME_SIZE is zero or NAME is the null pointer then the
- * external file name is not returned. If OFFSET or SIZE are
- * null pointers then the corresponding information is not
- * returned.
- *
- * See Also: H5Pset_external()
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, March 3, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and get property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_external(hid_t plist_id, int idx, size_t name_size, char *name/*out*/,
- off_t *offset/*out*/, hsize_t *size/*out*/)
-{
- H5O_efl_t efl;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_external, FAIL);
- H5TRACE6("e","iIszxxx",plist_id,idx,name_size,name,offset,size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get value */
- if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list");
-
- if (idx<0 || idx>=efl.nused)
- HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range");
-
- /* Return values */
- if (name_size>0 && name)
- HDstrncpy (name, efl.slot[idx].name, name_size);
- if (offset)
- *offset = efl.slot[idx].offset;
- if (size)
- *size = efl.slot[idx].size;
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P_set_driver
- *
- * Purpose: Set the file driver (DRIVER_ID) for a file access or data
- * transfer property list (PLIST_ID) and supply an optional
- * struct containing the driver-specific properites
- * (DRIVER_INFO). The driver properties will be copied into the
- * property list and the reference count on the driver will be
- * incremented, allowing the caller to close the driver ID but
- * still use the property list.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Tuesday, August 3, 1999
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info)
-{
- hid_t driver_id; /* VFL driver ID */
- void *driver_info; /* VFL driver info */
- void *tmp_driver_info; /* Temporary VFL driver info */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5P_set_driver, FAIL);
-
- if (NULL==H5I_object_verify(new_driver_id, H5I_VFL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID");
-
- if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
- /* Remove old driver */
- if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID");
- if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,"can't get driver info");
- assert(driver_id>=0);
- H5FD_fapl_free(driver_id, driver_info);
- H5I_dec_ref(driver_id);
-
- /* Add new driver */
- H5I_inc_ref(new_driver_id);
- driver_id = new_driver_id;
- driver_info = H5FD_fapl_copy(new_driver_id, new_driver_info);
-
- if(H5P_set(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver ID");
- if(H5P_set(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't set driver info");
-
- } else if( TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER) ) {
- /* Get the current driver information */
- if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
- if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
-
- /* Remove old driver */
-
- /* Double-check value... */
- assert(driver_id>=0);
-
- /* Free any driver information stored */
- H5FD_dxpl_free(driver_id, driver_info);
-
- /* Decrement reference count for old driver */
- H5I_dec_ref(driver_id);
-
- /* Add new driver */
-
- /* Increment reference count for new driver */
- H5I_inc_ref(new_driver_id);
-
- /* Make a copy of the driver information */
- if((tmp_driver_info = H5FD_dxpl_copy(new_driver_id, new_driver_info))==NULL)
- HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, FAIL, "Can't copy VFL driver");
-
- /* Set the driver info for the property list */
- if(H5P_set(plist, H5D_XFER_VFL_ID_NAME, &new_driver_id)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver ID");
- if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &tmp_driver_info) < 0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver info");
-
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list");
- }
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5P_set_driver() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_driver
- *
- * Purpose: Set the file driver (DRIVER_ID) for a file access or data
- * transfer property list (PLIST_ID) and supply an optional
- * struct containing the driver-specific properites
- * (DRIVER_INFO). The driver properties will be copied into the
- * property list and the reference count on the driver will be
- * incremented, allowing the caller to close the driver ID but
- * still use the property list.
- *
- * Return: Success: Non-negative
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Tuesday, August 3, 1999
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* Return value */
-
- FUNC_ENTER_API(H5Pset_driver, FAIL);
- H5TRACE3("e","iix",plist_id,new_driver_id,new_driver_info);
-
- /* Check arguments */
- if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
- if (NULL==H5I_object_verify(new_driver_id, H5I_VFL))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID");
-
- /* Set the driver */
- if(H5P_set_driver(plist,new_driver_id,new_driver_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info");
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5Pset_driver() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P_get_driver
- *
- * Purpose: Return the ID of the low-level file driver. PLIST_ID should
- * be a file access property list or data transfer propert list.
- *
- * Return: Success: A low-level driver ID which is the same ID
- * used when the driver was set for the property
- * list. The driver ID is only valid as long as
- * the file driver remains registered.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Thursday, February 26, 1998
- *
- * Modifications:
- * Robb Matzke, 1999-08-03
- * Rewritten to use the virtual file layer.
- *
- * Robb Matzke, 1999-08-05
- * If the driver ID is H5FD_VFD_DEFAULT then substitute the
- * current value of H5FD_SEC2.
- *
- * Quincey Koziol 2000-11-28
- * Added internal function..
- *
- * Raymond Lu, 2001-10-23
- * Changed the file access list design to the new generic
- * property list.
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5P_get_driver(H5P_genplist_t *plist)
-{
- hid_t ret_value=FAIL; /* Return value */
-
- FUNC_ENTER_NOAPI(H5P_get_driver, FAIL);
-
- /* Get the current driver ID */
- if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
- if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &ret_value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID");
- } else if( TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER) ) {
- if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &ret_value)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list");
- }
-
- if (H5FD_VFD_DEFAULT==ret_value)
- ret_value = H5FD_SEC2;
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_driver
- *
- * Purpose: Return the ID of the low-level file driver. PLIST_ID should
- * be a file access property list or data transfer propert list.
- *
- * Return: Success: A low-level driver ID which is the same ID
- * used when the driver was set for the property
- * list. The driver ID is only valid as long as
- * the file driver remains registered.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Thursday, February 26, 1998
- *
- * Modifications:
- * Robb Matzke, 1999-08-03
- * Rewritten to use the virtual file layer.
- *
- * Robb Matzke, 1999-08-05
- * If the driver ID is H5FD_VFD_DEFAULT then substitute the current value of
- * H5FD_SEC2.
- *
- * Quincey Koziol 2000-11-28
- * Added internal function..
- *-------------------------------------------------------------------------
- */
-hid_t
-H5Pget_driver(hid_t plist_id)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- hid_t ret_value; /* Return value */
-
- FUNC_ENTER_API(H5Pget_driver, FAIL);
- H5TRACE1("i","i",plist_id);
-
- if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
-
- ret_value = H5P_get_driver(plist);
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P_get_driver_info
- *
- * Purpose: Returns a pointer directly to the file driver-specific
- * information of a file access or data transfer property list.
- *
- * Return: Success: Ptr to *uncopied* driver specific data
- * structure if any.
- *
- * Failure: NULL. Null is also returned if the driver has
- * not registered any driver-specific properties
- * although no error is pushed on the stack in
- * this case.
- *
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5P_get_driver_info(H5P_genplist_t *plist)
-{
- void *ret_value=NULL;
-
- FUNC_ENTER_NOAPI(H5P_get_driver_info, NULL);
-
- /* Get the current driver info */
- if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
- if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &ret_value) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,NULL,"can't get driver info");
- } else if( TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER) ) {
- if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &ret_value)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, NULL, "Can't retrieve VFL driver ID");
- } else {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access or data transfer property list");
- }
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5P_get_driver_info() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_driver_info
- *
- * Purpose: Returns a pointer directly to the file driver-specific
- * information of a file access or data transfer property list.
- *
- * Return: Success: Ptr to *uncopied* driver specific data
- * structure if any.
- *
- * Failure: NULL. Null is also returned if the driver has
- * not registered any driver-specific properties
- * although no error is pushed on the stack in
- * this case.
- *
- * Programmer: Robb Matzke
- * Wednesday, August 4, 1999
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list design to the new generic
- * property list.
- *
- *-------------------------------------------------------------------------
- */
-void *
-H5Pget_driver_info(hid_t plist_id)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- void *ret_value; /* Return value */
-
- FUNC_ENTER_API(H5Pget_driver_info, NULL);
-
- if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list");
-
- if((ret_value=H5P_get_driver_info(plist))==NULL)
- HGOTO_ERROR(H5E_PLIST,H5E_CANTGET,NULL,"can't get driver info");
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5Pget_driver_info() */
-
-#ifdef H5_WANT_H5_V1_4_COMPAT
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_cache
- *
- * Purpose: Set the number of objects in the meta data cache and the
- * maximum number of chunks and bytes in the raw data chunk
- * cache.
- *
- * The RDCC_W0 value should be between 0 and 1 inclusive and
- * indicates how much chunks that have been fully read or fully
- * written are favored for preemption. A value of zero means
- * fully read or written chunks are treated no differently than
- * other chunks (the preemption is strictly LRU) while a value
- * of one means fully read chunks are always preempted before
- * other chunks.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, May 19, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_cache(hid_t plist_id, int mdc_nelmts,
- int _rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- size_t rdcc_nelmts=(size_t)_rdcc_nelmts; /* Work around variable changing size */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_cache, FAIL);
- H5TRACE5("e","iIsIszd",plist_id,mdc_nelmts,_rdcc_nelmts,rdcc_nbytes,
- rdcc_w0);
-
- /* Check arguments */
- if (mdc_nelmts<0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "meta data cache size must be non-negative");
- if (rdcc_w0<0.0 || rdcc_w0>1.0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set sizes */
- if(H5P_set(plist, H5F_ACS_META_CACHE_SIZE_NAME, &mdc_nelmts) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set meta data cache size");
- if(H5P_set(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &rdcc_nelmts) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache element size");
- if(H5P_set(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache byte size");
- if(H5P_set(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set preempt read chunks");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_cache
- *
- * Purpose: Retrieves the maximum possible number of elements in the meta
- * data cache and the maximum possible number of elements and
- * bytes and the RDCC_W0 value in the raw data chunk cache. Any
- * (or all) arguments may be null pointers in which case the
- * corresponding datum is not returned.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, May 19, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property
- * list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_cache(hid_t plist_id, int *mdc_nelmts,
- int *_rdcc_nelmts, size_t *rdcc_nbytes, double *rdcc_w0)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- size_t rdcc_nelmts; /* Work around variable changing size */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_cache, FAIL);
- H5TRACE5("e","i*Is*Is*z*d",plist_id,mdc_nelmts,_rdcc_nelmts,rdcc_nbytes,
- rdcc_w0);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get sizes */
- if (mdc_nelmts)
- if(H5P_get(plist, H5F_ACS_META_CACHE_SIZE_NAME, mdc_nelmts) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get meta data cache size");
- if (_rdcc_nelmts) {
- if(H5P_get(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &rdcc_nelmts) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache element size");
- *_rdcc_nelmts=rdcc_nelmts;
- } /* end if */
- if (rdcc_nbytes)
- if(H5P_get(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, rdcc_nbytes) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache byte size");
- if (rdcc_w0)
- if(H5P_get(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, rdcc_w0) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get preempt read chunks");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-#else /* H5_WANT_H5_V1_4_COMPAT */
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_cache
- *
- * Purpose: Set the number of objects in the meta data cache and the
- * maximum number of chunks and bytes in the raw data chunk
- * cache.
- *
- * The RDCC_W0 value should be between 0 and 1 inclusive and
- * indicates how much chunks that have been fully read or fully
- * written are favored for preemption. A value of zero means
- * fully read or written chunks are treated no differently than
- * other chunks (the preemption is strictly LRU) while a value
- * of one means fully read chunks are always preempted before
- * other chunks.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, May 19, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_cache(hid_t plist_id, int mdc_nelmts,
- size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_cache, FAIL);
- H5TRACE5("e","iIszzd",plist_id,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
-
- /* Check arguments */
- if (mdc_nelmts<0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "meta data cache size must be non-negative");
- if (rdcc_w0<0.0 || rdcc_w0>1.0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set sizes */
- if(H5P_set(plist, H5F_ACS_META_CACHE_SIZE_NAME, &mdc_nelmts) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set meta data cache size");
- if(H5P_set(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &rdcc_nelmts) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache element size");
- if(H5P_set(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache byte size");
- if(H5P_set(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set preempt read chunks");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_cache
- *
- * Purpose: Retrieves the maximum possible number of elements in the meta
- * data cache and the maximum possible number of elements and
- * bytes and the RDCC_W0 value in the raw data chunk cache. Any
- * (or all) arguments may be null pointers in which case the
- * corresponding datum is not returned.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, May 19, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property
- * list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_cache(hid_t plist_id, int *mdc_nelmts,
- size_t *rdcc_nelmts, size_t *rdcc_nbytes, double *rdcc_w0)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_cache, FAIL);
- H5TRACE5("e","i*Is*z*z*d",plist_id,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,
- rdcc_w0);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get sizes */
- if (mdc_nelmts)
- if(H5P_get(plist, H5F_ACS_META_CACHE_SIZE_NAME, mdc_nelmts) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get meta data cache size");
- if (rdcc_nelmts)
- if(H5P_get(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, rdcc_nelmts) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache element size");
- if (rdcc_nbytes)
- if(H5P_get(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, rdcc_nbytes) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache byte size");
- if (rdcc_w0)
- if(H5P_get(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, rdcc_w0) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get preempt read chunks");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-#endif /* H5_WANT_H5_V1_4_COMPAT */
-
-#ifdef H5_WANT_H5_V1_4_COMPAT
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_buffer
- *
- * Purpose: Given a dataset transfer property list, set the maximum size
- * for the type conversion buffer and background buffer and
- * optionally supply pointers to application-allocated buffers.
- * If the buffer size is smaller than the entire amount of data
- * being transfered between application and file, and a type
- * conversion buffer or background buffer is required then
- * strip mining will be used.
- *
- * If TCONV and/or BKG are null pointers then buffers will be
- * allocated and freed during the data transfer.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Monday, March 16, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_buffer(hid_t plist_id, hsize_t _size, void *tconv, void *bkg)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- size_t size=(size_t)_size; /* Work around size difference */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_buffer, FAIL);
- H5TRACE4("e","ihxx",plist_id,_size,tconv,bkg);
-
- /* Check arguments */
- if (size<=0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Update property list */
- if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size");
- if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer");
- if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_buffer
- *
- * Purpose: Reads values previously set with H5Pset_buffer().
- *
- * Return: Success: Buffer size.
- *
- * Failure: 0
- *
- * Programmer: Robb Matzke
- * Monday, March 16, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-hsize_t
-H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- size_t size; /* Type conversion buffer size */
- hsize_t ret_value; /* Return value */
-
- FUNC_ENTER_API(H5Pget_buffer, 0);
- H5TRACE3("h","ixx",plist_id,tconv,bkg);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID");
-
- /* Return values */
- if (tconv)
- if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer");
- if (bkg)
- if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer");
-
- /* Get the size */
- if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size");
-
- /* Set the return value */
- ret_value=(hsize_t)size;
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-#else /* H5_WANT_H5_V1_4_COMPAT */
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_buffer
- *
- * Purpose: Given a dataset transfer property list, set the maximum size
- * for the type conversion buffer and background buffer and
- * optionally supply pointers to application-allocated buffers.
- * If the buffer size is smaller than the entire amount of data
- * being transfered between application and file, and a type
- * conversion buffer or background buffer is required then
- * strip mining will be used.
- *
- * If TCONV and/or BKG are null pointers then buffers will be
- * allocated and freed during the data transfer.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Monday, March 16, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_buffer, FAIL);
- H5TRACE4("e","izxx",plist_id,size,tconv,bkg);
-
- /* Check arguments */
- if (size<=0)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Update property list */
- if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size");
- if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer");
- if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_buffer
- *
- * Purpose: Reads values previously set with H5Pset_buffer().
- *
- * Return: Success: Buffer size.
- *
- * Failure: 0
- *
- * Programmer: Robb Matzke
- * Monday, March 16, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-size_t
-H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- size_t size; /* Type conversion buffer size */
- size_t ret_value; /* Return value */
-
- FUNC_ENTER_API(H5Pget_buffer, 0);
- H5TRACE3("z","ixx",plist_id,tconv,bkg);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID");
-
- /* Return values */
- if (tconv)
- if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer");
- if (bkg)
- if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer");
-
- /* Get the size */
- if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
- HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size");
-
- /* Set the return value */
- ret_value=size;
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-#endif /* H5_WANT_H5_V1_4_COMPAT */
-
-#ifdef H5_WANT_H5_V1_4_COMPAT
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_hyper_cache
- *
- * Purpose: Given a dataset transfer property list, indicate whether to
- * cache the hyperslab blocks during the I/O (which speeds
- * things up) and the maximum size of the hyperslab block to
- * cache. If a block is smaller than to limit, it may still not
- * be cached if no memory is available. Setting the limit to 0
- * indicates no limitation on the size of block to attempt to
- * cache.
- *
- * The default is to cache blocks with no limit on block size
- * for serial I/O and to not cache blocks for parallel I/O
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, September 21, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_hyper_cache(hid_t plist_id, unsigned cache, unsigned limit)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED;
-
- FUNC_ENTER_API(H5Pset_hyper_cache, FAIL);
- H5TRACE3("e","iIuIu",plist_id,cache,limit);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Update property list */
- cache = (cache>0) ? 1 : 0;
- if (H5P_set(plist,H5D_XFER_HYPER_CACHE_NAME,&cache)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to set value");
- if (H5P_set(plist,H5D_XFER_HYPER_CACHE_LIM_NAME,&limit)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to set value");
-
-done:
- FUNC_LEAVE (ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_hyper_cache
- *
- * Purpose: Reads values previously set with H5Pset_hyper_cache().
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, September 21, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_hyper_cache(hid_t plist_id, unsigned *cache/*out*/,
- unsigned *limit/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_hyper_cache, FAIL);
- H5TRACE3("e","ixx",plist_id,cache,limit);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Return values */
- if (cache)
- if (H5P_get(plist,H5D_XFER_HYPER_CACHE_NAME,cache)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
- if (limit)
- if (H5P_get(plist,H5D_XFER_HYPER_CACHE_LIM_NAME,limit)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-#endif /* H5_WANT_H5_V1_4_COMPAT */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_preserve
- *
- * Purpose: When reading or writing compound data types and the
- * destination is partially initialized and the read/write is
- * intended to initialize the other members, one must set this
- * property to TRUE. Otherwise the I/O pipeline treats the
- * destination datapoints as completely uninitialized.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Tuesday, March 17, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_preserve(hid_t plist_id, hbool_t status)
-{
- H5T_bkg_t need_bkg; /* Value for background buffer type */
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_preserve, FAIL);
- H5TRACE2("e","ib",plist_id,status);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Update property list */
- need_bkg = status ? H5T_BKG_YES : H5T_BKG_NO;
- if (H5P_set(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_preserve
- *
- * Purpose: The inverse of H5Pset_preserve()
- *
- * Return: Success: TRUE or FALSE
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Tuesday, March 17, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-int
-H5Pget_preserve(hid_t plist_id)
-{
- H5T_bkg_t need_bkg; /* Background value */
- H5P_genplist_t *plist; /* Property list pointer */
- int ret_value; /* return value */
-
- FUNC_ENTER_API(H5Pget_preserve, FAIL);
- H5TRACE1("Is","i",plist_id);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get value */
- if (H5P_get(plist,H5D_XFER_BKGR_BUF_NAME,&need_bkg)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
-
- /* Set return value */
- ret_value= need_bkg ? TRUE : FALSE;
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_filter
- *
- * Purpose: Adds the specified FILTER and corresponding properties to the
- * end of the transient or permanent output filter pipeline
- * depending on whether PLIST is a dataset creation or dataset
- * transfer property list. The FLAGS argument specifies certain
- * general properties of the filter and is documented below.
- * The CD_VALUES is an array of CD_NELMTS integers which are
- * auxiliary data for the filter. The integer vlues will be
- * stored in the dataset object header as part of the filter
- * information.
- *
- * The FLAGS argument is a bit vector of the following fields:
- *
- * H5Z_FLAG_OPTIONAL(0x0001)
- * If this bit is set then the filter is optional. If the
- * filter fails during an H5Dwrite() operation then the filter
- * is just excluded from the pipeline for the chunk for which it
- * failed; the filter will not participate in the pipeline
- * during an H5Dread() of the chunk. If this bit is clear and
- * the filter fails then the entire I/O operation fails.
- *
- * Note: This function currently supports only the permanent filter
- * pipeline. That is, PLIST_ID must be a dataset creation
- * property list.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Wednesday, April 15, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and set property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
- size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/])
-{
- H5O_pline_t pline;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_filter, FAIL);
- H5TRACE5("e","iZfIuz*[a3]Iu",plist_id,filter,flags,cd_nelmts,cd_values);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
-
- if (filter<0 || filter>H5Z_FILTER_MAX)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier");
- if (flags & ~((unsigned)H5Z_FLAG_DEFMASK))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags");
- if (cd_nelmts>0 && !cd_values)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied");
-
- /* Do it */
- if(H5Z_append(&pline, filter, flags, cd_nelmts, cd_values) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline");
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_nfilters
- *
- * Purpose: Returns the number of filters in the permanent or transient
- * pipeline depending on whether PLIST_ID is a dataset creation
- * or dataset transfer property list. In each pipeline the
- * filters are numbered from zero through N-1 where N is the
- * value returned by this function. During output to the file
- * the filters of a pipeline are applied in increasing order
- * (the inverse is true for input).
- *
- * Note: Only permanent filters are supported at this time.
- *
- * Return: Success: Number of filters or zero if there are none.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Tuesday, August 4, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-int
-H5Pget_nfilters(hid_t plist_id)
-{
- H5O_pline_t pline;
- H5P_genplist_t *plist; /* Property list pointer */
- int ret_value; /* return value */
-
- FUNC_ENTER_API(H5Pget_nfilters, FAIL);
- H5TRACE1("Is","i",plist_id);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get value */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
-
- /* Set return value */
- ret_value=(int)(pline.nfilters);
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_filter
- *
- * Purpose: This is the query counterpart of H5Pset_filter() and returns
- * information about a particular filter number in a permanent
- * or transient pipeline depending on whether PLIST_ID is a
- * dataset creation or transfer property list. On input,
- * CD_NELMTS indicates the number of entries in the CD_VALUES
- * array allocated by the caller while on exit it contains the
- * number of values defined by the filter. The IDX should be a
- * value between zero and N-1 as described for H5Pget_nfilters()
- * and the function will return failure if the filter number is
- * out or range.
- *
- * Return: Success: Filter identification number.
- *
- * Failure: H5Z_FILTER_ERROR (Negative)
- *
- * Programmer: Robb Matzke
- * Wednesday, April 15, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check paramter and set property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-H5Z_filter_t
-H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/,
- size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
- size_t namelen, char name[]/*out*/)
-{
- H5O_pline_t pline;
- size_t i;
- H5P_genplist_t *plist; /* Property list pointer */
- H5Z_filter_t ret_value; /* return value */
-
- FUNC_ENTER_API(H5Pget_filter, H5Z_FILTER_ERROR);
- H5TRACE7("Zf","iIsx*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen,
- name);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID");
-
- /* Get pipeline info */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline");
-
- if (idx<0 || (size_t)idx>=pline.nfilters)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid");
-
- if (cd_nelmts || cd_values) {
- if (cd_nelmts && *cd_nelmts>256)
- /*
- * It's likely that users forget to initialize this on input, so
- * we'll check that it has a reasonable value. The actual number
- * is unimportant because the H5O layer will detect when a message
- * is too large.
- */
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "probable uninitialized *cd_nelmts argument");
- if (cd_nelmts && *cd_nelmts>0 && !cd_values)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied");
-
- /*
- * If cd_nelmts is null but cd_values is non-null then just ignore
- * cd_values
- */
- if (!cd_nelmts)
- cd_values = NULL;
- }
-
- if (flags)
- *flags = pline.filter[idx].flags;
- if (cd_values) {
- for (i=0; i<pline.filter[idx].cd_nelmts && i<*cd_nelmts; i++)
- cd_values[i] = pline.filter[idx].cd_values[i];
- }
- if (cd_nelmts)
- *cd_nelmts = pline.filter[idx].cd_nelmts;
-
- if (namelen>0 && name) {
- const char *s = pline.filter[idx].name;
-
- if (!s) {
- H5Z_class_t *cls = H5Z_find(pline.filter[idx].id);
-
- if (cls)
- s = cls->name;
- }
- if (s)
- HDstrncpy(name, s, namelen);
- else
- name[0] = '\0';
- }
-
- /* Set return value */
- ret_value=pline.filter[idx].id;
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_deflate
- *
- * Purpose: Sets the compression method for a permanent or transient
- * filter pipeline (depending on whether PLIST_ID is a dataset
- * creation or transfer property list) to H5Z_FILTER_DEFLATE
- * and the compression level to LEVEL which should be a value
- * between zero and nine, inclusive. Lower compression levels
- * are faster but result in less compression. This is the same
- * algorithm as used by the GNU gzip program.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Wednesday, April 15, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and set property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_deflate(hid_t plist_id, unsigned level)
-{
- H5O_pline_t pline;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_deflate, FAIL);
- H5TRACE2("e","iIu",plist_id,level);
-
- /* Check arguments */
- if (level>9)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid deflate level");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Add the filter */
- if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
- if (H5Z_append(&pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, 1, &level)<0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add deflate filter to pipeline");
- if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_btree_ratios
- *
- * Purpose: Queries B-tree split ratios. See H5Pset_btree_ratios().
- *
- * Return: Success: Non-negative with split ratios returned through
- * the non-null arguments.
- *
- * Failure: Negative
- *
- * Programmer: Robb Matzke
- * Monday, September 28, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, double *middle/*out*/,
- double *right/*out*/)
-{
- double btree_split_ratio[3]; /* B-tree node split ratios */
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_btree_ratios, FAIL);
- H5TRACE4("e","ixxx",plist_id,left,middle,right);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get the split ratios */
- if (H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&btree_split_ratio)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
-
- /* Get values */
- if (left)
- *left = btree_split_ratio[0];
- if (middle)
- *middle = btree_split_ratio[1];
- if (right)
- *right = btree_split_ratio[2];
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_btree_ratios
- *
- * Purpose: Sets B-tree split ratios for a dataset transfer property
- * list. The split ratios determine what percent of children go
- * in the first node when a node splits. The LEFT ratio is
- * used when the splitting node is the left-most node at its
- * level in the tree; the RIGHT ratio is when the splitting node
- * is the right-most node at its level; and the MIDDLE ratio for
- * all other cases. A node which is the only node at its level
- * in the tree uses the RIGHT ratio when it splits. All ratios
- * are real numbers between 0 and 1, inclusive.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Monday, September 28, 1998
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_btree_ratios(hid_t plist_id, double left, double middle,
- double right)
-{
- double split_ratio[3]; /* B-tree node split ratios */
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_btree_ratios, FAIL);
- H5TRACE4("e","iddd",plist_id,left,middle,right);
-
- /* Check arguments */
- if (left<0.0 || left>1.0 || middle<0.0 || middle>1.0 ||
- right<0.0 || right>1.0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- split_ratio[0] = left;
- split_ratio[1] = middle;
- split_ratio[2] = right;
-
- /* Set the split ratios */
- if (H5P_set(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&split_ratio)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_fill_value
- *
- * Purpose: Set the fill value for a dataset creation property list. The
- * VALUE is interpretted as being of type TYPE, which need not
- * be the same type as the dataset but the library must be able
- * to convert VALUE to the dataset type when the dataset is
- * created. If VALUE is NULL, it will be interpreted as
- * undefining fill value. The fill value property will be
- * removed from property list.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Thursday, October 1, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and set property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
-{
- H5O_fill_t fill;
- H5T_t *type = NULL;
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_fill_value, FAIL);
- H5TRACE3("e","iix",plist_id,type_id,value);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get the "basic" fill value structure */
- if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
-
- /* Reset the fill structure */
- if(H5O_reset(H5O_FILL, &fill)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset fill value");
-
- if(value) {
- if (NULL==(type=H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
-
- /* Set the fill value */
- if (NULL==(fill.type=H5T_copy(type, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy data type");
- fill.size = H5T_get_size(type);
- if (NULL==(fill.buf=H5MM_malloc(fill.size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for fill value");
- HDmemcpy(fill.buf, value, fill.size);
- } else {
- fill.type = fill.buf = NULL;
- fill.size = (size_t)-1;
- }
-
- if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set fill value");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_fill_value
- *
- * Purpose: Queries the fill value property of a dataset creation
- * property list. The fill value is returned through the VALUE
- * pointer and the memory is allocated by the caller. The fill
- * value will be converted from its current data type to the
- * specified TYPE.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * Thursday, October 1, 1998
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to check parameter and get property for
- * generic property list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
-{
- H5O_fill_t fill;
- H5T_t *type = NULL; /*data type */
- H5T_path_t *tpath = NULL; /*type conversion info */
- void *buf = NULL; /*conversion buffer */
- void *bkg = NULL; /*conversion buffer */
- hid_t src_id = -1; /*source data type id */
- herr_t ret_value=SUCCEED; /* Return value */
- H5P_genplist_t *plist; /* Property list pointer */
-
- FUNC_ENTER_API(H5Pget_fill_value, FAIL);
- H5TRACE3("e","iix",plist_id,type_id,value);
-
- /* Check arguments */
- if (NULL==(type=H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
- if (!value)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,"no fill value output buffer");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /*
- * If no fill value is defined then return an error. We can't even
- * return zero because we don't know the data type of the dataset and
- * data type conversion might not have resulted in zero. If fill value
- * is undefined, also return error.
- */
- if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
- if(fill.size == (size_t)-1)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "fill value is undefined");
-
- if(fill.size == 0) {
- HDmemset(value, 0, H5T_get_size(type));
- HGOTO_DONE(SUCCEED);
- }
- /*
- * Can we convert between the source and destination data types?
- */
- if(NULL==(tpath=H5T_path_find(fill.type, type, NULL, NULL)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types");
- src_id = H5I_register(H5I_DATATYPE, H5T_copy (fill.type, H5T_COPY_TRANSIENT));
- if (src_id<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register data type");
-
- /*
- * Data type conversions are always done in place, so we need a buffer
- * other than the fill value buffer that is large enough for both source
- * and destination. The app-supplied buffer might do okay.
- */
- if (H5T_get_size(type)>=H5T_get_size(fill.type)) {
- buf = value;
- if (tpath->cdata.need_bkg && NULL==(bkg=H5MM_malloc(H5T_get_size(type))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
- } else {
- if (NULL==(buf=H5MM_malloc(H5T_get_size(fill.type))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
- if (tpath->cdata.need_bkg)
- bkg = value;
- }
- HDmemcpy(buf, fill.buf, H5T_get_size(fill.type));
-
- /* Do the conversion */
- if (H5T_convert(tpath, src_id, type_id, (hsize_t)1, 0, 0, buf, bkg, H5P_DEFAULT)<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed");
- if (buf!=value)
- HDmemcpy(value, buf, H5T_get_size(type));
-
-done:
- if (buf!=value)
- H5MM_xfree(buf);
- if (bkg!=value)
- H5MM_xfree(bkg);
- if (src_id>=0)
- H5I_dec_ref(src_id);
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P_fill_value_defined
- *
- * Purpose: Check if fill value is defined. Internal version of function
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Raymond Lu
- * Wednesday, January 16, 2002
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status)
-{
- herr_t ret_value = SUCCEED;
- H5O_fill_t fill;
-
- FUNC_ENTER_NOAPI(H5P_fill_value_defined, FAIL);
-
- assert(plist);
- assert(status);
-
- /* Get the fill value struct */
- if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
-
- /* Check if the fill value was never set */
- if(fill.size == (size_t)-1 && !fill.buf) {
- *status = H5D_FILL_VALUE_UNDEFINED;
- }
- /* Check if the fill value was set to the default fill value by the library */
- else if(fill.size == 0 && !fill.buf) {
- *status = H5D_FILL_VALUE_DEFAULT;
- }
- /* Check if the fill value was set by the application */
- else if(fill.size > 0 && fill.buf) {
- *status = H5D_FILL_VALUE_USER_DEFINED;
- }
- else {
- *status = H5D_FILL_VALUE_ERROR;
- HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "invalid combination of fill-value info");
- }
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5P_fill_value_defined() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pfill_value_defined
- *
- * Purpose: Check if fill value is defined.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Raymond Lu
- * Wednesday, January 16, 2002
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status)
-{
- H5P_genplist_t *plist;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_API(H5Pfill_value_defined, FAIL);
- H5TRACE2("e","i*Df",plist_id,status);
-
- assert(status);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Call the internal function */
- if(H5P_fill_value_defined(plist, status) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value info");
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5Pfill_value_defined() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_space_time
- *
- * Purpose: Set space allocation time for dataset during creation.
- * Valid values are H5D_EARLY, H5D_LATE.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Raymond Lu
- * Wednesday, January 16, 2002
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_space_time(hid_t plist_id, H5D_space_time_t alloc_time)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_space_time, FAIL);
- H5TRACE2("e","iDs",plist_id,alloc_time);
-
- /* Get the property list structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if(H5P_set(plist, H5D_CRT_SPACE_TIME_NAME, &alloc_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_space_time
- *
- * Purpose: Get space allocation time for dataset creation. Valid
- * values are H5D_EARLY, H5D_LATE.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Raymond Lu
- * Wednesday, January 16, 2002
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_space_time(hid_t plist_id, H5D_space_time_t *alloc_time/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_space_time, FAIL);
- H5TRACE2("e","ix",plist_id,alloc_time);
-
- /* Get the property list structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if(!alloc_time || H5P_get(plist, H5D_CRT_SPACE_TIME_NAME, alloc_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get space allocation time");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_fill_time
- *
- * Purpose: Set fill value writing time for dataset. Valid values are
- * H5D_FILL_TIME_ALLOC and H5D_FILL_TIME_NEVER.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Raymond Lu
- * Wednesday, January 16, 2002
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_fill_time, FAIL);
-
- /* Get the property list structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if(H5P_set(plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_fill_time
- *
- * Purpose: Get fill value writing time. Valid values are H5D_NEVER
- * and H5D_ALLOC.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Raymond Lu
- * Wednesday, January 16, 2002
- *
- * Modifications:
- *
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value = SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_fill_time, FAIL);
- H5TRACE2("e","ix",plist_id,fill_time);
-
- /* Get the property list structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if(!fill_time || H5P_get(plist, H5D_CRT_FILL_TIME_NAME, fill_time) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_gc_references
- *
- * Purpose: Sets the flag for garbage collecting references for the file.
- * Dataset region references (and other reference types
- * probably) use space in the file heap. If garbage collection
- * is on and the user passes in an uninitialized value in a
- * reference structure, the heap might get corrupted. When
- * garbage collection is off however and the user re-uses a
- * reference, the previous heap block will be orphaned and not
- * returned to the free heap space. When garbage collection is
- * on, the user must initialize the reference structures to 0 or
- * risk heap corruption.
- *
- * Default value for garbage collecting references is off, just
- * to be on the safe side.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * June, 1999
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property
- * list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_gc_references(hid_t plist_id, unsigned gc_ref)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_gc_references, FAIL);
- H5TRACE2("e","iIu",plist_id,gc_ref);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if(H5P_set(plist, H5F_ACS_GARBG_COLCT_REF_NAME, &gc_ref) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set garbage collect reference");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_gc_references
- *
- * Purpose: Returns the current setting for the garbage collection
- * references property from a file access property list.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * June, 1999
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property
- * list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_gc_references(hid_t plist_id, unsigned *gc_ref/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_gc_references, FAIL);
- H5TRACE2("e","ix",plist_id,gc_ref);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if (gc_ref)
- if(H5P_get(plist, H5F_ACS_GARBG_COLCT_REF_NAME, gc_ref) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get garbage collect reference");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_fclose_degree
- *
- * Purpose: Sets the degree for the file close behavior.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Raymond Lu
- * November, 2001
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_fclose_degree(hid_t plist_id, H5F_close_degree_t degree)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_fclose_degree, FAIL);
- H5TRACE2("e","iFc",plist_id,degree);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if(H5P_set(plist, H5F_CLOSE_DEGREE_NAME, &degree) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_fclose_degree
- *
- * Purpose: Returns the current setting for the garbage collection
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * June, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t H5Pget_fclose_degree(hid_t plist_id, H5F_close_degree_t *degree)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_fclose_degree, FAIL);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- if( degree && (H5P_get(plist, H5F_CLOSE_DEGREE_NAME, degree) < 0) )
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5P_set_vlen_mem_manager
- *
- * Purpose: Sets the memory allocate/free pair for VL datatypes. The
- * allocation routine is called when data is read into a new
- * array and the free routine is called when H5Dvlen_reclaim is
- * called. The alloc_info and free_info are user parameters
- * which are passed to the allocation and freeing functions
- * respectively. To reset the allocate/free functions to the
- * default setting of using the system's malloc/free functions,
- * call this routine with alloc_func and free_func set to NULL.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, July 1, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func,
- void *alloc_info, H5MM_free_t free_func, void *free_info)
-{
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_NOAPI(H5P_set_vlen_mem_manager, FAIL);
-
- assert(plist);
-
- /* Update property list */
- if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
- if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
- if (H5P_set(plist,H5D_XFER_VLEN_FREE_NAME,&free_func)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
- if (H5P_set(plist,H5D_XFER_VLEN_FREE_INFO_NAME,&free_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5P_set_vlen_mem_manager() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_vlen_mem_manager
- *
- * Purpose: Sets the memory allocate/free pair for VL datatypes. The
- * allocation routine is called when data is read into a new
- * array and the free routine is called when H5Dvlen_reclaim is
- * called. The alloc_info and free_info are user parameters
- * which are passed to the allocation and freeing functions
- * respectively. To reset the allocate/free functions to the
- * default setting of using the system's malloc/free functions,
- * call this routine with alloc_func and free_func set to NULL.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, July 1, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func,
- void *alloc_info, H5MM_free_t free_func, void *free_info)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_vlen_mem_manager, FAIL);
- H5TRACE5("e","ixxxx",plist_id,alloc_func,alloc_info,free_func,free_info);
-
- /* Check arguments */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list");
-
- /* Update property list */
- if (H5P_set_vlen_mem_manager(plist,alloc_func,alloc_info,free_func,free_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set values");
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5Pset_vlen_mem_manager() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_vlen_mem_manager
- *
- * Purpose: The inverse of H5Pset_vlen_mem_manager()
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, July 1, 1999
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func/*out*/,
- void **alloc_info/*out*/,
- H5MM_free_t *free_func/*out*/,
- void **free_info/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_vlen_mem_manager, FAIL);
- H5TRACE5("e","ixxxx",plist_id,alloc_func,alloc_info,free_func,free_info);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- if(alloc_func!=NULL)
- if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,alloc_func)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
- if(alloc_info!=NULL)
- if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,alloc_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
- if(free_func!=NULL)
- if (H5P_get(plist,H5D_XFER_VLEN_FREE_NAME,free_func)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
- if(free_info!=NULL)
- if (H5P_get(plist,H5D_XFER_VLEN_FREE_INFO_NAME,free_info)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_meta_block_size
- *
- * Purpose: Sets the minimum size of metadata block allocations when
- * the H5FD_FEAT_AGGREGATE_METADATA is set by a VFL driver.
- * Each "raw" metadata block is allocated to be this size and then
- * specific pieces of metadata (object headers, local heaps, B-trees, etc)
- * are sub-allocated from this block.
- *
- * The default value is set to 2048 (bytes), indicating that metadata
- * will be attempted to be bunched together in (at least) 2K blocks in
- * the file. Setting the value to 0 with this API function will
- * turn off the metadata aggregation, even if the VFL driver attempts to
- * use that strategy.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Friday, August 25, 2000
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property
- * list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_meta_block_size(hid_t plist_id, hsize_t size)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_meta_block_size, FAIL);
- H5TRACE2("e","ih",plist_id,size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if(H5P_set(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set meta data block size");
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_meta_block_size
- *
- * Purpose: Returns the current settings for the metadata block allocation
- * property from a file access property list.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Friday, August 29, 2000
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property
- * list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_meta_block_size(hid_t plist_id, hsize_t *size/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_meta_block_size, FAIL);
- H5TRACE2("e","ix",plist_id,size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if (size) {
- if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get meta data block size");
- } /* end if */
-
-done:
- FUNC_LEAVE(ret_value);
-}
-
-#ifdef H5_WANT_H5_V1_4_COMPAT
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_sieve_buf_size
- *
- * Purpose: Sets the maximum size of the data seive buffer used for file
- * drivers which are capable of using data sieving. The data sieve
- * buffer is used when performing I/O on datasets in the file. Using a
- * buffer which is large anough to hold several pieces of the dataset
- * being read in for hyperslab selections boosts performance by quite a
- * bit.
- *
- * The default value is set to 64KB, indicating that file I/O for raw data
- * reads and writes will occur in at least 64KB blocks.
- * Setting the value to 0 with this API function will turn off the
- * data sieving, even if the VFL driver attempts to use that strategy.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, September 21, 2000
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property
- * list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_sieve_buf_size(hid_t plist_id, hsize_t _size)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- size_t size=(size_t)_size; /* Work around size difference */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_sieve_buf_size, FAIL);
- H5TRACE2("e","ih",plist_id,_size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if(H5P_set(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set sieve buffer size");
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5Pset_sieve_buf_size() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_sieve_buf_size
- *
- * Purpose: Returns the current settings for the data sieve buffer size
- * property from a file access property list.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, September 21, 2000
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property
- * list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_sieve_buf_size(hid_t plist_id, hsize_t *_size/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- size_t size; /* Work around size difference */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_sieve_buf_size, FAIL);
- H5TRACE2("e","ix",plist_id,_size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if (_size) {
- if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get sieve buffer size");
- *_size=size;
- } /* end if */
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5Pget_sieve_buf_size() */
-#else /* H5_WANT_H5_V1_4_COMPAT */
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_sieve_buf_size
- *
- * Purpose: Sets the maximum size of the data seive buffer used for file
- * drivers which are capable of using data sieving. The data sieve
- * buffer is used when performing I/O on datasets in the file. Using a
- * buffer which is large anough to hold several pieces of the dataset
- * being read in for hyperslab selections boosts performance by quite a
- * bit.
- *
- * The default value is set to 64KB, indicating that file I/O for raw data
- * reads and writes will occur in at least 64KB blocks.
- * Setting the value to 0 with this API function will turn off the
- * data sieving, even if the VFL driver attempts to use that strategy.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, September 21, 2000
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property
- * list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_sieve_buf_size(hid_t plist_id, size_t size)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_sieve_buf_size, FAIL);
- H5TRACE2("e","iz",plist_id,size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if(H5P_set(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set sieve buffer size");
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5Pset_sieve_buf_size() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_sieve_buf_size
- *
- * Purpose: Returns the current settings for the data sieve buffer size
- * property from a file access property list.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Thursday, September 21, 2000
- *
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, Oct 23, 2001
- * Changed the file access list to the new generic property
- * list.
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_sieve_buf_size(hid_t plist_id, size_t *size/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_sieve_buf_size, FAIL);
- H5TRACE2("e","ix",plist_id,size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if (size)
- if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get sieve buffer size");
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5Pget_sieve_buf_size() */
-#endif /* H5_WANT_H5_V1_4_COMPAT */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_hyper_vector_size
- *
- * Purpose: Given a dataset transfer property list, set the number of
- * "I/O vectors" (offset and length pairs) which are to be
- * accumulated in memory before being issued to the lower levels
- * of the library for reading or writing the actual data.
- * Increasing the number should give better performance, but use
- * more memory during hyperslab I/O. The vector size must be
- * greater than 1.
- *
- * The default is to use 1024 vectors for I/O during hyperslab
- * reading/writing.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, July 9, 2001
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_hyper_vector_size, FAIL);
- H5TRACE2("e","iz",plist_id,vector_size);
-
- /* Check arguments */
- if (vector_size<1)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "vector size too small");
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Update property list */
- if (H5P_set(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5Pset_hyper_vector_size() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_hyper_vector_size
- *
- * Purpose: Reads values previously set with H5Pset_hyper_vector_size().
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Monday, July 9, 2001
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_hyper_vector_size, FAIL);
- H5TRACE2("e","ix",plist_id,vector_size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Return values */
- if (vector_size)
- if (H5P_get(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,vector_size)<0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5Pget_hyper_vector_size() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pset_small_data_block_size
- *
- * Purpose: Sets the minimum size of "small" raw data block allocations
- * when the H5FD_FEAT_AGGREGATE_SMALLDATA is set by a VFL driver.
- * Each "small" raw data block is allocated to be this size and then
- * pieces of raw data which are small enough to fit are sub-allocated from
- * this block.
- *
- * The default value is set to 2048 (bytes), indicating that raw data
- * smaller than this value will be attempted to be bunched together in (at
- * least) 2K blocks in the file. Setting the value to 0 with this API
- * function will turn off the "small" raw data aggregation, even if the
- * VFL driver attempts to use that strategy.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Wednesday, June 5, 2002
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pset_small_data_block_size(hid_t plist_id, hsize_t size)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pset_small_data_block_size, FAIL);
- H5TRACE2("e","ih",plist_id,size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Set values */
- if(H5P_set(plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' block size");
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5Pset_small_data_block_size() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5Pget_small_data_block_size
- *
- * Purpose: Returns the current settings for the "small" raw data block
- * allocation property from a file access property list.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * Wednesday, June 5, 2002
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Pget_small_data_block_size(hid_t plist_id, hsize_t *size/*out*/)
-{
- H5P_genplist_t *plist; /* Property list pointer */
- herr_t ret_value=SUCCEED; /* return value */
-
- FUNC_ENTER_API(H5Pget_small_data_block_size, FAIL);
- H5TRACE2("e","ix",plist_id,size);
-
- /* Get the plist structure */
- if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
-
- /* Get values */
- if (size) {
- if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get 'small data' block size");
- } /* end if */
-
-done:
- FUNC_LEAVE(ret_value);
-} /* end H5Pget_small_data_block_size() */
-
-
/*--------------------------------------------------------------------------
NAME
H5P_dup_prop
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
new file mode 100644
index 0000000..4c3d6a1
--- /dev/null
+++ b/src/H5Pdcpl.c
@@ -0,0 +1,1172 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id$ */
+
+#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+
+/* Private header files */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Ppkg.h" /* Property lists */
+
+/* Pablo mask */
+#define PABLO_MASK H5Pdcpl_mask
+
+/* Interface initialization */
+#define INTERFACE_INIT NULL
+static int interface_initialize_g = 0;
+
+/* Local datatypes */
+
+/* Static function prototypes */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_layout
+ *
+ * Purpose: Sets the layout of raw data in the file.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, January 6, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_layout(hid_t plist_id, H5D_layout_t layout)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_layout, FAIL);
+ H5TRACE2("e","iDl",plist_id,layout);
+
+ /* Check arguments */
+ if (layout < 0 || layout >= H5D_NLAYOUTS)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "raw data layout method is not valid");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set value */
+ if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_layout
+ *
+ * Purpose: Retrieves layout type of a dataset creation property list.
+ *
+ * Return: Success: The layout type
+ *
+ * Failure: H5D_LAYOUT_ERROR (negative)
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, January 7, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and get property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+H5D_layout_t
+H5Pget_layout(hid_t plist_id)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5D_layout_t ret_value=H5D_LAYOUT_ERROR;
+
+ FUNC_ENTER_API(H5Pget_layout, H5D_LAYOUT_ERROR);
+ H5TRACE1("Dl","i",plist_id);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5D_LAYOUT_ERROR, "can't find object for ID");
+
+ /* Get value */
+ if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &ret_value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5D_LAYOUT_ERROR, "can't get layout");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_chunk
+ *
+ * Purpose: Sets the number of dimensions and the size of each chunk to
+ * the values specified. The dimensionality of the chunk should
+ * match the dimensionality of the data space.
+ *
+ * As a side effect, the layout method is changed to
+ * H5D_CHUNKED.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, January 6, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/])
+{
+ int i;
+ hsize_t real_dims[H5O_LAYOUT_NDIMS]; /* Full-sized array to hold chunk dims */
+ H5D_layout_t layout;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_chunk, FAIL);
+ H5TRACE3("e","iIs*[a1]h",plist_id,ndims,dim);
+
+ /* Check arguments */
+ if (ndims <= 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk dimensionality must be positive");
+ if (ndims > H5S_MAX_RANK)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk dimensionality is too large");
+ if (!dim)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no chunk dimensions specified");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Initialize chunk dims to 0s */
+ HDmemset(real_dims,0,H5O_LAYOUT_NDIMS*sizeof(hsize_t));
+ for (i=0; i<ndims; i++) {
+ if (dim[i] <= 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be positive");
+ real_dims[i]=dim[i]; /* Store user's chunk dimensions */
+ }
+
+ layout = H5D_CHUNKED;
+ if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout");
+ if(H5P_set(plist, H5D_CRT_CHUNK_DIM_NAME, &ndims) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set chunk dimensionanlity");
+ if(H5P_set(plist, H5D_CRT_CHUNK_SIZE_NAME, real_dims) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set chunk size");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_chunk
+ *
+ * Purpose: Retrieves the chunk size of chunked layout. The chunk
+ * dimensionality is returned and the chunk size in each
+ * dimension is returned through the DIM argument. At most
+ * MAX_NDIMS elements of DIM will be initialized.
+ *
+ * Return: Success: Positive Chunk dimensionality.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, January 7, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/)
+{
+ int i;
+ int ndims;
+ H5D_layout_t layout;
+ hsize_t chunk_size[32];
+ H5P_genplist_t *plist; /* Property list pointer */
+ int ret_value;
+
+ FUNC_ENTER_API(H5Pget_chunk, FAIL);
+ H5TRACE3("Is","iIsx",plist_id,max_ndims,dim);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout");
+ if(H5D_CHUNKED != layout)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout");
+
+ if(H5P_get(plist, H5D_CRT_CHUNK_SIZE_NAME, chunk_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get chunk size");
+ if(H5P_get(plist, H5D_CRT_CHUNK_DIM_NAME, &ndims) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get chunk dimensionality");
+
+ /* Get the dimension sizes */
+ for (i=0; i<ndims && i<max_ndims && dim; i++)
+ dim[i] = chunk_size[i];
+
+ /* Set the return value */
+ ret_value=ndims;
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_external
+ *
+ * Purpose: Adds an external file to the list of external files. PLIST_ID
+ * should be an object ID for a dataset creation property list.
+ * NAME is the name of an external file, OFFSET is the location
+ * where the data starts in that file, and SIZE is the number of
+ * bytes reserved in the file for the data.
+ *
+ * If a dataset is split across multiple files then the files
+ * should be defined in order. The total size of the dataset is
+ * the sum of the SIZE arguments for all the external files. If
+ * the total size is larger than the size of a dataset then the
+ * dataset can be extended (provided the data space also allows
+ * the extending).
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 3, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size)
+{
+ int idx;
+ hsize_t total, tmp;
+ H5O_efl_t efl;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pset_external, FAIL);
+ H5TRACE4("e","isoh",plist_id,name,offset,size);
+
+ /* Check arguments */
+ if (!name || !*name)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name given");
+ if (offset<0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "negative external file offset");
+ if (size<=0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "zero size");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list");
+ if(efl.nused > 0 && H5O_EFL_UNLIMITED==efl.slot[efl.nused-1].size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "previous file size is unlimited");
+
+ if (H5O_EFL_UNLIMITED!=size) {
+ for (idx=0, total=size; idx<efl.nused; idx++, total=tmp) {
+ tmp = total + efl.slot[idx].size;
+ if (tmp <= total)
+ HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "total external data size overflowed");
+ } /* end for */
+ } /* end if */
+
+
+ /* Add to the list */
+ if (efl.nused >= efl.nalloc) {
+ int na = efl.nalloc + H5O_EFL_ALLOC;
+ H5O_efl_entry_t *x = H5MM_realloc (efl.slot, na*sizeof(H5O_efl_entry_t));
+
+ if (!x)
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
+ efl.nalloc = na;
+ efl.slot = x;
+ }
+ idx = efl.nused;
+ efl.slot[idx].name_offset = 0; /*not entered into heap yet*/
+ efl.slot[idx].name = H5MM_xstrdup (name);
+ efl.slot[idx].offset = offset;
+ efl.slot[idx].size = size;
+ efl.nused++;
+
+ if(H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set external file list");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_external_count
+ *
+ * Purpose: Returns the number of external files for this dataset.
+ *
+ * Return: Success: Number of external files
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 3, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5Pget_external_count(hid_t plist_id)
+{
+ H5O_efl_t efl;
+ H5P_genplist_t *plist; /* Property list pointer */
+ int ret_value; /* return value */
+
+ FUNC_ENTER_API(H5Pget_external_count, FAIL);
+ H5TRACE1("Is","i",plist_id);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get value */
+ if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list");
+
+ /* Set return value */
+ ret_value=efl.nused;
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_external
+ *
+ * Purpose: Returns information about an external file. External files
+ * are numbered from zero to N-1 where N is the value returned
+ * by H5Pget_external_count(). At most NAME_SIZE characters are
+ * copied into the NAME array. If the external file name is
+ * longer than NAME_SIZE with the null terminator, then the
+ * return value is not null terminated (similar to strncpy()).
+ *
+ * If NAME_SIZE is zero or NAME is the null pointer then the
+ * external file name is not returned. If OFFSET or SIZE are
+ * null pointers then the corresponding information is not
+ * returned.
+ *
+ * See Also: H5Pset_external()
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 3, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and get property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_external(hid_t plist_id, int idx, size_t name_size, char *name/*out*/,
+ off_t *offset/*out*/, hsize_t *size/*out*/)
+{
+ H5O_efl_t efl;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_external, FAIL);
+ H5TRACE6("e","iIszxxx",plist_id,idx,name_size,name,offset,size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get value */
+ if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list");
+
+ if (idx<0 || idx>=efl.nused)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range");
+
+ /* Return values */
+ if (name_size>0 && name)
+ HDstrncpy (name, efl.slot[idx].name, name_size);
+ if (offset)
+ *offset = efl.slot[idx].offset;
+ if (size)
+ *size = efl.slot[idx].size;
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_filter
+ *
+ * Purpose: Adds the specified FILTER and corresponding properties to the
+ * end of the transient or permanent output filter pipeline
+ * depending on whether PLIST is a dataset creation or dataset
+ * transfer property list. The FLAGS argument specifies certain
+ * general properties of the filter and is documented below.
+ * The CD_VALUES is an array of CD_NELMTS integers which are
+ * auxiliary data for the filter. The integer vlues will be
+ * stored in the dataset object header as part of the filter
+ * information.
+ *
+ * The FLAGS argument is a bit vector of the following fields:
+ *
+ * H5Z_FLAG_OPTIONAL(0x0001)
+ * If this bit is set then the filter is optional. If the
+ * filter fails during an H5Dwrite() operation then the filter
+ * is just excluded from the pipeline for the chunk for which it
+ * failed; the filter will not participate in the pipeline
+ * during an H5Dread() of the chunk. If this bit is clear and
+ * the filter fails then the entire I/O operation fails.
+ *
+ * Note: This function currently supports only the permanent filter
+ * pipeline. That is, PLIST_ID must be a dataset creation
+ * property list.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, April 15, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags,
+ size_t cd_nelmts, const unsigned int cd_values[/*cd_nelmts*/])
+{
+ H5O_pline_t pline;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_filter, FAIL);
+ H5TRACE5("e","iZfIuz*[a3]Iu",plist_id,filter,flags,cd_nelmts,cd_values);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+
+ if (filter<0 || filter>H5Z_FILTER_MAX)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier");
+ if (flags & ~((unsigned)H5Z_FLAG_DEFMASK))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags");
+ if (cd_nelmts>0 && !cd_values)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied");
+
+ /* Do it */
+ if(H5Z_append(&pline, filter, flags, cd_nelmts, cd_values) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline");
+ if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_nfilters
+ *
+ * Purpose: Returns the number of filters in the permanent or transient
+ * pipeline depending on whether PLIST_ID is a dataset creation
+ * or dataset transfer property list. In each pipeline the
+ * filters are numbered from zero through N-1 where N is the
+ * value returned by this function. During output to the file
+ * the filters of a pipeline are applied in increasing order
+ * (the inverse is true for input).
+ *
+ * Note: Only permanent filters are supported at this time.
+ *
+ * Return: Success: Number of filters or zero if there are none.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, August 4, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5Pget_nfilters(hid_t plist_id)
+{
+ H5O_pline_t pline;
+ H5P_genplist_t *plist; /* Property list pointer */
+ int ret_value; /* return value */
+
+ FUNC_ENTER_API(H5Pget_nfilters, FAIL);
+ H5TRACE1("Is","i",plist_id);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get value */
+ if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+
+ /* Set return value */
+ ret_value=(int)(pline.nfilters);
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_filter
+ *
+ * Purpose: This is the query counterpart of H5Pset_filter() and returns
+ * information about a particular filter number in a permanent
+ * or transient pipeline depending on whether PLIST_ID is a
+ * dataset creation or transfer property list. On input,
+ * CD_NELMTS indicates the number of entries in the CD_VALUES
+ * array allocated by the caller while on exit it contains the
+ * number of values defined by the filter. The IDX should be a
+ * value between zero and N-1 as described for H5Pget_nfilters()
+ * and the function will return failure if the filter number is
+ * out or range.
+ *
+ * Return: Success: Filter identification number.
+ *
+ * Failure: H5Z_FILTER_ERROR (Negative)
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, April 15, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check paramter and set property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+H5Z_filter_t
+H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/,
+ size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/,
+ size_t namelen, char name[]/*out*/)
+{
+ H5O_pline_t pline;
+ size_t i;
+ H5P_genplist_t *plist; /* Property list pointer */
+ H5Z_filter_t ret_value; /* return value */
+
+ FUNC_ENTER_API(H5Pget_filter, H5Z_FILTER_ERROR);
+ H5TRACE7("Zf","iIsx*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen,
+ name);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_FILTER_ERROR, "can't find object for ID");
+
+ /* Get pipeline info */
+ if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline");
+
+ if (idx<0 || (size_t)idx>=pline.nfilters)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid");
+
+ if (cd_nelmts || cd_values) {
+ if (cd_nelmts && *cd_nelmts>256)
+ /*
+ * It's likely that users forget to initialize this on input, so
+ * we'll check that it has a reasonable value. The actual number
+ * is unimportant because the H5O layer will detect when a message
+ * is too large.
+ */
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "probable uninitialized *cd_nelmts argument");
+ if (cd_nelmts && *cd_nelmts>0 && !cd_values)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied");
+
+ /*
+ * If cd_nelmts is null but cd_values is non-null then just ignore
+ * cd_values
+ */
+ if (!cd_nelmts)
+ cd_values = NULL;
+ }
+
+ if (flags)
+ *flags = pline.filter[idx].flags;
+ if (cd_values) {
+ for (i=0; i<pline.filter[idx].cd_nelmts && i<*cd_nelmts; i++)
+ cd_values[i] = pline.filter[idx].cd_values[i];
+ }
+ if (cd_nelmts)
+ *cd_nelmts = pline.filter[idx].cd_nelmts;
+
+ if (namelen>0 && name) {
+ const char *s = pline.filter[idx].name;
+
+ if (!s) {
+ H5Z_class_t *cls = H5Z_find(pline.filter[idx].id);
+
+ if (cls)
+ s = cls->name;
+ }
+ if (s)
+ HDstrncpy(name, s, namelen);
+ else
+ name[0] = '\0';
+ }
+
+ /* Set return value */
+ ret_value=pline.filter[idx].id;
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_deflate
+ *
+ * Purpose: Sets the compression method for a permanent or transient
+ * filter pipeline (depending on whether PLIST_ID is a dataset
+ * creation or transfer property list) to H5Z_FILTER_DEFLATE
+ * and the compression level to LEVEL which should be a value
+ * between zero and nine, inclusive. Lower compression levels
+ * are faster but result in less compression. This is the same
+ * algorithm as used by the GNU gzip program.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, April 15, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_deflate(hid_t plist_id, unsigned level)
+{
+ H5O_pline_t pline;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_deflate, FAIL);
+ H5TRACE2("e","iIu",plist_id,level);
+
+ /* Check arguments */
+ if (level>9)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid deflate level");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Add the filter */
+ if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline");
+ if (H5Z_append(&pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, 1, &level)<0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add deflate filter to pipeline");
+ if(H5P_set(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0)
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_fill_value
+ *
+ * Purpose: Set the fill value for a dataset creation property list. The
+ * VALUE is interpretted as being of type TYPE, which need not
+ * be the same type as the dataset but the library must be able
+ * to convert VALUE to the dataset type when the dataset is
+ * created. If VALUE is NULL, it will be interpreted as
+ * undefining fill value. The fill value property will be
+ * removed from property list.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Thursday, October 1, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and set property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
+{
+ H5O_fill_t fill;
+ H5T_t *type = NULL;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_fill_value, FAIL);
+ H5TRACE3("e","iix",plist_id,type_id,value);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get the "basic" fill value structure */
+ if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
+
+ /* Reset the fill structure */
+ if(H5O_reset(H5O_FILL, &fill)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset fill value");
+
+ if(value) {
+ if (NULL==(type=H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+
+ /* Set the fill value */
+ if (NULL==(fill.type=H5T_copy(type, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy data type");
+ fill.size = H5T_get_size(type);
+ if (NULL==(fill.buf=H5MM_malloc(fill.size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for fill value");
+ HDmemcpy(fill.buf, value, fill.size);
+ } else {
+ fill.type = fill.buf = NULL;
+ fill.size = (size_t)-1;
+ }
+
+ if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set fill value");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_fill_value
+ *
+ * Purpose: Queries the fill value property of a dataset creation
+ * property list. The fill value is returned through the VALUE
+ * pointer and the memory is allocated by the caller. The fill
+ * value will be converted from its current data type to the
+ * specified TYPE.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Thursday, October 1, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, October 2, 2001
+ * Changed the way to check parameter and get property for
+ * generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
+{
+ H5O_fill_t fill;
+ H5T_t *type = NULL; /*data type */
+ H5T_path_t *tpath = NULL; /*type conversion info */
+ void *buf = NULL; /*conversion buffer */
+ void *bkg = NULL; /*conversion buffer */
+ hid_t src_id = -1; /*source data type id */
+ herr_t ret_value=SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list pointer */
+
+ FUNC_ENTER_API(H5Pget_fill_value, FAIL);
+ H5TRACE3("e","iix",plist_id,type_id,value);
+
+ /* Check arguments */
+ if (NULL==(type=H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ if (!value)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,"no fill value output buffer");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /*
+ * If no fill value is defined then return an error. We can't even
+ * return zero because we don't know the data type of the dataset and
+ * data type conversion might not have resulted in zero. If fill value
+ * is undefined, also return error.
+ */
+ if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
+ if(fill.size == (size_t)-1)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "fill value is undefined");
+
+ if(fill.size == 0) {
+ HDmemset(value, 0, H5T_get_size(type));
+ HGOTO_DONE(SUCCEED);
+ }
+ /*
+ * Can we convert between the source and destination data types?
+ */
+ if(NULL==(tpath=H5T_path_find(fill.type, type, NULL, NULL)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types");
+ src_id = H5I_register(H5I_DATATYPE, H5T_copy (fill.type, H5T_COPY_TRANSIENT));
+ if (src_id<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register data type");
+
+ /*
+ * Data type conversions are always done in place, so we need a buffer
+ * other than the fill value buffer that is large enough for both source
+ * and destination. The app-supplied buffer might do okay.
+ */
+ if (H5T_get_size(type)>=H5T_get_size(fill.type)) {
+ buf = value;
+ if (tpath->cdata.need_bkg && NULL==(bkg=H5MM_malloc(H5T_get_size(type))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
+ } else {
+ if (NULL==(buf=H5MM_malloc(H5T_get_size(fill.type))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
+ if (tpath->cdata.need_bkg)
+ bkg = value;
+ }
+ HDmemcpy(buf, fill.buf, H5T_get_size(fill.type));
+
+ /* Do the conversion */
+ if (H5T_convert(tpath, src_id, type_id, (hsize_t)1, 0, 0, buf, bkg, H5P_DEFAULT)<0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed");
+ if (buf!=value)
+ HDmemcpy(value, buf, H5T_get_size(type));
+
+done:
+ if (buf!=value)
+ H5MM_xfree(buf);
+ if (bkg!=value)
+ H5MM_xfree(bkg);
+ if (src_id>=0)
+ H5I_dec_ref(src_id);
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_fill_value_defined
+ *
+ * Purpose: Check if fill value is defined. Internal version of function
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * Wednesday, January 16, 2002
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status)
+{
+ herr_t ret_value = SUCCEED;
+ H5O_fill_t fill;
+
+ FUNC_ENTER_NOAPI(H5P_fill_value_defined, FAIL);
+
+ assert(plist);
+ assert(status);
+
+ /* Get the fill value struct */
+ if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
+
+ /* Check if the fill value was never set */
+ if(fill.size == (size_t)-1 && !fill.buf) {
+ *status = H5D_FILL_VALUE_UNDEFINED;
+ }
+ /* Check if the fill value was set to the default fill value by the library */
+ else if(fill.size == 0 && !fill.buf) {
+ *status = H5D_FILL_VALUE_DEFAULT;
+ }
+ /* Check if the fill value was set by the application */
+ else if(fill.size > 0 && fill.buf) {
+ *status = H5D_FILL_VALUE_USER_DEFINED;
+ }
+ else {
+ *status = H5D_FILL_VALUE_ERROR;
+ HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "invalid combination of fill-value info");
+ }
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5P_fill_value_defined() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pfill_value_defined
+ *
+ * Purpose: Check if fill value is defined.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * Wednesday, January 16, 2002
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status)
+{
+ H5P_genplist_t *plist;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(H5Pfill_value_defined, FAIL);
+ H5TRACE2("e","i*Df",plist_id,status);
+
+ assert(status);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Call the internal function */
+ if(H5P_fill_value_defined(plist, status) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value info");
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5Pfill_value_defined() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_space_time
+ *
+ * Purpose: Set space allocation time for dataset during creation.
+ * Valid values are H5D_EARLY, H5D_LATE.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * Wednesday, January 16, 2002
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_space_time(hid_t plist_id, H5D_space_time_t alloc_time)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_space_time, FAIL);
+ H5TRACE2("e","iDs",plist_id,alloc_time);
+
+ /* Get the property list structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ if(H5P_set(plist, H5D_CRT_SPACE_TIME_NAME, &alloc_time) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_space_time
+ *
+ * Purpose: Get space allocation time for dataset creation. Valid
+ * values are H5D_EARLY, H5D_LATE.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * Wednesday, January 16, 2002
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_space_time(hid_t plist_id, H5D_space_time_t *alloc_time/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_space_time, FAIL);
+ H5TRACE2("e","ix",plist_id,alloc_time);
+
+ /* Get the property list structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get values */
+ if(!alloc_time || H5P_get(plist, H5D_CRT_SPACE_TIME_NAME, alloc_time) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get space allocation time");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_fill_time
+ *
+ * Purpose: Set fill value writing time for dataset. Valid values are
+ * H5D_FILL_TIME_ALLOC and H5D_FILL_TIME_NEVER.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * Wednesday, January 16, 2002
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_fill_time, FAIL);
+
+ /* Get the property list structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ if(H5P_set(plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_fill_time
+ *
+ * Purpose: Get fill value writing time. Valid values are H5D_NEVER
+ * and H5D_ALLOC.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * Wednesday, January 16, 2002
+ *
+ * Modifications:
+ *
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value = SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_fill_time, FAIL);
+ H5TRACE2("e","ix",plist_id,fill_time);
+
+ /* Get the property list structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ if(!fill_time || H5P_get(plist, H5D_CRT_FILL_TIME_NAME, fill_time) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
new file mode 100644
index 0000000..15d0557
--- /dev/null
+++ b/src/H5Pdxpl.c
@@ -0,0 +1,750 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id$ */
+
+#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+
+/* Private header files */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Ppkg.h" /* Property lists */
+
+/* Pablo mask */
+#define PABLO_MASK H5Pdxpl_mask
+
+/* Interface initialization */
+#define INTERFACE_INIT NULL
+static int interface_initialize_g = 0;
+
+/* Local datatypes */
+
+/* Static function prototypes */
+
+#ifdef H5_WANT_H5_V1_4_COMPAT
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_buffer
+ *
+ * Purpose: Given a dataset transfer property list, set the maximum size
+ * for the type conversion buffer and background buffer and
+ * optionally supply pointers to application-allocated buffers.
+ * If the buffer size is smaller than the entire amount of data
+ * being transfered between application and file, and a type
+ * conversion buffer or background buffer is required then
+ * strip mining will be used.
+ *
+ * If TCONV and/or BKG are null pointers then buffers will be
+ * allocated and freed during the data transfer.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Monday, March 16, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_buffer(hid_t plist_id, hsize_t _size, void *tconv, void *bkg)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t size=(size_t)_size; /* Work around size difference */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_buffer, FAIL);
+ H5TRACE4("e","ihxx",plist_id,_size,tconv,bkg);
+
+ /* Check arguments */
+ if (size<=0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Update property list */
+ if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size");
+ if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer");
+ if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_buffer
+ *
+ * Purpose: Reads values previously set with H5Pset_buffer().
+ *
+ * Return: Success: Buffer size.
+ *
+ * Failure: 0
+ *
+ * Programmer: Robb Matzke
+ * Monday, March 16, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hsize_t
+H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t size; /* Type conversion buffer size */
+ hsize_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_buffer, 0);
+ H5TRACE3("h","ixx",plist_id,tconv,bkg);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID");
+
+ /* Return values */
+ if (tconv)
+ if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer");
+ if (bkg)
+ if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer");
+
+ /* Get the size */
+ if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size");
+
+ /* Set the return value */
+ ret_value=(hsize_t)size;
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+#else /* H5_WANT_H5_V1_4_COMPAT */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_buffer
+ *
+ * Purpose: Given a dataset transfer property list, set the maximum size
+ * for the type conversion buffer and background buffer and
+ * optionally supply pointers to application-allocated buffers.
+ * If the buffer size is smaller than the entire amount of data
+ * being transfered between application and file, and a type
+ * conversion buffer or background buffer is required then
+ * strip mining will be used.
+ *
+ * If TCONV and/or BKG are null pointers then buffers will be
+ * allocated and freed during the data transfer.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Monday, March 16, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_buffer, FAIL);
+ H5TRACE4("e","izxx",plist_id,size,tconv,bkg);
+
+ /* Check arguments */
+ if (size<=0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Update property list */
+ if(H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size");
+ if(H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer");
+ if(H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_buffer
+ *
+ * Purpose: Reads values previously set with H5Pset_buffer().
+ *
+ * Return: Success: Buffer size.
+ *
+ * Failure: 0
+ *
+ * Programmer: Robb Matzke
+ * Monday, March 16, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+size_t
+H5Pget_buffer(hid_t plist_id, void **tconv/*out*/, void **bkg/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t size; /* Type conversion buffer size */
+ size_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_buffer, 0);
+ H5TRACE3("z","ixx",plist_id,tconv,bkg);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, 0, "can't find object for ID");
+
+ /* Return values */
+ if (tconv)
+ if(H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer");
+ if (bkg)
+ if(H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer");
+
+ /* Get the size */
+ if(H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size");
+
+ /* Set the return value */
+ ret_value=size;
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+#endif /* H5_WANT_H5_V1_4_COMPAT */
+
+#ifdef H5_WANT_H5_V1_4_COMPAT
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_hyper_cache
+ *
+ * Purpose: Given a dataset transfer property list, indicate whether to
+ * cache the hyperslab blocks during the I/O (which speeds
+ * things up) and the maximum size of the hyperslab block to
+ * cache. If a block is smaller than to limit, it may still not
+ * be cached if no memory is available. Setting the limit to 0
+ * indicates no limitation on the size of block to attempt to
+ * cache.
+ *
+ * The default is to cache blocks with no limit on block size
+ * for serial I/O and to not cache blocks for parallel I/O
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 21, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_hyper_cache(hid_t plist_id, unsigned cache, unsigned limit)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED;
+
+ FUNC_ENTER_API(H5Pset_hyper_cache, FAIL);
+ H5TRACE3("e","iIuIu",plist_id,cache,limit);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Update property list */
+ cache = (cache>0) ? 1 : 0;
+ if (H5P_set(plist,H5D_XFER_HYPER_CACHE_NAME,&cache)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to set value");
+ if (H5P_set(plist,H5D_XFER_HYPER_CACHE_LIM_NAME,&limit)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to set value");
+
+done:
+ FUNC_LEAVE (ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_hyper_cache
+ *
+ * Purpose: Reads values previously set with H5Pset_hyper_cache().
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, September 21, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_hyper_cache(hid_t plist_id, unsigned *cache/*out*/,
+ unsigned *limit/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_hyper_cache, FAIL);
+ H5TRACE3("e","ixx",plist_id,cache,limit);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Return values */
+ if (cache)
+ if (H5P_get(plist,H5D_XFER_HYPER_CACHE_NAME,cache)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ if (limit)
+ if (H5P_get(plist,H5D_XFER_HYPER_CACHE_LIM_NAME,limit)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+#endif /* H5_WANT_H5_V1_4_COMPAT */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_preserve
+ *
+ * Purpose: When reading or writing compound data types and the
+ * destination is partially initialized and the read/write is
+ * intended to initialize the other members, one must set this
+ * property to TRUE. Otherwise the I/O pipeline treats the
+ * destination datapoints as completely uninitialized.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 17, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_preserve(hid_t plist_id, hbool_t status)
+{
+ H5T_bkg_t need_bkg; /* Value for background buffer type */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_preserve, FAIL);
+ H5TRACE2("e","ib",plist_id,status);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Update property list */
+ need_bkg = status ? H5T_BKG_YES : H5T_BKG_NO;
+ if (H5P_set(plist,H5D_XFER_BKGR_BUF_TYPE_NAME,&need_bkg)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_preserve
+ *
+ * Purpose: The inverse of H5Pset_preserve()
+ *
+ * Return: Success: TRUE or FALSE
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, March 17, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+H5Pget_preserve(hid_t plist_id)
+{
+ H5T_bkg_t need_bkg; /* Background value */
+ H5P_genplist_t *plist; /* Property list pointer */
+ int ret_value; /* return value */
+
+ FUNC_ENTER_API(H5Pget_preserve, FAIL);
+ H5TRACE1("Is","i",plist_id);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get value */
+ if (H5P_get(plist,H5D_XFER_BKGR_BUF_NAME,&need_bkg)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+
+ /* Set return value */
+ ret_value= need_bkg ? TRUE : FALSE;
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_btree_ratios
+ *
+ * Purpose: Queries B-tree split ratios. See H5Pset_btree_ratios().
+ *
+ * Return: Success: Non-negative with split ratios returned through
+ * the non-null arguments.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Monday, September 28, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_btree_ratios(hid_t plist_id, double *left/*out*/, double *middle/*out*/,
+ double *right/*out*/)
+{
+ double btree_split_ratio[3]; /* B-tree node split ratios */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_btree_ratios, FAIL);
+ H5TRACE4("e","ixxx",plist_id,left,middle,right);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get the split ratios */
+ if (H5P_get(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&btree_split_ratio)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+
+ /* Get values */
+ if (left)
+ *left = btree_split_ratio[0];
+ if (middle)
+ *middle = btree_split_ratio[1];
+ if (right)
+ *right = btree_split_ratio[2];
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_btree_ratios
+ *
+ * Purpose: Sets B-tree split ratios for a dataset transfer property
+ * list. The split ratios determine what percent of children go
+ * in the first node when a node splits. The LEFT ratio is
+ * used when the splitting node is the left-most node at its
+ * level in the tree; the RIGHT ratio is when the splitting node
+ * is the right-most node at its level; and the MIDDLE ratio for
+ * all other cases. A node which is the only node at its level
+ * in the tree uses the RIGHT ratio when it splits. All ratios
+ * are real numbers between 0 and 1, inclusive.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Monday, September 28, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_btree_ratios(hid_t plist_id, double left, double middle,
+ double right)
+{
+ double split_ratio[3]; /* B-tree node split ratios */
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_btree_ratios, FAIL);
+ H5TRACE4("e","iddd",plist_id,left,middle,right);
+
+ /* Check arguments */
+ if (left<0.0 || left>1.0 || middle<0.0 || middle>1.0 ||
+ right<0.0 || right>1.0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0<=X<=1.0");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ split_ratio[0] = left;
+ split_ratio[1] = middle;
+ split_ratio[2] = right;
+
+ /* Set the split ratios */
+ if (H5P_set(plist,H5D_XFER_BTREE_SPLIT_RATIO_NAME,&split_ratio)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_set_vlen_mem_manager
+ *
+ * Purpose: Sets the memory allocate/free pair for VL datatypes. The
+ * allocation routine is called when data is read into a new
+ * array and the free routine is called when H5Dvlen_reclaim is
+ * called. The alloc_info and free_info are user parameters
+ * which are passed to the allocation and freeing functions
+ * respectively. To reset the allocate/free functions to the
+ * default setting of using the system's malloc/free functions,
+ * call this routine with alloc_func and free_func set to NULL.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, July 1, 1999
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func,
+ void *alloc_info, H5MM_free_t free_func, void *free_info)
+{
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_NOAPI(H5P_set_vlen_mem_manager, FAIL);
+
+ assert(plist);
+
+ /* Update property list */
+ if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_NAME,&alloc_func)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ if (H5P_set(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,&alloc_info)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ if (H5P_set(plist,H5D_XFER_VLEN_FREE_NAME,&free_func)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+ if (H5P_set(plist,H5D_XFER_VLEN_FREE_INFO_NAME,&free_info)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5P_set_vlen_mem_manager() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_vlen_mem_manager
+ *
+ * Purpose: Sets the memory allocate/free pair for VL datatypes. The
+ * allocation routine is called when data is read into a new
+ * array and the free routine is called when H5Dvlen_reclaim is
+ * called. The alloc_info and free_info are user parameters
+ * which are passed to the allocation and freeing functions
+ * respectively. To reset the allocate/free functions to the
+ * default setting of using the system's malloc/free functions,
+ * call this routine with alloc_func and free_func set to NULL.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, July 1, 1999
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func,
+ void *alloc_info, H5MM_free_t free_func, void *free_info)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_vlen_mem_manager, FAIL);
+ H5TRACE5("e","ixxxx",plist_id,alloc_func,alloc_info,free_func,free_info);
+
+ /* Check arguments */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list");
+
+ /* Update property list */
+ if (H5P_set_vlen_mem_manager(plist,alloc_func,alloc_info,free_func,free_info)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set values");
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5Pset_vlen_mem_manager() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_vlen_mem_manager
+ *
+ * Purpose: The inverse of H5Pset_vlen_mem_manager()
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, July 1, 1999
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func/*out*/,
+ void **alloc_info/*out*/,
+ H5MM_free_t *free_func/*out*/,
+ void **free_info/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_vlen_mem_manager, FAIL);
+ H5TRACE5("e","ixxxx",plist_id,alloc_func,alloc_info,free_func,free_info);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ if(alloc_func!=NULL)
+ if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_NAME,alloc_func)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ if(alloc_info!=NULL)
+ if (H5P_get(plist,H5D_XFER_VLEN_ALLOC_INFO_NAME,alloc_info)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ if(free_func!=NULL)
+ if (H5P_get(plist,H5D_XFER_VLEN_FREE_NAME,free_func)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+ if(free_info!=NULL)
+ if (H5P_get(plist,H5D_XFER_VLEN_FREE_INFO_NAME,free_info)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_hyper_vector_size
+ *
+ * Purpose: Given a dataset transfer property list, set the number of
+ * "I/O vectors" (offset and length pairs) which are to be
+ * accumulated in memory before being issued to the lower levels
+ * of the library for reading or writing the actual data.
+ * Increasing the number should give better performance, but use
+ * more memory during hyperslab I/O. The vector size must be
+ * greater than 1.
+ *
+ * The default is to use 1024 vectors for I/O during hyperslab
+ * reading/writing.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, July 9, 2001
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_hyper_vector_size, FAIL);
+ H5TRACE2("e","iz",plist_id,vector_size);
+
+ /* Check arguments */
+ if (vector_size<1)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "vector size too small");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Update property list */
+ if (H5P_set(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,&vector_size)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value");
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5Pset_hyper_vector_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_hyper_vector_size
+ *
+ * Purpose: Reads values previously set with H5Pset_hyper_vector_size().
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Monday, July 9, 2001
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_hyper_vector_size, FAIL);
+ H5TRACE2("e","ix",plist_id,vector_size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Return values */
+ if (vector_size)
+ if (H5P_get(plist,H5D_XFER_HYPER_VECTOR_SIZE_NAME,vector_size)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value");
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5Pget_hyper_vector_size() */
+
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
new file mode 100644
index 0000000..a20a1b1
--- /dev/null
+++ b/src/H5Pfapl.c
@@ -0,0 +1,1287 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id$ */
+
+#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+
+/* Private header files */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Ppkg.h" /* Property lists */
+
+/* Default file driver - see H5Pget_driver() */
+#include "H5FDsec2.h" /* Posix unbuffered I/O file driver */
+
+/* Pablo mask */
+#define PABLO_MASK H5Pfapl_mask
+
+/* Interface initialization */
+#define INTERFACE_INIT NULL
+static int interface_initialize_g = 0;
+
+/* Local datatypes */
+
+/* Static function prototypes */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_alignment
+ *
+ * Purpose: Sets the alignment properties of a file access property list
+ * so that any file object >= THRESHOLD bytes will be aligned on
+ * an address which is a multiple of ALIGNMENT. The addresses
+ * are relative to the end of the user block; the alignment is
+ * calculated by subtracting the user block size from the
+ * absolute file address and then adjusting the address to be a
+ * multiple of ALIGNMENT.
+ *
+ * Default values for THRESHOLD and ALIGNMENT are one, implying
+ * no alignment. Generally the default values will result in
+ * the best performance for single-process access to the file.
+ * For MPI-IO and other parallel systems, choose an alignment
+ * which is a multiple of the disk block size.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, June 9, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed file access property list mechanism to the new
+ * generic property list.
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_alignment, FAIL);
+ H5TRACE3("e","ihh",fapl_id,threshold,alignment);
+
+ /* Check args */
+ if (alignment<1)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "alignment must be positive");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ if(H5P_set(plist, H5F_ACS_ALIGN_THRHD_NAME, &threshold) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set threshold");
+ if(H5P_set(plist, H5F_ACS_ALIGN_NAME, &alignment) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_alignment
+ *
+ * Purpose: Returns the current settings for alignment properties from a
+ * file access property list. The THRESHOLD and/or ALIGNMENT
+ * pointers may be null pointers.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, June 9, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list design to the new generic
+ * property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_alignment(hid_t fapl_id, hsize_t *threshold/*out*/,
+ hsize_t *alignment/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_alignment, FAIL);
+ H5TRACE3("e","ixx",fapl_id,threshold,alignment);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get values */
+ if (threshold)
+ if(H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, threshold) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get threshold");
+ if (alignment)
+ if(H5P_get(plist, H5F_ACS_ALIGN_NAME, alignment) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_set_driver
+ *
+ * Purpose: Set the file driver (DRIVER_ID) for a file access or data
+ * transfer property list (PLIST_ID) and supply an optional
+ * struct containing the driver-specific properites
+ * (DRIVER_INFO). The driver properties will be copied into the
+ * property list and the reference count on the driver will be
+ * incremented, allowing the caller to close the driver ID but
+ * still use the property list.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, August 3, 1999
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list design to the new generic
+ * property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_driver_info)
+{
+ hid_t driver_id; /* VFL driver ID */
+ void *driver_info; /* VFL driver info */
+ void *tmp_driver_info; /* Temporary VFL driver info */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5P_set_driver, FAIL);
+
+ if (NULL==H5I_object_verify(new_driver_id, H5I_VFL))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID");
+
+ if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ /* Remove old driver */
+ if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID");
+ if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,"can't get driver info");
+ assert(driver_id>=0);
+ H5FD_fapl_free(driver_id, driver_info);
+ H5I_dec_ref(driver_id);
+
+ /* Add new driver */
+ H5I_inc_ref(new_driver_id);
+ driver_id = new_driver_id;
+ driver_info = H5FD_fapl_copy(new_driver_id, new_driver_info);
+
+ if(H5P_set(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver ID");
+ if(H5P_set(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't set driver info");
+
+ } else if( TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER) ) {
+ /* Get the current driver information */
+ if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
+ if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info");
+
+ /* Remove old driver */
+
+ /* Double-check value... */
+ assert(driver_id>=0);
+
+ /* Free any driver information stored */
+ H5FD_dxpl_free(driver_id, driver_info);
+
+ /* Decrement reference count for old driver */
+ H5I_dec_ref(driver_id);
+
+ /* Add new driver */
+
+ /* Increment reference count for new driver */
+ H5I_inc_ref(new_driver_id);
+
+ /* Make a copy of the driver information */
+ if((tmp_driver_info = H5FD_dxpl_copy(new_driver_id, new_driver_info))==NULL)
+ HGOTO_ERROR (H5E_DATASET, H5E_CANTCOPY, FAIL, "Can't copy VFL driver");
+
+ /* Set the driver info for the property list */
+ if(H5P_set(plist, H5D_XFER_VFL_ID_NAME, &new_driver_id)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver ID");
+ if(H5P_set(plist, H5D_XFER_VFL_INFO_NAME, &tmp_driver_info) < 0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver info");
+
+ } else {
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list");
+ }
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5P_set_driver() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_driver
+ *
+ * Purpose: Set the file driver (DRIVER_ID) for a file access or data
+ * transfer property list (PLIST_ID) and supply an optional
+ * struct containing the driver-specific properites
+ * (DRIVER_INFO). The driver properties will be copied into the
+ * property list and the reference count on the driver will be
+ * incremented, allowing the caller to close the driver ID but
+ * still use the property list.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, August 3, 1999
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list design to the new generic
+ * property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pset_driver, FAIL);
+ H5TRACE3("e","iix",plist_id,new_driver_id,new_driver_info);
+
+ /* Check arguments */
+ if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+ if (NULL==H5I_object_verify(new_driver_id, H5I_VFL))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID");
+
+ /* Set the driver */
+ if(H5P_set_driver(plist,new_driver_id,new_driver_info)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info");
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5Pset_driver() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_get_driver
+ *
+ * Purpose: Return the ID of the low-level file driver. PLIST_ID should
+ * be a file access property list or data transfer propert list.
+ *
+ * Return: Success: A low-level driver ID which is the same ID
+ * used when the driver was set for the property
+ * list. The driver ID is only valid as long as
+ * the file driver remains registered.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Thursday, February 26, 1998
+ *
+ * Modifications:
+ * Robb Matzke, 1999-08-03
+ * Rewritten to use the virtual file layer.
+ *
+ * Robb Matzke, 1999-08-05
+ * If the driver ID is H5FD_VFD_DEFAULT then substitute the
+ * current value of H5FD_SEC2.
+ *
+ * Quincey Koziol 2000-11-28
+ * Added internal function..
+ *
+ * Raymond Lu, 2001-10-23
+ * Changed the file access list design to the new generic
+ * property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5P_get_driver(H5P_genplist_t *plist)
+{
+ hid_t ret_value=FAIL; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5P_get_driver, FAIL);
+
+ /* Get the current driver ID */
+ if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &ret_value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID");
+ } else if( TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER) ) {
+ if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &ret_value)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
+ } else {
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access or data transfer property list");
+ }
+
+ if (H5FD_VFD_DEFAULT==ret_value)
+ ret_value = H5FD_SEC2;
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_driver
+ *
+ * Purpose: Return the ID of the low-level file driver. PLIST_ID should
+ * be a file access property list or data transfer propert list.
+ *
+ * Return: Success: A low-level driver ID which is the same ID
+ * used when the driver was set for the property
+ * list. The driver ID is only valid as long as
+ * the file driver remains registered.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Thursday, February 26, 1998
+ *
+ * Modifications:
+ * Robb Matzke, 1999-08-03
+ * Rewritten to use the virtual file layer.
+ *
+ * Robb Matzke, 1999-08-05
+ * If the driver ID is H5FD_VFD_DEFAULT then substitute the current value of
+ * H5FD_SEC2.
+ *
+ * Quincey Koziol 2000-11-28
+ * Added internal function..
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5Pget_driver(hid_t plist_id)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ hid_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_driver, FAIL);
+ H5TRACE1("i","i",plist_id);
+
+ if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+
+ ret_value = H5P_get_driver(plist);
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P_get_driver_info
+ *
+ * Purpose: Returns a pointer directly to the file driver-specific
+ * information of a file access or data transfer property list.
+ *
+ * Return: Success: Ptr to *uncopied* driver specific data
+ * structure if any.
+ *
+ * Failure: NULL. Null is also returned if the driver has
+ * not registered any driver-specific properties
+ * although no error is pushed on the stack in
+ * this case.
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, August 4, 1999
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list design to the new generic
+ * property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5P_get_driver_info(H5P_genplist_t *plist)
+{
+ void *ret_value=NULL;
+
+ FUNC_ENTER_NOAPI(H5P_get_driver_info, NULL);
+
+ /* Get the current driver info */
+ if( TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS) ) {
+ if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &ret_value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,NULL,"can't get driver info");
+ } else if( TRUE == H5P_isa_class(plist->plist_id, H5P_DATASET_XFER) ) {
+ if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &ret_value)<0)
+ HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, NULL, "Can't retrieve VFL driver ID");
+ } else {
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access or data transfer property list");
+ }
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5P_get_driver_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_driver_info
+ *
+ * Purpose: Returns a pointer directly to the file driver-specific
+ * information of a file access or data transfer property list.
+ *
+ * Return: Success: Ptr to *uncopied* driver specific data
+ * structure if any.
+ *
+ * Failure: NULL. Null is also returned if the driver has
+ * not registered any driver-specific properties
+ * although no error is pushed on the stack in
+ * this case.
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, August 4, 1999
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list design to the new generic
+ * property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5Pget_driver_info(hid_t plist_id)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ void *ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_driver_info, NULL);
+
+ if(NULL == (plist = H5I_object_verify(plist_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list");
+
+ if((ret_value=H5P_get_driver_info(plist))==NULL)
+ HGOTO_ERROR(H5E_PLIST,H5E_CANTGET,NULL,"can't get driver info");
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5Pget_driver_info() */
+
+#ifdef H5_WANT_H5_V1_4_COMPAT
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_cache
+ *
+ * Purpose: Set the number of objects in the meta data cache and the
+ * maximum number of chunks and bytes in the raw data chunk
+ * cache.
+ *
+ * The RDCC_W0 value should be between 0 and 1 inclusive and
+ * indicates how much chunks that have been fully read or fully
+ * written are favored for preemption. A value of zero means
+ * fully read or written chunks are treated no differently than
+ * other chunks (the preemption is strictly LRU) while a value
+ * of one means fully read chunks are always preempted before
+ * other chunks.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, May 19, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_cache(hid_t plist_id, int mdc_nelmts,
+ int _rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t rdcc_nelmts=(size_t)_rdcc_nelmts; /* Work around variable changing size */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_cache, FAIL);
+ H5TRACE5("e","iIsIszd",plist_id,mdc_nelmts,_rdcc_nelmts,rdcc_nbytes,
+ rdcc_w0);
+
+ /* Check arguments */
+ if (mdc_nelmts<0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "meta data cache size must be non-negative");
+ if (rdcc_w0<0.0 || rdcc_w0>1.0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set sizes */
+ if(H5P_set(plist, H5F_ACS_META_CACHE_SIZE_NAME, &mdc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set meta data cache size");
+ if(H5P_set(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &rdcc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache element size");
+ if(H5P_set(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache byte size");
+ if(H5P_set(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set preempt read chunks");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_cache
+ *
+ * Purpose: Retrieves the maximum possible number of elements in the meta
+ * data cache and the maximum possible number of elements and
+ * bytes and the RDCC_W0 value in the raw data chunk cache. Any
+ * (or all) arguments may be null pointers in which case the
+ * corresponding datum is not returned.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, May 19, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_cache(hid_t plist_id, int *mdc_nelmts,
+ int *_rdcc_nelmts, size_t *rdcc_nbytes, double *rdcc_w0)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t rdcc_nelmts; /* Work around variable changing size */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_cache, FAIL);
+ H5TRACE5("e","i*Is*Is*z*d",plist_id,mdc_nelmts,_rdcc_nelmts,rdcc_nbytes,
+ rdcc_w0);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get sizes */
+ if (mdc_nelmts)
+ if(H5P_get(plist, H5F_ACS_META_CACHE_SIZE_NAME, mdc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get meta data cache size");
+ if (_rdcc_nelmts) {
+ if(H5P_get(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &rdcc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache element size");
+ *_rdcc_nelmts=rdcc_nelmts;
+ } /* end if */
+ if (rdcc_nbytes)
+ if(H5P_get(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, rdcc_nbytes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache byte size");
+ if (rdcc_w0)
+ if(H5P_get(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, rdcc_w0) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get preempt read chunks");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+#else /* H5_WANT_H5_V1_4_COMPAT */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_cache
+ *
+ * Purpose: Set the number of objects in the meta data cache and the
+ * maximum number of chunks and bytes in the raw data chunk
+ * cache.
+ *
+ * The RDCC_W0 value should be between 0 and 1 inclusive and
+ * indicates how much chunks that have been fully read or fully
+ * written are favored for preemption. A value of zero means
+ * fully read or written chunks are treated no differently than
+ * other chunks (the preemption is strictly LRU) while a value
+ * of one means fully read chunks are always preempted before
+ * other chunks.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, May 19, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_cache(hid_t plist_id, int mdc_nelmts,
+ size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_cache, FAIL);
+ H5TRACE5("e","iIszzd",plist_id,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
+
+ /* Check arguments */
+ if (mdc_nelmts<0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "meta data cache size must be non-negative");
+ if (rdcc_w0<0.0 || rdcc_w0>1.0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set sizes */
+ if(H5P_set(plist, H5F_ACS_META_CACHE_SIZE_NAME, &mdc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set meta data cache size");
+ if(H5P_set(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &rdcc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache element size");
+ if(H5P_set(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache byte size");
+ if(H5P_set(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set preempt read chunks");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_cache
+ *
+ * Purpose: Retrieves the maximum possible number of elements in the meta
+ * data cache and the maximum possible number of elements and
+ * bytes and the RDCC_W0 value in the raw data chunk cache. Any
+ * (or all) arguments may be null pointers in which case the
+ * corresponding datum is not returned.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, May 19, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_cache(hid_t plist_id, int *mdc_nelmts,
+ size_t *rdcc_nelmts, size_t *rdcc_nbytes, double *rdcc_w0)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_cache, FAIL);
+ H5TRACE5("e","i*Is*z*z*d",plist_id,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,
+ rdcc_w0);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get sizes */
+ if (mdc_nelmts)
+ if(H5P_get(plist, H5F_ACS_META_CACHE_SIZE_NAME, mdc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get meta data cache size");
+ if (rdcc_nelmts)
+ if(H5P_get(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, rdcc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache element size");
+ if (rdcc_nbytes)
+ if(H5P_get(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, rdcc_nbytes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache byte size");
+ if (rdcc_w0)
+ if(H5P_get(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, rdcc_w0) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get preempt read chunks");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+#endif /* H5_WANT_H5_V1_4_COMPAT */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_gc_references
+ *
+ * Purpose: Sets the flag for garbage collecting references for the file.
+ * Dataset region references (and other reference types
+ * probably) use space in the file heap. If garbage collection
+ * is on and the user passes in an uninitialized value in a
+ * reference structure, the heap might get corrupted. When
+ * garbage collection is off however and the user re-uses a
+ * reference, the previous heap block will be orphaned and not
+ * returned to the free heap space. When garbage collection is
+ * on, the user must initialize the reference structures to 0 or
+ * risk heap corruption.
+ *
+ * Default value for garbage collecting references is off, just
+ * to be on the safe side.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * June, 1999
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_gc_references(hid_t plist_id, unsigned gc_ref)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_gc_references, FAIL);
+ H5TRACE2("e","iIu",plist_id,gc_ref);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ if(H5P_set(plist, H5F_ACS_GARBG_COLCT_REF_NAME, &gc_ref) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set garbage collect reference");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_gc_references
+ *
+ * Purpose: Returns the current setting for the garbage collection
+ * references property from a file access property list.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * June, 1999
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_gc_references(hid_t plist_id, unsigned *gc_ref/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_gc_references, FAIL);
+ H5TRACE2("e","ix",plist_id,gc_ref);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get values */
+ if (gc_ref)
+ if(H5P_get(plist, H5F_ACS_GARBG_COLCT_REF_NAME, gc_ref) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get garbage collect reference");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_fclose_degree
+ *
+ * Purpose: Sets the degree for the file close behavior.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * November, 2001
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_fclose_degree(hid_t plist_id, H5F_close_degree_t degree)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_fclose_degree, FAIL);
+ H5TRACE2("e","iFc",plist_id,degree);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ if(H5P_set(plist, H5F_CLOSE_DEGREE_NAME, &degree) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_fclose_degree
+ *
+ * Purpose: Returns the current setting for the garbage collection
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * June, 1999
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t H5Pget_fclose_degree(hid_t plist_id, H5F_close_degree_t *degree)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_fclose_degree, FAIL);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ if( degree && (H5P_get(plist, H5F_CLOSE_DEGREE_NAME, degree) < 0) )
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_meta_block_size
+ *
+ * Purpose: Sets the minimum size of metadata block allocations when
+ * the H5FD_FEAT_AGGREGATE_METADATA is set by a VFL driver.
+ * Each "raw" metadata block is allocated to be this size and then
+ * specific pieces of metadata (object headers, local heaps, B-trees, etc)
+ * are sub-allocated from this block.
+ *
+ * The default value is set to 2048 (bytes), indicating that metadata
+ * will be attempted to be bunched together in (at least) 2K blocks in
+ * the file. Setting the value to 0 with this API function will
+ * turn off the metadata aggregation, even if the VFL driver attempts to
+ * use that strategy.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 25, 2000
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_meta_block_size(hid_t plist_id, hsize_t size)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_meta_block_size, FAIL);
+ H5TRACE2("e","ih",plist_id,size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ if(H5P_set(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set meta data block size");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_meta_block_size
+ *
+ * Purpose: Returns the current settings for the metadata block allocation
+ * property from a file access property list.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, August 29, 2000
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_meta_block_size(hid_t plist_id, hsize_t *size/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_meta_block_size, FAIL);
+ H5TRACE2("e","ix",plist_id,size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get values */
+ if (size) {
+ if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get meta data block size");
+ } /* end if */
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+#ifdef H5_WANT_H5_V1_4_COMPAT
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_sieve_buf_size
+ *
+ * Purpose: Sets the maximum size of the data seive buffer used for file
+ * drivers which are capable of using data sieving. The data sieve
+ * buffer is used when performing I/O on datasets in the file. Using a
+ * buffer which is large anough to hold several pieces of the dataset
+ * being read in for hyperslab selections boosts performance by quite a
+ * bit.
+ *
+ * The default value is set to 64KB, indicating that file I/O for raw data
+ * reads and writes will occur in at least 64KB blocks.
+ * Setting the value to 0 with this API function will turn off the
+ * data sieving, even if the VFL driver attempts to use that strategy.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, September 21, 2000
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_sieve_buf_size(hid_t plist_id, hsize_t _size)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t size=(size_t)_size; /* Work around size difference */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_sieve_buf_size, FAIL);
+ H5TRACE2("e","ih",plist_id,_size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ if(H5P_set(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set sieve buffer size");
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5Pset_sieve_buf_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_sieve_buf_size
+ *
+ * Purpose: Returns the current settings for the data sieve buffer size
+ * property from a file access property list.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, September 21, 2000
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_sieve_buf_size(hid_t plist_id, hsize_t *_size/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t size; /* Work around size difference */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_sieve_buf_size, FAIL);
+ H5TRACE2("e","ix",plist_id,_size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get values */
+ if (_size) {
+ if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get sieve buffer size");
+ *_size=size;
+ } /* end if */
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5Pget_sieve_buf_size() */
+#else /* H5_WANT_H5_V1_4_COMPAT */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_sieve_buf_size
+ *
+ * Purpose: Sets the maximum size of the data seive buffer used for file
+ * drivers which are capable of using data sieving. The data sieve
+ * buffer is used when performing I/O on datasets in the file. Using a
+ * buffer which is large anough to hold several pieces of the dataset
+ * being read in for hyperslab selections boosts performance by quite a
+ * bit.
+ *
+ * The default value is set to 64KB, indicating that file I/O for raw data
+ * reads and writes will occur in at least 64KB blocks.
+ * Setting the value to 0 with this API function will turn off the
+ * data sieving, even if the VFL driver attempts to use that strategy.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, September 21, 2000
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_sieve_buf_size(hid_t plist_id, size_t size)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_sieve_buf_size, FAIL);
+ H5TRACE2("e","iz",plist_id,size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ if(H5P_set(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set sieve buffer size");
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5Pset_sieve_buf_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_sieve_buf_size
+ *
+ * Purpose: Returns the current settings for the data sieve buffer size
+ * property from a file access property list.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, September 21, 2000
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_sieve_buf_size(hid_t plist_id, size_t *size/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_sieve_buf_size, FAIL);
+ H5TRACE2("e","ix",plist_id,size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get values */
+ if (size)
+ if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get sieve buffer size");
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5Pget_sieve_buf_size() */
+#endif /* H5_WANT_H5_V1_4_COMPAT */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_small_data_block_size
+ *
+ * Purpose: Sets the minimum size of "small" raw data block allocations
+ * when the H5FD_FEAT_AGGREGATE_SMALLDATA is set by a VFL driver.
+ * Each "small" raw data block is allocated to be this size and then
+ * pieces of raw data which are small enough to fit are sub-allocated from
+ * this block.
+ *
+ * The default value is set to 2048 (bytes), indicating that raw data
+ * smaller than this value will be attempted to be bunched together in (at
+ * least) 2K blocks in the file. Setting the value to 0 with this API
+ * function will turn off the "small" raw data aggregation, even if the
+ * VFL driver attempts to use that strategy.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, June 5, 2002
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_small_data_block_size(hid_t plist_id, hsize_t size)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_small_data_block_size, FAIL);
+ H5TRACE2("e","ih",plist_id,size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ if(H5P_set(plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' block size");
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5Pset_small_data_block_size() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_small_data_block_size
+ *
+ * Purpose: Returns the current settings for the "small" raw data block
+ * allocation property from a file access property list.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, June 5, 2002
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_small_data_block_size(hid_t plist_id, hsize_t *size/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_small_data_block_size, FAIL);
+ H5TRACE2("e","ix",plist_id,size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get values */
+ if (size) {
+ if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get 'small data' block size");
+ } /* end if */
+
+done:
+ FUNC_LEAVE(ret_value);
+} /* end H5Pget_small_data_block_size() */
+
diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c
new file mode 100644
index 0000000..93a4390
--- /dev/null
+++ b/src/H5Pfcpl.c
@@ -0,0 +1,609 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* $Id$ */
+
+#define H5P_PACKAGE /*suppress error about including H5Ppkg */
+
+/* Private header files */
+#include "H5private.h" /* Generic Functions */
+#include "H5Bprivate.h" /* B-tree subclass names */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5Ppkg.h" /* Property lists */
+
+/* Pablo mask */
+#define PABLO_MASK H5Pfcpl_mask
+
+/* Interface initialization */
+#define INTERFACE_INIT NULL
+static int interface_initialize_g = 0;
+
+/* Local datatypes */
+
+/* Static function prototypes */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_version
+ *
+ * Purpose: Retrieves version information for various parts of a file.
+ *
+ * BOOT: The file boot block.
+ * HEAP: The global heap.
+ * FREELIST: The global free list.
+ * STAB: The root symbol table entry.
+ * SHHDR: Shared object headers.
+ *
+ * Any (or even all) of the output arguments can be null
+ * pointers.
+ *
+ * Return: Success: Non-negative, version information is returned
+ * through the arguments.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, January 7, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu, Oct 14, 2001
+ * Change to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_version(hid_t plist_id, int *boot/*out*/, int *freelist/*out*/,
+ int *stab/*out*/, int *shhdr/*out*/)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_version, FAIL);
+ H5TRACE5("e","ixxxx",plist_id,boot,freelist,stab,shhdr);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get values */
+ if (boot)
+ if(H5P_get(plist, H5F_CRT_BOOT_VERS_NAME, boot) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get boot version");
+ if (freelist)
+ if(H5P_get(plist, H5F_CRT_FREESPACE_VERS_NAME, freelist) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space version");
+ if (stab)
+ if(H5P_get(plist, H5F_CRT_OBJ_DIR_VERS_NAME, stab) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object directory version");
+ if (shhdr)
+ if(H5P_get(plist, H5F_CRT_SHARE_HEAD_VERS_NAME, shhdr) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get shared-header version");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_userblock
+ *
+ * Purpose: Sets the userblock size field of a file creation property
+ * list.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, January 6, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu, Oct 14, 2001
+ * Changed to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_userblock(hid_t plist_id, hsize_t size)
+{
+ unsigned i;
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_userblock, FAIL);
+ H5TRACE2("e","ih",plist_id,size);
+
+ /* Check that the userblock size is a power of two */
+ for (i=8; i<8*sizeof(hsize_t); i++) {
+ hsize_t p2 = 8==i ? 0 : ((hsize_t)1<<i);
+
+ if (size == p2)
+ break;
+ }
+ if (i>=8*sizeof(hsize_t))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "userblock size is not valid");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set value */
+ if(H5P_set(plist, H5F_CRT_USER_BLOCK_NAME, &size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set user block");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_userblock
+ *
+ * Purpose: Queries the size of a user block in a file creation property
+ * list.
+ *
+ * Return: Success: Non-negative, size returned through SIZE argument.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, January 7, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu, Oct 14, 2001
+ * Changed to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_userblock(hid_t plist_id, hsize_t *size)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_userblock, FAIL);
+ H5TRACE2("e","i*h",plist_id,size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get value */
+ if (size)
+ if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,"can't get user block");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_sizes
+ *
+ * Purpose: Sets file size-of addresses and sizes. PLIST_ID should be a
+ * file creation property list. A value of zero causes the
+ * property to not change.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, January 6, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pset_sizes, FAIL);
+ H5TRACE3("e","izz",plist_id,sizeof_addr,sizeof_size);
+
+ /* Check arguments */
+ if (sizeof_addr) {
+ if (sizeof_addr != 2 && sizeof_addr != 4 &&
+ sizeof_addr != 8 && sizeof_addr != 16)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file haddr_t size is not valid");
+ }
+ if (sizeof_size) {
+ if (sizeof_size != 2 && sizeof_size != 4 &&
+ sizeof_size != 8 && sizeof_size != 16)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file size_t size is not valid");
+ }
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set value */
+ if (sizeof_addr)
+ if(H5P_set(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &sizeof_addr) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for an address");
+ if (sizeof_size)
+ if(H5P_set(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &sizeof_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for object ");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_sizes
+ *
+ * Purpose: Returns the size of address and size quantities stored in a
+ * file according to a file creation property list. Either (or
+ * even both) SIZEOF_ADDR and SIZEOF_SIZE may be null pointers.
+ *
+ * Return: Success: Non-negative, sizes returned through arguments.
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, January 7, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_sizes(hid_t plist_id,
+ size_t *sizeof_addr /*out */ , size_t *sizeof_size /*out */ )
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_sizes, FAIL);
+ H5TRACE3("e","ixx",plist_id,sizeof_addr,sizeof_size);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get values */
+ if (sizeof_addr)
+ if(H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, sizeof_addr) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for an address");
+ if (sizeof_size)
+ if(H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, sizeof_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for object ");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+#ifdef H5_WANT_H5_V1_4_COMPAT
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_sym_k
+ *
+ * Purpose: IK is one half the rank of a tree that stores a symbol
+ * table for a group. Internal nodes of the symbol table are on
+ * average 75% full. That is, the average rank of the tree is
+ * 1.5 times the value of IK.
+ *
+ * LK is one half of the number of symbols that can be stored in
+ * a symbol table node. A symbol table node is the leaf of a
+ * symbol table tree which is used to store a group. When
+ * symbols are inserted randomly into a group, the group's
+ * symbol table nodes are 75% full on average. That is, they
+ * contain 1.5 times the number of symbols specified by LK.
+ *
+ * Either (or even both) of IK and LK can be zero in which case
+ * that value is left unchanged.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, January 6, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu, Oct 14, 2001
+ * Changed to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_sym_k(hid_t plist_id, int ik, int lk)
+{
+ int btree_k[H5B_NUM_BTREE_ID];
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pset_sym_k, FAIL);
+ H5TRACE3("e","iIsIs",plist_id,ik,lk);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ if (ik > 0) {
+ if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes");
+ btree_k[H5B_SNODE_ID] = ik;
+ if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree nodes");
+ }
+ if (lk > 0)
+ if(H5P_set(plist, H5F_CRT_SYM_LEAF_NAME, &lk) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for symbol table leaf nodes");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_sym_k
+ *
+ * Purpose: Retrieves the symbol table B-tree 1/2 rank (IK) and the
+ * symbol table leaf node 1/2 size (LK). See H5Pset_sym_k() for
+ * details. Either (or even both) IK and LK may be null
+ * pointers.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, January 7, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Changed to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_sym_k(hid_t plist_id, int *ik /*out */ , int *lk /*out */ )
+{
+ int btree_k[H5B_NUM_BTREE_ID];
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_sym_k, FAIL);
+ H5TRACE3("e","ixx",plist_id,ik,lk);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get values */
+ if (ik) {
+ if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree nodes");
+ *ik = btree_k[H5B_SNODE_ID];
+ }
+ if (lk)
+ if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, lk) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for symbol table leaf nodes");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+#else /* H5_WANT_H5_V1_4_COMPAT */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_sym_k
+ *
+ * Purpose: IK is one half the rank of a tree that stores a symbol
+ * table for a group. Internal nodes of the symbol table are on
+ * average 75% full. That is, the average rank of the tree is
+ * 1.5 times the value of IK.
+ *
+ * LK is one half of the number of symbols that can be stored in
+ * a symbol table node. A symbol table node is the leaf of a
+ * symbol table tree which is used to store a group. When
+ * symbols are inserted randomly into a group, the group's
+ * symbol table nodes are 75% full on average. That is, they
+ * contain 1.5 times the number of symbols specified by LK.
+ *
+ * Either (or even both) of IK and LK can be zero in which case
+ * that value is left unchanged.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, January 6, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu, Oct 14, 2001
+ * Changed to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_sym_k(hid_t plist_id, int ik, unsigned lk)
+{
+ int btree_k[H5B_NUM_BTREE_ID];
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pset_sym_k, FAIL);
+ H5TRACE3("e","iIsIu",plist_id,ik,lk);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set values */
+ if (ik > 0) {
+ if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes");
+ btree_k[H5B_SNODE_ID] = ik;
+ if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree nodes");
+ }
+ if (lk > 0)
+ if(H5P_set(plist, H5F_CRT_SYM_LEAF_NAME, &lk) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for symbol table leaf nodes");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_sym_k
+ *
+ * Purpose: Retrieves the symbol table B-tree 1/2 rank (IK) and the
+ * symbol table leaf node 1/2 size (LK). See H5Pset_sym_k() for
+ * details. Either (or even both) IK and LK may be null
+ * pointers.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, January 7, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu
+ * Changed to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_sym_k(hid_t plist_id, int *ik /*out */ , unsigned *lk /*out */ )
+{
+ int btree_k[H5B_NUM_BTREE_ID];
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pget_sym_k, FAIL);
+ H5TRACE3("e","ixx",plist_id,ik,lk);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get values */
+ if (ik) {
+ if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree nodes");
+ *ik = btree_k[H5B_SNODE_ID];
+ }
+ if (lk)
+ if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, lk) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for symbol table leaf nodes");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+#endif /* H5_WANT_H5_V1_4_COMPAT */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_istore_k
+ *
+ * Purpose: IK is one half the rank of a tree that stores chunked raw
+ * data. On average, such a tree will be 75% full, or have an
+ * average rank of 1.5 times the value of IK.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, January 6, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu, Oct 14, 2001
+ * Changed to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_istore_k(hid_t plist_id, int ik)
+{
+ int btree_k[H5B_NUM_BTREE_ID];
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(H5Pset_istore_k, FAIL);
+ H5TRACE2("e","iIs",plist_id,ik);
+
+ /* Check arguments */
+ if (ik <= 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value must be positive");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set value */
+ if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes");
+ btree_k[H5B_ISTORE_ID] = ik;
+ if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree interanl nodes");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_istore_k
+ *
+ * Purpose: Queries the 1/2 rank of an indexed storage B-tree. See
+ * H5Pset_istore_k() for details. The argument IK may be the
+ * null pointer.
+ *
+ * Return: Success: Non-negative, size returned through IK
+ *
+ * Failure: Negative
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, January 7, 1998
+ *
+ * Modifications:
+ *
+ * Raymond Lu, Oct 14, 2001
+ * Changed to the new generic property list.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_istore_k(hid_t plist_id, int *ik /*out */ )
+{
+ int btree_k[H5B_NUM_BTREE_ID];
+ H5P_genplist_t *plist; /* Property list pointer */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER_API(H5Pget_istore_k, FAIL);
+ H5TRACE2("e","ix",plist_id,ik);
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get value */
+ if (ik) {
+ if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes");
+ *ik = btree_k[H5B_ISTORE_ID];
+ }
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
diff --git a/src/Makefile.in b/src/Makefile.in
index 78aef12..4f7a155 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -25,9 +25,10 @@ LIB_SRC=H5.c H5A.c H5AC.c H5B.c H5D.c H5E.c H5F.c H5Farray.c H5Fcontig.c \
H5FDstream.c H5FL.c H5G.c H5Gent.c H5Gnode.c H5Gstab.c H5HG.c H5HL.c H5I.c \
H5MF.c H5MM.c H5O.c H5Oattr.c H5Ocomp.c H5Ocont.c H5Odtype.c H5Oefl.c \
H5Ofill.c H5Olayout.c H5Omtime.c H5Oname.c H5Onull.c H5Osdspace.c \
- H5Oshared.c H5Ostab.c H5P.c H5R.c H5S.c H5Sall.c H5Shyper.c \
- H5Smpio.c H5Snone.c H5Spoint.c H5Sselect.c H5T.c H5Tbit.c H5Tconv.c \
- H5Tinit.c H5Tvlen.c H5TB.c H5TS.c H5V.c H5Z.c H5Zdeflate.c
+ H5Oshared.c H5Ostab.c H5P.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5R.c \
+ H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c H5Sselect.c H5T.c \
+ H5Tbit.c H5Tconv.c H5Tinit.c H5Tvlen.c H5TB.c H5TS.c H5V.c H5Z.c \
+ H5Zdeflate.c
LIB_OBJ=$(LIB_SRC:.c=.lo)