From c839ed338399301b3f861bde5fc8eecb9434462a Mon Sep 17 00:00:00 2001 From: Neil Fortner Date: Tue, 1 Sep 2015 08:03:33 -0500 Subject: [svn-r27646] Add version number to VDS global heap object encoding. Fix handling of layout version number. Other minor fixes/cleanup. NOTE: This commit changes the file format for VDS, all files must be re-generated. Tested: ummon --- src/H5Dvirtual.c | 2 +- src/H5Olayout.c | 25 +++++++++++++++++++++---- src/H5Pdapl.c | 12 +++++------- test/vds.c | 12 +++++++----- tools/testfiles/vds/1_a.h5 | Bin 4856 -> 4856 bytes tools/testfiles/vds/1_b.h5 | Bin 4611 -> 4611 bytes tools/testfiles/vds/1_c.h5 | Bin 4856 -> 4856 bytes tools/testfiles/vds/1_d.h5 | Bin 4611 -> 4611 bytes tools/testfiles/vds/1_e.h5 | Bin 4856 -> 4856 bytes tools/testfiles/vds/1_f.h5 | Bin 4611 -> 4611 bytes tools/testfiles/vds/1_vds.h5 | Bin 5496 -> 5496 bytes tools/testfiles/vds/2_a.h5 | Bin 4576 -> 4576 bytes tools/testfiles/vds/2_b.h5 | Bin 4578 -> 4578 bytes tools/testfiles/vds/2_c.h5 | Bin 4576 -> 4576 bytes tools/testfiles/vds/2_d.h5 | Bin 4578 -> 4578 bytes tools/testfiles/vds/2_e.h5 | Bin 4578 -> 4578 bytes tools/testfiles/vds/2_vds.h5 | Bin 5496 -> 5496 bytes tools/testfiles/vds/3_1_vds.h5 | Bin 5496 -> 5496 bytes tools/testfiles/vds/3_2_vds.h5 | Bin 5496 -> 5496 bytes tools/testfiles/vds/4_0.h5 | Bin 4581 -> 4581 bytes tools/testfiles/vds/4_1.h5 | Bin 4581 -> 4581 bytes tools/testfiles/vds/4_2.h5 | Bin 4581 -> 4581 bytes tools/testfiles/vds/4_vds.h5 | Bin 5496 -> 5496 bytes tools/testfiles/vds/5_a.h5 | Bin 4581 -> 4581 bytes tools/testfiles/vds/5_b.h5 | Bin 4581 -> 4581 bytes tools/testfiles/vds/5_c.h5 | Bin 4581 -> 4581 bytes tools/testfiles/vds/5_vds.h5 | Bin 5496 -> 5496 bytes 27 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 10e53c9..a611321 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -808,7 +808,7 @@ done: /*------------------------------------------------------------------------- * Function: H5D__virtual_reset_source_dset * - * Purpose: Frees space reference by a source dataset struct. + * Purpose: Frees space referenced by a source dataset struct. * * Return: Non-negative on success/Negative on failure * diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 130bf67..81ef061 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -34,6 +34,9 @@ /* Local macros */ +/* Version # of encoded virtual dataset global heap blocks */ +#define H5O_LAYOUT_VDS_GH_ENC_VERS 0 + /* PRIVATE PROTOTYPES */ static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, @@ -115,7 +118,7 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") mesg->version = *p++; - if(mesg->version < H5O_LAYOUT_VERSION_1 || mesg->version > H5O_LAYOUT_VERSION_3) + if(mesg->version < H5O_LAYOUT_VERSION_1 || mesg->version > H5O_LAYOUT_VERSION_4) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for layout message") if(mesg->version < H5O_LAYOUT_VERSION_3) { @@ -243,6 +246,10 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * break; case H5D_VIRTUAL: + /* Check version */ + if(mesg->version < H5O_LAYOUT_VERSION_4) + HGOTO_ERROR(H5E_OHDR, H5E_VERSION, NULL, "invalid layout version with virtual layout") + /* Heap information */ H5F_addr_decode(f, &p, &(mesg->storage.u.virt.serial_list_hobjid.addr)); UINT32DECODE(p, mesg->storage.u.virt.serial_list_hobjid.idx); @@ -260,6 +267,7 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * /* Decode heap block if it exists */ if(mesg->storage.u.virt.serial_list_hobjid.addr != HADDR_UNDEF) { const uint8_t *heap_block_p; + uint8_t heap_vers; size_t block_size = 0; size_t tmp_size; hsize_t tmp_hsize; @@ -273,6 +281,11 @@ H5O_layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED * heap_block_p = (const uint8_t *)heap_block; + /* Decode the version number of the heap block encoding */ + heap_vers = (uint8_t)*heap_block_p++; + if((uint8_t)H5O_LAYOUT_VDS_GH_ENC_VERS != heap_vers) + HGOTO_ERROR(H5E_OHDR, H5E_VERSION, NULL, "bad version # of encoded VDS heap information, expected %u, got %u", (unsigned)H5O_LAYOUT_VDS_GH_ENC_VERS, (unsigned)heap_vers) + /* Number of entries */ H5F_DECODE_LENGTH(f, heap_block_p, tmp_hsize) @@ -445,7 +458,8 @@ H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c HDassert(p); /* Message version */ - *p++ = (uint8_t)H5O_LAYOUT_VERSION_3; + *p++ = mesg->type == H5D_VIRTUAL ? (uint8_t)H5O_LAYOUT_VERSION_4 + : (uint8_t)H5O_LAYOUT_VERSION_3; /* Layout class */ *p++ = mesg->type; @@ -505,8 +519,8 @@ H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c /* * Calculate heap block size */ - /* Number of entries */ - block_size = H5F_SIZEOF_SIZE(f); + /* Version and number of entries */ + block_size = (size_t)1 + H5F_SIZEOF_SIZE(f); /* Calculate size of each entry */ for(i = 0; i < mesg->storage.u.virt.list_nused; i++) { @@ -546,6 +560,9 @@ H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c */ heap_block_p = heap_block; + /* Encode heap block encoding version */ + *heap_block_p++ = (uint8_t)H5O_LAYOUT_VDS_GH_ENC_VERS; + /* Number of entries */ tmp_hsize = (hsize_t)mesg->storage.u.virt.list_nused; H5F_ENCODE_LENGTH(f, heap_block_p, tmp_hsize) diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index 94ae0b4..c8df45b 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -368,9 +368,7 @@ done: * H5Pset_virtual_view call. The possible values of view are * H5D_VDS_FIRST_MISSING or H5D_VDS_LAST_AVAIALBLE. * - * Return: Success: H5D_VDS_FIRST_MISSING or - * H5D_VDS_LAST_AVAILABLE - * Failure: H5D_VDS_ERROR + * Return: Non-negative on success/Negative on failure * * Programmer: Neil Fortner * May 4, 2015 @@ -388,12 +386,12 @@ H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view) /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5D_VDS_ERROR, "can't find object for ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get value from property list */ if(view) if(H5P_get(plist, H5D_ACS_VDS_VIEW_NAME, view) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5D_VDS_ERROR, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") done: FUNC_LEAVE_API(ret_value) @@ -551,12 +549,12 @@ H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size) /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5D_VDS_ERROR, "can't find object for ID") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get value from property list */ if(gap_size) if(H5P_get(plist, H5D_ACS_VDS_PRINTF_GAP_NAME, gap_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5D_VDS_ERROR, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") done: FUNC_LEAVE_API(ret_value) diff --git a/test/vds.c b/test/vds.c index 5cdcef4..3e1bc18 100644 --- a/test/vds.c +++ b/test/vds.c @@ -386,8 +386,10 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, if(oinfo.meta_size.obj.index_size != (hsize_t)0) TEST_ERROR if(config == TEST_API_REOPEN_FILE) { - if(oinfo.meta_size.obj.heap_size != exp_meta_size) { printf("%llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size); - TEST_ERROR } + if(oinfo.meta_size.obj.heap_size != exp_meta_size) { + printf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size); + TEST_ERROR + } /* end if */ } /* end if */ else if((oinfo.meta_size.obj.heap_size != exp_meta_size) @@ -550,7 +552,7 @@ test_api(test_api_config_t config, hid_t fapl) TEST_ERROR /* Get examination DCPL */ - if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)68) < 0) + if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)69) < 0) TEST_ERROR /* Test H5Pget_virtual_count */ @@ -621,7 +623,7 @@ test_api(test_api_config_t config, hid_t fapl) TEST_ERROR /* Get examination DCPL */ - if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)212) < 0) + if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)213) < 0) TEST_ERROR /* Test H5Pget_virtual_count */ @@ -1028,7 +1030,7 @@ test_api(test_api_config_t config, hid_t fapl) } /* end if */ /* Get examination DCPL */ - if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)696) < 0) + if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename, (hsize_t)697) < 0) TEST_ERROR /* Test H5Pget_virtual_count */ diff --git a/tools/testfiles/vds/1_a.h5 b/tools/testfiles/vds/1_a.h5 index 533728f..953d33d 100644 Binary files a/tools/testfiles/vds/1_a.h5 and b/tools/testfiles/vds/1_a.h5 differ diff --git a/tools/testfiles/vds/1_b.h5 b/tools/testfiles/vds/1_b.h5 index 4195588..6ba95e6 100644 Binary files a/tools/testfiles/vds/1_b.h5 and b/tools/testfiles/vds/1_b.h5 differ diff --git a/tools/testfiles/vds/1_c.h5 b/tools/testfiles/vds/1_c.h5 index cc6c2c7..4bcebbd 100644 Binary files a/tools/testfiles/vds/1_c.h5 and b/tools/testfiles/vds/1_c.h5 differ diff --git a/tools/testfiles/vds/1_d.h5 b/tools/testfiles/vds/1_d.h5 index 20bea0b..9c2d795 100644 Binary files a/tools/testfiles/vds/1_d.h5 and b/tools/testfiles/vds/1_d.h5 differ diff --git a/tools/testfiles/vds/1_e.h5 b/tools/testfiles/vds/1_e.h5 index 43e9cea..4f7aa7b 100644 Binary files a/tools/testfiles/vds/1_e.h5 and b/tools/testfiles/vds/1_e.h5 differ diff --git a/tools/testfiles/vds/1_f.h5 b/tools/testfiles/vds/1_f.h5 index c49843e..62e86bc 100644 Binary files a/tools/testfiles/vds/1_f.h5 and b/tools/testfiles/vds/1_f.h5 differ diff --git a/tools/testfiles/vds/1_vds.h5 b/tools/testfiles/vds/1_vds.h5 index 59c76ea..707a37f 100644 Binary files a/tools/testfiles/vds/1_vds.h5 and b/tools/testfiles/vds/1_vds.h5 differ diff --git a/tools/testfiles/vds/2_a.h5 b/tools/testfiles/vds/2_a.h5 index bba7854..5227e9e 100644 Binary files a/tools/testfiles/vds/2_a.h5 and b/tools/testfiles/vds/2_a.h5 differ diff --git a/tools/testfiles/vds/2_b.h5 b/tools/testfiles/vds/2_b.h5 index a30ff72..34723a3 100644 Binary files a/tools/testfiles/vds/2_b.h5 and b/tools/testfiles/vds/2_b.h5 differ diff --git a/tools/testfiles/vds/2_c.h5 b/tools/testfiles/vds/2_c.h5 index bec8e65..d2252fc 100644 Binary files a/tools/testfiles/vds/2_c.h5 and b/tools/testfiles/vds/2_c.h5 differ diff --git a/tools/testfiles/vds/2_d.h5 b/tools/testfiles/vds/2_d.h5 index 605ff85..6880c2e 100644 Binary files a/tools/testfiles/vds/2_d.h5 and b/tools/testfiles/vds/2_d.h5 differ diff --git a/tools/testfiles/vds/2_e.h5 b/tools/testfiles/vds/2_e.h5 index a033de1..81ffacc 100644 Binary files a/tools/testfiles/vds/2_e.h5 and b/tools/testfiles/vds/2_e.h5 differ diff --git a/tools/testfiles/vds/2_vds.h5 b/tools/testfiles/vds/2_vds.h5 index 85f075a..cbef59c 100644 Binary files a/tools/testfiles/vds/2_vds.h5 and b/tools/testfiles/vds/2_vds.h5 differ diff --git a/tools/testfiles/vds/3_1_vds.h5 b/tools/testfiles/vds/3_1_vds.h5 index 9661907..e66e4c7 100644 Binary files a/tools/testfiles/vds/3_1_vds.h5 and b/tools/testfiles/vds/3_1_vds.h5 differ diff --git a/tools/testfiles/vds/3_2_vds.h5 b/tools/testfiles/vds/3_2_vds.h5 index c39fee4..a19dab5 100644 Binary files a/tools/testfiles/vds/3_2_vds.h5 and b/tools/testfiles/vds/3_2_vds.h5 differ diff --git a/tools/testfiles/vds/4_0.h5 b/tools/testfiles/vds/4_0.h5 index 3f5b594..5e71d20 100644 Binary files a/tools/testfiles/vds/4_0.h5 and b/tools/testfiles/vds/4_0.h5 differ diff --git a/tools/testfiles/vds/4_1.h5 b/tools/testfiles/vds/4_1.h5 index 0b91398..edad46e 100644 Binary files a/tools/testfiles/vds/4_1.h5 and b/tools/testfiles/vds/4_1.h5 differ diff --git a/tools/testfiles/vds/4_2.h5 b/tools/testfiles/vds/4_2.h5 index 0ea8f8e..a82b012 100644 Binary files a/tools/testfiles/vds/4_2.h5 and b/tools/testfiles/vds/4_2.h5 differ diff --git a/tools/testfiles/vds/4_vds.h5 b/tools/testfiles/vds/4_vds.h5 index de3457a..64c2288 100644 Binary files a/tools/testfiles/vds/4_vds.h5 and b/tools/testfiles/vds/4_vds.h5 differ diff --git a/tools/testfiles/vds/5_a.h5 b/tools/testfiles/vds/5_a.h5 index 189e3b1..e8ea552 100644 Binary files a/tools/testfiles/vds/5_a.h5 and b/tools/testfiles/vds/5_a.h5 differ diff --git a/tools/testfiles/vds/5_b.h5 b/tools/testfiles/vds/5_b.h5 index 49b85ac..6da7cf5 100644 Binary files a/tools/testfiles/vds/5_b.h5 and b/tools/testfiles/vds/5_b.h5 differ diff --git a/tools/testfiles/vds/5_c.h5 b/tools/testfiles/vds/5_c.h5 index 5ea371e..3e3bc61 100644 Binary files a/tools/testfiles/vds/5_c.h5 and b/tools/testfiles/vds/5_c.h5 differ diff --git a/tools/testfiles/vds/5_vds.h5 b/tools/testfiles/vds/5_vds.h5 index bee4974..379485e 100644 Binary files a/tools/testfiles/vds/5_vds.h5 and b/tools/testfiles/vds/5_vds.h5 differ -- cgit v0.12