diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-01-13 04:12:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-13 04:12:51 (GMT) |
commit | b84f48f929ec02b9a2fefa036c63656af2f4aa89 (patch) | |
tree | 7a6eb6609b553f9262b69970d96a775c69d2f50a /src/H5FD.c | |
parent | 0e09b0b636b25bfe6226cc5ef5fa52e75383c32c (diff) | |
download | hdf5-b84f48f929ec02b9a2fefa036c63656af2f4aa89.zip hdf5-b84f48f929ec02b9a2fefa036c63656af2f4aa89.tar.gz hdf5-b84f48f929ec02b9a2fefa036c63656af2f4aa89.tar.bz2 |
Allow read-only VFD registration (#257)
* Removes no-op callback stubs from read-only VFDs
Also changes VFD registration to allow read-only VFDs with no
write callback to be registered.
* Adds a RELEASE.txt note for HDFFV-11205
For the read-only VFD registration change
Diffstat (limited to 'src/H5FD.c')
-rw-r--r-- | src/H5FD.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -231,9 +231,9 @@ H5FDregister(const H5FD_class_t *cls) "'get_eoa' and/or 'set_eoa' methods are not defined") if (!cls->get_eof) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eof' method is not defined") - if (!cls->read || !cls->write) + if (!cls->read) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, - "'read' and/or 'write' method is not defined") + "'read' method is not defined") for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) if (cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid free-list mapping") @@ -277,7 +277,7 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref) HDassert(cls->open && cls->close); HDassert(cls->get_eoa && cls->set_eoa); HDassert(cls->get_eof); - HDassert(cls->read && cls->write); + HDassert(cls->read); for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) { HDassert(cls->fl_map[type] >= H5FD_MEM_NOLIST && cls->fl_map[type] < H5FD_MEM_NTYPES); } @@ -1417,6 +1417,10 @@ H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz if (!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL") + /* Make sure this isn't being called on a read-only VFD */ + if (!file->cls->write) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "write request made to read-only VFD") + /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; |