diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
commit | b2d661b508a7fc7a2592c13bc6bdc175551f075d (patch) | |
tree | 13baeb0d83a7c2a4c6299993c182b1227c2f6114 /src/H5Ocache_image.c | |
parent | 29ab58b58dce556639ea3154e262895773a8a8df (diff) | |
download | hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2 |
Clang-format of source files
Diffstat (limited to 'src/H5Ocache_image.c')
-rw-r--r-- | src/H5Ocache_image.c | 147 |
1 files changed, 65 insertions, 82 deletions
diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c index f1882ee..e6ba2bf 100644 --- a/src/H5Ocache_image.c +++ b/src/H5Ocache_image.c @@ -26,62 +26,56 @@ *------------------------------------------------------------------------- */ -#include "H5Omodule.h" /* This source code file is part of the H5O module */ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#include "H5Omodule.h" /* This source code file is part of the H5O module */ +#define H5F_FRIEND /*suppress error about including H5Fpkg */ - -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* Files */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Opkg.h" /* Object headers */ -#include "H5MFprivate.h" /* File space management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Opkg.h" /* Object headers */ +#include "H5MFprivate.h" /* File space management */ /* Callbacks for message class */ -static void *H5O__mdci_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, - unsigned *ioflags, size_t p_size, const uint8_t *p); -static herr_t H5O__mdci_encode(H5F_t *f, hbool_t disable_shared, - uint8_t *p, const void *_mesg); -static void *H5O__mdci_copy(const void *_mesg, void *_dest); -static size_t H5O__mdci_size(const H5F_t *f, hbool_t disable_shared, - const void *_mesg); +static void *H5O__mdci_decode(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, size_t p_size, + const uint8_t *p); +static herr_t H5O__mdci_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg); +static void * H5O__mdci_copy(const void *_mesg, void *_dest); +static size_t H5O__mdci_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg); static herr_t H5O__mdci_free(void *mesg); static herr_t H5O__mdci_delete(H5F_t *f, H5O_t *open_oh, void *_mesg); -static herr_t H5O__mdci_debug(H5F_t *f, const void *_mesg, FILE *stream, - int indent, int fwidth); +static herr_t H5O__mdci_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth); /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_MDCI[1] = {{ - H5O_MDCI_MSG_ID, /* message id number */ - "mdci", /* message name for debugging */ - sizeof(H5O_mdci_t), /* native message size */ - 0, /* messages are sharable? */ - H5O__mdci_decode, /* decode message */ - H5O__mdci_encode, /* encode message */ - H5O__mdci_copy, /* copy method */ - H5O__mdci_size, /* size of mdc image message */ - NULL, /* reset method */ - H5O__mdci_free, /* free method */ - H5O__mdci_delete, /* file delete method */ - NULL, /* link method */ - NULL, /* set share method */ - NULL, /* can share method */ - NULL, /* pre copy native value to file */ - NULL, /* copy native value to file */ - NULL, /* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O__mdci_debug /* debugging */ + H5O_MDCI_MSG_ID, /* message id number */ + "mdci", /* message name for debugging */ + sizeof(H5O_mdci_t), /* native message size */ + 0, /* messages are sharable? */ + H5O__mdci_decode, /* decode message */ + H5O__mdci_encode, /* encode message */ + H5O__mdci_copy, /* copy method */ + H5O__mdci_size, /* size of mdc image message */ + NULL, /* reset method */ + H5O__mdci_free, /* free method */ + H5O__mdci_delete, /* file delete method */ + NULL, /* link method */ + NULL, /* set share method */ + NULL, /* can share method */ + NULL, /* pre copy native value to file */ + NULL, /* copy native value to file */ + NULL, /* post copy native value to file */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O__mdci_debug /* debugging */ }}; /* Only one version of the metadata cache image message at present */ -#define H5O_MDCI_VERSION_0 0 +#define H5O_MDCI_VERSION_0 0 /* Declare the free list for H5O_mdci_t's */ H5FL_DEFINE(H5O_mdci_t); - - /*------------------------------------------------------------------------- * Function: H5O__mdci_decode * @@ -97,12 +91,11 @@ H5FL_DEFINE(H5O_mdci_t); *------------------------------------------------------------------------- */ static void * -H5O__mdci_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, - unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, - size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__mdci_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, + unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) { - H5O_mdci_t *mesg; /* Native message */ - void *ret_value = NULL; /* Return value */ + H5O_mdci_t *mesg; /* Native message */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -111,12 +104,13 @@ H5O__mdci_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, HDassert(p); /* Version of message */ - if(*p++ != H5O_MDCI_VERSION_0) + if (*p++ != H5O_MDCI_VERSION_0) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message") /* Allocate space for message */ - if(NULL == (mesg = (H5O_mdci_t *)H5FL_MALLOC(H5O_mdci_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for metadata cache image message") + if (NULL == (mesg = (H5O_mdci_t *)H5FL_MALLOC(H5O_mdci_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + "memory allocation failed for metadata cache image message") /* Decode */ H5F_addr_decode(f, &p, &(mesg->addr)); @@ -129,7 +123,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__mdci_decode() */ - /*------------------------------------------------------------------------- * Function: H5O__mdci_encode * @@ -143,8 +136,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O__mdci_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, - uint8_t *p, const void *_mesg) +H5O__mdci_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg) { const H5O_mdci_t *mesg = (const H5O_mdci_t *)_mesg; @@ -163,7 +155,6 @@ H5O__mdci_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__mdci_encode() */ - /*------------------------------------------------------------------------- * Function: H5O__mdci_copy * @@ -181,15 +172,15 @@ H5O__mdci_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, static void * H5O__mdci_copy(const void *_mesg, void *_dest) { - const H5O_mdci_t *mesg = (const H5O_mdci_t *)_mesg; - H5O_mdci_t *dest = (H5O_mdci_t *) _dest; - void *ret_value = NULL; /* Return value */ + const H5O_mdci_t *mesg = (const H5O_mdci_t *)_mesg; + H5O_mdci_t * dest = (H5O_mdci_t *)_dest; + void * ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC /* check args */ HDassert(mesg); - if(!dest && NULL == (dest = H5FL_MALLOC(H5O_mdci_t))) + if (!dest && NULL == (dest = H5FL_MALLOC(H5O_mdci_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* copy */ @@ -202,7 +193,6 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_mdci__copy() */ - /*------------------------------------------------------------------------- * Function: H5O__mdci_size * @@ -220,24 +210,22 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O__mdci_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, - const void H5_ATTR_UNUSED *_mesg) +H5O__mdci_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void H5_ATTR_UNUSED *_mesg) { - size_t ret_value = 0; /* Return value */ + size_t ret_value = 0; /* Return value */ FUNC_ENTER_STATIC_NOERR /* Set return value */ - ret_value = (size_t)( 1 + /* Version number */ - H5F_SIZEOF_ADDR(f) + /* addr of metadata cache */ - /* image block */ - H5F_SIZEOF_SIZE(f) ); /* length of metadata cache */ - /* image block */ + ret_value = (size_t)(1 + /* Version number */ + H5F_SIZEOF_ADDR(f) + /* addr of metadata cache */ + /* image block */ + H5F_SIZEOF_SIZE(f)); /* length of metadata cache */ + /* image block */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__mdci_size() */ - /*------------------------------------------------------------------------- * Function: H5O__mdci_free * @@ -262,7 +250,6 @@ H5O__mdci_free(void *mesg) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__mdci_free() */ - /*------------------------------------------------------------------------- * Function: H5O__mdci_delete * @@ -279,8 +266,8 @@ static herr_t H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) { H5O_mdci_t *mesg = (H5O_mdci_t *)_mesg; - haddr_t final_eoa; /* For sanity check */ - herr_t ret_value = SUCCEED; /* Return value */ + haddr_t final_eoa; /* For sanity check */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -289,32 +276,30 @@ H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) HDassert(mesg); /* Free file space for cache image */ - if(H5F_addr_defined(mesg->addr)) { + if (H5F_addr_defined(mesg->addr)) { /* The space for the cache image block was allocated directly * from the VFD layer at the end of file. As this was the * last file space allocation before shutdown, the cache image * should still be the last item in the file. */ - if(f->shared->closing) { + if (f->shared->closing) { /* Get the eoa, and verify that it has the expected value */ - if(HADDR_UNDEF == (final_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT)) ) + if (HADDR_UNDEF == (final_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get file size") HDassert(H5F_addr_eq(final_eoa, mesg->addr + mesg->size)); - if(H5FD_free(f->shared->lf, H5FD_MEM_SUPER, f, mesg->addr, mesg->size) < 0) + if (H5FD_free(f->shared->lf, H5FD_MEM_SUPER, f, mesg->addr, mesg->size) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't free MDC image") } - else - if(H5MF_xfree(f, H5FD_MEM_SUPER, mesg->addr, mesg->size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free file space for cache image block") + else if (H5MF_xfree(f, H5FD_MEM_SUPER, mesg->addr, mesg->size) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free file space for cache image block") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__mdci_delete() */ - /*------------------------------------------------------------------------- * Function: H5O__mdci_debug * @@ -328,10 +313,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O__mdci_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, - int indent, int fwidth) +H5O__mdci_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int indent, int fwidth) { - const H5O_mdci_t *mdci = (const H5O_mdci_t *) _mesg; + const H5O_mdci_t *mdci = (const H5O_mdci_t *)_mesg; FUNC_ENTER_STATIC_NOERR @@ -350,4 +334,3 @@ H5O__mdci_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__mdci_debug() */ - |