diff options
Diffstat (limited to 'src/H5FDmulti.c')
-rw-r--r-- | src/H5FDmulti.c | 137 |
1 files changed, 56 insertions, 81 deletions
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 1a5a5c0..5072209 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -26,11 +26,6 @@ #include <stdlib.h> #include <string.h> -/* Disable certain warnings in PC-Lint: */ -/*lint --emacro( {534, 830}, H5P_DEFAULT, H5P_FILE_ACCESS, H5P_DATASET_XFER) */ -/*lint --emacro( {534, 830}, H5FD_MULTI) */ -/*lint -esym( 534, H5Eclear2, H5Epush2) */ - #include "hdf5.h" /* Our version of MAX */ @@ -83,7 +78,7 @@ typedef struct H5FD_multi_fapl_t { hid_t memb_fapl[H5FD_MEM_NTYPES]; /*member access properties */ char * memb_name[H5FD_MEM_NTYPES]; /*name generators */ haddr_t memb_addr[H5FD_MEM_NTYPES]; /*starting addr per member */ - hbool_t relax; /*less stringent error checking */ + hbool_t relax; /*less stringent error checking */ } H5FD_multi_fapl_t; /* @@ -183,7 +178,7 @@ static const H5FD_class_t H5FD_multi_g = { * * Return: Success: Ptr to new copy of string * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Friday, August 13, 1999 @@ -209,14 +204,13 @@ my_strdup(const char *s) /*------------------------------------------------------------------------- * Function: H5FD_multi_init * - * Purpose: Initialize this driver by registering the driver with the - * library. - * - * Return: Success: The driver ID for the multi driver. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Failure: Negative + * Return: Success: The driver ID for the multi driver + * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, August 4, 1999 * *------------------------------------------------------------------------- @@ -231,14 +225,14 @@ H5FD_multi_init(void) H5FD_MULTI_g = H5FDregister(&H5FD_multi_g); return H5FD_MULTI_g; -} +} /* end H5FD_multi_init() */ /*--------------------------------------------------------------------------- * Function: H5FD_multi_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * - * Return: <none> + * Returns: Non-negative on success or negative on failure * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 @@ -262,7 +256,7 @@ H5FD_multi_term(void) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Wednesday, August 11, 1999 @@ -371,7 +365,7 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const c * memb_map: The default member map has the value * H5FD_MEM_DEFAULT for each element. * - * memb_fapl: The value H5P_DEFAULT for each element. + * memb_fapl: The value H5P_DEFAULT for each element. * * memb_name: The string `%s-X.h5' where `X' is one of the * letters `s' (H5FD_MEM_SUPER), @@ -379,26 +373,26 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const c * `g' (H5FD_MEM_GHEAP), 'l' (H5FD_MEM_LHEAP), * `o' (H5FD_MEM_OHDR). * - * memb_addr: The value HADDR_UNDEF for each element. + * memb_addr: The value HADDR_UNDEF for each element. * * * Example: To set up a multi file access property list which partitions * data into meta and raw files each being 1/2 of the address * space one would say: * - * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + * H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; * hid_t memb_fapl[H5FD_MEM_NTYPES]; * const char *memb[H5FD_MEM_NTYPES]; * haddr_t memb_addr[H5FD_MEM_NTYPES]; * - * // The mapping... - * for (mt=0; mt<H5FD_MEM_NTYPES; mt++) { + * // The mapping... + * for (mt=0; mt<H5FD_MEM_NTYPES; mt++) { * memb_map[mt] = H5FD_MEM_SUPER; * } - * memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; + * memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; * - * // Member information - * memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT; + * // Member information + * memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT; * memb_name[H5FD_MEM_SUPER] = "%s.meta"; * memb_addr[H5FD_MEM_SUPER] = 0; * @@ -406,14 +400,14 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const c * memb_name[H5FD_MEM_DRAW] = "%s.raw"; * memb_addr[H5FD_MEM_DRAW] = HADDR_MAX/2; * - * hid_t fapl = H5Pcreate(H5P_FILE_ACCESS); + * hid_t fapl = H5Pcreate(H5P_FILE_ACCESS); * H5Pset_fapl_multi(fapl, memb_map, memb_fapl, * memb_name, memb_addr, TRUE); * * * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -512,7 +506,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_f * * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -523,9 +517,9 @@ herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl /*out*/, char **memb_name /*out*/, haddr_t *memb_addr /*out*/, hbool_t *relax) { - H5FD_multi_fapl_t *fa; - H5FD_mem_t mt; - static const char *func = "H5FDget_fapl_multi"; /* Function Name for error reporting */ + const H5FD_multi_fapl_t *fa; + H5FD_mem_t mt; + static const char * func = "H5FDget_fapl_multi"; /* Function Name for error reporting */ /*NO TRACE*/ @@ -536,7 +530,7 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not an access list", -1) if (H5FD_MULTI != H5Pget_driver(fapl_id)) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "incorrect VFL driver", - -1) if (NULL == (fa = (H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id))) + -1) if (NULL == (fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id))) H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADVALUE, "bad VFL driver info", -1) if (memb_map) memcpy(memb_map, fa->memb_map, H5FD_MEM_NTYPES * sizeof(H5FD_mem_t)); @@ -568,11 +562,11 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl * Function: H5FD_multi_sb_size * * Purpose: Returns the size of the private information to be stored in - * the superblock. + * the superblock. * * Return: Success: The super block driver data size. * - * Failure: never fails + * Failure: never fails * * Programmer: Robb Matzke * Monday, August 16, 1999 @@ -623,7 +617,7 @@ H5FD_multi_sb_size(H5FD_t *_file) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Monday, August 16, 1999 @@ -706,7 +700,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Monday, August 16, 1999 @@ -766,7 +760,8 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) buf += nseen * 2 * 8; if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HADDR, nseen * 2, x, NULL, H5P_DEFAULT) < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1) - ap = (haddr_t *)x; + ap = (haddr_t *)((void *)x); /* Extra (void *) cast to quiet "cast to create alignment" warning - + 2019/07/05, QAK */ UNIQUE_MEMBERS(map, mt) { memb_addr[_unmapped] = *ap++; @@ -853,7 +848,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) * Return: Success: Ptr to new file access property list with all * members copied from the file struct. * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Friday, August 13, 1999 @@ -878,7 +873,7 @@ H5FD_multi_fapl_get(H5FD_t *_file) * * Return: Success: Ptr to a new property list * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -935,7 +930,7 @@ H5FD_multi_fapl_copy(const void *_old_fa) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -973,7 +968,7 @@ H5FD_multi_fapl_free(void *_fa) * public fields will be initialized by the * caller, which is always H5FD_open(). * - * Failure: NULL + * Failure: NULL * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -983,11 +978,11 @@ H5FD_multi_fapl_free(void *_fa) static H5FD_t * H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - H5FD_multi_t * file = NULL; - hid_t close_fapl = -1; - H5FD_multi_fapl_t *fa; - H5FD_mem_t m; - static const char *func = "H5FD_multi_open"; /* Function Name for error reporting */ + H5FD_multi_t * file = NULL; + hid_t close_fapl = -1; + const H5FD_multi_fapl_t *fa; + H5FD_mem_t m; + static const char * func = "H5FD_multi_open"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -1076,7 +1071,7 @@ error: * * Return: Success: Non-negative * - * Failure: Negative with as many members closed as + * Failure: Negative with as many members closed as * possible. The only subsequent operation * permitted on the file is a close operation. * @@ -1137,8 +1132,7 @@ H5FD_multi_close(H5FD_t *_file) * * Return: Success: like strcmp() * - * Failure: never fails (arguments were checked by the - * caller). + * Failure: never fails (arguments were checked by th caller). * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -1184,7 +1178,7 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * * Return: Success: non-negative * - * Failure: negative + * Failure: negative * * Programmer: Quincey Koziol * Tuesday, September 26, 2000 @@ -1213,7 +1207,7 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) * Purpose: Retrieve the memory type mapping for this file * * Return: Success: non-negative - * Failure: negative + * Failure: negative * * Programmer: Quincey Koziol * Tuesday, October 9, 2008 @@ -1240,19 +1234,11 @@ H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) * * Return: Success: The end-of-address-marker * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 21 Dec. 2006 - * Added the parameter TYPE. It's only used for MULTI driver. - * If the TYPE is H5FD_MEM_DEFAULT, simply find the biggest - * EOA of individual file because the EOA for the whole file - * is meaningless. - * *------------------------------------------------------------------------- */ static haddr_t @@ -1341,22 +1327,11 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Wednesday, August 4, 1999 * - * Modifications: - * Raymond Lu - * 10 January 2007 - * EOA for the whole file is discarded because it's meaningless - * for MULTI file. This function only sets eoa for individual - * file. - * - * Raymond Lu - * 21 June 2011 - * Backward compatibility of EOA. Please the comment in the - * code. *------------------------------------------------------------------------- */ static herr_t @@ -1408,7 +1383,7 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) * the end of the multi of files or the current * EOA, whichever is larger. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -1508,7 +1483,7 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle) * * Return: Success: Address of new memory * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * * Programmer: Robb Matzke * Thursday, August 12, 1999 @@ -1555,7 +1530,7 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Thursday, August 12, 1999 @@ -1590,7 +1565,7 @@ H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi * Return: Success: Zero. Result is stored in caller-supplied * buffer BUF. * - * Failure: -1, contents of buffer BUF are undefined. + * Failure: -1, contents of buffer BUF are undefined. * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -1639,7 +1614,7 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz * * Return: Success: Zero * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -1686,7 +1661,7 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si * * Return: Success: 0 * - * Failure: -1, as many files flushed as possible. + * Failure: -1, as many files flushed as possible. * * Programmer: Robb Matzke * Wednesday, August 4, 1999 @@ -1759,7 +1734,7 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) * Purpose: Truncates all multi members. * * Return: Success: 0 - * Failure: -1, as many files truncated as possible. + * Failure: -1, as many files truncated as possible. * * Programmer: Quincey Koziol * Thursday, January 31, 2008 @@ -1802,7 +1777,7 @@ H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Monday, August 23, 1999 @@ -1844,7 +1819,7 @@ compute_next(H5FD_multi_t *file) * * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * * Programmer: Robb Matzke * Monday, August 23, 1999 |