summaryrefslogtreecommitdiffstats
path: root/src/H5VLnative_blob.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-10-01 14:04:36 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-10-01 14:04:36 (GMT)
commitf1ba03cea5b82699a984c80bd2deac14fdc8df18 (patch)
treeebe777c3e0b83f4c4cec9212731da9ebe0a0cfd3 /src/H5VLnative_blob.c
parent10343c197906415388f2a4c8d292e21d25cf7381 (diff)
downloadhdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.zip
hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.gz
hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.bz2
Source formatted
Diffstat (limited to 'src/H5VLnative_blob.c')
-rw-r--r--src/H5VLnative_blob.c171
1 files changed, 77 insertions, 94 deletions
diff --git a/src/H5VLnative_blob.c b/src/H5VLnative_blob.c
index 8e34859..aaac2b3 100644
--- a/src/H5VLnative_blob.c
+++ b/src/H5VLnative_blob.c
@@ -20,41 +20,33 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
-#include "H5HGprivate.h" /* Global Heaps */
+#include "H5HGprivate.h" /* Global Heaps */
#include "H5VLnative_private.h" /* Native VOL connector */
-
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Local Prototypes */
/********************/
-
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
-
-
/*-------------------------------------------------------------------------
* Function: H5VL__native_blob_put
*
@@ -68,13 +60,12 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id,
- void H5_ATTR_UNUSED *ctx)
+H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void H5_ATTR_UNUSED *ctx)
{
- H5F_t *f = (H5F_t *)obj; /* Retrieve file pointer */
- uint8_t *id = (uint8_t *)blob_id; /* Pointer to blob ID */
- H5HG_t hobjid; /* New VL sequence's heap ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t * f = (H5F_t *)obj; /* Retrieve file pointer */
+ uint8_t *id = (uint8_t *)blob_id; /* Pointer to blob ID */
+ H5HG_t hobjid; /* New VL sequence's heap ID */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -84,7 +75,7 @@ H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id,
HDassert(id);
/* Write the VL information to disk (allocates space also) */
- if(H5HG_insert(f, size, buf, &hobjid) < 0)
+ if (H5HG_insert(f, size, buf, &hobjid) < 0)
HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write blob information")
/* Encode the heap information */
@@ -95,7 +86,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__native_blob_put() */
-
/*-------------------------------------------------------------------------
* Function: H5VL__native_blob_get
*
@@ -109,14 +99,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size,
- void H5_ATTR_UNUSED *ctx)
+H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void H5_ATTR_UNUSED *ctx)
{
- H5F_t *f = (H5F_t *)obj; /* Retrieve file pointer */
+ H5F_t * f = (H5F_t *)obj; /* Retrieve file pointer */
const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the disk blob ID */
- H5HG_t hobjid; /* Global heap ID for sequence */
- size_t hobj_size; /* Global heap object size returned from H5HG_read() */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5HG_t hobjid; /* Global heap ID for sequence */
+ size_t hobj_size; /* Global heap object size returned from H5HG_read() */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -130,20 +119,19 @@ H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size,
UINT32DECODE(id, hobjid.idx);
/* Check if this sequence actually has any data */
- if(hobjid.addr > 0)
+ if (hobjid.addr > 0)
/* Read the VL information from disk */
- if(NULL == H5HG_read(f, &hobjid, buf, &hobj_size))
+ if (NULL == H5HG_read(f, &hobjid, buf, &hobj_size))
HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read VL information")
/* Verify the size is correct */
- if(hobj_size != size)
+ if (hobj_size != size)
HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "Expected global heap object size does not match")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL__native_blob_get() */
-
/*-------------------------------------------------------------------------
* Function: H5VL__native_blob_specific
*
@@ -157,11 +145,10 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_blob_specific(void *obj, void *blob_id,
- H5VL_blob_specific_t specific_type, va_list arguments)
+H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments)
{
- H5F_t *f = (H5F_t *)obj; /* Retrieve file pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *f = (H5F_t *)obj; /* Retrieve file pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -169,69 +156,65 @@ H5VL__native_blob_specific(void *obj, void *blob_id,
HDassert(f);
HDassert(blob_id);
- switch(specific_type) {
- case H5VL_BLOB_GETSIZE:
- {
- const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
- size_t *size = HDva_arg(arguments, size_t *);
- H5HG_t hobjid; /* blob's heap ID */
-
- /* Get heap information */
- H5F_addr_decode(f, &id, &(hobjid.addr));
- UINT32DECODE(id, hobjid.idx);
-
- /* Get heap object's size */
- if(hobjid.addr > 0) {
- if(H5HG_get_obj_size(f, &hobjid, size) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
- } /* end if */
- else
- *size = 0; /* Return '0' size for 'nil' blob ID */
-
- break;
- }
-
- case H5VL_BLOB_ISNULL:
- {
- const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
- hbool_t *isnull = HDva_arg(arguments, hbool_t *);
- haddr_t addr; /* Sequence's heap address */
-
- /* Get the heap address */
- H5F_addr_decode(f, &id, &addr);
-
- /* Check if heap address is 'nil' */
- *isnull = (addr == 0 ? TRUE : FALSE);
-
- break;
- }
-
- case H5VL_BLOB_SETNULL:
- {
- uint8_t *id = (uint8_t *)blob_id; /* Pointer to the blob ID */
- /* Encode the "nil" heap pointer information */
- H5F_addr_encode(f, &id, (haddr_t)0);
- UINT32ENCODE(id, 0);
-
- break;
- }
-
- case H5VL_BLOB_DELETE:
- {
- const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
- H5HG_t hobjid; /* VL sequence's heap ID */
-
- /* Get heap information */
- H5F_addr_decode(f, &id, &hobjid.addr);
- UINT32DECODE(id, hobjid.idx);
-
- /* Free heap object */
- if(hobjid.addr > 0)
- if(H5HG_remove(f, &hobjid) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
-
- break;
- }
+ switch (specific_type) {
+ case H5VL_BLOB_GETSIZE: {
+ const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
+ size_t * size = HDva_arg(arguments, size_t *);
+ H5HG_t hobjid; /* blob's heap ID */
+
+ /* Get heap information */
+ H5F_addr_decode(f, &id, &(hobjid.addr));
+ UINT32DECODE(id, hobjid.idx);
+
+ /* Get heap object's size */
+ if (hobjid.addr > 0) {
+ if (H5HG_get_obj_size(f, &hobjid, size) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
+ } /* end if */
+ else
+ *size = 0; /* Return '0' size for 'nil' blob ID */
+
+ break;
+ }
+
+ case H5VL_BLOB_ISNULL: {
+ const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
+ hbool_t * isnull = HDva_arg(arguments, hbool_t *);
+ haddr_t addr; /* Sequence's heap address */
+
+ /* Get the heap address */
+ H5F_addr_decode(f, &id, &addr);
+
+ /* Check if heap address is 'nil' */
+ *isnull = (addr == 0 ? TRUE : FALSE);
+
+ break;
+ }
+
+ case H5VL_BLOB_SETNULL: {
+ uint8_t *id = (uint8_t *)blob_id; /* Pointer to the blob ID */
+ /* Encode the "nil" heap pointer information */
+ H5F_addr_encode(f, &id, (haddr_t)0);
+ UINT32ENCODE(id, 0);
+
+ break;
+ }
+
+ case H5VL_BLOB_DELETE: {
+ const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
+ H5HG_t hobjid; /* VL sequence's heap ID */
+
+ /* Get heap information */
+ H5F_addr_decode(f, &id, &hobjid.addr);
+ UINT32DECODE(id, hobjid.idx);
+
+ /* Free heap object */
+ if (hobjid.addr > 0)
+ if (H5HG_remove(f, &hobjid) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
+
+ break;
+ }
default:
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")