diff options
Diffstat (limited to 'src/H5VLpassthru.c')
-rw-r--r-- | src/H5VLpassthru.c | 81 |
1 files changed, 62 insertions, 19 deletions
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index af79284..d7e730a 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -121,11 +121,12 @@ static void *H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_ hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); static void *H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, void *buf, void **req); -static herr_t H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, - void **req); +static herr_t H5VL_pass_through_dataset_read(size_t count, void *dset[], hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t plist_id, + void *buf[], void **req); +static herr_t H5VL_pass_through_dataset_write(size_t count, void *dset[], hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t plist_id, + const void *buf[], void **req); static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req); static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, @@ -1197,22 +1198,43 @@ H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, c *------------------------------------------------------------------------- */ static herr_t -H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t plist_id, void *buf, void **req) +H5VL_pass_through_dataset_read(size_t count, void *dset[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t plist_id, void *buf[], void **req) { - H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; - herr_t ret_value; + void *obj_local; /* Local buffer for obj */ + void **obj = &obj_local; /* Array of object pointers */ + size_t i; /* Local index variable */ + herr_t ret_value; #ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Read\n"); #endif - ret_value = H5VLdataset_read(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, - plist_id, buf, req); + /* Allocate obj array if necessary */ + if (count > 1) + if (NULL == (obj = (void **)malloc(count * sizeof(void *)))) + return -1; + + /* Build obj array */ + for (i = 0; i < count; i++) { + /* Get the object */ + obj[i] = ((H5VL_pass_through_t *)dset[i])->under_object; + + /* Make sure the class matches */ + if (((H5VL_pass_through_t *)dset[i])->under_vol_id != ((H5VL_pass_through_t *)dset[0])->under_vol_id) + return -1; + } + + ret_value = H5VLdataset_read(count, obj, ((H5VL_pass_through_t *)dset[0])->under_vol_id, mem_type_id, + mem_space_id, file_space_id, plist_id, buf, req); /* Check for async request */ if (req && *req) - *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + *req = H5VL_pass_through_new_obj(*req, ((H5VL_pass_through_t *)dset[0])->under_vol_id); + + /* Free memory */ + if (obj != &obj_local) + free(obj); return ret_value; } /* end H5VL_pass_through_dataset_read() */ @@ -1228,22 +1250,43 @@ H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id *------------------------------------------------------------------------- */ static herr_t -H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t plist_id, const void *buf, void **req) +H5VL_pass_through_dataset_write(size_t count, void *dset[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t plist_id, const void *buf[], void **req) { - H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; - herr_t ret_value; + void *obj_local; /* Local buffer for obj */ + void **obj = &obj_local; /* Array of object pointers */ + size_t i; /* Local index variable */ + herr_t ret_value; #ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Write\n"); #endif - ret_value = H5VLdataset_write(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, - plist_id, buf, req); + /* Allocate obj array if necessary */ + if (count > 1) + if (NULL == (obj = (void **)malloc(count * sizeof(void *)))) + return -1; + + /* Build obj array */ + for (i = 0; i < count; i++) { + /* Get the object */ + obj[i] = ((H5VL_pass_through_t *)dset[i])->under_object; + + /* Make sure the class matches */ + if (((H5VL_pass_through_t *)dset[i])->under_vol_id != ((H5VL_pass_through_t *)dset[0])->under_vol_id) + return -1; + } + + ret_value = H5VLdataset_write(count, obj, ((H5VL_pass_through_t *)dset[0])->under_vol_id, mem_type_id, + mem_space_id, file_space_id, plist_id, buf, req); /* Check for async request */ if (req && *req) - *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + *req = H5VL_pass_through_new_obj(*req, ((H5VL_pass_through_t *)dset[0])->under_vol_id); + + /* Free memory */ + if (obj != &obj_local) + free(obj); return ret_value; } /* end H5VL_pass_through_dataset_write() */ |