summaryrefslogtreecommitdiffstats
path: root/src/H5Ftest.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-03-25 00:39:37 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-03-25 00:39:37 (GMT)
commitfeb20aac304b39e18c70f88cae2f7cf7d5c82db2 (patch)
treee15d7e751af4e3c42e77ea955d91db4cf27a71cf /src/H5Ftest.c
parentbdac2ecdbff2c389a222b3d93ff1eb1d23ec6b23 (diff)
downloadhdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.zip
hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.gz
hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.bz2
Formats the source and updates the gcc warning pragmas
Diffstat (limited to 'src/H5Ftest.c')
-rw-r--r--src/H5Ftest.c289
1 files changed, 137 insertions, 152 deletions
diff --git a/src/H5Ftest.c b/src/H5Ftest.c
index f249d45..7ff3427 100644
--- a/src/H5Ftest.c
+++ b/src/H5Ftest.c
@@ -26,71 +26,63 @@
/* Module Setup */
/****************/
-#include "H5Fmodule.h" /* This source code file is part of the H5F module */
-#define H5F_TESTING /* Suppress warning about H5F testing funcs */
-#define H5G_FRIEND /* Suppress error about including H5Gpkg.h */
-#define H5G_TESTING /* Suppress warning about H5G testing funcs */
-#define H5SM_FRIEND /* Suppress error about including H5SMpkg.h */
-#define H5SM_TESTING /* Suppress warning about H5SM testing funcs */
-
+#include "H5Fmodule.h" /* This source code file is part of the H5F module */
+#define H5F_TESTING /* Suppress warning about H5F testing funcs */
+#define H5G_FRIEND /* Suppress error about including H5Gpkg.h */
+#define H5G_TESTING /* Suppress warning about H5G testing funcs */
+#define H5SM_FRIEND /* Suppress error about including H5SMpkg.h */
+#define H5SM_TESTING /* Suppress warning about H5SM testing funcs */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5FDprivate.h" /* File Drivers */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* File access */
-#include "H5Gpkg.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5SMpkg.h" /* Shared object header messages */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5VLprivate.h" /* Virtual Object Layer */
-
+#include "H5private.h" /* Generic Functions */
+#include "H5FDprivate.h" /* File Drivers */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5SMpkg.h" /* Shared object header messages */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/****************/
/* Local Macros */
/****************/
-
/******************/
/* Local Typedefs */
/******************/
-
/********************/
/* Package Typedefs */
/********************/
-
/********************/
/* Local Prototypes */
/********************/
static herr_t H5F__vfd_swmr_decode_md_hdr(int md_fd, H5FD_vfd_swmr_md_header *md_hdr);
-static herr_t H5F__vfd_swmr_decode_md_idx(int md_fd, H5FD_vfd_swmr_md_header *md_hdr, H5FD_vfd_swmr_md_index *md_idx);
-static herr_t H5F__vfd_swmr_verify_md_hdr_and_idx(H5F_t *f,
- H5FD_vfd_swmr_md_header *md_hdr, H5FD_vfd_swmr_md_index *md_idx,
- unsigned num_entries, H5FD_vfd_swmr_idx_entry_t *index);
-
+static herr_t H5F__vfd_swmr_decode_md_idx(int md_fd, H5FD_vfd_swmr_md_header *md_hdr,
+ H5FD_vfd_swmr_md_index *md_idx);
+static herr_t H5F__vfd_swmr_verify_md_hdr_and_idx(H5F_t *f, H5FD_vfd_swmr_md_header *md_hdr,
+ H5FD_vfd_swmr_md_index *md_idx, unsigned num_entries,
+ H5FD_vfd_swmr_idx_entry_t *index);
/*********************/
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
/* Declare external the free list for H5FD_vfd_swmr_idx_entry_t */
H5FL_SEQ_EXTERN(H5FD_vfd_swmr_idx_entry_t);
-
/*******************/
/* Local Variables */
/*******************/
-
/*-------------------------------------------------------------------------
* Function: H5F__get_sohm_mesg_count_test
*
@@ -106,33 +98,32 @@ H5FL_SEQ_EXTERN(H5FD_vfd_swmr_idx_entry_t);
herr_t
H5F__get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, size_t *mesg_count)
{
- H5F_t *file; /* File info */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t * file; /* File info */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
+ if (NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Push API context */
- if(H5CX_push() < 0)
+ if (H5CX_push() < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context")
api_ctx_pushed = TRUE;
/* Retrieve count for message type */
- if(H5SM__get_mesg_count_test(file, type_id, mesg_count) < 0)
+ if (H5SM__get_mesg_count_test(file, type_id, mesg_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve shared message count")
done:
- if(api_ctx_pushed && H5CX_pop() < 0)
+ if (api_ctx_pushed && H5CX_pop() < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__get_sohm_mesg_count_test() */
-
/*-------------------------------------------------------------------------
* Function: H5F__check_cached_stab_test
*
@@ -151,33 +142,32 @@ done:
herr_t
H5F__check_cached_stab_test(hid_t file_id)
{
- H5F_t *file; /* File info */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t * file; /* File info */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
+ if (NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Push API context */
- if(H5CX_push() < 0)
+ if (H5CX_push() < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context")
api_ctx_pushed = TRUE;
/* Verify the cached stab info */
- if(H5G__verify_cached_stab_test(H5G_oloc(file->shared->root_grp), file->shared->sblock->root_ent) < 0)
+ if (H5G__verify_cached_stab_test(H5G_oloc(file->shared->root_grp), file->shared->sblock->root_ent) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to verify cached symbol table info")
done:
- if(api_ctx_pushed && H5CX_pop() < 0)
+ if (api_ctx_pushed && H5CX_pop() < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__check_cached_stab_test() */
-
/*-------------------------------------------------------------------------
* Function: H5F__get_maxaddr_test
*
@@ -193,13 +183,13 @@ done:
herr_t
H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr)
{
- H5F_t *file; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
+ if (NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Retrieve maxaddr for file */
@@ -209,7 +199,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__get_maxaddr_test() */
-
/*-------------------------------------------------------------------------
* Function: H5F__get_sbe_addr_test
*
@@ -226,13 +215,13 @@ done:
herr_t
H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr)
{
- H5F_t *file; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *file; /* File info */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
+ if (NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Retrieve maxaddr for file */
@@ -242,10 +231,10 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__get_sbe_addr_test() */
-/*
- * VFD SWMR tests
+/*
+ * VFD SWMR tests
*/
-
+
/*-------------------------------------------------------------------------
* Function: H5F__vfd_swmr_writer_create_open_flush_test
*
@@ -270,73 +259,73 @@ done:
herr_t
H5F__vfd_swmr_writer_create_open_flush_test(hid_t file_id, hbool_t file_create)
{
- H5F_t *f; /* File pointer */
- h5_stat_t stat_buf; /* Buffer for stat info */
- H5FD_vfd_swmr_md_header md_hdr; /* Header for the metadata file */
- H5FD_vfd_swmr_md_index md_idx; /* Indedx for the metadata file */
- int md_fd = -1; /* The metadata file descriptor */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t * f; /* File pointer */
+ h5_stat_t stat_buf; /* Buffer for stat info */
+ H5FD_vfd_swmr_md_header md_hdr; /* Header for the metadata file */
+ H5FD_vfd_swmr_md_index md_idx; /* Indedx for the metadata file */
+ int md_fd = -1; /* The metadata file descriptor */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (f = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
+ if (NULL == (f = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Open the metadata file */
- if((md_fd = HDopen(f->shared->vfd_swmr_config.md_file_path, O_RDONLY)) < 0)
+ if ((md_fd = HDopen(f->shared->vfd_swmr_config.md_file_path, O_RDONLY)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "error opening metadata file")
/* Verify the minimum size for the metadata file */
- if(HDstat(f->shared->vfd_swmr_config.md_file_path, &stat_buf) < 0)
+ if (HDstat(f->shared->vfd_swmr_config.md_file_path, &stat_buf) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to stat the metadata file")
- if(stat_buf.st_size < (HDoff_t)((hsize_t)f->shared->vfd_swmr_config.md_pages_reserved * f->shared->fs_page_size))
+ if (stat_buf.st_size <
+ (HDoff_t)((hsize_t)f->shared->vfd_swmr_config.md_pages_reserved * f->shared->fs_page_size))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect metadata file size")
- if(file_create) { /* Creating file */
+ if (file_create) { /* Creating file */
uint32_t hdr_magic;
/* Seek to the beginning of the file */
- if(HDlseek(md_fd, (HDoff_t)H5FD_MD_HEADER_OFF, SEEK_SET) < 0)
+ if (HDlseek(md_fd, (HDoff_t)H5FD_MD_HEADER_OFF, SEEK_SET) < 0)
HGOTO_ERROR(H5E_FILE, H5E_SEEKERROR, FAIL, "error seeking metadata file")
/* Try to read the magic for header */
- if(HDread(md_fd, &hdr_magic, H5_SIZEOF_MAGIC) < 0)
+ if (HDread(md_fd, &hdr_magic, H5_SIZEOF_MAGIC) < 0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "error reading metadata file")
/* Verify that there is no header magic in the metadata file */
- if(HDmemcmp(&hdr_magic, H5FD_MD_HEADER_MAGIC, (size_t)H5_SIZEOF_MAGIC) == 0)
+ if (HDmemcmp(&hdr_magic, H5FD_MD_HEADER_MAGIC, (size_t)H5_SIZEOF_MAGIC) == 0)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "error finding header magic in the metadata file")
+ }
+ else { /* Opening or flushing the file */
- } else { /* Opening or flushing the file */
-
HDmemset(&md_hdr, 0, sizeof(H5FD_vfd_swmr_md_header));
HDmemset(&md_idx, 0, sizeof(H5FD_vfd_swmr_md_index));
/* Decode the header */
- if(H5F__vfd_swmr_decode_md_hdr(md_fd, &md_hdr) < 0)
+ if (H5F__vfd_swmr_decode_md_hdr(md_fd, &md_hdr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "error decoding header in the metadata file")
/* Decode the index */
- if(H5F__vfd_swmr_decode_md_idx(md_fd, &md_hdr, &md_idx) < 0)
+ if (H5F__vfd_swmr_decode_md_idx(md_fd, &md_hdr, &md_idx) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "error decoding index in the metadata file")
/* Verify info in header and index read from the metadata file */
- if(H5F__vfd_swmr_verify_md_hdr_and_idx(f, &md_hdr, &md_idx, 0, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect info found in header and index of the metadata file")
+ if (H5F__vfd_swmr_verify_md_hdr_and_idx(f, &md_hdr, &md_idx, 0, NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL,
+ "incorrect info found in header and index of the metadata file")
}
done:
/* Free the index entries */
- if(!file_create && md_idx.entries) {
+ if (!file_create && md_idx.entries) {
HDassert(md_idx.num_entries);
H5MM_free(md_idx.entries);
}
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__vfd_swmr_writer_create_open_flush_test() */
-
-
/*-------------------------------------------------------------------------
* Function: H5F__vfd_swmr_decode_md_hdr
*
@@ -350,24 +339,24 @@ static herr_t
H5F__vfd_swmr_decode_md_hdr(int md_fd, H5FD_vfd_swmr_md_header *md_hdr)
{
uint64_t index_length;
- uint8_t image[H5FD_MD_HEADER_SIZE]; /* Buffer for the header image */
- uint8_t *p = NULL; /* Points to the image */
- herr_t ret_value = SUCCEED; /* Return value */
+ uint8_t image[H5FD_MD_HEADER_SIZE]; /* Buffer for the header image */
+ uint8_t *p = NULL; /* Points to the image */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
p = image;
/* Seek to the beginning of the file */
- if(HDlseek(md_fd, (HDoff_t)H5FD_MD_HEADER_OFF, SEEK_SET) < 0)
+ if (HDlseek(md_fd, (HDoff_t)H5FD_MD_HEADER_OFF, SEEK_SET) < 0)
HGOTO_ERROR(H5E_FILE, H5E_SEEKERROR, FAIL, "error seeking metadata file")
/* Read the header */
- if(HDread(md_fd, image, H5FD_MD_HEADER_SIZE) < 0)
+ if (HDread(md_fd, image, H5FD_MD_HEADER_SIZE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "error reading metadata file")
/* Verify magic for header */
- if(HDmemcmp(p, H5FD_MD_HEADER_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
+ if (HDmemcmp(p, H5FD_MD_HEADER_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "does not find header magic in the metadata file")
p += H5_SIZEOF_MAGIC;
@@ -385,7 +374,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__vfd_swmr_decode_md_hdr() */
-
/*-------------------------------------------------------------------------
* Function: H5F__vfd_swmr_decode_md_idx
*
@@ -398,29 +386,29 @@ done:
static herr_t
H5F__vfd_swmr_decode_md_idx(int md_fd, H5FD_vfd_swmr_md_header *md_hdr, H5FD_vfd_swmr_md_index *md_idx)
{
- uint8_t *image = NULL; /* Points to the buffer for the index image */
- uint8_t *p = NULL; /* Points to the image */
- unsigned i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ uint8_t *image = NULL; /* Points to the buffer for the index image */
+ uint8_t *p = NULL; /* Points to the image */
+ unsigned i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Allocate buffer for the index image */
- if(NULL == (image = H5MM_malloc(md_hdr->index_length)))
+ if (NULL == (image = H5MM_malloc(md_hdr->index_length)))
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "memory allocation failed for index on disk buffer")
p = image;
/* Seek to the position of the index */
- if(HDlseek(md_fd, (HDoff_t)md_hdr->index_offset, SEEK_SET) < 0)
+ if (HDlseek(md_fd, (HDoff_t)md_hdr->index_offset, SEEK_SET) < 0)
HGOTO_ERROR(H5E_FILE, H5E_SEEKERROR, FAIL, "unable to seek in metadata file")
/* Read the index */
- if(HDread(md_fd, image, md_hdr->index_length) < (int64_t)md_hdr->index_length)
+ if (HDread(md_fd, image, md_hdr->index_length) < (int64_t)md_hdr->index_length)
HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "error in reading the header in metadata file")
/* Verify magic for index */
- if(HDmemcmp(p, H5FD_MD_INDEX_MAGIC, H5_SIZEOF_MAGIC) != 0)
+ if (HDmemcmp(p, H5FD_MD_INDEX_MAGIC, H5_SIZEOF_MAGIC) != 0)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "no header magic in the metadata file")
p += H5_SIZEOF_MAGIC;
@@ -430,30 +418,29 @@ H5F__vfd_swmr_decode_md_idx(int md_fd, H5FD_vfd_swmr_md_header *md_hdr, H5FD_vfd
UINT32DECODE(p, md_idx->num_entries);
/* Deserialize index entries */
- if(md_idx->num_entries) {
- md_idx->entries =
- H5MM_calloc(md_idx->num_entries * sizeof(md_idx->entries[0]));
+ if (md_idx->num_entries) {
+ md_idx->entries = H5MM_calloc(md_idx->num_entries * sizeof(md_idx->entries[0]));
/* Allocate memory for the index entries */
- if(NULL == md_idx->entries)
+ if (NULL == md_idx->entries)
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "memory allocation failed for index entries")
- /* Decode index entries */
- for(i = 0; i < md_idx->num_entries; i++) {
+ /* Decode index entries */
+ for (i = 0; i < md_idx->num_entries; i++) {
UINT32DECODE(p, md_idx->entries[i].hdf5_page_offset);
UINT32DECODE(p, md_idx->entries[i].md_file_page_offset);
UINT32DECODE(p, md_idx->entries[i].length);
UINT32DECODE(p, md_idx->entries[i].chksum);
- } /* end for */
+ } /* end for */
- } /* end if */
+ } /* end if */
done:
/* Free the buffer */
- if(image)
+ if (image)
H5MM_free(image);
- if(ret_value < 0) {
+ if (ret_value < 0) {
/* Free the index entries */
- if(md_idx->entries) {
+ if (md_idx->entries) {
HDassert(md_idx->num_entries);
H5MM_free(md_idx->entries);
}
@@ -462,15 +449,13 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__vfd_swmr_decode_md_idx() */
-
-
/*-------------------------------------------------------------------------
* Function: H5F__vfd_swmr_verify_md_hdr_idx_test
*
* Purpose: Verify the header and index in the metadata file:
* --fs_page_size in md header is the same as that stored in "f"
* --index_length in md header is as indicated by num_entries
- * --index_offset in md header is right after the header
+ * --index_offset in md header is right after the header
* --number of entries in md index is num_entries
* --entries in md index is as indicated by num_entries and index
*
@@ -479,49 +464,51 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5F__vfd_swmr_verify_md_hdr_and_idx(H5F_t *f,
- H5FD_vfd_swmr_md_header *md_hdr, H5FD_vfd_swmr_md_index *md_idx,
- unsigned num_entries, H5FD_vfd_swmr_idx_entry_t *index)
+H5F__vfd_swmr_verify_md_hdr_and_idx(H5F_t *f, H5FD_vfd_swmr_md_header *md_hdr, H5FD_vfd_swmr_md_index *md_idx,
+ unsigned num_entries, H5FD_vfd_swmr_idx_entry_t *index)
{
- unsigned i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Verify fs_page_size read from header in the metadata file is fs_page_size in f */
- if(md_hdr->fs_page_size != f->shared->fs_page_size)
+ if (md_hdr->fs_page_size != f->shared->fs_page_size)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect fs_page_size read from metadata file")
/* Verify index_length read from header in the metadata file is the size of num_entries index */
- if(md_hdr->index_length != H5FD_MD_INDEX_SIZE(num_entries))
+ if (md_hdr->index_length != H5FD_MD_INDEX_SIZE(num_entries))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect index_length read from metadata file")
/* Verify index_offset read from header in the metadata file is the size of md header */
- if(md_hdr->index_offset != f->shared->fs_page_size)
+ if (md_hdr->index_offset != f->shared->fs_page_size)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect index_offset read from metadata file")
/* Verify num_entries read from index in the metadata file is num_entries */
- if(md_idx->num_entries != num_entries)
+ if (md_idx->num_entries != num_entries)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect num_entries read from metadata file")
/* Verify empty/non-empty index entries */
- if(num_entries == 0) {
+ if (num_entries == 0) {
/* Verify the index is empty */
- if(md_idx->entries != NULL)
+ if (md_idx->entries != NULL)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect entries in index")
- } else {
+ }
+ else {
/* Verify entries */
- for(i = 0; i < num_entries; i++) {
- if(md_idx->entries[i].length != index[i].length)
+ for (i = 0; i < num_entries; i++) {
+ if (md_idx->entries[i].length != index[i].length)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect length read from metadata file")
- if(md_idx->entries[i].hdf5_page_offset != index[i].hdf5_page_offset)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect hdf5_page_offset read from metadata file")
+ if (md_idx->entries[i].hdf5_page_offset != index[i].hdf5_page_offset)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL,
+ "incorrect hdf5_page_offset read from metadata file")
- if(md_idx->entries[i].md_file_page_offset != index[i].md_file_page_offset)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect md_file_page_offset read from metadata file")
+ if (md_idx->entries[i].md_file_page_offset != index[i].md_file_page_offset)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL,
+ "incorrect md_file_page_offset read from metadata file")
- if(md_idx->entries[i].chksum != index[i].chksum)
+ if (md_idx->entries[i].chksum != index[i].chksum)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect chksum read from metadata file")
}
}
@@ -534,15 +521,14 @@ static unsigned
count_shadow_defrees(shadow_defree_queue_t *shadow_defrees)
{
shadow_defree_t *shadow_defree;
- unsigned count = 0;
+ unsigned count = 0;
TAILQ_FOREACH(shadow_defree, shadow_defrees, link)
- count++;
+ count++;
return count;
}
-
/*-------------------------------------------------------------------------
* Function: H5F__vfd_swmr_writer_md_test
*
@@ -550,7 +536,7 @@ count_shadow_defrees(shadow_defree_queue_t *shadow_defrees)
* the following:
* --info read from the metadata file is as indicated by
* the input: num_entries, index
- * --# of entries on the delayed list is as indicated by
+ * --# of entries on the delayed list is as indicated by
* the input: nshadow_defrees
*
* Return: SUCCEED/FAIL
@@ -558,14 +544,14 @@ count_shadow_defrees(shadow_defree_queue_t *shadow_defrees)
*-------------------------------------------------------------------------
*/
herr_t
-H5F__vfd_swmr_writer_md_test(hid_t file_id, unsigned num_entries,
- H5FD_vfd_swmr_idx_entry_t *index, unsigned nshadow_defrees)
+H5F__vfd_swmr_writer_md_test(hid_t file_id, unsigned num_entries, H5FD_vfd_swmr_idx_entry_t *index,
+ unsigned nshadow_defrees)
{
- H5F_t *f; /* File pointer */
- int md_fd = -1; /* The metadata file descriptor */
- H5FD_vfd_swmr_md_header md_hdr; /* Header for the metadata file */
- H5FD_vfd_swmr_md_index md_idx; /* Index for the metadata file */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t * f; /* File pointer */
+ int md_fd = -1; /* The metadata file descriptor */
+ H5FD_vfd_swmr_md_header md_hdr; /* Header for the metadata file */
+ H5FD_vfd_swmr_md_index md_idx; /* Index for the metadata file */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -573,43 +559,43 @@ H5F__vfd_swmr_writer_md_test(hid_t file_id, unsigned num_entries,
HDmemset(&md_idx, 0, sizeof(H5FD_vfd_swmr_md_index));
/* Check arguments */
- if(NULL == (f = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
+ if (NULL == (f = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* Update the metadata file with the input index */
- if(H5F_update_vfd_swmr_metadata_file(f, num_entries, index) < 0)
+ if (H5F_update_vfd_swmr_metadata_file(f, num_entries, index) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "error updating the md file with the index")
/* Verify the number of entries in the delayed list is as expected */
- if(count_shadow_defrees(&f->shared->shadow_defrees) == nshadow_defrees)
+ if (count_shadow_defrees(&f->shared->shadow_defrees) == nshadow_defrees)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect # of entries in the delayed list")
/* Open the metadata file */
- if((md_fd = HDopen(f->shared->vfd_swmr_config.md_file_path, O_RDONLY)) < 0)
+ if ((md_fd = HDopen(f->shared->vfd_swmr_config.md_file_path, O_RDONLY)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "error opening metadata file")
/* Decode the header in the metadata file */
- if(H5F__vfd_swmr_decode_md_hdr(md_fd, &md_hdr) < 0)
+ if (H5F__vfd_swmr_decode_md_hdr(md_fd, &md_hdr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "error decoding header in the metadata file")
/* Decode the index in the metadata file */
- if(H5F__vfd_swmr_decode_md_idx(md_fd, &md_hdr, &md_idx) < 0)
+ if (H5F__vfd_swmr_decode_md_idx(md_fd, &md_hdr, &md_idx) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "error decoding index in the metadata file")
/* Verify info read from the metadata file is the same as the input index */
- if(H5F__vfd_swmr_verify_md_hdr_and_idx(f, &md_hdr, &md_idx, num_entries, index) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect info found in header and index of the metadata file")
+ if (H5F__vfd_swmr_verify_md_hdr_and_idx(f, &md_hdr, &md_idx, num_entries, index) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL,
+ "incorrect info found in header and index of the metadata file")
done:
/* Free the index entries */
- if(md_idx.entries) {
+ if (md_idx.entries) {
HDassert(md_idx.num_entries);
H5MM_free(md_idx.entries);
}
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__vfd_swmr_writer_md_test() */
-
/*-------------------------------------------------------------------------
* Function: H5F__same_file_test
*
@@ -625,15 +611,15 @@ done:
htri_t
H5F__same_file_test(hid_t file_id1, hid_t file_id2)
{
- H5F_t *file1, *file2; /* File info */
- htri_t ret_value = FAIL; /* Return value */
+ H5F_t *file1, *file2; /* File info */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_PACKAGE
/* Check arguments */
- if(NULL == (file1 = (H5F_t *)H5VL_object_verify(file_id1, H5I_FILE)))
+ if (NULL == (file1 = (H5F_t *)H5VL_object_verify(file_id1, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
- if(NULL == (file2 = (H5F_t *)H5VL_object_verify(file_id2, H5I_FILE)))
+ if (NULL == (file2 = (H5F_t *)H5VL_object_verify(file_id2, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file")
/* If they are using the same underlying "shared" file struct, they are the same file */
@@ -642,4 +628,3 @@ H5F__same_file_test(hid_t file_id1, hid_t file_id2)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__same_file_test() */
-