summaryrefslogtreecommitdiffstats
path: root/src/H5P.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-12-05 16:12:32 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-12-05 16:12:32 (GMT)
commita9c747deba6e588b2ec5bc624a53c976a9faa3bc (patch)
tree4a9c1f2c4f2b383a62e2f9e8b87ab3ef154f810c /src/H5P.c
parent2167e3c495aada1c47375cdf923d26c583dce768 (diff)
downloadhdf5-a9c747deba6e588b2ec5bc624a53c976a9faa3bc.zip
hdf5-a9c747deba6e588b2ec5bc624a53c976a9faa3bc.tar.gz
hdf5-a9c747deba6e588b2ec5bc624a53c976a9faa3bc.tar.bz2
[svn-r4669] Purpose:
Backward Compatibility Fix Description: One of H5P[gs]et_cache's parameters changed between v1.4 and the development branch. Solution: Added v1.4 compat stuff around H5P[gs]et_cache implementation and testing to allow v1.4.x users to continue to use their source code without modification. These changes are for everything except the FORTRAN wrappers - I spoke with Elena and she will make the FORTRAN wrapper changes. Platforms tested: FreeBSD 4.4 (hawkwind)
Diffstat (limited to 'src/H5P.c')
-rw-r--r--src/H5P.c132
1 files changed, 132 insertions, 0 deletions
diff --git a/src/H5P.c b/src/H5P.c
index 71e14bc..5d47446 100644
--- a/src/H5P.c
+++ b/src/H5P.c
@@ -1987,6 +1987,137 @@ H5Pget_driver_info(hid_t plist_id)
FUNC_LEAVE(ret_value);
} /* end H5Pget_driver_info() */
+#ifdef H5_WANT_H5_V1_4_COMPAT
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pset_cache
+ *
+ * Purpose: Set the number of objects in the meta data cache and the
+ * maximum number of chunks and bytes in the raw data chunk
+ * cache.
+ *
+ * The RDCC_W0 value should be between 0 and 1 inclusive and
+ * indicates how much chunks that have been fully read or fully
+ * written are favored for preemption. A value of zero means
+ * fully read or written chunks are treated no differently than
+ * other chunks (the preemption is strictly LRU) while a value
+ * of one means fully read chunks are always preempted before
+ * other chunks.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, May 19, 1998
+ *
+ * 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,
+ int _rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t rdcc_nelmts=(size_t)_rdcc_nelmts; /* Work around variable changing size */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ FUNC_ENTER (H5Pset_cache, FAIL);
+ H5TRACE5("e","iIszzd",plist_id,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0);
+
+ /* Check arguments */
+ if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) )
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
+ if (mdc_nelmts<0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "meta data cache size must be non-negative");
+ if (rdcc_w0<0.0 || rdcc_w0>1.0)
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "raw data cache w0 value must be between 0.0 and 1.0 inclusive");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Set sizes */
+ if(H5P_set(plist, H5F_ACS_META_CACHE_SIZE_NAME, &mdc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set meta data cache size");
+ if(H5P_set(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &rdcc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache element size");
+ if(H5P_set(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set data cache byte size");
+ if(H5P_set(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET,FAIL, "can't set preempt read chunks");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Pget_cache
+ *
+ * Purpose: Retrieves the maximum possible number of elements in the meta
+ * data cache and the maximum possible number of elements and
+ * bytes and the RDCC_W0 value in the raw data chunk cache. Any
+ * (or all) arguments may be null pointers in which case the
+ * corresponding datum is not returned.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Robb Matzke
+ * Tuesday, May 19, 1998
+ *
+ * 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,
+ int *_rdcc_nelmts, size_t *rdcc_nbytes, double *rdcc_w0)
+{
+ H5P_genplist_t *plist; /* Property list pointer */
+ size_t rdcc_nelmts; /* Work around variable changing size */
+ herr_t ret_value=SUCCEED; /* return value */
+
+ 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(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list");
+
+ /* Get the plist structure */
+ if(NULL == (plist = H5I_object(plist_id)))
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
+
+ /* Get sizes */
+ if (mdc_nelmts)
+ if(H5P_get(plist, H5F_ACS_META_CACHE_SIZE_NAME, mdc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get meta data cache size");
+ if (_rdcc_nelmts) {
+ if(H5P_get(plist, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, &rdcc_nelmts) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache element size");
+ *_rdcc_nelmts=rdcc_nelmts;
+ } /* end if */
+ if (rdcc_nbytes)
+ if(H5P_get(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, rdcc_nbytes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache byte size");
+ if (rdcc_w0)
+ if(H5P_get(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, rdcc_w0) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get preempt read chunks");
+
+done:
+ FUNC_LEAVE(ret_value);
+}
+
+#else /* H5_WANT_H5_V1_4_COMPAT */
/*-------------------------------------------------------------------------
* Function: H5Pset_cache
@@ -2111,6 +2242,7 @@ H5Pget_cache(hid_t plist_id, int *mdc_nelmts,
done:
FUNC_LEAVE(ret_value);
}
+#endif /* H5_WANT_H5_V1_4_COMPAT */
/*-------------------------------------------------------------------------