summaryrefslogtreecommitdiffstats
path: root/src/H5checksum.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-08-22 17:50:25 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-08-22 17:50:25 (GMT)
commit5c5f9e8e28dc7665051b10494a7133d331f673f5 (patch)
tree63d21cc2d4bfac7b7efa843c8563f2da5ce4f75e /src/H5checksum.c
parentc2c6e2d0d5f4bfe8c7d31711a09b0bc1cdcd267f (diff)
downloadhdf5-5c5f9e8e28dc7665051b10494a7133d331f673f5.zip
hdf5-5c5f9e8e28dc7665051b10494a7133d331f673f5.tar.gz
hdf5-5c5f9e8e28dc7665051b10494a7133d331f673f5.tar.bz2
[svn-r12612] Description:
Provide more abstract internal routine for computing checksums on metadata in a file. This will allow a unified policy on which algorithm to choose and under what criteria (length probably) to be more easily maintained. Tested On: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5checksum.c')
-rw-r--r--src/H5checksum.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/H5checksum.c b/src/H5checksum.c
index 9ad575d..4a1e5de 100644
--- a/src/H5checksum.c
+++ b/src/H5checksum.c
@@ -136,3 +136,38 @@ H5_fletcher32(const void *_data, size_t _len)
FUNC_LEAVE_NOAPI((sum2 << 16) | sum1)
} /* end H5_fletcher32() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5_checksum_metadata
+ *
+ * Purpose: Provide a more abstract routine for checksumming metadata
+ * in a file, where the policy of which algorithm to choose
+ * is centralized.
+ *
+ * Return: checksum of input buffer (can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, August 22, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+uint32_t
+H5_checksum_metadata(const void *data, size_t len)
+{
+ uint32_t chksum; /* Checksum value to return */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5_checksum_metadata)
+
+ /* Sanity check */
+ HDassert(data);
+ HDassert(len > 0);
+
+ /* Choose the appropriate checksum routine */
+ /* (use fletcher32 for everything right now, but will probably go
+ * with a CRC algorithm for "shorter" pieces of metadata eventually)
+ */
+ chksum = H5_fletcher32(data, len);
+
+ FUNC_LEAVE_NOAPI(chksum)
+} /* end H5_checksum_metadata() */
+