1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#include "H5Vol_def.h"
//
// NOTE: this is called from H5F.c when a new file or trunc file is asked
// so no need to check flags here. if do need to, use & not ==
//
void *H5VL_adios2_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
hid_t dxpl_id, void **req)
{
gInitADIOS2(fapl_id);
if (flags & H5F_ACC_TRUNC)
{
H5VL_FileDef_t *handle = gADIOS2CreateFile(name);
return gFileToVolObj(handle);
}
if (flags & H5F_ACC_EXCL)
{
H5VL_FileDef_t *handle = gADIOS2OpenFile(name);
if (NULL == handle->m_Engine)
{
H5VL_FileDef_t *handle = gADIOS2CreateFile(name);
return gFileToVolObj(handle);
}
else
{
gADIOS2CloseFile(handle); // f is freed in this call
}
// exists,
}
return NULL;
}
void *H5VL_adios2_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id,
void **req)
{
gInitADIOS2(fapl_id);
H5VL_FileDef_t *handle = gADIOS2OpenFile(name);
return gFileToVolObj(handle);
}
herr_t H5VL_adios2_file_specific(void *file, H5VL_file_specific_args_t *args, hid_t dxpl_id,
void **req)
{
//
// This function is called after H5Fopen/create. Do not remove
//
return 0;
}
herr_t H5VL_adios2_file_close(void *file, hid_t dxpl_id, void **req)
{
H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)file;
REQUIRE_SUCC((ROOT == vol->m_ObjType), -1);
H5VL_FileDef_t *f = (H5VL_FileDef_t *)(vol->m_ObjPtr);
gADIOS2CloseFile(f); // f is freed in this call
gFreeVol(vol);
return 0;
}
|