summaryrefslogtreecommitdiffstats
path: root/src/H5FDvfd_swmr.c
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2020-07-13 15:09:40 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-07-13 15:09:40 (GMT)
commit326b98fd08fa28719d27d48f39e07c2ac0bb8e30 (patch)
tree6ca07ba234b70f4bf8cc8155c98d864f6ac8556d /src/H5FDvfd_swmr.c
parent62240b1a553e4fc73b982bf40cdf5b7c7221219e (diff)
downloadhdf5-326b98fd08fa28719d27d48f39e07c2ac0bb8e30.zip
hdf5-326b98fd08fa28719d27d48f39e07c2ac0bb8e30.tar.gz
hdf5-326b98fd08fa28719d27d48f39e07c2ac0bb8e30.tar.bz2
Delete whitespace at EOL. Join consecutive line. NFCI.
Diffstat (limited to 'src/H5FDvfd_swmr.c')
-rw-r--r--src/H5FDvfd_swmr.c153
1 files changed, 76 insertions, 77 deletions
diff --git a/src/H5FDvfd_swmr.c b/src/H5FDvfd_swmr.c
index 9841312..2cf19a1 100644
--- a/src/H5FDvfd_swmr.c
+++ b/src/H5FDvfd_swmr.c
@@ -52,7 +52,7 @@ typedef struct H5FD_vfd_swmr_t {
uint32_t api_elapsed_nslots;
uint64_t *api_elapsed_ticks; /* Histogram of ticks elapsed
- * inside the API (reader only).
+ * inside the API (reader only).
*/
hbool_t pb_configured; /* boolean flag set to TRUE */
/* when the page buffer is */
@@ -65,30 +65,30 @@ typedef struct H5FD_vfd_swmr_t {
/* Prototypes */
static herr_t H5FD_vfd_swmr_term(void);
-static H5FD_t *H5FD_vfd_swmr_open(const char *name, unsigned flags,
+static H5FD_t *H5FD_vfd_swmr_open(const char *name, unsigned flags,
hid_t fapl_id, haddr_t maxaddr);
static herr_t H5FD_vfd_swmr_close(H5FD_t *_file);
static int H5FD_vfd_swmr_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
static herr_t H5FD_vfd_swmr_query(const H5FD_t *_f1, unsigned long *flags);
static haddr_t H5FD_vfd_swmr_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
-static herr_t H5FD_vfd_swmr_set_eoa(H5FD_t *_file, H5FD_mem_t type,
+static herr_t H5FD_vfd_swmr_set_eoa(H5FD_t *_file, H5FD_mem_t type,
haddr_t addr);
static haddr_t H5FD_vfd_swmr_get_eof(const H5FD_t *_file, H5FD_mem_t type);
-static herr_t H5FD_vfd_swmr_get_handle(H5FD_t *_file, hid_t fapl,
+static herr_t H5FD_vfd_swmr_get_handle(H5FD_t *_file, hid_t fapl,
void** file_handle);
-static herr_t H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type,
+static herr_t H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type,
hid_t fapl_id, haddr_t addr, size_t size, void *buf);
-static herr_t H5FD_vfd_swmr_write(H5FD_t *_file, H5FD_mem_t type,
+static herr_t H5FD_vfd_swmr_write(H5FD_t *_file, H5FD_mem_t type,
hid_t fapl_id, haddr_t addr, size_t size, const void *buf);
-static herr_t H5FD_vfd_swmr_truncate(H5FD_t *_file, hid_t dxpl_id,
+static herr_t H5FD_vfd_swmr_truncate(H5FD_t *_file, hid_t dxpl_id,
hbool_t closing);
static herr_t H5FD_vfd_swmr_lock(H5FD_t *_file, hbool_t rw);
static herr_t H5FD_vfd_swmr_unlock(H5FD_t *_file);
/* VFD SWMR */
-static htri_t H5FD__vfd_swmr_header_deserialize(H5FD_t *_file,
+static htri_t H5FD__vfd_swmr_header_deserialize(H5FD_t *_file,
H5FD_vfd_swmr_md_header *md_header);
-static htri_t H5FD__vfd_swmr_index_deserialize(const H5FD_t *_file,
+static htri_t H5FD__vfd_swmr_index_deserialize(const H5FD_t *_file,
H5FD_vfd_swmr_md_index *md_index, const H5FD_vfd_swmr_md_header *md_header);
static herr_t H5FD__vfd_swmr_load_hdr_and_idx(H5FD_t *_file, hbool_t open);
@@ -225,7 +225,7 @@ H5FD_vfd_swmr_term(void)
* Function: H5Pset_fapl_vfd_swmr (Not yet)
*
* Purpose: Modify the file access property list to use the H5FD_SWMR
- * driver
+ * driver
*
* Return: SUCCEED/FAIL
*
@@ -263,7 +263,7 @@ done:
*-------------------------------------------------------------------------
*/
static H5FD_t *
-H5FD_vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id,
+H5FD_vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr)
{
H5FD_vfd_swmr_t *file = NULL; /* VFD SWMR driver info */
@@ -308,7 +308,7 @@ H5FD_vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id,
file->hdf5_filename[sizeof(file->hdf5_filename) - 1] = '\0';
/* Retain a copy of the metadata file name */
- HDstrncpy(file->md_file_path, vfd_swmr_config->md_file_path,
+ HDstrncpy(file->md_file_path, vfd_swmr_config->md_file_path,
sizeof(file->md_file_path));
file->md_file_path[sizeof(file->md_file_path) - 1] = '\0';
@@ -344,7 +344,7 @@ H5FD_vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id,
"unable to open the metadata file after all retry attempts");
/* Retry on loading and decoding the header and index in the
- * metadata file
+ * metadata file
*/
if(H5FD__vfd_swmr_load_hdr_and_idx((H5FD_t *)file, TRUE) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL,
@@ -353,17 +353,17 @@ H5FD_vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id,
finish:
/* Hard-wired to open the underlying HDF5 file with SEC2 */
- if((file->hdf5_file_lf = H5FD_open(name, flags, H5P_FILE_ACCESS_DEFAULT,
+ if((file->hdf5_file_lf = H5FD_open(name, flags, H5P_FILE_ACCESS_DEFAULT,
maxaddr)) == NULL)
HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "can't set driver info");
file->hdf5_file_lf->exc_owner = &file->pub;
- /* set pb_configured to FALSE. This field should not exist, but
+ /* set pb_configured to FALSE. This field should not exist, but
* until we modify the file open procedure to create the page buffer
- * before there is any file I/O when opening a file VFD SWMR reader,
+ * before there is any file I/O when opening a file VFD SWMR reader,
* we need to be able to turn off sanity checking in the read function
- * until the page buffer is enabled. This field exists for this
+ * until the page buffer is enabled. This field exists for this
* purpose, and should be remove when it is no longer necessary.
*
* JRM -- 1/29/19
@@ -448,7 +448,7 @@ H5FD_vfd_swmr_close(H5FD_t *_file)
/* Free the index entries */
if(file->md_index.num_entries && file->md_index.entries)
- file->md_index.entries = H5FL_SEQ_FREE(H5FD_vfd_swmr_idx_entry_t,
+ file->md_index.entries = H5FL_SEQ_FREE(H5FD_vfd_swmr_idx_entry_t,
file->md_index.entries);
finish:
@@ -513,7 +513,7 @@ H5FD_vfd_swmr_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /*
/* metadata for faster */
/* writes */
- *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data */
+ *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data */
/* sieving for faster */
/* raw data reads & */
/* writes */
@@ -526,12 +526,12 @@ H5FD_vfd_swmr_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /*
/* returns a POSIX file */
/* descriptor */
- *flags |= H5FD_FEAT_SUPPORTS_SWMR_IO; /* VFD supports the */
+ *flags |= H5FD_FEAT_SUPPORTS_SWMR_IO; /* VFD supports the */
/* single-writer/ */
- /* multiple-readers */
+ /* multiple-readers */
/* (SWMR) pattern */
- *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file */
+ *flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file */
/* which can be opened */
/* with the default VFD */
@@ -544,8 +544,8 @@ H5FD_vfd_swmr_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /*
/*-------------------------------------------------------------------------
* Function: H5FD_vfd_swmr_get_eoa
*
- * Purpose: Gets the end-of-address marker for the file for the
- * underlying HDF5 file. The EOA marker is the first address
+ * Purpose: Gets the end-of-address marker for the file for the
+ * underlying HDF5 file. The EOA marker is the first address
* past the last byte allocated in the format address space.
*
* Return: The end-of-address marker.
@@ -573,9 +573,9 @@ done:
/*-------------------------------------------------------------------------
* Function: H5FD_vfd_swmr_set_eoa
*
- * Purpose: Set the end-of-address marker for the underlying HDF5 file.
- * This function is called shortly after an existing HDF5 file
- * is opened in order to tell the driver where the end of the
+ * Purpose: Set the end-of-address marker for the underlying HDF5 file.
+ * This function is called shortly after an existing HDF5 file
+ * is opened in order to tell the driver where the end of the
* HDF5 data is located.
*
* Return: SUCCEED (Can't fail)
@@ -606,7 +606,7 @@ done:
* either the filesystem end-of-file or the HDF5 end-of-address
* markers for the underlying HDF5 file
*
- * Return: End of file address, the first address past the end of the
+ * Return: End of file address, the first address past the end of the
* "file", either the filesystem file or the HDF5 file.
*
*-------------------------------------------------------------------------
@@ -666,27 +666,27 @@ done:
/*-------------------------------------------------------------------------
* Function: H5FD_vfd_swmr_read
*
- * Purpose: If the target page or multi-page metadata entry is
- * defined in the current metadata file index, satisfy
+ * Purpose: If the target page or multi-page metadata entry is
+ * defined in the current metadata file index, satisfy
* the read from the metadata file. Otherwise, pass the
* read through to the underlying VFD.
*
- * Under normal operating conditions, the size of the
- * read must always match the size supplied in the
- * metadata file index. However, until we modify the
- * file open process for VFD SWMR readers to create the
- * page buffer before any reads, we must allow non
+ * Under normal operating conditions, the size of the
+ * read must always match the size supplied in the
+ * metadata file index. However, until we modify the
+ * file open process for VFD SWMR readers to create the
+ * page buffer before any reads, we must allow non
* full page / non full multi-page metadata entry reads
* until the page buffer is created.
*
- * This is tracked by the pb_configured flag in
- * H5FD_vfd_swmr_t. If this field is FALSE, the function
- * must allow reads smaller than the size listed in the
- * index, and possibly starting anywhere in the page.
- * Note, however, that these reads must not cross page
+ * This is tracked by the pb_configured flag in
+ * H5FD_vfd_swmr_t. If this field is FALSE, the function
+ * must allow reads smaller than the size listed in the
+ * index, and possibly starting anywhere in the page.
+ * Note, however, that these reads must not cross page
* boundaries.
*
- * Once we modify the file open code to start up the
+ * Once we modify the file open code to start up the
* page buffer before we attempt any reads, this exception
* will not longer be necessary, and should be removed.
*
@@ -699,7 +699,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type,
+H5FD_vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type,
hid_t H5_ATTR_UNUSED dxpl_id,
const haddr_t addr, size_t size, void * const buf /*out*/)
{
@@ -839,7 +839,7 @@ H5FD_vfd_swmr_write(H5FD_t *_file, H5FD_mem_t type,
H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file;
HDassert(file->writer);
-
+
return H5FD_write(file->hdf5_file_lf, type, addr, size, buf);
}
@@ -855,15 +855,15 @@ H5FD_vfd_swmr_write(H5FD_t *_file, H5FD_mem_t type,
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_vfd_swmr_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id,
+H5FD_vfd_swmr_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id,
hbool_t closing)
{
H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file; /* VFD SWMR file struct */
- /* The VFD SWMR vfd should only be used by the VFD SWMR reader,
+ /* The VFD SWMR vfd should only be used by the VFD SWMR reader,
* and thus this file should only be opened R/O.
*
- * Thus this function should never be called and should return error
+ * Thus this function should never be called and should return error
*
* For now, just assert FALSE.
*/
@@ -920,7 +920,7 @@ H5FD_vfd_swmr_unlock(H5FD_t *_file)
FUNC_ENTER_NOAPI_NOINIT
HDassert(file);
-
+
if(H5FD_unlock(file->hdf5_file_lf) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTUNLOCK, FAIL, \
@@ -982,7 +982,7 @@ static herr_t
H5FD__vfd_swmr_load_hdr_and_idx(H5FD_t *_file, hbool_t open)
{
H5FD_vfd_swmr_t *file = /* VFD SWMR file struct */
- (H5FD_vfd_swmr_t *)_file;
+ (H5FD_vfd_swmr_t *)_file;
bool do_try;
h5_retry_t retry;
H5FD_vfd_swmr_md_header md_header; /* Metadata file header, take 1 */
@@ -1070,8 +1070,8 @@ H5FD__vfd_swmr_load_hdr_and_idx(H5FD_t *_file, hbool_t open)
}
}
- /* Exhaust all retries for loading and decoding the md file header
- * and index
+ /* Exhaust all retries for loading and decoding the md file header
+ * and index
*/
if (!do_try) {
HGOTO_ERROR(H5E_VFL, H5E_CANTLOAD, FAIL, \
@@ -1084,8 +1084,7 @@ H5FD__vfd_swmr_load_hdr_and_idx(H5FD_t *_file, hbool_t open)
HDassert(file->md_index.num_entries);
file->md_index.entries = (H5FD_vfd_swmr_idx_entry_t *)
- H5FL_SEQ_FREE(H5FD_vfd_swmr_idx_entry_t,
- file->md_index.entries);
+ H5FL_SEQ_FREE(H5FD_vfd_swmr_idx_entry_t, file->md_index.entries);
}
/* Copy header and index to VFD */
@@ -1116,11 +1115,11 @@ done:
*-------------------------------------------------------------------------
*/
static htri_t
-H5FD__vfd_swmr_header_deserialize(H5FD_t *_file,
+H5FD__vfd_swmr_header_deserialize(H5FD_t *_file,
H5FD_vfd_swmr_md_header *md_header)
{
H5FD_vfd_swmr_t *file = /* VFD SWMR file struct */
- (H5FD_vfd_swmr_t *)_file;
+ (H5FD_vfd_swmr_t *)_file;
uint8_t image[H5FD_MD_HEADER_SIZE]; /* Buffer for element data */
uint32_t stored_chksum; /* Stored metadata checksum */
uint32_t computed_chksum; /* Computed metadata checksum */
@@ -1160,7 +1159,7 @@ H5FD__vfd_swmr_header_deserialize(H5FD_t *_file,
HGOTO_DONE(FALSE);
/* Verify stored and computed checksums are equal */
- H5F_get_checksums(image, H5FD_MD_HEADER_SIZE, &stored_chksum,
+ H5F_get_checksums(image, H5FD_MD_HEADER_SIZE, &stored_chksum,
&computed_chksum);
if (stored_chksum != computed_chksum)
@@ -1187,8 +1186,8 @@ H5FD__vfd_swmr_header_deserialize(H5FD_t *_file,
HDassert((size_t)(p - image) <= H5FD_MD_HEADER_SIZE);
#if 0 /* JRM */
- HDfprintf(stderr,
- "---read header ps/tick/idx_off/idx_len = %d / %lld / %lld / %lld\n",
+ HDfprintf(stderr,
+ "---read header ps/tick/idx_off/idx_len = %d / %lld / %lld / %lld\n",
md_header->fs_page_size, md_header->tick_num,
md_header->index_offset, md_header->index_length);
#endif /* JRM */
@@ -1205,7 +1204,7 @@ done:
* Function: H5FD__vfd_swmr_index_deserialize()
*
* Purpose: Load and decode the index in the metadata file
- * --Retry to get a file with size at least the size of the
+ * --Retry to get a file with size at least the size of the
* (header+index)
* --Retry on loading the valid magic and checksum for the index
* --Decode the index
@@ -1218,7 +1217,7 @@ done:
*
*/
static htri_t
-H5FD__vfd_swmr_index_deserialize(const H5FD_t *_file,
+H5FD__vfd_swmr_index_deserialize(const H5FD_t *_file,
H5FD_vfd_swmr_md_index *md_index, const H5FD_vfd_swmr_md_header *md_header)
{
const H5FD_vfd_swmr_t *file = (const H5FD_vfd_swmr_t *)_file;
@@ -1281,7 +1280,7 @@ H5FD__vfd_swmr_index_deserialize(const H5FD_t *_file,
* one write(2), and the header is written in a distinct
* second write(2), it is reasonable to expect that the
* index-write is complete when the index-read occurs.
- * So we should not read bad magic because we read a
+ * So we should not read bad magic because we read a
* "torn" write.
*
* (I am not sure I believe any recent version of UNIX or
@@ -1302,7 +1301,7 @@ H5FD__vfd_swmr_index_deserialize(const H5FD_t *_file,
HGOTO_DONE(FALSE);
/* Verify stored and computed checksums are equal */
- H5F_get_checksums(image, md_header->index_length, &stored_chksum,
+ H5F_get_checksums(image, md_header->index_length, &stored_chksum,
&computed_chksum);
if (stored_chksum != computed_chksum)
@@ -1310,8 +1309,8 @@ H5FD__vfd_swmr_index_deserialize(const H5FD_t *_file,
p = image + H5_SIZEOF_MAGIC;
- /* Deserialize the index info: tick number, number of entries, entries,
- * checksum
+ /* Deserialize the index info: tick number, number of entries, entries,
+ * checksum
*/
UINT64DECODE(p, md_index->tick_num);
UINT32DECODE(p, md_index->num_entries);
@@ -1343,8 +1342,8 @@ H5FD__vfd_swmr_index_deserialize(const H5FD_t *_file,
HDassert((size_t)(p - image) <= md_header->index_length);
#if 0 /* JRM */
- HDfprintf(stderr,
- " ---- read index tick/num_entries = %lld / %d \n",
+ HDfprintf(stderr,
+ " ---- read index tick/num_entries = %lld / %d \n",
md_index->tick_num, md_index->num_entries);
#endif /* JRM */
@@ -1369,16 +1368,16 @@ done:
/*-------------------------------------------------------------------------
* Function: H5FD_vfd_swmr_get_tick_and_idx()
*
- * Purpose: Retrieve tick_num, num_entries and index from the metadata
+ * Purpose: Retrieve tick_num, num_entries and index from the metadata
* file
*
- * --If the parameter "reload_hdr_and_index" is true, load and
- * decode the header and index via
- * H5FD__vfd_swmr_load_hdr_and_idx(), which may replace the
+ * --If the parameter "reload_hdr_and_index" is true, load and
+ * decode the header and index via
+ * H5FD__vfd_swmr_load_hdr_and_idx(), which may replace the
* VFD's local copies of header and index with the
* latest info read.
*
- * --Return tick_num, num_entries and index from the VFD's
+ * --Return tick_num, num_entries and index from the VFD's
* local copies.
*
* Return: Success: SUCCEED
@@ -1390,7 +1389,7 @@ done:
*/
herr_t
H5FD_vfd_swmr_get_tick_and_idx(H5FD_t *_file, hbool_t reload_hdr_and_index,
- uint64_t *tick_ptr, uint32_t *num_entries_ptr,
+ uint64_t *tick_ptr, uint32_t *num_entries_ptr,
H5FD_vfd_swmr_idx_entry_t index[])
{
H5FD_vfd_swmr_t *file = (H5FD_vfd_swmr_t *)_file; /* VFD SWMR file struct */
@@ -1418,7 +1417,7 @@ H5FD_vfd_swmr_get_tick_and_idx(H5FD_t *_file, hbool_t reload_hdr_and_index,
"not enough space to copy index");
}
- HDmemcpy(index, file->md_index.entries,
+ HDmemcpy(index, file->md_index.entries,
(file->md_index.num_entries *
sizeof(file->md_index.entries[0])));
}
@@ -1482,7 +1481,7 @@ H5FD_vfd_swmr_get_underlying_vfd(H5FD_t *_file)
/*-------------------------------------------------------------------------
* Function: H5FD_vfd_swmr_dump_status
*
- * Purpose: Dump a variety of information about the vfd swmr reader
+ * Purpose: Dump a variety of information about the vfd swmr reader
* vfd to stderr for debugging purposes.
*
* Return: Success: SUCCEED
@@ -1513,13 +1512,13 @@ H5FD_vfd_swmr_dump_status(H5FD_t *_file, uint64_t page)
in_index = TRUE;
}
- HDassert( ( i == 0 ) ||
+ HDassert( ( i == 0 ) ||
( index[i-1].hdf5_page_offset < index[i].hdf5_page_offset ) );
i++;
}
- HDfprintf(stderr,
+ HDfprintf(stderr,
"fd: tick = %" PRIu64 ", index_len = %" PRIu32 ", page %" PRIu64
" in index = %s.\n",
file->md_index.tick_num, num_entries, page,
@@ -1533,14 +1532,14 @@ H5FD_vfd_swmr_dump_status(H5FD_t *_file, uint64_t page)
/*-------------------------------------------------------------------------
* Function: H5FD_vfd_swmr_set_pb_configured
*
- * Purpose: Set the pb_configured field.
+ * Purpose: Set the pb_configured field.
*
* This notifies the VFD that the page buffer is configured,
* and that therefore all reads to the metadata file should
* read complete pages or multi-page metadata entries.
*
* This function in necessary because we haven't modified
- * the file open code to configure the page buffer prior
+ * the file open code to configure the page buffer prior
* to any file I/O when opening a file VFD SWMR reader.
* Once this is done, this function should be removed.
*