summaryrefslogtreecommitdiffstats
path: root/src/H5Gnode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Gnode.c')
-rw-r--r--src/H5Gnode.c81
1 files changed, 32 insertions, 49 deletions
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 9cfabe3..f88c89c 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -315,7 +315,7 @@ H5G_node_debug_key (FILE *stream, H5F_t *f, hid_t dxpl_id, int indent, int fwidt
s = H5HL_offset_into(f, heap, key->offset);
HDfprintf (stream, "%s\n", s);
- if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, FALSE) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
done:
@@ -834,7 +834,7 @@ H5G_node_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke
ret_value = HDstrcmp(s1, s2);
done:
- if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, FALSE) < 0)
+ if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
FUNC_LEAVE_NOAPI(ret_value);
@@ -898,7 +898,7 @@ H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_ke
HGOTO_DONE(1);
done:
- if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, FALSE) < 0)
+ if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
FUNC_LEAVE_NOAPI(ret_value);
@@ -945,7 +945,6 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
void *_udata)
{
H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata;
- hbool_t sn_dirtied = FALSE;
H5G_node_t *sn = NULL;
const H5HL_t *heap = NULL;
int lt = 0, idx = 0, rt, cmp = 1;
@@ -990,7 +989,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
}
}
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol name");
heap=NULL; base=NULL;
@@ -1008,7 +1007,7 @@ H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key
done:
if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn,
- sn_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1068,8 +1067,8 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
H5G_node_key_t *rt_key = (H5G_node_key_t *) _rt_key;
H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata;
- hbool_t sn_dirtied = FALSE, snrt_dirtied = FALSE;
H5G_node_t *sn = NULL, *snrt = NULL;
+ unsigned sn_flags = H5AC__NO_FLAGS_SET, snrt_flags = H5AC__NO_FLAGS_SET;
const H5HL_t *heap = NULL;
size_t offset; /*offset of name in heap */
const char *s;
@@ -1114,7 +1113,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
if (0 == (cmp = HDstrcmp(bt_udata->name, s))) /*already present */ {
HCOMMON_ERROR(H5E_SYM, H5E_CANTINSERT, "symbol is already present in symbol table");
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; base=NULL;
@@ -1129,7 +1128,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
}
idx += cmp > 0 ? 1 : 0;
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; base=NULL;
@@ -1160,13 +1159,13 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f),
H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t));
snrt->nsyms = H5F_SYM_LEAF_K(f);
- snrt_dirtied = TRUE;
+ snrt_flags |= H5AC__DIRTIED_FLAG;
/* The left node */
HDmemset(sn->entry + H5F_SYM_LEAF_K(f), 0,
H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t));
sn->nsyms = H5F_SYM_LEAF_K(f);
- sn_dirtied = TRUE;
+ sn_flags |= H5AC__DIRTIED_FLAG;
/* The middle key */
md_key->offset = sn->entry[sn->nsyms - 1].name_off;
@@ -1187,7 +1186,7 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
} else {
/* Where to insert the new entry? */
ret_value = H5B_INS_NOOP;
- sn_dirtied = TRUE;
+ sn_flags |= H5AC__DIRTIED_FLAG;
insert_into = sn;
if (idx == sn->nsyms) {
rt_key->offset = offset;
@@ -1204,11 +1203,9 @@ H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key,
insert_into->nsyms += 1;
done:
- if (snrt && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, *new_node_p, snrt,
- snrt_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ if (snrt && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, *new_node_p, snrt, snrt_flags) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node");
- if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn,
- sn_dirtied, H5AC__NO_FLAGS_SET) < 0)
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_flags) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1267,8 +1264,8 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
H5G_node_key_t *lt_key = (H5G_node_key_t*)_lt_key;
H5G_node_key_t *rt_key = (H5G_node_key_t*)_rt_key;
H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t*)_udata;
- hbool_t sn_dirtied = FALSE;
H5G_node_t *sn = NULL;
+ unsigned sn_flags = H5AC__NO_FLAGS_SET;
const H5HL_t *heap = NULL;
int lt=0, rt, idx=0, cmp=1;
const char *s = NULL;
@@ -1312,7 +1309,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
}
}
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; base=NULL;
@@ -1332,7 +1329,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
else
found=0;
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; s=NULL;
@@ -1360,7 +1357,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
else
found=0;
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, FALSE) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to unprotect symbol name");
heap=NULL; s=NULL;
@@ -1381,9 +1378,8 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
*rt_key = *lt_key;
*rt_key_changed = TRUE;
sn->nsyms = 0;
- sn_dirtied = TRUE;
if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size(f))<0
- || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, H5C__DELETED_FLAG)<0) {
+ || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__DIRTIED_FLAG | H5C__DELETED_FLAG)<0) {
sn = NULL;
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node");
}
@@ -1397,7 +1393,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
* change.
*/
sn->nsyms -= 1;
- sn_dirtied = TRUE;
+ sn_flags |= H5AC__DIRTIED_FLAG;
HDmemmove(sn->entry+idx, sn->entry+idx+1,
(sn->nsyms-idx)*sizeof(H5G_entry_t));
ret_value = H5B_INS_NOOP;
@@ -1409,7 +1405,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
* should be changed to reflect the new right-most entry.
*/
sn->nsyms -= 1;
- sn_dirtied = TRUE;
+ sn_flags |= H5AC__DIRTIED_FLAG;
rt_key->offset = sn->entry[sn->nsyms-1].name_off;
*rt_key_changed = TRUE;
ret_value = H5B_INS_NOOP;
@@ -1420,7 +1416,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
* node.
*/
sn->nsyms -= 1;
- sn_dirtied = TRUE;
+ sn_flags |= H5AC__DIRTIED_FLAG;
HDmemmove(sn->entry+idx, sn->entry+idx+1,
(sn->nsyms-idx)*sizeof(H5G_entry_t));
ret_value = H5B_INS_NOOP;
@@ -1447,9 +1443,8 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
*rt_key = *lt_key;
*rt_key_changed = TRUE;
sn->nsyms = 0;
- sn_dirtied = TRUE;
if (H5MF_xfree(f, H5FD_MEM_BTREE, dxpl_id, addr, (hsize_t)H5G_node_size(f))<0
- || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, H5C__DELETED_FLAG)<0) {
+ || H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__DIRTIED_FLAG | H5C__DELETED_FLAG)<0) {
sn = NULL;
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to free symbol table node");
}
@@ -1458,8 +1453,7 @@ H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key/*in,out*/,
} /* end else */
done:
- if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn,
- sn_dirtied, H5AC__NO_FLAGS_SET)<0)
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_flags)<0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1496,7 +1490,6 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
const void UNUSED *_rt_key, void *_udata)
{
H5G_bt_ud2_t *bt_udata = (H5G_bt_ud2_t *)_udata;
- hbool_t sn_dirtied = FALSE;
H5G_node_t *sn = NULL;
const H5HL_t *heap = NULL;
int i, nsyms;
@@ -1526,8 +1519,7 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
for (i=0; i<nsyms; i++)
name_off[i] = sn->entry[i].name_off;
- if (H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied, H5AC__NO_FLAGS_SET)
- != SUCCEED) {
+ if (H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) {
sn = NULL;
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
}
@@ -1556,7 +1548,7 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
}
HDstrcpy (s, name);
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, FALSE) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
heap=NULL; name=NULL;
@@ -1573,11 +1565,10 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t a
HERROR (H5E_SYM, H5E_CANTNEXT, "iteration operator failed");
done:
- if (heap && H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, FALSE) < 0)
+ if (heap && H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
- if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
if(name_off)
@@ -1612,7 +1603,6 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr
const void UNUSED *_rt_key, void *_udata)
{
hsize_t *num_objs = (hsize_t *)_udata;
- hbool_t sn_dirtied = FALSE;
H5G_node_t *sn = NULL;
int ret_value = H5B_ITER_CONT;
@@ -1632,8 +1622,7 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr
*num_objs += sn->nsyms;
done:
- if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1670,7 +1659,6 @@ H5G_node_name(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
size_t name_off;
hsize_t loc_idx;
const char *name;
- hbool_t sn_dirtied = FALSE;
H5G_node_t *sn = NULL;
int ret_value = H5B_ITER_CONT;
@@ -1699,7 +1687,7 @@ H5G_node_name(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
bt_udata->name = H5MM_strdup (name);
assert(bt_udata->name);
- if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, FALSE) < 0)
+ if (H5HL_unprotect(f, dxpl_id, heap, bt_udata->ent->cache.stab.heap_addr, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to unprotect symbol name");
heap=NULL; name=NULL;
@@ -1709,8 +1697,7 @@ H5G_node_name(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
}
done:
- if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1744,7 +1731,6 @@ H5G_node_type(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
{
H5G_bt_ud3_t *bt_udata = (H5G_bt_ud3_t*)_udata;
hsize_t loc_idx;
- hbool_t sn_dirtied = FALSE;
H5G_node_t *sn = NULL;
int ret_value = H5B_ITER_CONT;
@@ -1768,8 +1754,7 @@ H5G_node_type(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr,
}
done:
- if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied,
- H5AC__NO_FLAGS_SET) != SUCCEED)
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_ITER_ERROR, "unable to release object header");
FUNC_LEAVE_NOAPI(ret_value);
@@ -1927,7 +1912,6 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
int fwidth, haddr_t heap)
{
int i;
- hbool_t sn_dirtied = FALSE;
H5G_node_t *sn = NULL;
const char *s;
const H5HL_t *heap_ptr = NULL;
@@ -1992,8 +1976,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
}
done:
- if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, sn_dirtied,
- H5AC__NO_FLAGS_SET) < 0)
+ if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node");
FUNC_LEAVE_NOAPI(ret_value);