Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Purges UFAIL from the library #637

Merged
merged 32 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ba9deae
Committing clang-format changes
github-actions[bot] Mar 19, 2021
00f9750
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 21, 2021
e997283
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 22, 2021
3eac585
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 23, 2021
71643b7
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 24, 2021
d242911
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 24, 2021
bc70f95
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 26, 2021
3d7ad8e
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 26, 2021
aeb16b7
Merge branch 'develop' of https://github.com/derobins/hdf5 into develop
derobins Mar 26, 2021
765cb5b
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 27, 2021
18401fc
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 29, 2021
222242c
Merge branch 'develop' of https://github.com/derobins/hdf5 into develop
derobins Mar 29, 2021
8d0cafa
Merge remote-tracking branch 'canonical/develop' into develop
derobins Mar 30, 2021
d3694d1
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 2, 2021
1c7bcc2
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 15, 2021
70551e3
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 16, 2021
2dfc7db
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 20, 2021
71d2fbf
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 21, 2021
c8925f8
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 22, 2021
dd3e970
Merge branch 'develop' of https://github.com/derobins/hdf5 into develop
derobins Apr 22, 2021
bb61990
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 23, 2021
2c2b368
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 25, 2021
be2ada6
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 27, 2021
439f3a8
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 28, 2021
649aa9b
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 29, 2021
3fa627f
Merge remote-tracking branch 'canonical/develop' into develop
derobins Apr 29, 2021
0df36ec
Merge remote-tracking branch 'canonical/develop' into develop
derobins May 3, 2021
d65c841
Merge remote-tracking branch 'canonical/develop' into develop
derobins May 6, 2021
fc7eb21
Merge branch 'develop' of https://github.com/derobins/hdf5 into develop
derobins May 6, 2021
130d491
Merge remote-tracking branch 'canonical/develop' into develop
derobins May 8, 2021
b4beccc
Purges UFAIL from the library
derobins May 10, 2021
dd6c1bc
H5HL_insert change requested in PR
derobins May 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/H5Dchunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,10 +711,8 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize
} /* end for */

/* Get the "down" sizes for each dimension */
if (H5VM_array_down(ndims, layout->chunks, layout->down_chunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
if (H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value")
H5VM_array_down(ndims, layout->chunks, layout->down_chunks);
H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks);

done:
FUNC_LEAVE_NOAPI(ret_value)
Expand Down
16 changes: 5 additions & 11 deletions src/H5Dearray.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,9 +1160,7 @@ H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda
static herr_t
H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
{
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_STATIC
FUNC_ENTER_STATIC_NOERR

/* Check args */
HDassert(layout);
Expand All @@ -1182,22 +1180,18 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout)
H5VM_swizzle_coords(hsize_t, swizzled_chunks, layout->u.earray.unlim_dim);

/* Get the swizzled "down" sizes for each dimension */
if (H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks);

/* Get the swizzled max number of chunks in each dimension */
H5MM_memcpy(swizzled_max_chunks, layout->max_chunks,
(layout->ndims - 1) * sizeof(swizzled_max_chunks[0]));
H5VM_swizzle_coords(hsize_t, swizzled_max_chunks, layout->u.earray.unlim_dim);

/* Get the swizzled max "down" sizes for each dimension */
if (H5VM_array_down((layout->ndims - 1), swizzled_max_chunks,
layout->u.earray.swizzled_max_down_chunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value")
} /* end if */
H5VM_array_down((layout->ndims - 1), swizzled_max_chunks, layout->u.earray.swizzled_max_down_chunks);
}

done:
FUNC_LEAVE_NOAPI(ret_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__earray_idx_resize() */

/*-------------------------------------------------------------------------
Expand Down
17 changes: 8 additions & 9 deletions src/H5Dlayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
H5HL_t * heap; /* Pointer to local heap for EFL file names */
size_t heap_size = H5HL_ALIGN(1);
size_t u;
size_t name_offset;

/* Determine size of heap needed to stored the file names */
for (u = 0; u < efl->nused; ++u)
Expand All @@ -518,24 +519,22 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect EFL file name heap")

/* Insert "empty" name first */
if (UFAIL == H5HL_insert(file, heap, (size_t)1, "")) {
if (H5HL_insert(file, heap, (size_t)1, "", &name_offset) < 0) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
} /* end if */
}

for (u = 0; u < efl->nused; ++u) {
size_t offset; /* Offset of file name in heap */

/* Insert file name into heap */
if (UFAIL ==
(offset = H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name))) {
if (H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name, &name_offset) <
0) {
H5HL_unprotect(heap);
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap")
} /* end if */
}

/* Store EFL file name offset */
efl->slot[u].name_offset = offset;
} /* end for */
efl->slot[u].name_offset = name_offset;
}

/* Release the heap */
if (H5HL_unprotect(heap) < 0)
Expand Down
13 changes: 4 additions & 9 deletions src/H5Gent.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,8 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk
/* Reset the new entry */
H5G__ent_reset(ent);

/*
* Add the new name to the heap.
*/
name_offset = H5HL_insert(f, heap, HDstrlen(name) + 1, name);
if (0 == name_offset || UFAIL == name_offset)
/* Add the new name to the heap */
if (H5HL_insert(f, heap, HDstrlen(name) + 1, name, &name_offset) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap")
ent->name_off = name_offset;

Expand Down Expand Up @@ -476,14 +473,12 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk
size_t lnk_offset; /* Offset to sym-link value */

/* Insert link value into local heap */
if (UFAIL ==
(lnk_offset = H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name)))
if (H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name, &lnk_offset) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap")

ent->type = H5G_CACHED_SLINK;
ent->cache.slink.lval_offset = lnk_offset;
} /* end case */
break;
} break;

case H5L_TYPE_ERROR:
case H5L_TYPE_EXTERNAL:
Expand Down
5 changes: 2 additions & 3 deletions src/H5Gstab.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,10 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint)
HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap")

/* Insert name into the heap */
if (UFAIL == (name_offset = H5HL_insert(f, heap, (size_t)1, "")))
if (H5HL_insert(f, heap, (size_t)1, "", &name_offset) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert name into heap")

/*
* B-tree's won't work if the first name isn't at the beginning
/* B-trees won't work if the first name isn't at the beginning
* of the heap.
*/
HDassert(0 == name_offset);
Expand Down
42 changes: 21 additions & 21 deletions src/H5HL.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,27 +508,31 @@ END_FUNC(STATIC) /* end H5HL__dirty() */
*
* Purpose: Inserts a new item into the heap.
*
* Return: Success: Offset of new item within heap.
* Failure: UFAIL
* Return: Success: SUCCEED
* Offset set to location of new item within heap
*
* Failure: FAIL
* Offset set to SIZE_MAX
*
* Programmer: Robb Matzke
* Jul 17 1997
*
*-------------------------------------------------------------------------
*/
BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf))
BEGIN_FUNC(PRIV, ERR, herr_t, SUCCEED, FAIL,
H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *offset_out))

H5HL_free_t *fl = NULL, *last_fl = NULL;
size_t offset = 0;
size_t need_size;
size_t offset = 0;
hbool_t found;

/* check arguments */
/* Check arguments */
HDassert(f);
HDassert(heap);
HDassert(buf_size > 0);
HDassert(buf);
HDassert(offset_out);

/* Mark heap as dirty in cache */
/* (A bit early in the process, but it's difficult to determine in the
Expand All @@ -539,20 +543,18 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
if (FAIL == H5HL__dirty(heap))
H5E_THROW(H5E_CANTMARKDIRTY, "unable to mark heap as dirty");

/*
* In order to keep the free list descriptors aligned on word boundaries,
/* In order to keep the free list descriptors aligned on word boundaries,
* whatever that might mean, we round the size up to the next multiple of
* a word.
*/
need_size = H5HL_ALIGN(buf_size);

/*
* Look for a free slot large enough for this object and which would
/* Look for a free slot large enough for this object and which would
* leave zero or at least H5G_SIZEOF_FREE bytes left over.
*/
for (fl = heap->freelist, found = FALSE; fl; fl = fl->next) {
if (fl->size > need_size && fl->size - need_size >= H5HL_SIZEOF_FREE(f)) {
/* a big enough free block was found */
/* A big enough free block was found */
offset = fl->offset;
fl->offset += need_size;
fl->size -= need_size;
Expand All @@ -562,20 +564,19 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
break;
}
else if (fl->size == need_size) {
/* free block of exact size found */
/* Free block of exact size found */
offset = fl->offset;
fl = H5HL__remove_free(heap, fl);
found = TRUE;
break;
}
else if (!last_fl || last_fl->offset < fl->offset) {
/* track free space that's closest to end of heap */
/* Track free space that's closest to end of heap */
last_fl = fl;
}
} /* end for */

/*
* If no free chunk was large enough, then allocate more space and
/* If no free chunk was large enough, then allocate more space and
* add it to the free list. If the heap ends with a free chunk, we
* can extend that free chunk. Otherwise we'll have to make another
* free chunk. If the heap must expand, we double its size.
Expand All @@ -587,7 +588,8 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
htri_t was_extended; /* Whether the local heap's data segment on disk was extended */

/* At least double the heap's size, making certain there's enough room
* for the new object */
* for the new object
*/
need_more = MAX(need_size, heap->dblk_size);

/* If there is no last free block or it's not at the end of the heap,
Expand Down Expand Up @@ -657,8 +659,7 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
}
} /* end if */
else {
/*
* Create a new free list element large enough that we can
/* Create a new free list element large enough that we can
* take some space out of it right away.
*/
offset = old_dblk_size;
Expand Down Expand Up @@ -700,11 +701,10 @@ BEGIN_FUNC(PRIV, ERR, size_t, UFAIL, UFAIL,
/* Copy the data into the heap */
H5MM_memcpy(heap->dblk_image + offset, buf, buf_size);

/* Set return value */
ret_value = offset;
*offset_out = offset;

CATCH
/* No special processing on errors */
/* No special processing on exit */

END_FUNC(PRIV) /* H5HL_insert() */

Expand Down
2 changes: 1 addition & 1 deletion src/H5HLprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ H5_DLL herr_t H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr /*out*/);
H5_DLL herr_t H5HL_delete(H5F_t *f, haddr_t addr);
H5_DLL herr_t H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size);
H5_DLL herr_t H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size);
H5_DLL size_t H5HL_insert(H5F_t *f, H5HL_t *heap, size_t size, const void *buf);
H5_DLL herr_t H5HL_insert(H5F_t *f, H5HL_t *heap, size_t size, const void *buf, size_t *offset);
H5_DLL void * H5HL_offset_into(const H5HL_t *heap, size_t offset);
H5_DLL H5HL_t *H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags);
H5_DLL herr_t H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size);
Expand Down
8 changes: 4 additions & 4 deletions src/H5Oefl.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
HGOTO_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to protect EFL file name heap")

/* Insert "empty" name first */
if (UFAIL == (name_offset = H5HL_insert(file_dst, heap, (size_t)1, "")))
if (H5HL_insert(file_dst, heap, (size_t)1, "", &name_offset) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap")
HDassert(0 == name_offset);

Expand All @@ -483,10 +483,10 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
/* copy the name from the source */
for (idx = 0; idx < efl_src->nused; idx++) {
efl_dst->slot[idx].name = H5MM_xstrdup(efl_src->slot[idx].name);
if (UFAIL == (efl_dst->slot[idx].name_offset = H5HL_insert(
file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name)))
if (H5HL_insert(file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name,
&(efl_dst->slot[idx].name_offset)) < 0)
HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap")
} /* end for */
}

/* Set return value */
ret_value = efl_dst;
Expand Down
Loading