summaryrefslogtreecommitdiffstats
path: root/src/H5Dnone.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Dnone.c')
-rw-r--r--src/H5Dnone.c158
1 files changed, 69 insertions, 89 deletions
diff --git a/src/H5Dnone.c b/src/H5Dnone.c
index 4622c84..82fbffb 100644
--- a/src/H5Dnone.c
+++ b/src/H5Dnone.c
@@ -28,51 +28,43 @@
/* Module Setup */
/****************/
-#include "H5Dmodule.h" /* This source code file is part of the H5D module */
-
+#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Dpkg.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5MFprivate.h" /* File space management */
-#include "H5VMprivate.h" /* Vector functions */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Dpkg.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MFprivate.h" /* File space management */
+#include "H5VMprivate.h" /* Vector functions */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
/* Non Index chunking I/O ops */
-static herr_t H5D__none_idx_create(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__none_idx_create(const H5D_chk_idx_info_t *idx_info);
static hbool_t H5D__none_idx_is_space_alloc(const H5O_storage_chunk_t *storage);
-static herr_t H5D__none_idx_get_addr(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_ud_t *udata);
-static int H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata);
-static herr_t H5D__none_idx_remove(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_common_ud_t *udata);
-static herr_t H5D__none_idx_delete(const H5D_chk_idx_info_t *idx_info);
-static herr_t H5D__none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst);
-static herr_t H5D__none_idx_size(const H5D_chk_idx_info_t *idx_info,
- hsize_t *size);
-static herr_t H5D__none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
-static herr_t H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
-
+static herr_t H5D__none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata);
+static int H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb,
+ void *chunk_udata);
+static herr_t H5D__none_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata);
+static herr_t H5D__none_idx_delete(const H5D_chk_idx_info_t *idx_info);
+static herr_t H5D__none_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src,
+ const H5D_chk_idx_info_t *idx_info_dst);
+static herr_t H5D__none_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size);
+static herr_t H5D__none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
+static herr_t H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream);
/*********************/
/* Package Variables */
@@ -80,36 +72,32 @@ static herr_t H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *strea
/* Non Index chunk I/O ops */
const H5D_chunk_ops_t H5D_COPS_NONE[1] = {{
- FALSE, /* Non-indexed chunking don't current support SWMR access */
- NULL, /* init */
- H5D__none_idx_create, /* create */
- H5D__none_idx_is_space_alloc, /* is_space_alloc */
- NULL, /* insert */
- H5D__none_idx_get_addr, /* get_addr */
- NULL, /* resize */
- H5D__none_idx_iterate, /* iterate */
- H5D__none_idx_remove, /* remove */
- H5D__none_idx_delete, /* delete */
- H5D__none_idx_copy_setup, /* copy_setup */
- NULL, /* copy_shutdown */
- H5D__none_idx_size, /* size */
- H5D__none_idx_reset, /* reset */
- H5D__none_idx_dump, /* dump */
- NULL /* dest */
+ FALSE, /* Non-indexed chunking don't current support SWMR access */
+ NULL, /* init */
+ H5D__none_idx_create, /* create */
+ H5D__none_idx_is_space_alloc, /* is_space_alloc */
+ NULL, /* insert */
+ H5D__none_idx_get_addr, /* get_addr */
+ NULL, /* resize */
+ H5D__none_idx_iterate, /* iterate */
+ H5D__none_idx_remove, /* remove */
+ H5D__none_idx_delete, /* delete */
+ H5D__none_idx_copy_setup, /* copy_setup */
+ NULL, /* copy_shutdown */
+ H5D__none_idx_size, /* size */
+ H5D__none_idx_reset, /* reset */
+ H5D__none_idx_dump, /* dump */
+ NULL /* dest */
}};
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_create
*
@@ -125,9 +113,9 @@ const H5D_chunk_ops_t H5D_COPS_NONE[1] = {{
static herr_t
H5D__none_idx_create(const H5D_chk_idx_info_t *idx_info)
{
- hsize_t nbytes; /* Total size of dataset chunks */
- haddr_t addr; /* The address of dataset chunks */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t nbytes; /* Total size of dataset chunks */
+ haddr_t addr; /* The address of dataset chunks */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -139,15 +127,15 @@ H5D__none_idx_create(const H5D_chk_idx_info_t *idx_info)
HDassert(idx_info->layout);
HDassert(idx_info->storage);
HDassert(idx_info->layout->max_nchunks);
- HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); /* address of data shouldn't be defined */
+ HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); /* address of data shouldn't be defined */
/* Calculate size of max dataset chunks */
nbytes = idx_info->layout->max_nchunks * idx_info->layout->size;
/* Allocate space for max dataset chunks */
addr = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, nbytes);
- if(!H5F_addr_defined(addr))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed")
+ if (!H5F_addr_defined(addr))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed")
/* This is the address of the dataset chunks */
idx_info->storage->idx_addr = addr;
@@ -156,7 +144,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__none_idx_create() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_is_space_alloc
*
@@ -179,7 +166,6 @@ H5D__none_idx_is_space_alloc(const H5O_storage_chunk_t *storage)
FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr))
} /* end H5D__none_idx_is_space_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_get_addr
*
@@ -208,19 +194,19 @@ H5D__none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
HDassert(H5F_addr_defined(idx_info->storage->idx_addr));
/* Calculate the index of this chunk */
- udata->chunk_idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks, udata->common.scaled);
+ udata->chunk_idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks,
+ udata->common.scaled);
/* Calculate the address of the chunk */
udata->chunk_block.offset = idx_info->storage->idx_addr + udata->chunk_idx * idx_info->layout->size;
/* Update the other (constant) information for the chunk */
udata->chunk_block.length = idx_info->layout->size;
- udata->filter_mask = 0;
+ udata->filter_mask = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__none_idx_get_addr() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_iterate
*
@@ -234,15 +220,14 @@ H5D__none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata
*-------------------------------------------------------------------------
*/
static int
-H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
- H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
+H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chunk_cb, void *chunk_udata)
{
- H5D_chunk_rec_t chunk_rec; /* generic chunk record */
- unsigned ndims; /* Rank of chunk */
- unsigned u; /* Local index variable */
- int curr_dim; /* Current rank */
- hsize_t idx; /* Array index of chunk */
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5D_chunk_rec_t chunk_rec; /* generic chunk record */
+ unsigned ndims; /* Rank of chunk */
+ unsigned u; /* Local index variable */
+ int curr_dim; /* Current rank */
+ hsize_t idx; /* Array index of chunk */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -259,14 +244,14 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
/* Initialize generic chunk record */
HDmemset(&chunk_rec, 0, sizeof(chunk_rec));
- chunk_rec.nbytes = idx_info->layout->size;
+ chunk_rec.nbytes = idx_info->layout->size;
chunk_rec.filter_mask = 0;
ndims = idx_info->layout->ndims - 1;
HDassert(ndims > 0);
/* Iterate over all the chunks in the dataset's dataspace */
- for(u = 0; u < idx_info->layout->nchunks && ret_value == H5_ITER_CONT; u++) {
+ for (u = 0; u < idx_info->layout->nchunks && ret_value == H5_ITER_CONT; u++) {
/* Calculate the index of this chunk */
idx = H5VM_array_offset_pre(ndims, idx_info->layout->max_down_chunks, chunk_rec.scaled);
@@ -274,17 +259,18 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
chunk_rec.chunk_addr = idx_info->storage->idx_addr + idx * idx_info->layout->size;
/* Make "generic chunk" callback */
- if((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, H5_ITER_ERROR, "failure in generic chunk iterator callback")
+ if ((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, H5_ITER_ERROR,
+ "failure in generic chunk iterator callback")
/* Update coordinates of chunk in dataset */
curr_dim = (int)(ndims - 1);
- while(curr_dim >= 0) {
+ while (curr_dim >= 0) {
/* Increment coordinate in current dimension */
chunk_rec.scaled[curr_dim]++;
/* Check if we went off the end of the current dimension */
- if(chunk_rec.scaled[curr_dim] >= idx_info->layout->chunks[curr_dim]) {
+ if (chunk_rec.scaled[curr_dim] >= idx_info->layout->chunks[curr_dim]) {
/* Reset coordinate & move to next faster dimension */
chunk_rec.scaled[curr_dim] = 0;
curr_dim--;
@@ -292,13 +278,12 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
else
break;
} /* end while */
- } /* end for */
+ } /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__none_idx_iterate() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_remove
*
@@ -315,7 +300,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5D__none_idx_remove(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, H5D_chunk_common_ud_t H5_ATTR_UNUSED *udata)
+H5D__none_idx_remove(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info,
+ H5D_chunk_common_ud_t H5_ATTR_UNUSED *udata)
{
FUNC_ENTER_STATIC_NOERR
@@ -324,7 +310,6 @@ H5D__none_idx_remove(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, H5D_chun
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5D__none_idx_remove() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_delete
*
@@ -340,8 +325,8 @@ H5D__none_idx_remove(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, H5D_chun
static herr_t
H5D__none_idx_delete(const H5D_chk_idx_info_t *idx_info)
{
- hsize_t nbytes; /* Size of all chunks */
- herr_t ret_value = SUCCEED; /* Return value */
+ hsize_t nbytes; /* Size of all chunks */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -352,11 +337,11 @@ H5D__none_idx_delete(const H5D_chk_idx_info_t *idx_info)
HDassert(!idx_info->pline->nused); /* Shouldn't have filter defined on entering here */
HDassert(idx_info->layout);
HDassert(idx_info->storage);
- HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); /* should be defined */
+ HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); /* should be defined */
/* chunk size * max # of chunks */
nbytes = idx_info->layout->max_nchunks * idx_info->layout->size;
- if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->storage->idx_addr, nbytes) < 0)
+ if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->storage->idx_addr, nbytes) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free dataset chunks")
idx_info->storage->idx_addr = HADDR_UNDEF;
@@ -365,7 +350,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__none_idx_delete() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_copy_setup
*
@@ -379,9 +363,9 @@ done:
*/
static herr_t
H5D__none_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_info_src,
- const H5D_chk_idx_info_t *idx_info_dst)
+ const H5D_chk_idx_info_t * idx_info_dst)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -405,7 +389,7 @@ H5D__none_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_inf
H5_BEGIN_TAG(H5AC__COPIED_TAG);
/* Allocate dataset chunks in the dest. file */
- if(H5D__none_idx_create(idx_info_dst) < 0)
+ if (H5D__none_idx_create(idx_info_dst) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage")
/* Reset metadata tag */
@@ -415,7 +399,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__none_idx_copy_setup() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_size
*
@@ -441,7 +424,6 @@ H5D__none_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t *i
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__none_idx_size() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_reset
*
@@ -462,13 +444,12 @@ H5D__none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr)
HDassert(storage);
/* Reset index info */
- if(reset_addr)
- storage->idx_addr = HADDR_UNDEF;
+ if (reset_addr)
+ storage->idx_addr = HADDR_UNDEF;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__none_idx_reset() */
-
/*-------------------------------------------------------------------------
* Function: H5D__none_idx_dump
*
@@ -493,4 +474,3 @@ H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__none_idx_dump() */
-