summaryrefslogtreecommitdiffstats
path: root/src/H5FDmulti.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FDmulti.c')
-rw-r--r--src/H5FDmulti.c125
1 files changed, 64 insertions, 61 deletions
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 7f65f11..168bbe1 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -281,8 +281,7 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const c
H5Eclear2(H5E_DEFAULT);
/* Initialize */
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
/* Treat global heap as raw data, not metadata */
memb_map[mt] = ((mt == H5FD_MEM_DRAW || mt == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : H5FD_MEM_SUPER);
memb_fapl[mt] = -1;
@@ -588,15 +587,16 @@ H5FD_multi_sb_size(H5FD_t *_file)
H5Eclear2(H5E_DEFAULT);
/* How many unique files? */
- UNIQUE_MEMBERS(file->fa.memb_map, mt) { nseen++; }
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
+ nseen++;
+ }
END_MEMBERS;
/* Addresses and EOA markers */
nbytes += nseen * 2 * 8;
/* Name templates */
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
size_t n = strlen(file->fa.memb_name[mt]) + 1;
nbytes += (n + 7) & ~((size_t)0x0007);
}
@@ -663,8 +663,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out
nseen = 0;
p = buf + 8;
assert(sizeof(haddr_t) <= 8);
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
memcpy(p, &(file->fa.memb_addr[mt]), sizeof(haddr_t));
p += sizeof(haddr_t);
memb_eoa = H5FDget_eoa(file->memb[mt], mt);
@@ -678,8 +677,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out
/* Encode all name templates */
p = buf + 8 + nseen * 2 * 8;
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
size_t n = strlen(file->fa.memb_name[mt]) + 1;
strncpy((char *)p, file->fa.memb_name[mt], n);
p += n;
@@ -735,8 +733,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "invalid multi superblock", -1);
/* Set default values */
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
memb_addr[mt] = HADDR_UNDEF;
memb_eoa[mt] = HADDR_UNDEF;
memb_name[mt] = NULL;
@@ -754,7 +751,9 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
map_changed = TRUE;
}
- UNIQUE_MEMBERS(map, mt) { nseen++; }
+ UNIQUE_MEMBERS (map, mt) {
+ nseen++;
+ }
END_MEMBERS;
buf += 8;
@@ -766,16 +765,14 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1);
ap = (haddr_t *)((void *)x); /* Extra (void *) cast to quiet "cast to create alignment" warning -
2019/07/05, QAK */
- UNIQUE_MEMBERS(map, mt)
- {
+ UNIQUE_MEMBERS (map, mt) {
memb_addr[_unmapped] = *ap++;
memb_eoa[_unmapped] = *ap++;
}
END_MEMBERS;
/* Decode name templates */
- UNIQUE_MEMBERS(map, mt)
- {
+ UNIQUE_MEMBERS (map, mt) {
size_t n = strlen((const char *)buf) + 1;
memb_name[_unmapped] = (const char *)buf;
buf += (n + 7) & ~((unsigned)0x0007);
@@ -790,15 +787,18 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
*/
if (map_changed) {
/* Commit map */
- ALL_MEMBERS(mt) { file->fa.memb_map[mt] = map[mt]; }
+ ALL_MEMBERS (mt) {
+ file->fa.memb_map[mt] = map[mt];
+ }
END_MEMBERS;
/* Close files which are unused now */
memset(in_use, 0, sizeof in_use);
- UNIQUE_MEMBERS(map, mt) { in_use[mt] = TRUE; }
+ UNIQUE_MEMBERS (map, mt) {
+ in_use[mt] = TRUE;
+ }
END_MEMBERS;
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (!in_use[mt] && file->memb[mt]) {
(void)H5FDclose(file->memb[mt]);
file->memb[mt] = NULL;
@@ -809,8 +809,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
}
/* Commit member starting addresses and name templates */
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
file->fa.memb_addr[mt] = memb_addr[mt];
if (memb_name[mt]) {
if (file->fa.memb_name[mt])
@@ -827,8 +826,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", -1);
/* Set the EOA marker for all open files */
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
if (file->memb[mt])
if (H5FDset_eoa(file->memb[mt], mt, memb_eoa[mt]) < 0)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1);
@@ -898,8 +896,7 @@ H5FD_multi_fapl_copy(const void *_old_fa)
H5Eclear2(H5E_DEFAULT);
memcpy(new_fa, old_fa, sizeof(H5FD_multi_fapl_t));
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (old_fa->memb_fapl[mt] >= 0) {
if (H5Iinc_ref(old_fa->memb_fapl[mt]) < 0) {
nerrors++;
@@ -918,8 +915,7 @@ H5FD_multi_fapl_copy(const void *_old_fa)
END_MEMBERS;
if (nerrors) {
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (new_fa->memb_fapl[mt] >= 0)
(void)H5Idec_ref(new_fa->memb_fapl[mt]);
if (new_fa->memb_name[mt])
@@ -955,8 +951,7 @@ H5FD_multi_fapl_free(void *_fa)
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (fa->memb_fapl[mt] >= 0)
if (H5Idec_ref(fa->memb_fapl[mt]) < 0)
H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", -1);
@@ -1018,8 +1013,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
}
fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id);
assert(fa);
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
file->fa.memb_map[mt] = fa->memb_map[mt];
file->fa.memb_addr[mt] = fa->memb_addr[mt];
if (fa->memb_fapl[mt] >= 0)
@@ -1055,8 +1049,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
error:
/* Cleanup and fail */
if (file) {
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (file->memb[mt])
(void)H5FDclose(file->memb[mt]);
if (file->fa.memb_fapl[mt] >= 0)
@@ -1099,8 +1092,7 @@ H5FD_multi_close(H5FD_t *_file)
H5Eclear2(H5E_DEFAULT);
/* Close as many members as possible */
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (file->memb[mt]) {
if (H5FDclose(file->memb[mt]) < 0) {
nerrors++;
@@ -1115,8 +1107,7 @@ H5FD_multi_close(H5FD_t *_file)
H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1);
/* Clean up other stuff */
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (file->fa.memb_fapl[mt] >= 0)
(void)H5Idec_ref(file->fa.memb_fapl[mt]);
if (file->fa.memb_name[mt])
@@ -1158,8 +1149,7 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
out_mt = mt;
if (f1->memb[mt] && f2->memb[mt])
break;
@@ -1268,13 +1258,15 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
* the query is for TYPE == H5FD_MEM_DEFAULT.
*/
if (H5FD_MEM_DEFAULT == type) {
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
haddr_t memb_eoa;
if (file->memb[mt]) {
/* Retrieve EOA */
- H5E_BEGIN_TRY { memb_eoa = H5FDget_eoa(file->memb[mt], mt); }
+ H5E_BEGIN_TRY
+ {
+ memb_eoa = H5FDget_eoa(file->memb[mt], mt);
+ }
H5E_END_TRY;
if (HADDR_UNDEF == memb_eoa)
@@ -1307,7 +1299,10 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
mmt = type;
if (file->memb[mmt]) {
- H5E_BEGIN_TRY { eoa = H5FDget_eoa(file->memb[mmt], mmt); }
+ H5E_BEGIN_TRY
+ {
+ eoa = H5FDget_eoa(file->memb[mmt], mmt);
+ }
H5E_END_TRY;
if (HADDR_UNDEF == eoa)
@@ -1385,7 +1380,10 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa)
assert(eoa >= file->fa.memb_addr[mmt]);
assert(eoa < file->memb_next[mmt]);
- H5E_BEGIN_TRY { status = H5FDset_eoa(file->memb[mmt], mmt, (eoa - file->fa.memb_addr[mmt])); }
+ H5E_BEGIN_TRY
+ {
+ status = H5FDset_eoa(file->memb[mmt], mmt, (eoa - file->fa.memb_addr[mmt]));
+ }
H5E_END_TRY;
if (status < 0)
H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1);
@@ -1421,13 +1419,15 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type)
H5Eclear2(H5E_DEFAULT);
if (H5FD_MEM_DEFAULT == type) {
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
haddr_t tmp_eof;
if (file->memb[mt]) {
/* Retrieve EOF */
- H5E_BEGIN_TRY { tmp_eof = H5FDget_eof(file->memb[mt], type); }
+ H5E_BEGIN_TRY
+ {
+ tmp_eof = H5FDget_eof(file->memb[mt], type);
+ }
H5E_END_TRY;
if (HADDR_UNDEF == tmp_eof)
@@ -1460,7 +1460,10 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type)
if (file->memb[mmt]) {
/* Retrieve EOF */
- H5E_BEGIN_TRY { eof = H5FDget_eof(file->memb[mmt], mmt); }
+ H5E_BEGIN_TRY
+ {
+ eof = H5FDget_eof(file->memb[mmt], mmt);
+ }
H5E_END_TRY;
if (HADDR_UNDEF == eof)
@@ -1544,8 +1547,7 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
/* XXX: NEED to work on this again */
if (file->pub.paged_aggr) {
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (file->memb[mt])
file->memb[mt]->paged_aggr = file->pub.paged_aggr;
}
@@ -1840,8 +1842,7 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw)
H5Eclear2(H5E_DEFAULT);
/* Lock all member files */
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
out_mt = mt;
if (file->memb[mt]) {
H5E_BEGIN_TRY
@@ -1900,8 +1901,7 @@ H5FD_multi_unlock(H5FD_t *_file)
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- ALL_MEMBERS(mt)
- {
+ ALL_MEMBERS (mt) {
if (file->memb[mt])
if (H5FDunlock(file->memb[mt]) < 0)
nerrors++;
@@ -1935,11 +1935,12 @@ compute_next(H5FD_multi_t *file)
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- ALL_MEMBERS(mt) { file->memb_next[mt] = HADDR_UNDEF; }
+ ALL_MEMBERS (mt) {
+ file->memb_next[mt] = HADDR_UNDEF;
+ }
END_MEMBERS;
- UNIQUE_MEMBERS(file->fa.memb_map, mt1)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt1) {
UNIQUE_MEMBERS2(file->fa.memb_map, mt2)
{
if (file->fa.memb_addr[mt1] < file->fa.memb_addr[mt2] &&
@@ -1988,8 +1989,7 @@ open_members(H5FD_multi_t *file)
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- UNIQUE_MEMBERS(file->fa.memb_map, mt)
- {
+ UNIQUE_MEMBERS (file->fa.memb_map, mt) {
if (file->memb[mt])
continue; /*already open*/
assert(file->fa.memb_name[mt]);
@@ -1999,7 +1999,10 @@ open_members(H5FD_multi_t *file)
sprintf(tmp, file->fa.memb_name[mt], file->name);
tmp[sizeof(tmp) - 1] = '\0';
- H5E_BEGIN_TRY { file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); }
+ H5E_BEGIN_TRY
+ {
+ file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF);
+ }
H5E_END_TRY;
if (!file->memb[mt]) {
if (!file->fa.relax || (file->flags & H5F_ACC_RDWR))