summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-10-21 15:52:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-10-21 15:52:54 (GMT)
commit275d19661e1f06f95c57e5f81635bb0e5e2c357a (patch)
treeeb393a99ea9d67984c9191597b584c1001ca0515 /src/H5D.c
parent155d762b9c4d60e0455f3bc71700a289ad18e6a4 (diff)
downloadhdf5-275d19661e1f06f95c57e5f81635bb0e5e2c357a.zip
hdf5-275d19661e1f06f95c57e5f81635bb0e5e2c357a.tar.gz
hdf5-275d19661e1f06f95c57e5f81635bb0e5e2c357a.tar.bz2
[svn-r11593] Purpose:
Code cleanup Description: Clean up & standardize a bit in preparation for coding standards discussion. Platforms tested: FreeBSD 4.11 (sleipnir) Too minor to require h5committest
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c285
1 files changed, 42 insertions, 243 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 4f7ea5d..49df75e0 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -12,12 +12,19 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/****************/
+/* Module Setup */
+/****************/
+
#define H5D_PACKAGE /*suppress error about including H5Dpkg */
/* Interface initialization */
#define H5_INTERFACE_INIT_FUNC H5D_init_interface
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Dpkg.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
@@ -29,9 +36,30 @@
#include "H5Sprivate.h" /* Dataspaces */
#include "H5Vprivate.h" /* Vectors and arrays */
-/*#define H5D_DEBUG*/
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Internal data structure for computing variable-length dataset's total size */
+typedef struct {
+ hid_t dataset_id; /* ID of the dataset we are working on */
+ hid_t fspace_id; /* ID of the file dataset's dataspace we are working on */
+ hid_t mspace_id; /* ID of the memory dataset's dataspace we are working on */
+ void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */
+ void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */
+ hid_t xfer_pid; /* ID of the dataset xfer property list */
+ hsize_t size; /* Accumulated number of bytes for the selection */
+} H5D_vlen_bufsize_t;
+
+/********************/
+/* Local Prototypes */
+/********************/
-/* Local functions */
+/* General stuff */
static herr_t H5D_init_storage(H5D_t *dataset, hbool_t full_overwrite, hid_t dxpl_id);
static H5D_shared_t * H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type);
static H5D_t * H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id,
@@ -43,6 +71,8 @@ static haddr_t H5D_get_offset(const H5D_t *dset);
static herr_t H5D_extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id);
static herr_t H5D_set_extent(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id);
static herr_t H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type);
+
+/* Property list callbacks */
static int H5D_crt_fill_value_cmp(const void *value1, const void *value2, size_t size);
static int H5D_crt_ext_file_list_cmp(const void *value1, const void *value2, size_t size);
static int H5D_crt_data_pipeline_cmp(const void *value1, const void *value2, size_t size);
@@ -50,16 +80,16 @@ static herr_t H5D_xfer_xform_del(hid_t prop_id, const char* name, size_t size, v
static herr_t H5D_xfer_xform_copy(const char* name, size_t size, void* value);
static herr_t H5D_xfer_xform_close(const char* name, size_t size, void* value);
-/* Internal data structure for computing variable-length dataset's total size */
-typedef struct {
- hid_t dataset_id; /* ID of the dataset we are working on */
- hid_t fspace_id; /* ID of the file dataset's dataspace we are working on */
- hid_t mspace_id; /* ID of the memory dataset's dataspace we are working on */
- void *fl_tbuf; /* Ptr to the temporary buffer we are using for fixed-length data */
- void *vl_tbuf; /* Ptr to the temporary buffer we are using for VL data */
- hid_t xfer_pid; /* ID of the dataset xfer property list */
- hsize_t size; /* Accumulated number of bytes for the selection */
-} H5D_vlen_bufsize_t;
+/*********************/
+/* Package Variables */
+/*********************/
+
+/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */
+H5D_dxpl_cache_t H5D_def_dxpl_cache;
+
+/*******************/
+/* Local Variables */
+/*******************/
/* Declare a free list to manage the H5D_t and H5D_shared_t structs */
H5FL_DEFINE_STATIC(H5D_t);
@@ -77,9 +107,6 @@ H5FL_BLK_EXTERN(sieve_buf);
/* Define a static "default" dataset structure to use to initialize new datasets */
static H5D_shared_t H5D_def_dset;
-/* Define a "default" dataset transfer property list cache structure to use for default DXPLs */
-H5D_dxpl_cache_t H5D_def_dxpl_cache;
-
/*-------------------------------------------------------------------------
* Function: H5D_init
@@ -93,8 +120,6 @@ H5D_dxpl_cache_t H5D_def_dxpl_cache;
* Programmer: Quincey Koziol
* Saturday, March 4, 2000
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -405,8 +430,6 @@ done:
* Programmer: Robb Matzke
* Friday, November 20, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -464,8 +487,6 @@ H5D_term_interface(void)
*
* Comments: Private function, calls private H5Z_xform_destroy
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -501,8 +522,6 @@ done:
*
* Comments: Public function, calls private H5Z_xform_copy_tree
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -535,8 +554,6 @@ done:
* Comments: private function, calls H5Z_xform_destroy_parse_tree
* Identical to H5D_xfer_xform_del
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -571,8 +588,6 @@ done:
* Programmer: Raymond Lu
* Tuesday, October 2, 2001
*
- * Modification:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -646,8 +661,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, July 11, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -702,8 +715,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, January 7, 2004
*
- * Modification:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -758,8 +769,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, January 7, 2004
*
- * Modification:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -840,8 +849,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, January 7, 2004
*
- * Modification:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -933,7 +940,6 @@ done:
* Thursday, August 2, 2001
*
* Notes: This same routine is currently used for the 'copy' callback.
- * Modifications:
*
*-------------------------------------------------------------------------
*/
@@ -984,8 +990,6 @@ done:
* Programmer: Raymond Lu
* Tuesday, October 2, 2001
*
- * Modification:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -1038,8 +1042,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, July 11, 2001
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -1147,20 +1149,9 @@ done:
*
* Failure: FAIL
*
- * Errors:
- * ARGS BADTYPE Not a data space.
- * ARGS BADTYPE Not a dataset creation plist.
- * ARGS BADTYPE Not a file.
- * ARGS BADTYPE Not a type.
- * ARGS BADVALUE No name.
- * DATASET CANTINIT Can't create dataset.
- * DATASET CANTREGISTER Can't register dataset.
- *
* Programmer: Robb Matzke
* Wednesday, December 3, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -1221,13 +1212,9 @@ done:
*
* Failure: FAIL
*
- * Errors:
- *
* Programmer: Robb Matzke
* Thursday, December 4, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -1290,15 +1277,9 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Errors:
- * ARGS BADTYPE Not a dataset.
- * DATASET CANTINIT Can't free.
- *
* Programmer: Robb Matzke
* Thursday, December 4, 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1342,10 +1323,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, January 28, 1998
*
- * Modifications:
- * Robb Matzke, 9 Jun 1998
- * The data space is not constant and is no longer cached by the dataset
- * struct.
*-------------------------------------------------------------------------
*/
hid_t
@@ -1394,8 +1371,6 @@ done:
*
* Programmer: Raymond Lu
*
- * Modification:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1432,8 +1407,6 @@ done:
*
* Programmer: Raymond Lu
*
- * Modification:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1500,13 +1473,6 @@ done:
* Programmer: Robb Matzke
* Tuesday, February 3, 1998
*
- * Modifications:
- *
- * Robb Matzke, 1 Jun 1998
- * If the dataset has a named data type then a handle to the opened data
- * type is returned. Otherwise the returned data type is read-only. If
- * atomization of the data type fails then the data type is closed.
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -1566,13 +1532,6 @@ done:
* Programmer: Robb Matzke
* Tuesday, February 3, 1998
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * The way to retrieve and set property is changed for the
- * generic property list.
- *
*-------------------------------------------------------------------------
*/
hid_t
@@ -1638,8 +1597,6 @@ done:
* Programmer: Robb Matzke
* Friday, January 30, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -1675,18 +1632,9 @@ done:
*
* Failure: NULL
*
- * Errors:
- *
* Programmer: Quincey Koziol
* Monday, October 12, 1998
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to query and inialization for generic
- * property list.
- *
*-------------------------------------------------------------------------
*/
static H5D_shared_t *
@@ -1748,13 +1696,9 @@ done:
* Return: Success: SUCCEED
* Failure: FAIL
*
- * Errors:
- *
* Programmer: Quincey Koziol
* Thursday, June 24, 2004
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1820,18 +1764,9 @@ done:
* Return: Success: SUCCEED
* Failure: FAIL
*
- * Errors:
- *
* Programmer: Bill Wendling
* Thursday, October 31, 2002
*
- * Modifications:
- *
- * John Mainzer 6/6/05
- * Modified function to use the new dirtied parameter of
- * H5AC_unprotect() instead of manipulating the is_dirty
- * field of the cache info directly.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -2066,54 +2001,9 @@ done:
*
* Failure: NULL
*
- * Errors:
- * DATASET CANTINIT Can't update dataset header.
- * DATASET CANTINIT Problem with the dataset name.
- * DATASET CANTINIT Fail in file space allocation for
- * chunks
- *
* Programmer: Robb Matzke
* Thursday, December 4, 1997
*
- * Modifications:
- * Robb Matzke, 9 Jun 1998
- * The data space message is no longer cached in the dataset struct.
- *
- * Robb Matzke, 27 Jul 1998
- * Added the MTIME message to the dataset object header.
- *
- * Robb Matzke, 1999-10-14
- * The names for the external file list are entered into the heap hear
- * instead of when the efl message is encoded, preventing a possible
- * infinite recursion situation.
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to retrieve and set property for generic property
- * list.
- *
- * Raymond Lu, 26 Feb 2002
- * A new fill value message is added. Two properties, space allocation
- * time and fill value writing time, govern space allocation and fill
- * value writing.
- *
- * Bill Wendling, 1. November 2002
- * Removed the cache updating mechanism. This was done so that it
- * can be called separately from the H5D_create function. There were
- * two of these mechanisms: one to create and insert into the parent
- * group the H5G_entry_t object and the other to update based upon
- * whether we're working with an external file or not. Between the
- * two, there is a conditional call to allocate space which isn't
- * part of updating the cache.
- *
- * Nat Furrer and James Laird
- * June 7, 2004
- * Added checked_filters flag
- *
- * Peter X. Cao
- * May 09, 2005
- * Add property to create intermediate groups
- *
*-------------------------------------------------------------------------
*/
static H5D_t *
@@ -2459,8 +2349,6 @@ done:
* Programmer: Robb Matzke
* Monday, November 2, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
htri_t
@@ -2503,13 +2391,9 @@ done:
* Return: Success: Dataset ID
* Failure: FAIL
*
- * Errors:
- *
* Programmer: Quincey Koziol
* Friday, December 20, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5D_t*
@@ -2591,24 +2475,9 @@ done:
*
* Return: Dataset pointer on success, NULL on failure
*
- * Errors:
- *
* Programmer: Quincey Koziol
* Monday, October 12, 1998
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to set property for generic property list.
- *
- * Raymond Lu
- * Feb 26, 2002
- * A new fill value message and two new properties are added.
- *
- * Pedro Vicente, <pvn@ncsa.uiuc.edu> 22 Aug 2002
- * Added a deep copy of the symbol table entry
- *
*-------------------------------------------------------------------------
*/
static H5D_t *
@@ -2870,17 +2739,9 @@ done:
*
* Return: Non-negative on success/Negative on failure
*
- * Errors:
- * DATASET CANTINIT Couldn't free the type or space,
- * but the dataset was freed anyway.
- *
* Programmer: Robb Matzke
* Thursday, December 4, 1997
*
- * Modifications:
- * Robb Matzke, 9 Jun 1998
- * The data space message is no longer cached in the dataset struct.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3014,19 +2875,6 @@ done:
* Programmer: Robb Matzke
* Friday, January 30, 1998
*
- * Modifications:
- *
- * Raymond Lu, October 2, 2001
- * Changed the way to retrieve property for generic property list.
- *
- * Nat Furrer/James Laird, June 17, 2004
- * Added check for filter encode capability.
- *
- * Christian Chilan, June 27, 2005
- * In addition to the case where allocation property is
- * H5D_ALLOC_TIME_EARLY, storage will be allocated when the
- * dataset is open by parallel mode.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -3114,8 +2962,6 @@ done:
* Programmer: Robb Matzke
* Friday, April 24, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5G_entry_t *
@@ -3141,8 +2987,6 @@ H5D_entof (H5D_t *dataset)
* Programmer: Robb Matzke
* Thursday, June 4, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5T_t *
@@ -3170,8 +3014,6 @@ H5D_typeof (const H5D_t *dset)
* Programmer: Quincey Koziol
* Thursday, October 22, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static H5F_t *
@@ -3197,16 +3039,6 @@ H5D_get_file (const H5D_t *dset)
* Programmer: Robb Matzke
* Friday, January 16, 1998
*
- * Modifications:
- * Quincey Koziol, August 22, 2002
- * Moved here from H5F_arr_create and moved more logic into
- * this function from places where it was being called.
- *
- * Christian Chilan, June 27, 2005
- * In addition to the case where allocation property is
- * H5D_ALLOC_TIME_EARLY, storage will be allocated when the
- * dataset is open by parallel mode.
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3356,13 +3188,6 @@ done:
* Programmer: Robb Matzke
* Monday, October 5, 1998
*
- * Modifications:
- *
- * Raymond Lu
- * Tuesday, October 2, 2001
- * Changed the way to retrieve property for generic property
- * list.
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -3443,8 +3268,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, April 21, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
hsize_t
@@ -3481,8 +3304,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, April 21, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hsize_t
@@ -3533,8 +3354,6 @@ done:
* Programmer: Raymond Lu
* November 6, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
haddr_t
@@ -3571,8 +3390,6 @@ done:
* Programmer: Raymond Lu
* November 6, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static haddr_t
@@ -3674,8 +3491,6 @@ done:
* Programmer: Quincey Koziol
* Friday, June 11, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3720,8 +3535,6 @@ done:
* Programmer: Quincey Koziol
* Thursday, June 10, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3771,8 +3584,6 @@ done:
* Programmer: Quincey Koziol
* Tuesday, August 17, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void *
@@ -3818,8 +3629,6 @@ done:
* Programmer: Quincey Koziol
* Tuesday, August 17, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -3878,8 +3687,6 @@ done:
* Programmer: Quincey Koziol
* Wednesday, August 11, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -3981,8 +3788,6 @@ done:
*
* Comments: Public function, calls private H5D_set_extent
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -4024,8 +3829,6 @@ done:
*
* Comments: Private function
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -4139,8 +3942,6 @@ done:
*
* Date: August 14, 2002
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
@@ -4233,8 +4034,6 @@ done:
* Programmer: Robb Matzke
* Wednesday, April 28, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t