diff options
Diffstat (limited to 'src/H5FDfamily.c')
-rw-r--r-- | src/H5FDfamily.c | 87 |
1 files changed, 37 insertions, 50 deletions
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 5fd0294..17683ce 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -88,6 +88,7 @@ typedef struct H5FD_family_dxpl_t { } H5FD_family_dxpl_t; /* Callback prototypes */ +static herr_t H5FD_family_term(void); static void *H5FD_family_fapl_get(H5FD_t *_file); static void *H5FD_family_fapl_copy(const void *_old_fa); static herr_t H5FD_family_fapl_free(void *_fa); @@ -119,6 +120,7 @@ static const H5FD_class_t H5FD_family_g = { "family", /*name */ HADDR_MAX, /*maxaddr */ H5F_CLOSE_WEAK, /*fc_degree */ + H5FD_family_term, /*terminate */ H5FD_family_sb_size, /*sb_size */ H5FD_family_sb_encode, /*sb_encode */ H5FD_family_sb_decode, /*sb_decode */ @@ -166,7 +168,7 @@ DESCRIPTION static herr_t H5FD_family_init_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_family_init_interface) + FUNC_ENTER_NOAPI_NOINIT_NOERR FUNC_LEAVE_NOAPI(H5FD_family_init()) } /* H5FD_family_init_interface() */ @@ -194,7 +196,7 @@ H5FD_family_init(void) { hid_t ret_value=H5FD_FAMILY_g; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_init, FAIL) + FUNC_ENTER_NOAPI(FAIL) if (H5I_VFL!=H5Iget_type(H5FD_FAMILY_g)) H5FD_FAMILY_g = H5FD_register(&H5FD_family_g,sizeof(H5FD_class_t),FALSE); @@ -212,24 +214,22 @@ done: * * Purpose: Shut down the VFD * - * Return: <none> + * Returns: Non-negative on success or negative on failure * * Programmer: Quincey Koziol * Friday, Jan 30, 2004 * - * Modification: - * *--------------------------------------------------------------------------- */ -void +static herr_t H5FD_family_term(void) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_family_term) + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Reset VFL ID */ H5FD_FAMILY_g=0; - FUNC_LEAVE_NOAPI_VOID + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD_family_term() */ @@ -265,7 +265,7 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id) H5FD_family_fapl_t fa={0, -1}; H5P_genplist_t *plist; /* Property list pointer */ - FUNC_ENTER_API(H5Pset_fapl_family, FAIL) + FUNC_ENTER_API(FAIL) H5TRACE3("e", "ihi", fapl_id, msize, memb_fapl_id); @@ -324,7 +324,7 @@ H5Pget_fapl_family(hid_t fapl_id, hsize_t *msize/*out*/, H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Pget_fapl_family, FAIL) + FUNC_ENTER_API(FAIL) H5TRACE3("e", "ixx", fapl_id, msize, memb_fapl_id); if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) @@ -371,7 +371,7 @@ H5FD_family_fapl_get(H5FD_t *_file) H5P_genplist_t *plist; /* Property list pointer */ void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_fapl_get, NULL) + FUNC_ENTER_NOAPI_NOINIT if(NULL == (fa = (H5FD_family_fapl_t *)H5MM_calloc(sizeof(H5FD_family_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -417,7 +417,7 @@ H5FD_family_fapl_copy(const void *_old_fa) H5P_genplist_t *plist; /* Property list pointer */ void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_fapl_copy, NULL) + FUNC_ENTER_NOAPI_NOINIT if(NULL == (new_fa = (H5FD_family_fapl_t *)H5MM_malloc(sizeof(H5FD_family_fapl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -470,7 +470,7 @@ H5FD_family_fapl_free(void *_fa) H5FD_family_fapl_t *fa = (H5FD_family_fapl_t*)_fa; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_fapl_free, FAIL) + FUNC_ENTER_NOAPI_NOINIT if(H5I_dec_ref(fa->memb_fapl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID") @@ -505,7 +505,7 @@ H5FD_family_dxpl_copy(const void *_old_dx) H5P_genplist_t *plist; /* Property list pointer */ void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_dxpl_copy, NULL) + FUNC_ENTER_NOAPI_NOINIT if(NULL == (new_dx = (H5FD_family_dxpl_t *)H5MM_malloc(sizeof(H5FD_family_dxpl_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -556,7 +556,7 @@ H5FD_family_dxpl_free(void *_dx) H5FD_family_dxpl_t *dx = (H5FD_family_dxpl_t*)_dx; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_dxpl_free, FAIL) + FUNC_ENTER_NOAPI_NOINIT if(H5I_dec_ref(dx->memb_dxpl_id) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID") @@ -587,16 +587,11 @@ done: static hsize_t H5FD_family_sb_size(H5FD_t UNUSED *_file) { - hsize_t ret_value = 0; /*size of header*/ - - FUNC_ENTER_NOAPI(H5FD_family_sb_size, UFAIL) + FUNC_ENTER_NOAPI_NOINIT_NOERR /* 8 bytes field for the size of member file size field should be * enough for now. */ - ret_value += 8; - -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(8) } @@ -625,7 +620,7 @@ H5FD_family_sb_encode(H5FD_t *_file, char *name/*out*/, unsigned char *buf/*out* { H5FD_family_t *file = (H5FD_family_t*)_file; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_family_sb_encode) + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Name and version number */ HDstrncpy(name, "NCSAfami", (size_t)9); @@ -670,7 +665,7 @@ H5FD_family_sb_decode(H5FD_t *_file, const char UNUSED *name, const unsigned cha uint64_t msize; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_sb_decode, FAIL) + FUNC_ENTER_NOAPI_NOINIT /* Read member file size. Skip name template for now although it's saved. */ UINT64DECODE(buf, msize); @@ -748,7 +743,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, hsize_t eof=HADDR_UNDEF; unsigned t_flags = flags & ~H5F_ACC_CREAT; - FUNC_ENTER_NOAPI(H5FD_family_open, NULL) + FUNC_ENTER_NOAPI_NOINIT /* Check arguments */ if(!name || !*name) @@ -905,7 +900,7 @@ H5FD_family_close(H5FD_t *_file) unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_close, FAIL) + FUNC_ENTER_NOAPI_NOINIT /* Close as many members as possible. Use private function here to avoid clearing * the error stack. We need the error message to indicate wrong member file size. */ @@ -929,7 +924,6 @@ H5FD_family_close(H5FD_t *_file) H5MM_xfree(file->name); H5MM_xfree(file); -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_family_close() */ @@ -957,18 +951,17 @@ H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { const H5FD_family_t *f1 = (const H5FD_family_t*)_f1; const H5FD_family_t *f2 = (const H5FD_family_t*)_f2; - int ret_value=(H5FD_VFD_DEFAULT); + int ret_value = 0; - FUNC_ENTER_NOAPI(H5FD_family_cmp, H5FD_VFD_DEFAULT) + FUNC_ENTER_NOAPI_NOINIT_NOERR - assert(f1->nmembs>=1 && f1->memb[0]); - assert(f2->nmembs>=1 && f2->memb[0]); + HDassert(f1->nmembs >= 1 && f1->memb[0]); + HDassert(f2->nmembs >= 1 && f2->memb[0]); - ret_value= H5FDcmp(f1->memb[0], f2->memb[0]); + ret_value = H5FDcmp(f1->memb[0], f2->memb[0]); -done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_family_cmp() */ /*------------------------------------------------------------------------- @@ -991,7 +984,7 @@ H5FD_family_query(const H5FD_t * _file, unsigned long *flags /* out */) { const H5FD_family_t *file = (const H5FD_family_t*)_file; /* Family VFD info */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_family_query) + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Set the VFL feature flags that this driver supports */ if(flags) { @@ -1035,15 +1028,10 @@ static haddr_t H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { const H5FD_family_t *file = (const H5FD_family_t*)_file; - haddr_t ret_value; /* Return value */ - - FUNC_ENTER_NOAPI(H5FD_family_get_eoa, HADDR_UNDEF) - /* Set return value */ - ret_value=file->eoa; + FUNC_ENTER_NOAPI_NOINIT_NOERR -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(file->eoa) } @@ -1075,7 +1063,7 @@ H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_set_eoa, FAIL) + FUNC_ENTER_NOAPI_NOINIT for(u = 0; addr || u < file->nmembs; u++) { @@ -1153,7 +1141,7 @@ H5FD_family_get_eof(const H5FD_t *_file) int i; /* Local index variable */ haddr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_get_eof, HADDR_UNDEF) + FUNC_ENTER_NOAPI_NOINIT_NOERR /* * Find the last member that has a non-zero EOF and break out of the loop @@ -1180,7 +1168,6 @@ H5FD_family_get_eof(const H5FD_t *_file) /* Set return value */ ret_value = MAX(eof, file->eoa); -done: FUNC_LEAVE_NOAPI(ret_value) } @@ -1208,7 +1195,7 @@ H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) int memb; herr_t ret_value; - FUNC_ENTER_NOAPI(H5FD_family_get_handle, FAIL) + FUNC_ENTER_NOAPI_NOINIT /* Get the plist structure and family offset */ if(NULL == (plist = H5P_object_verify(fapl, H5P_FILE_ACCESS))) @@ -1260,7 +1247,7 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_read, FAIL) + FUNC_ENTER_NOAPI_NOINIT /* * Get the member data transfer property list. If the transfer property @@ -1337,7 +1324,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_write, FAIL) + FUNC_ENTER_NOAPI_NOINIT /* * Get the member data transfer property list. If the transfer property @@ -1402,7 +1389,7 @@ H5FD_family_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) unsigned u, nerrors = 0; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT for(u = 0; u < file->nmembs; u++) if(file->memb[u] && H5FD_flush(file->memb[u], dxpl_id, closing) < 0) @@ -1437,7 +1424,7 @@ H5FD_family_truncate(H5FD_t *_file, hid_t dxpl_id, unsigned closing) unsigned u, nerrors = 0; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5FD_family_truncate, FAIL) + FUNC_ENTER_NOAPI_NOINIT for(u = 0; u < file->nmembs; u++) if(file->memb[u] && H5FD_truncate(file->memb[u], dxpl_id, closing) < 0) |