summaryrefslogtreecommitdiffstats
path: root/src/H5MFsection.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2022-04-13 21:17:29 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2022-04-13 21:17:29 (GMT)
commitcabc39c3e197e2591449d2604bfee26465fb60e1 (patch)
treed5f39f5f5965584bf9bf49646a2af617adfd3e4e /src/H5MFsection.c
parent7355f4c505092a7a85474b47f18d5206028e2c95 (diff)
parentab69f5df770ee3cc6cd6c81d905a5317b894a002 (diff)
downloadhdf5-feature/coding_standards.zip
hdf5-feature/coding_standards.tar.gz
hdf5-feature/coding_standards.tar.bz2
Merge branch 'develop' into feature/coding_standardsfeature/coding_standards
Diffstat (limited to 'src/H5MFsection.c')
-rw-r--r--src/H5MFsection.c503
1 files changed, 240 insertions, 263 deletions
diff --git a/src/H5MFsection.c b/src/H5MFsection.c
index f661ef9..43586af 100644
--- a/src/H5MFsection.c
+++ b/src/H5MFsection.c
@@ -6,13 +6,13 @@
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
- * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Tuesday, January 8, 2008
*
* Purpose: Free space section callbacks for file.
@@ -23,162 +23,145 @@
/* Module Setup */
/****************/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
-#include "H5MFmodule.h" /* This source code file is part of the H5MF module */
-
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#include "H5MFmodule.h" /* This source code file is part of the H5MF module */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5MFpkg.h" /* File memory management */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5MFpkg.h" /* File memory management */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
/* 'simple/small/large' section callbacks */
-static H5FS_section_info_t *H5MF__sect_deserialize(const H5FS_section_class_t *cls,
- const uint8_t *buf, haddr_t sect_addr, hsize_t sect_size, unsigned *des_flags);
-static herr_t H5MF__sect_valid(const H5FS_section_class_t *cls,
- const H5FS_section_info_t *sect);
-static H5FS_section_info_t *H5MF__sect_split(H5FS_section_info_t *sect,
- hsize_t frag_size);
-
+static H5FS_section_info_t *H5MF__sect_deserialize(const H5FS_section_class_t *cls, const uint8_t *buf,
+ haddr_t sect_addr, hsize_t sect_size, unsigned *des_flags);
+static herr_t H5MF__sect_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *sect);
+static H5FS_section_info_t *H5MF__sect_split(H5FS_section_info_t *sect, hsize_t frag_size);
/* 'simple' section callbacks */
-static htri_t H5MF__sect_simple_can_merge(const H5FS_section_info_t *sect1,
- const H5FS_section_info_t *sect2, void *udata);
-static herr_t H5MF__sect_simple_merge(H5FS_section_info_t **sect1,
- H5FS_section_info_t *sect2, void *udata);
-static htri_t H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect,
- void *udata);
-static herr_t H5MF__sect_simple_shrink(H5FS_section_info_t **_sect,
- void *udata);
-
+static htri_t H5MF__sect_simple_can_merge(const H5FS_section_info_t *sect1, const H5FS_section_info_t *sect2,
+ void *udata);
+static herr_t H5MF__sect_simple_merge(H5FS_section_info_t **sect1, H5FS_section_info_t *sect2, void *udata);
+static htri_t H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *udata);
+static herr_t H5MF__sect_simple_shrink(H5FS_section_info_t **_sect, void *udata);
/* 'small' section callbacks */
static herr_t H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata);
-static htri_t H5MF__sect_small_can_merge(const H5FS_section_info_t *sect1,
- const H5FS_section_info_t *sect2, void *udata);
-static herr_t H5MF__sect_small_merge(H5FS_section_info_t **sect1,
- H5FS_section_info_t *sect2, void *udata);
+static htri_t H5MF__sect_small_can_merge(const H5FS_section_info_t *sect1, const H5FS_section_info_t *sect2,
+ void *udata);
+static herr_t H5MF__sect_small_merge(H5FS_section_info_t **sect1, H5FS_section_info_t *sect2, void *udata);
/* 'large' section callbacks */
-static htri_t H5MF__sect_large_can_merge(const H5FS_section_info_t *sect1,
- const H5FS_section_info_t *sect2, void *udata);
-static herr_t H5MF__sect_large_merge(H5FS_section_info_t **sect1,
- H5FS_section_info_t *sect2, void *udata);
-static htri_t H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect,
- void *udata);
-static herr_t H5MF__sect_large_shrink(H5FS_section_info_t **_sect,
- void *udata);
+static htri_t H5MF__sect_large_can_merge(const H5FS_section_info_t *sect1, const H5FS_section_info_t *sect2,
+ void *udata);
+static herr_t H5MF__sect_large_merge(H5FS_section_info_t **sect1, H5FS_section_info_t *sect2, void *udata);
+static htri_t H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect, void *udata);
+static herr_t H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *udata);
/*********************/
/* Package Variables */
/*********************/
/* Class info for "simple" free space sections */
-H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{
+const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{
/* Class variables */
- H5MF_FSPACE_SECT_SIMPLE, /* Section type */
- 0, /* Extra serialized size */
+ H5MF_FSPACE_SECT_SIMPLE, /* Section type */
+ 0, /* Extra serialized size */
H5FS_CLS_MERGE_SYM | H5FS_CLS_ADJUST_OK, /* Class flags */
- NULL, /* Class private info */
+ NULL, /* Class private info */
/* Class methods */
- NULL, /* Initialize section class */
- NULL, /* Terminate section class */
+ NULL, /* Initialize section class */
+ NULL, /* Terminate section class */
/* Object methods */
- NULL, /* Add section */
- NULL, /* Serialize section */
- H5MF__sect_deserialize, /* Deserialize section */
- H5MF__sect_simple_can_merge, /* Can sections merge? */
- H5MF__sect_simple_merge, /* Merge sections */
- H5MF__sect_simple_can_shrink, /* Can section shrink container?*/
- H5MF__sect_simple_shrink, /* Shrink container w/section */
- H5MF__sect_free, /* Free section */
- H5MF__sect_valid, /* Check validity of section */
- H5MF__sect_split, /* Split section node for alignment */
- NULL, /* Dump debugging for section */
+ NULL, /* Add section */
+ NULL, /* Serialize section */
+ H5MF__sect_deserialize, /* Deserialize section */
+ H5MF__sect_simple_can_merge, /* Can sections merge? */
+ H5MF__sect_simple_merge, /* Merge sections */
+ H5MF__sect_simple_can_shrink, /* Can section shrink container?*/
+ H5MF__sect_simple_shrink, /* Shrink container w/section */
+ H5MF__sect_free, /* Free section */
+ H5MF__sect_valid, /* Check validity of section */
+ H5MF__sect_split, /* Split section node for alignment */
+ NULL, /* Dump debugging for section */
}};
/* Class info for "small" free space sections */
-H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{
+const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{
/* Class variables */
- H5MF_FSPACE_SECT_SMALL, /* Section type */
- 0, /* Extra serialized size */
- H5FS_CLS_MERGE_SYM | H5FS_CLS_ADJUST_OK, /* Class flags */
- NULL, /* Class private info */
+ H5MF_FSPACE_SECT_SMALL, /* Section type */
+ 0, /* Extra serialized size */
+ H5FS_CLS_MERGE_SYM | H5FS_CLS_ADJUST_OK, /* Class flags */
+ NULL, /* Class private info */
/* Class methods */
- NULL, /* Initialize section class */
- NULL, /* Terminate section class */
+ NULL, /* Initialize section class */
+ NULL, /* Terminate section class */
/* Object methods */
- H5MF__sect_small_add, /* Add section */
+ H5MF__sect_small_add, /* Add section */
NULL, /* Serialize section */
- H5MF__sect_deserialize, /* Deserialize section */
- H5MF__sect_small_can_merge, /* Can sections merge? */
- H5MF__sect_small_merge, /* Merge sections */
- NULL, /* Can section shrink container?*/
- NULL, /* Shrink container w/section */
- H5MF__sect_free, /* Free section */
- H5MF__sect_valid, /* Check validity of section */
- H5MF__sect_split, /* Split section node for alignment */
+ H5MF__sect_deserialize, /* Deserialize section */
+ H5MF__sect_small_can_merge, /* Can sections merge? */
+ H5MF__sect_small_merge, /* Merge sections */
+ NULL, /* Can section shrink container?*/
+ NULL, /* Shrink container w/section */
+ H5MF__sect_free, /* Free section */
+ H5MF__sect_valid, /* Check validity of section */
+ H5MF__sect_split, /* Split section node for alignment */
NULL, /* Dump debugging for section */
}};
/* Class info for "large" free space sections */
-H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{
+const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{
/* Class variables */
- H5MF_FSPACE_SECT_LARGE, /* Section type */
- 0, /* Extra serialized size */
+ H5MF_FSPACE_SECT_LARGE, /* Section type */
+ 0, /* Extra serialized size */
H5FS_CLS_MERGE_SYM | H5FS_CLS_ADJUST_OK, /* Class flags */
- NULL, /* Class private info */
+ NULL, /* Class private info */
/* Class methods */
- NULL, /* Initialize section class */
- NULL, /* Terminate section class */
+ NULL, /* Initialize section class */
+ NULL, /* Terminate section class */
/* Object methods */
- NULL, /* Add section */
- NULL, /* Serialize section */
- H5MF__sect_deserialize, /* Deserialize section */
- H5MF__sect_large_can_merge, /* Can sections merge? */
- H5MF__sect_large_merge, /* Merge sections */
- H5MF__sect_large_can_shrink, /* Can section shrink container?*/
- H5MF__sect_large_shrink, /* Shrink container w/section */
- H5MF__sect_free, /* Free section */
- H5MF__sect_valid, /* Check validity of section */
- H5MF__sect_split, /* Split section node for alignment */
- NULL, /* Dump debugging for section */
+ NULL, /* Add section */
+ NULL, /* Serialize section */
+ H5MF__sect_deserialize, /* Deserialize section */
+ H5MF__sect_large_can_merge, /* Can sections merge? */
+ H5MF__sect_large_merge, /* Merge sections */
+ H5MF__sect_large_can_shrink, /* Can section shrink container?*/
+ H5MF__sect_large_shrink, /* Shrink container w/section */
+ H5MF__sect_free, /* Free section */
+ H5MF__sect_valid, /* Check validity of section */
+ H5MF__sect_split, /* Split section node for alignment */
+ NULL, /* Dump debugging for section */
}};
/*****************************/
/* Library Private Variables */
/*****************************/
-
/*******************/
/* Local Variables */
/*******************/
@@ -186,11 +169,10 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{
/* Declare a free list to manage the H5MF_free_section_t struct */
H5FL_DEFINE(H5MF_free_section_t);
-/*
+/*
* "simple/small/large" section callbacks
*/
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_new
*
@@ -199,7 +181,6 @@ H5FL_DEFINE(H5MF_free_section_t);
* Return: Pointer to new section on success/NULL on failure
*
* Programmer: Quincey Koziol
- * koziol@hdfgroup.org
* January 8 2008
*
*-------------------------------------------------------------------------
@@ -207,8 +188,8 @@ H5FL_DEFINE(H5MF_free_section_t);
H5MF_free_section_t *
H5MF__sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size)
{
- H5MF_free_section_t *sect; /* 'Simple' free space section to add */
- H5MF_free_section_t *ret_value = NULL; /* Return value */
+ H5MF_free_section_t *sect; /* 'Simple' free space section to add */
+ H5MF_free_section_t *ret_value = NULL; /* Return value */
FUNC_ENTER_PACKAGE
@@ -216,15 +197,16 @@ H5MF__sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size)
HDassert(sect_size);
/* Create free space section node */
- if(NULL == (sect = H5FL_MALLOC(H5MF_free_section_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for direct block free list section")
+ if (NULL == (sect = H5FL_MALLOC(H5MF_free_section_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
+ "memory allocation failed for direct block free list section")
/* Set the information passed in */
sect->sect_info.addr = sect_off;
sect->sect_info.size = sect_size;
/* Set the section's class & state */
- sect->sect_info.type = ctype;
+ sect->sect_info.type = ctype;
sect->sect_info.state = H5FS_SECT_LIVE;
/* Set return value */
@@ -234,7 +216,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF__sect_new() */
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_free
*
@@ -251,7 +232,7 @@ done:
herr_t
H5MF__sect_free(H5FS_section_info_t *_sect)
{
- H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; /* File free section */
+ H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; /* File free section */
FUNC_ENTER_PACKAGE_NOERR
@@ -262,9 +243,8 @@ H5MF__sect_free(H5FS_section_info_t *_sect)
sect = H5FL_FREE(H5MF_free_section_t, sect);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5MF__sect_free() */
+} /* H5MF__sect_free() */
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_deserialize
*
@@ -279,14 +259,13 @@ H5MF__sect_free(H5FS_section_info_t *_sect)
*-------------------------------------------------------------------------
*/
static H5FS_section_info_t *
-H5MF__sect_deserialize(const H5FS_section_class_t *cls,
- const uint8_t H5_ATTR_UNUSED *buf, haddr_t sect_addr,
- hsize_t sect_size, unsigned H5_ATTR_UNUSED *des_flags)
+H5MF__sect_deserialize(const H5FS_section_class_t *cls, const uint8_t H5_ATTR_UNUSED *buf, haddr_t sect_addr,
+ hsize_t sect_size, unsigned H5_ATTR_UNUSED *des_flags)
{
- H5MF_free_section_t *sect; /* New section */
- H5FS_section_info_t *ret_value = NULL; /* Return value */
+ H5MF_free_section_t *sect; /* New section */
+ H5FS_section_info_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
HDassert(cls);
@@ -294,7 +273,7 @@ H5MF__sect_deserialize(const H5FS_section_class_t *cls,
HDassert(sect_size);
/* Create free space section for block */
- if(NULL == (sect = H5MF__sect_new(cls->type, sect_addr, sect_size)))
+ if (NULL == (sect = H5MF__sect_new(cls->type, sect_addr, sect_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section")
/* Set return value */
@@ -304,7 +283,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__sect_deserialize() */
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_valid
*
@@ -319,25 +297,23 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF__sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
- const H5FS_section_info_t
+H5MF__sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5FS_section_info_t
#ifdef NDEBUG
- H5_ATTR_UNUSED
+ H5_ATTR_UNUSED
#endif /* NDEBUG */
- *_sect)
+ *_sect)
{
#ifndef NDEBUG
- const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
-#endif /* NDEBUG */
+ const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
+#endif /* NDEBUG */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(sect);
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5MF__sect_valid() */
-
+} /* H5MF__sect_valid() */
/*-------------------------------------------------------------------------
* Function: H5MF__sect_split
@@ -355,12 +331,12 @@ H5MF__sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls,
static H5FS_section_info_t *
H5MF__sect_split(H5FS_section_info_t *sect, hsize_t frag_size)
{
- H5MF_free_section_t *ret_value = NULL; /* Return value */
+ H5MF_free_section_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* Allocate space for new section */
- if(NULL == (ret_value = H5MF__sect_new(sect->type, sect->addr, frag_size)))
+ if (NULL == (ret_value = H5MF__sect_new(sect->type, sect->addr, frag_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section")
/* Set new section's info */
@@ -371,10 +347,10 @@ done:
FUNC_LEAVE_NOAPI((H5FS_section_info_t *)ret_value)
} /* end H5MF__sect_split() */
-/*
+/*
* "simple" section callbacks
*/
-
+
/*-------------------------------------------------------------------------
* Function: H5MF__sect_simple_can_merge
*
@@ -391,19 +367,19 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF__sect_simple_can_merge(const H5FS_section_info_t *_sect1,
- const H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata)
+H5MF__sect_simple_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_info_t *_sect2,
+ void H5_ATTR_UNUSED *_udata)
{
- const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
- const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */
- htri_t ret_value = FAIL; /* Return value */
+ const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
+ const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */
+ htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(sect1);
HDassert(sect2);
- HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */
+ HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */
HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr));
/* Check if second section adjoins first section */
@@ -412,7 +388,6 @@ H5MF__sect_simple_can_merge(const H5FS_section_info_t *_sect1,
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__sect_simple_can_merge() */
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_simple_merge
*
@@ -430,13 +405,13 @@ H5MF__sect_simple_can_merge(const H5FS_section_info_t *_sect1,
*/
static herr_t
H5MF__sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
- void H5_ATTR_UNUSED *_udata)
+ void H5_ATTR_UNUSED *_udata)
{
- H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
- H5MF_free_section_t *sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
+ H5MF_free_section_t * sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
HDassert(sect1);
@@ -449,14 +424,13 @@ H5MF__sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect
(*sect1)->sect_info.size += sect2->sect_info.size;
/* Get rid of second section */
- if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0)
+ if (H5MF__sect_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__sect_simple_merge() */
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_simple_can_shrink
*
@@ -473,13 +447,13 @@ done:
static htri_t
H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
{
- const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
- H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
- haddr_t eoa; /* End of address space in the file */
- haddr_t end; /* End of section to extend */
- htri_t ret_value = FAIL; /* Return value */
+ const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
+ H5MF_sect_ud_t * udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
+ haddr_t eoa; /* End of address space in the file */
+ haddr_t end; /* End of section to extend */
+ htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
HDassert(sect);
@@ -487,18 +461,20 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
HDassert(udata->f);
/* Retrieve the end of the file's address space */
- if(HADDR_UNDEF == (eoa = H5F_get_eoa(udata->f, udata->alloc_type)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
+ if (HADDR_UNDEF == (eoa = H5F_get_eoa(udata->f, udata->alloc_type)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
/* Compute address of end of section to check */
end = sect->sect_info.addr + sect->sect_info.size;
/* Check if the section is exactly at the end of the allocated space in the file */
- if(H5F_addr_eq(end, eoa)) {
+ if (H5F_addr_eq(end, eoa)) {
/* Set the shrinking type */
udata->shrink = H5MF_SHRINK_EOA;
#ifdef H5MF_ALLOC_DEBUG_MORE
-HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr, sect->sect_info.size, eoa);
+ HDfprintf(stderr,
+ "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "}, shrinks file, eoa = %" PRIuHADDR "\n",
+ __func__, sect->sect_info.addr, sect->sect_info.size, eoa);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Indicate shrinking can occur */
@@ -506,47 +482,53 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect-
} /* end if */
else {
/* Shrinking can't occur if the 'eoa_shrink_only' flag is set and we're not shrinking the EOA */
- if(udata->allow_eoa_shrink_only)
+ if (udata->allow_eoa_shrink_only)
HGOTO_DONE(FALSE)
/* Check if this section is allowed to merge with metadata aggregation block */
- if(udata->f->shared->fs_aggr_merge[udata->alloc_type] & H5F_FS_MERGE_METADATA) {
- htri_t status; /* Status from aggregator adjoin */
+ if (udata->f->shared->fs_aggr_merge[udata->alloc_type] & H5F_FS_MERGE_METADATA) {
+ htri_t status; /* Status from aggregator adjoin */
/* See if section can absorb the aggregator & vice versa */
- if((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->meta_aggr), sect, &(udata->shrink))) < 0)
+ if ((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->meta_aggr), sect,
+ &(udata->shrink))) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "error merging section with aggregation block")
- else if(status > 0) {
+ else if (status > 0) {
/* Set the aggregator to operate on */
udata->aggr = &(udata->f->shared->meta_aggr);
#ifdef H5MF_ALLOC_DEBUG_MORE
-HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins metadata aggregator\n", FUNC, sect->sect_info.addr, sect->sect_info.size);
+ HDfprintf(stderr,
+ "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "}, adjoins metadata aggregator\n",
+ __func__, sect->sect_info.addr, sect->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Indicate shrinking can occur */
HGOTO_DONE(TRUE)
} /* end if */
- } /* end if */
+ } /* end if */
/* Check if this section is allowed to merge with small 'raw' aggregation block */
- if(udata->f->shared->fs_aggr_merge[udata->alloc_type] & H5F_FS_MERGE_RAWDATA) {
- htri_t status; /* Status from aggregator adjoin */
+ if (udata->f->shared->fs_aggr_merge[udata->alloc_type] & H5F_FS_MERGE_RAWDATA) {
+ htri_t status; /* Status from aggregator adjoin */
/* See if section can absorb the aggregator & vice versa */
- if((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->sdata_aggr), sect, &(udata->shrink))) < 0)
+ if ((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->sdata_aggr), sect,
+ &(udata->shrink))) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "error merging section with aggregation block")
- else if(status > 0) {
+ else if (status > 0) {
/* Set the aggregator to operate on */
udata->aggr = &(udata->f->shared->sdata_aggr);
#ifdef H5MF_ALLOC_DEBUG_MORE
-HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins small data aggregator\n", FUNC, sect->sect_info.addr, sect->sect_info.size);
+ HDfprintf(stderr,
+ "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "}, adjoins small data aggregator\n",
+ __func__, sect->sect_info.addr, sect->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Indicate shrinking can occur */
HGOTO_DONE(TRUE)
} /* end if */
- } /* end if */
- } /* end else */
+ } /* end if */
+ } /* end else */
/* Set return value */
ret_value = FALSE;
@@ -555,7 +537,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__sect_simple_can_shrink() */
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_simple_shrink
*
@@ -572,11 +553,11 @@ done:
static herr_t
H5MF__sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
{
- H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
- H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
+ H5MF_sect_ud_t * udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
HDassert(sect);
@@ -584,12 +565,12 @@ H5MF__sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
HDassert(udata->f);
/* Check for shrinking file */
- if(H5MF_SHRINK_EOA == udata->shrink) {
+ if (H5MF_SHRINK_EOA == udata->shrink) {
/* Sanity check */
HDassert(H5F_INTENT(udata->f) & H5F_ACC_RDWR);
/* Release section's space at EOA */
- if(H5F__free(udata->f, udata->alloc_type, (*sect)->sect_info.addr, (*sect)->sect_info.size) < 0)
+ if (H5F__free(udata->f, udata->alloc_type, (*sect)->sect_info.addr, (*sect)->sect_info.size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed")
} /* end if */
else {
@@ -597,14 +578,15 @@ H5MF__sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata)
HDassert(udata->aggr);
/* Absorb the section into the aggregator or vice versa */
- if(H5MF__aggr_absorb(udata->f, udata->aggr, *sect, udata->allow_sect_absorb) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "can't absorb section into aggregator or vice versa")
+ if (H5MF__aggr_absorb(udata->f, udata->aggr, *sect, udata->allow_sect_absorb) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL,
+ "can't absorb section into aggregator or vice versa")
} /* end else */
/* Check for freeing section */
- if(udata->shrink != H5MF_SHRINK_SECT_ABSORB_AGGR) {
+ if (udata->shrink != H5MF_SHRINK_SECT_ABSORB_AGGR) {
/* Free section */
- if(H5MF__sect_free((H5FS_section_info_t *)*sect) < 0)
+ if (H5MF__sect_free((H5FS_section_info_t *)*sect) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
/* Mark section as freed, for free space manager */
@@ -615,17 +597,16 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__sect_simple_shrink() */
-/*
+/*
* "small" section callbacks
*/
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_small_add
*
* Purpose: Perform actions on a small "meta" action before adding it to the free space manager:
* 1) Drop the section if it is at page end and its size <= page end threshold
- * 2) Adjust section size to include page end threshold if
+ * 2) Adjust section size to include page end threshold if
* (section size + threshold) is at page end
*
* Return: Success: non-negative
@@ -638,51 +619,52 @@ done:
static herr_t
H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata)
{
- H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* Fractal heap free section */
- H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
- haddr_t sect_end;
- hsize_t rem, prem;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* Fractal heap free section */
+ H5MF_sect_ud_t * udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
+ haddr_t sect_end;
+ hsize_t rem, prem;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
#ifdef H5MF_ALLOC_DEBUG_MORE
-HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size);
+ HDfprintf(stderr, "%s: Entering, section {%" PRIuHADDR ", %" PRIuHSIZE "}\n", __func__,
+ (*sect)->sect_info.addr, (*sect)->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Do not adjust the section raw data or global heap data */
- if(udata->alloc_type == H5FD_MEM_DRAW || udata->alloc_type == H5FD_MEM_GHEAP)
+ if (udata->alloc_type == H5FD_MEM_DRAW || udata->alloc_type == H5FD_MEM_GHEAP)
HGOTO_DONE(ret_value);
sect_end = (*sect)->sect_info.addr + (*sect)->sect_info.size;
- rem = sect_end % udata->f->shared->fs_page_size;
- prem = udata->f->shared->fs_page_size - rem;
+ rem = sect_end % udata->f->shared->fs_page_size;
+ prem = udata->f->shared->fs_page_size - rem;
/* Drop the section if it is at page end and its size is <= pgend threshold */
- if(!rem && (*sect)->sect_info.size <= H5F_PGEND_META_THRES(udata->f) && (*flags & H5FS_ADD_RETURNED_SPACE)) {
- if(H5MF__sect_free((H5FS_section_info_t *)(*sect)) < 0)
+ if (!rem && (*sect)->sect_info.size <= H5F_PGEND_META_THRES(udata->f) &&
+ (*flags & H5FS_ADD_RETURNED_SPACE)) {
+ if (H5MF__sect_free((H5FS_section_info_t *)(*sect)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
*sect = NULL;
*flags &= (unsigned)~H5FS_ADD_RETURNED_SPACE;
*flags |= H5FS_PAGE_END_NO_ADD;
#ifdef H5MF_ALLOC_DEBUG_MORE
-HDfprintf(stderr, "%s: section is dropped\n", FUNC);
+ HDfprintf(stderr, "%s: section is dropped\n", __func__);
#endif /* H5MF_ALLOC_DEBUG_MORE */
- } /* end if */
+ } /* end if */
/* Adjust the section if it is not at page end but its size + prem is at page end */
- else
- if(prem <= H5F_PGEND_META_THRES(udata->f)) {
- (*sect)->sect_info.size += prem;
+ else if (prem <= H5F_PGEND_META_THRES(udata->f)) {
+ (*sect)->sect_info.size += prem;
#ifdef H5MF_ALLOC_DEBUG_MORE
-HDfprintf(stderr, "%s: section is adjusted {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size);
+ HDfprintf(stderr, "%s: section is adjusted {%" PRIuHADDR ", %" PRIuHSIZE "}\n", __func__,
+ (*sect)->sect_info.addr, (*sect)->sect_info.size);
#endif /* H5MF_ALLOC_DEBUG_MORE */
- } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__sect_small_add() */
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_small_can_merge
*
@@ -699,37 +681,36 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF__sect_small_can_merge(const H5FS_section_info_t *_sect1,
- const H5FS_section_info_t *_sect2, void *_udata)
+H5MF__sect_small_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_info_t *_sect2, void *_udata)
{
- const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
- const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */
- H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
- htri_t ret_value = FALSE; /* Return value */
+ const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
+ const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */
+ H5MF_sect_ud_t * udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
+ htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(sect1);
HDassert(sect2);
- HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */
+ HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */
HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr));
/* Check if second section adjoins first section */
ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr);
- if(ret_value > 0)
+ if (ret_value > 0)
/* If they are on different pages, couldn't merge */
- if((sect1->sect_info.addr / udata->f->shared->fs_page_size) != (((sect2->sect_info.addr + sect2->sect_info.size - 1) / udata->f->shared->fs_page_size)))
- ret_value = FALSE;
+ if ((sect1->sect_info.addr / udata->f->shared->fs_page_size) !=
+ (((sect2->sect_info.addr + sect2->sect_info.size - 1) / udata->f->shared->fs_page_size)))
+ ret_value = FALSE;
#ifdef H5MF_ALLOC_DEBUG_MORE
-HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: Leaving: ret_value = %d\n", __func__, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__sect_small_can_merge() */
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_small_merge
*
@@ -747,15 +728,14 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
- void *_udata)
+H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, void *_udata)
{
- H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
- H5MF_free_section_t *sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
- H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
+ H5MF_free_section_t * sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
+ H5MF_sect_ud_t * udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
HDassert(sect1);
@@ -767,36 +747,35 @@ H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2
/* Add second section's size to first section */
(*sect1)->sect_info.size += sect2->sect_info.size;
- if((*sect1)->sect_info.size == udata->f->shared->fs_page_size) {
- if(H5MF_xfree(udata->f, udata->alloc_type, (*sect1)->sect_info.addr, (*sect1)->sect_info.size) < 0)
+ if ((*sect1)->sect_info.size == udata->f->shared->fs_page_size) {
+ if (H5MF_xfree(udata->f, udata->alloc_type, (*sect1)->sect_info.addr, (*sect1)->sect_info.size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section")
/* Need to free possible metadata page in the PB cache */
/* This is in response to the data corruption bug from fheap.c with page buffering + page strategy */
/* Note: Large metadata page bypasses the PB cache */
/* Note: Update of raw data page (large or small sized) is handled by the PB cache */
- if(udata->f->shared->page_buf != NULL && udata->alloc_type != H5FD_MEM_DRAW)
- if(H5PB_remove_entry(udata->f->shared, (*sect1)->sect_info.addr) < 0)
+ if (udata->f->shared->page_buf != NULL && udata->alloc_type != H5FD_MEM_DRAW)
+ if (H5PB_remove_entry(udata->f->shared, (*sect1)->sect_info.addr) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section")
- if(H5MF__sect_free((H5FS_section_info_t *)(*sect1)) < 0)
+ if (H5MF__sect_free((H5FS_section_info_t *)(*sect1)) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
*sect1 = NULL;
} /* end if */
/* Get rid of second section */
- if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0)
+ if (H5MF__sect_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__sect_small_merge() */
-/*
+/*
* "Large" section callbacks
*/
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_large_can_merge (same as H5MF__sect_simple_can_merge)
*
@@ -812,31 +791,30 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5MF__sect_large_can_merge(const H5FS_section_info_t *_sect1,
- const H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata)
+H5MF__sect_large_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_info_t *_sect2,
+ void H5_ATTR_UNUSED *_udata)
{
- const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
- const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */
- htri_t ret_value = FALSE; /* Return value */
+ const H5MF_free_section_t *sect1 = (const H5MF_free_section_t *)_sect1; /* File free section */
+ const H5MF_free_section_t *sect2 = (const H5MF_free_section_t *)_sect2; /* File free section */
+ htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_PACKAGE_NOERR
/* Check arguments. */
HDassert(sect1);
HDassert(sect2);
- HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */
+ HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */
HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr));
ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr);
#ifdef H5MF_ALLOC_DEBUG_MORE
-HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
+ HDfprintf(stderr, "%s: Leaving: ret_value = %d\n", __func__, ret_value);
#endif /* H5MF_ALLOC_DEBUG_MORE */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__sect_large_can_merge() */
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_large_merge (same as H5MF__sect_simple_merge)
*
@@ -852,14 +830,13 @@ HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value);
*-------------------------------------------------------------------------
*/
static herr_t
-H5MF__sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2,
- void H5_ATTR_UNUSED *_udata)
+H5MF__sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, void H5_ATTR_UNUSED *_udata)
{
- H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
- H5MF_free_section_t *sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5MF_free_section_t **sect1 = (H5MF_free_section_t **)_sect1; /* File free section */
+ H5MF_free_section_t * sect2 = (H5MF_free_section_t *)_sect2; /* File free section */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
HDassert(sect1);
@@ -872,14 +849,13 @@ H5MF__sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2
(*sect1)->sect_info.size += sect2->sect_info.size;
/* Get rid of second section */
- if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0)
+ if (H5MF__sect_free((H5FS_section_info_t *)sect2) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__sect_large_merge() */
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_large_can_shrink
*
@@ -895,13 +871,13 @@ done:
static htri_t
H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
{
- const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
- H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
- haddr_t eoa; /* End of address space in the file */
- haddr_t end; /* End of section to extend */
- htri_t ret_value = FALSE; /* Return value */
+ const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */
+ H5MF_sect_ud_t * udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
+ haddr_t eoa; /* End of address space in the file */
+ haddr_t end; /* End of section to extend */
+ htri_t ret_value = FALSE; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
HDassert(sect);
@@ -910,18 +886,20 @@ H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata)
HDassert(udata->f);
/* Retrieve the end of the file's address space */
- if(HADDR_UNDEF == (eoa = H5FD_get_eoa(udata->f->shared->lf, udata->alloc_type)))
+ if (HADDR_UNDEF == (eoa = H5FD_get_eoa(udata->f->shared->lf, udata->alloc_type)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
/* Compute address of end of section to check */
end = sect->sect_info.addr + sect->sect_info.size;
/* Check if the section is exactly at the end of the allocated space in the file */
- if(H5F_addr_eq(end, eoa) && sect->sect_info.size >= udata->f->shared->fs_page_size) {
+ if (H5F_addr_eq(end, eoa) && sect->sect_info.size >= udata->f->shared->fs_page_size) {
/* Set the shrinking type */
udata->shrink = H5MF_SHRINK_EOA;
#ifdef H5MF_ALLOC_DEBUG_MORE
-HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr, sect->sect_info.size, eoa);
+ HDfprintf(stderr,
+ "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "}, shrinks file, eoa = %" PRIuHADDR "\n",
+ __func__, sect->sect_info.addr, sect->sect_info.size, eoa);
#endif /* H5MF_ALLOC_DEBUG_MORE */
/* Indicate shrinking can occur */
@@ -932,7 +910,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__sect_large_can_shrink() */
-
/*-------------------------------------------------------------------------
* Function: H5MF__sect_large_shrink
*
@@ -948,12 +925,12 @@ done:
static herr_t
H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *_udata)
{
- H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
- H5MF_sect_ud_t *udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
- hsize_t frag_size = 0; /* Fragment size */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5MF_free_section_t **sect = (H5MF_free_section_t **)_sect; /* File free section */
+ H5MF_sect_ud_t * udata = (H5MF_sect_ud_t *)_udata; /* User data for callback */
+ hsize_t frag_size = 0; /* Fragment size */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
/* Check arguments. */
HDassert(sect);
@@ -969,14 +946,15 @@ H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *_udata)
/* Free full pages from EOA */
/* Retain partial page in the free-space manager so as to keep EOA at page boundary */
- if(H5F__free(udata->f, udata->alloc_type, (*sect)->sect_info.addr+frag_size, (*sect)->sect_info.size-frag_size) < 0)
+ if (H5F__free(udata->f, udata->alloc_type, (*sect)->sect_info.addr + frag_size,
+ (*sect)->sect_info.size - frag_size) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed")
- if(frag_size) /* Adjust section size for the partial page */
+ if (frag_size) /* Adjust section size for the partial page */
(*sect)->sect_info.size = frag_size;
else {
/* Free section */
- if(H5MF__sect_free((H5FS_section_info_t *)*sect) < 0)
+ if (H5MF__sect_free((H5FS_section_info_t *)*sect) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node")
/* Mark section as freed, for free space manager */
@@ -986,4 +964,3 @@ H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *_udata)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5MF__sect_large_shrink() */
-