mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-04-12 17:31:09 +08:00
Cleanups and normalizations against incoming page_buffering changes.
This commit is contained in:
parent
4a42b04e59
commit
101fa7af8e
@ -1151,14 +1151,18 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
|
||||
|
||||
ALL_MEMBERS(mt) {
|
||||
out_mt = mt;
|
||||
if (f1->memb[mt] && f2->memb[mt]) break;
|
||||
if (!cmp) {
|
||||
if (f1->memb[mt]) cmp = -1;
|
||||
else if (f2->memb[mt]) cmp = 1;
|
||||
if(f1->memb[mt] && f2->memb[mt])
|
||||
break;
|
||||
if(!cmp) {
|
||||
if(f1->memb[mt])
|
||||
cmp = -1;
|
||||
else if(f2->memb[mt])
|
||||
cmp = 1;
|
||||
}
|
||||
} END_MEMBERS;
|
||||
assert(cmp || out_mt<H5FD_MEM_NTYPES);
|
||||
if (out_mt>=H5FD_MEM_NTYPES) return cmp;
|
||||
if(out_mt>=H5FD_MEM_NTYPES)
|
||||
return cmp;
|
||||
|
||||
return H5FDcmp(f1->memb[out_mt], f2->memb[out_mt]);
|
||||
}
|
||||
|
15
src/H5Fint.c
15
src/H5Fint.c
@ -869,7 +869,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
|
||||
} /* end if */
|
||||
|
||||
/* With the shutdown modifications, the contents of the metadata cache
|
||||
* should be clean at this point, with the possible exception of the
|
||||
* should be clean at this point, with the possible exception of the
|
||||
* the superblock and superblock extension.
|
||||
*
|
||||
* Verify this.
|
||||
@ -892,18 +892,21 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
|
||||
* (assuming they are persistent). In this case, closing the
|
||||
* free space managers should have no effect on EOA.
|
||||
*
|
||||
* -- JRM
|
||||
* -- JRM
|
||||
*/
|
||||
if(H5F_ACC_RDWR & H5F_INTENT(f)) {
|
||||
if(H5MF_close(f, dxpl_id) < 0)
|
||||
/* Push error, but keep going*/
|
||||
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info")
|
||||
|
||||
/* at this point, only the superblock and superblock
|
||||
/* at this point, only the superblock and superblock
|
||||
* extension should be dirty.
|
||||
*/
|
||||
HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM));
|
||||
|
||||
/* Flush the file again (if requested), as shutting down the
|
||||
* free space manager may dirty some data structures again.
|
||||
*/
|
||||
if(flush) {
|
||||
/* Clear status_flags */
|
||||
f->shared->sblock->status_flags &= (uint8_t)(~H5F_SUPER_WRITE_ACCESS);
|
||||
@ -918,7 +921,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
|
||||
* so that the eoa value corresponds to the end of the
|
||||
* space written to in the file.
|
||||
*
|
||||
* At most, this should change the superblock or the
|
||||
* At most, this should change the superblock or the
|
||||
* superblock extension messages.
|
||||
*/
|
||||
if(H5MF_free_aggrs(f, dxpl_id) < 0)
|
||||
@ -930,7 +933,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
|
||||
/* Push error, but keep going*/
|
||||
HDONE_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "low level truncate failed")
|
||||
|
||||
/* at this point, only the superblock and superblock
|
||||
/* at this point, only the superblock and superblock
|
||||
* extension should be dirty.
|
||||
*/
|
||||
HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM));
|
||||
@ -952,7 +955,7 @@ H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush)
|
||||
f->shared->sblock = NULL;
|
||||
} /* end if */
|
||||
|
||||
/* with the possible exception of the superblock and superblock
|
||||
/* with the possible exception of the superblock and superblock
|
||||
* extension, the metadata cache should be clean at this point.
|
||||
*
|
||||
* Verify this.
|
||||
|
@ -232,9 +232,9 @@ haddr_t
|
||||
H5MF_aggr_alloc(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr,
|
||||
H5F_blk_aggr_t *other_aggr, H5FD_mem_t type, hsize_t size)
|
||||
{
|
||||
haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */
|
||||
hsize_t eoa_frag_size = 0; /* Size of fragment at EOA */
|
||||
haddr_t eoa = HADDR_UNDEF; /* Initial EOA for the file */
|
||||
haddr_t eoa_frag_addr = HADDR_UNDEF; /* Address of fragment at EOA */
|
||||
hsize_t eoa_frag_size = 0; /* Size of fragment at EOA */
|
||||
haddr_t eoa = HADDR_UNDEF; /* Initial EOA for the file */
|
||||
haddr_t ret_value = HADDR_UNDEF; /* Return value */
|
||||
|
||||
FUNC_ENTER_NOAPI(HADDR_UNDEF)
|
||||
@ -543,7 +543,8 @@ H5MF_aggr_try_extend(H5F_t *f, hid_t dxpl_id, H5F_blk_aggr_t *aggr,
|
||||
} /* end else-if */
|
||||
} /* end else */
|
||||
} /* end if */
|
||||
else { /* The aggreator is not at end of file */
|
||||
else {
|
||||
/* The aggreator is not at end of file */
|
||||
/* Check if aggregator has enough internal space to satisfy the extension. */
|
||||
if(aggr->size >= extra_requested) {
|
||||
/* Extend block into aggregator */
|
||||
|
17
test/cache.c
17
test/cache.c
@ -15898,7 +15898,6 @@ check_destroy_pinned_err(void)
|
||||
* should fail. Unpin the entry and flush destroy again -- should
|
||||
* succeed.
|
||||
*/
|
||||
|
||||
if(pass) {
|
||||
|
||||
reset_entries();
|
||||
@ -15909,7 +15908,7 @@ check_destroy_pinned_err(void)
|
||||
protect_entry(file_ptr, 0, 0);
|
||||
unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG);
|
||||
|
||||
if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0 ) {
|
||||
if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0) {
|
||||
pass = FALSE;
|
||||
failure_mssg = "unexpected failure of prep for file close.\n";
|
||||
} /* end if */
|
||||
@ -15925,9 +15924,8 @@ check_destroy_pinned_err(void)
|
||||
pass = FALSE;
|
||||
failure_mssg = "destroy failed after unpin.\n";
|
||||
} /* end if */
|
||||
else {
|
||||
else
|
||||
file_ptr->shared->cache = NULL;
|
||||
} /* end else */
|
||||
} /* end else */
|
||||
|
||||
if(saved_cache != NULL) {
|
||||
@ -15989,16 +15987,16 @@ check_destroy_protected_err(void)
|
||||
file_ptr = setup_cache((size_t)(2 * 1024),
|
||||
(size_t)(1 * 1024));
|
||||
|
||||
/* Note: normally this call would go just before the series of
|
||||
* flushes prior to file close -- in particular, all entries
|
||||
/* Note: normally this call would go just before the series of
|
||||
* flushes prior to file close -- in particular, all entries
|
||||
* should be unprotected when this call is made.
|
||||
*
|
||||
* Thus H5C_prep_for_file_close() contains an assert to verify
|
||||
* this. Since this assert would be triggered by the condition
|
||||
* this. Since this assert would be triggered by the condition
|
||||
* we are trying to test, put the call to H5C_prep_for_file_close()
|
||||
* prior to the final protect call.
|
||||
*/
|
||||
if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0 ) {
|
||||
if(H5C_prep_for_file_close(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0) {
|
||||
pass = FALSE;
|
||||
failure_mssg = "unexpected failure of prep for file close.\n";
|
||||
} /* end if */
|
||||
@ -28154,8 +28152,7 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion)
|
||||
}
|
||||
|
||||
if(show_progress) /* 0 */
|
||||
HDfprintf(stdout, "\n%s: check point %d -- pass %d\n",
|
||||
FUNC, checkpoint++, pass);
|
||||
HDfprintf(stdout, "\n%s: check point %d -- pass %d\n", FUNC, checkpoint++, pass);
|
||||
|
||||
if(pass) {
|
||||
|
||||
|
@ -953,9 +953,9 @@ check_dense_attribute_tags(void)
|
||||
int verbose = FALSE; /* verbose file outout */
|
||||
int i = 0; /* iterator */
|
||||
hid_t fapl = -1; /* File access property list */
|
||||
haddr_t d_tag = 0; /* Dataset tag value */
|
||||
haddr_t root_tag = 0; /* Root group tag value */
|
||||
char attrname[500]; /* Name of attribute */
|
||||
haddr_t d_tag = 0; /* Dataset tag value */
|
||||
haddr_t root_tag = 0; /* Root group tag value */
|
||||
char attrname[500]; /* Name of attribute */
|
||||
|
||||
/* Testing Macro */
|
||||
TESTING("tag application during dense attribute manipulation");
|
||||
@ -1533,6 +1533,7 @@ check_attribute_rename_tags(hid_t fcpl, int type)
|
||||
/* Close and Reopen the file and group */
|
||||
if ( H5Gclose(gid) < 0 ) TEST_ERROR;
|
||||
if ( H5Fclose(fid) < 0 ) TEST_ERROR;
|
||||
|
||||
if ( (fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0 ) TEST_ERROR;
|
||||
if ( (gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0 ) TEST_ERROR;
|
||||
|
||||
|
@ -820,7 +820,7 @@ long_links(hid_t fapl, hbool_t new_format)
|
||||
static int
|
||||
toomany(hid_t fapl, hbool_t new_format)
|
||||
{
|
||||
hid_t fid = (-1); /* File ID */
|
||||
hid_t fid = (-1); /* File ID */
|
||||
hid_t gid = (-1), gid2 = (-1); /* Group IDs */
|
||||
char objname[NAME_BUF_SIZE]; /* Object name */
|
||||
char filename[NAME_BUF_SIZE];
|
||||
@ -2623,7 +2623,6 @@ external_link_toomany(hid_t fapl, hbool_t new_format)
|
||||
/* Close first file */
|
||||
if(H5Fclose(fid) < 0) TEST_ERROR
|
||||
|
||||
|
||||
PASSED();
|
||||
return 0;
|
||||
|
||||
|
123
test/tfile.c
123
test/tfile.c
@ -103,14 +103,14 @@
|
||||
#define USERBLOCK_SIZE ((hsize_t) 512)
|
||||
|
||||
/* Declarations for test_filespace_*() */
|
||||
#define FILENAME_LEN 1024 /* length of file name */
|
||||
#define FILENAME_LEN 1024 /* length of file name */
|
||||
#define CORE_INCREMENT 1024 /* core file */
|
||||
#define FAMILY_SIZE 1024 /* family file */
|
||||
#define DSETNAME "dset" /* Name of dataset */
|
||||
#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */
|
||||
#define READ_OLD_BUFSIZE 1024 /* Buffer for holding file data */
|
||||
#define FILE5 "tfile5.h5" /* Test file */
|
||||
#define TEST_THRESHOLD10 10 /* Free space section threshold */
|
||||
#define DSETNAME "dset" /* Name of dataset */
|
||||
#define NELMTS(X) (sizeof(X)/sizeof(X[0])) /* # of elements */
|
||||
#define READ_OLD_BUFSIZE 1024 /* Buffer for holding file data */
|
||||
#define FILE5 "tfile5.h5" /* Test file */
|
||||
#define TEST_THRESHOLD10 10 /* Free space section threshold */
|
||||
|
||||
/* Declaration for test_libver_macros2() */
|
||||
#define FILE6 "tfile6.h5" /* Test file */
|
||||
@ -120,7 +120,8 @@
|
||||
#define NGROUPS 2
|
||||
#define NDSETS 4
|
||||
|
||||
const char *OLD_FILENAME[] = { /* Files created under 1.6 branch and 1.8 branch */
|
||||
/* Files created under 1.6 branch and 1.8 branch--used in test_filespace_compatible() */
|
||||
const char *OLD_FILENAME[] = {
|
||||
"filespace_1_6.h5", /* 1.6 HDF5 file */
|
||||
"filespace_1_8.h5" /* 1.8 HDF5 file */
|
||||
};
|
||||
@ -888,9 +889,8 @@ test_file_close(void)
|
||||
ret = H5Gclose(group_id3);
|
||||
CHECK(ret, FAIL, "H5Gclose");
|
||||
break;
|
||||
|
||||
case H5F_CLOSE_DEFAULT:
|
||||
default:
|
||||
case H5F_CLOSE_DEFAULT:
|
||||
default:
|
||||
CHECK(fc_degree, H5F_CLOSE_DEFAULT, "H5Pget_fclose_degree");
|
||||
break;
|
||||
}
|
||||
@ -3605,36 +3605,36 @@ static void
|
||||
test_filespace_compatible(void)
|
||||
{
|
||||
int fd_old = (-1), fd_new = (-1); /* File descriptors for copying data */
|
||||
hid_t fid; /* File id */
|
||||
hid_t fcpl; /* File creation property list template */
|
||||
hid_t did; /* Dataset id */
|
||||
int check[100]; /* Temporary buffer for verifying dataset data */
|
||||
int rdbuf[100]; /* Temporary buffer for reading in dataset data */
|
||||
hid_t fid = -1; /* File id */
|
||||
hid_t did = -1; /* Dataset id */
|
||||
hid_t fcpl; /* File creation property list template */
|
||||
int check[100]; /* Temporary buffer for verifying dataset data */
|
||||
int rdbuf[100]; /* Temporary buffer for reading in dataset data */
|
||||
uint8_t buf[READ_OLD_BUFSIZE]; /* temporary buffer for reading */
|
||||
ssize_t nread; /* Number of bytes read in */
|
||||
unsigned i, j; /* Local index variable */
|
||||
hssize_t free_space; /* Amount of free space in the file */
|
||||
hsize_t threshold; /* Free space section threshold */
|
||||
ssize_t nread; /* Number of bytes read in */
|
||||
unsigned i, j; /* Local index variable */
|
||||
hssize_t free_space; /* Amount of free-space in the file */
|
||||
hsize_t threshold; /* Free-space section threshold */
|
||||
H5F_file_space_type_t strategy; /* File space handling strategy */
|
||||
herr_t ret; /* Return value */
|
||||
herr_t ret; /* Return value */
|
||||
|
||||
/* Output message about test being performed */
|
||||
MESSAGE(5, ("Testing File space compatibility for 1.6 and 1.8 files\n"));
|
||||
MESSAGE(5, ("File space compatibility testing for 1.6 and 1.8 files\n"));
|
||||
|
||||
for(j = 0; j < NELMTS(OLD_FILENAME); j++) {
|
||||
const char *filename = H5_get_srcdir_filename(OLD_FILENAME[j]); /* Corrected test file name */
|
||||
|
||||
/* Copy old file into test file */
|
||||
/* Open and copy the test file into a temporary file */
|
||||
fd_old = HDopen(filename, O_RDONLY, 0666);
|
||||
CHECK(fd_old, FAIL, "HDopen");
|
||||
fd_new = HDopen(FILE5, O_RDWR|O_CREAT|O_TRUNC, 0666);
|
||||
CHECK(fd_new, FAIL, "HDopen");
|
||||
|
||||
/* Copy data */
|
||||
while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0) {
|
||||
ssize_t write_err = HDwrite(fd_new, buf, (size_t)nread);
|
||||
CHECK(write_err, -1, "HDwrite");
|
||||
} /* end while */
|
||||
while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0) {
|
||||
ssize_t write_err = HDwrite(fd_new, buf, (size_t)nread);
|
||||
CHECK(write_err, -1, "HDwrite");
|
||||
} /* end while */
|
||||
|
||||
/* Close the files */
|
||||
ret = HDclose(fd_old);
|
||||
@ -3642,7 +3642,7 @@ test_filespace_compatible(void)
|
||||
ret = HDclose(fd_new);
|
||||
CHECK(ret, FAIL, "HDclose");
|
||||
|
||||
/* Open the test file */
|
||||
/* Open the temporary test file */
|
||||
fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT);
|
||||
CHECK(fid, FAIL, "H5Fopen");
|
||||
|
||||
@ -3651,10 +3651,11 @@ test_filespace_compatible(void)
|
||||
CHECK(free_space, FAIL, "H5Fget_freespace");
|
||||
VERIFY(free_space, (hssize_t)0, "H5Fget_freespace");
|
||||
|
||||
/* Get the file's file creation property list */
|
||||
/* Get the file's file creation property list */
|
||||
fcpl = H5Fget_create_plist(fid);
|
||||
CHECK(fcpl, FAIL, "H5Fget_create_plist");
|
||||
|
||||
/* Retrieve the file space handling strategy and threshold */
|
||||
fcpl = H5Fget_create_plist(fid);
|
||||
CHECK(fcpl, FAIL, "H5Fget_create_plist");
|
||||
ret = H5Pget_file_space(fcpl, &strategy, &threshold);
|
||||
CHECK(ret, FAIL, "H5Pget_file_space");
|
||||
|
||||
@ -3685,13 +3686,13 @@ test_filespace_compatible(void)
|
||||
ret = H5Ldelete(fid, DSETNAME, H5P_DEFAULT);
|
||||
CHECK(ret, FAIL, "H5Ldelete");
|
||||
|
||||
/* Close the plist */
|
||||
ret = H5Pclose(fcpl);
|
||||
CHECK(ret, FAIL, "H5Pclose");
|
||||
/* Close the plist */
|
||||
ret = H5Pclose(fcpl);
|
||||
CHECK(ret, FAIL, "H5Pclose");
|
||||
|
||||
/* Close the file */
|
||||
ret = H5Fclose(fid);
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
/* Close the file */
|
||||
ret = H5Fclose(fid);
|
||||
CHECK(ret, FAIL, "H5Fclose");
|
||||
|
||||
/* Re-Open the file */
|
||||
fid = H5Fopen(FILE5, H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
@ -4090,37 +4091,37 @@ test_file(void)
|
||||
/* Output message about test being performed */
|
||||
MESSAGE(5, ("Testing Low-Level File I/O\n"));
|
||||
|
||||
test_file_create(); /* Test file creation(also creation templates)*/
|
||||
test_file_open(); /* Test file opening */
|
||||
test_file_reopen(); /* Test file reopening */
|
||||
test_file_close(); /* Test file close behavior */
|
||||
test_get_file_id(); /* Test H5Iget_file_id */
|
||||
test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */
|
||||
test_file_perm(); /* Test file access permissions */
|
||||
test_file_perm2(); /* Test file access permission again */
|
||||
test_file_create(); /* Test file creation(also creation templates)*/
|
||||
test_file_open(); /* Test file opening */
|
||||
test_file_reopen(); /* Test file reopening */
|
||||
test_file_close(); /* Test file close behavior */
|
||||
test_get_file_id(); /* Test H5Iget_file_id */
|
||||
test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */
|
||||
test_file_perm(); /* Test file access permissions */
|
||||
test_file_perm2(); /* Test file access permission again */
|
||||
test_file_freespace(); /* Test file free space information */
|
||||
test_file_ishdf5(); /* Test detecting HDF5 files correctly */
|
||||
test_file_open_dot(); /* Test opening objects with "." for a name */
|
||||
test_file_open_overlap(); /* Test opening files in an overlapping manner */
|
||||
test_file_getname(); /* Test basic H5Fget_name() functionality */
|
||||
test_file_double_root_open(); /* Test opening root group from two files works properly */
|
||||
test_file_double_group_open(); /* Test opening same group from two files works properly */
|
||||
test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */
|
||||
test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */
|
||||
test_file_ishdf5(); /* Test detecting HDF5 files correctly */
|
||||
test_file_open_dot(); /* Test opening objects with "." for a name */
|
||||
test_file_open_overlap(); /* Test opening files in an overlapping manner */
|
||||
test_file_getname(); /* Test basic H5Fget_name() functionality */
|
||||
test_file_double_root_open(); /* Test opening root group from two files works properly */
|
||||
test_file_double_group_open(); /* Test opening same group from two files works properly */
|
||||
test_file_double_dataset_open(); /* Test opening same dataset from two files works properly */
|
||||
test_file_double_datatype_open(); /* Test opening same named datatype from two files works properly */
|
||||
test_file_double_file_dataset_open(TRUE);
|
||||
test_file_double_file_dataset_open(FALSE);
|
||||
test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */
|
||||
test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */
|
||||
test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */
|
||||
test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly */
|
||||
test_userblock_file_size(); /* Tests that files created with a userblock have the correct size */
|
||||
test_cached_stab_info(); /* Tests that files are created with cached stab info in the superblock */
|
||||
test_rw_noupdate(); /* Test to ensure that RW permissions don't write the file unless dirtied */
|
||||
test_userblock_alignment(); /* Tests that files created with a userblock and alignment interact properly */
|
||||
test_filespace_sects(); /* Test file free space section information */
|
||||
test_filespace_info(); /* Test file creation public routines:H5Pget/set_file_space */
|
||||
test_filespace_compatible();/* Test compatibility for file space management */
|
||||
test_libver_bounds(); /* Test compatibility for file space management */
|
||||
test_libver_macros(); /* Test the macros for library version comparison */
|
||||
test_libver_macros2(); /* Test the macros for library version comparison */
|
||||
test_filespace_compatible(); /* Test compatibility for file space management */
|
||||
test_libver_bounds(); /* Test compatibility for file space management */
|
||||
test_libver_macros(); /* Test the macros for library version comparison */
|
||||
test_libver_macros2(); /* Test the macros for library version comparison */
|
||||
#ifndef H5_NO_DEPRECATED_SYMBOLS
|
||||
test_deprec(); /* Test deprecated routines */
|
||||
test_deprec(); /* Test deprecated routines */
|
||||
#endif /* H5_NO_DEPRECATED_SYMBOLS */
|
||||
} /* test_file() */
|
||||
|
||||
|
@ -2440,9 +2440,9 @@ int
|
||||
main(void)
|
||||
{
|
||||
hid_t fapl, fapl2, file;
|
||||
int nerrors = 0;
|
||||
int nerrors = 0;
|
||||
char filename[1024];
|
||||
unsigned new_format;
|
||||
unsigned new_format;
|
||||
|
||||
/* Metadata cache parameters */
|
||||
int mdc_nelmts;
|
||||
|
@ -36,16 +36,17 @@ typedef enum part_t {
|
||||
UC_WRITER, /* writer only */
|
||||
UC_READER /* reader only */
|
||||
} part_t;
|
||||
|
||||
typedef struct options_t {
|
||||
int chunksize; /* chunks are chunksize^2 planes */
|
||||
int chunkplanes; /* number of planes per chunk, default 1 */
|
||||
hsize_t chunksize; /* chunks are chunksize^2 planes */
|
||||
hsize_t chunkplanes; /* number of planes per chunk, default 1 */
|
||||
hsize_t chunkdims[UC_RANK]; /* chunk dims is (chunkplan, chunksize, chunksize) */
|
||||
hsize_t dims[UC_RANK]; /* dataset initial dims */
|
||||
hsize_t max_dims[UC_RANK]; /* dataset max dims */
|
||||
hsize_t nplanes; /* number of planes to write, default proportional to chunksize */
|
||||
char *filename; /* use case data filename */
|
||||
part_t launch; /* launch writer, reader or both */
|
||||
int use_swmr; /* use swmr open (1) or not */
|
||||
hbool_t use_swmr; /* use swmr open (1) or not */
|
||||
int iterations; /* iterations, default 1 */
|
||||
} options_t;
|
||||
|
||||
|
@ -82,22 +82,22 @@ int setup_parameters(int argc, char * const argv[])
|
||||
/* use case defaults */
|
||||
HDmemset(&UC_opts, 0, sizeof(options_t));
|
||||
UC_opts.chunksize = Chunksize_DFT;
|
||||
UC_opts.use_swmr = 1; /* use swmr open */
|
||||
UC_opts.use_swmr = TRUE; /* use swmr open */
|
||||
UC_opts.iterations = 1;
|
||||
UC_opts.chunkplanes = 1;
|
||||
|
||||
/* parse options */
|
||||
if (parse_option(argc, argv) < 0){
|
||||
if (parse_option(argc, argv) < 0)
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* set chunk dims */
|
||||
UC_opts.chunkdims[0] = (hsize_t)UC_opts.chunkplanes;
|
||||
UC_opts.chunkdims[1] = UC_opts.chunkdims[2] = (hsize_t)UC_opts.chunksize;
|
||||
UC_opts.chunkdims[0] = UC_opts.chunkplanes;
|
||||
UC_opts.chunkdims[1] = UC_opts.chunkdims[2] = UC_opts.chunksize;
|
||||
|
||||
/* set dataset initial and max dims */
|
||||
UC_opts.dims[0] = 0;
|
||||
UC_opts.max_dims[0] = H5S_UNLIMITED;
|
||||
UC_opts.dims[1] = UC_opts.dims[2] = UC_opts.max_dims[1] = UC_opts.max_dims[2] = (hsize_t)UC_opts.chunksize;
|
||||
UC_opts.dims[1] = UC_opts.dims[2] = UC_opts.max_dims[1] = UC_opts.max_dims[2] = UC_opts.chunksize;
|
||||
|
||||
/* set nplanes */
|
||||
if (UC_opts.nplanes == 0)
|
||||
@ -125,7 +125,7 @@ main(int argc, char *argv[])
|
||||
int child_wait_option=0;
|
||||
int ret_value = 0;
|
||||
int child_ret_value;
|
||||
hbool_t send_wait = 0;
|
||||
hbool_t send_wait = FALSE;
|
||||
|
||||
/* initialization */
|
||||
if (setup_parameters(argc, argv) < 0){
|
||||
@ -135,7 +135,7 @@ main(int argc, char *argv[])
|
||||
/* Determine the need to send/wait message file*/
|
||||
if(UC_opts.launch == UC_READWRITE) {
|
||||
HDunlink(WRITER_MESSAGE);
|
||||
send_wait = 1;
|
||||
send_wait = TRUE;
|
||||
}
|
||||
|
||||
/* ==============================================================*/
|
||||
@ -157,12 +157,12 @@ main(int argc, char *argv[])
|
||||
|
||||
if (UC_opts.launch==UC_READWRITE){
|
||||
/* fork process */
|
||||
if((childpid = fork()) < 0) {
|
||||
perror("fork");
|
||||
if((childpid = HDfork()) < 0) {
|
||||
HDperror("fork");
|
||||
Hgoto_error(1);
|
||||
};
|
||||
};
|
||||
mypid = getpid();
|
||||
mypid = HDgetpid();
|
||||
|
||||
/* ============= */
|
||||
/* launch reader */
|
||||
@ -193,8 +193,8 @@ main(int argc, char *argv[])
|
||||
/* If readwrite, collect exit code of child process */
|
||||
/* ================================================ */
|
||||
if (UC_opts.launch == UC_READWRITE){
|
||||
if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0){
|
||||
perror("waitpid");
|
||||
if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0){
|
||||
HDperror("waitpid");
|
||||
Hgoto_error(1);
|
||||
}
|
||||
if (WIFEXITED(child_status)){
|
||||
|
@ -69,7 +69,7 @@ parse_option(int argc, char * const argv[])
|
||||
UC_opts.filename = optarg;
|
||||
break;
|
||||
case 'i': /* iterations */
|
||||
if ((UC_opts.iterations = atoi(optarg)) <= 0){
|
||||
if ((UC_opts.iterations = HDatoi(optarg)) <= 0) {
|
||||
fprintf(stderr, "bad iterations number %s, must be a positive integer\n", optarg);
|
||||
usage(progname_g);
|
||||
Hgoto_error(-1);
|
||||
@ -91,28 +91,28 @@ parse_option(int argc, char * const argv[])
|
||||
}
|
||||
break;
|
||||
case 'n': /* number of planes to write/read */
|
||||
if ((UC_opts.nplanes = atoi(optarg)) <= 0){
|
||||
if ((UC_opts.nplanes = HDstrtoul(optarg, NULL, 0)) <= 0) {
|
||||
fprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg);
|
||||
usage(progname_g);
|
||||
Hgoto_error(-1);
|
||||
};
|
||||
break;
|
||||
case 's': /* use swmr file open mode */
|
||||
if ((UC_opts.use_swmr = atoi(optarg)) < 0){
|
||||
if ((UC_opts.use_swmr = HDatoi(optarg)) < 0) {
|
||||
fprintf(stderr, "swmr value should be 0(no) or 1(yes)\n");
|
||||
usage(progname_g);
|
||||
Hgoto_error(-1);
|
||||
};
|
||||
break;
|
||||
case 'y': /* Number of planes per chunk */
|
||||
if ((UC_opts.chunkplanes = atoi(optarg)) <= 0){
|
||||
if ((UC_opts.chunkplanes = HDstrtoul(optarg, NULL, 0)) <= 0) {
|
||||
fprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n", optarg);
|
||||
usage(progname_g);
|
||||
Hgoto_error(-1);
|
||||
};
|
||||
break;
|
||||
case 'z': /* size of chunk=(z,z) */
|
||||
if ((UC_opts.chunksize = atoi(optarg)) <= 0){
|
||||
if ((UC_opts.chunksize = HDstrtoull(optarg, NULL, 0)) <= 0) {
|
||||
fprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg);
|
||||
usage(progname_g);
|
||||
Hgoto_error(-1);
|
||||
@ -361,7 +361,7 @@ int write_uc_file(hbool_t tosend)
|
||||
bufptr = buffer;
|
||||
for (j=0; j<dims[1]; j++)
|
||||
for (k=0; k<dims[2]; k++)
|
||||
*bufptr++ = i;
|
||||
*bufptr++ = (UC_CTYPE)i;
|
||||
|
||||
/* Cork the dataset's metadata in the cache, if SWMR is enabled */
|
||||
if(UC_opts.use_swmr)
|
||||
|
@ -31,73 +31,73 @@
|
||||
#include "H5private.h"
|
||||
|
||||
h5tool_format_t h5tools_dataformat = {
|
||||
0, /*raw */
|
||||
0, /*raw */
|
||||
|
||||
"", /*fmt_raw */
|
||||
"%d", /*fmt_int */
|
||||
"%u", /*fmt_uint */
|
||||
"%hhd", /*fmt_schar */
|
||||
"%u", /*fmt_uchar */
|
||||
"%d", /*fmt_short */
|
||||
"%u", /*fmt_ushort */
|
||||
"%ld", /*fmt_long */
|
||||
"%lu", /*fmt_ulong */
|
||||
NULL, /*fmt_llong */
|
||||
NULL, /*fmt_ullong */
|
||||
"%g", /*fmt_double */
|
||||
"%g", /*fmt_float */
|
||||
"", /*fmt_raw */
|
||||
"%d", /*fmt_int */
|
||||
"%u", /*fmt_uint */
|
||||
"%hhd", /*fmt_schar */
|
||||
"%u", /*fmt_uchar */
|
||||
"%d", /*fmt_short */
|
||||
"%u", /*fmt_ushort */
|
||||
"%ld", /*fmt_long */
|
||||
"%lu", /*fmt_ulong */
|
||||
NULL, /*fmt_llong */
|
||||
NULL, /*fmt_ullong */
|
||||
"%g", /*fmt_double */
|
||||
"%g", /*fmt_float */
|
||||
|
||||
0, /*ascii */
|
||||
0, /*str_locale */
|
||||
0, /*str_repeat */
|
||||
0, /*ascii */
|
||||
0, /*str_locale */
|
||||
0, /*str_repeat */
|
||||
|
||||
"[ ", /*arr_pre */
|
||||
",", /*arr_sep */
|
||||
" ]", /*arr_suf */
|
||||
1, /*arr_linebreak */
|
||||
"[ ", /*arr_pre */
|
||||
",", /*arr_sep */
|
||||
" ]", /*arr_suf */
|
||||
1, /*arr_linebreak */
|
||||
|
||||
"", /*cmpd_name */
|
||||
",\n", /*cmpd_sep */
|
||||
"{", /*cmpd_pre */
|
||||
"}", /*cmpd_suf */
|
||||
"\n", /*cmpd_end */
|
||||
NULL, /* cmpd_listv */
|
||||
"", /*cmpd_name */
|
||||
",\n", /*cmpd_sep */
|
||||
"{", /*cmpd_pre */
|
||||
"}", /*cmpd_suf */
|
||||
"\n", /*cmpd_end */
|
||||
NULL, /* cmpd_listv */
|
||||
|
||||
", ", /*vlen_sep */
|
||||
"(", /*vlen_pre */
|
||||
")", /*vlen_suf */
|
||||
"", /*vlen_end */
|
||||
", ", /*vlen_sep */
|
||||
"(", /*vlen_pre */
|
||||
")", /*vlen_suf */
|
||||
"", /*vlen_end */
|
||||
|
||||
"%s", /*elmt_fmt */
|
||||
",", /*elmt_suf1 */
|
||||
" ", /*elmt_suf2 */
|
||||
"%s", /*elmt_fmt */
|
||||
",", /*elmt_suf1 */
|
||||
" ", /*elmt_suf2 */
|
||||
|
||||
"", /*idx_n_fmt */
|
||||
"", /*idx_sep */
|
||||
"", /*idx_fmt */
|
||||
"", /*idx_n_fmt */
|
||||
"", /*idx_sep */
|
||||
"", /*idx_fmt */
|
||||
|
||||
80, /*line_ncols *//*standard default columns */
|
||||
0, /*line_per_line */
|
||||
"", /*line_pre */
|
||||
"%s", /*line_1st */
|
||||
"%s", /*line_cont */
|
||||
"", /*line_suf */
|
||||
"", /*line_sep */
|
||||
1, /*line_multi_new */
|
||||
" ", /*line_indent */
|
||||
80, /*line_ncols *//*standard default columns */
|
||||
0, /*line_per_line */
|
||||
"", /*line_pre */
|
||||
"%s", /*line_1st */
|
||||
"%s", /*line_cont */
|
||||
"", /*line_suf */
|
||||
"", /*line_sep */
|
||||
1, /*line_multi_new */
|
||||
" ", /*line_indent */
|
||||
|
||||
1, /*skip_first */
|
||||
1, /*skip_first */
|
||||
|
||||
1, /*obj_hidefileno */
|
||||
" "H5_PRINTF_HADDR_FMT, /*obj_format */
|
||||
1, /*obj_hidefileno */
|
||||
" "H5_PRINTF_HADDR_FMT, /*obj_format */
|
||||
|
||||
1, /*dset_hidefileno */
|
||||
"DATASET %s ", /*dset_format */
|
||||
"%s", /*dset_blockformat_pre */
|
||||
"%s", /*dset_ptformat_pre */
|
||||
"%s", /*dset_ptformat */
|
||||
1, /*array indices */
|
||||
1 /*escape non printable characters */
|
||||
1, /*dset_hidefileno */
|
||||
"DATASET %s ", /*dset_format */
|
||||
"%s", /*dset_blockformat_pre */
|
||||
"%s", /*dset_ptformat_pre */
|
||||
"%s", /*dset_ptformat */
|
||||
1, /*array indices */
|
||||
1 /*escape non printable characters */
|
||||
};
|
||||
|
||||
const h5tools_dump_header_t h5tools_standardformat = {
|
||||
|
@ -69,7 +69,7 @@ static h5tool_format_t xml_dataformat = {
|
||||
"", /*cmpd_pre */
|
||||
"", /*cmpd_suf */
|
||||
"", /*cmpd_end */
|
||||
"", /*cmpd_listv */
|
||||
NULL, /*cmpd_listv */
|
||||
|
||||
" ", /*vlen_sep */
|
||||
" ", /*vlen_pre */
|
||||
|
Loading…
x
Reference in New Issue
Block a user