diff options
Diffstat (limited to 'test/freespace.c')
-rw-r--r-- | test/freespace.c | 589 |
1 files changed, 336 insertions, 253 deletions
diff --git a/test/freespace.c b/test/freespace.c index 1c28bc2..af53eba 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -214,7 +214,7 @@ TEST_sect_init_cls(H5FS_section_class_t *cls, void *_udata) init_flags = (unsigned *)_udata; cls->flags |= *init_flags; - return(ret_value); + return ret_value; } /* TEST_sect_init_cls() */ /* @@ -238,7 +238,7 @@ TEST_sect_can_merge(const H5FS_section_info_t *_sect1, /* Check if second section adjoins first section */ ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr); - return(ret_value); + return ret_value; } /* TEST_sect_can_merge() */ /* @@ -268,9 +268,9 @@ TEST_sect_merging(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2, /* Get rid of second section */ if(TEST_sect_free((H5FS_section_info_t *)sect2) < 0) - TEST_ERROR + TEST_ERROR error: - return(ret_value); + return ret_value; } /* TEST_sect_merging() */ /* @@ -282,7 +282,7 @@ TEST_sect_free(H5FS_section_info_t *sect) /* Release the section */ HDfree(sect); - return(0); + return 0; } /* TEST_sect_free() */ /* @@ -299,18 +299,18 @@ TEST_sect_can_shrink(const H5FS_section_info_t *_sect, void *_udata) const TEST_free_section_t *sect = (const TEST_free_section_t *)_sect; haddr_t end, eoa; - if (can_shrink == NULL) - return(FALSE); + if(can_shrink == NULL) + return FALSE; end = sect->sect_info.addr + sect->sect_info.size; eoa = TEST_get_eoa(); if (end == eoa) - *can_shrink = TRUE; + *can_shrink = TRUE; else - *can_shrink = FALSE; + *can_shrink = FALSE; - return((htri_t)*can_shrink); + return (htri_t)*can_shrink; } /* TEST_sect_can_shrink() */ /* @@ -325,14 +325,14 @@ TEST_sect_shrinking(H5FS_section_info_t **_sect, void *_udata) /* address of the section is faked, so, doesn't need to do anything */ /* just free the section node */ if (*can_shrink) { - if (TEST_sect_free((H5FS_section_info_t *)*sect) < 0) - TEST_ERROR - *sect = NULL; - return(TRUE); - } + if (TEST_sect_free((H5FS_section_info_t *)*sect) < 0) + TEST_ERROR + *sect = NULL; + return TRUE; + } /* end if */ error: - return(FALSE); + return FALSE; } @@ -359,7 +359,7 @@ TEST_sects_cb(H5FS_section_info_t *_sect, void *_udata) static haddr_t TEST_get_eoa(void) { - return(g_eoa); + return g_eoa; } /* supporting routine for shrinking */ @@ -431,10 +431,10 @@ check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state) } /* end if */ /* All tests passed */ - return(0); + return 0; error: - return(1); + return 1; } /* check_stats() */ /* @@ -448,6 +448,7 @@ static unsigned test_fs_create(hid_t fapl) { hid_t file = -1; /* File ID */ + hid_t dxpl_id = -1; /* dxpl ID (for tag) */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ @@ -487,14 +488,20 @@ test_fs_create(hid_t fapl) init_cparam(&cparam); nclasses = NELMTS(test_classes); - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + /* Create the dxpl and tag it with the global free space tag */ + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + FAIL_STACK_ERROR + if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0) + FAIL_STACK_ERROR + + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR if(!H5F_addr_defined(fs_addr)) TEST_ERROR if (frsp->nclasses != nclasses) - TEST_ERROR + TEST_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); if(check_stats(f, frsp, &state)) @@ -507,27 +514,27 @@ test_fs_create(hid_t fapl) FAIL_STACK_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* reopen the free-space manager */ - if(NULL == (frsp = H5FS_open(f, H5AC_ind_read_dxpl_id, fs_addr, + if(NULL == (frsp = H5FS_open(f, dxpl_id, fs_addr, nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR if(!H5F_addr_defined(fs_addr)) TEST_ERROR if (frsp->nclasses != nclasses) - TEST_ERROR + TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -543,17 +550,22 @@ test_fs_create(hid_t fapl) if(file_size != empty_size) TEST_ERROR + /* Close the dxpl */ + if(H5Pclose(dxpl_id) < 0) + FAIL_STACK_ERROR; + PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { if(frsp) - H5FS_close(f, H5AC_ind_read_dxpl_id, frsp); - H5Fclose(file); + H5FS_close(f, dxpl_id, frsp); + H5Fclose(file); + H5Pclose(dxpl_id); } H5E_END_TRY; - return(1); + return 1; } /* test_fs_create() */ @@ -585,6 +597,7 @@ static unsigned test_fs_sect_add(hid_t fapl) { hid_t file = -1; /* File ID */ + hid_t dxpl_id = -1; /* dxpl_id (for tag) */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ @@ -625,7 +638,13 @@ test_fs_sect_add(hid_t fapl) init_cparam(&cparam); nclasses = NELMTS(test_classes); - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + /* Create the dxpl and tag it with the global free space tag */ + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + FAIL_STACK_ERROR + if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0) + FAIL_STACK_ERROR + + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -637,7 +656,7 @@ test_fs_sect_add(hid_t fapl) init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -652,7 +671,7 @@ test_fs_sect_add(hid_t fapl) fr_meta_size = H5FS_HEADER_SIZE(f) + H5FS_SINFO_PREFIX_SIZE(f); /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; @@ -687,7 +706,7 @@ test_fs_sect_add(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = H5FS_CLS_GHOST_OBJ; - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -700,7 +719,7 @@ test_fs_sect_add(hid_t fapl) init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node, 0, NULL) < 0) FAIL_STACK_ERROR @@ -715,7 +734,7 @@ test_fs_sect_add(hid_t fapl) fr_meta_size = H5FS_HEADER_SIZE(f); /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR /* Close the file */ @@ -759,7 +778,7 @@ test_fs_sect_add(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = 0; - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -774,7 +793,7 @@ test_fs_sect_add(hid_t fapl) */ init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -785,13 +804,13 @@ test_fs_sect_add(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) - FAIL_STACK_ERROR + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) + FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; /* Close the file */ @@ -828,22 +847,22 @@ test_fs_sect_add(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = 0; - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(!H5F_addr_defined(fs_addr)) TEST_ERROR if(NULL == (sect_node = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* * Add section A */ init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_DESERIALIZING, &can_shrink) < 0) FAIL_STACK_ERROR @@ -855,41 +874,44 @@ test_fs_sect_add(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if(H5FS_sect_remove(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node) < 0) - FAIL_STACK_ERROR + if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node) < 0) + FAIL_STACK_ERROR /* Free the section node(s) */ if(TEST_sect_free((H5FS_section_info_t *)sect_node) < 0) - TEST_ERROR + TEST_ERROR sect_node = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) - FAIL_STACK_ERROR + if(H5FS_close(f, dxpl_id, frsp) < 0) + FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) - FAIL_STACK_ERROR + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) + FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file */ + /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR + if(H5Pclose(dxpl_id) < 0) + FAIL_STACK_ERROR PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { if(sect_node) TEST_sect_free((H5FS_section_info_t *)sect_node); if(frsp) - H5FS_close(f, H5AC_ind_read_dxpl_id, frsp); - H5Fclose(file); + H5FS_close(f, dxpl_id, frsp); + H5Fclose(file); + H5Pclose(dxpl_id); } H5E_END_TRY; - return(1); + return 1; } /* test_fs_sect_add() */ @@ -917,6 +939,7 @@ static unsigned test_fs_sect_find(hid_t fapl) { hid_t file = -1; /* File ID */ + hid_t dxpl_id = -1; /* dxpl ID (for tag) */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ @@ -946,7 +969,13 @@ test_fs_sect_find(hid_t fapl) init_cparam(&cparam); nclasses = NELMTS(test_classes); - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + /* Create the dxpl and tag it with the global free space tag */ + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + FAIL_STACK_ERROR + if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0) + FAIL_STACK_ERROR + + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -958,9 +987,9 @@ test_fs_sect_find(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE30, (H5FS_section_info_t **)&node)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if (node_found) TEST_ERROR @@ -968,8 +997,8 @@ test_fs_sect_find(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) - FAIL_STACK_ERROR + if(H5FS_close(f, dxpl_id, frsp) < 0) + FAIL_STACK_ERROR frsp = NULL; PASSED() @@ -977,26 +1006,26 @@ test_fs_sect_find(hid_t fapl) TESTING("H5FS_sect_find() a section equal to requested-size from free-space"); /* reopen the free-space manager */ - if(NULL == (frsp = H5FS_open(f, H5AC_ind_read_dxpl_id, fs_addr, nclasses, + if(NULL == (frsp = H5FS_open(f, dxpl_id, fs_addr, nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(!H5F_addr_defined(fs_addr)) TEST_ERROR if (frsp->nclasses != nclasses) - TEST_ERROR + TEST_ERROR /* * Add section A */ if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); state.tot_space += sect_node1->sect_info.size; @@ -1011,13 +1040,13 @@ test_fs_sect_find(hid_t fapl) * Add section C */ if(NULL == (sect_node3 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR init_sect_node(sect_node3, (haddr_t)(TEST_SECT_ADDR200), (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, H5FS_ADD_RETURNED_SPACE, NULL) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR state.tot_space += sect_node3->sect_info.size; state.tot_sect_count += 1; @@ -1030,13 +1059,13 @@ test_fs_sect_find(hid_t fapl) * Add section B */ if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR state.tot_space += sect_node2->sect_info.size; state.tot_sect_count += 1; @@ -1049,13 +1078,13 @@ test_fs_sect_find(hid_t fapl) * Add section D */ if(NULL == (sect_node4 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR300, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node4, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node4, H5FS_ADD_RETURNED_SPACE, NULL) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR state.tot_space += sect_node4->sect_info.size; state.tot_sect_count += 1; @@ -1064,40 +1093,40 @@ test_fs_sect_find(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if (!node_found) TEST_ERROR if ((node->sect_info.addr != TEST_SECT_ADDR100) || (node->sect_info.size != TEST_SECT_SIZE50)) - TEST_ERROR + TEST_ERROR if(TEST_sect_free((H5FS_section_info_t *)node) < 0) - TEST_ERROR + TEST_ERROR /* remove sections A, C and D */ - if(H5FS_sect_remove(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) - FAIL_STACK_ERROR - if(H5FS_sect_remove(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node3) < 0) - FAIL_STACK_ERROR - if(H5FS_sect_remove(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node4) < 0) - FAIL_STACK_ERROR + if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) + FAIL_STACK_ERROR + if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node3) < 0) + FAIL_STACK_ERROR + if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node4) < 0) + FAIL_STACK_ERROR /* Free the section node(s) */ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0) - TEST_ERROR + TEST_ERROR sect_node1 = NULL; if(TEST_sect_free((H5FS_section_info_t *)sect_node3) < 0) - TEST_ERROR + TEST_ERROR sect_node3 = NULL; if(TEST_sect_free((H5FS_section_info_t *)sect_node4) < 0) - TEST_ERROR + TEST_ERROR sect_node4 = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) - FAIL_STACK_ERROR + if(H5FS_close(f, dxpl_id, frsp) < 0) + FAIL_STACK_ERROR frsp = NULL; PASSED() @@ -1105,26 +1134,26 @@ test_fs_sect_find(hid_t fapl) TESTING("H5FS_sect_find() a section greater than requested-size from free-space"); /* reopen the free-space manager */ - if(NULL == (frsp = H5FS_open(f, H5AC_ind_read_dxpl_id, fs_addr, nclasses, + if(NULL == (frsp = H5FS_open(f, dxpl_id, fs_addr, nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(!H5F_addr_defined(fs_addr)) TEST_ERROR if (frsp->nclasses != nclasses) - TEST_ERROR + TEST_ERROR /* * Add section A */ if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); state.tot_space += sect_node1->sect_info.size; @@ -1138,13 +1167,13 @@ test_fs_sect_find(hid_t fapl) * Add section B */ if(NULL == (sect_node2 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR200, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR state.tot_space += sect_node2->sect_info.size; state.tot_sect_count += 1; @@ -1153,30 +1182,31 @@ test_fs_sect_find(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR - if (!node_found) TEST_ERROR + if (!node_found) + TEST_ERROR if ((node->sect_info.addr != TEST_SECT_ADDR200) || (node->sect_info.size < TEST_SECT_SIZE50)) - TEST_ERROR + TEST_ERROR if(TEST_sect_free((H5FS_section_info_t *)node) < 0) - TEST_ERROR + TEST_ERROR node = NULL; /* remove sections A */ - if(H5FS_sect_remove(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) - FAIL_STACK_ERROR + if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) + FAIL_STACK_ERROR /* Free the section node(s) */ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0) - TEST_ERROR + TEST_ERROR sect_node1 = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) - FAIL_STACK_ERROR + if(H5FS_close(f, dxpl_id, frsp) < 0) + FAIL_STACK_ERROR frsp = NULL; PASSED() @@ -1184,26 +1214,26 @@ test_fs_sect_find(hid_t fapl) TESTING("H5FS_sect_find(): cannot find a section with requested-size from free-space"); /* reopen the free-space manager */ - if(NULL == (frsp = H5FS_open(f, H5AC_ind_read_dxpl_id, fs_addr, nclasses, + if(NULL == (frsp = H5FS_open(f, dxpl_id, fs_addr, nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR if(!H5F_addr_defined(fs_addr)) TEST_ERROR if (frsp->nclasses != nclasses) - TEST_ERROR + TEST_ERROR /* * Add section A */ if(NULL == (sect_node1 = (TEST_free_section_t *)HDmalloc(sizeof(TEST_free_section_t)))) - FAIL_STACK_ERROR + FAIL_STACK_ERROR init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); state.tot_space += sect_node1->sect_info.size; @@ -1213,38 +1243,40 @@ test_fs_sect_find(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if (node_found) TEST_ERROR /* remove sections A */ - if(H5FS_sect_remove(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) - FAIL_STACK_ERROR + if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) + FAIL_STACK_ERROR /* Free the section node(s) */ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0) - TEST_ERROR + TEST_ERROR sect_node1 = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) - FAIL_STACK_ERROR + if(H5FS_close(f, dxpl_id, frsp) < 0) + FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) - FAIL_STACK_ERROR + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) + FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file */ + /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR + if(H5Pclose(dxpl_id) < 0) + FAIL_STACK_ERROR PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { @@ -1255,10 +1287,11 @@ error: if(sect_node4) TEST_sect_free((H5FS_section_info_t *)sect_node4); if(frsp) - H5FS_close(f, H5AC_ind_read_dxpl_id, frsp); - H5Fclose(file); + H5FS_close(f, dxpl_id, frsp); + H5Fclose(file); + H5Pclose(dxpl_id); } H5E_END_TRY; - return(1); + return 1; } /* test_fs_sect_find() */ @@ -1298,6 +1331,7 @@ static unsigned test_fs_sect_merge(hid_t fapl) { hid_t file = -1; /* File ID */ + hid_t dxpl_id = -1; /* dxpl ID (for tag) */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ @@ -1330,7 +1364,13 @@ test_fs_sect_merge(hid_t fapl) init_cparam(&cparam); nclasses = NELMTS(test_classes); - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + /* Create the dxpl and tag it with the global free space tag */ + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + FAIL_STACK_ERROR + if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0) + FAIL_STACK_ERROR + + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -1345,7 +1385,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1365,7 +1405,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1383,7 +1423,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE10, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1401,7 +1441,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR150, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node4, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node4, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1413,7 +1453,7 @@ test_fs_sect_merge(hid_t fapl) /* should be able to find the merged section of A, B, C & D */ - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE10+TEST_SECT_SIZE30+TEST_SECT_SIZE50+TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1426,12 +1466,12 @@ test_fs_sect_merge(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -1458,7 +1498,7 @@ test_fs_sect_merge(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = H5FS_CLS_SEPAR_OBJ; - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -1473,7 +1513,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1493,7 +1533,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1506,17 +1546,17 @@ test_fs_sect_merge(hid_t fapl) TEST_ERROR /* should not be able to find the merged section of A & B */ - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE30+TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if (node_found) TEST_ERROR /* remove section A from free-space */ - if(H5FS_sect_remove(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) + if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) FAIL_STACK_ERROR /* remove section B from free-space */ - if(H5FS_sect_remove(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2) < 0) + if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2) < 0) FAIL_STACK_ERROR /* Free the section node(s) */ @@ -1528,12 +1568,12 @@ test_fs_sect_merge(hid_t fapl) sect_node2 = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -1560,7 +1600,7 @@ test_fs_sect_merge(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = 0; /* reset */ - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -1575,7 +1615,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE10, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1595,7 +1635,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1615,7 +1655,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1633,7 +1673,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR150, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node4, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node4, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1649,14 +1689,14 @@ test_fs_sect_merge(hid_t fapl) TEST_ERROR /* should not be able to find a merged section of A, B, C & D */ - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE10+TEST_SECT_SIZE30+TEST_SECT_SIZE50+TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if (node_found) TEST_ERROR /* should be able to find the merged section of B & C */ - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE30+TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1670,7 +1710,7 @@ test_fs_sect_merge(hid_t fapl) TEST_ERROR /* should be able to find section A */ - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE10), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1683,7 +1723,7 @@ test_fs_sect_merge(hid_t fapl) TEST_ERROR /* should be able to find section D */ - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1696,22 +1736,24 @@ test_fs_sect_merge(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file */ + /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR + if(H5Pclose(dxpl_id) < 0) + FAIL_STACK_ERROR PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { @@ -1720,10 +1762,11 @@ error: if(sect_node2) TEST_sect_free((H5FS_section_info_t *)sect_node2); if(frsp) - H5FS_close(f, H5AC_ind_read_dxpl_id, frsp); - H5Fclose(file); + H5FS_close(f, dxpl_id, frsp); + H5Pclose(dxpl_id); + H5Fclose(file); } H5E_END_TRY; - return(1); + return 1; } /* test_fs_sect_merge() */ /* @@ -1764,6 +1807,7 @@ static unsigned test_fs_sect_shrink(hid_t fapl) { hid_t file = -1; /* File ID */ + hid_t dxpl_id = -1; /* dxpl ID (for tag) */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ @@ -1796,7 +1840,13 @@ test_fs_sect_shrink(hid_t fapl) TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */ - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + /* Create the dxpl and tag it with the global free space tag */ + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + FAIL_STACK_ERROR + if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0) + FAIL_STACK_ERROR + + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -1812,7 +1862,7 @@ test_fs_sect_shrink(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE); can_shrink = FALSE; - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -1825,7 +1875,7 @@ test_fs_sect_shrink(hid_t fapl) TEST_ERROR /* section A should still be there in free-space */ - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1846,7 +1896,7 @@ test_fs_sect_shrink(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); can_shrink = FALSE; - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -1857,19 +1907,19 @@ test_fs_sect_shrink(hid_t fapl) TEST_ERROR /* section A should not be there in free-space */ - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if (node_found) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -1897,7 +1947,7 @@ test_fs_sect_shrink(hid_t fapl) /* does not allow merging */ init_flags = H5FS_CLS_SEPAR_OBJ; - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -1912,7 +1962,7 @@ test_fs_sect_shrink(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -1932,7 +1982,7 @@ test_fs_sect_shrink(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -1941,7 +1991,7 @@ test_fs_sect_shrink(hid_t fapl) TEST_ERROR /* section B should not be there in free-space */ - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1952,7 +2002,7 @@ test_fs_sect_shrink(hid_t fapl) /* section A should still be there in free-space */ - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE20), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1965,12 +2015,12 @@ test_fs_sect_shrink(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -1996,7 +2046,7 @@ test_fs_sect_shrink(hid_t fapl) TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */ init_flags = 0; /* reset */ - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2011,7 +2061,7 @@ test_fs_sect_shrink(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -2031,7 +2081,7 @@ test_fs_sect_shrink(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -2041,44 +2091,47 @@ test_fs_sect_shrink(hid_t fapl) TEST_ERROR /* section B should not be there in free-space */ - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if (node_found) TEST_ERROR /* section A should not be there in free-space */ - if((node_found = H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if((node_found = H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE30), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if (node_found) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file */ + /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR + if(H5Pclose(dxpl_id) < 0) + FAIL_STACK_ERROR PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { if(frsp) - H5FS_close(f, H5AC_ind_read_dxpl_id, frsp); - H5Fclose(file); + H5FS_close(f, dxpl_id, frsp); + H5Fclose(file); + H5Pclose(dxpl_id); } H5E_END_TRY; - return(1); + return 1; } /* test_sect_shrink() */ /* @@ -2102,6 +2155,7 @@ static unsigned test_fs_sect_change_class(hid_t fapl) { hid_t file = -1; /* File ID */ + hid_t dxpl_id = -1; /* dxpl ID (for tag) */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ @@ -2130,8 +2184,14 @@ test_fs_sect_change_class(hid_t fapl) init_cparam(&cparam); nclasses = NELMTS(test_classes); + /* Create the dxpl and tag it with the global free space tag */ + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + FAIL_STACK_ERROR + if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0) + FAIL_STACK_ERROR + init_flags = H5FS_CLS_GHOST_OBJ; - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2146,7 +2206,7 @@ test_fs_sect_change_class(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2166,7 +2226,7 @@ test_fs_sect_change_class(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2177,7 +2237,7 @@ test_fs_sect_change_class(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if (H5FS_sect_change_class(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if (H5FS_sect_change_class(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, TEST_FSPACE_SECT_TYPE_NONE) < 0) TEST_ERROR @@ -2186,7 +2246,7 @@ test_fs_sect_change_class(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if(H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE30, (H5FS_section_info_t **)&node) < 0) FAIL_STACK_ERROR @@ -2196,7 +2256,7 @@ test_fs_sect_change_class(hid_t fapl) if(TEST_sect_free((H5FS_section_info_t *)node) < 0) TEST_ERROR - if(H5FS_sect_remove(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2) < 0) + if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2) < 0) FAIL_STACK_ERROR /* Free the section node(s) */ @@ -2205,12 +2265,12 @@ test_fs_sect_change_class(hid_t fapl) sect_node2 = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -2237,7 +2297,7 @@ test_fs_sect_change_class(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = H5FS_CLS_SEPAR_OBJ; - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2252,7 +2312,7 @@ test_fs_sect_change_class(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2264,7 +2324,7 @@ test_fs_sect_change_class(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2276,17 +2336,17 @@ test_fs_sect_change_class(hid_t fapl) init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR200, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR /* change the class of B to A's class */ - if (H5FS_sect_change_class(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if (H5FS_sect_change_class(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, TEST_FSPACE_SECT_TYPE) < 0) TEST_ERROR /* change the class of C to A's class */ - if (H5FS_sect_change_class(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, + if (H5FS_sect_change_class(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, TEST_FSPACE_SECT_TYPE) < 0) TEST_ERROR @@ -2296,7 +2356,7 @@ test_fs_sect_change_class(hid_t fapl) TEST_ERROR /* verify that section B has changed class */ - if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if(H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node) < 0) FAIL_STACK_ERROR @@ -2307,7 +2367,7 @@ test_fs_sect_change_class(hid_t fapl) TEST_ERROR /* verify that section C has changed class */ - if(H5FS_sect_find(f, H5AC_ind_read_dxpl_id, frsp, + if(H5FS_sect_find(f, dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE80, (H5FS_section_info_t **)&node) < 0) FAIL_STACK_ERROR @@ -2318,7 +2378,7 @@ test_fs_sect_change_class(hid_t fapl) TEST_ERROR /* remove section A from free-space */ - if(H5FS_sect_remove(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) + if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) FAIL_STACK_ERROR /* Free the section node(s) */ @@ -2327,22 +2387,24 @@ test_fs_sect_change_class(hid_t fapl) sect_node1 = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file */ + /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR + if(H5Pclose(dxpl_id) < 0) + FAIL_STACK_ERROR PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { @@ -2351,10 +2413,11 @@ error: if(sect_node2) TEST_sect_free((H5FS_section_info_t *)sect_node2); if(frsp) - H5FS_close(f, H5AC_ind_read_dxpl_id, frsp); - H5Fclose(file); + H5FS_close(f, dxpl_id, frsp); + H5Fclose(file); + H5Pclose(dxpl_id); } H5E_END_TRY; - return(1); + return 1; } /* test_sect_change_class() */ @@ -2392,6 +2455,7 @@ static unsigned test_fs_sect_extend(hid_t fapl) { hid_t file = -1; /* File ID */ + hid_t dxpl_id = -1; /* dxpl ID (for tag) */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ @@ -2415,13 +2479,19 @@ test_fs_sect_extend(hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + /* Create the dxpl and tag it with the global free space tag */ + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + FAIL_STACK_ERROR + if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0) + FAIL_STACK_ERROR + /* * TEST 1 */ init_cparam(&cparam); nclasses = NELMTS(test_classes); - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2436,7 +2506,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2456,7 +2526,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2468,7 +2538,7 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Extend a block by requested-size */ - if((status = H5FS_sect_try_extend(f, H5AC_ind_read_dxpl_id, frsp, (haddr_t)TEST_SECT_SIZE80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE40)) < 0) + if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_SIZE80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE40)) < 0) FAIL_STACK_ERROR if(FALSE == status) TEST_ERROR @@ -2481,12 +2551,12 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -2497,7 +2567,7 @@ test_fs_sect_extend(hid_t fapl) */ TESTING("a block's extension by requested-size which is > adjoining free section's size: Test 2"); - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2512,7 +2582,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2532,7 +2602,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2544,7 +2614,7 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Extend the block by requested-size */ - if((status = H5FS_sect_try_extend(f, H5AC_ind_read_dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE50)) < 0) + if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE50)) < 0) FAIL_STACK_ERROR if(TRUE == status) TEST_ERROR @@ -2554,12 +2624,12 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -2570,7 +2640,7 @@ test_fs_sect_extend(hid_t fapl) */ TESTING("a block's extension by requested-size which is < adjoining free section's size: Test 3"); - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2585,7 +2655,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2605,7 +2675,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2617,7 +2687,7 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Extend the block by requested-size */ - if((status = H5FS_sect_try_extend(f, H5AC_ind_read_dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE30)) < 0) + if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE30)) < 0) TEST_ERROR if(FALSE == status) TEST_ERROR @@ -2628,12 +2698,12 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -2644,7 +2714,7 @@ test_fs_sect_extend(hid_t fapl) */ TESTING("a block's extension by requested-size which does not adjoin any free section: Test 4"); - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2659,7 +2729,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2679,7 +2749,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2691,7 +2761,7 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Extend the block by requested-size */ - if((status = H5FS_sect_try_extend(f, H5AC_ind_read_dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE15, (hsize_t)TEST_SECT_SIZE40)) < 0) + if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE15, (hsize_t)TEST_SECT_SIZE40)) < 0) TEST_ERROR if(TRUE == status) TEST_ERROR @@ -2701,30 +2771,33 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; PASSED() - /* Close the file */ + /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR + if(H5Pclose(dxpl_id) < 0) + FAIL_STACK_ERROR - return(0); + return 0; error: H5E_BEGIN_TRY { if(frsp) - H5FS_close(f, H5AC_ind_read_dxpl_id, frsp); - H5Fclose(file); + H5FS_close(f, dxpl_id, frsp); + H5Fclose(file); + H5Pclose(dxpl_id); } H5E_END_TRY; - return(1); + return 1; } /* test_sect_extend() */ @@ -2740,6 +2813,7 @@ static unsigned test_fs_sect_iterate(hid_t fapl) { hid_t file = -1; /* File ID */ + hid_t dxpl_id = -1; /* dxpl ID (for tag) */ char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5FS_t *frsp = NULL; /* pointer to free space structure */ @@ -2771,8 +2845,14 @@ test_fs_sect_iterate(hid_t fapl) udata.tot_size = 0; udata.tot_sect_count = 0; + /* Create the dxpl and tag it with the global free space tag */ + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) + FAIL_STACK_ERROR + if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0) + FAIL_STACK_ERROR + init_flags = H5FS_CLS_SEPAR_OBJ; - if(NULL == (frsp = H5FS_create(f, H5AC_ind_read_dxpl_id, &fs_addr, + if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2786,12 +2866,12 @@ test_fs_sect_iterate(hid_t fapl) sect_size = (unsigned)((i-1) % 9) + 1; init_sect_node(sect_node, (haddr_t)i*10, (hsize_t)sect_size, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5AC_ind_read_dxpl_id, frsp, (H5FS_section_info_t *)sect_node, + if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR } - if(H5FS_sect_iterate(f, H5AC_ind_read_dxpl_id, frsp, TEST_sects_cb, &udata) < 0) + if(H5FS_sect_iterate(f, dxpl_id, frsp, TEST_sects_cb, &udata) < 0) TEST_ERROR H5FS_sect_stats(frsp, &tot_space, &nsects); @@ -2802,30 +2882,33 @@ test_fs_sect_iterate(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5AC_ind_read_dxpl_id, frsp) < 0) + if(H5FS_close(f, dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5AC_ind_read_dxpl_id, fs_addr) < 0) + if(H5FS_delete(f, dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; - /* Close the file */ + /* Close the file and dxpl */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR + if(H5Pclose(dxpl_id) < 0) + FAIL_STACK_ERROR PASSED() - return(0); + return 0; error: H5E_BEGIN_TRY { if(frsp) - H5FS_close(f, H5AC_ind_read_dxpl_id, frsp); - H5Fclose(file); + H5FS_close(f, dxpl_id, frsp); + H5Fclose(file); + H5Pclose(dxpl_id); } H5E_END_TRY; - return(1); + return 1; } /* test_fs_sect_iterate() */ @@ -2866,13 +2949,13 @@ main(void) puts("All free-space tests passed."); h5_cleanup(FILENAME, fapl); - return (0); + return 0; error: puts("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Pclose(fapl); } H5E_END_TRY; - return (1); + return 1; } /* main() */ |