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

Remove HD from HDposix_memalign() #3196

Merged
merged 3 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
14 changes: 7 additions & 7 deletions src/H5FDdirect.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,11 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
* than the one where the program is running.
*/
/* NOTE: Use HDmalloc and HDfree here to ensure compatibility with
* HDposix_memalign.
* posix_memalign.
*/
buf1 = HDmalloc(sizeof(int));
if (HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed")
if (posix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "posix_memalign failed")

if (o_flags & O_CREAT) {
if (HDwrite(file->fd, buf1, sizeof(int)) < 0) {
Expand Down Expand Up @@ -944,8 +944,8 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U
if (alloc_size > _cbsize)
alloc_size = _cbsize;
HDassert(!(alloc_size % _fbsize));
if (HDposix_memalign(&copy_buf, _boundary, alloc_size) != 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed")
if (posix_memalign(&copy_buf, _boundary, alloc_size) != 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "posix_memalign failed")

/* look for the aligned position for reading the data */
HDassert(!(((addr / _fbsize) * _fbsize) % _fbsize));
Expand Down Expand Up @@ -1125,8 +1125,8 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_
alloc_size = _cbsize;
HDassert(!(alloc_size % _fbsize));

if (HDposix_memalign(&copy_buf, _boundary, alloc_size) != 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed")
if (posix_memalign(&copy_buf, _boundary, alloc_size) != 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "posix_memalign failed")

/* look for the right position for reading or writing the data */
if (HDlseek(file->fd, (HDoff_t)write_addr, SEEK_SET) < 0)
Expand Down
3 changes: 0 additions & 3 deletions src/H5private.h
Original file line number Diff line number Diff line change
Expand Up @@ -910,9 +910,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation);
#ifndef HDmalloc
#define HDmalloc(Z) malloc(Z)
#endif
#ifndef HDposix_memalign
#define HDposix_memalign(P, A, Z) posix_memalign(P, A, Z)
#endif
#ifndef HDmemcmp
#define HDmemcmp(X, Y, Z) memcmp(X, Y, Z)
#endif
Expand Down
4 changes: 2 additions & 2 deletions test/vfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,10 +788,10 @@ test_direct(void)

/* Allocate aligned memory for data set 1. For data set 1, everything is aligned including
* memory address, size of data, and file address. */
if (0 != HDposix_memalign(&proto_points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
if (0 != posix_memalign(&proto_points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
points = proto_points;
if (0 != HDposix_memalign(&proto_check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
if (0 != posix_memalign(&proto_check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
check = proto_check;

Expand Down