diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-04-16 18:47:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-16 18:47:32 (GMT) |
commit | d5c449248f74886529b9fad09473dd73d60a34fd (patch) | |
tree | ca3495dbf738c1561ad6501920a9d54680251664 /src/H5FDstdio.c | |
parent | e21f7aaac4a4d34a8a5aa1330fb2ed6814532cfb (diff) | |
download | hdf5-d5c449248f74886529b9fad09473dd73d60a34fd.zip hdf5-d5c449248f74886529b9fad09473dd73d60a34fd.tar.gz hdf5-d5c449248f74886529b9fad09473dd73d60a34fd.tar.bz2 |
Brings the native implementation of H5Fdelete() from Bitbucket (#524)
* Committing clang-format changes
* Brings the native VFD H5Fdelete() implementation from Bitbucket
Only brings the 'del' callbacks, not the 'open/close' scheme.
* Formatter changes
* Committing clang-format changes
* Fixes direct VFD callback name
* Removes UNUSED macro from family API call
* Adds barrier and rank 0 check to MPI-I/O VFD delete
* Revert "Adds barrier and rank 0 check to MPI-I/O VFD delete"
This reverts commit 909765f759d9d96e84f4b8b1cc14f7d2b3ac8143.
* Revert "Revert "Adds barrier and rank 0 check to MPI-I/O VFD delete""
This reverts commit 9b04bef1157853fc79fcb8fcc3e8ba1371091702.
* Adds a second barrier after the delete in MPI-I/O VFD
* Only delete files in the core VFD when the backing store flag is set
* Fixes string issues in multi VFD
Also, h5test.c cleanup code now uses H5Fdelete().
* Formatted source
* Rework fapl checks for MPI-I/O VFD delete callback
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5FDstdio.c')
-rw-r--r-- | src/H5FDstdio.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 3d0332f..6631325 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -180,6 +180,7 @@ static herr_t H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static herr_t H5FD_stdio_lock(H5FD_t *_file, hbool_t rw); static herr_t H5FD_stdio_unlock(H5FD_t *_file); +static herr_t H5FD_stdio_delete(const char *filename, hid_t fapl_id); static const H5FD_class_t H5FD_stdio_g = { "stdio", /* name */ @@ -213,6 +214,7 @@ static const H5FD_class_t H5FD_stdio_g = { H5FD_stdio_truncate, /* truncate */ H5FD_stdio_lock, /* lock */ H5FD_stdio_unlock, /* unlock */ + H5FD_stdio_delete, /* del */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -1200,6 +1202,34 @@ H5FD_stdio_unlock(H5FD_t *_file) return 0; } /* end H5FD_stdio_unlock() */ +/*------------------------------------------------------------------------- + * Function: H5FD_stdio_delete + * + * Purpose: Delete a file + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD_stdio_delete(const char *filename, hid_t /*UNUSED*/ fapl_id) +{ + static const char *func = "H5FD_stdio_delete"; /* Function Name for error reporting */ + + /* Clear the error stack */ + H5Eclear2(H5E_DEFAULT); + + assert(filename); + + /* Quiet compiler */ + (void)fapl_id; + + if (remove(filename) < 0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTDELETEFILE, "can't delete file)", -1); + + return 0; +} /* end H5FD_stdio_delete() */ + #ifdef H5private_H /* * This is not related to the functionality of the driver code. |