summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5.c6
-rw-r--r--src/H5F.c479
-rw-r--r--src/H5FD.c80
-rw-r--r--src/H5FDfamily.c31
-rw-r--r--src/H5FDmpio.c31
-rw-r--r--src/H5Fpkg.h2
-rw-r--r--src/H5Fprivate.h81
-rw-r--r--src/H5P.c338
-rw-r--r--src/H5Pprivate.h2
-rw-r--r--src/H5Ppublic.h36
10 files changed, 743 insertions, 343 deletions
diff --git a/src/H5.c b/src/H5.c
index 1e1a6ff..1eb156b 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -1974,9 +1974,6 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
/* property lists are converted to generic property */
/* lists -QAK */
switch (H5P_get_class(id_type)) {
- case H5P_FILE_ACCESS_OLD:
- fprintf(out, "H5P_FILE_ACCESS");
- break;
case H5P_MOUNT_OLD:
fprintf(out, "H5P_MOUNT");
break;
@@ -2137,9 +2134,6 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
case H5P_NO_CLASS_OLD:
fprintf (out, "H5P_NO_CLASS");
break;
- case H5P_FILE_ACCESS_OLD:
- fprintf (out, "H5P_FILE_ACCESS");
- break;
case H5P_MOUNT_OLD:
fprintf (out, "H5P_MOUNT");
break;
diff --git a/src/H5F.c b/src/H5F.c
index 4ac87dc..7477acf 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1,17 +1,17 @@
/****************************************************************************
-* NCSA HDF *
-* Software Development Group *
-* National Center for Supercomputing Applications *
-* University of Illinois at Urbana-Champaign *
-* 605 E. Springfield, Champaign IL 61820 *
-* *
-* For conditions of distribution and use, see the accompanying *
-* hdf/COPYING file. *
-*
-* MODIFICATIONS
-* Robb Matzke, 30 Aug 1997
-* Added `ERRORS' fields to function prologues.
-*
+* NCSA HDF *
+* Software Development Group *
+* National Center for Supercomputing Applications *
+* University of Illinois at Urbana-Champaign *
+* 605 E. Springfield, Champaign IL 61820 *
+* *
+* For conditions of distribution and use, see the accompanying *
+* hdf/COPYING file. *
+* *
+* MODIFICATIONS *
+* Robb Matzke, 30 Aug 1997 *
+* Added `ERRORS' fields to function prologues. *
+* *
****************************************************************************/
/* $Id$ */
@@ -48,13 +48,6 @@
#define PABLO_MASK H5F_mask
-
-/*
- * Define the default file access property list. The template is initialized
- * by H5F_init_interface().
- */
-H5F_access_t H5F_access_dflt;
-
/*
* Define the default mount property list.
*/
@@ -171,6 +164,32 @@ H5F_init_interface(void)
int freespace_ver = H5F_CRT_FREESPACE_VERS_DEF;
int objectdir_ver = H5F_CRT_OBJ_DIR_VERS_DEF;
int sharedheader_ver = H5F_CRT_SHARE_HEAD_VERS_DEF;
+ /* File access property class variables. In sequence, they are
+ * - Size of meta data cache(elements)
+ * - Size of raw data chunk cache(elements)
+ * - Size of raw data chunk cache(bytes)
+ * - Preemption for reading chunks
+ * - Threshold for alignment
+ * - Alignment
+ * - Minimum metadata allocation block size
+ * - Maximum sieve buffer size
+ * - Garbage-collect reference
+ * - File driver ID
+ * - File driver info
+ */
+ H5P_genclass_t *acs_pclass;
+ int mdc_nelmts = H5F_ACS_META_CACHE_SIZE_DEF;
+ size_t rdcc_nelmts = H5F_ACS_DATA_CACHE_ELMT_SIZE_DEF;
+ size_t rdcc_nbytes = H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF;
+ double rdcc_w0 = H5F_ACS_PREEMPT_READ_CHUNKS_DEF;
+ hsize_t threshold = H5F_ACS_ALIGN_THRHD_DEF;
+ hsize_t alignment = H5F_ACS_ALIGN_DEF;
+ size_t meta_block_size = H5F_ACS_META_BLOCK_SIZE_DEF;
+ size_t sieve_buf_size = H5F_ACS_SIEVE_BUF_SIZE_DEF;
+ unsigned gc_ref = H5F_ACS_GARBG_COLCT_REF_DEF;
+ hid_t driver_id = H5F_ACS_FILE_DRV_ID_DEF;
+ void *driver_info = H5F_ACS_FILE_DRV_INFO_DEF;
+
FUNC_ENTER(H5F_init_interface, FAIL);
@@ -197,11 +216,9 @@ H5F_init_interface(void)
HRETURN_ERROR (H5E_FILE, H5E_CANTINIT, FAIL,
"unable to initialize interface");
}
-
-
- assert(H5P_CLS_FILE_CREATE_g!=-1);
/* ========== File Creation Property Class Initialization ============*/
+ assert(H5P_CLS_FILE_CREATE_g!=-1);
/* Get the pointer to file creation class */
if(H5I_GENPROP_CLS != H5I_get_type(H5P_CLS_FILE_CREATE_g) ||
NULL == (crt_pclass = H5I_object(H5P_CLS_FILE_CREATE_g)))
@@ -271,9 +288,6 @@ H5F_init_interface(void)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL,
"can't insert property into class");
-
-/* Register the default file access properties */
-
/* Register predefined file drivers */
H5E_BEGIN_TRY {
if ((status=H5FD_SEC2)<0) goto end_registration;
@@ -304,18 +318,72 @@ H5F_init_interface(void)
"file driver registration failed");
}
- /* Initialize the default file access property list */
- H5F_access_dflt.mdc_nelmts = H5AC_NSLOTS;
- H5F_access_dflt.rdcc_nelmts = 521;
- H5F_access_dflt.rdcc_nbytes = 1024*1024; /*1MB*/
- H5F_access_dflt.rdcc_w0 = 0.75; /*preempt fully read chunks*/
- H5F_access_dflt.threshold = 1; /*alignment applies to everything*/
- H5F_access_dflt.alignment = 1; /*no alignment*/
- H5F_access_dflt.gc_ref = 0; /*don't garbage-collect references*/
- H5F_access_dflt.meta_block_size = 2048; /* set metadata block allocations to 2KB */
- H5F_access_dflt.sieve_buf_size = 64*1024; /* set sieve buffer allocation to 64KB */
- H5F_access_dflt.driver_id = H5FD_SEC2; /*default driver*/
- H5F_access_dflt.driver_info = NULL; /*driver file access properties*/
+ /* ========== File Access Property Class Initialization ============*/
+ assert(H5P_CLS_FILE_ACCESS_g!=-1);
+ /* Get the pointer to file creation class */
+ if(H5I_GENPROP_CLS != H5I_get_type(H5P_CLS_FILE_ACCESS_g) ||
+ NULL == (acs_pclass = H5I_object(H5P_CLS_FILE_ACCESS_g)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class");
+
+ /* Register the size of meta data cache(elements) */
+ if(H5P_register(acs_pclass,H5F_ACS_META_CACHE_SIZE_NAME,H5F_ACS_META_CACHE_SIZE_SIZE, &mdc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the size of raw data chunk cache (elements) */
+ if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME,H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the size of raw data chunk cache(bytes) */
+ if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME,H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the preemption for reading chunks */
+ if(H5P_register(acs_pclass,H5F_ACS_PREEMPT_READ_CHUNKS_NAME,H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the threshold for alignment */
+ if(H5P_register(acs_pclass,H5F_ACS_ALIGN_THRHD_NAME,H5F_ACS_ALIGN_THRHD_SIZE, &threshold,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the alignment */
+ if(H5P_register(acs_pclass,H5F_ACS_ALIGN_NAME,H5F_ACS_ALIGN_SIZE, &alignment,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the minimum metadata allocation block size */
+ if(H5P_register(acs_pclass,H5F_ACS_META_BLOCK_SIZE_NAME,H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the maximum sieve buffer size */
+ if(H5P_register(acs_pclass,H5F_ACS_SIEVE_BUF_SIZE_NAME,H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the garbage collection reference */
+ if(H5P_register(acs_pclass,H5F_ACS_GARBG_COLCT_REF_NAME,H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the file driver ID */
+ if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_ID_NAME,H5F_ACS_FILE_DRV_ID_SIZE, &driver_id,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the file driver info */
+ if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_INFO_NAME,H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info,NULL,NULL,NULL,NULL,NULL,NULL)<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL,
+ "can't insert property into class");
+
+ /* Register the default file access property list */
+ if((H5P_LST_FILE_ACCESS_g = H5Pcreate_list(H5P_CLS_FILE_ACCESS_g))<0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL,
+ "can't insert property into class");
done:
FUNC_LEAVE(ret_value);
@@ -361,6 +429,157 @@ H5F_term_interface(void)
}
+/*----------------------------------------------------------------------------
+ * Function: H5F_acs_create
+ *
+ * Purpose: Callback routine which is called whenever a file access
+ * property list is closed. This routine performs any generic
+ * initialization needed on the properties the library put into
+ * the list.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Raymond Lu
+ * Tuesday, Oct 23, 2001
+ *
+ * Modifications:
+ *
+ *----------------------------------------------------------------------------
+ */
+herr_t
+H5F_acs_create(hid_t fapl_id, void UNUSED *copy_data)
+{
+ hid_t driver_id;
+ void* driver_info;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER(H5F_acs_create, FAIL);
+
+ /* Check argument */
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+
+ /* Retrieve properties */
+ if(H5P_get(fapl_id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver ID");
+ if(H5P_get(fapl_id, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info");
+
+ if(driver_id > 0) {
+ /* Increment the reference count on driver and copy driver info */
+ H5I_inc_ref(driver_id);
+ driver_info = H5FD_fapl_copy(driver_id, driver_info);
+ /* Set the driver properties for the list */
+ if(H5P_set(fapl_id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set drver ID");
+ if(H5P_set(fapl_id, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set drver info");
+ }
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*--------------------------------------------------------------------------
+ * Function: H5F_acs_close
+ *
+ * Purpose: Callback routine which is called whenever a file access
+ * property list is closed. This routine performs any generic
+ * cleanup needed on the properties.
+ *
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Raymond Lu
+ * Tuesday, Oct 23, 2001
+ *
+ * Modifications:
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5F_acs_close(hid_t fapl_id, void UNUSED *close_data)
+{
+ hid_t driver_id;
+ void *driver_info;
+ herr_t ret_value = SUCCEED;
+
+ /* Can't use FUNC_ENTER when library is shutting down */
+
+ if(H5P_get(fapl_id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HGOTO_DONE(FAIL); /* Can't return errors when library is shutting down */
+ if(H5P_get(fapl_id, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
+ HGOTO_DONE(FAIL); /* Can't return errors when library is shutting down */
+
+ if(driver_id > 0) {
+ /* Free memory for driver info and decrement reference count for driver */
+ H5FD_fapl_free(driver_id, driver_info);
+ H5I_dec_ref(driver_id);
+ driver_info = NULL;
+ driver_id = -1;
+ if(H5P_set(fapl_id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HGOTO_DONE(FAIL); /* Can't return errors when library is shutting down */
+ if(H5P_set(fapl_id, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
+ HGOTO_DONE(FAIL); /* Can't return errors when library is shutting down */
+ }
+
+done:
+ /* Can't use FUNC_LEAVE when library is shutting down */
+ return(ret_value);
+}
+
+
+/*--------------------------------------------------------------------------
+ * Function: H5F_acs_copy
+ *
+ * Purpose: Callback routine which is called whenever a file access
+ * property list is copied. This routine performs any generic
+ * copy needed on the properties.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ * Programmer: Raymond Lu
+ * Tuesday, Oct 23, 2001
+ *
+ * Modifications:
+ *
+ *--------------------------------------------------------------------------
+ */
+herr_t
+H5F_acs_copy(hid_t new_fapl_id, hid_t old_fapl_id, void UNUSED *copy_data)
+{
+ hid_t driver_id;
+ void* driver_info;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER(H5F_acs_copy, FAIL);
+
+ if(H5I_GENPROP_LST != H5I_get_type(new_fapl_id) || H5I_GENPROP_LST !=
+ H5I_get_type(old_fapl_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+
+ if(H5P_get(old_fapl_id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver ID");
+ if(H5P_get(old_fapl_id, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info");
+
+ if(driver_id > 0) {
+ H5I_inc_ref(driver_id);
+ driver_info = H5FD_fapl_copy(driver_id, driver_info);
+ if(H5P_set(new_fapl_id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set drver ID");
+ if(H5P_set(new_fapl_id, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set drver info");
+ }
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
/*-------------------------------------------------------------------------
* Function: H5F_flush_all_cb
*
@@ -539,15 +758,17 @@ H5Fget_create_plist(hid_t file_id)
* Wednesday, February 18, 1998
*
* Modifications:
- *
+ * Raymond Lu, Oct 23, 2001
+ * Changed file access property list to the new generic
+ * property list.
+ *
*-------------------------------------------------------------------------
*/
hid_t
H5Fget_access_plist(hid_t file_id)
{
H5F_t *f = NULL;
- H5F_access_t _fapl;
- H5P_t *plist=NULL;
+ H5P_t *plist=NULL;
hid_t ret_value = FAIL;
FUNC_ENTER(H5Fget_access_plist, FAIL);
@@ -558,35 +779,59 @@ H5Fget_access_plist(hid_t file_id)
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file");
}
- /* Initialize the property list */
- HDmemset(&_fapl, 0, sizeof _fapl);
- _fapl.mdc_nelmts = f->shared->mdc_nelmts;
- _fapl.rdcc_nelmts = f->shared->rdcc_nelmts;
- _fapl.rdcc_nbytes = f->shared->rdcc_nbytes;
- _fapl.rdcc_w0 = f->shared->rdcc_w0;
- _fapl.threshold = f->shared->threshold;
- _fapl.alignment = f->shared->alignment;
- _fapl.gc_ref = f->shared->gc_ref;
- _fapl.meta_block_size = f->shared->lf->def_meta_block_size;
- _fapl.sieve_buf_size = f->shared->sieve_buf_size;
- _fapl.driver_id = f->shared->lf->driver_id;
- _fapl.driver_info = NULL; /*just for now */
-
- /* Copy properties */
- if (NULL==(plist=H5P_copy(H5P_FILE_ACCESS, &_fapl))) {
- HRETURN_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL,
- "unable to copy file access properties");
- }
-
- /* Get the properties for the file driver */
- plist->u.faccess.driver_info = H5FD_fapl_get(f->shared->lf);
-
- /* Create an atom */
- if ((ret_value = H5P_create(H5P_FILE_ACCESS, plist))<0) {
- H5P_close(plist);
- HRETURN_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL,
- "unable to register property list");
- }
+ /* Make a copy of the default file access property list */
+ if((ret_value=H5P_copy_new(H5P_LST_FILE_ACCESS_g)) < 0)
+ HRETURN_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL,
+ "can't copy file access property list");
+
+ /* Copy properties of the file access property list */
+ if(H5P_set(ret_value, H5F_ACS_META_CACHE_SIZE_NAME,
+ &(f->shared->mdc_nelmts)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set meta data cache size");
+ if(H5P_set(ret_value, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME,
+ &(f->shared->rdcc_nelmts)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set data cache element size");
+ if(H5P_set(ret_value, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME,
+ &(f->shared->rdcc_nbytes)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set data cache byte size");
+
+ if(H5P_set(ret_value, H5F_ACS_PREEMPT_READ_CHUNKS_NAME,
+ &(f->shared->rdcc_w0)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set preempt read chunks");
+ if(H5P_set(ret_value, H5F_ACS_ALIGN_THRHD_NAME,
+ &(f->shared->threshold)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set alignment threshold");
+ if(H5P_set(ret_value, H5F_ACS_ALIGN_NAME,
+ &(f->shared->alignment)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set alignment");
+
+ if(H5P_set(ret_value, H5F_ACS_GARBG_COLCT_REF_NAME,
+ &(f->shared->gc_ref)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set garbage collect reference");
+ if(H5P_set(ret_value, H5F_ACS_META_BLOCK_SIZE_NAME,
+ &(f->shared->lf->def_meta_block_size)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set meta data cache size");
+ if(H5P_set(ret_value, H5F_ACS_SIEVE_BUF_SIZE_NAME,
+ &(f->shared->sieve_buf_size)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't sieve buffer size");
+
+ if(H5P_set(ret_value, H5F_ACS_FILE_DRV_ID_NAME,
+ &(f->shared->lf->driver_id)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set file driver ID");
+ if(H5P_set(ret_value, H5F_ACS_FILE_DRV_INFO_NAME,
+ H5FD_fapl_get(f->shared->lf)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set file driver info");
FUNC_LEAVE(ret_value);
}
@@ -764,17 +1009,18 @@ H5Fis_hdf5(const char *name)
* Modifications:
*
* Raymond Lu, Oct 14, 2001
- * Changed to generic property list.
+ * Changed the file creation and access property list to the
+ * new generic property list.
*
*-------------------------------------------------------------------------
*/
static H5F_t *
H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id)
{
- H5F_t *f=NULL, *ret_value=NULL;
+ H5F_t *f=NULL, *ret_value=NULL;
int n;
- const H5F_access_t *fapl=NULL;
-
+ hid_t driver_id = -1;
+
FUNC_ENTER(H5F_new, NULL);
if (NULL==(f=H5FL_ALLOC(H5F_t,1))) {
@@ -804,15 +1050,43 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id)
f->shared->fcpl_id = H5P_copy_new(fcpl_id);
- fapl = (H5P_DEFAULT==fapl_id)? &H5F_access_dflt : (const H5F_access_t *)H5I_object(fapl_id);
- f->shared->mdc_nelmts = fapl->mdc_nelmts;
- f->shared->rdcc_nelmts = fapl->rdcc_nelmts;
- f->shared->rdcc_nbytes = fapl->rdcc_nbytes;
- f->shared->rdcc_w0 = fapl->rdcc_w0;
- f->shared->threshold = fapl->threshold;
- f->shared->alignment = fapl->alignment;
- f->shared->gc_ref = fapl->gc_ref;
- f->shared->sieve_buf_size = fapl->sieve_buf_size;
+ if(H5P_DEFAULT == fapl_id)
+ fapl_id = H5P_FILE_ACCESS_DEFAULT;
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL,
+ "not file access property list");
+
+ if(H5P_get(fapl_id, H5F_ACS_META_CACHE_SIZE_NAME,
+ &(f->shared->mdc_nelmts)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "can't get meta data cache size");
+ if(H5P_get(fapl_id, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME,
+ &(f->shared->rdcc_nelmts)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "can't get data cache element size");
+ if(H5P_get(fapl_id, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME,
+ &(f->shared->rdcc_nbytes)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "can't get data cache cache size");
+ if(H5P_get(fapl_id, H5F_ACS_PREEMPT_READ_CHUNKS_NAME,
+ &(f->shared->rdcc_w0)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "can't get preempt read chunk");
+
+ if(H5P_get(fapl_id, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold))<0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "can't get alignment threshold");
+ if(H5P_get(fapl_id, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment");
+ if(H5P_get(fapl_id, H5F_ACS_GARBG_COLCT_REF_NAME,&(f->shared->gc_ref))<0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "can't get garbage collect reference");
+ if(H5P_get(fapl_id, H5F_ACS_SIEVE_BUF_SIZE_NAME,
+ &(f->shared->sieve_buf_size)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "can't get sieve buffer size");
+
#ifdef H5_HAVE_PARALLEL
/*
@@ -820,7 +1094,9 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id)
* does not permit caching. (maybe able to relax it for
* read only open.)
*/
- if (H5FD_MPIO==fapl->driver_id){
+ if(H5P_get(fapl_id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID");
+ if (H5FD_MPIO==driver_id){
f->shared->rdcc_nbytes = 0;
f->shared->mdc_nelmts = 0;
}
@@ -1030,7 +1306,8 @@ done:
* arguments would be the same.
*
* Raymond Lu, 2001-10-14
- * Changed to generic property list.
+ * Changed the file creation and access property lists to the
+ * new generic property list.
*
*-------------------------------------------------------------------------
*/
@@ -1470,7 +1747,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
* to the H5F_open() as object IDs.
*
* Raymond Lu, 2001-10-14
- * Changed to generic property list.
+ * Changed the file creation and access property list to the
+ * new generic property list.
*
*-------------------------------------------------------------------------
*/
@@ -1481,7 +1759,10 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id,
H5F_t *new_file = NULL; /*file struct for new file */
hid_t ret_value = FAIL; /*return value */
+ size_t meta_block_size = 0;
+ hid_t driver_id=-1;
+
FUNC_ENTER(H5Fcreate, FAIL);
H5TRACE4("i","sIuii",filename,flags,fcpl_id,fapl_id);
@@ -1497,6 +1778,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id,
"mutually exclusive flags for file creation");
}
+ /* Check file creation property list */
if(H5P_DEFAULT == fcpl_id)
fcpl_id = H5P_FILE_CREATE_DEFAULT;
if(H5I_GENPROP_LST != H5I_get_type(fcpl_id) ||
@@ -1504,12 +1786,13 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id,
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"not file create property list");
- if (H5P_DEFAULT!=fapl_id &&
- (H5P_FILE_ACCESS!=H5P_get_class(fapl_id) ||
- NULL==H5I_object(fapl_id))) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
+ /* Check the file access property list */
+ if(H5P_DEFAULT == fapl_id)
+ fapl_id = H5P_FILE_ACCESS_DEFAULT;
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "not file access property list");
/*
* Adjust bit flags by turning on the creation bit and making sure that
@@ -1597,12 +1880,12 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
(flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL)) {
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags");
}
- if (H5P_DEFAULT!=fapl_id &&
- (H5P_FILE_ACCESS!=H5P_get_class(fapl_id) ||
- NULL==H5I_object(fapl_id))) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
+ if(H5P_DEFAULT == fapl_id)
+ fapl_id = H5P_FILE_ACCESS_DEFAULT;
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "not file access property list");
/* Open the file */
if (NULL==(new_file=H5F_open(filename, flags, H5P_DEFAULT, fapl_id))) {
diff --git a/src/H5FD.c b/src/H5FD.c
index 62a866f..ef7d756 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -277,38 +277,35 @@ H5FDunregister(hid_t driver_id)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
H5FD_class_t *
H5FD_get_class(hid_t id)
{
H5FD_class_t *ret_value=NULL;
- H5F_access_t *fapl=NULL;
-
+ hid_t driver_id = -1;
+
FUNC_ENTER(H5FD_get_class, NULL);
- if (H5P_DEFAULT==id) {
- ret_value = H5FD_get_class(H5F_access_dflt.driver_id);
- } else if (H5I_VFL==H5I_get_type(id)) {
+ if (H5I_VFL==H5I_get_type(id)) {
ret_value = H5I_object(id);
} else if (H5I_GENPROP_LST == H5I_get_type(id) &&
- TRUE==H5Pisa_class(id,H5P_DATASET_XFER)) {
+ TRUE==H5Pisa_class(id,H5P_FILE_ACCESS)) {
+ if(H5P_get(id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID");
+ ret_value = H5FD_get_class(driver_id);
+ } else if (H5I_GENPROP_LST == H5I_get_type(id) &&
+ TRUE==H5Pisa_class(id,H5P_DATASET_XFER)) {
ret_value = H5FD_get_class(H5P_peek_hid_t(id,H5D_XFER_VFL_ID_NAME));
} else {
- switch (H5P_get_class(id)) {
- case H5P_FILE_ACCESS_OLD:
- if (NULL==(fapl=H5I_object(id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL,
- "not a file access property list");
- }
- ret_value = H5FD_get_class(fapl->driver_id);
- break;
-
- default:
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL,
- "not a driver id, file access property list or "
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL,
+ "not a driver id, file access property list or "
"data transfer property list");
- }
}
FUNC_LEAVE(ret_value);
}
@@ -733,33 +730,42 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
H5FD_t *
H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
- const H5F_access_t *fapl=NULL;
H5FD_class_t *driver;
H5FD_t *file=NULL;
+ hid_t driver_id = -1;
+ size_t meta_block_size=0;
FUNC_ENTER(H5FD_open, NULL);
/* Check arguments */
- if (H5P_DEFAULT==fapl_id) {
- fapl = &H5F_access_dflt;
- } else if (H5P_FILE_ACCESS != H5P_get_class(fapl_id) ||
- NULL == (fapl = H5I_object(fapl_id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL,
- "not a file access property list");
- }
+ if(H5P_DEFAULT == fapl_id)
+ fapl_id = H5P_FILE_ACCESS_DEFAULT;
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL,
+ "not a file access property list");
+
if (0==maxaddr) {
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, NULL,
"zero format address range");
}
+ if(H5P_get(fapl_id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID");
+
/* Get driver info */
- if (H5I_VFL!=H5I_get_type(fapl->driver_id) ||
- NULL==(driver=H5I_object(fapl->driver_id))) {
+ if (H5I_VFL!=H5I_get_type(driver_id) ||
+ NULL==(driver=H5I_object(driver_id))) {
HRETURN_ERROR(H5E_VFL, H5E_BADVALUE, NULL,
"invalid driver ID in file access property list");
}
@@ -778,16 +784,22 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
* Fill in public fields. We must increment the reference count on the
* driver ID to prevent it from being freed while this file is open.
*/
- file->driver_id = fapl->driver_id;
+ file->driver_id = driver_id;
H5I_inc_ref(file->driver_id);
file->cls = driver;
file->maxaddr = maxaddr;
HDmemset(file->fl, 0, sizeof(file->fl));
- file->def_meta_block_size = fapl->meta_block_size;
+ if(H5P_get(fapl_id, H5F_ACS_META_BLOCK_SIZE_NAME,
+ &(meta_block_size)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "can't get meta data block size");
+ file->def_meta_block_size = meta_block_size;
file->accum_loc = HADDR_UNDEF;
- file->threshold = fapl->threshold;
- file->alignment = fapl->alignment;
-
+ if(H5P_get(fapl_id, H5F_ACS_ALIGN_THRHD_NAME, &(file->threshold)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL,
+ "can't get alignment threshold");
+ if(H5P_get(fapl_id, H5F_ACS_ALIGN_NAME, &(file->alignment)) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment");
/* Retrieve the VFL driver feature flags */
if (H5FD_query(file, &(file->feature_flags))<0)
HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver");
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 5f67f03..db492b3 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -164,6 +164,11 @@ H5FD_family_init(void)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -176,11 +181,13 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t memb_size, hid_t memb_fapl_id)
H5TRACE3("e","ihi",fapl_id,memb_size,memb_fapl_id);
/* Check arguments */
- if (H5P_FILE_ACCESS!=H5Pget_class(fapl_id))
- HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl");
- if (H5P_DEFAULT!=memb_fapl_id &&
- H5P_FILE_ACCESS!=H5Pget_class(memb_fapl_id))
- HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl");
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "not a file access property list");
+ if(H5P_DEFAULT != memb_fapl_id &&
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list");
/*
* Initialize driver specific information. No need to copy it into the FA
@@ -210,6 +217,11 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t memb_size, hid_t memb_fapl_id)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -221,14 +233,15 @@ H5Pget_fapl_family(hid_t fapl_id, hsize_t *memb_size/*out*/,
FUNC_ENTER(H5Pget_fapl_family, FAIL);
H5TRACE3("e","ixx",fapl_id,memb_size,memb_fapl_id);
- if (H5P_FILE_ACCESS!=H5Pget_class(fapl_id))
- HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl");
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list");
if (H5FD_FAMILY!=H5P_get_driver(fapl_id))
HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver");
if (NULL==(fa=H5Pget_driver_info(fapl_id)))
HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info");
if (memb_size) *memb_size = fa->memb_size;
- if (memb_fapl_id) *memb_fapl_id = H5Pcopy(fa->memb_fapl_id);
+ if (memb_fapl_id) *memb_fapl_id = H5P_copy_new(fa->memb_fapl_id);
FUNC_LEAVE(SUCCEED);
}
@@ -423,7 +436,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr)
{
H5FD_family_t *file=NULL;
- H5FD_t *ret_value=NULL;
+ H5FD_t *ret_value=NULL;
char memb_name[4096], temp[4096];
hsize_t eof;
unsigned t_flags = flags & ~H5F_ACC_CREAT;
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 76a6662..7448117 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -226,6 +226,12 @@ H5FD_mpio_init(void)
*
* Robb Matzke, 1999-08-06
* Modified to work with the virtual file layer.
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
@@ -238,8 +244,11 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info)
H5TRACE3("e","iMcMi",fapl_id,comm,info);
/* Check arguments */
- if (H5P_FILE_ACCESS!=H5Pget_class(fapl_id))
- HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl");
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list");
+
+
#ifdef LATER
#warning "We need to verify that COMM and INFO contain sensible information."
#endif
@@ -275,10 +284,15 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info)
*
* Modifications:
*
- * Albert Cheng, Apr 16, 1998
- * Removed the access_mode argument. The access_mode is changed
- * to be controlled by data transfer property list during data
- * read/write calls.
+ * Albert Cheng, Apr 16, 1998
+ * Removed the access_mode argument. The access_mode is changed
+ * to be controlled by data transfer property list during data
+ * read/write calls.
+ *
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
*
*-------------------------------------------------------------------------
*/
@@ -290,8 +304,9 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm/*out*/, MPI_Info *info/*out*/)
FUNC_ENTER(H5Pget_fapl_mpio, FAIL);
H5TRACE3("e","ixx",fapl_id,comm,info);
- if (H5P_FILE_ACCESS!=H5Pget_class(fapl_id))
- HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl");
+ if(H5I_GENPROP_LST != H5I_GET_TYPE(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list");
if (H5FD_MPIO!=H5P_get_driver(fapl_id))
HRETURN_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver");
if (NULL==(fa=H5Pget_driver_info(fapl_id)))
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index bcb569b..22cae65 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -94,7 +94,7 @@ typedef struct H5F_file_t {
haddr_t driver_addr; /* File driver information block address*/
struct H5AC_t *cache; /* The object cache */
hid_t fcpl_id; /* File creation property list ID */
- int mdc_nelmts; /* Size of meta data cache (elements) */
+ int mdc_nelmts; /* Size of meta data cache (elements) */
size_t rdcc_nelmts; /* Size of raw data chunk cache (elmts) */
size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */
double rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 77af814..aaa29de 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -288,23 +288,63 @@ __DLL__ size_t H5F_sizeof_size(const H5F_t *f);
#define H5F_CRT_SHARE_HEAD_VERS_SIZE sizeof(int)
#define H5F_CRT_SHARE_HEAD_VERS_DEF HDF5_SHAREDHEADER_VERSION
-
-/*
- * File-access property list.
- */
-typedef struct H5F_access_t {
- int mdc_nelmts; /* Size of meta data cache (elements) */
- size_t rdcc_nelmts; /* Size of raw data chunk cache (elmts) */
- size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */
- double rdcc_w0; /* Preempt read chunks first? [0.0..1.0]*/
- hsize_t threshold; /* Threshold for alignment */
- hsize_t alignment; /* Alignment */
- size_t meta_block_size; /* Minimum metadata allocation block size (when aggregating metadata allocations) */
- size_t sieve_buf_size; /* Maximum sieve buffer size (when data sieving is allowed by file driver) */
- unsigned gc_ref; /* Garbage-collect references? */
- hid_t driver_id; /* File driver ID */
- void *driver_info; /* File driver specific information */
-} H5F_access_t;
+/* ========= File Access properties ============ */
+/* Definitions for size of meta data cache(elements) */
+#define H5F_ACS_META_CACHE_SIZE_NAME "mdc_nelmts"
+#define H5F_ACS_META_CACHE_SIZE_SIZE sizeof(int)
+#define H5F_ACS_META_CACHE_SIZE_DEF H5AC_NSLOTS
+
+/* Definitions for size of raw data chunk cache(elements) */
+#define H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME "rdcc_nelmts"
+#define H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE sizeof(size_t)
+#define H5F_ACS_DATA_CACHE_ELMT_SIZE_DEF 521
+
+/* Definition for size of raw data chunk cache(bytes) */
+#define H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes"
+#define H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE sizeof(size_t)
+#define H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF 1024*1024
+
+/* Definition for preemption read chunks first */
+#define H5F_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0"
+#define H5F_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double)
+#define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75
+
+/* Definition for threshold for alignment */
+#define H5F_ACS_ALIGN_THRHD_NAME "threshold"
+#define H5F_ACS_ALIGN_THRHD_SIZE sizeof(hsize_t)
+#define H5F_ACS_ALIGN_THRHD_DEF 1
+
+/* Definition for alignment */
+#define H5F_ACS_ALIGN_NAME "align"
+#define H5F_ACS_ALIGN_SIZE sizeof(hsize_t)
+#define H5F_ACS_ALIGN_DEF 1
+
+/* Definition for minimum metadata allocation block size(when
+ aggregating metadata allocations. */
+#define H5F_ACS_META_BLOCK_SIZE_NAME "meta_block_size"
+#define H5F_ACS_META_BLOCK_SIZE_SIZE sizeof(size_t)
+#define H5F_ACS_META_BLOCK_SIZE_DEF 2048
+
+/* Definition for maximum sieve buffer size (when data sieving
+ is allowed by file driver */
+#define H5F_ACS_SIEVE_BUF_SIZE_NAME "sieve_buf_size"
+#define H5F_ACS_SIEVE_BUF_SIZE_SIZE sizeof(size_t)
+#define H5F_ACS_SIEVE_BUF_SIZE_DEF 64*1024
+
+/* Definition for garbage-collect references */
+#define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref"
+#define H5F_ACS_GARBG_COLCT_REF_SIZE sizeof(unsigned)
+#define H5F_ACS_GARBG_COLCT_REF_DEF 0
+
+/* Definition for file driver ID */
+#define H5F_ACS_FILE_DRV_ID_NAME "driver_id"
+#define H5F_ACS_FILE_DRV_ID_SIZE sizeof(hid_t)
+#define H5F_ACS_FILE_DRV_ID_DEF H5FD_SEC2
+
+/* Definition for file driver info */
+#define H5F_ACS_FILE_DRV_INFO_NAME "driver_info"
+#define H5F_ACS_FILE_DRV_INFO_SIZE sizeof(void*)
+#define H5F_ACS_FILE_DRV_INFO_DEF NULL
/* Mount property list */
typedef struct H5F_mprop_t {
@@ -312,7 +352,6 @@ typedef struct H5F_mprop_t {
} H5F_mprop_t;
/* library variables */
-__DLLVAR__ H5F_access_t H5F_access_dflt;
__DLLVAR__ const H5F_mprop_t H5F_mount_dflt;
/* Forward declarations for prototypes arguments */
@@ -398,4 +437,10 @@ __DLL__ void H5F_addr_decode(H5F_t *, const uint8_t** /*in,out*/,
__DLL__ herr_t H5F_addr_pack(H5F_t *f, haddr_t *addr_p /*out*/,
const unsigned long objno[2]);
+/* callback Functions for file access class */
+__DLL__ herr_t H5F_acs_create(hid_t fapl_id, void UNUSED *close_data);
+__DLL__ herr_t H5F_acs_close(hid_t fapl_id, void UNUSED *close_data);
+__DLL__ herr_t H5F_acs_copy(hid_t new_fapl_id, hid_t old_fapl_id,
+ void UNUSED *close_data);
+
#endif
diff --git a/src/H5P.c b/src/H5P.c
index 6371505..7737913 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -38,7 +38,6 @@ static herr_t H5P_init_interface(void);
/* These go away as each old-style property list is converted to a generic */
/* property list -QAK */
hid_t H5P_NO_CLASS=(hid_t)H5P_NO_CLASS_OLD;
-hid_t H5P_FILE_ACCESS=(hid_t)H5P_FILE_ACCESS_OLD;
hid_t H5P_MOUNT=(hid_t)H5P_MOUNT_OLD;
/*
@@ -222,7 +221,7 @@ H5P_init_interface(void)
HRETURN_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class");
/* Allocate the file access class */
- if (NULL==(pclass = H5P_create_class (root_class,"file access",H5P_FILE_ACCESS_HASH_SIZE,1,NULL,NULL,NULL,NULL,NULL,NULL)))
+ if (NULL==(pclass = H5P_create_class (root_class,"file access",H5P_FILE_ACCESS_HASH_SIZE,1,H5F_acs_create,NULL,H5F_acs_copy,NULL,H5F_acs_close,NULL)))
HRETURN_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed");
/* Register the file access class */
@@ -343,14 +342,10 @@ H5Pcreate(hid_t type)
else {
/* Set the type of the property list to create for older property lists */
old_type=(H5P_class_t_old)type;
- assert( old_type==H5P_FILE_ACCESS_OLD ||
- old_type==H5P_MOUNT_OLD);
+ assert( old_type == H5P_MOUNT_OLD);
/* Allocate a new property list and initialize it with default values */
switch (old_type) {
- case H5P_FILE_ACCESS_OLD:
- src = &H5F_access_dflt;
- break;
case H5P_MOUNT_OLD:
src = &H5F_mount_dflt;
break;
@@ -487,7 +482,6 @@ herr_t
H5P_close(void *_plist)
{
H5P_t *plist=(H5P_t *)_plist;
- H5F_access_t *fa_list = &(plist->u.faccess);
FUNC_ENTER (H5P_close, FAIL);
@@ -497,15 +491,6 @@ H5P_close(void *_plist)
/* Some property lists may need to do special things */
switch (plist->cls) {
- case H5P_FILE_ACCESS_OLD:
- if (fa_list->driver_id>=0) {
- H5FD_fapl_free(fa_list->driver_id, fa_list->driver_info);
- H5I_dec_ref(fa_list->driver_id);
- fa_list->driver_info = NULL;
- fa_list->driver_id = -1;
- }
- break;
-
case H5P_MOUNT_OLD:
break;
@@ -754,6 +739,9 @@ static hid_t H5P_copy_plist(H5P_genplist_t *old_plist, hid_t old_plist_id)
if ((new_plist_id = H5I_register(H5I_GENPROP_LST, new_plist))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list");
+ /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */
+ new_plist->plist_id=new_plist_id;
+
/* Call the class callback (if it exists) now that we have the property list ID */
if(new_plist->pclass->copy_func!=NULL) {
if((new_plist->pclass->copy_func)(new_plist_id,old_plist_id,old_plist->pclass->copy_data)<0) {
@@ -927,16 +915,11 @@ H5P_copy (H5P_class_t_old type, const void *src)
{
size_t size;
H5P_t *dst = NULL;
- H5F_access_t *fa_dst = NULL;
FUNC_ENTER (H5P_copy, NULL);
/* How big is the property list */
switch (type) {
- case H5P_FILE_ACCESS_OLD:
- size = sizeof(H5F_access_t);
- break;
-
case H5P_MOUNT_OLD:
size = sizeof(H5F_mprop_t);
break;
@@ -960,15 +943,6 @@ H5P_copy (H5P_class_t_old type, const void *src)
/* Deep-copy pointers */
switch (type) {
- case H5P_FILE_ACCESS_OLD:
- fa_dst = (H5F_access_t*)dst;
-
- if (fa_dst->driver_id>=0) {
- H5I_inc_ref(fa_dst->driver_id);
- fa_dst->driver_info = H5FD_fapl_copy(fa_dst->driver_id,
- fa_dst->driver_info);
- }
- break;
case H5P_MOUNT_OLD:
/* Nothing to do */
@@ -1157,30 +1131,35 @@ H5Pget_userblock(hid_t plist_id, hsize_t *size)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed file access property list mechanism to the new
+ * generic property list.
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment)
{
- H5F_access_t *fapl = NULL;
FUNC_ENTER (H5Pset_alignment, FAIL);
H5TRACE3("e","ihh",fapl_id,threshold,alignment);
/* Check args */
- if (H5P_FILE_ACCESS != H5P_get_class (fapl_id) ||
- NULL == (fapl = H5I_object (fapl_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "not a file access property list");
+
if (alignment<1) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"alignment must be positive");
}
/* Set values */
- fapl->threshold = threshold;
- fapl->alignment = alignment;
+ if(H5P_set(fapl_id, H5F_ACS_ALIGN_THRHD_NAME, &threshold) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set threshold");
+ if(H5P_set(fapl_id, H5F_ACS_ALIGN_NAME, &alignment) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment");
FUNC_LEAVE (SUCCEED);
}
@@ -1200,29 +1179,33 @@ H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list design to the new generic
+ * property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_alignment(hid_t fapl_id, hsize_t *threshold/*out*/,
hsize_t *alignment/*out*/)
{
- H5F_access_t *fapl = NULL;
-
FUNC_ENTER (H5Pget_alignment, FAIL);
H5TRACE3("e","ixx",fapl_id,threshold,alignment);
/* Check args */
- if (H5P_FILE_ACCESS != H5P_get_class (fapl_id) ||
- NULL == (fapl = H5I_object (fapl_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "not a file access property list");
/* Get values */
if (threshold)
- *threshold = fapl->threshold;
+ if(H5P_get(fapl_id, H5F_ACS_ALIGN_THRHD_NAME, threshold) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get threshold");
if (alignment)
- *alignment = fapl->alignment;
+ if(H5P_set(fapl_id, H5F_ACS_ALIGN_NAME, alignment) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment");
FUNC_LEAVE (SUCCEED);
}
@@ -1972,12 +1955,16 @@ H5Pget_external(hid_t plist_id, int idx, size_t name_size, char *name/*out*/,
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list design to the new generic
+ * property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info)
{
- H5F_access_t *fapl=NULL;
hid_t driver_id; /* VFL driver ID */
void *driver_info; /* VFL driver info */
void *tmp_driver_info; /* Temporary VFL driver info */
@@ -1989,23 +1976,27 @@ H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info)
if (H5I_VFL!=H5I_get_type(new_driver_id) || NULL==H5I_object(new_driver_id))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID");
- if (H5P_FILE_ACCESS==H5P_get_class(plist_id)) {
- if (NULL==(fapl=H5I_object(plist_id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
-
+ if( TRUE == H5Pisa_class(plist_id, H5P_FILE_ACCESS) ) {
/* Remove old driver */
- assert(fapl->driver_id>=0);
- H5FD_fapl_free(fapl->driver_id, fapl->driver_info);
- H5I_dec_ref(fapl->driver_id);
+ if(H5P_get(plist_id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID");
+ if(H5P_get(plist_id, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,"can't get driver info");
+ assert(driver_id>=0);
+ H5FD_fapl_free(driver_id, driver_info);
+ H5I_dec_ref(driver_id);
/* Add new driver */
H5I_inc_ref(new_driver_id);
- fapl->driver_id = new_driver_id;
- fapl->driver_info = H5FD_fapl_copy(new_driver_id, new_driver_info);
+ driver_id = new_driver_id;
+ driver_info = H5FD_fapl_copy(new_driver_id, new_driver_info);
+
+ if(H5P_set(plist_id, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver ID");
+ if(H5P_set(plist_id, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,"can't set driver info");
- } else if (H5I_GENPROP_LST==H5I_get_type(plist_id)) {
+ } else if( TRUE == H5Pisa_class(plist_id, H5P_DATASET_XFER) ) {
/* Get the current driver information */
if(H5P_get(plist_id, H5D_XFER_VFL_ID_NAME, &driver_id)<0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
@@ -2035,7 +2026,7 @@ H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info)
/* Set the driver info for the property list */
if(H5P_set(plist_id, H5D_XFER_VFL_ID_NAME, &new_driver_id)<0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver ID");
- if(H5P_set(plist_id, H5D_XFER_VFL_INFO_NAME, &tmp_driver_info)<0)
+ if(H5P_set(plist_id, H5D_XFER_VFL_INFO_NAME, &tmp_driver_info) < 0)
HGOTO_ERROR (H5E_PLIST, H5E_CANTSET, FAIL, "Can't set VFL driver info");
} else {
@@ -2084,6 +2075,8 @@ H5Pget_driver(hid_t plist_id)
FUNC_ENTER (H5Pget_driver, FAIL);
H5TRACE1("i","i",plist_id);
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
ret_value = H5P_get_driver(plist_id);
FUNC_LEAVE(ret_value);
@@ -2111,25 +2104,30 @@ H5Pget_driver(hid_t plist_id)
* Rewritten to use the virtual file layer.
*
* Robb Matzke, 1999-08-05
- * If the driver ID is H5FD_VFD_DEFAULT then substitute the current value
- * of H5FD_SEC2.
+ * If the driver ID is H5FD_VFD_DEFAULT then substitute the
+ * current value of H5FD_SEC2.
*
* Quincey Koziol 2000-11-28
* Added internal function..
+ *
+ * Raymond Lu, 2001-10-23
+ * Changed the file access list design to the new generic
+ * property list.
+ *
*-------------------------------------------------------------------------
*/
hid_t
H5P_get_driver(hid_t plist_id)
{
- H5F_access_t *fapl=NULL;
hid_t ret_value=-1;
FUNC_ENTER (H5P_get_driver, FAIL);
H5TRACE1("i","i",plist_id);
- if (H5P_FILE_ACCESS==H5P_get_class(plist_id) && (fapl=H5I_object(plist_id))) {
- ret_value = fapl->driver_id;
- } else if (H5I_GENPROP_LST==H5I_get_type(plist_id)) {
+ if( TRUE == H5Pisa_class(plist_id, H5P_FILE_ACCESS) ) {
+ if(H5P_get(plist_id, H5F_ACS_FILE_DRV_ID_NAME, &ret_value) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID");
+ } else if( TRUE == H5Pisa_class(plist_id, H5P_DATASET_XFER) ) {
/* Get the current driver ID */
if(H5P_get(plist_id, H5D_XFER_VFL_ID_NAME, &ret_value)<0)
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID");
@@ -2164,19 +2162,24 @@ H5P_get_driver(hid_t plist_id)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list design to the new generic
+ * property list.
+ *
*-------------------------------------------------------------------------
*/
void *
H5Pget_driver_info(hid_t plist_id)
{
- H5F_access_t *fapl=NULL;
void *ret_value=NULL;
FUNC_ENTER(H5Pget_driver_info, NULL);
- if (H5P_FILE_ACCESS==H5P_get_class(plist_id) && (fapl=H5I_object(plist_id))) {
- ret_value = fapl->driver_info;
- } else if (H5I_GENPROP_LST==H5I_get_type(plist_id)) {
+ if( TRUE == H5Pisa_class(plist_id, H5P_FILE_ACCESS) ) {
+ if(H5P_get(plist_id, H5F_ACS_FILE_DRV_INFO_NAME, &ret_value) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET,NULL,"can't get driver info");
+ } else if( TRUE == H5Pisa_class(plist_id, H5P_DATASET_XFER) ) {
/* Get the current driver info */
if(H5P_get(plist_id, H5D_XFER_VFL_INFO_NAME, &ret_value)<0)
HRETURN_ERROR (H5E_PLIST, H5E_CANTGET, NULL, "Can't retrieve VFL driver ID");
@@ -2211,23 +2214,24 @@ H5Pget_driver_info(hid_t plist_id)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_cache(hid_t plist_id, int mdc_nelmts,
size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0)
{
- H5F_access_t *fapl = NULL;
FUNC_ENTER (H5Pset_cache, FAIL);
H5TRACE5("e","iIszzd",plist_id,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
/* Check arguments */
- if (H5P_FILE_ACCESS!=H5P_get_class (plist_id) ||
- NULL==(fapl=H5I_object (plist_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
+ if( H5I_GENPROP_LST != H5I_get_type(plist_id) ||
+ TRUE != H5Pisa_class(plist_id, H5P_FILE_ACCESS) )
+
if (mdc_nelmts<0) {
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL,
"meta data cache size must be non-negative");
@@ -2239,10 +2243,18 @@ H5Pset_cache(hid_t plist_id, int mdc_nelmts,
}
/* Set sizes */
- fapl->mdc_nelmts = mdc_nelmts;
- fapl->rdcc_nelmts = rdcc_nelmts;
- fapl->rdcc_nbytes = rdcc_nbytes;
- fapl->rdcc_w0 = rdcc_w0;
+ if(H5P_set(plist_id, H5F_ACS_META_CACHE_SIZE_NAME, &mdc_nelmts) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,
+ "can't set meta data cache size");
+ if(H5P_set(plist_id, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &rdcc_nelmts) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,
+ "can't set data cache element size");
+ if(H5P_set(plist_id, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,
+ "can't set data cache byte size");
+ if(H5P_set(plist_id, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET,FAIL,
+ "can't set preempt read chunks");
FUNC_LEAVE (SUCCEED);
}
@@ -2264,34 +2276,44 @@ H5Pset_cache(hid_t plist_id, int mdc_nelmts,
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_cache(hid_t plist_id, int *mdc_nelmts,
size_t *rdcc_nelmts, size_t *rdcc_nbytes, double *rdcc_w0)
{
- H5F_access_t *fapl = NULL;
FUNC_ENTER (H5Pget_cache, FAIL);
H5TRACE5("e","i*Is*z*z*d",plist_id,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,
rdcc_w0);
/* Check arguments */
- if (H5P_FILE_ACCESS!=H5P_get_class (plist_id) ||
- NULL==(fapl=H5I_object (plist_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
+ if(H5I_GENPROP_LST != H5I_get_type(plist_id) ||
+ TRUE != H5Pisa_class(plist_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Get sizes */
if (mdc_nelmts)
- *mdc_nelmts = fapl->mdc_nelmts;
+ if(H5P_get(plist_id, H5F_ACS_META_CACHE_SIZE_NAME, mdc_nelmts) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,
+ "can't get meta data cache size");
if (rdcc_nelmts)
- *rdcc_nelmts = fapl->rdcc_nelmts;
+ if(H5P_get(plist_id, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, rdcc_nelmts) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,
+ "can't get data cache element size");
if (rdcc_nbytes)
- *rdcc_nbytes = fapl->rdcc_nbytes;
+ if(H5P_get(plist_id, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, rdcc_nbytes) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,
+ "can't get data cache byte size");
if (rdcc_w0)
- *rdcc_w0 = fapl->rdcc_w0;
+ if(H5P_get(plist_id, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, rdcc_w0) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET,FAIL,
+ "can't get preempt read chunks");
FUNC_LEAVE (SUCCEED);
}
@@ -3159,25 +3181,28 @@ done:
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref)
{
- H5F_access_t *fapl = NULL;
-
FUNC_ENTER(H5Pset_gc_references, FAIL);
H5TRACE2("e","iIu",fapl_id,gc_ref);
/* Check args */
- if (H5P_FILE_ACCESS!=H5P_get_class(fapl_id) ||
- NULL==(fapl=H5I_object(fapl_id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Set values */
- fapl->gc_ref = (gc_ref!=0);
+ if(H5P_set(fapl_id, H5F_ACS_GARBG_COLCT_REF_NAME, &gc_ref) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set garbage collect reference");
FUNC_LEAVE (SUCCEED);
}
@@ -3196,26 +3221,28 @@ H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_gc_references(hid_t fapl_id, unsigned *gc_ref/*out*/)
{
- H5F_access_t *fapl = NULL;
-
FUNC_ENTER(H5Pget_gc_references, FAIL);
H5TRACE2("e","ix",fapl_id,gc_ref);
/* Check args */
- if (H5P_FILE_ACCESS!=H5P_get_class(fapl_id) ||
- NULL==(fapl=H5I_object(fapl_id))) {
- HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
-
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Get values */
if (gc_ref)
- *gc_ref = fapl->gc_ref;
+ if(H5P_get(fapl_id, H5F_ACS_GARBG_COLCT_REF_NAME, gc_ref) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,
+ "can't get garbage collect reference");
FUNC_LEAVE (SUCCEED);
}
@@ -3339,25 +3366,27 @@ H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func/*out*/,
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_meta_block_size(hid_t fapl_id, size_t size)
{
- H5F_access_t *fapl = NULL;
-
FUNC_ENTER (H5Pset_meta_block_size, FAIL);
H5TRACE2("e","iz",fapl_id,size);
/* Check args */
- if (H5P_FILE_ACCESS != H5P_get_class (fapl_id) ||
- NULL == (fapl = H5I_object (fapl_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
-
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Set values */
- fapl->meta_block_size = size;
+ if(H5P_set(fapl_id, H5F_ACS_META_BLOCK_SIZE_NAME, &size) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set meta data block size");
FUNC_LEAVE (SUCCEED);
}
@@ -3376,26 +3405,29 @@ H5Pset_meta_block_size(hid_t fapl_id, size_t size)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_meta_block_size(hid_t fapl_id, size_t *size/*out*/)
{
- H5F_access_t *fapl = NULL;
FUNC_ENTER (H5Pget_meta_block_size, FAIL);
H5TRACE2("e","ix",fapl_id,size);
/* Check args */
- if (H5P_FILE_ACCESS != H5P_get_class (fapl_id) ||
- NULL == (fapl = H5I_object (fapl_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
-
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Get values */
if (size)
- *size = fapl->meta_block_size;
+ if(H5P_get(fapl_id, H5F_ACS_META_BLOCK_SIZE_NAME, size) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,
+ "can't get meta data block size");
FUNC_LEAVE (SUCCEED);
}
@@ -3423,25 +3455,28 @@ H5Pget_meta_block_size(hid_t fapl_id, size_t *size/*out*/)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pset_sieve_buf_size(hid_t fapl_id, size_t size)
{
- H5F_access_t *fapl = NULL;
FUNC_ENTER (H5Pset_sieve_buf_size, FAIL);
H5TRACE2("e","iz",fapl_id,size);
/* Check args */
- if (H5P_FILE_ACCESS != H5P_get_class (fapl_id) ||
- NULL == (fapl = H5I_object (fapl_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
-
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Set values */
- fapl->sieve_buf_size = size;
+ if(H5P_set(fapl_id, H5F_ACS_SIEVE_BUF_SIZE_NAME, &size) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL,
+ "can't set sieve buffer size");
FUNC_LEAVE (SUCCEED);
} /* end H5Pset_sieve_buf_size() */
@@ -3460,26 +3495,28 @@ H5Pset_sieve_buf_size(hid_t fapl_id, size_t size)
*
* Modifications:
*
+ * Raymond Lu
+ * Tuesday, Oct 23, 2001
+ * Changed the file access list to the new generic property
+ * list.
+ *
*-------------------------------------------------------------------------
*/
herr_t
H5Pget_sieve_buf_size(hid_t fapl_id, size_t *size/*out*/)
{
- H5F_access_t *fapl = NULL;
-
FUNC_ENTER (H5Pget_sieve_buf_size, FAIL);
H5TRACE2("e","ix",fapl_id,size);
/* Check args */
- if (H5P_FILE_ACCESS != H5P_get_class (fapl_id) ||
- NULL == (fapl = H5I_object (fapl_id))) {
- HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL,
- "not a file access property list");
- }
-
+ if(H5I_GENPROP_LST != H5I_get_type(fapl_id) ||
+ TRUE != H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
/* Get values */
if (size)
- *size = fapl->sieve_buf_size;
+ if(H5P_get(fapl_id, H5F_ACS_SIEVE_BUF_SIZE_NAME, size) < 0)
+ HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,
+ "can't get sieve buffer size");
FUNC_LEAVE (SUCCEED);
} /* end H5Pget_sieve_buf_size() */
@@ -4381,6 +4418,9 @@ hid_t H5Pcreate_list(hid_t cls_id)
if ((plist_id = H5I_register(H5I_GENPROP_LST, plist))<0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to atomize property list");
+ /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */
+ plist->plist_id=plist_id;
+
/* Call the class callback (if it exists) now that we have the property list ID */
if(plist->pclass->create_func!=NULL) {
if((plist->pclass->create_func)(plist_id,plist->pclass->create_data)<0) {
@@ -7341,6 +7381,12 @@ static herr_t H5P_close_list(void *_plist)
assert(plist);
+ /* Make call to property list class close callback, if needed */
+ if(plist->class_init!=0 && plist->pclass->close_func!=NULL) {
+ /* Call user's "close" callback function, ignoring return value */
+ (plist->pclass->close_func)(plist->plist_id,plist->pclass->close_data);
+ } /* end if */
+
/* Make calls to any property close callbacks which exist */
H5P_free_all_prop(plist->props,plist->pclass->hashsize,1);
@@ -7390,12 +7436,6 @@ herr_t H5Pclose_list(hid_t plist_id)
if (H5I_GENPROP_LST != H5I_get_type(plist_id) || NULL == (plist = H5I_object(plist_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
- /* Make call to property list class close callback, if needed */
- if(plist->class_init!=0 && plist->pclass->close_func!=NULL) {
- /* Call user's "close" callback function, ignoring return value */
- (plist->pclass->close_func)(plist_id,plist->pclass->close_data);
- } /* end if */
-
/* Close the property list */
if ((ret_value=H5P_close_list(plist)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close");
diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h
index 212cf4b..f6d7573 100644
--- a/src/H5Pprivate.h
+++ b/src/H5Pprivate.h
@@ -82,6 +82,7 @@ typedef struct H5P_genclass_tag {
/* Define structure to hold property list information */
typedef struct H5P_genplist_tag {
H5P_genclass_t *pclass; /* Pointer to class info */
+ hid_t plist_id; /* Copy of the property list ID (for use in close callback) */
size_t nprops; /* Number of properties in class */
unsigned class_init:1; /* Whether the class initialization callback finished successfully */
@@ -93,7 +94,6 @@ typedef struct H5P_genplist_tag {
typedef struct {
/* Union of all the different kinds of property lists */
union {
- H5F_access_t faccess; /* File access properties */
H5F_mprop_t mount; /* Mounting properties */
} u;
H5P_class_t_old cls; /* Property list class */
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 9156065..d9a1911 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -39,8 +39,7 @@ typedef long off_t;
/* Property list classes */
typedef enum H5P_class_t_old {
H5P_NO_CLASS_OLD = -1, /*error return value */
- H5P_FILE_ACCESS_OLD = 0, /*file access properties */
- H5P_MOUNT_OLD = 1, /*file mounting properties */
+ H5P_MOUNT_OLD = 0, /*file mounting properties */
H5P_NCLASSES_OLD /*this must be last! */
} H5P_class_t_old;
@@ -55,7 +54,6 @@ typedef hid_t H5P_class_t; /* Alias H5P_class_t to hid_t */
/* - merge/delete H5Pcopy and H5Pcopy_new */
/* - merge/delete H5Pclose and H5Pclose_list */
__DLLVAR__ hid_t H5P_NO_CLASS;
-__DLLVAR__ hid_t H5P_FILE_ACCESS;
__DLLVAR__ hid_t H5P_MOUNT;
/* H5P_DATASET_XFER was the name from the beginning through 1.2. It was
@@ -92,16 +90,16 @@ extern "C" {
*/
#define H5P_NO_CLASS_NEW (H5open(), H5P_CLS_NO_CLASS_g)
#define H5P_NO_CLASS_HASH_SIZE 1 /* 1, not 0, otherwise allocations get weird */
-#define H5P_FILE_CREATE (H5open(), H5P_CLS_FILE_CREATE_g)
-#define H5P_FILE_CREATE_HASH_SIZE 17
-#define H5P_FILE_ACCESS_NEW (H5open(), H5P_CLS_FILE_ACCESS_g)
-#define H5P_FILE_ACCESS_HASH_SIZE 17
-#define H5P_DATASET_CREATE (H5open(), H5P_CLS_DATASET_CREATE_g)
-#define H5P_DATASET_CREATE_HASH_SIZE 17
-#define H5P_DATASET_XFER (H5open(), H5P_CLS_DATASET_XFER_g)
-#define H5P_DATASET_XFER_HASH_SIZE 17
-#define H5P_MOUNT_NEW (H5open(), H5P_CLS_MOUNT_g)
-#define H5P_MOUNT_HASH_SIZE 17
+#define H5P_FILE_CREATE (H5open(), H5P_CLS_FILE_CREATE_g)
+#define H5P_FILE_CREATE_HASH_SIZE 17
+#define H5P_FILE_ACCESS (H5open(), H5P_CLS_FILE_ACCESS_g)
+#define H5P_FILE_ACCESS_HASH_SIZE 17
+#define H5P_DATASET_CREATE (H5open(), H5P_CLS_DATASET_CREATE_g)
+#define H5P_DATASET_CREATE_HASH_SIZE 17
+#define H5P_DATASET_XFER (H5open(), H5P_CLS_DATASET_XFER_g)
+#define H5P_DATASET_XFER_HASH_SIZE 17
+#define H5P_MOUNT_NEW (H5open(), H5P_CLS_MOUNT_g)
+#define H5P_MOUNT_HASH_SIZE 17
__DLLVAR__ hid_t H5P_CLS_NO_CLASS_g;
__DLLVAR__ hid_t H5P_CLS_FILE_CREATE_g;
__DLLVAR__ hid_t H5P_CLS_FILE_ACCESS_g;
@@ -111,12 +109,12 @@ __DLLVAR__ hid_t H5P_CLS_MOUNT_g;
/*
* The library created default property lists
*/
-#define H5P_NO_CLASS_DEFAULT (H5open(), H5P_LST_NO_CLASS_g)
-#define H5P_FILE_CREATE_DEFAULT (H5open(), H5P_LST_FILE_CREATE_g)
-#define H5P_FILE_ACCESS_DEFAULT (H5open(), H5P_LST_FILE_ACCESS_g)
-#define H5P_DATASET_CREATE_DEFAULT (H5open(), H5P_LST_DATASET_CREATE_g)
-#define H5P_DATASET_XFER_DEFAULT (H5open(), H5P_LST_DATASET_XFER_g)
-#define H5P_MOUNT_DEFAULT (H5open(), H5P_LST_MOUNT_g)
+#define H5P_NO_CLASS_DEFAULT (H5open(), H5P_LST_NO_CLASS_g)
+#define H5P_FILE_CREATE_DEFAULT (H5open(), H5P_LST_FILE_CREATE_g)
+#define H5P_FILE_ACCESS_DEFAULT (H5open(), H5P_LST_FILE_ACCESS_g)
+#define H5P_DATASET_CREATE_DEFAULT (H5open(), H5P_LST_DATASET_CREATE_g)
+#define H5P_DATASET_XFER_DEFAULT (H5open(), H5P_LST_DATASET_XFER_g)
+#define H5P_MOUNT_DEFAULT (H5open(), H5P_LST_MOUNT_g)
__DLLVAR__ hid_t H5P_LST_NO_CLASS_g;
__DLLVAR__ hid_t H5P_LST_FILE_CREATE_g;
__DLLVAR__ hid_t H5P_LST_FILE_ACCESS_g;