summaryrefslogtreecommitdiffstats
path: root/hl/src
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2013-04-19 15:23:01 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2013-04-19 15:23:01 (GMT)
commit14d8e1c2b5ecaf2e298984f269094dd5f2bd735f (patch)
treecc250461294a2c9118b10a95d0459d7314fa5e50 /hl/src
parent6ee0e05fb94445551840fcb80b9b1c254c736799 (diff)
downloadhdf5-14d8e1c2b5ecaf2e298984f269094dd5f2bd735f.zip
hdf5-14d8e1c2b5ecaf2e298984f269094dd5f2bd735f.tar.gz
hdf5-14d8e1c2b5ecaf2e298984f269094dd5f2bd735f.tar.bz2
[svn-r23600] Bring revisions #23085 - #23341 from trunk to revise_chunks.
h5committested.
Diffstat (limited to 'hl/src')
-rw-r--r--hl/src/CMakeLists.txt4
-rw-r--r--hl/src/H5DO.c137
-rw-r--r--hl/src/H5DOprivate.h37
-rw-r--r--hl/src/H5DOpublic.h42
-rw-r--r--hl/src/H5DS.c4
-rw-r--r--hl/src/Makefile.am4
-rw-r--r--hl/src/Makefile.in13
-rw-r--r--hl/src/hdf5_hl.h1
8 files changed, 232 insertions, 10 deletions
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index 2df2c23..edba042 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.8.6)
+cmake_minimum_required (VERSION 2.8.10)
PROJECT (HDF5_HL_SRC)
#-----------------------------------------------------------------------------
@@ -14,6 +14,7 @@ ENDIF (BUILD_SHARED_LIBS)
INCLUDE_DIRECTORIES (${HDF5_HL_SRC_DIR}/src)
SET (HL_SRCS
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5DO.c
${HDF5_HL_SRC_SOURCE_DIR}/H5DS.c
${HDF5_HL_SRC_SOURCE_DIR}/H5IM.c
${HDF5_HL_SRC_SOURCE_DIR}/H5LT.c
@@ -24,6 +25,7 @@ SET (HL_SRCS
)
SET (HL_HEADERS
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5DOpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5DSpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5IMpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h
diff --git a/hl/src/H5DO.c b/hl/src/H5DO.c
new file mode 100644
index 0000000..9cfd8c1
--- /dev/null
+++ b/hl/src/H5DO.c
@@ -0,0 +1,137 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+* Copyright by The HDF Group. *
+* Copyright by the Board of Trustees of the University of Illinois. *
+* All rights reserved. *
+* *
+* This file is part of HDF5. The full HDF5 copyright notice, including *
+* terms governing use, modification, and redistribution, is contained in *
+* the files COPYING and Copyright.html. COPYING can be found at the root *
+* of the source code distribution tree; Copyright.html can be found at the *
+* root level of an installed copy of the electronic HDF5 document set and *
+* is linked from the top-level documents page. It can also be found at *
+* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+* access to either file, you may request a copy from help@hdfgroup.org. *
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <stdio.h>
+
+#include "H5DOprivate.h"
+
+/*-------------------------------------------------------------------------
+ * Function: H5DOwrite_chunk
+ *
+ * Purpose: Writes an entire chunk to the file directly.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * 30 July 2012
+ *
+ * Modifications:
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
+ size_t data_size, const void *buf)
+{
+ hbool_t created_dxpl = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ if(dset_id < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(!buf) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(!offset) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(!data_size) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(H5P_DEFAULT == dxpl_id) {
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ created_dxpl = TRUE;
+ }
+
+ if(H5DO_write_chunk(dset_id, dxpl_id, filters, offset, data_size, buf) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+done:
+ if(created_dxpl) {
+ if(H5Pclose(dxpl_id) < 0)
+ ret_value = FAIL;
+ }
+
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: H5DO_write_chunk
+ *
+ * Purpose: Private function for H5DOwrite_chunk
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Raymond Lu
+ * 30 July 2012
+ *
+ * Modifications:
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5DO_write_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset,
+ size_t data_size, const void *buf)
+{
+ hbool_t do_direct_write = TRUE;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &filters) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &offset) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &data_size) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if(H5Dwrite(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+done:
+ do_direct_write = FALSE;
+ if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0)
+ ret_value = FAIL;
+
+ return ret_value;
+}
diff --git a/hl/src/H5DOprivate.h b/hl/src/H5DOprivate.h
new file mode 100644
index 0000000..fcea585
--- /dev/null
+++ b/hl/src/H5DOprivate.h
@@ -0,0 +1,37 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _H5DOprivate_H
+#define _H5DOprivate_H
+
+/* High-level library internal header file */
+#include "H5HLprivate2.h"
+
+/* public LT prototypes */
+#include "H5DOpublic.h"
+
+/*-------------------------------------------------------------------------
+ * Private functions
+ *-------------------------------------------------------------------------
+ */
+
+H5_HLDLL herr_t H5DO_write_chunk(hid_t dset_id,
+ hid_t dxpl_id,
+ uint32_t filters,
+ const hsize_t *offset,
+ size_t data_size,
+ const void *buf);
+
+#endif
diff --git a/hl/src/H5DOpublic.h b/hl/src/H5DOpublic.h
new file mode 100644
index 0000000..774709e
--- /dev/null
+++ b/hl/src/H5DOpublic.h
@@ -0,0 +1,42 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _H5DOpublic_H
+#define _H5DOpublic_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*-------------------------------------------------------------------------
+ *
+ * Direct chunk write function
+ *
+ *-------------------------------------------------------------------------
+ */
+
+H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id,
+ hid_t dxpl_id,
+ uint32_t filters,
+ const hsize_t *offset,
+ size_t data_size,
+ const void *buf);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index e9ea9cf..cb3a1ce 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -1779,6 +1779,8 @@ out:
* Comments:
*
* Modifications:
+* The size of the name returned should not include the NULL termination
+* in its value so as to be consistent with other HDF5 APIs.
*
*-------------------------------------------------------------------------
*/
@@ -1875,7 +1877,7 @@ ssize_t H5DSget_scale_name(hid_t did,
buf=NULL;
}
- return (ssize_t) nbytes;
+ return (ssize_t) MAX(0,nbytes-1);
/* error zone */
out:
diff --git a/hl/src/Makefile.am b/hl/src/Makefile.am
index 4c120b1..c1e6810 100644
--- a/hl/src/Makefile.am
+++ b/hl/src/Makefile.am
@@ -31,12 +31,12 @@ lib_LTLIBRARIES=libhdf5_hl.la
libhdf5_hl_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# List sources to include in the HDF5 HL Library.
-libhdf5_hl_la_SOURCES=H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c H5LD.c
+libhdf5_hl_la_SOURCES=H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c H5LD.c
# HDF5 HL library depends on HDF5 Library.
libhdf5_hl_la_LIBADD=$(LIBHDF5)
# Public header files (to be installed)
-include_HEADERS=hdf5_hl.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LDpublic.h
+include_HEADERS=hdf5_hl.h H5DOpublic.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LDpublic.h
include $(top_srcdir)/config/conclude.am
diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in
index 9fb86a5..34db4c0 100644
--- a/hl/src/Makefile.in
+++ b/hl/src/Makefile.in
@@ -114,8 +114,8 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libhdf5_hl_la_DEPENDENCIES = $(LIBHDF5)
-am_libhdf5_hl_la_OBJECTS = H5DS.lo H5IM.lo H5LT.lo H5LTanalyze.lo \
- H5LTparse.lo H5PT.lo H5TB.lo H5LD.lo
+am_libhdf5_hl_la_OBJECTS = H5DO.lo H5DS.lo H5IM.lo H5LT.lo \
+ H5LTanalyze.lo H5LTparse.lo H5PT.lo H5TB.lo H5LD.lo
libhdf5_hl_la_OBJECTS = $(am_libhdf5_hl_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -259,6 +259,7 @@ H5_VERSION = @H5_VERSION@
HADDR_T = @HADDR_T@
HAVE_DMALLOC = @HAVE_DMALLOC@
HAVE_FORTRAN_2003 = @HAVE_FORTRAN_2003@
+HAVE_PTHREAD = @HAVE_PTHREAD@
HDF5_HL = @HDF5_HL@
HDF5_INTERFACES = @HDF5_INTERFACES@
HDF_CXX = @HDF_CXX@
@@ -310,7 +311,6 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PARALLEL = @PARALLEL@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
-PTHREAD = @PTHREAD@
RANLIB = @RANLIB@
ROOT = @ROOT@
RUNPARALLEL = @RUNPARALLEL@
@@ -457,7 +457,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.
LT_VERS_INTERFACE = 6
-LT_VERS_REVISION = 127
+LT_VERS_REVISION = 138
LT_VERS_AGE = 0
# This library is our main target.
@@ -467,13 +467,13 @@ lib_LTLIBRARIES = libhdf5_hl.la
libhdf5_hl_la_LDFLAGS = -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS)
# List sources to include in the HDF5 HL Library.
-libhdf5_hl_la_SOURCES = H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c H5LD.c
+libhdf5_hl_la_SOURCES = H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c H5LD.c
# HDF5 HL library depends on HDF5 Library.
libhdf5_hl_la_LIBADD = $(LIBHDF5)
# Public header files (to be installed)
-include_HEADERS = hdf5_hl.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LDpublic.h
+include_HEADERS = hdf5_hl.h H5DOpublic.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LDpublic.h
# Automake needs to be taught how to build lib, progs, and tests targets.
# These will be filled in automatically for the most part (e.g.,
@@ -572,6 +572,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5DO.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5DS.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5IM.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5LD.Plo@am__quote@
diff --git a/hl/src/hdf5_hl.h b/hl/src/hdf5_hl.h
index 3b3a2a0..6693b14 100644
--- a/hl/src/hdf5_hl.h
+++ b/hl/src/hdf5_hl.h
@@ -22,6 +22,7 @@
#ifndef _HDF5_HL_H
#define _HDF5_HL_H
+#include "H5DOpublic.h" /* dataset optimization */
#include "H5DSpublic.h" /* dimension scales */
#include "H5LTpublic.h" /* lite */
#include "H5IMpublic.h" /* image */