diff options
-rw-r--r-- | src/H5.c | 8 | ||||
-rw-r--r-- | src/H5F.c | 111 | ||||
-rw-r--r-- | src/H5Ffake.c | 2 | ||||
-rw-r--r-- | src/H5Fmount.c | 2 | ||||
-rw-r--r-- | src/H5Fpkg.h | 7 | ||||
-rw-r--r-- | src/H5Fprivate.h | 8 | ||||
-rw-r--r-- | src/H5Fpublic.h | 19 | ||||
-rw-r--r-- | src/H5Fsuper.c | 2 | ||||
-rw-r--r-- | src/H5L.c | 164 | ||||
-rw-r--r-- | src/H5Lexternal.c | 2 |
10 files changed, 101 insertions, 224 deletions
@@ -167,8 +167,6 @@ H5_init_library(void) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize error interface") if(H5P_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface") - if(H5F_init() < 0) - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize file interface") if(H5T_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize datatype interface") if(H5D_init() < 0) @@ -343,13 +341,13 @@ done: herr_t H5dont_atexit(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT(H5dont_atexit) H5TRACE0("e",""); - if (H5_dont_atexit_g) - ret_value=FAIL; + if(H5_dont_atexit_g) + ret_value = FAIL; else H5_dont_atexit_g = TRUE; @@ -60,9 +60,6 @@ typedef struct H5F_olist_t { } H5F_olist_t; /* PRIVATE PROTOTYPES */ -#ifdef NOT_YET -static int H5F_flush_all_cb(void *f, hid_t fid, void *_invalidate); -#endif /* NOT_YET */ static unsigned H5F_get_objects(const H5F_t *f, unsigned types, int max_objs, hid_t *obj_id_list); static int H5F_get_objects_cb(void *obj_ptr, hid_t obj_id, void *key); static herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void** file_handle); @@ -85,27 +82,24 @@ H5FL_DEFINE(H5F_file_t); * Purpose: Initialize the interface from some other layer. * * Return: Success: non-negative - * * Failure: negative * * Programmer: Robb Matzke * Wednesday, December 16, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5F_init(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5F_init, FAIL) /* FUNC_ENTER() does all the work */ done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5F_init() */ /*------------------------------------------------------------------------- @@ -181,107 +175,6 @@ H5F_term_interface(void) FUNC_LEAVE_NOAPI(n) } -#ifdef NOT_YET - -/*------------------------------------------------------------------------- - * Function: H5F_flush_all_cb - * - * Purpose: Callback function for H5F_flush_all(). - * - * Return: Always returns zero. - * - * Programmer: Robb Matzke - * Friday, February 19, 1999 - * - * Modifications: - * Bill Wendling, 2003-03-18 - * Changed H5F_flush to accept H5F_flush_t flags instead of a - * series of h5bool_t's. - * - *------------------------------------------------------------------------- - */ -static int -H5F_flush_all_cb(void *_f, hid_t UNUSED fid, void *_invalidate) -{ - H5F_t *f=(H5F_t *)_f; - unsigned invalidate = (*((hbool_t*)_invalidate); - - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_flush_all_cb) - - H5F_flush(f, H5F_SCOPE_LOCAL, (invalidate ? H5F_FLUSH_INVALIDATE : H5F_FLUSH_NONE)); - - FUNC_LEAVE_NOAPI(0) -} - - -/*------------------------------------------------------------------------- - * Function: H5F_flush_all - * - * Purpose: Flush all open files. If INVALIDATE is true then also remove - * everything from the cache. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Thursday, February 18, 1999 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -herr_t -H5F_flush_all(hbool_t invalidate) -{ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5F_flush_all, FAIL) - - H5I_search(H5I_FILE,H5F_flush_all_cb,&invalidate); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} -#endif /* NOT_YET */ - -#ifdef NOT_YET - -/*-------------------------------------------------------------------------- - NAME - H5F_encode_length_unusual -- encode an unusual length size - USAGE - void H5F_encode_length_unusual(f, p, l) - const H5F_t *f; IN: pointer to the file record - uint8_t **p; IN: pointer to buffer pointer to encode length in - uint8_t *l; IN: pointer to length to encode - - ERRORS - - RETURNS - none - DESCRIPTION - Encode non-standard (i.e. not 2, 4 or 8-byte) lengths in file meta-data. ---------------------------------------------------------------------------*/ -void -H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, uint8_t *l) -{ - int i = (int)H5F_SIZEOF_SIZE(f)-1; - -#ifdef WORDS_BIGENDIAN - /* - * For non-little-endian platforms, encode each byte in memory backwards. - */ - for (/*void*/; i>=0; i--, (*p)++)*(*p) = *(l+i); -#else - /* platform has little-endian integers */ - HDmemcpy(*p,l,(size_t)(i+1)); - *p+=(i+1); -#endif - -} -#endif /* NOT_YET */ - /*------------------------------------------------------------------------- * Function: H5Fget_create_plist diff --git a/src/H5Ffake.c b/src/H5Ffake.c index 97e2e2f..ae0b6a6 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -36,7 +36,7 @@ RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. (Just calls - H5F_init_iterface currently). + H5F_init() currently). --------------------------------------------------------------------------*/ static herr_t diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 8d765f8..7727425 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -44,7 +44,7 @@ RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. (Just calls - H5F_init_iterface currently). + H5F_init() currently). --------------------------------------------------------------------------*/ static herr_t diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index a0e96d7..fa0cf64 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -172,11 +172,8 @@ H5FL_EXTERN(H5F_file_t); /******************************/ -#ifdef NOT_YET -H5_DLL void H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, uint8_t *l); -#endif /* NOT_YET */ - /* General routines */ +H5_DLL herr_t H5F_init(void); H5_DLL herr_t H5F_try_close(H5F_t *f); H5_DLL haddr_t H5F_locate_signature(H5FD_t *file, hid_t dxpl_id); @@ -195,5 +192,5 @@ H5_DLL herr_t H5F_sfile_add(H5F_file_t *shared); H5_DLL H5F_file_t * H5F_sfile_search(H5FD_t *lf); H5_DLL herr_t H5F_sfile_remove(H5F_file_t *shared); -#endif +#endif /* _H5Fpkg_H */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index ce18ef5..23af32f 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -375,12 +375,8 @@ typedef struct H5F_t H5F_t; struct H5B_class_t; struct H5RC_t; -/* Private functions, not part of the publicly documented API */ -H5_DLL herr_t H5F_init(void); -#ifdef NOT_YET -H5_DLL herr_t H5F_flush_all(hbool_t invalidate); -#endif /* NOT_YET */ -H5_DLL H5F_t * H5F_open(const char *name, unsigned flags, hid_t fcpl_id, +/* Private functions */ +H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id); /* Functions than retrieve values from the file struct */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index d3ae119..ea30b28 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -33,8 +33,6 @@ * We're assuming that these constants are used rather early in the hdf5 * session. * - * NOTE: When adding H5F_ACC_* macros, remember to redefine them in H5Fprivate.h - * */ /* When this header is included from a private header, don't make calls to H5check() */ @@ -104,20 +102,20 @@ extern "C" { #endif /* Functions in H5F.c */ -H5_DLL htri_t H5Fis_hdf5 (const char *filename); -H5_DLL hid_t H5Fcreate (const char *filename, unsigned flags, +H5_DLL htri_t H5Fis_hdf5(const char *filename); +H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags, hid_t create_plist, hid_t access_plist); -H5_DLL hid_t H5Fopen (const char *filename, unsigned flags, +H5_DLL hid_t H5Fopen(const char *filename, unsigned flags, hid_t access_plist); H5_DLL hid_t H5Freopen(hid_t file_id); H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope); -H5_DLL herr_t H5Fclose (hid_t file_id); -H5_DLL hid_t H5Fget_create_plist (hid_t file_id); -H5_DLL hid_t H5Fget_access_plist (hid_t file_id); +H5_DLL herr_t H5Fclose(hid_t file_id); +H5_DLL hid_t H5Fget_create_plist(hid_t file_id); +H5_DLL hid_t H5Fget_access_plist(hid_t file_id); H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned * intent); H5_DLL int H5Fget_obj_count(hid_t file_id, unsigned types); H5_DLL int H5Fget_obj_ids(hid_t file_id, unsigned types, int max_objs, hid_t *obj_id_list); -H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void** file_handle); +H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle); H5_DLL herr_t H5Fmount(hid_t loc, const char *name, hid_t child, hid_t plist); H5_DLL herr_t H5Funmount(hid_t loc, const char *name); H5_DLL hssize_t H5Fget_freespace(hid_t file_id); @@ -138,4 +136,5 @@ H5_DLL ssize_t H5Fget_name(hid_t obj_id, char *name, size_t size); #ifdef __cplusplus } #endif -#endif +#endif /* _H5Fpublic_H */ + diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index e3dd12f..b14fcb0 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -39,7 +39,7 @@ RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. (Just calls - H5F_init_iterface currently). + H5F_init() currently). --------------------------------------------------------------------------*/ static herr_t @@ -159,21 +159,74 @@ static H5L_class_t *H5L_table_g = NULL; * Programmer: James Laird * Thursday, July 13, 2006 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5L_init(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5L_init, FAIL); + FUNC_ENTER_NOAPI(H5L_init, FAIL) /* FUNC_ENTER() does all the work */ done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_init() */ + + +/*------------------------------------------------------------------------- + * Function: H5L_init_interface + * + * Purpose: Initialize information specific to H5L interface. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: James Laird + * Tuesday, January 24, 2006 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L_init_interface(void) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5L_init_interface) + + /* Initialize user-defined link classes */ + if(H5L_register_external() < 0) + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register external link class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L_init_interface() */ + + +/*------------------------------------------------------------------------- + * Function: H5L_term_interface + * + * Purpose: Terminate any resources allocated in H5L_init_interface. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: James Laird + * Tuesday, January 24, 2006 + * + *------------------------------------------------------------------------- + */ +int +H5L_term_interface(void) +{ + int n = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5L_term_interface) + + /* Free the table of link types */ + H5L_table_g = H5MM_xfree(H5L_table_g); + H5L_table_used_g = H5L_table_alloc_g = 0; + + FUNC_LEAVE_NOAPI(n) +} /* H5L_term_interface() */ /*------------------------------------------------------------------------- @@ -294,61 +347,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_init_interface - * - * Purpose: Initialize information specific to H5L interface. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Tuesday, January 24, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5L_init_interface(void) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT(H5L_init_interface) - - /* Initialize user-defined link classes */ - if(H5L_register_external() <0) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register external link class") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5L_init_interface() */ - - -/*------------------------------------------------------------------------- - * Function: H5L_term_interface - * - * Purpose: Terminate any resources allocated in H5L_init_interface. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: James Laird - * Tuesday, January 24, 2006 - * - *------------------------------------------------------------------------- - */ -int -H5L_term_interface(void) -{ - int n=0; - - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5L_term_interface) - - /* Free the table of link types */ - H5L_table_g = H5MM_xfree(H5L_table_g); - H5L_table_used_g = H5L_table_alloc_g = 0; - - FUNC_LEAVE_NOAPI(n) -} - - -/*------------------------------------------------------------------------- * Function: H5Lmove * * Purpose: Renames an object within an HDF5 file and moves it to a new @@ -634,7 +632,6 @@ done: } /* end H5Lcreate_hard() */ - /*------------------------------------------------------------------------- * Function: H5Lcreate_ud * @@ -861,7 +858,8 @@ done: * *------------------------------------------------------------------------- */ -htri_t H5Lis_registered(H5L_type_t id) +htri_t +H5Lis_registered(H5L_type_t id) { size_t i; /* Local index variable */ htri_t ret_value=FALSE; /* Return value */ @@ -881,8 +879,7 @@ htri_t H5Lis_registered(H5L_type_t id) done: FUNC_LEAVE_API(ret_value) -} -/* end H5Lis_registered */ +} /* end H5Lis_registered() */ /* *------------------------------------------------------------------------- @@ -908,28 +905,28 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_register (const H5L_class_t *cls) +H5L_register(const H5L_class_t *cls) { - size_t i; - herr_t ret_value=SUCCEED; /* Return value */ + size_t i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5L_register, FAIL) - assert (cls); - assert (cls->id>=0 && cls->id<=H5L_TYPE_MAX); + HDassert(cls); + HDassert(cls->id >= 0 && cls->id <= H5L_TYPE_MAX); /* Is the link type already registered? */ - for (i=0; i<H5L_table_used_g; i++) - if (H5L_table_g[i].id==cls->id) + for(i = 0; i < H5L_table_used_g; i++) + if(H5L_table_g[i].id == cls->id) break; /* Filter not already registered */ - if (i>=H5L_table_used_g) { - if (H5L_table_used_g>=H5L_table_alloc_g) { - size_t n = MAX(H5L_MIN_TABLE_SIZE, 2*H5L_table_alloc_g); + if(i >= H5L_table_used_g) { + if(H5L_table_used_g >= H5L_table_alloc_g) { + size_t n = MAX(H5L_MIN_TABLE_SIZE, 2 * H5L_table_alloc_g); H5L_class_t *table = H5MM_realloc(H5L_table_g, - n*sizeof(H5L_class_t)); - if (!table) + n * sizeof(H5L_class_t)); + if(!table) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend link type table") H5L_table_g = table; H5L_table_alloc_g = n; @@ -937,13 +934,10 @@ H5L_register (const H5L_class_t *cls) /* Initialize */ i = H5L_table_used_g++; - HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_class_t)); } /* end if */ - /* Filter already registered */ - else { - /* Replace old contents */ - HDmemcpy(H5L_table_g+i, cls, sizeof(H5L_class_t)); - } /* end else */ + + /* Copy link class info into table */ + HDmemcpy(H5L_table_g + i, cls, sizeof(H5L_class_t)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -965,7 +959,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5L_unregister (H5L_type_t id) +H5L_unregister(H5L_type_t id) { size_t i; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ @@ -2129,4 +2123,4 @@ H5L_get_default_lcpl(void) done: FUNC_LEAVE_NOAPI(ret_value) } /* H5L_get_default_lcpl */ - + diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 9b53c14..c29889a 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -56,7 +56,7 @@ RETURNS DESCRIPTION Initializes any interface-specific data or routines. (Just calls - H5L_init currently). + H5L_init() currently). --------------------------------------------------------------------------*/ static herr_t |