summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Dvirtual.c36
-rw-r--r--test/vds.c2
2 files changed, 33 insertions, 5 deletions
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index dd3508f..d80e086 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -417,6 +417,11 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
hsize_t tmp_nentries; /* Temp. variable for # of VDS entries */
uint32_t chksum; /* Checksum for heap data */
size_t i; /* Local index variable */
+ H5P_genplist_t *fapl_plist; /* The file access property list */
+ hid_t new_fapl_id; /* The file access property list ID */
+ H5F_libver_t low_bound = H5F_LIBVER_V110; /* Set the low bound in fapl to latest */
+ H5F_libver_t high_bound = H5F_LIBVER_V110; /* Set the high bound in fapl to latest */
+ H5F_t *tmp_f = NULL; /* Pointer to faked file structure */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -428,6 +433,24 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
/* Create block if # of used entries > 0 */
if(layout->storage.u.virt.list_nused > 0) {
+
+ /* Make a copy of the default file access property list */
+ if(NULL == (fapl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Set latest format in fapl_plist for virtual layout encoding */
+ if(H5P_set(fapl_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &low_bound) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions")
+ if(H5P_set(fapl_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &high_bound) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions")
+ /* Copy and return the fapl id */
+ if((new_fapl_id = H5P_copy_plist(fapl_plist, FALSE)) < 0)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list")
+
+ /* Allocate "fake" file structure with the fapl setting */
+ if(NULL == (tmp_f = H5F_fake_alloc((uint8_t)0, new_fapl_id)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct")
+
/* Allocate array for caching results of strlen */
if(NULL == (str_size = (size_t *)H5MM_malloc(2 * layout->storage.u.virt.list_nused * sizeof(size_t))))
HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, FAIL, "unable to allocate string length array")
@@ -457,12 +480,12 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
block_size += str_size[(2 * i) + 1];
/* Source selection */
- if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_select,f)) < 0)
+ if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_select, tmp_f)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size")
block_size += (size_t)select_serial_size;
/* Virtual dataset selection */
- if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_dset.virtual_select,f)) < 0)
+ if((select_serial_size = H5S_SELECT_SERIAL_SIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, tmp_f)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size")
block_size += (size_t)select_serial_size;
} /* end for */
@@ -499,11 +522,11 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
heap_block_p += str_size[(2 * i) + 1];
/* Source selection */
- if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_select, &heap_block_p,f) < 0)
+ if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_select, &heap_block_p, tmp_f) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize source selection")
/* Virtual selection */
- if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p,f) < 0)
+ if(H5S_SELECT_SERIALIZE(layout->storage.u.virt.list[i].source_dset.virtual_select, &heap_block_p, tmp_f) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize virtual selection")
} /* end for */
@@ -517,9 +540,14 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
} /* end if */
done:
+ /* Release fake file structure */
+ if(tmp_f && H5F_fake_free(tmp_f) < 0)
+ HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release fake file struct")
+
heap_block = (uint8_t *)H5MM_xfree(heap_block);
str_size = (size_t *)H5MM_xfree(str_size);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_store_layout() */
diff --git a/test/vds.c b/test/vds.c
index 051bc9d..42bb0b8 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -621,7 +621,7 @@ test_api(test_api_config_t config, hid_t fapl)
/* Should be a value of 174, not 213. HDFFV-10469 */
- if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)213) < 0)
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)174) < 0)
TEST_ERROR
/* Test H5Pget_virtual_count */