diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2021-05-05 22:07:40 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2021-05-05 22:07:40 (GMT) |
commit | 8d4873173fe95ffd8a274c9d9a6c1e8b5e017957 (patch) | |
tree | 10a135eaa95a0dfd54925af438504179c439de17 /src/H5FDstdio.c | |
parent | 54c202e4ec4bc9c7e45543cea5b51868a091b3e9 (diff) | |
download | hdf5-8d4873173fe95ffd8a274c9d9a6c1e8b5e017957.zip hdf5-8d4873173fe95ffd8a274c9d9a6c1e8b5e017957.tar.gz hdf5-8d4873173fe95ffd8a274c9d9a6c1e8b5e017957.tar.bz2 |
Brings native H5Fdelete implementation from develop
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 12475e7..f9faf53 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 */ NULL, /* dedup */ H5FD_FLMAP_DICHOTOMY /* fl_map */ }; @@ -1201,6 +1203,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. |