summaryrefslogtreecommitdiffstats
path: root/src/H5Olayout.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2015-09-01 13:03:33 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2015-09-01 13:03:33 (GMT)
commitc839ed338399301b3f861bde5fc8eecb9434462a (patch)
treedf5a053e9f59b81edc49b614b1ee9f2d831a0820 /src/H5Olayout.c
parentdb8e289abe67b506d2a1096d1a39151aca0935e9 (diff)
downloadhdf5-c839ed338399301b3f861bde5fc8eecb9434462a.zip
hdf5-c839ed338399301b3f861bde5fc8eecb9434462a.tar.gz
hdf5-c839ed338399301b3f861bde5fc8eecb9434462a.tar.bz2
[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
Diffstat (limited to 'src/H5Olayout.c')
-rw-r--r--src/H5Olayout.c25
1 files changed, 21 insertions, 4 deletions
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)