diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-06-02 02:37:52 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-06-02 02:37:52 (GMT) |
commit | 063642da28b0336f67a68ade16e00c571f3d0ad7 (patch) | |
tree | d02c00015b97712723dfd72b276d4e067c3d864f /src | |
parent | 2423bd6cabae9a027677b0141c91fedba4ec990b (diff) | |
download | hdf5-063642da28b0336f67a68ade16e00c571f3d0ad7.zip hdf5-063642da28b0336f67a68ade16e00c571f3d0ad7.tar.gz hdf5-063642da28b0336f67a68ade16e00c571f3d0ad7.tar.bz2 |
[svn-r10841] Purpose:
Code cleanup
Description:
Merge in some mostly cosmetic improvements to the H5F routines.
Platforms tested:
FreeBSD 4.11 (sleipnir)
Too minor to require h5committest
Diffstat (limited to 'src')
-rw-r--r-- | src/H5F.c | 94 | ||||
-rw-r--r-- | src/H5Fprivate.h | 9 |
2 files changed, 93 insertions, 10 deletions
@@ -61,8 +61,6 @@ typedef struct H5F_olist_t { } H5F_olist_t; /* PRIVATE PROTOTYPES */ -static H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id); static herr_t H5F_close(H5F_t *f); #ifdef NOT_YET @@ -776,19 +774,19 @@ done: * weren't being close. * * J Mainzer, Mar 10, 2005 - * Updated function for changes in the propertly list entries + * Updated function for changes in the property list entries * used by the new metadata cache. * + * Quincey Koziol, May 25, 2005 + * Extracted guts into new internal routine. + * *------------------------------------------------------------------------- */ hid_t H5Fget_access_plist(hid_t file_id) { H5F_t *f = NULL; - H5P_genplist_t *new_plist; /* New property list */ - H5P_genplist_t *old_plist; /* Old property list */ hid_t ret_value = SUCCEED; - void *driver_info=NULL; FUNC_ENTER_API(H5Fget_access_plist, FAIL) H5TRACE1("i","i",file_id); @@ -797,6 +795,51 @@ H5Fget_access_plist(hid_t file_id) if (NULL==(f=H5I_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + /* Retrieve the file's access property list */ + if((ret_value = H5F_get_access_plist(f)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file access property list") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Fget_access_plist() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_get_access_plist + * + * Purpose: Returns a copy of the file access property list of the + * specified file. + * + * NOTE: Make sure that, if you are going to overwrite + * information in the copied property list that was + * previously opened and assigned to the property list, then + * you must close it before overwriting the values. + * + * Return: Success: Object ID for a copy of the file access + * property list. + * + * Failure: FAIL + * + * Programmer: Quincey Koziol + * Wednesday, May 25, 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +hid_t +H5F_get_access_plist(H5F_t *f) +{ + H5P_genplist_t *new_plist; /* New property list */ + H5P_genplist_t *old_plist; /* Old property list */ + void *driver_info=NULL; + hid_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5F_get_access_plist, FAIL) + + /* Check args */ + HDassert(f); + /* Make a copy of the default file access property list */ if(NULL == (old_plist = H5I_object(H5P_LST_FILE_ACCESS_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") @@ -855,8 +898,8 @@ H5Fget_access_plist(hid_t file_id) } done: - FUNC_LEAVE_API(ret_value) -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_get_access_plist() */ /*------------------------------------------------------------------------- @@ -1729,7 +1772,7 @@ done: * *------------------------------------------------------------------------- */ -static H5F_t * +H5F_t * H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id) { H5F_t *file = NULL; /*the success return value */ @@ -4458,7 +4501,8 @@ done: * *------------------------------------------------------------------------- */ -H5RC_t *H5F_grp_btree_shared(const H5F_t *f) +H5RC_t * +H5F_grp_btree_shared(const H5F_t *f) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_grp_btree_shared) @@ -4471,6 +4515,36 @@ H5RC_t *H5F_grp_btree_shared(const H5F_t *f) /*------------------------------------------------------------------------- + * Function: H5F_get_fcpl + * + * Purpose: Retrieve the value of a file's FCPL. + * + * Return: Success: The FCPL for the file. + * + * Failure: ? (should not happen) + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * May 25 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +hid_t +H5F_get_fcpl(const H5F_t *f) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_get_fcpl) + + assert(f); + assert(f->shared); + + FUNC_LEAVE_NOAPI(f->shared->fcpl_id) +} /* end H5F_get_fcpl() */ + + +/*------------------------------------------------------------------------- * Function: H5F_block_read * * Purpose: Reads some data from a file/server/etc into a buffer. diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 51ea689..a04f73d 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -197,6 +197,8 @@ typedef struct H5F_t H5F_t; /* If the module using this macro is allowed access to the private variables, access them directly */ #ifdef H5F_PACKAGE +/* The FCPL itself */ +#define H5F_FCPL(F) ((F)->shared->fcpl_id) /* size of size_t and off_t as they exist on disk */ #define H5F_SIZEOF_ADDR(F) ((F)->shared->sizeof_addr) #define H5F_SIZEOF_SIZE(F) ((F)->shared->sizeof_size) @@ -215,6 +217,7 @@ typedef struct H5F_t H5F_t; /* Base address of file */ #define H5F_BASE_ADDR(F) ((F)->shared->base_addr) #else /* H5F_PACKAGE */ +#define H5F_FCPL(F) (H5F_get_fcpl(F)) #define H5F_SIZEOF_ADDR(F) (H5F_sizeof_addr(F)) #define H5F_SIZEOF_SIZE(F) (H5F_sizeof_size(F)) #define H5F_SYM_LEAF_K(F) (H5F_sym_leaf_k(F)) @@ -411,7 +414,12 @@ struct H5RC_t; /* Private functions, not part of the publicly documented API */ H5_DLL herr_t H5F_init(void); +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 */ H5_DLL hid_t H5F_get_driver_id(const H5F_t *f); +H5_DLL hid_t H5F_get_access_plist(H5F_t *f); H5_DLL unsigned H5F_get_intent(const H5F_t *f); H5_DLL herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum); H5_DLL hid_t H5F_get_id(H5F_t *file); @@ -429,6 +437,7 @@ H5_DLL htri_t H5F_is_mount(const H5F_t *file); H5_DLL htri_t H5F_has_mount(const H5F_t *file); /* Functions than retrieve values set from the FCPL */ +H5_DLL hid_t H5F_get_fcpl(const H5F_t *f); H5_DLL size_t H5F_sizeof_addr(const H5F_t *f); H5_DLL size_t H5F_sizeof_size(const H5F_t *f); H5_DLL unsigned H5F_sym_leaf_k(const H5F_t *f); |