/*------------------------------------------------------------------------- * 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_API(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_API(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_API(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_API(ret_value); }
/*------------------------------------------------------------------------- * 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, unsigned ik) { unsigned 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","iIu",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_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pget_version * * Purpose: Retrieves version information for various parts of a file. * * SUPER: The file super 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, unsigned *super/*out*/, unsigned *freelist/*out*/, unsigned *stab/*out*/, unsigned *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,super,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 (super) if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, super) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get superblock 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_API(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_API(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, unsigned *ik /*out */ , unsigned *lk /*out */ ) { unsigned 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_API(ret_value); }
/*------------------------------------------------------------------------- * 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_API(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_API(ret_value); }
/*------------------------------------------------------------------------- * 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_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pset_fapl_windows * * Purpose: Modify the file access property list to use the H5FD_WINDOWS * driver defined in this source file. There are no driver * specific properties. * * NOTE: The Windows VFD was merely a merge of the SEC2 and STDIO drivers * so it has been retired. Selecting the Windows VFD will actually * set the SEC2 VFD (though for backwards compatibility, we'll keep * the H5FD_WINDOWS symbol). * * * Return: Non-negative on success/Negative on failure * * Programmer: Dana Robinson * October 10, 2011 * *------------------------------------------------------------------------- */ herr_t H5Pset_fapl_windows(hid_t fapl_id) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value; FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", fapl_id); if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") ret_value = H5P_set_driver(plist, H5FD_WINDOWS, NULL); done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_fapl_windows() */
/*------------------------------------------------------------------------- * 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_API(ret_value); }
/*------------------------------------------------------------------------- * 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_API(ret_value); } /* end H5Pget_hyper_vector_size() */
/*------------------------------------------------------------------------- * 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_API(ret_value); } /* end H5Pset_vlen_mem_manager() */
/*------------------------------------------------------------------------- * 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_API(ret_value); }
/*------------------------------------------------------------------------- * 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_API(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_API(ret_value); } /* end H5Pset_hyper_vector_size() */
/*------------------------------------------------------------------------- * 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_API(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_TYPE_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_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pset_filter_callback * * Purpose: Sets user's callback function for dataset transfer property * list. This callback function defines what user wants to do * if certain filter fails. * * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Jan 14, 2003 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ H5Z_cb_t cb_struct; FUNC_ENTER_API(H5Pset_filter_callback, FAIL); H5TRACE3("e","ixx",plist_id,func,op_data); /* 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 */ cb_struct.func = func; cb_struct.op_data = op_data; if (H5P_set(plist,H5D_XFER_FILTER_CB_NAME,&cb_struct)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pget_edc_check * * Purpose: Enable or disable error-detecting for a dataset reading * process. This error-detecting algorithm is whichever * user chooses earlier. This function cannot control * writing process. * * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Jan 3, 2003 * * Modifications: * *------------------------------------------------------------------------- */ H5Z_EDC_t H5Pget_edc_check(hid_t plist_id) { H5P_genplist_t *plist; /* Property list pointer */ H5Z_EDC_t ret_value; /* return value */ FUNC_ENTER_API(H5Pget_edc_check, H5Z_ERROR_EDC); H5TRACE1("Ze","i",plist_id); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_XFER))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5Z_ERROR_EDC, "can't find object for ID"); /* Update property list */ if (H5P_get(plist,H5D_XFER_EDC_NAME,&ret_value)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5Z_ERROR_EDC, "unable to set value"); /* check valid value */ if (ret_value != H5Z_ENABLE_EDC && ret_value != H5Z_DISABLE_EDC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_ERROR_EDC, "not a valid value"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5Pset_edc_check * * Purpose: Enable or disable error-detecting for a dataset reading * process. This error-detecting algorithm is whichever * user chooses earlier. This function cannot control * writing process. * * Return: Non-negative on success/Negative on failure * * Programmer: Raymond Lu * Jan 3, 2003 * * Modifications: * *------------------------------------------------------------------------- */ herr_t H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pset_edc_check, FAIL); H5TRACE2("e","iZe",plist_id,check); /* Check argument */ if (check != H5Z_ENABLE_EDC && check != H5Z_DISABLE_EDC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid value"); /* 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_EDC_NAME,&check)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value); }
/*------------------------------------------------------------------------- * Function: H5L_extern_traverse * * Purpose: Default traversal function for external links. This can * be overridden using H5Lregister(). * * Given a filename and path packed into the link udata, * attempts to open an object within an external file. * If the H5L_ELINK_PREFIX_NAME property is set in the * link access property list, appends that prefix to the * filename being opened. * * Return: ID of the opened object on success/Negative on failure * * Programmer: James Laird * Monday, July 10, 2006 * Modifications: * Vailin Choi, April 2, 2008 * Add handling to search for the target file * See description in RM: H5Lcreate_external * * Vailin Choi; Sept. 12th, 2008; bug #1247 * Retrieve the file access property list identifer that is set * for link access property via H5Pget_elink_fapl(). * If the return value is H5P_DEFAULT, the parent's file access * property is used to H5F_open() the target file; * Otherwise, the file access property retrieved from H5Pget_elink_fapl() * is used to H5F_open() the target file. * * Vailin Choi; Nov 2010 * Free memory pointed to by tmp_env_prefix for HDF5_EXT_PREFIX case. * *------------------------------------------------------------------------- */ static hid_t H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, const void *_udata, size_t H5_ATTR_UNUSED udata_size, hid_t lapl_id) { H5P_genplist_t *plist; /* Property list pointer */ char *my_prefix; /* Library's copy of the prefix */ H5G_loc_t root_loc; /* Location of root group in external file */ H5G_loc_t loc; /* Location of object */ H5F_t *ext_file = NULL; /* File struct for external file */ const uint8_t *p = (const uint8_t *)_udata; /* Pointer into external link buffer */ const char *file_name; /* Name of file containing external link's object */ char *full_name = NULL; /* File name with prefix */ const char *obj_name; /* Name external link's object */ size_t fname_len; /* Length of external link file name */ unsigned intent; /* File access permissions */ H5L_elink_cb_t cb_info; /* Callback info struct */ hid_t fapl_id = -1; /* File access property list for external link's file */ hid_t ext_obj = -1; /* ID for external link's object */ char *parent_group_name = NULL;/* Temporary pointer to group name */ char local_group_name[H5L_EXT_TRAVERSE_BUF_SIZE]; /* Local buffer to hold group name */ char *temp_file_name = NULL; /* Temporary pointer to file name */ size_t temp_file_name_len; /* Length of temporary file name */ char *actual_file_name = NULL; /* Parent file's actual name */ H5P_genplist_t *fa_plist; /* File access property list pointer */ H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */ hid_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ HDassert(p); /* Check external link version & flags */ if(((*p >> 4) & 0x0F) > H5L_EXT_VERSION) HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad version number for external link") if((*p & 0x0F) & ~H5L_EXT_FLAGS_ALL) HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad flags for external link") p++; /* Gather some information from the external link's user data */ file_name = (const char *)p; fname_len = HDstrlen(file_name); obj_name = (const char *)p + fname_len + 1; /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the fapl_id set for lapl_id if any */ if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links") /* Get the location for the group holding the external link */ if(H5G_loc(cur_group, &loc) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get object location") /* get the access flags set for lapl_id if any */ if(H5P_get(plist, H5L_ACS_ELINK_FLAGS_NAME, &intent) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink file access flags") /* get the file access mode flags for the parent file, if they were not set * on lapl_id */ if(intent == H5F_ACC_DEFAULT) intent = H5F_INTENT(loc.oloc->file); if((fapl_id == H5P_DEFAULT) && ((fapl_id = H5F_get_access_plist(loc.oloc->file, FALSE)) < 0)) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get parent's file access property list") /* Get callback_info */ if(H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink callback info") /* Get file access property list */ if(NULL == (fa_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Make callback if it exists */ if(cb_info.func) { const char *parent_file_name; /* Parent file name */ ssize_t group_name_len; /* Length of parent group name */ /* Get parent file name */ parent_file_name = H5F_OPEN_NAME(loc.oloc->file); /* Query length of parent group name */ if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL, lapl_id, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve length of group name") /* Account for null terminator */ group_name_len++; /* Check if we need to allocate larger buffer */ if((size_t)group_name_len > sizeof(local_group_name)) { if(NULL == (parent_group_name = (char *)H5MM_malloc((size_t)group_name_len))) HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, FAIL, "can't allocate buffer to hold group name, group_name_len = %Zu", group_name_len) } /* end if */ else parent_group_name = local_group_name; /* Get parent group name */ if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL, lapl_id, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve group name") /* Make callback */ if((cb_info.func)(parent_file_name, parent_group_name, file_name, obj_name, &intent, fapl_id, cb_info.user_data) < 0) HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "traversal operator failed") /* Check access flags */ if((intent & H5F_ACC_TRUNC) || (intent & H5F_ACC_EXCL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") } /* end if */