diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2014-03-12 17:22:29 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2014-03-12 17:22:29 (GMT) |
commit | e2c3ecd82527f17b08a2b2b5b11404fecfb3645e (patch) | |
tree | a1a76b0f600d7b1267a03de15fc30915d262ab45 /hl/src | |
parent | a8a8652ebd5de474abc1b4afd4f7ea0834636ec7 (diff) | |
download | hdf5-e2c3ecd82527f17b08a2b2b5b11404fecfb3645e.zip hdf5-e2c3ecd82527f17b08a2b2b5b11404fecfb3645e.tar.gz hdf5-e2c3ecd82527f17b08a2b2b5b11404fecfb3645e.tar.bz2 |
[svn-r24785] Description:
Bring r24769 & r24772 from trunk to 1.8 branch:
Check in Mohamad's changes to support collective I/O on point selections,
along with some other minor cleanups.
Correct some dynamically sized arrays that fail on Windows.
Tested on:
Mac OSX/64 10.9.2 (amazon) w/parallel
(And has been through the daily test regime on the trunk)
Diffstat (limited to 'hl/src')
-rw-r--r-- | hl/src/H5DO.c | 122 | ||||
-rw-r--r-- | hl/src/H5DOprivate.h | 37 |
2 files changed, 42 insertions, 117 deletions
diff --git a/hl/src/H5DO.c b/hl/src/H5DO.c index 9cfd8c1..99dbd93 100644 --- a/hl/src/H5DO.c +++ b/hl/src/H5DO.c @@ -18,8 +18,14 @@ #include <assert.h> #include <stdio.h> -#include "H5DOprivate.h" +/* High-level library internal header file */ +#include "H5HLprivate2.h" +/* public LT prototypes */ +#include "H5DOpublic.h" + + + /*------------------------------------------------------------------------- * Function: H5DOwrite_chunk * @@ -30,108 +36,64 @@ * 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 */ + hbool_t created_dxpl = FALSE; /* Whether we created a DXPL */ + hbool_t do_direct_write = TRUE; /* Flag for direct writes */ + uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */ + herr_t ret_value = FAIL; /* Return value */ - if(dset_id < 0) { - ret_value = FAIL; + /* Check arguments */ + if(dset_id < 0) goto done; - } - - if(!buf) { - ret_value = FAIL; + if(!buf) goto done; - } - - if(!offset) { - ret_value = FAIL; + if(!offset) goto done; - } - - if(!data_size) { - ret_value = FAIL; + if(!data_size) + goto done; + data_size_32 = (uint32_t)data_size; + if(data_size != (size_t)data_size_32) goto done; - } + /* If the user passed in a default DXPL, create one to pass to H5Dwrite() */ if(H5P_DEFAULT == dxpl_id) { - if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) { - ret_value = FAIL; + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) goto done; - } - created_dxpl = TRUE; - } + } /* end if */ - if(H5DO_write_chunk(dset_id, dxpl_id, filters, offset, data_size, buf) < 0) { - ret_value = FAIL; + /* Set direct write parameters */ + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) 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; + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &filters) < 0) goto done; - } - - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME, &filters) < 0) { - ret_value = FAIL; + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &offset) < 0) goto done; - } - - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_NAME, &offset) < 0) { - ret_value = FAIL; + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &data_size_32) < 0) goto done; - } - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_NAME, &data_size) < 0) { - ret_value = FAIL; + /* Write chunk */ + if(H5Dwrite(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) goto done; - } - if(H5Dwrite(dset_id, 0, H5S_ALL, H5S_ALL, dxpl_id, buf) < 0) { - ret_value = FAIL; - goto done; - } + /* Indicate success */ + ret_value = SUCCEED; done: - do_direct_write = FALSE; - if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) - ret_value = FAIL; + if(created_dxpl) { + if(H5Pclose(dxpl_id) < 0) + ret_value = FAIL; + } /* end if */ + else + /* Reset the direct write flag on user DXPL */ + if(H5Pset(dxpl_id, H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME, &do_direct_write) < 0) + ret_value = FAIL; + + return(ret_value); +} /* end H5DOwrite_chunk() */ - return ret_value; -} diff --git a/hl/src/H5DOprivate.h b/hl/src/H5DOprivate.h deleted file mode 100644 index fcea585..0000000 --- a/hl/src/H5DOprivate.h +++ /dev/null @@ -1,37 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * 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 |