diff options
Diffstat (limited to 'src')
60 files changed, 1519 insertions, 1501 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 999420c..e5f7e2f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -770,16 +770,8 @@ set (H5_PRIVATE_HEADERS # Setup the H5Detect utility which generates H5Tinit with platform # specific type checks inside #----------------------------------------------------------------------------- -#add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) -#TARGET_C_PROPERTIES (H5detect " " " ") -IF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - SET (LOCAL_OPT_FLAG "-O0") -ELSE (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - SET (LOCAL_OPT_FLAG " ") -ENDIF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) -ADD_EXECUTABLE (H5detect ${HDF5_SRC_DIR}/H5detect.c) -TARGET_C_PROPERTIES (H5detect ${LOCAL_OPT_FLAG} " ") - +add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) +TARGET_C_PROPERTIES (H5detect STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5detect "ws2_32.lib") endif (MSVC OR MINGW) @@ -793,7 +785,7 @@ add_custom_command ( ) add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) -TARGET_C_PROPERTIES (H5make_libsettings " " " ") +TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5make_libsettings "ws2_32.lib") endif (MSVC OR MINGW) @@ -860,7 +852,7 @@ set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5overflow.h) set_source_files_properties (${HDF5_BINARY_DIR}/H5overflow.h GENERATED) add_library (${HDF5_LIB_TARGET} ${LIB_TYPE} ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS}) -TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} " " " ") +TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} ${LIB_TYPE} " " " ") target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS}) if (NOT WIN32) target_link_libraries (${HDF5_LIB_TARGET} dl) @@ -638,7 +638,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") /* Go write the actual data to the attribute */ - if((ret_value = H5A_read(attr, mem_type, buf, H5AC_dxpl_id)) < 0) + if((ret_value = H5A_read(attr, mem_type, buf, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: @@ -1160,7 +1160,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Call private attribute rename routine */ - if(H5A_rename_by_name(loc, obj_name, old_attr_name, new_attr_name, lapl_id) < 0) + if(H5A_rename_by_name(loc, obj_name, old_attr_name, new_attr_name, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1537,7 +1537,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; @@ -1668,7 +1668,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") - if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id)) < 0) + if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: @@ -106,11 +106,6 @@ H5FL_DEFINE_STATIC(H5AC_slist_entry_t); /* (Global variable definition, declaration is in H5ACprivate.h also) */ hid_t H5AC_dxpl_id=(-1); -/* Private dataset transfer property list for metadata I/O calls */ -/* (Collective set and "library internal" set) */ -/* (Static variable definition) */ -static hid_t H5AC_noblock_dxpl_id=(-1); - /* Dataset transfer property list for independent metadata I/O calls */ /* (just "library internal" set - i.e. independent transfer mode) */ /* (Global variable definition, declaration is in H5ACprivate.h also) */ @@ -257,9 +252,7 @@ H5AC_init_interface(void) { #ifdef H5_HAVE_PARALLEL H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ - unsigned block_before_meta_write; /* "block before meta write" property value */ unsigned coll_meta_write; /* "collective metadata write" property value */ - unsigned library_internal = 1; /* "library internal" property value */ #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ @@ -269,7 +262,7 @@ H5AC_init_interface(void) /* Sanity check */ HDassert(H5P_CLS_DATASET_XFER_g != NULL); - /* Get an ID for the blocking, collective H5AC dxpl */ + /* Get an ID for the collective H5AC dxpl */ if((H5AC_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") @@ -277,51 +270,13 @@ H5AC_init_interface(void) if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") - /* Insert 'block before metadata write' property */ - block_before_meta_write=1; - if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write, - NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") - - /* Insert 'library internal' property */ - if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal, - NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") - - /* Insert 'collective metadata write' property */ - coll_meta_write = 1; - if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") - - - /* Get an ID for the non-blocking, collective H5AC dxpl */ - if((H5AC_noblock_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") - - /* Get the property list object */ - if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_noblock_dxpl_id))) - HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") - - /* Insert 'block before metadata write' property */ - block_before_meta_write=0; - if(H5P_insert(xfer_plist,H5AC_BLOCK_BEFORE_META_WRITE_NAME,H5AC_BLOCK_BEFORE_META_WRITE_SIZE,&block_before_meta_write, - NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") - - /* Insert 'library internal' property */ - if(H5P_insert(xfer_plist,H5AC_LIBRARY_INTERNAL_NAME,H5AC_LIBRARY_INTERNAL_SIZE,&library_internal, - NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") - /* Insert 'collective metadata write' property */ coll_meta_write = 1; if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") - - /* Get an ID for the non-blocking, independent H5AC dxpl */ + /* Get an ID for the independent H5AC dxpl */ if((H5AC_ind_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") @@ -329,29 +284,16 @@ H5AC_init_interface(void) if(NULL == (H5AC_ind_dxpl_g = (H5P_genplist_t *)H5I_object(H5AC_ind_dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") - /* Insert 'block before metadata write' property */ - block_before_meta_write=0; - if(H5P_insert(H5AC_ind_dxpl_g, H5AC_BLOCK_BEFORE_META_WRITE_NAME, H5AC_BLOCK_BEFORE_META_WRITE_SIZE, &block_before_meta_write, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") - - /* Insert 'library internal' property */ - if(H5P_insert(H5AC_ind_dxpl_g, H5AC_LIBRARY_INTERNAL_NAME, H5AC_LIBRARY_INTERNAL_SIZE, &library_internal, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") - /* Insert 'collective metadata write' property */ coll_meta_write = 0; if(H5P_insert(H5AC_ind_dxpl_g, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") - #else /* H5_HAVE_PARALLEL */ /* Sanity check */ HDassert(H5P_LST_DATASET_XFER_ID_g!=(-1)); H5AC_dxpl_id = H5P_DATASET_XFER_DEFAULT; - H5AC_noblock_dxpl_id = H5P_DATASET_XFER_DEFAULT; H5AC_ind_dxpl_id = H5P_DATASET_XFER_DEFAULT; /* Get the property list objects for the IDs */ @@ -388,19 +330,17 @@ H5AC_term_interface(void) if (H5_interface_initialize_g) { #ifdef H5_HAVE_PARALLEL - if(H5AC_dxpl_id > 0 || H5AC_noblock_dxpl_id > 0 || H5AC_ind_dxpl_id > 0) { + if(H5AC_dxpl_id > 0 || H5AC_ind_dxpl_id > 0) { /* Indicate more work to do */ n = 1; /* H5I */ /* Close H5AC dxpl */ if(H5I_dec_ref(H5AC_dxpl_id) < 0 || - H5I_dec_ref(H5AC_noblock_dxpl_id) < 0 || H5I_dec_ref(H5AC_ind_dxpl_id) < 0) H5E_clear_stack(NULL); /*ignore error*/ else { /* Reset static IDs */ H5AC_dxpl_id = (-1); - H5AC_noblock_dxpl_id = (-1); H5AC_ind_dxpl_id = (-1); /* Reset interface initialization flag */ @@ -411,7 +351,6 @@ H5AC_term_interface(void) #else /* H5_HAVE_PARALLEL */ /* Reset static IDs */ H5AC_dxpl_id=(-1); - H5AC_noblock_dxpl_id=(-1); H5AC_ind_dxpl_id=(-1); #endif /* H5_HAVE_PARALLEL */ /* Reset interface initialization flag */ @@ -659,7 +598,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #ifdef H5_HAVE_PARALLEL H5AC_aux_t * aux_ptr = NULL; #endif /* H5_HAVE_PARALLEL */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -689,7 +628,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #endif /* H5_HAVE_PARALLEL */ /* Destroy the cache */ - if(H5C_dest(f, dxpl_id, H5AC_noblock_dxpl_id) < 0) + if(H5C_dest(f, dxpl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache") f->shared->cache = NULL; @@ -702,8 +641,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) if(aux_ptr->candidate_slist_ptr != NULL) H5SL_close(aux_ptr->candidate_slist_ptr); aux_ptr->magic = 0; - H5FL_FREE(H5AC_aux_t, aux_ptr); - aux_ptr = NULL; + aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr); } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -771,7 +709,7 @@ H5AC_expunge_entry(H5F_t *f, result = H5C_expunge_entry(f, dxpl_id, - H5AC_noblock_dxpl_id, + H5AC_dxpl_id, type, addr, flags); @@ -850,7 +788,7 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id) #endif /* H5_HAVE_PARALLEL */ /* Flush the cache */ - if(H5C_flush_cache(f, dxpl_id, H5AC_noblock_dxpl_id, H5AC__NO_FLAGS_SET) < 0) + if(H5C_flush_cache(f, dxpl_id, H5AC_dxpl_id, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache.") done: @@ -992,7 +930,7 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add #endif /* H5AC__TRACE_FILE_ENABLED */ /* Insert entry into metadata cache */ - if(H5C_insert_entry(f, dxpl_id, H5AC_noblock_dxpl_id, type, addr, thing, flags) < 0) + if(H5C_insert_entry(f, dxpl_id, H5AC_dxpl_id, type, addr, thing, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_insert_entry() failed") #if H5AC__TRACE_FILE_ENABLED @@ -1013,7 +951,7 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add /* Check if we should try to flush */ if(aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) - if(H5AC_run_sync_point(f, H5AC_noblock_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) + if(H5AC_run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") } /* end if */ } @@ -1166,7 +1104,7 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne #ifdef H5_HAVE_PARALLEL /* Check if we should try to flush */ if(NULL != aux_ptr && aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) { - if(H5AC_run_sync_point(f, H5AC_noblock_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) + if(H5AC_run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -1378,7 +1316,7 @@ H5AC_protect(H5F_t *f, thing = H5C_protect(f, dxpl_id, - H5AC_noblock_dxpl_id, + H5AC_dxpl_id, type, addr, udata, @@ -1696,13 +1634,13 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, } /* end if */ #endif /* H5_HAVE_PARALLEL */ - if(H5C_unprotect(f, dxpl_id, H5AC_noblock_dxpl_id, type, addr, thing, flags) < 0) + if(H5C_unprotect(f, dxpl_id, H5AC_dxpl_id, type, addr, thing, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "H5C_unprotect() failed.") #ifdef H5_HAVE_PARALLEL /* Check if we should try to flush */ if((aux_ptr != NULL) && (aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)) { - if(H5AC_run_sync_point(f, H5AC_noblock_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) + if(H5AC_run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -2925,7 +2863,7 @@ H5AC_broadcast_clean_list(H5AC_t * cache_ptr) */ if ( aux_ptr->sync_point_done != NULL ) { - addr_buf_ptr = H5MM_malloc((size_t)num_entries * sizeof(haddr_t)); + addr_buf_ptr = (haddr_t *)H5MM_malloc((size_t)num_entries * sizeof(haddr_t)); if ( addr_buf_ptr == NULL ) { @@ -2971,8 +2909,7 @@ H5AC_broadcast_clean_list(H5AC_t * cache_ptr) } slist_entry_ptr->magic = 0; - H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); - slist_entry_ptr = NULL; + slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); aux_ptr->c_slist_len -= 1; @@ -2981,7 +2918,7 @@ H5AC_broadcast_clean_list(H5AC_t * cache_ptr) /* and also remove the matching entry from the dirtied list * if it exists. */ - if((slist_entry_ptr = H5SL_search(aux_ptr->d_slist_ptr, (void *)(&addr))) != NULL) { + if((slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_search(aux_ptr->d_slist_ptr, (void *)(&addr))) != NULL) { HDassert( slist_entry_ptr->magic == H5AC__H5AC_SLIST_ENTRY_T_MAGIC ); HDassert( slist_entry_ptr->addr == addr ); @@ -2989,8 +2926,7 @@ H5AC_broadcast_clean_list(H5AC_t * cache_ptr) HGOTO_ERROR(H5E_CACHE, H5E_CANTDELETE, FAIL, "Can't delete entry from dirty entry slist.") slist_entry_ptr->magic = 0; - H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); - slist_entry_ptr = NULL; + slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); aux_ptr->d_slist_len -= 1; @@ -3282,8 +3218,7 @@ H5AC_copy_candidate_list_to_buffer(H5AC_t * cache_ptr, HGOTO_ERROR(H5E_CACHE, H5E_CANTDELETE, FAIL, "Can't delete entry from candidate entry slist.") slist_entry_ptr->magic = 0; - H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); - slist_entry_ptr = NULL; + slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); aux_ptr->candidate_slist_len -= 1; @@ -3450,8 +3385,7 @@ H5AC_log_deleted_entry(H5AC_t * cache_ptr, HGOTO_ERROR(H5E_CACHE, H5E_CANTDELETE, FAIL, "Can't delete entry from dirty entry slist.") slist_entry_ptr->magic = 0; - H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); - slist_entry_ptr = NULL; + slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); aux_ptr->d_slist_len -= 1; @@ -3467,8 +3401,7 @@ H5AC_log_deleted_entry(H5AC_t * cache_ptr, HGOTO_ERROR(H5E_CACHE, H5E_CANTDELETE, FAIL, "Can't delete entry from cleaned entry slist.") slist_entry_ptr->magic = 0; - H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); - slist_entry_ptr = NULL; + slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); aux_ptr->c_slist_len -= 1; @@ -3577,8 +3510,7 @@ H5AC_log_dirtied_entry(const H5AC_info_t * entry_ptr, HGOTO_ERROR(H5E_CACHE, H5E_CANTDELETE, FAIL, "Can't delete entry from clean entry slist.") slist_entry_ptr->magic = 0; - H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); - slist_entry_ptr = NULL; + slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); aux_ptr->c_slist_len -= 1; @@ -3672,8 +3604,7 @@ H5AC_log_flushed_entry(H5C_t * cache_ptr, } slist_entry_ptr->magic = 0; - H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); - slist_entry_ptr = NULL; + slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); aux_ptr->c_slist_len -= 1; @@ -3694,8 +3625,7 @@ H5AC_log_flushed_entry(H5C_t * cache_ptr, } slist_entry_ptr->magic = 0; - H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); - slist_entry_ptr = NULL; + slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); aux_ptr->d_slist_len -= 1; @@ -3925,8 +3855,7 @@ H5AC_log_moved_entry(const H5F_t *f, } slist_entry_ptr->magic = 0; - H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); - slist_entry_ptr = NULL; + slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, slist_entry_ptr); aux_ptr->c_slist_len -= 1; @@ -4307,7 +4236,7 @@ H5AC_propagate_flushed_and_still_clean_entries_list(H5F_t * f, HDassert( aux_ptr->c_slist_len == 0 ); } /* end if */ else { - if(H5AC_receive_and_apply_clean_list(f, dxpl_id, H5AC_noblock_dxpl_id, cache_ptr) < 0) + if(H5AC_receive_and_apply_clean_list(f, dxpl_id, H5AC_dxpl_id, cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive and/or process clean slist broadcast.") } /* end else */ @@ -4881,7 +4810,7 @@ H5AC_rsp__p0_only__flush(H5F_t *f, } /* end if */ /* Propagate cleaned entries to other ranks. */ - if(H5AC_propagate_flushed_and_still_clean_entries_list(f, H5AC_noblock_dxpl_id, cache_ptr) < 0) + if(H5AC_propagate_flushed_and_still_clean_entries_list(f, H5AC_dxpl_id, cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") done: @@ -4988,7 +4917,7 @@ H5AC_rsp__p0_only__flush_to_min_clean(H5F_t *f, */ aux_ptr->write_permitted = TRUE; - result = H5C_flush_to_min_clean(f, dxpl_id, H5AC_noblock_dxpl_id); + result = H5C_flush_to_min_clean(f, dxpl_id, H5AC_dxpl_id); aux_ptr->write_permitted = FALSE; @@ -5232,7 +5161,7 @@ H5AC_tidy_cache_0_lists(H5AC_t * cache_ptr, HGOTO_ERROR(H5E_CACHE, H5E_CANTDELETE, FAIL, "Can't delete entry from dirty entry slist.") d_slist_entry_ptr->magic = 0; - H5FL_FREE(H5AC_slist_entry_t, d_slist_entry_ptr); + d_slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, d_slist_entry_ptr); aux_ptr->d_slist_len -= 1; @@ -5248,7 +5177,7 @@ H5AC_tidy_cache_0_lists(H5AC_t * cache_ptr, HGOTO_ERROR(H5E_CACHE, H5E_CANTDELETE, FAIL, "Can't delete entry from clean entry slist.") c_slist_entry_ptr->magic = 0; - H5FL_FREE(H5AC_slist_entry_t, c_slist_entry_ptr); + c_slist_entry_ptr = H5FL_FREE(H5AC_slist_entry_t, c_slist_entry_ptr); aux_ptr->c_slist_len -= 1; @@ -5291,7 +5220,7 @@ H5AC_flush_entries(H5F_t *f) /* Check if we have >1 ranks */ if(f->shared->cache->aux_ptr) { - if(H5AC_run_sync_point(f, H5AC_noblock_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_CACHE) < 0) + if(H5AC_run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_CACHE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") } /* end if */ diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 623f502..0a958b0 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -42,6 +42,7 @@ #define H5AC__TRACE_FILE_ENABLED 0 #endif /* H5_METADATA_TRACE_FILE */ +/* Global metadata tag values */ #define H5AC__INVALID_TAG (haddr_t)0 #define H5AC__IGNORE_TAG (haddr_t)1 #define H5AC__SUPERBLOCK_TAG (haddr_t)2 @@ -195,20 +196,10 @@ typedef H5C_t H5AC_t; /* Metadata specific properties for FAPL */ /* (Only used for parallel I/O) */ #ifdef H5_HAVE_PARALLEL -/* Definitions for "block before metadata write" property */ -#define H5AC_BLOCK_BEFORE_META_WRITE_NAME "H5AC_block_before_meta_write" -#define H5AC_BLOCK_BEFORE_META_WRITE_SIZE sizeof(unsigned) -#define H5AC_BLOCK_BEFORE_META_WRITE_DEF 0 - /* Definitions for "collective metadata write" property */ #define H5AC_COLLECTIVE_META_WRITE_NAME "H5AC_collective_metadata_write" #define H5AC_COLLECTIVE_META_WRITE_SIZE sizeof(unsigned) #define H5AC_COLLECTIVE_META_WRITE_DEF 0 - -/* Definitions for "library internal" property */ -#define H5AC_LIBRARY_INTERNAL_NAME "H5AC_library_internal" -#define H5AC_LIBRARY_INTERNAL_SIZE sizeof(unsigned) -#define H5AC_LIBRARY_INTERNAL_DEF 0 #endif /* H5_HAVE_PARALLEL */ #define H5AC_METADATA_TAG_NAME "H5AC_metadata_tag" diff --git a/src/H5Aint.c b/src/H5Aint.c index 625bfa9..e28c2cc 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -1187,7 +1187,7 @@ H5A_type(const H5A_t *attr) */ htri_t H5A_exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name, - hid_t lapl_id) + hid_t lapl_id, hid_t dxpl_id) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ @@ -1203,12 +1203,12 @@ H5A_exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Check if the attribute exists */ - if((ret_value = H5O_attr_exists(obj_loc.oloc, attr_name, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5O_attr_exists(obj_loc.oloc, attr_name, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: @@ -2377,7 +2377,7 @@ done: */ herr_t H5A_rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name, - const char *new_attr_name, hid_t lapl_id) + const char *new_attr_name, hid_t lapl_id, hid_t dxpl_id) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ @@ -2400,7 +2400,7 @@ H5A_rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_nam loc_found = TRUE; /* Call attribute rename routine */ - if(H5O_attr_rename(obj_loc.oloc, H5AC_dxpl_id, old_attr_name, new_attr_name) < 0) + if(H5O_attr_rename(obj_loc.oloc, dxpl_id, old_attr_name, new_attr_name) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ diff --git a/src/H5Apkg.h b/src/H5Apkg.h index efa2b74..f587f81 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -206,9 +206,9 @@ H5_DLL herr_t H5A_close(H5A_t *attr); H5_DLL htri_t H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo); H5_DLL herr_t H5A_set_version(const H5F_t *f, H5A_t *attr); H5_DLL herr_t H5A_rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name, - const char *new_attr_name, hid_t lapl_id); + const char *new_attr_name, hid_t lapl_id, hid_t dxpl_id); H5_DLL htri_t H5A_exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name, - hid_t lapl_id); + hid_t lapl_id, hid_t dxpl_id); /* Attribute "dense" storage routines */ H5_DLL herr_t H5A_dense_create(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo); diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 7a538bd..3ea9534 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -337,7 +337,7 @@ H5_DLL herr_t H5B2_neighbor_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, /* Routines for removing records */ H5_DLL herr_t H5B2_remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, void *swap_loc, unsigned depth, - H5AC_info_t *parent_cache_info, hbool_t * parent_cache_info_dirtied_ptr, + H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr, H5B2_nodepos_t curr_pos, H5B2_node_ptr_t *curr_node_ptr, void *udata, H5B2_remove_t op, void *op_data); H5_DLL herr_t H5B2_remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, @@ -345,8 +345,8 @@ H5_DLL herr_t H5B2_remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, void *udata, H5B2_remove_t op, void *op_data); H5_DLL herr_t H5B2_remove_internal_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, void *swap_loc, unsigned depth, - H5AC_info_t *parent_cache_info, hbool_t * parent_cache_info_dirtied_ptr, - H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, hsize_t idx, + H5AC_info_t *parent_cache_info, unsigned *parent_cache_info_flags_ptr, + H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, hsize_t n, H5B2_remove_t op, void *op_data); H5_DLL herr_t H5B2_remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, @@ -329,7 +329,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) H5O_loc_t oloc; /* Dataset object location */ H5O_type_t obj_type; /* Type of object at location */ hbool_t loc_found = FALSE; /* Location at 'name' found */ - hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datset */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */ hid_t ret_value; FUNC_ENTER_API(FAIL) diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 35c2afa..d05de03 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -74,8 +74,8 @@ * The chunk's file address is part of the B-tree and not part of the key. */ typedef struct H5D_btree_key_t { - uint32_t nbytes; /*size of stored data */ hsize_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/ + uint32_t nbytes; /*size of stored data */ unsigned filter_mask; /*excluded filters */ } H5D_btree_key_t; @@ -255,7 +255,7 @@ H5D__btree_get_shared(const H5F_t UNUSED *f, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5D__btree_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, +H5D__btree_new_node(H5F_t *f, hid_t UNUSED dxpl_id, H5B_ins_t op, void *_lt_key, void *_udata, void *_rt_key, haddr_t *addr_p/*out*/) { @@ -265,7 +265,7 @@ H5D__btree_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, unsigned u; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC + FUNC_ENTER_STATIC_NOERR /* check args */ HDassert(f); @@ -275,18 +275,16 @@ H5D__btree_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, HDassert(udata->common.layout->ndims > 0 && udata->common.layout->ndims < H5O_LAYOUT_NDIMS); HDassert(addr_p); - /* Allocate new storage */ - HDassert(udata->nbytes > 0); - H5_CHECK_OVERFLOW(udata->nbytes, uint32_t, hsize_t); - if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->nbytes))) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "couldn't allocate new file storage") - udata->addr = *addr_p; + /* Set address */ + HDassert(H5F_addr_defined(udata->chunk_block.offset)); + HDassert(udata->chunk_block.length > 0); + *addr_p = udata->chunk_block.offset; /* * The left key describes the storage of the UDATA chunk being * inserted into the tree. */ - lt_key->nbytes = udata->nbytes; + H5_ASSIGN_OVERFLOW(lt_key->nbytes, udata->chunk_block.length, hsize_t, uint32_t); lt_key->filter_mask = udata->filter_mask; for(u = 0; u < udata->common.layout->ndims; u++) lt_key->offset[u] = udata->common.offset[u]; @@ -305,7 +303,6 @@ H5D__btree_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, } /* end if */ } /* end if */ -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__btree_new_node() */ @@ -468,8 +465,8 @@ H5D__btree_found(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr, const void /* Initialize return values */ HDassert(lt_key->nbytes > 0); - udata->addr = addr; - udata->nbytes = lt_key->nbytes; + udata->chunk_block.offset = addr; + udata->chunk_block.length = lt_key->nbytes; udata->filter_mask = lt_key->filter_mask; done: @@ -507,7 +504,7 @@ done: */ /* ARGSUSED */ static H5B_ins_t -H5D__btree_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, +H5D__btree_insert(H5F_t *f, hid_t UNUSED dxpl_id, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, hbool_t UNUSED *rt_key_changed, @@ -547,35 +544,17 @@ H5D__btree_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, * Already exists. If the new size is not the same as the old size * then we should reallocate storage. */ - if(lt_key->nbytes != udata->nbytes) { -/* Currently, the old chunk data is "thrown away" after the space is reallocated, - * so avoid data copy in H5MF_realloc() call by just free'ing the space and - * allocating new space. - * - * This should keep the file smaller also, by freeing the space and then - * allocating new space, instead of vice versa (in H5MF_realloc). - * - * QAK - 11/19/2002 - */ -#ifdef OLD_WAY - if(HADDR_UNDEF == (*new_node_p = H5MF_realloc(f, H5FD_MEM_DRAW, addr, - (hsize_t)lt_key->nbytes, (hsize_t)udata->nbytes))) - HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk storage") -#else /* OLD_WAY */ - H5_CHECK_OVERFLOW(lt_key->nbytes, uint32_t, hsize_t); - if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes) < 0) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk") - H5_CHECK_OVERFLOW(udata->nbytes, uint32_t, hsize_t); - if(HADDR_UNDEF == (*new_node_p = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->nbytes))) - HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk") -#endif /* OLD_WAY */ - lt_key->nbytes = udata->nbytes; + if(lt_key->nbytes != udata->chunk_block.length) { + /* Set node's address (already re-allocated by main chunk routines) */ + HDassert(H5F_addr_defined(udata->chunk_block.offset)); + *new_node_p = udata->chunk_block.offset; + H5_ASSIGN_OVERFLOW(lt_key->nbytes, udata->chunk_block.length, hsize_t, uint32_t); lt_key->filter_mask = udata->filter_mask; *lt_key_changed = TRUE; - udata->addr = *new_node_p; ret_value = H5B_INS_CHANGE; } else { - udata->addr = addr; + /* Already have address in udata, from main chunk routines */ + HDassert(H5F_addr_defined(udata->chunk_block.offset)); ret_value = H5B_INS_NOOP; } @@ -589,20 +568,15 @@ H5D__btree_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, * Split this node, inserting the new new node to the right of the * current node. The MD_KEY is where the split occurs. */ - md_key->nbytes = udata->nbytes; + H5_ASSIGN_OVERFLOW(md_key->nbytes, udata->chunk_block.length, hsize_t, uint32_t); md_key->filter_mask = udata->filter_mask; for(u = 0; u < udata->common.layout->ndims; u++) { HDassert(0 == udata->common.offset[u] % udata->common.layout->dim[u]); md_key->offset[u] = udata->common.offset[u]; } /* end for */ - /* - * Allocate storage for the new chunk - */ - H5_CHECK_OVERFLOW(udata->nbytes, uint32_t, hsize_t); - if(HADDR_UNDEF == (*new_node_p = H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->nbytes))) - HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "file allocation failed") - udata->addr = *new_node_p; + HDassert(H5F_addr_defined(udata->chunk_block.offset)); + *new_node_p = udata->chunk_block.offset; ret_value = H5B_INS_RIGHT; } else { @@ -926,8 +900,7 @@ H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage) /*------------------------------------------------------------------------- * Function: H5D__btree_idx_insert * - * Purpose: Create the chunk it if it doesn't exist, or reallocate the - * chunk if its size changed. + * Purpose: Insert chunk entry into the indexing structure. * * Return: Non-negative on success/Negative on failure * diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 9f2a020..b0d935c 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -17,7 +17,7 @@ * Thursday, April 24, 2008 * * Purpose: Abstract indexed (chunked) I/O functions. The logical - * multi-dimensional data space is regularly partitioned into + * multi-dimensional dataspace is regularly partitioned into * same-sized "chunks", the first of which is aligned with the * logical origin. The chunks are indexed by different methods, * that map a chunk index to disk address. Each chunk can be @@ -59,6 +59,7 @@ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ +#include "H5MFprivate.h" /* File memory management */ #include "H5VMprivate.h" /* Vector and array functions */ @@ -201,7 +202,6 @@ static herr_t H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *ty H5D_chunk_map_t *fm); static herr_t H5D__chunk_flush(H5D_t *dset, hid_t dxpl_id); static herr_t H5D__chunk_io_term(const H5D_chunk_map_t *fm); -static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last); /* "Nonexistent" layout operation callback */ static ssize_t @@ -212,10 +212,11 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info, /* Helper routines */ static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims); -static void *H5D__chunk_alloc(size_t size, const H5O_pline_t *pline); -static void *H5D__chunk_xfree(void *chk, const H5O_pline_t *pline); -static void *H5D__chunk_realloc(void *chk, size_t size, +static void *H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline); +static void *H5D__chunk_mem_xfree(void *chk, const H5O_pline_t *pline); +static void *H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline); +static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last); static herr_t H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *udata); static hbool_t H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, @@ -237,6 +238,8 @@ static herr_t H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, static herr_t H5D__chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, size_t size); static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata); +static herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, + const H5F_block_t *old_chunk, H5F_block_t *new_chunk, hbool_t *need_insert); #ifdef H5_HAVE_PARALLEL static herr_t H5D__chunk_collective_fill(const H5D_t *dset, hid_t dxpl_id, H5D_chunk_coll_info_t *chunk_info, size_t chunk_size, const void *fill_buf); @@ -319,78 +322,88 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, hsiz { const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */ H5D_chunk_ud_t udata; /* User data for querying chunk info */ - hsize_t chunk_idx; - H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ - H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ - const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ - int space_ndims; /* Dataset's space rank */ - hsize_t space_dim[H5O_LAYOUT_NDIMS]; /* Dataset's dataspace dimensions */ + hsize_t chunk_idx; /* Global index of chunk */ + H5F_block_t old_chunk; /* Offset/length of old chunk */ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ + hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL) - /* Allocate data space and initialize it if it hasn't been. */ - if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) + /* Allocate dataspace and initialize it if it hasn't been. */ + if(!(*layout->ops->is_space_alloc)(&layout->storage)) /* Allocate storage */ if(H5D__alloc_storage(dset, dxpl_id, H5D_ALLOC_WRITE, FALSE, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") - /* Retrieve the dataset dimensions */ - if((space_ndims = H5S_get_simple_extent_dims(dset->shared->space, space_dim, NULL)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get simple dataspace info") - /* Calculate the index of this chunk */ - if(H5VM_chunk_index((unsigned)space_ndims, offset, - layout->u.chunk.dim, layout->u.chunk.down_chunks, &chunk_idx) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get chunk index") + chunk_idx = H5VM_chunk_index(dset->shared->ndims, offset, layout->u.chunk.dim, layout->u.chunk.down_chunks); - /* Find out the file address of the chunk */ + /* Find out the file address of the chunk (if any) */ if(H5D__chunk_lookup(dset, dxpl_id, offset, chunk_idx, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") - udata.filter_mask = filters; + /* Sanity check */ + HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || + (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); + + /* Set the file block information for the old chunk */ + /* (Which is only defined when overwriting an existing chunk) */ + old_chunk.offset = udata.chunk_block.offset; + old_chunk.length = udata.chunk_block.length; - /* Check if the chunk needs to be 'inserted' (could exist already and - * the 'insert' operation could resize it) + /* Check if the chunk needs to be inserted (it also could exist already + * and the chunk allocate operation could resize it) */ - { - H5D_chk_idx_info_t idx_info; /* Chunked index info */ - - /* Compose chunked index info struct */ - idx_info.f = dset->oloc.file; - idx_info.dxpl_id = dxpl_id; - idx_info.pline = &(dset->shared->dcpl_cache.pline); - idx_info.layout = &(dset->shared->layout.u.chunk); - idx_info.storage = &(dset->shared->layout.storage.u.chunk); - /* Set up the size of chunk for user data */ - udata.nbytes = data_size; + /* Compose chunked index info struct */ + idx_info.f = dset->oloc.file; + idx_info.dxpl_id = dxpl_id; + idx_info.pline = &(dset->shared->dcpl_cache.pline); + idx_info.layout = &(dset->shared->layout.u.chunk); + idx_info.storage = &(dset->shared->layout.storage.u.chunk); - /* Create the chunk it if it doesn't exist, or reallocate the chunk - * if its size changed. - */ - if((dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk") + /* Set up the size of chunk for user data */ + udata.chunk_block.length = data_size; - /* Make sure the address of the chunk is returned. */ - if(!H5F_addr_defined(udata.addr)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined") - } /* end if */ + /* Create the chunk it if it doesn't exist, or reallocate the chunk + * if its size changed. + */ + if(H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") - /* Fill the DXPL cache values for later use */ - if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + /* Make sure the address of the chunk is returned. */ + if(!H5F_addr_defined(udata.chunk_block.offset)) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk address isn't defined") - /* Evict the entry from the cache if present, but do not flush + /* Evict the (old) entry from the cache if present, but do not flush * it to disk */ - if(UINT_MAX != udata.idx_hint) + if(UINT_MAX != udata.idx_hint) { + H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ + H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ + const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ + + /* Fill the DXPL cache values for later use */ + if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, rdcc->slot[udata.idx_hint], FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk") + } /* end if */ /* Write the data to the file */ - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.addr, data_size, dxpl_id, buf) < 0) + if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, data_size, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") + /* Insert the chunk record into the index */ + if(need_insert && layout->storage.u.chunk.ops->insert) { + /* Set the chunk's filter mask to the new settings */ + udata.filter_mask = filters; + + if((layout->storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") + } /* end if */ + done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D__chunk_direct_write() */ @@ -454,23 +467,15 @@ done: herr_t H5D__chunk_set_info(const H5D_t *dset) { - hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */ - int sndims; /* Rank of dataspace */ - unsigned ndims; /* Rank of dataspace */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity checks */ HDassert(dset); - /* Get the dim info for dataset */ - if((sndims = H5S_get_simple_extent_dims(dset->shared->space, curr_dims, NULL)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions") - H5_ASSIGN_OVERFLOW(ndims, sndims, int, unsigned); - /* Set the base layout information */ - if(H5D__chunk_set_info_real(&dset->shared->layout.u.chunk, ndims, curr_dims) < 0) + if(H5D__chunk_set_info_real(&dset->shared->layout.u.chunk, dset->shared->ndims, dset->shared->curr_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info") /* Call the index's "resize" callback */ @@ -498,10 +503,7 @@ static herr_t H5D__chunk_construct(H5F_t UNUSED *f, H5D_t *dset) { const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */ - hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ - hsize_t dims[H5O_LAYOUT_NDIMS]; /* Dimension size of data in elements */ uint64_t chunk_size; /* Size of chunk in bytes */ - int ndims; /* Rank of dataspace */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -516,9 +518,7 @@ H5D__chunk_construct(H5F_t UNUSED *f, H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "no chunk information set?") /* Set up layout information */ - if((ndims = H5S_GET_EXTENT_NDIMS(dset->shared->space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get rank") - if(dset->shared->layout.u.chunk.ndims != (unsigned)ndims) + if(dset->shared->layout.u.chunk.ndims != dset->shared->ndims) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimensionality of chunks doesn't match the dataspace") /* Increment # of chunk dimensions, to account for datatype size as last element */ @@ -532,10 +532,6 @@ H5D__chunk_construct(H5F_t UNUSED *f, H5D_t *dset) /* Set the last dimension of the chunk size to the size of the datatype */ dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = (uint32_t)H5T_GET_SIZE(type); - /* Get local copy of dataset dimensions (for sanity checking) */ - if(H5S_get_simple_extent_dims(dset->shared->space, dims, max_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to query maximum dimensions") - /* Sanity check dimensions */ for(u = 0; u < dset->shared->layout.u.chunk.ndims - 1; u++) { /* Don't allow zero-sized chunk dimensions */ @@ -547,7 +543,7 @@ H5D__chunk_construct(H5F_t UNUSED *f, H5D_t *dset) * the maximum dimension size. If any dimension size is zero, there * will be no such restriction. */ - if(dims[u] && max_dims[u] != H5S_UNLIMITED && max_dims[u] < dset->shared->layout.u.chunk.dim[u]) + if(dset->shared->curr_dims[u] && dset->shared->max_dims[u] != H5S_UNLIMITED && dset->shared->max_dims[u] < dset->shared->layout.u.chunk.dim[u]) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be <= maximum dimension size for fixed-sized dimensions") } /* end for */ @@ -601,21 +597,21 @@ H5D__chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id) HDassert(dset); if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for fapl ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for fapl ID") /* Use the properties in dapl_id if they have been set, otherwise use the properties from the file */ if(H5P_get(dapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc->nslots) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache number of slots"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache number of slots") if(rdcc->nslots == H5D_CHUNK_CACHE_NSLOTS_DEFAULT) rdcc->nslots = H5F_RDCC_NSLOTS(f); if(H5P_get(dapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc->nbytes_max) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache byte size"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get data cache byte size") if(rdcc->nbytes_max == H5D_CHUNK_CACHE_NBYTES_DEFAULT) rdcc->nbytes_max = H5F_RDCC_NBYTES(f); if(H5P_get(dapl, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc->w0) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get preempt read chunks"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get preempt read chunks") if(rdcc->w0 < 0) rdcc->w0 = H5F_RDCC_W0(f); @@ -724,10 +720,8 @@ H5D__chunk_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf /* Set the number of dimensions for the memory dataspace */ H5_ASSIGN_OVERFLOW(fm->m_ndims, sm_ndims, int, unsigned); - /* Get dim number and dimensionality for each dataspace */ + /* Get rank for file dataspace */ fm->f_ndims = f_ndims = dataset->shared->layout.u.chunk.ndims - 1; - if(H5S_get_simple_extent_dims(file_space, fm->f_dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality") /* Normalize hyperslab selections by adjusting them by the offset */ /* (It might be worthwhile to normalize both the file and memory dataspaces @@ -974,7 +968,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__chunk_alloc + * Function: H5D__chunk_mem_alloc * * Purpose: Allocate space for a chunk in memory. This routine allocates * memory space for non-filtered chunks from a block free list @@ -988,7 +982,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5D__chunk_alloc(size_t size, const H5O_pline_t *pline) +H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline) { void *ret_value = NULL; /* Return value */ @@ -1003,11 +997,11 @@ H5D__chunk_alloc(size_t size, const H5O_pline_t *pline) ret_value = H5FL_BLK_MALLOC(chunk, size); FUNC_LEAVE_NOAPI(ret_value) -} /* H5D__chunk_alloc() */ +} /* H5D__chunk_mem_alloc() */ /*------------------------------------------------------------------------- - * Function: H5D__chunk_xfree + * Function: H5D__chunk_mem_xfree * * Purpose: Free space for a chunk in memory. This routine allocates * memory space for non-filtered chunks from a block free list @@ -1021,7 +1015,7 @@ H5D__chunk_alloc(size_t size, const H5O_pline_t *pline) *------------------------------------------------------------------------- */ static void * -H5D__chunk_xfree(void *chk, const H5O_pline_t *pline) +H5D__chunk_mem_xfree(void *chk, const H5O_pline_t *pline) { FUNC_ENTER_STATIC_NOERR @@ -1035,11 +1029,11 @@ H5D__chunk_xfree(void *chk, const H5O_pline_t *pline) } /* end if */ FUNC_LEAVE_NOAPI(NULL) -} /* H5D__chunk_xfree() */ +} /* H5D__chunk_mem_xfree() */ /*------------------------------------------------------------------------- - * Function: H5D__chunk_realloc + * Function: H5D__chunk_mem_realloc * * Purpose: Reallocate space for a chunk in memory. This routine allocates * memory space for non-filtered chunks from a block free list @@ -1053,7 +1047,7 @@ H5D__chunk_xfree(void *chk, const H5O_pline_t *pline) *------------------------------------------------------------------------- */ static void * -H5D__chunk_realloc(void *chk, size_t size, const H5O_pline_t *pline) +H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline) { void *ret_value = NULL; /* Return value */ @@ -1068,7 +1062,7 @@ H5D__chunk_realloc(void *chk, size_t size, const H5O_pline_t *pline) ret_value = H5FL_BLK_REALLOC(chunk, chk, size); FUNC_LEAVE_NOAPI(ret_value) -} /* H5D__chunk_realloc() */ +} /* H5D__chunk_mem_realloc() */ /*-------------------------------------------------------------------------- @@ -1160,8 +1154,7 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t chunk_info->coords[fm->f_ndims] = 0; /* Calculate the index of this chunk */ - if(H5VM_chunk_index(fm->f_ndims, chunk_info->coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_info->index) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") + chunk_info->index = H5VM_chunk_index(fm->f_ndims, chunk_info->coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks); /* Copy selection for file's dataspace into chunk dataspace */ if(H5S_select_copy(fm->single_space, fm->file_space, FALSE) < 0) @@ -1219,7 +1212,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t hsize_t sel_points; /* Number of elements in file selection */ hsize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */ hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ - hsize_t end[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ + hsize_t end[H5O_LAYOUT_NDIMS]; /* Final coordinates of chunk */ hsize_t chunk_index; /* Index of chunk */ int curr_dim; /* Current dimension to increment */ unsigned u; /* Local index variable */ @@ -1245,8 +1238,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t } /* end for */ /* Calculate the index of this chunk */ - if(H5VM_chunk_index(fm->f_ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_index) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") + chunk_index = H5VM_chunk_index(fm->f_ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks); /* Iterate through each chunk in the dataset */ while(sel_points) { @@ -1362,8 +1354,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t } while(coords[curr_dim] > sel_end[curr_dim]); /* Re-calculate the index of this chunk */ - if(H5VM_chunk_index(fm->f_ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_index) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") + chunk_index = H5VM_chunk_index(fm->f_ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks); } /* end if */ } /* end while */ @@ -1505,14 +1496,14 @@ H5D__chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, cons H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */ hsize_t coords_in_chunk[H5O_LAYOUT_NDIMS]; /* Coordinates of element in chunk */ hsize_t chunk_index; /* Chunk index */ + hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC /* Calculate the index of this chunk */ - if(H5VM_chunk_index(ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_index) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") + chunk_index = H5VM_chunk_index_scaled(ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, scaled); /* Find correct chunk in file & memory skip list */ if(chunk_index==fm->last_index) { @@ -1565,7 +1556,7 @@ H5D__chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, cons /* Compute the chunk's coordinates */ for(u = 0; u < fm->f_ndims; u++) { H5_CHECK_OVERFLOW(fm->layout->u.chunk.dim[u], hsize_t, hssize_t); - chunk_info->coords[u] = (coords[u] / (hssize_t)fm->layout->u.chunk.dim[u]) * (hssize_t)fm->layout->u.chunk.dim[u]; + chunk_info->coords[u] = scaled[u] * (hssize_t)fm->layout->u.chunk.dim[u]; } /* end for */ chunk_info->coords[fm->f_ndims] = 0; @@ -1629,8 +1620,7 @@ H5D__chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const FUNC_ENTER_STATIC /* Calculate the index of this chunk */ - if(H5VM_chunk_index(ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks, &chunk_index) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") + chunk_index = H5VM_chunk_index(ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks); /* Find correct chunk in file & memory skip list */ if(chunk_index == fm->last_index) { @@ -1835,10 +1825,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm); while(chunk_node) { H5D_chunk_info_t *chunk_info; /* Chunk information */ - H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */ - void *chunk; /* Pointer to locked chunk buffer */ - H5D_chunk_ud_t udata; /* B-tree pass-through */ - htri_t cacheable; /* Whether the chunk is cacheable */ + H5D_chunk_ud_t udata; /* Chunk index pass-through */ /* Get the actual chunk information from the skip list node */ chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node); @@ -1847,11 +1834,19 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->coords, chunk_info->index, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + /* Sanity check */ + HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || + (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); + /* Check for non-existant chunk & skip it if appropriate */ - if(H5F_addr_defined(udata.addr) || UINT_MAX != udata.idx_hint + if(H5F_addr_defined(udata.chunk_block.offset) || UINT_MAX != udata.idx_hint || !skip_missing_chunks) { - /* Load the chunk into cache and lock it. */ - if((cacheable = H5D__chunk_cacheable(io_info, udata.addr, FALSE)) < 0) + H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */ + void *chunk = NULL; /* Pointer to locked chunk buffer */ + htri_t cacheable; /* Whether the chunk is cacheable */ + + /* Determine if we should use the chunk cache */ + if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable") if(cacheable) { /* Pass in chunk's coordinates in a union. */ @@ -1872,20 +1867,14 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, /* Point I/O info at contiguous I/O info for this chunk */ chk_io_info = &cpt_io_info; } /* end if */ - else if(H5F_addr_defined(udata.addr)) { + else if(H5F_addr_defined(udata.chunk_block.offset)) { /* Set up the storage address information for this chunk */ - ctg_store.contig.dset_addr = udata.addr; - - /* No chunk cached */ - chunk = NULL; + ctg_store.contig.dset_addr = udata.chunk_block.offset; /* Point I/O info at temporary I/O info for this chunk */ chk_io_info = &ctg_io_info; } /* end else if */ else { - /* No chunk cached */ - chunk = NULL; - /* Point I/O info at "nonexistent" I/O info for this chunk */ chk_io_info = &nonexistent_io_info; } /* end else */ @@ -1963,21 +1952,30 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm); while(chunk_node) { H5D_chunk_info_t *chunk_info; /* Chunk information */ + H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */ void *chunk; /* Pointer to locked chunk buffer */ H5D_chunk_ud_t udata; /* Index pass-through */ htri_t cacheable; /* Whether the chunk is cacheable */ + hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ /* Get the actual chunk information from the skip list node */ chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node); - /* Load the chunk into cache. But if the whole chunk is written, - * simply allocate space instead of load the chunk. */ + /* Look up the chunk */ if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->coords, chunk_info->index, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") - if((cacheable = H5D__chunk_cacheable(io_info, udata.addr, TRUE)) < 0) + + /* Sanity check */ + HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || + (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); + + /* Determine if we should use the chunk cache */ + if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable") if(cacheable) { + /* Load the chunk into cache. But if the whole chunk is written, + * simply allocate space instead of load the chunk. */ hbool_t entire_chunk = TRUE; /* Whether whole chunk is selected */ /* Pass in chunk's coordinates in a union. */ @@ -2005,9 +2003,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, } /* end if */ else { /* If the chunk hasn't been allocated on disk, do so now. */ - if(!H5F_addr_defined(udata.addr)) { - H5D_chk_idx_info_t idx_info; /* Chunked index info */ - + if(!H5F_addr_defined(udata.chunk_block.offset)) { /* Compose chunked index info struct */ idx_info.f = io_info->dset->oloc.file; idx_info.dxpl_id = io_info->dxpl_id; @@ -2016,14 +2012,14 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, idx_info.storage = &(io_info->dset->shared->layout.storage.u.chunk); /* Set up the size of chunk for user data */ - udata.nbytes = io_info->dset->shared->layout.u.chunk.size; + udata.chunk_block.length = io_info->dset->shared->layout.u.chunk.size; - /* Create the chunk */ - if((io_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk") + /* Allocate the chunk */ + if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Make sure the address of the chunk is returned. */ - if(!H5F_addr_defined(udata.addr)) + if(!H5F_addr_defined(udata.chunk_block.offset)) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined") /* Cache the new chunk information */ @@ -2031,7 +2027,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, } /* end if */ /* Set up the storage address information for this chunk */ - ctg_store.contig.dset_addr = udata.addr; + ctg_store.contig.dset_addr = udata.chunk_block.offset; /* No chunk cached */ chunk = NULL; @@ -2045,9 +2041,16 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, (hsize_t)chunk_info->chunk_points, chunk_info->fspace, chunk_info->mspace) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked write failed") - /* Release the cache lock on the chunk. */ - if(chunk && H5D__chunk_unlock(io_info, &udata, TRUE, chunk, dst_accessed_bytes) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk") + /* Release the cache lock on the chunk, or insert chunk into index. */ + if(chunk) { + if(H5D__chunk_unlock(io_info, &udata, TRUE, chunk, dst_accessed_bytes) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk") + } /* end if */ + else { + if(need_insert && io_info->dset->shared->layout.storage.u.chunk.ops->insert) + if((io_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") + } /* end else */ /* Advance to next chunk in list */ chunk_node = H5D_CHUNK_GET_NEXT_NODE(fm, chunk_node); @@ -2244,9 +2247,9 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud /* Stored the information to cache */ HDmemcpy(last->offset, udata->common.offset, sizeof(hsize_t) * udata->common.layout->ndims); - last->nbytes = udata->nbytes; + last->addr = udata->chunk_block.offset; + H5_ASSIGN_OVERFLOW(last->nbytes, udata->chunk_block.length, hsize_t, uint32_t); last->filter_mask = udata->filter_mask; - last->addr = udata->addr; /* Indicate that the cached info is valid */ last->valid = TRUE; @@ -2291,9 +2294,9 @@ H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *uda HGOTO_DONE(FALSE) /* Retrieve the information from the cache */ - udata->nbytes = last->nbytes; + udata->chunk_block.offset = last->addr; + udata->chunk_block.length = last->nbytes; udata->filter_mask = last->filter_mask; - udata->addr = last->addr; /* Indicate that the data was found */ HGOTO_DONE(TRUE) @@ -2389,12 +2392,11 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset, udata->common.layout = &(dset->shared->layout.u.chunk); udata->common.storage = &(dset->shared->layout.storage.u.chunk); udata->common.offset = chunk_offset; - udata->common.rdcc = &(dset->shared->cache.chunk); /* Reset information about the chunk we are looking for */ - udata->nbytes = 0; + udata->chunk_block.offset = HADDR_UNDEF; + udata->chunk_block.length = 0; udata->filter_mask = 0; - udata->addr = HADDR_UNDEF; /* Check for chunk in cache */ if(dset->shared->cache.chunk.nslots > 0) { @@ -2402,8 +2404,7 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset, ent = dset->shared->cache.chunk.slot[udata->idx_hint]; if(ent) - for(u = 0, found = TRUE; u < dset->shared->layout.u.chunk.ndims - 1; - u++) + for(u = 0, found = TRUE; u < dset->shared->ndims; u++) if(chunk_offset[u] != ent->offset[u]) { found = FALSE; break; @@ -2411,8 +2412,10 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *chunk_offset, } /* end if */ /* Find chunk addr */ - if(found) - udata->addr = ent->chunk_addr; + if(found) { + udata->chunk_block.offset = ent->chunk_block.offset; + udata->chunk_block.length = ent->chunk_block.length;; + } /* end if */ else { /* Invalidate idx_hint, to signal that the chunk is not in cache */ udata->idx_hint = UINT_MAX; @@ -2474,22 +2477,23 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t HDassert(!ent->locked); buf = ent->chunk; - if(ent->dirty && !ent->deleted) { + if(ent->dirty) { + H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_chunk_ud_t udata; /* pass through B-tree */ - hbool_t must_insert = FALSE; /* Whether the chunk must go through the "insert" method */ + hbool_t must_alloc = FALSE; /* Whether the chunk must be allocated */ + hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ /* Set up user data for index callbacks */ udata.common.layout = &dset->shared->layout.u.chunk; udata.common.storage = &dset->shared->layout.storage.u.chunk; udata.common.offset = ent->offset; - udata.common.rdcc = &(dset->shared->cache.chunk); + udata.chunk_block.offset = ent->chunk_block.offset; + udata.chunk_block.length = dset->shared->layout.u.chunk.size; udata.filter_mask = 0; - udata.nbytes = dset->shared->layout.u.chunk.size; - udata.addr = ent->chunk_addr; /* Should the chunk be filtered before writing it to disk? */ if(dset->shared->dcpl_cache.pline.nused) { - size_t alloc = udata.nbytes; /* Bytes allocated for BUF */ + size_t alloc = udata.chunk_block.length; /* Bytes allocated for BUF */ size_t nbytes; /* Chunk size (in bytes) */ if(!reset) { @@ -2498,10 +2502,9 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t * the pipeline because we'll want to save the original buffer * for later. */ - H5_ASSIGN_OVERFLOW(alloc, udata.nbytes, uint32_t, size_t); if(NULL == (buf = H5MM_malloc(alloc))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline") - HDmemcpy(buf, ent->chunk, udata.nbytes); + HDmemcpy(buf, ent->chunk, alloc); } /* end if */ else { /* @@ -2514,7 +2517,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t point_of_no_return = TRUE; ent->chunk = NULL; } /* end else */ - H5_ASSIGN_OVERFLOW(nbytes, udata.nbytes, uint32_t, size_t); + H5_ASSIGN_OVERFLOW(nbytes, udata.chunk_block.length, hsize_t, size_t); if(H5Z_pipeline(&(dset->shared->dcpl_cache.pline), 0, &(udata.filter_mask), dxpl_cache->err_detect, dxpl_cache->filter_cb, &nbytes, &alloc, &buf) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "output pipeline failed") @@ -2523,21 +2526,19 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t if(nbytes > ((size_t)0xffffffff)) HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length") #endif /* H5_SIZEOF_SIZE_T > 4 */ - H5_ASSIGN_OVERFLOW(udata.nbytes, nbytes, size_t, uint32_t); + H5_ASSIGN_OVERFLOW(udata.chunk_block.length, nbytes, size_t, hsize_t); - /* Indicate that the chunk must go through 'insert' method */ - must_insert = TRUE; + /* Indicate that the chunk must be allocated */ + must_alloc = TRUE; } /* end if */ - else if(!H5F_addr_defined(udata.addr)) - /* Indicate that the chunk must go through 'insert' method */ - must_insert = TRUE; + else if(!H5F_addr_defined(udata.chunk_block.offset)) + /* Indicate that the chunk must be allocated */ + must_alloc = TRUE; - /* Check if the chunk needs to be 'inserted' (could exist already and - * the 'insert' operation could resize it) + /* Check if the chunk needs to be allocated (it also could exist already + * and the chunk alloc operation could resize it) */ - if(must_insert) { - H5D_chk_idx_info_t idx_info; /* Chunked index info */ - + if(must_alloc) { /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; idx_info.dxpl_id = dxpl_id; @@ -2548,18 +2549,25 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t /* Create the chunk it if it doesn't exist, or reallocate the chunk * if its size changed. */ - if((dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk") + if(H5D__chunk_file_alloc(&idx_info, &(ent->chunk_block), &udata.chunk_block, &need_insert) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") - /* Update the chunk entry's address, in case it was allocated or relocated */ - ent->chunk_addr = udata.addr; + /* Update the chunk entry's info, in case it was allocated or relocated */ + ent->chunk_block.offset = udata.chunk_block.offset; + ent->chunk_block.length = udata.chunk_block.length; } /* end if */ /* Write the data to the file */ - HDassert(H5F_addr_defined(udata.addr)); - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.addr, udata.nbytes, dxpl_id, buf) < 0) + HDassert(H5F_addr_defined(udata.chunk_block.offset)); + H5_CHECK_OVERFLOW(udata.chunk_block.length, hsize_t, size_t); + if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, (size_t)udata.chunk_block.length, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") + /* Insert the chunk record into the index */ + if(need_insert && dset->shared->layout.storage.u.chunk.ops->insert) + if((dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") + /* Cache the chunk's info, in case it's accessed again shortly */ H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, &udata); @@ -2576,7 +2584,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t if(buf == ent->chunk) buf = NULL; if(ent->chunk != NULL) - ent->chunk = (uint8_t *)H5D__chunk_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline)); + ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline)); } /* end if */ done: @@ -2590,10 +2598,9 @@ done: * output pipeline failed. Do not free the entry or remove it from the * list. */ - if(ret_value < 0 && point_of_no_return) { + if(ret_value < 0 && point_of_no_return) if(ent->chunk) - ent->chunk = (uint8_t *)H5D__chunk_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline)); - } /* end if */ + ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline)); FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D__chunk_flush_entry() */ @@ -2635,7 +2642,7 @@ H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t else { /* Don't flush, just free chunk */ if(ent->chunk != NULL) - ent->chunk = (uint8_t *)H5D__chunk_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline)); + ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline)); } /* end else */ /* Unlink from list */ @@ -2649,8 +2656,12 @@ H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t rdcc->tail = ent->prev; ent->prev = ent->next = NULL; + /* Only clear hash table slot if chunk was not marked as deleted already */ + if(!ent->deleted) + rdcc->slot[ent->idx] = NULL; + /* Remove from cache */ - rdcc->slot[ent->idx] = NULL; + HDassert(rdcc->slot[ent->idx] != ent); ent->idx = UINT_MAX; rdcc->nbytes_used -= dset->shared->layout.u.chunk.size; --rdcc->nused; @@ -2802,14 +2813,13 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t relax) { const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ - const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info - always equal to the pline passed to H5D__chunk_alloc */ + const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info - always equal to the pline passed to H5D__chunk_mem_alloc */ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */ const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */ hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */ H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache*/ - H5D_rdcc_ent_t *ent = NULL; /*cache entry */ - haddr_t chunk_addr = HADDR_UNDEF; /* Address of chunk on disk */ + H5D_rdcc_ent_t *ent; /*cache entry */ size_t chunk_size; /*size of a chunk */ void *chunk = NULL; /*the file chunk */ void *ret_value; /*return value */ @@ -2850,110 +2860,12 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, * Already in the cache. Count a hit. */ rdcc->stats.nhits++; - } /* end if */ - else if(relax) { - /* - * Not in the cache, but we're about to overwrite the whole thing - * anyway, so just allocate a buffer for it but don't initialize that - * buffer with the file contents. Count this as a hit instead of a - * miss because we saved ourselves lots of work. - */ - rdcc->stats.nhits++; - - /* Still save the chunk address so the cache stays consistent */ - chunk_addr = udata->addr; - - if(NULL == (chunk = H5D__chunk_alloc(chunk_size, pline))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") - - /* In the case that some dataset functions look through this data, - * clear it to all 0s. */ - HDmemset(chunk, 0, chunk_size); - } /* end if */ - else { - /* - * Not in the cache. Count this as a miss if it's in the file - * or an init if it isn't. - */ - - /* Save the chunk address */ - chunk_addr = udata->addr; - - /* Check if the chunk exists on disk */ - if(H5F_addr_defined(chunk_addr)) { - size_t chunk_alloc = 0; /*allocated chunk size */ - - /* Chunk size on disk isn't [likely] the same size as the final chunk - * size in memory, so allocate memory big enough. */ - H5_ASSIGN_OVERFLOW(chunk_alloc, udata->nbytes, uint32_t, size_t); - if(NULL == (chunk = H5D__chunk_alloc(chunk_alloc, pline))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") - if(H5F_block_read(dset->oloc.file, H5FD_MEM_DRAW, chunk_addr, chunk_alloc, io_info->dxpl_id, chunk) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk") - - if(pline->nused) { - if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata->filter_mask), io_info->dxpl_cache->err_detect, - io_info->dxpl_cache->filter_cb, &chunk_alloc, &chunk_alloc, &chunk) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, NULL, "data pipeline read failed") - H5_ASSIGN_OVERFLOW(udata->nbytes, chunk_alloc, size_t, uint32_t); - } /* end if */ - /* Increment # of cache misses */ - rdcc->stats.nmisses++; - } /* end if */ - else { - H5D_fill_value_t fill_status; - - /* Sanity check */ - HDassert(fill->alloc_time != H5D_ALLOC_TIME_EARLY); - - /* Chunk size on disk isn't [likely] the same size as the final chunk - * size in memory, so allocate memory big enough. */ - if(NULL == (chunk = H5D__chunk_alloc(chunk_size, pline))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") - - if(H5P_is_fill_value_defined(fill, &fill_status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't tell if fill value defined") - - if(fill->fill_time == H5D_FILL_TIME_ALLOC || - (fill->fill_time == H5D_FILL_TIME_IFSET && - (fill_status == H5D_FILL_VALUE_USER_DEFINED || - fill_status == H5D_FILL_VALUE_DEFAULT))) { - /* - * The chunk doesn't exist in the file. Replicate the fill - * value throughout the chunk, if the fill value is defined. - */ - - /* Initialize the fill value buffer */ - /* (use the compact dataset storage buffer as the fill value buffer) */ - if(H5D__fill_init(&fb_info, chunk, NULL, NULL, NULL, NULL, - &dset->shared->dcpl_cache.fill, dset->shared->type, - dset->shared->type_id, (size_t)0, chunk_size, io_info->dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't initialize fill buffer info") - fb_info_init = TRUE; - - /* Check for VL datatype & non-default fill value */ - if(fb_info.has_vlen_fill_type) - /* Fill the buffer with VL datatype fill values */ - if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf, io_info->dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, NULL, "can't refill fill value buffer") - } /* end if */ - else - HDmemset(chunk, 0, chunk_size); - - /* Increment # of creations */ - rdcc->stats.ninits++; - } /* end else */ - } /* end else */ - HDassert(chunk_size > 0); - - if(ent) { /* - * The chunk is not at the beginning of the cache; move it backward + * If the chunk is not at the beginning of the cache; move it backward * by one slot. This is how we implement the LRU preemption * algorithm. */ - HDassert(ent); if(ent->next) { if(ent->next->next) ent->next->next->prev = ent; @@ -2969,67 +2881,166 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, ent->prev->next = ent; } /* end if */ } /* end if */ - else if(rdcc->nslots > 0 && chunk_size <= rdcc->nbytes_max) { - /* Calculate the index */ - udata->idx_hint = H5D_CHUNK_HASH(dset->shared, io_info->store->chunk.index); + else { + haddr_t chunk_addr; /* Address of chunk on disk */ + hsize_t chunk_alloc; /* Length of chunk on disk */ + + /* Save the chunk info so the cache stays consistent */ + chunk_addr = udata->chunk_block.offset; + chunk_alloc = udata->chunk_block.length; + + if(relax) { + /* + * Not in the cache, but we're about to overwrite the whole thing + * anyway, so just allocate a buffer for it but don't initialize that + * buffer with the file contents. Count this as a hit instead of a + * miss because we saved ourselves lots of work. + */ + rdcc->stats.nhits++; - /* Add the chunk to the cache only if the slot is not already locked */ - ent = rdcc->slot[udata->idx_hint]; - if(!ent || !ent->locked) { - /* Preempt enough things from the cache to make room */ - if(ent) { - if(H5D__chunk_cache_evict(io_info->dset, io_info->dxpl_id, io_info->dxpl_cache, ent, TRUE) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache") + if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") + + /* In the case that some dataset functions look through this data, + * clear it to all 0s. */ + HDmemset(chunk, 0, chunk_size); + } /* end if */ + else { + /* + * Not in the cache. Count this as a miss if it's in the file + * or an init if it isn't. + */ + + /* Check if the chunk exists on disk */ + if(H5F_addr_defined(chunk_addr)) { + size_t my_chunk_alloc = chunk_alloc; /* Allocated buffer size */ + size_t buf_alloc = chunk_alloc; /* [Re-]allocated buffer size */ + + /* Chunk size on disk isn't [likely] the same size as the final chunk + * size in memory, so allocate memory big enough. */ + if(NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, pline))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") + if(H5F_block_read(dset->oloc.file, H5FD_MEM_DRAW, chunk_addr, my_chunk_alloc, io_info->dxpl_id, chunk) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk") + + if(pline->nused) + if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata->filter_mask), io_info->dxpl_cache->err_detect, + io_info->dxpl_cache->filter_cb, &my_chunk_alloc, &buf_alloc, &chunk) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, NULL, "data pipeline read failed") + + /* Increment # of cache misses */ + rdcc->stats.nmisses++; } /* end if */ - if(H5D__chunk_cache_prune(io_info->dset, io_info->dxpl_id, io_info->dxpl_cache, chunk_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache") - - /* Create a new entry */ - if(NULL == (ent = H5FL_CALLOC(H5D_rdcc_ent_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate raw data chunk entry") - - /* Initialize the new entry */ - ent->chunk_addr = chunk_addr; - HDmemcpy(ent->offset, io_info->store->chunk.offset, sizeof(hsize_t) * layout->u.chunk.ndims); - H5_ASSIGN_OVERFLOW(ent->rd_count, chunk_size, size_t, uint32_t); - H5_ASSIGN_OVERFLOW(ent->wr_count, chunk_size, size_t, uint32_t); - ent->chunk = (uint8_t *)chunk; - - /* Add it to the cache */ - HDassert(NULL == rdcc->slot[udata->idx_hint]); - rdcc->slot[udata->idx_hint] = ent; - ent->idx = udata->idx_hint; - rdcc->nbytes_used += chunk_size; - rdcc->nused++; - - /* Add it to the linked list */ - if(rdcc->tail) { - rdcc->tail->next = ent; - ent->prev = rdcc->tail; - rdcc->tail = ent; + else { + H5D_fill_value_t fill_status; + + /* Sanity check */ + HDassert(fill->alloc_time != H5D_ALLOC_TIME_EARLY); + + /* Chunk size on disk isn't [likely] the same size as the final chunk + * size in memory, so allocate memory big enough. */ + if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") + + if(H5P_is_fill_value_defined(fill, &fill_status) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't tell if fill value defined") + + if(fill->fill_time == H5D_FILL_TIME_ALLOC || + (fill->fill_time == H5D_FILL_TIME_IFSET && + (fill_status == H5D_FILL_VALUE_USER_DEFINED || + fill_status == H5D_FILL_VALUE_DEFAULT))) { + /* + * The chunk doesn't exist in the file. Replicate the fill + * value throughout the chunk, if the fill value is defined. + */ + + /* Initialize the fill value buffer */ + /* (use the compact dataset storage buffer as the fill value buffer) */ + if(H5D__fill_init(&fb_info, chunk, NULL, NULL, NULL, NULL, + &dset->shared->dcpl_cache.fill, dset->shared->type, + dset->shared->type_id, (size_t)0, chunk_size, io_info->dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't initialize fill buffer info") + fb_info_init = TRUE; + + /* Check for VL datatype & non-default fill value */ + if(fb_info.has_vlen_fill_type) + /* Fill the buffer with VL datatype fill values */ + if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf, io_info->dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, NULL, "can't refill fill value buffer") + } /* end if */ + else + HDmemset(chunk, 0, chunk_size); + + /* Increment # of creations */ + rdcc->stats.ninits++; + } /* end else */ + } /* end else */ + + /* See if the chunk can be cached */ + if(rdcc->nslots > 0 && chunk_size <= rdcc->nbytes_max) { + /* Calculate the index */ + udata->idx_hint = H5D_CHUNK_HASH(dset->shared, io_info->store->chunk.index); + + /* Add the chunk to the cache only if the slot is not already locked */ + ent = rdcc->slot[udata->idx_hint]; + if(!ent || !ent->locked) { + /* Preempt enough things from the cache to make room */ + if(ent) { + if(H5D__chunk_cache_evict(io_info->dset, io_info->dxpl_id, io_info->dxpl_cache, ent, TRUE) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache") + } /* end if */ + if(H5D__chunk_cache_prune(io_info->dset, io_info->dxpl_id, io_info->dxpl_cache, chunk_size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache") + + /* Create a new entry */ + if(NULL == (ent = H5FL_CALLOC(H5D_rdcc_ent_t))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate raw data chunk entry") + + /* Initialize the new entry */ + ent->chunk_block.offset = chunk_addr; + ent->chunk_block.length = chunk_alloc; + HDmemcpy(ent->offset, io_info->store->chunk.offset, sizeof(hsize_t) * layout->u.chunk.ndims); + H5_ASSIGN_OVERFLOW(ent->rd_count, chunk_size, size_t, uint32_t); + H5_ASSIGN_OVERFLOW(ent->wr_count, chunk_size, size_t, uint32_t); + ent->chunk = (uint8_t *)chunk; + + /* Add it to the cache */ + HDassert(NULL == rdcc->slot[udata->idx_hint]); + rdcc->slot[udata->idx_hint] = ent; + ent->idx = udata->idx_hint; + rdcc->nbytes_used += chunk_size; + rdcc->nused++; + + /* Add it to the linked list */ + if(rdcc->tail) { + rdcc->tail->next = ent; + ent->prev = rdcc->tail; + rdcc->tail = ent; + } /* end if */ + else + rdcc->head = rdcc->tail = ent; } /* end if */ else - rdcc->head = rdcc->tail = ent; - } /* end if */ - else - /* We did not add the chunk to cache */ + /* We did not add the chunk to cache */ + ent = NULL; + } /* end else */ + else /* No cache set up, or chunk is too large: chunk is uncacheable */ ent = NULL; } /* end else */ - if(!ent) - /* - * The chunk cannot be placed in cache so we don't cache it. This is the - * reason all those arguments have to be repeated for the unlock - * function. - */ - udata->idx_hint = UINT_MAX; - /* Lock the chunk into the cache */ if(ent) { HDassert(!ent->locked); ent->locked = TRUE; chunk = ent->chunk; } /* end if */ + else + /* + * The chunk cannot be placed in cache so we don't cache it. This is the + * reason all those arguments have to be repeated for the unlock + * function. + */ + udata->idx_hint = UINT_MAX; /* Set return value */ ret_value = chunk; @@ -3042,7 +3053,7 @@ done: /* Release the chunk allocated, on error */ if(!ret_value) if(chunk) - chunk = H5D__chunk_xfree(chunk, pline); + chunk = H5D__chunk_mem_xfree(chunk, pline); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_lock() */ @@ -3097,7 +3108,8 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, fake_ent.dirty = TRUE; HDmemcpy(fake_ent.offset, io_info->store->chunk.offset, layout->u.chunk.ndims * sizeof(fake_ent.offset[0])); HDassert(layout->u.chunk.size > 0); - fake_ent.chunk_addr = udata->addr; + fake_ent.chunk_block.offset = udata->chunk_block.offset; + fake_ent.chunk_block.length = udata->chunk_block.length; fake_ent.chunk = (uint8_t *)chunk; if(H5D__chunk_flush_entry(io_info->dset, io_info->dxpl_id, io_info->dxpl_cache, &fake_ent, TRUE) < 0) @@ -3105,7 +3117,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, } /* end if */ else { if(chunk) - chunk = H5D__chunk_xfree(chunk, &(io_info->dset->shared->dcpl_cache.pline)); + chunk = H5D__chunk_mem_xfree(chunk, &(io_info->dset->shared->dcpl_cache.pline)); } /* end else */ } /* end if */ else { @@ -3261,10 +3273,10 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, H5D_chunk_coll_info_t chunk_info; /* chunk address information for doing I/O */ #endif /* H5_HAVE_PARALLEL */ hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */ - int space_ndims; /* Dataset's space rank */ - hsize_t space_dim[H5O_LAYOUT_NDIMS]; /* Dataset's dataspace dimensions */ + unsigned space_ndims; /* Dataset's space rank */ + const hsize_t *space_dim; /* Dataset's dataspace dimensions */ const uint32_t *chunk_dim = layout->u.chunk.dim; /* Convenience pointer to chunk dimensions */ - int op_dim; /* Current operationg dimension */ + unsigned op_dim; /* Current operating dimension */ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */ hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3277,16 +3289,15 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); /* Retrieve the dataset dimensions */ - if((space_ndims = H5S_get_simple_extent_dims(dset->shared->space, space_dim, NULL)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get simple dataspace info") - space_dim[space_ndims] = layout->u.chunk.dim[space_ndims]; + space_dim = dset->shared->curr_dims; + space_ndims = dset->shared->ndims; /* The last dimension in chunk_offset is always 0 */ chunk_offset[space_ndims] = (hsize_t)0; /* Check if any space dimensions are 0, if so we do not have to do anything */ - for(op_dim=0; op_dim<space_ndims; op_dim++) + for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) if(space_dim[op_dim] == 0) { /* Reset any cached chunk info for this dataset */ H5D__chunk_cinfo_cache_reset(&dset->shared->cache.chunk.last); @@ -3333,8 +3344,8 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, /* Initialize the fill value buffer */ /* (delay allocating fill buffer for VL datatypes until refilling) */ /* (casting away const OK - QAK) */ - if(H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_alloc, - (void *)pline, (H5MM_free_t)H5D__chunk_xfree, (void *)pline, + if(H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc, + (void *)pline, (H5MM_free_t)H5D__chunk_mem_xfree, (void *)pline, &dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id, (size_t)0, orig_chunk_size, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") @@ -3367,8 +3378,8 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, /* Calculate the minimum and maximum chunk offsets in each dimension. Note * that we assume here that all elements of space_dim are > 0. This is - * checked at the top of this function */ - for(op_dim=0; op_dim<space_ndims; op_dim++) { + * checked at the top of this function. */ + for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) { min_unalloc[op_dim] = ((old_dim[op_dim] + chunk_dim[op_dim] - 1) / chunk_dim[op_dim]) * chunk_dim[op_dim]; max_unalloc[op_dim] = ((space_dim[op_dim] - 1) / chunk_dim[op_dim]) @@ -3393,7 +3404,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, * certain dimension, max_unalloc is updated in order to avoid allocating * those chunks again. */ - for(op_dim=0; op_dim<space_ndims; op_dim++) { + for(op_dim = 0; op_dim < space_ndims; op_dim++) { H5D_chunk_ud_t udata; /* User data for querying chunk info */ int i; /* Local index variable */ @@ -3402,13 +3413,15 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, continue; else { /* Reset the chunk offset indices */ - HDmemset(chunk_offset, 0, ((unsigned)space_ndims * sizeof(chunk_offset[0]))); + HDmemset(chunk_offset, 0, (space_ndims * sizeof(chunk_offset[0]))); chunk_offset[op_dim] = min_unalloc[op_dim]; carry = FALSE; } /* end else */ while(!carry) { + hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ + /* Reset size of chunk in bytes, in case filtered size changes */ chunk_size = orig_chunk_size; @@ -3417,16 +3430,12 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, { hsize_t chunk_idx; - /* Calculate the index of this chunk */ - if(H5VM_chunk_index((unsigned)space_ndims, chunk_offset, - layout->u.chunk.dim, layout->u.chunk.down_chunks, - &chunk_idx) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get chunk index") - + /* Look up this chunk */ + chunk_idx = H5VM_chunk_index(space_ndims, chunk_offset, layout->u.chunk.dim, layout->u.chunk.down_chunks); if(H5D__chunk_lookup(dset, dxpl_id, chunk_offset, chunk_idx, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") - HDassert(!H5F_addr_defined(udata.addr)); + HDassert(!H5F_addr_defined(udata.chunk_block.offset)); } /* end block */ /* Make sure the chunk is really in the dataset and outside the @@ -3435,7 +3444,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, unsigned u; /* Local index variable */ hbool_t outside_orig = FALSE; - for(u = 0; u < (unsigned)space_ndims; u++) { + for(u = 0; u < space_ndims; u++) { HDassert(chunk_offset[u] < space_dim[u]); if(chunk_offset[u] >= old_dim[u]) outside_orig = TRUE; @@ -3456,8 +3465,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, * possible (though ill-advised) for the filter to shrink the * buffer. */ if(fb_info.fill_buf_size < orig_chunk_size) { - if(NULL == (fb_info.fill_buf = H5D__chunk_realloc( - fb_info.fill_buf, orig_chunk_size, pline))) + if(NULL == (fb_info.fill_buf = H5D__chunk_mem_realloc(fb_info.fill_buf, orig_chunk_size, pline))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory reallocation failed for raw data chunk") fb_info.fill_buf_size = orig_chunk_size; } /* end if */ @@ -3489,21 +3497,20 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, udata.common.layout = &layout->u.chunk; udata.common.storage = &layout->storage.u.chunk; udata.common.offset = chunk_offset; - udata.common.rdcc = NULL; - H5_ASSIGN_OVERFLOW(udata.nbytes, chunk_size, size_t, uint32_t); + udata.chunk_block.offset = HADDR_UNDEF; + H5_ASSIGN_OVERFLOW(udata.chunk_block.length, chunk_size, size_t, uint32_t); udata.filter_mask = filter_mask; - udata.addr = HADDR_UNDEF; - /* Allocate the chunk with all processes */ - if((ops->insert)(&idx_info, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert record into chunk index") - HDassert(H5F_addr_defined(udata.addr)); + /* Allocate the chunk (with all processes) */ + if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") + HDassert(H5F_addr_defined(udata.chunk_block.offset)); /* Check if fill values should be written to chunks */ if(should_fill) { /* Sanity check */ HDassert(fb_info_init); - HDassert(udata.nbytes == chunk_size); + HDassert(udata.chunk_block.length == chunk_size); #ifdef H5_HAVE_PARALLEL /* Check if this file is accessed with an MPI-capable file driver */ @@ -3511,14 +3518,12 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, /* collect all chunk addresses to be written to write collectively at the end */ /* allocate/resize address array if no more space left */ - if(0 == chunk_info.num_io % 1024) { - if(NULL == (chunk_info.addr = (haddr_t *)HDrealloc - (chunk_info.addr, (chunk_info.num_io + 1024) * sizeof(haddr_t)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for chunk addresses"); - } /* end if */ + if(0 == chunk_info.num_io % 1024) + if(NULL == (chunk_info.addr = (haddr_t *)HDrealloc(chunk_info.addr, (chunk_info.num_io + 1024) * sizeof(haddr_t)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for chunk addresses") /* Store the chunk's address for later */ - chunk_info.addr[chunk_info.num_io] = udata.addr; + chunk_info.addr[chunk_info.num_io] = udata.chunk_block.offset; chunk_info.num_io++; /* Indicate that blocks will be written */ @@ -3526,20 +3531,27 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, } /* end if */ else { #endif /* H5_HAVE_PARALLEL */ - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.addr, chunk_size, - dxpl_id, fb_info.fill_buf) < 0) + if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, dxpl_id, fb_info.fill_buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") #ifdef H5_HAVE_PARALLEL } /* end else */ #endif /* H5_HAVE_PARALLEL */ } /* end if */ - /* Increment indices */ + /* Insert the chunk record into the index */ + /* (Note that this isn't safe, from a SWMR perspective, unlike + * serial operation. -QAK + */ + if(need_insert && ops->insert) + if((ops->insert)(&idx_info, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") + + /* Increment indices and adjust the edge chunk state */ carry = TRUE; for(i = ((int)space_ndims - 1); i >= 0; --i) { chunk_offset[i] += chunk_dim[i]; if(chunk_offset[i] > max_unalloc[i]) { - if(i == op_dim) + if((unsigned)i == op_dim) chunk_offset[i] = min_unalloc[i]; else chunk_offset[i] = 0; @@ -3562,10 +3574,9 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, #ifdef H5_HAVE_PARALLEL /* do final collective I/O */ - if(using_mpi && blocks_written) { + if(using_mpi && blocks_written) if(H5D__chunk_collective_fill(dset, dxpl_id, &chunk_info, chunk_size, fb_info.fill_buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") - } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* Reset any cached chunk info for this dataset */ @@ -3577,10 +3588,8 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") #ifdef H5_HAVE_PARALLEL - if(using_mpi) { - if(chunk_info.addr) - HDfree(chunk_info.addr); - } /* end if */ + if(using_mpi && chunk_info.addr) + HDfree(chunk_info.addr); #endif FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) @@ -3684,8 +3693,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, hid_t dxpl_id, * should use this if MPI_type_create_hindexed block is working * mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE, &file_type); */ - mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, - MPI_BYTE, &file_type); + mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, MPI_BYTE, &file_type); if(mpi_code != MPI_SUCCESS) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&file_type))) @@ -3718,9 +3726,8 @@ H5D__chunk_collective_fill(const H5D_t *dset, hid_t dxpl_id, HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set transfer mode") } - /* low level write */ - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, (haddr_t)0, (blocks) ? (size_t)1 : (size_t)0, - data_dxpl_id, fill_buf) < 0) + /* low level write (collective) */ + if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, (haddr_t)0, (blocks) ? (size_t)1 : (size_t)0, data_dxpl_id, fill_buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Barrier so processes don't race ahead */ @@ -3786,9 +3793,8 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata) if(H5D__chunk_lookup(dset, io_info->dxpl_id, chunk_offset, io_info->store->chunk.index, &chk_udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") - /* If this chunk does not exist in cache or on disk, no need to do anything - */ - if(!H5F_addr_defined(chk_udata.addr) && UINT_MAX == chk_udata.idx_hint) + /* If this chunk does not exist in cache or on disk, no need to do anything */ + if(!H5F_addr_defined(chk_udata.chunk_block.offset) && UINT_MAX == chk_udata.idx_hint) HGOTO_DONE(SUCCEED) /* Initialize the fill value buffer, if necessary */ @@ -3804,8 +3810,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata) /* Compute the # of elements to leave with existing value, in each dimension */ for(u = 0; u < rank; u++) { - count[u] = MIN(layout->u.chunk.dim[u], (udata->space_dim[u] - - chunk_offset[u])); + count[u] = MIN(layout->u.chunk.dim[u], (udata->space_dim[u] - chunk_offset[u])); HDassert(count[u] > 0); } /* end for */ @@ -3983,14 +3988,13 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */ const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ H5D_rdcc_ent_t *ent = NULL; /* Cache entry */ - int space_ndims; /* Dataset's space rank */ - hsize_t space_dim[H5O_LAYOUT_NDIMS]; /* Current dataspace dimensions */ - int op_dim; /* Current operationg dimension */ + unsigned space_ndims; /* Dataset's space rank */ + const hsize_t *space_dim; /* Current dataspace dimensions */ + unsigned op_dim; /* Current operating dimension */ hbool_t shrunk_dim[H5O_LAYOUT_NDIMS]; /* Dimensions which have shrunk */ H5D_chunk_it_ud1_t udata; /* Chunk index iterator user data */ hbool_t udata_init = FALSE; /* Whether the chunk index iterator user data has been initialized */ H5D_chunk_common_ud_t idx_udata; /* User data for index removal routine */ - H5D_chunk_ud_t chk_udata; /* User data for getting chunk info */ H5S_t *chunk_space = NULL; /* Dataspace for a chunk */ hsize_t chunk_dim[H5O_LAYOUT_NDIMS]; /* Chunk dimensions */ hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */ @@ -4012,16 +4016,14 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") /* Go get the rank & dimensions (including the element size) */ - if((space_ndims = H5S_get_simple_extent_dims(dset->shared->space, space_dim, - NULL)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") - space_dim[space_ndims] = layout->u.chunk.dim[space_ndims]; + space_dim = dset->shared->curr_dims; + space_ndims = dset->shared->ndims; /* The last dimension in chunk_offset is always 0 */ chunk_offset[space_ndims] = (hsize_t)0; /* Check if any old dimensions are 0, if so we do not have to do anything */ - for(op_dim=0; op_dim<space_ndims; op_dim++) + for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) if(old_dim[op_dim] == 0) { /* Reset any cached chunk info for this dataset */ H5D__chunk_cinfo_cache_reset(&dset->shared->cache.chunk.last); @@ -4034,14 +4036,14 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) /* (also copy the chunk dimensions into 'hsize_t' array for creating dataspace) */ /* (also compute the dimensions which have been shrunk) */ elmts_per_chunk = 1; - for(u = 0; u < (unsigned)space_ndims; u++) { + for(u = 0; u < space_ndims; u++) { elmts_per_chunk *= layout->u.chunk.dim[u]; chunk_dim[u] = layout->u.chunk.dim[u]; shrunk_dim[u] = space_dim[u] < old_dim[u]; } /* end for */ /* Create a dataspace for a chunk & set the extent */ - if(NULL == (chunk_space = H5S_create_simple((unsigned)space_ndims, chunk_dim, NULL))) + if(NULL == (chunk_space = H5S_create_simple(space_ndims, chunk_dim, NULL))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") /* Reset hyperslab start array */ @@ -4065,7 +4067,6 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) HDmemset(&udata, 0, sizeof udata); udata.common.layout = &layout->u.chunk; udata.common.storage = &layout->storage.u.chunk; - udata.common.rdcc = rdcc; udata.io_info = &chk_io_info; udata.idx_info = &idx_info; udata.space_dim = space_dim; @@ -4084,7 +4085,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) */ HDmemset(min_mod_chunk_off, 0, sizeof(min_mod_chunk_off)); HDmemset(max_mod_chunk_off, 0, sizeof(max_mod_chunk_off)); - for(op_dim = 0; op_dim < space_ndims; op_dim++) { + for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) { /* Calculate the largest offset of chunks that might need to be * modified in this dimension */ max_mod_chunk_off[op_dim] = chunk_dim[op_dim] * ((old_dim[op_dim] - 1) @@ -4119,21 +4120,8 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) fill_dim[op_dim] = FALSE; } /* end for */ - /* Check the cache for any entries that are outside the bounds. Mark these - * entries as deleted so they are not flushed to disk accidentally. This is - * only necessary if there are chunks that need to be filled. */ - if(has_fill) - for(ent = rdcc->head; ent; ent = ent->next) - /* Check for chunk offset outside of new dimensions */ - for(u = 0; u < (unsigned)space_ndims; u++) - if((hsize_t)ent->offset[u] >= space_dim[u]) { - /* Mark the entry as "deleted" */ - ent->deleted = TRUE; - break; - } /* end if */ - /* Main loop: fill or remove chunks */ - for(op_dim=0; op_dim<space_ndims; op_dim++) { + for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) { /* Check if modification along this dimension is really necessary */ if(!shrunk_dim[op_dim]) continue; @@ -4141,12 +4129,12 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) HDassert((hsize_t) max_mod_chunk_off[op_dim] >= min_mod_chunk_off[op_dim]); /* Reset the chunk offset indices */ - HDmemset(chunk_offset, 0, ((unsigned)space_ndims * sizeof(chunk_offset[0]))); + HDmemset(chunk_offset, 0, (space_ndims * sizeof(chunk_offset[0]))); chunk_offset[op_dim] = min_mod_chunk_off[op_dim]; /* Initialize "dims_outside_fill" array */ ndims_outside_fill = 0; - for(u = 0; u < (unsigned)space_ndims; u++) + for(u = 0; u < space_ndims; u++) if((hssize_t)chunk_offset[u] > max_fill_chunk_off[u]) { dims_outside_fill[u] = TRUE; ndims_outside_fill++; @@ -4161,10 +4149,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) int i; /* Local index variable */ /* Calculate the index of this chunk */ - if(H5VM_chunk_index((unsigned)space_ndims, chunk_offset, - layout->u.chunk.dim, layout->u.chunk.down_chunks, - &(chk_io_info.store->chunk.index)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get chunk index") + chk_io_info.store->chunk.index = H5VM_chunk_index(space_ndims, chunk_offset, layout->u.chunk.dim, layout->u.chunk.down_chunks); if(0 == ndims_outside_fill) { HDassert(fill_dim[op_dim]); @@ -4175,12 +4160,14 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write fill value") } /* end if */ else { + H5D_chunk_ud_t chk_udata; /* User data for getting chunk info */ + #ifndef NDEBUG /* Make sure this chunk is really outside the new dimensions */ { hbool_t outside_dim = FALSE; - for(u = 0; u < (unsigned)space_ndims; u++) + for(u = 0; u < space_ndims; u++) if(chunk_offset[u] >= space_dim[u]) { outside_dim = TRUE; break; @@ -4200,7 +4187,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk") /* Remove the chunk from disk, if present */ - if(H5F_addr_defined(chk_udata.addr)) { + if(H5F_addr_defined(chk_udata.chunk_block.offset)) { /* Update the offset in idx_udata */ idx_udata.offset = chunk_offset; @@ -4217,7 +4204,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) if(chunk_offset[i] > (hsize_t) max_mod_chunk_off[i]) { /* Left maximum dimensions, "wrap around" and check if this * dimension is no longer outside the fill dimension */ - if(i == op_dim) { + if((unsigned)i == op_dim) { chunk_offset[i] = min_mod_chunk_off[i]; if(dims_outside_fill[i] && fill_dim[i]) { dims_outside_fill[i] = FALSE; @@ -4295,8 +4282,7 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) FUNC_ENTER_STATIC /* Compute the index for this chunk */ - if(H5VM_chunk_index(rank, chunk_rec->offset, udata->common.layout->dim, udata->common.layout->down_chunks, &chunk_index) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, H5_ITER_ERROR, "can't get chunk index") + chunk_index = H5VM_chunk_index(rank, chunk_rec->offset, udata->common.layout->dim, udata->common.layout->down_chunks); /* Set it in the userdata to return */ udata->chunk_addr[chunk_index] = chunk_rec->chunk_addr; @@ -4337,7 +4323,6 @@ H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]) HDmemset(&udata, 0, sizeof(udata)); udata.common.layout = &dset->shared->layout.u.chunk; udata.common.storage = &dset->shared->layout.storage.u.chunk; - udata.common.rdcc = &(dset->shared->cache.chunk); udata.chunk_addr = chunk_addr; /* Compose chunked index info struct */ @@ -4453,7 +4438,6 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id) { H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ H5D_rdcc_ent_t *ent, *next; /*cache entry */ - H5D_rdcc_ent_t *old_ent; /* Old cache entry */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ unsigned rank; /* Current # of dimensions */ @@ -4466,7 +4450,7 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id) HDassert(dset->shared->layout.u.chunk.ndims > 0 && dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS); /* Get the rank */ - rank = dset->shared->layout.u.chunk.ndims-1; + rank = dset->shared->layout.u.chunk.ndims - 1; HDassert(rank > 0); /* 1-D dataset's chunks can't have their index change */ @@ -4486,36 +4470,51 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id) next = ent->next; /* Calculate the index of this chunk */ - if(H5VM_chunk_index(rank, ent->offset, dset->shared->layout.u.chunk.dim, dset->shared->layout.u.chunk.down_chunks, &idx) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") + idx = H5VM_chunk_index(rank, ent->offset, dset->shared->layout.u.chunk.dim, dset->shared->layout.u.chunk.down_chunks); /* Compute the index for the chunk entry */ old_idx = ent->idx; /* Save for later */ ent->idx = H5D_CHUNK_HASH(dset->shared, idx); if(old_idx != ent->idx) { + H5D_rdcc_ent_t *old_ent; /* Old cache entry */ + /* Check if there is already a chunk at this chunk's new location */ old_ent = rdcc->slot[ent->idx]; if(old_ent != NULL) { - HDassert(old_ent->locked == 0); + HDassert(old_ent->locked == FALSE); + HDassert(old_ent->deleted == FALSE); - /* Check if we are removing the entry we would walk to next */ - if(old_ent == next) - next = old_ent->next; - - /* Remove the old entry from the cache */ - if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, old_ent, TRUE) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") + /* Mark the old entry as deleted, but do not evict (yet). + * Make sure we do not make any calls to the index + * until all chunks have updated indices! */ + old_ent->deleted = TRUE; } /* end if */ /* Insert this chunk into correct location in hash table */ rdcc->slot[ent->idx] = ent; - /* Null out previous location */ - rdcc->slot[old_idx] = NULL; + /* If this chunk was previously marked as deleted and therefore + * not in the hash table, reset the deleted flag. + * Otherwise clear the old hash table slot. */ + if(ent->deleted) + ent->deleted = FALSE; + else + rdcc->slot[old_idx] = NULL; } /* end if */ } /* end for */ + /* Evict chunks that are still marked as deleted */ + for(ent = rdcc->head; ent; ent = next) { + /* Get the pointer to the next cache entry */ + next = ent->next; + + /* Remove the old entry from the cache */ + if(ent->deleted) + if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") + } /* end for */ + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_update_cache() */ @@ -4541,6 +4540,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) H5D_chunk_ud_t udata_dst; /* User data about new destination chunk */ hbool_t is_vlen = FALSE; /* Whether datatype is variable-length */ hbool_t fix_ref = FALSE; /* Whether to fix up references in the dest. file */ + hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ /* General information about chunk copy */ void *bkg = udata->bkg; /* Background buffer for datatype conversion */ @@ -4662,13 +4662,12 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) udata_dst.common.layout = udata->idx_info_dst->layout; udata_dst.common.storage = udata->idx_info_dst->storage; udata_dst.common.offset = chunk_rec->offset; - udata_dst.common.rdcc = NULL; - udata_dst.nbytes = chunk_rec->nbytes; + udata_dst.chunk_block.offset = HADDR_UNDEF; + udata_dst.chunk_block.length = chunk_rec->nbytes; udata_dst.filter_mask = chunk_rec->filter_mask; - udata_dst.addr = HADDR_UNDEF; /* Need to compress variable-length & reference data elements before writing to file */ - if(has_filters && (is_vlen || fix_ref) ) { + if(has_filters && (is_vlen || fix_ref)) { if(H5Z_pipeline(pline, 0, &(udata_dst.filter_mask), H5Z_NO_EDC, cb_struct, &nbytes, &buf_size, &buf) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "output pipeline failed") #if H5_SIZEOF_SIZE_T > 4 @@ -4676,26 +4675,31 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) if(nbytes > ((size_t)0xffffffff)) HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, H5_ITER_ERROR, "chunk too large for 32-bit length") #endif /* H5_SIZEOF_SIZE_T > 4 */ - H5_ASSIGN_OVERFLOW(udata_dst.nbytes, nbytes, size_t, uint32_t); + H5_ASSIGN_OVERFLOW(udata_dst.chunk_block.length, nbytes, size_t, uint32_t); udata->buf = buf; udata->buf_size = buf_size; } /* end if */ + /* Allocate chunk in the file */ + if(H5D__chunk_file_alloc(udata->idx_info_dst, NULL, &udata_dst.chunk_block, &need_insert) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") + + /* Write chunk data to destination file */ + HDassert(H5F_addr_defined(udata_dst.chunk_block.offset)); + if(H5F_block_write(udata->idx_info_dst->f, H5FD_MEM_DRAW, udata_dst.chunk_block.offset, nbytes, udata->idx_info_dst->dxpl_id, buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to write raw data to file") + /* Set metadata tag in dxpl_id */ H5_BEGIN_TAG(udata->idx_info_dst->dxpl_id, H5AC__COPIED_TAG, H5_ITER_ERROR); - /* Insert chunk into the destination index */ - if((udata->idx_info_dst->storage->ops->insert)(udata->idx_info_dst, &udata_dst) < 0) - HGOTO_ERROR_TAG(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert chunk into index") + /* Insert chunk record into index */ + if(need_insert && udata->idx_info_dst->storage->ops->insert) + if((udata->idx_info_dst->storage->ops->insert)(udata->idx_info_dst, &udata_dst) < 0) + HGOTO_ERROR_TAG(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert chunk addr into index") /* Reset metadata tag in dxpl_id */ H5_END_TAG(H5_ITER_ERROR); - /* Write chunk data to destination file */ - HDassert(H5F_addr_defined(udata_dst.addr)); - if(H5F_block_write(udata->idx_info_dst->f, H5FD_MEM_DRAW, udata_dst.addr, nbytes, udata->idx_info_dst->dxpl_id, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to write raw data to file") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_copy_cb() */ @@ -4906,7 +4910,6 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, HDmemset(&udata, 0, sizeof udata); udata.common.layout = layout_src; udata.common.storage = storage_src; - udata.common.rdcc = NULL; udata.file_src = f_src; udata.idx_info_dst = &idx_info_dst; udata.buf = buf; @@ -4952,7 +4955,7 @@ done: /* Clean up any index information */ if(copy_setup_done) - if((storage_src->ops->copy_shutdown)(storage_src, storage_dst, dxpl_id) < 0) + if(storage_src->ops->copy_shutdown && (storage_src->ops->copy_shutdown)(storage_src, storage_dst, dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to shut down index copying info") FUNC_LEAVE_NOAPI(ret_value) @@ -5337,3 +5340,114 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5D__nonexistent_readvv() */ + +/*------------------------------------------------------------------------- + * Function: H5D__chunk_file_alloc() + * + * Purpose: Chunk allocation: + * Create the chunk if it doesn't exist, or reallocate the + * chunk if its size changed. + * The coding is moved and modified from each index structure. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2014 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk, + H5F_block_t *new_chunk, hbool_t *need_insert) +{ + hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(new_chunk); + HDassert(need_insert); + + /* Check for filters on chunks */ + if(idx_info->pline->nused > 0) { + /* Sanity/error checking block */ + { + unsigned allow_chunk_size_len; /* Allowed size of encoded chunk size */ + unsigned new_chunk_size_len; /* Size of encoded chunk size */ + + /* Compute the size required for encoding the size of a chunk, allowing + * for an extra byte, in case the filter makes the chunk larger. + */ + allow_chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)(idx_info->layout->size)) + 8) / 8); + if(allow_chunk_size_len > 8) + allow_chunk_size_len = 8; + + /* Compute encoded size of chunk */ + new_chunk_size_len = (H5VM_log2_gen((uint64_t)(new_chunk->length)) + 8) / 8; + if(new_chunk_size_len > 8) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "encoded chunk size is more than 8 bytes?!?") + + /* Check if the chunk became too large to be encoded */ + if(new_chunk_size_len > allow_chunk_size_len) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded") + } /* end block */ + + if(old_chunk && H5F_addr_defined(old_chunk->offset)) { + /* Sanity check */ + HDassert(!H5F_addr_defined(new_chunk->offset) || H5F_addr_eq(new_chunk->offset, old_chunk->offset)); + + /* Check for chunk being same size */ + if(new_chunk->length != old_chunk->length) { + /* Release previous chunk */ + if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, old_chunk->offset, old_chunk->length) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + alloc_chunk = TRUE; + } /* end if */ + else { + /* Don't need to reallocate chunk, but send its address back up */ + if(!H5F_addr_defined(new_chunk->offset)) + new_chunk->offset = old_chunk->offset; + } /* end else */ + } /* end if */ + else { + HDassert(!H5F_addr_defined(new_chunk->offset)); + alloc_chunk = TRUE; + } /* end else */ + } /* end if */ + else { + HDassert(!H5F_addr_defined(new_chunk->offset)); + HDassert(new_chunk->length == idx_info->layout->size); + alloc_chunk = TRUE; + } /* end else */ + + /* Actually allocate space for the chunk in the file */ + if(alloc_chunk) { + switch(idx_info->storage->idx_type) { + case H5D_CHUNK_IDX_BTREE: + HDassert(new_chunk->length > 0); + H5_CHECK_OVERFLOW(new_chunk->length, /*From: */uint32_t, /*To: */hsize_t); + new_chunk->offset = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)new_chunk->length); + if(!H5F_addr_defined(new_chunk->offset)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed") + *need_insert = TRUE; + break; + + case H5D_CHUNK_IDX_NTYPES: + default: + HDassert(0 && "This should never be executed!"); + break; + } /* end switch */ + } /* end if */ + + HDassert(H5F_addr_defined(new_chunk->offset)); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__chunk_file_alloc() */ + diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 789beab..1d8b97c 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -174,11 +174,8 @@ H5D__compact_construct(H5F_t *f, H5D_t *dset) hssize_t stmp_size; /* Temporary holder for raw data size */ hsize_t tmp_size; /* Temporary holder for raw data size */ hsize_t max_comp_data_size; /* Max. allowed size of compact data */ - hsize_t dim[H5O_LAYOUT_NDIMS]; /* Current size of data in elements */ - hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ - int ndims; /* Rank of dataspace */ - int i; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -187,11 +184,9 @@ H5D__compact_construct(H5F_t *f, H5D_t *dset) HDassert(dset); /* Check for invalid dataset dimensions */ - if((ndims = H5S_get_simple_extent_dims(dset->shared->space, dim, max_dim)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions") - for(i = 0; i < ndims; i++) - if(max_dim[i] > dim[i]) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "extendible compact dataset") + for(u = 0; u < dset->shared->ndims; u++) + if(dset->shared->max_dims[u] > dset->shared->curr_dims[u]) + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "extendible compact dataset not allowed") /* * Compact dataset is stored in dataset object header message of diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 8d4cd02..e913a3f 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -396,10 +396,7 @@ H5D__contig_construct(H5F_t *f, H5D_t *dset) size_t dt_size; /* Size of datatype */ hsize_t tmp_size; /* Temporary holder for raw data size */ size_t tmp_sieve_buf_size; /* Temporary holder for sieve buffer size */ - hsize_t dim[H5O_LAYOUT_NDIMS]; /* Current size of data in elements */ - hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ - int ndims; /* Rank of dataspace */ - int i; /* Local index variable */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -415,11 +412,9 @@ H5D__contig_construct(H5F_t *f, H5D_t *dset) */ /* Check for invalid dataset dimensions */ - if((ndims = H5S_get_simple_extent_dims(dset->shared->space, dim, max_dim)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage") - for(i = 0; i < ndims; i++) - if(max_dim[i] > dim[i]) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "extendible contiguous non-external dataset") + for(u = 0; u < dset->shared->ndims; u++) + if(dset->shared->max_dims[u] > dset->shared->curr_dims[u]) + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "extendible contiguous non-external dataset not allowed") /* Retrieve the number of elements in the dataspace */ if((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0) @@ -675,7 +670,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, } /* end if */ else { /* Allocate room for the data sieve buffer */ - if(NULL == (dset_contig->sieve_buf = H5FL_BLK_MALLOC(sieve_buf, dset_contig->sieve_buf_size))) + if(NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed") /* Determine the new sieve buffer size & location */ @@ -946,7 +941,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, } /* end if */ else { /* Allocate room for the data sieve buffer */ - if(NULL == (dset_contig->sieve_buf = H5FL_BLK_MALLOC(sieve_buf, dset_contig->sieve_buf_size))) + if(NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed") #ifdef H5_CLEAR_MEMORY diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index a7c6dc1..4e934f2 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -113,7 +113,7 @@ H5Ddebug(hid_t dset_id) /* Print B-tree information */ if(H5D_CHUNKED == dset->shared->layout.type) - (void)H5D__chunk_dump_index(dset, H5AC_dxpl_id, stdout); + (void)H5D__chunk_dump_index(dset, H5AC_ind_dxpl_id, stdout); else if(H5D_CONTIGUOUS == dset->shared->layout.type) HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 04cf032..b3dae7b 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -233,7 +233,7 @@ H5Dopen1(hid_t loc_id, const char *name) H5O_type_t obj_type; /* Type of object at location */ hbool_t loc_found = FALSE; /* Location at 'name' found */ hid_t dapl_id = H5P_DATASET_ACCESS_DEFAULT; /* dapl to use to open dataset */ - hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datset */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -341,9 +341,7 @@ static herr_t H5D__extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id) { htri_t changed; /* Flag to indicate that the dataspace was successfully extended */ - H5S_t *space; /* Dataset's dataspace */ - int rank; /* Dataspace # of dimensions */ - hsize_t curr_dims[H5O_LAYOUT_NDIMS];/* Current dimension sizes */ + hsize_t old_dims[H5S_MAX_RANK]; /* Current (i.e. old, if changed) dimension sizes */ H5O_fill_t *fill; /* Dataset's fill value */ herr_t ret_value = SUCCEED; /* Return value */ @@ -364,20 +362,30 @@ H5D__extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id) */ /* Retrieve the current dimensions */ - space = dataset->shared->space; - if((rank = H5S_get_simple_extent_dims(space, curr_dims, NULL)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") + HDcompile_assert(sizeof(old_dims) == sizeof(dataset->shared->curr_dims)); + HDmemcpy(old_dims, dataset->shared->curr_dims, H5S_MAX_RANK * sizeof(old_dims[0])); /* Increase the size of the data space */ - if((changed = H5S_extend(space, size)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to increase size of data space") + if((changed = H5S_extend(dataset->shared->space, size)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to increase size of dataspace") /* Updated the dataset's info if the dataspace was successfully extended */ if(changed) { + /* Get the extended dimension sizes */ + /* (Need to retrieve this here, since the 'size' dimensions could + * extend one dimension but be smaller in a different dimension, + * and the dataspace's extent is the larger of the current and + * 'size' dimension values. - QAK) + */ + if(H5S_get_simple_extent_dims(dataset->shared->space, dataset->shared->curr_dims, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") + /* Update the index values for the cached chunks for this dataset */ if(H5D_CHUNKED == dataset->shared->layout.type) { + /* Update general information for chunks */ if(H5D__chunk_set_info(dataset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to update # of chunks") + /* Update the chunk cache indices */ if(H5D__chunk_update_cache(dataset, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update cached chunk indices") } /* end if */ @@ -385,8 +393,7 @@ H5D__extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id) /* Allocate space for the new parts of the dataset, if appropriate */ fill = &dataset->shared->dcpl_cache.fill; if(fill->alloc_time == H5D_ALLOC_TIME_EARLY) - if(H5D__alloc_storage(dataset, dxpl_id, H5D_ALLOC_EXTEND, FALSE, - curr_dims) < 0) + if(H5D__alloc_storage(dataset, dxpl_id, H5D_ALLOC_EXTEND, FALSE, old_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value") /* Mark the dataspace as dirty, for later writing to the file */ diff --git a/src/H5Defl.c b/src/H5Defl.c index 38c8ccd..355492f 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -126,14 +126,11 @@ static herr_t H5D__efl_construct(H5F_t *f, H5D_t *dset) { size_t dt_size; /* Size of datatype */ - hsize_t dim[H5O_LAYOUT_NDIMS]; /* Current size of data in elements */ - hsize_t max_dim[H5O_LAYOUT_NDIMS]; /* Maximum size of data in elements */ hssize_t stmp_size; /* Temporary holder for raw data size */ hsize_t tmp_size; /* Temporary holder for raw data size */ hsize_t max_points; /* Maximum elements */ hsize_t max_storage; /* Maximum storage size */ - int ndims; /* Rank of dataspace */ - int i; /* Local index variable */ + unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -149,11 +146,9 @@ H5D__efl_construct(H5F_t *f, H5D_t *dset) */ /* Check for invalid dataset dimensions */ - if((ndims = H5S_get_simple_extent_dims(dset->shared->space, dim, max_dim)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage") - for(i = 1; i < ndims; i++) - if(max_dim[i] > dim[i]) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "only the first dimension can be extendible") + for(u = 1; u < dset->shared->ndims; u++) + if(dset->shared->max_dims[u] > dset->shared->curr_dims[u]) + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "only the first dimension can be extendible") /* Retrieve the size of the dataset's datatype */ if(0 == (dt_size = H5T_get_size(dset->shared->type))) diff --git a/src/H5Dfill.c b/src/H5Dfill.c index e682dd6..484c362 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -133,7 +133,7 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") /* Fill the selection in the memory buffer */ - if(H5D__fill(fill, fill_type, buf, buf_type, space, H5AC_dxpl_id) < 0) + if(H5D__fill(fill, fill_type, buf, buf_type, space, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed") done: diff --git a/src/H5Dint.c b/src/H5Dint.c index 8e1fcec..23824e3 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -62,6 +62,7 @@ static H5D_shared_t *H5D__new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); static herr_t H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); +static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id); @@ -665,6 +666,40 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__cache_dataspace_info + * + * Purpose: Cache dataspace info for a dataset + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Quincey Koziol + * Wednesday, November 19, 2014 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__cache_dataspace_info(const H5D_t *dset) +{ + int sndims; /* Signed number of dimensions of dataspace rank */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checking */ + HDassert(dset); + + /* Cache info for dataset's dataspace */ + if((sndims = H5S_get_simple_extent_dims(dset->shared->space, dset->shared->curr_dims, dset->shared->max_dims)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't cache dataspace dimensions") + dset->shared->ndims = (unsigned)sndims; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__cache_dataspace_info() */ + + +/*------------------------------------------------------------------------- * Function: H5D__init_space * * Purpose: Copy a dataspace for a dataset's use, performing all the @@ -698,6 +733,10 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space) if(NULL == (dset->shared->space = H5S_copy(space, FALSE, TRUE))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace") + /* Cache the dataset's dataspace info */ + if(H5D__cache_dataspace_info(dset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info") + /* Set the latest format, if requested */ if(use_latest_format) if(H5S_set_latest_version(dset->shared->space) < 0) @@ -1251,6 +1290,10 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) if(NULL == (dataset->shared->space = H5S_read(&(dataset->oloc), dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") + /* Cache the dataset's dataspace info */ + if(H5D__cache_dataspace_info(dataset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info") + /* Get a datatype ID for the dataset's datatype */ if((dataset->shared->type_id = H5I_register(H5I_DATATYPE, dataset->shared->type, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type") @@ -2161,9 +2204,7 @@ done: herr_t H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) { - H5S_t *space; /* Dataset's dataspace */ - int rank; /* Dataspace # of dimensions */ - hsize_t curr_dims[H5O_LAYOUT_NDIMS];/* Current dimension sizes */ + hsize_t curr_dims[H5S_MAX_RANK]; /* Current dimension sizes */ htri_t changed; /* Whether the dataspace changed size */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2187,29 +2228,30 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) if(H5D__check_filters(dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't apply filters") - /* Get the data space */ - space = dset->shared->space; - - /* Check if we are shrinking or expanding any of the dimensions */ - if((rank = H5S_get_simple_extent_dims(space, curr_dims, NULL)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") + /* Keep the current dataspace dimensions for later */ + HDcompile_assert(sizeof(curr_dims) == sizeof(dset->shared->curr_dims)); + HDmemcpy(curr_dims, dset->shared->curr_dims, H5S_MAX_RANK * sizeof(curr_dims[0])); - /* Modify the size of the data space */ - if((changed = H5S_set_extent(space, size)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of data space") + /* Modify the size of the dataspace */ + if((changed = H5S_set_extent(dset->shared->space, size)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") /* Don't bother updating things, unless they've changed */ if(changed) { - hbool_t shrink = FALSE; /* Flag to indicate a dimension has shrank */ - hbool_t expand = FALSE; /* Flag to indicate a dimension has grown */ - unsigned u; /* Local index variable */ + hbool_t shrink = FALSE; /* Flag to indicate a dimension has shrank */ + hbool_t expand = FALSE; /* Flag to indicate a dimension has grown */ + unsigned u; /* Local index variable */ /* Determine if we are shrinking and/or expanding any dimensions */ - for(u = 0; u < (unsigned)rank; u++) { + for(u = 0; u < dset->shared->ndims; u++) { + /* Check for various status changes */ if(size[u] < curr_dims[u]) shrink = TRUE; if(size[u] > curr_dims[u]) expand = TRUE; + + /* Update the cached copy of the dataset's dimensions */ + dset->shared->curr_dims[u] = size[u]; } /* end for */ /*------------------------------------------------------------------------- @@ -2218,7 +2260,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) */ /* Update the index values for the cached chunks for this dataset */ if(H5D_CHUNKED == dset->shared->layout.type) { - /* Update the cached chunk info */ + /* Set the cached chunk info */ if(H5D__chunk_set_info(dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to update # of chunks") if(H5D__chunk_update_cache(dset, dxpl_id) < 0) diff --git a/src/H5Dio.c b/src/H5Dio.c index 88f75b1..44080dc 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -302,10 +302,8 @@ H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, uint32_t direct_filters; hsize_t *direct_offset; uint32_t direct_datasize; - int ndims = 0; - hsize_t dims[H5O_LAYOUT_NDIMS]; hsize_t internal_offset[H5O_LAYOUT_NDIMS]; - unsigned u; + unsigned u; /* Local index variable */ /* Get the dataset transfer property list */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) @@ -324,12 +322,9 @@ H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, /* The library's chunking code requires the offset terminates with a zero. So transfer the * offset array to an internal offset array */ - if((ndims = H5S_get_simple_extent_dims(dset->shared->space, dims, NULL)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve dataspace extent dims") - - for(u = 0; u < ndims; u++) { + for(u = 0; u < dset->shared->ndims; u++) { /* Make sure the offset doesn't exceed the dataset's dimensions */ - if(direct_offset[u] > dims[u]) + if(direct_offset[u] > dset->shared->curr_dims[u]) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset") /* Make sure the offset fall right on a chunk's boundary */ @@ -340,7 +335,7 @@ H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id, } /* end for */ /* Terminate the offset with a zero */ - internal_offset[ndims] = 0; + internal_offset[dset->shared->ndims] = 0; /* write raw data */ if(H5D__chunk_direct_write(dset, dxpl_id, direct_filters, internal_offset, direct_datasize, buf) < 0) diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 01d2288..db487cd 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -860,10 +860,9 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ mspace = chunk_info->mspace; /* Look up address of chunk */ - if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->coords, - chunk_info->index, &udata) < 0) + if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->coords, chunk_info->index, &udata) < 0) HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk address") - ctg_store.contig.dset_addr = udata.addr; + ctg_store.contig.dset_addr = udata.chunk_block.offset; } /* end else */ /* Set up the base storage address for this chunk */ @@ -1592,7 +1591,7 @@ if(H5DEBUG(D)) if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->coords, chunk_info->index, &udata) < 0) HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skipped list") - chunk_addr = udata.addr; + chunk_addr = udata.chunk_block.offset; } /* end if */ else chunk_addr = total_chunk_addr_array[chunk_info->index]; diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 6128d7e..12e84b0 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -33,6 +33,7 @@ /* Other private headers needed by this file */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5Fprivate.h" /* File access */ #include "H5Gprivate.h" /* Groups */ #include "H5SLprivate.h" /* Skip lists */ #include "H5Tprivate.h" /* Datatypes */ @@ -82,7 +83,7 @@ typedef struct H5D_type_info_t { /* Computed/derived values */ size_t src_type_size; /* Size of source type */ - size_t dst_type_size; /* Size of destination type*/ + size_t dst_type_size; /* Size of destination type */ size_t max_type_size; /* Size of largest source/destination type */ hbool_t is_conv_noop; /* Whether the type conversion is a NOOP */ hbool_t is_xform_noop; /* Whether the data transform is a NOOP */ @@ -238,8 +239,8 @@ typedef struct H5D_chk_idx_info_t { * The chunk's file address, filter mask and size on disk are not key values. */ typedef struct H5D_chunk_rec_t { - uint32_t nbytes; /* Size of stored data */ hsize_t offset[H5O_LAYOUT_NDIMS]; /* Logical offset to start */ + uint32_t nbytes; /* Size of stored data */ unsigned filter_mask; /* Excluded filters */ haddr_t chunk_addr; /* Address of chunk in file */ } H5D_chunk_rec_t; @@ -254,9 +255,6 @@ typedef struct H5D_chunk_common_ud_t { const H5O_layout_chunk_t *layout; /* Chunk layout description */ const H5O_storage_chunk_t *storage; /* Chunk storage description */ const hsize_t *offset; /* Logical offset of chunk */ - const struct H5D_rdcc_t *rdcc; /* Chunk cache. Only necessary if the index may - * be modified, and if any chunks in the dset - * may be cached */ } H5D_chunk_common_ud_t; /* B-tree callback info for various operations */ @@ -265,9 +263,8 @@ typedef struct H5D_chunk_ud_t { /* Upward */ unsigned idx_hint; /*index of chunk in cache, if present */ - uint32_t nbytes; /*size of stored data */ + H5F_block_t chunk_block; /*offset/length of chunk in file */ unsigned filter_mask; /*excluded filters */ - haddr_t addr; /*file address of chunk */ } H5D_chunk_ud_t; /* Typedef for "generic" chunk callbacks */ @@ -325,9 +322,9 @@ typedef struct H5D_chunk_info_t { uint32_t chunk_points; /* Number of elements selected in chunk */ hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of chunk in file dataset's dataspace */ H5S_t *fspace; /* Dataspace describing chunk & selection in it */ - unsigned fspace_shared; /* Indicate that the file space for a chunk is shared and shouldn't be freed */ + hbool_t fspace_shared; /* Indicate that the file space for a chunk is shared and shouldn't be freed */ H5S_t *mspace; /* Dataspace describing selection in memory corresponding to this chunk */ - unsigned mspace_shared; /* Indicate that the memory space for a chunk is shared and shouldn't be freed */ + hbool_t mspace_shared; /* Indicate that the memory space for a chunk is shared and shouldn't be freed */ } H5D_chunk_info_t; /* Main structure holding the mapping between file chunks and memory */ @@ -337,7 +334,6 @@ typedef struct H5D_chunk_map_t { const H5S_t *file_space; /* Pointer to the file dataspace */ unsigned f_ndims; /* Number of dimensions for file dataspace */ - hsize_t f_dims[H5O_LAYOUT_NDIMS]; /* File dataspace dimensions */ const H5S_t *mem_space; /* Pointer to the memory dataspace */ H5S_t *mchunk_tmpl; /* Dataspace template for new memory chunks */ @@ -365,9 +361,9 @@ typedef struct H5D_chunk_map_t { typedef struct H5D_chunk_cached_t { hbool_t valid; /*whether cache info is valid*/ hsize_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/ + haddr_t addr; /*file address of chunk */ uint32_t nbytes; /*size of stored data */ unsigned filter_mask; /*excluded filters */ - haddr_t addr; /*file address of chunk */ } H5D_chunk_cached_t; /* The raw data chunk cache */ @@ -389,7 +385,7 @@ typedef struct H5D_rdcc_t { struct H5D_rdcc_ent_t **slot; /* Chunk slots, each points to a chunk*/ H5SL_t *sel_chunks; /* Skip list containing information for each chunk selected */ H5S_t *single_space; /* Dataspace for single element I/O on chunks */ - H5D_chunk_info_t *single_chunk_info; /* Pointer to single chunk's info */ + H5D_chunk_info_t *single_chunk_info; /* Pointer to single chunk's info */ } H5D_rdcc_t; /* The raw data contiguous data cache */ @@ -419,6 +415,11 @@ typedef struct H5D_shared_t { H5O_layout_t layout; /* Data layout */ hbool_t checked_filters;/* TRUE if dataset passes can_apply check */ + /* Cached dataspace info */ + unsigned ndims; /* The dataset's dataspace rank */ + hsize_t curr_dims[H5S_MAX_RANK]; /* The curr. size of dataset dimensions */ + hsize_t max_dims[H5S_MAX_RANK]; /* The max. size of dataset dimensions */ + /* Buffered/cached information for types of raw data storage*/ struct { H5D_rdcdc_t contig; /* Information about contiguous data */ @@ -492,11 +493,11 @@ typedef struct { typedef struct H5D_rdcc_ent_t { hbool_t locked; /*entry is locked in cache */ hbool_t dirty; /*needs to be written to disk? */ - hbool_t deleted; /*chunk about to be deleted (do not flush) */ + hbool_t deleted; /*chunk about to be deleted */ hsize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */ uint32_t rd_count; /*bytes remaining to be read */ uint32_t wr_count; /*bytes remaining to be written */ - haddr_t chunk_addr; /*address of chunk in file */ + H5F_block_t chunk_block; /*offset/length of chunk in file */ uint8_t *chunk; /*the unfiltered chunk data */ unsigned idx; /*index in hash table */ struct H5D_rdcc_ent_t *next;/*next item in doubly-linked list */ diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 0e6def6..2065b08 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -186,7 +186,7 @@ H5_DLL herr_t H5E_init(void); H5_DLL herr_t H5E_push_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc); H5_DLL herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func, - unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...); + unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...)__attribute__((format (printf, 8, 9))); H5_DLL herr_t H5E_clear_stack(H5E_t *estack); H5_DLL herr_t H5E_dump_api_stack(hbool_t is_api); diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 17a35d9..1639ab4 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -165,7 +165,7 @@ H5_DLL herr_t H5Eclose_stack(hid_t stack_id); H5_DLL ssize_t H5Eget_class_name(hid_t class_id, char *name, size_t size); H5_DLL herr_t H5Eset_current_stack(hid_t err_stack_id); H5_DLL herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, - hid_t cls_id, hid_t maj_id, hid_t min_id, const char *msg, ...); + hid_t cls_id, hid_t maj_id, hid_t min_id, const char *msg, ...)__attribute__((format (printf, 8, 9))); H5_DLL herr_t H5Epop(hid_t err_stack, size_t count); H5_DLL herr_t H5Eprint2(hid_t err_stack, FILE *stream); H5_DLL herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t func, @@ -484,15 +484,15 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Check/fix arguments */ if(!filename || !*filename) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file name") /* In this routine, we only accept the following flags: - * H5F_ACC_EXCL, H5F_ACC_TRUNC and H5F_ACC_DEBUG + * H5F_ACC_EXCL and H5F_ACC_TRUNC */ - if(flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_DEBUG)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags") + if(flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags") /* The H5F_ACC_EXCL and H5F_ACC_TRUNC flags are mutually exclusive */ if((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mutually exclusive flags for file creation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mutually exclusive flags for file creation") /* Check file creation property list */ if(H5P_DEFAULT == fcpl_id) @@ -1840,12 +1840,12 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FDtruncate(H5FD_t *file, hid_t dxpl_id, unsigned closing) +H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE3("e", "*xiIu", file, dxpl_id, closing); + H5TRACE3("e", "*xib", file, dxpl_id, closing); /* Check args */ if(!file || !file->cls) @@ -1879,7 +1879,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FD_truncate(H5FD_t *file, hid_t dxpl_id, unsigned closing) +H5FD_truncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing) { herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 70cf49a..d81509a 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1049,8 +1049,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, char debug_str[128]; int flag, i; if (MPI_INFO_NULL != info_dup) { - /*OKAY: CAST DISCARDS CONST*/ - MPI_Info_get(fa->info, (char *)H5F_MPIO_DEBUG_KEY, 127, debug_str, &flag); + MPI_Info_get(fa->info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str)-1, debug_str, &flag); if (flag) { fprintf(stdout, "H5FD_mpio debug flags=%s\n", debug_str ); for (i=0; @@ -1063,8 +1062,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, } #endif - /*OKAY: CAST DISCARDS CONST*/ - if(MPI_SUCCESS != (mpi_code = MPI_File_open(comm_dup, (char*)name, mpi_amode, info_dup, &fh))) + if(MPI_SUCCESS != (mpi_code = MPI_File_open(comm_dup, name, mpi_amode, info_dup, &fh))) HMPI_GOTO_ERROR(NULL, "MPI_File_open failed", mpi_code) file_opened=1; @@ -1460,12 +1458,13 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add MPI_Count bytes_read; /* Number of bytes read in */ MPI_Count type_size; /* MPI datatype used for I/O's size */ MPI_Count io_size; /* Actual number of bytes requested */ + MPI_Count n; #else int bytes_read; /* Number of bytes read in */ int type_size; /* MPI datatype used for I/O's size */ int io_size; /* Actual number of bytes requested */ -#endif int n; +#endif H5P_genplist_t *plist = NULL; /* Property list pointer */ hbool_t use_view_this_time = FALSE; herr_t ret_value = SUCCEED; @@ -1506,7 +1505,10 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add /* Obtain the data transfer properties */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - xfer_mode = (H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); + + /* get the transfer mode from the dxpl */ + if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") /* * Set up for a fancy xfer using complex types, or single byte block. We @@ -1521,15 +1523,14 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add use_view_this_time = TRUE; /* prepare for a full-blown xfer using btype, ftype, and disp */ - if(H5P_get(plist,H5FD_MPI_XFER_MEM_MPI_TYPE_NAME,&buf_type)<0) + if(H5P_get(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, &buf_type)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - if(H5P_get(plist,H5FD_MPI_XFER_FILE_MPI_TYPE_NAME,&file_type)<0) + if(H5P_get(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, &file_type)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") /* * Set the file view when we are using MPI derived types */ - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if (MPI_SUCCESS != (mpi_code=MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) @@ -1548,9 +1549,12 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add if (H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_read: using MPIO collective mode\n"); #endif - /* Peek the collective_opt property to check whether the application wants to do IO individually. */ + /* Get the collective_opt property to check whether the application wants to do IO individually. */ HDassert(plist); - coll_opt_mode = (H5FD_mpio_collective_opt_t)H5P_peek_unsigned(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME); + + /* get the transfer mode from the dxpl */ + if(H5P_get(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &coll_opt_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property") if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG @@ -1573,7 +1577,6 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add /* * Reset the file view when we used MPI derived types */ - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } else { @@ -1799,8 +1802,9 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - /* Obtain the data transfer properties */ - xfer_mode = (H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); + /* get the transfer mode from the dxpl */ + if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") /* * Set up for a fancy xfer using complex types, or single byte block. We @@ -1823,7 +1827,6 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, /* * Set the file view when we are using MPI derived types */ - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) @@ -1853,17 +1856,18 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: using MPIO collective mode\n"); #endif - /* Peek the collective_opt property to check whether the application wants to do IO individually. */ + /* Get the collective_opt property to check whether the application wants to do IO individually. */ HDassert(plist); - coll_opt_mode = (H5FD_mpio_collective_opt_t)H5P_peek_unsigned(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME); + /* get the transfer mode from the dxpl */ + if(H5P_get(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &coll_opt_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property") - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: doing MPI collective IO\n"); #endif - if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(file->f, mpi_off, (void*)buf, size_i, buf_type, &mpi_stat))) + if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) } /* end if */ else { @@ -1871,17 +1875,15 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: doing MPI independent IO\n"); #endif - if(MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, (void*)buf, size_i, buf_type, &mpi_stat))) + if(MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) } /* end else */ /* Reset the file view when we used MPI derived types */ - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } else { - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ - if(MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, (void*)buf, size_i, buf_type, &mpi_stat))) + if(MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) } diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index b1f094c..bc61374 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -30,18 +30,11 @@ /* Disable certain warnings in PC-Lint: */ /*lint --emacro( {534, 830}, H5P_DEFAULT, H5P_FILE_ACCESS, H5P_DATASET_XFER) */ -/*lint --emacro( {534, 830}, H5F_ACC_DEBUG, H5F_ACC_RDWR) */ /*lint --emacro( {534, 830}, H5FD_MULTI) */ /*lint -esym( 534, H5Eclear2, H5Epush2) */ #include "hdf5.h" -/* - * Define H5FD_MULTI_DEBUG if you want the ability to print debugging - * messages to the standard error stream. Messages are only printed if the - * file is opened with the H5F_ACC_DEBUG flag. - */ -#define H5FD_MULTI_DEBUG #ifndef FALSE #define FALSE 0 @@ -796,19 +789,6 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) * files at the end. */ if (map_changed) { -#ifdef H5FD_MULTI_DEBUG - if (file->flags & H5F_ACC_DEBUG) { - fprintf(stderr, "H5FD_MULTI: member map override\n"); - fprintf(stderr, " old value: "); - ALL_MEMBERS(mt) { - fprintf(stderr, "%s%d", mt?", ":"", (int)(file->fa.memb_map[mt])); - } END_MEMBERS; - fprintf(stderr, "\n new value: "); - ALL_MEMBERS(mt) { - fprintf(stderr, "%s%d", mt?", ":"", (int)(map[mt])); - } END_MEMBERS; - } -#endif /* Commit map */ ALL_MEMBERS(mt) { file->fa.memb_map[mt] = map[mt]; @@ -821,11 +801,6 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) } END_MEMBERS; ALL_MEMBERS(mt) { if (!in_use[mt] && file->memb[mt]) { -#ifdef H5FD_MULTI_DEBUG - if (file->flags & H5F_ACC_DEBUG) { - fprintf(stderr, "H5FD_MULTI: close member %d\n", (int)mt); - } -#endif (void)H5FDclose(file->memb[mt]); file->memb[mt] = NULL; } @@ -1109,20 +1084,10 @@ H5FD_multi_close(H5FD_t *_file) /* Close as many members as possible */ ALL_MEMBERS(mt) { if (file->memb[mt]) { -#ifdef H5FD_MULTI_DEBUG - if (file->flags & H5F_ACC_DEBUG) { - fprintf(stderr, "H5FD_MULTI: closing member %d\n", (int)mt); - } -#endif if (H5FDclose(file->memb[mt])<0) { -#ifdef H5FD_MULTI_DEBUG - if (file->flags & H5F_ACC_DEBUG) { - fprintf(stderr, "H5FD_MULTI: close failed\n"); - } -#endif - nerrors++; + nerrors++; } else { - file->memb[mt] = NULL; + file->memb[mt] = NULL; } } } END_MEMBERS; @@ -1895,18 +1860,10 @@ open_members(H5FD_multi_t *file) */ sprintf(tmp, file->fa.memb_name[mt], file->name); -#ifdef H5FD_MULTI_DEBUG - if(file->flags & H5F_ACC_DEBUG) - fprintf(stderr, "H5FD_MULTI: open member %d \"%s\"\n", (int)mt, tmp); -#endif H5E_BEGIN_TRY { file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); } H5E_END_TRY; if(!file->memb[mt]) { -#ifdef H5FD_MULTI_DEBUG - if(file->flags & H5F_ACC_DEBUG) - fprintf(stderr, "H5FD_MULTI: open failed for member %d\n", (int)mt); -#endif if(!file->fa.relax || (file->flags & H5F_ACC_RDWR)) nerrors++; } diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index e98f0f4..20e9a79 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -134,7 +134,7 @@ H5_DLL herr_t H5FD_read(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t typ haddr_t addr, size_t size, void *buf/*out*/); H5_DLL herr_t H5FD_write(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type, haddr_t addr, size_t size, const void *buf); -H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); +H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing); H5_DLL herr_t H5FD_truncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum); H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle); diff --git a/src/H5Fio.c b/src/H5Fio.c index 1d05cd0..763bd69 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -100,6 +100,9 @@ H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) +#ifdef QAK +HDfprintf(stderr, "%s: read from addr = %a, size = %Zu\n", FUNC, addr, size); +#endif /* QAK */ HDassert(f); HDassert(f->shared); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index fe81edc..4e57a19 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -488,6 +488,8 @@ if it is changed, the code must compensate. -QAK */ +#define HDF5_BTREE_IK_MAX_ENTRIES 65536 /* 2^16 - 2 bytes for storing entries (children) */ + /* See format specification on version 1 B-trees */ /* Default file space handling strategy */ #define H5F_FILE_SPACE_STRATEGY_DEF H5F_FILE_SPACE_ALL @@ -571,6 +573,12 @@ typedef struct H5F_io_info_t { const struct H5P_genplist_t *dxpl; /* DXPL object */ } H5F_io_info_t; +/* Concise info about a block of bytes in a file */ +typedef struct H5F_block_t { + haddr_t offset; /* Offset of the block in the file */ + hsize_t length; /* Length of the block in the file */ +} H5F_block_t; + /*****************************/ /* Library-private Variables */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index f32b3e0..aa6cc2a 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -41,12 +41,14 @@ * We're assuming that these constants are used rather early in the hdf5 * session. * + * Note that H5F_ACC_DEBUG is deprecated (nonfuncational) but retained as a + * symbol for backward compatibility. */ #define H5F_ACC_RDONLY (H5CHECK 0x0000u) /*absence of rdwr => rd-only */ #define H5F_ACC_RDWR (H5CHECK 0x0001u) /*open for read and write */ #define H5F_ACC_TRUNC (H5CHECK 0x0002u) /*overwrite existing files */ #define H5F_ACC_EXCL (H5CHECK 0x0004u) /*fail if file already exists*/ -#define H5F_ACC_DEBUG (H5CHECK 0x0008u) /*print debug info */ +/* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */ #define H5F_ACC_CREAT (H5CHECK 0x0010u) /*create non-existing files */ /* Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the @@ -221,7 +223,7 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); #ifndef H5_NO_DEPRECATED_SYMBOLS /* Macros */ - +#define H5F_ACC_DEBUG (H5CHECK 0x0000u) /*print debug info (deprecated)*/ /* Typedefs */ @@ -463,7 +463,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") /* Open the group */ - if((grp = H5G__open_name(&loc, name, gapl_id, H5AC_dxpl_id)) == NULL) + if((grp = H5G__open_name(&loc, name, gapl_id, H5AC_ind_dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an ID for the group */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 17920ab..ca9e7fd 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -261,7 +261,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") /* Set the non-default local heap size hint */ - ginfo.lheap_size_hint = size_hint; + H5_ASSIGN_OVERFLOW(ginfo.lheap_size_hint, size_hint, size_t, uint32_t); if(H5P_set(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info") } /* end if */ @@ -322,7 +322,7 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Open the group */ - if((grp = H5G__open_name(&loc, name, H5P_DEFAULT, H5AC_dxpl_id)) == NULL) + if((grp = H5G__open_name(&loc, name, H5P_DEFAULT, H5AC_ind_dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an atom for the group */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index 2b5d32a..de37655 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -97,6 +97,7 @@ H5G__is_empty_test(hid_t gid) H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = FALSE; /* Indicate that a header message is present */ htri_t linfo_exists = FALSE;/* Indicate that the 'link info' message is present */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -108,11 +109,11 @@ H5G__is_empty_test(hid_t gid) /* "New format" checks */ /* Check if the group has any link messages */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { /* Sanity check that new group format shouldn't have old messages */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") @@ -121,19 +122,19 @@ H5G__is_empty_test(hid_t gid) } /* end if */ /* Check for a link info message */ - if((linfo_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, H5AC_dxpl_id)) < 0) + if((linfo_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(linfo_exists > 0) { H5O_linfo_t linfo; /* Link info message */ /* Sanity check that new group format shouldn't have old messages */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found") /* Get the link info */ - if(H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id) < 0) + if(H5G__obj_get_linfo(&(grp->oloc), &linfo, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") /* Check for 'dense' link storage file addresses being defined */ @@ -152,7 +153,7 @@ H5G__is_empty_test(hid_t gid) /* "Old format" checks */ /* Check if the group has a symbol table message */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { H5O_stab_t stab; /* Info about local heap & B-tree */ @@ -161,17 +162,17 @@ H5G__is_empty_test(hid_t gid) /* Sanity check that old group format shouldn't have new messages */ if(linfo_exists > 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found") - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and group info messages found") /* Get the B-tree & local heap info */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab, H5AC_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol table message") /* Get the count of links in the group */ - if(H5G__stab_count(&(grp->oloc), &nlinks, H5AC_dxpl_id) < 0) + if(H5G__stab_count(&(grp->oloc), &nlinks, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to count links") /* Check for link count */ @@ -208,6 +209,7 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -217,13 +219,13 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Check if the group has any link messages */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists == 0) HGOTO_DONE(FALSE) /* Check if the group has a symbol table message */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") @@ -233,7 +235,7 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) int msg_count; /* Number of messages of a type */ /* Check how many link messages there are */ - if((msg_count = H5O_msg_count(&(grp->oloc), H5O_LINK_ID, H5AC_dxpl_id)) < 0) + if((msg_count = H5O_msg_count(&(grp->oloc), H5O_LINK_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count link messages") *nmsgs = (unsigned)msg_count; } /* end if */ @@ -266,6 +268,7 @@ H5G__has_stab_test(hid_t gid) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -275,13 +278,13 @@ H5G__has_stab_test(hid_t gid) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Check if the group has a symbol table message */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists == 0) HGOTO_DONE(FALSE) /* Check if the group has any link messages */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") @@ -316,6 +319,7 @@ H5G__is_new_dense_test(hid_t gid) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -325,25 +329,25 @@ H5G__is_new_dense_test(hid_t gid) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Check if the group has a symbol table message */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_DONE(FALSE) /* Check if the group has any link messages */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_DONE(FALSE) /* Check if the group has link info message */ - if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, H5AC_dxpl_id)) < 0) + if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { H5O_linfo_t linfo; /* Link info message */ /* Get the link info */ - if(H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id) < 0) + if(H5G__obj_get_linfo(&(grp->oloc), &linfo, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") /* Check for 'dense' link storage file addresses being defined */ @@ -386,6 +390,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ H5O_linfo_t linfo; /* Link info message */ H5G_t *grp = NULL; /* Pointer to group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -395,10 +400,10 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set metadata tag in dxpl_id */ - H5_BEGIN_TAG(H5AC_dxpl_id, grp->oloc.addr, FAIL); + H5_BEGIN_TAG(dxpl_id, grp->oloc.addr, FAIL); /* Get the link info */ - if(H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id) < 0) + if(H5G__obj_get_linfo(&(grp->oloc), &linfo, dxpl_id) < 0) HGOTO_ERROR_TAG(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") /* Check for 'dense' link storage file addresses being defined */ @@ -408,7 +413,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) HGOTO_DONE_TAG(FAIL, FAIL) /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(grp->oloc.file, H5AC_dxpl_id, linfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(grp->oloc.file, dxpl_id, linfo.name_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ @@ -418,7 +423,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) /* Check if there is a creation order index */ if(H5F_addr_defined(linfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(grp->oloc.file, H5AC_dxpl_id, linfo.corder_bt2_addr, NULL))) + if(NULL == (bt2_corder = H5B2_open(grp->oloc.file, dxpl_id, linfo.corder_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Retrieve # of records in creation order index */ @@ -433,9 +438,9 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) done: /* Release resources */ - if(bt2_name && H5B2_close(bt2_name, H5AC_dxpl_id) < 0) + if(bt2_name && H5B2_close(bt2_name, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(bt2_corder && H5B2_close(bt2_corder, H5AC_dxpl_id) < 0) + if(bt2_corder && H5B2_close(bt2_corder, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") FUNC_LEAVE_NOAPI(ret_value) @@ -465,7 +470,8 @@ herr_t H5G__lheap_size_test(hid_t gid, size_t *lheap_size) { H5G_t *grp = NULL; /* Pointer to group */ - H5O_stab_t stab; /* Symbol table message */ + H5O_stab_t stab; /* Symbol table message */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -475,11 +481,11 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Make certain the group has a symbol table message */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab, H5AC_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message") /* Check the size of the local heap for the group */ - if(H5HL_get_size(grp->oloc.file, H5AC_dxpl_id, stab.heap_addr, lheap_size) < 0) + if(H5HL_get_size(grp->oloc.file, dxpl_id, stab.heap_addr, lheap_size) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size") done: @@ -607,16 +613,17 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) { H5O_stab_t stab; /* Symbol table */ H5HL_t *heap = NULL; /* Pointer to local heap */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_TAG(H5AC_ind_dxpl_id, grp_oloc->addr, FAIL) + FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL) /* Verify that stab info is cached in ent */ if(ent->type != H5G_CACHED_STAB) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "symbol table information is not cached") /* Read the symbol table message from the group */ - if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab, H5AC_ind_dxpl_id)) + if(NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "unable to read symbol table message") /* Verify that the cached symbol table info matches the symbol table message @@ -626,11 +633,11 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "cached stab info does not match object header") /* Verify that the btree address is valid */ - if(H5B_valid(grp_oloc->file, H5AC_ind_dxpl_id, H5B_SNODE, stab.btree_addr) < 0) + if(H5B_valid(grp_oloc->file, dxpl_id, H5B_SNODE, stab.btree_addr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "b-tree address is invalid") /* Verify that the heap address is valid */ - if(NULL == (heap = H5HL_protect(grp_oloc->file, H5AC_ind_dxpl_id, stab.heap_addr, H5AC_READ))) + if(NULL == (heap = H5HL_protect(grp_oloc->file, dxpl_id, stab.heap_addr, H5AC_READ))) HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "heap address is invalid") done: @@ -763,6 +770,7 @@ H5G__verify_cached_stabs_test(hid_t gid) H5O_stab_t stab; /* Symbol table message */ H5G_bt_common_t udata = {NULL, NULL}; /* Dummy udata so H5B_iterate doesn't freak out */ haddr_t prev_tag = HADDR_UNDEF; /* Previous metadata tag */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -775,13 +783,13 @@ H5G__verify_cached_stabs_test(hid_t gid) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") /* Set up metadata tagging */ - if(H5AC_tag(H5AC_ind_dxpl_id, grp->oloc.addr, &prev_tag) < 0) + if(H5AC_tag(dxpl_id, grp->oloc.addr, &prev_tag) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "unable to apply metadata tag") /* Check for group having a symbol table message */ /* Check for the group having a group info message */ if((stab_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID, - H5AC_ind_dxpl_id)) < 0) + dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") /* No need to check anything if the symbol table doesn't exist */ @@ -789,16 +797,16 @@ H5G__verify_cached_stabs_test(hid_t gid) HGOTO_DONE(SUCCEED); /* Read the stab */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab, H5AC_ind_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab, dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get symbol table info") /* Iterate over the b-tree, checking validity of cached information */ - if((ret_value = H5B_iterate(grp->oloc.file, H5AC_ind_dxpl_id, H5B_SNODE, + if((ret_value = H5B_iterate(grp->oloc.file, dxpl_id, H5B_SNODE, stab.btree_addr, H5G_verify_cached_stabs_test_cb, &udata)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "iteration operator failed"); /* Reset metadata tagging */ - if(H5AC_tag(H5AC_ind_dxpl_id, prev_tag, NULL) < 0) + if(H5AC_tag(dxpl_id, prev_tag, NULL) < 0) HDONE_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "unable to apply metadata tag") done: diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index 274e0e3..f3546a2 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -77,8 +77,7 @@ H5FL_BLK_EXTERN(gheap_chunk); * largest data type is eight bytes. */ #define H5HG_ALIGNMENT 8 -#define H5HG_ALIGN(X) (size_t)(H5HG_ALIGNMENT*(((X)+H5HG_ALIGNMENT-1)/ \ - H5HG_ALIGNMENT)) +#define H5HG_ALIGN(X) (H5HG_ALIGNMENT*(((X)+H5HG_ALIGNMENT-1)/H5HG_ALIGNMENT)) #define H5HG_ISALIGNED(X) ((X)==H5HG_ALIGN(X)) /* @@ -86,20 +85,20 @@ H5FL_BLK_EXTERN(gheap_chunk); * that the stuff that follows the header is aligned. */ #define H5HG_SIZEOF_HDR(f) \ - H5HG_ALIGN(4 + /*magic number */ \ - 1 + /*version number */ \ - 3 + /*reserved */ \ - H5F_SIZEOF_SIZE(f)) /*collection size */ + (size_t)H5HG_ALIGN(4 + /*magic number */ \ + 1 + /*version number */ \ + 3 + /*reserved */ \ + H5F_SIZEOF_SIZE(f)) /*collection size */ /* * The overhead associated with each object in the heap, always a multiple of * the alignment so that the stuff that follows the header is aligned. */ #define H5HG_SIZEOF_OBJHDR(f) \ - H5HG_ALIGN(2 + /*object id number */ \ - 2 + /*reference count */ \ - 4 + /*reserved */ \ - H5F_SIZEOF_SIZE(f)) /*object data size */ + (size_t)H5HG_ALIGN(2 + /*object id number */ \ + 2 + /*reference count */ \ + 4 + /*reserved */ \ + H5F_SIZEOF_SIZE(f)) /*object data size */ /* * The initial guess for the number of messages in a collection. We assume @@ -593,15 +593,9 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) /* Check if we should delete this node or not */ if(delete_node) { - /* Decrement the number of IDs in the type */ - (type_ptr->id_count)--; - - /* Remove the node from the list */ - if(NULL == H5SL_remove(type_ptr->ids, &cur->id)) - HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, FAIL, "can't remove ID node from skip list") - - /* Free the node */ - cur = H5FL_FREE(H5I_id_info_t, cur); + /* Remove the node from the type */ + if(NULL == H5I__remove_common(type_ptr, cur->id)) + HGOTO_ERROR(H5E_ATOM, H5E_CANTDELETE, FAIL, "can't remove ID node") } /* end if */ } /* end for */ @@ -1208,8 +1202,6 @@ done: int H5I_dec_ref(hid_t id) { - H5I_type_t type; /*type the object is in*/ - H5I_id_type_t *type_ptr; /*ptr to the type */ H5I_id_info_t *id_ptr; /*ptr to the new ID */ int ret_value; /* Return value */ @@ -1218,17 +1210,9 @@ H5I_dec_ref(hid_t id) /* Sanity check */ HDassert(id >= 0); - /* Check arguments */ - type = H5I_TYPE(id); - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - type_ptr = H5I_id_type_list_g[type]; - if(NULL == type_ptr || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - /* General lookup of the ID */ - if(NULL == (id_ptr = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") + if(NULL == (id_ptr = H5I__find_id(id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* * If this is the last reference to the object then invoke the type's @@ -1246,6 +1230,11 @@ H5I_dec_ref(hid_t id) * file. We have to close the dataset anyway. (SLU - 2010/9/7) */ if(1 == id_ptr->count) { + H5I_id_type_t *type_ptr; /*ptr to the type */ + + /* Get the ID's type */ + type_ptr = H5I_id_type_list_g[H5I_TYPE(id)]; + /* (Casting away const OK -QAK) */ if(!type_ptr->cls->free_func || (type_ptr->cls->free_func)((void *)id_ptr->obj_ptr) >= 0) { /* Remove the node from the type */ @@ -1409,8 +1398,6 @@ done: int H5I_inc_ref(hid_t id, hbool_t app_ref) { - H5I_type_t type; /*type the object is in*/ - H5I_id_type_t *type_ptr; /*ptr to the type */ H5I_id_info_t *id_ptr; /*ptr to the ID */ int ret_value; /* Return value */ @@ -1419,16 +1406,8 @@ H5I_inc_ref(hid_t id, hbool_t app_ref) /* Sanity check */ HDassert(id >= 0); - /* Check arguments */ - type = H5I_TYPE(id); - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - type_ptr = H5I_id_type_list_g[type]; - if(!type_ptr || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") - /* General lookup of the ID */ - if(NULL == (id_ptr = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id))) + if(NULL == (id_ptr = H5I__find_id(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* Adjust reference counts */ @@ -1494,8 +1473,6 @@ done: int H5I_get_ref(hid_t id, hbool_t app_ref) { - H5I_type_t type; /*type the object is in*/ - H5I_id_type_t *type_ptr; /*ptr to the type */ H5I_id_info_t *id_ptr; /*ptr to the ID */ int ret_value; /* Return value */ @@ -1504,16 +1481,8 @@ H5I_get_ref(hid_t id, hbool_t app_ref) /* Sanity check */ HDassert(id >= 0); - /* Check arguments */ - type = H5I_TYPE(id); - if(type <= H5I_BADID || type >= H5I_next_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") - type_ptr = H5I_id_type_list_g[type]; - if(!type_ptr || type_ptr->init_count <= 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid type") - /* General lookup of the ID */ - if(NULL == (id_ptr = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id))) + if(NULL == (id_ptr = H5I__find_id(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID") /* Set return value */ @@ -2016,20 +1985,20 @@ done: static H5I_id_info_t * H5I__find_id(hid_t id) { - H5I_id_type_t *type_ptr; /*ptr to the type */ H5I_type_t type; /*ID's type */ + H5I_id_type_t *type_ptr; /*ptr to the type */ H5I_id_info_t *ret_value; /*return value */ FUNC_ENTER_STATIC_NOERR /* Check arguments */ type = H5I_TYPE(id); - if (type <= H5I_BADID || type >= H5I_next_type) - HGOTO_DONE(NULL); + if(type <= H5I_BADID || type >= H5I_next_type) + HGOTO_DONE(NULL) type_ptr = H5I_id_type_list_g[type]; - if (!type_ptr || type_ptr->init_count <= 0) - HGOTO_DONE(NULL); + if(!type_ptr || type_ptr->init_count <= 0) + HGOTO_DONE(NULL) /* Locate the ID node for the ID */ ret_value = (H5I_id_info_t *)H5SL_search(type_ptr->ids, &id); @@ -309,12 +309,12 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, H5AC_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_dxpl_id, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -390,7 +390,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) H5G_name_reset(obj_loc.path); /* objects opened through this routine don't have a path name */ /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_dxpl_id, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -573,7 +573,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Check if the object exists */ - if((ret_value = H5G_loc_exists(&loc, name, lapl_id, H5AC_dxpl_id)) < 0) + if((ret_value = H5G_loc_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -1346,6 +1346,7 @@ H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref) H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ hid_t ret_value = FAIL; FUNC_ENTER_NOAPI(FAIL) @@ -1360,12 +1361,12 @@ H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref) H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(loc, name, &obj_loc/*out*/, lapl_id, H5AC_dxpl_id) < 0) + if(H5G_loc_find(loc, name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, app_ref)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, app_ref)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index fc82407..1471ae5 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -86,7 +86,7 @@ static herr_t H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_ds static herr_t H5O_copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, hid_t dxpl_id, hid_t ocpypl_id); static herr_t H5O_copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, - const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id); + const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id); static herr_t H5O_copy_obj_by_ref(H5O_loc_t *src_oloc, hid_t dxpl_id, H5O_loc_t *dst_oloc, H5G_loc_t *dst_root_loc, H5O_copy_t *cpy_info); static herr_t H5O_copy_free_comm_dt_cb(void *item, void *key, void *op_data); @@ -243,7 +243,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5G_loc_reset(&tmp_loc); /* Check if object already exists in destination */ - if(H5G_loc_find(&dst_loc, dst_name, &tmp_loc, H5P_DEFAULT, H5AC_dxpl_id) >= 0) { + if(H5G_loc_find(&dst_loc, dst_name, &tmp_loc, H5P_DEFAULT, H5AC_ind_dxpl_id) >= 0) { H5G_name_free(&tmp_path); HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "destination object already exists") } /* end if */ @@ -255,7 +255,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5G_loc_reset(&src_loc); /* Find the source object to copy */ - if(H5G_loc_find(&loc, src_name, &src_loc/*out*/, H5P_DEFAULT, H5AC_dxpl_id) < 0) + if(H5G_loc_find(&loc, src_name, &src_loc/*out*/, H5P_DEFAULT, H5AC_ind_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "source object not found") loc_found = TRUE; @@ -281,7 +281,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list") /* Do the actual copying of the object */ - if(H5O_copy_obj(&src_loc, &dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) + if(H5O_copy_obj(&src_loc, &dst_loc, dst_name, ocpypl_id, lcpl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: @@ -1151,14 +1151,13 @@ done: */ static herr_t H5O_copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id) + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id) { H5G_name_t new_path; /* Copied object group hier. path */ H5O_loc_t new_oloc; /* Copied object object location */ H5G_loc_t new_loc; /* Group location of object copied */ H5F_t *cached_dst_file; /* Cached destination file */ hbool_t entry_inserted = FALSE; /* Flag to indicate that the new entry was inserted into a group */ - hid_t dxpl_id = H5AC_dxpl_id; /* DXPL for operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1656,7 +1655,8 @@ H5O_copy_search_comm_dt_check(H5O_loc_t *obj_oloc, attr_op.u.lib_op = H5O_copy_search_comm_dt_attr_cb; udata->obj_oloc.file = obj_oloc->file; udata->obj_oloc.addr = obj_oloc->addr; - if(H5O_attr_iterate_real((hid_t)-1, obj_oloc, udata->dxpl_id, H5_INDEX_NAME, H5_ITER_NATIVE, 0, NULL, &attr_op, udata) < 0) + if(H5O_attr_iterate_real((hid_t)-1, obj_oloc, udata->dxpl_id, H5_INDEX_NAME, + H5_ITER_NATIVE, (hsize_t)0, NULL, &attr_op, udata) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "error iterating over attributes"); done: diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 816242f..d58ad61 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -722,6 +722,7 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, "B-tree address:", mesg->storage.u.chunk.idx_addr); break; + case H5D_CHUNK_IDX_NTYPES: default: HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Index Type:", "Unknown", (unsigned)mesg->storage.u.chunk.idx_type); diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index e3a2d33..3707367 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -424,8 +424,8 @@ typedef struct H5O_layout_chunk_t { uint32_t dim[H5O_LAYOUT_NDIMS]; /* Size of chunk in elements */ uint32_t size; /* Size of chunk in bytes */ hsize_t nchunks; /* Number of chunks in dataset */ - hsize_t chunks[H5O_LAYOUT_NDIMS]; /* # of chunks in dataset dimensions */ - hsize_t down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each dimension */ + hsize_t chunks[H5O_LAYOUT_NDIMS]; /* # of chunks in each dataset dimension */ + hsize_t down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each dimension */ } H5O_layout_chunk_t; typedef struct H5O_layout_t { diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index aca589c..5fc93fd 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -517,6 +517,9 @@ H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk) /* Set values */ if (ik > 0) { + if((ik * 2) >= HDF5_BTREE_IK_MAX_ENTRIES) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value exceeds maximum B-tree entries"); + if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes"); btree_k[H5B_SNODE_ID] = ik; @@ -614,6 +617,9 @@ H5Pset_istore_k(hid_t plist_id, unsigned ik) if (ik == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value must be positive"); + if((ik * 2) >= HDF5_BTREE_IK_MAX_ENTRIES) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value exceeds maximum B-tree entries"); + /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); @@ -603,7 +603,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r file = loc.oloc->file; /* Create reference */ - if((ret_value = H5R_dereference(file, oapl_id, H5AC_dxpl_id, ref_type, _ref, TRUE)) < 0) + if((ret_value = H5R_dereference(file, oapl_id, H5AC_ind_dxpl_id, ref_type, _ref, TRUE)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to dereference object") done: @@ -1026,7 +1026,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, file = loc.oloc->file; /* Get name */ - if((ret_value = H5R_get_name(file, H5P_DEFAULT, H5AC_dxpl_id, id, ref_type, _ref, name, size)) < 0) + if((ret_value = H5R_get_name(file, H5P_DEFAULT, H5AC_ind_dxpl_id, id, ref_type, _ref, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object path") done: @@ -139,7 +139,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5RS_str_t * -H5RS_wrap(const char *s) +H5RS_wrap(char *s) { H5RS_str_t *ret_value; /* Return value */ @@ -150,7 +150,7 @@ H5RS_wrap(const char *s) HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed") /* Set the internal fields */ - ret_value->s = (char *)s; /* (Cast away const OK - QAK) */ + ret_value->s = s; ret_value->wrapped = 1; ret_value->n = 1; diff --git a/src/H5RSprivate.h b/src/H5RSprivate.h index c46f53c..757e0e4 100644 --- a/src/H5RSprivate.h +++ b/src/H5RSprivate.h @@ -46,7 +46,7 @@ typedef struct H5RS_str_t H5RS_str_t; /* Private routines */ /********************/ H5_DLL H5RS_str_t *H5RS_create(const char *s); -H5_DLL H5RS_str_t *H5RS_wrap(const char *s); +H5_DLL H5RS_str_t *H5RS_wrap(char *s); H5_DLL H5RS_str_t *H5RS_own(char *s); H5_DLL herr_t H5RS_decr(H5RS_str_t *rs); H5_DLL herr_t H5RS_incr(H5RS_str_t *rs); diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index ea30913..9877f42 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -228,7 +228,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) file = loc.oloc->file; /* Create reference */ - if((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id, ref_type, _ref, TRUE)) < 0) + if((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_ind_dxpl_id, ref_type, _ref, TRUE)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object") done: diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h index 997309f..e990661 100644 --- a/src/H5Rpublic.h +++ b/src/H5Rpublic.h @@ -14,7 +14,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * This file contains public declarations for the H5S module. + * This file contains public declarations for the H5R module. */ #ifndef _H5Rpublic_H #define _H5Rpublic_H @@ -482,6 +482,12 @@ H5Sextent_copy(hid_t dst_id,hid_t src_id) if(H5S_extent_copy(&(dst->extent), &(src->extent), TRUE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent") + /* If the selection is 'all', update the number of elements selected in the + * destination space */ + if(H5S_SEL_ALL == H5S_GET_SELECT_TYPE(dst)) + if(H5S_select_all(dst, FALSE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + done: FUNC_LEAVE_API(ret_value) } /* end H5Sextent_copy() */ @@ -2138,14 +2144,13 @@ H5S_extend(H5S_t *space, const hsize_t *size) HDassert(size); /* Check through all the dimensions to see if modifying the dataspace is allowed */ - for(u = 0; u < space->extent.rank; u++) { - if(space->extent.size[u]<size[u]) { - if(space->extent.max && H5S_UNLIMITED!=space->extent.max[u] && - space->extent.max[u]<size[u]) + for(u = 0; u < space->extent.rank; u++) + if(space->extent.size[u] < size[u]) { + if(space->extent.max && H5S_UNLIMITED != space->extent.max[u] && + space->extent.max[u] < size[u]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimension cannot be increased") ret_value++; } /* end if */ - } /* end for */ /* Update */ if(ret_value) { diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c index df033da..0cbe4f2 100644 --- a/src/H5Sdbg.c +++ b/src/H5Sdbg.c @@ -113,6 +113,7 @@ H5S_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, indent + 3, MAX(0, fwidth - 3)); break; + case H5S_NO_CLASS: default: fprintf(stream, "%*s%-*s **UNKNOWN-%ld**\n", indent, "", fwidth, "Space class:", (long)(H5S_GET_EXTENT_TYPE(mesg))); @@ -1,3 +1,4 @@ + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * @@ -67,10 +68,6 @@ * */ -/* Define the code template for types which need no extra initialization for the "GUTS" in the H5T_INIT_TYPE macro */ -#define H5T_INIT_TYPE_NONE_CORE { \ -} - /* Define the code template for bitfields for the "GUTS" in the H5T_INIT_TYPE macro */ #define H5T_INIT_TYPE_BITFIELD_CORE { \ dt->shared->type = H5T_BITFIELD; \ @@ -1045,24 +1042,24 @@ H5T_init_interface(void) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") status = 0; - status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "i_f", fixedpt, floatpt, H5T__conv_i_f, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "f_i", floatpt, fixedpt, H5T__conv_f_i, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T__conv_s_s, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T__conv_b_b, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T__conv_order, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T__conv_order, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "enum_i", enum_type, fixedpt, H5T__conv_enum_numeric, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T__conv_array, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "i_f", fixedpt, floatpt, H5T__conv_i_f, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "f_i", floatpt, fixedpt, H5T__conv_f_i, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T__conv_s_s, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T__conv_b_b, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T__conv_order, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T__conv_order_opt, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T__conv_order, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T__conv_order_opt, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum_i", enum_type, fixedpt, H5T__conv_enum_numeric, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T__conv_array, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt, H5AC_ind_dxpl_id, FALSE); /* * Native conversions should be listed last since we can use hardware to @@ -1073,220 +1070,221 @@ H5T_init_interface(void) */ /* floating point */ - status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T__conv_float_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T__conv_double_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T__conv_float_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T__conv_double_float, H5AC_ind_dxpl_id, FALSE); #if H5_SIZEOF_LONG_DOUBLE != 0 - status |= H5T_register(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T__conv_float_ldouble, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ldbl", native_double, native_ldouble, H5T__conv_double_ldouble, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T__conv_float_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ldbl", native_double, native_ldouble, H5T__conv_double_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double, H5AC_ind_dxpl_id, FALSE); #endif /* H5_SIZEOF_LONG_DOUBLE != 0 */ /* from long long */ - status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T__conv_llong_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T__conv_ullong_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T__conv_llong_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_ulong", native_llong, native_ulong, H5T__conv_llong_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_long", native_ullong, native_long, H5T__conv_ullong_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_ulong", native_ullong, native_ulong, H5T__conv_ullong_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_short", native_llong, native_short, H5T__conv_llong_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_ushort", native_llong, native_ushort, H5T__conv_llong_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_short", native_ullong, native_short, H5T__conv_ullong_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_ushort", native_ullong, native_ushort, H5T__conv_ullong_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_int", native_llong, native_int, H5T__conv_llong_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_uint", native_llong, native_uint, H5T__conv_llong_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_int", native_ullong, native_int, H5T__conv_ullong_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_uint", native_ullong, native_uint, H5T__conv_ullong_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_schar", native_llong, native_schar, H5T__conv_llong_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_uchar", native_llong, native_uchar, H5T__conv_llong_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_schar", native_ullong, native_schar, H5T__conv_ullong_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_uchar", native_ullong, native_uchar, H5T__conv_ullong_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T__conv_llong_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T__conv_ullong_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T__conv_llong_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ulong", native_llong, native_ulong, H5T__conv_llong_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_long", native_ullong, native_long, H5T__conv_ullong_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_ulong", native_ullong, native_ulong, H5T__conv_ullong_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_short", native_llong, native_short, H5T__conv_llong_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ushort", native_llong, native_ushort, H5T__conv_llong_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_short", native_ullong, native_short, H5T__conv_ullong_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_ushort", native_ullong, native_ushort, H5T__conv_ullong_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_int", native_llong, native_int, H5T__conv_llong_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_uint", native_llong, native_uint, H5T__conv_llong_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_int", native_ullong, native_int, H5T__conv_ullong_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_uint", native_ullong, native_uint, H5T__conv_ullong_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_schar", native_llong, native_schar, H5T__conv_llong_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_uchar", native_llong, native_uchar, H5T__conv_llong_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_schar", native_ullong, native_schar, H5T__conv_ullong_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_uchar", native_ullong, native_uchar, H5T__conv_ullong_uchar, H5AC_ind_dxpl_id, FALSE); /* From long */ - status |= H5T_register(H5T_PERS_HARD, "long_llong", native_long, native_llong, H5T__conv_long_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ullong", native_long, native_ullong, H5T__conv_long_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_llong", native_ulong, native_llong, H5T__conv_ulong_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_ullong", native_ulong, native_ullong, H5T__conv_ulong_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ulong", native_long, native_ulong, H5T__conv_long_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_long", native_ulong, native_long, H5T__conv_ulong_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_short", native_long, native_short, H5T__conv_long_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ushort", native_long, native_ushort, H5T__conv_long_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_short", native_ulong, native_short, H5T__conv_ulong_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_ushort", native_ulong, native_ushort, H5T__conv_ulong_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_int", native_long, native_int, H5T__conv_long_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_uint", native_long, native_uint, H5T__conv_long_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_int", native_ulong, native_int, H5T__conv_ulong_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_uint", native_ulong, native_uint, H5T__conv_ulong_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_schar", native_long, native_schar, H5T__conv_long_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_uchar", native_long, native_uchar, H5T__conv_long_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_schar", native_ulong, native_schar, H5T__conv_ulong_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_uchar", native_ulong, native_uchar, H5T__conv_ulong_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_llong", native_long, native_llong, H5T__conv_long_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ullong", native_long, native_ullong, H5T__conv_long_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_llong", native_ulong, native_llong, H5T__conv_ulong_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_ullong", native_ulong, native_ullong, H5T__conv_ulong_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ulong", native_long, native_ulong, H5T__conv_long_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_long", native_ulong, native_long, H5T__conv_ulong_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_short", native_long, native_short, H5T__conv_long_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ushort", native_long, native_ushort, H5T__conv_long_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_short", native_ulong, native_short, H5T__conv_ulong_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_ushort", native_ulong, native_ushort, H5T__conv_ulong_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_int", native_long, native_int, H5T__conv_long_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_uint", native_long, native_uint, H5T__conv_long_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_int", native_ulong, native_int, H5T__conv_ulong_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_uint", native_ulong, native_uint, H5T__conv_ulong_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_schar", native_long, native_schar, H5T__conv_long_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_uchar", native_long, native_uchar, H5T__conv_long_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_schar", native_ulong, native_schar, H5T__conv_ulong_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_uchar", native_ulong, native_uchar, H5T__conv_ulong_uchar, H5AC_ind_dxpl_id, FALSE); /* From short */ - status |= H5T_register(H5T_PERS_HARD, "short_llong", native_short, native_llong, H5T__conv_short_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ullong", native_short, native_ullong, H5T__conv_short_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_llong", native_ushort, native_llong, H5T__conv_ushort_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_ullong", native_ushort, native_ullong, H5T__conv_ushort_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_long", native_short, native_long, H5T__conv_short_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ulong", native_short, native_ulong, H5T__conv_short_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_long", native_ushort, native_long, H5T__conv_ushort_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_ulong", native_ushort, native_ulong, H5T__conv_ushort_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ushort", native_short, native_ushort, H5T__conv_short_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_short", native_ushort, native_short, H5T__conv_ushort_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_int", native_short, native_int, H5T__conv_short_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_uint", native_short, native_uint, H5T__conv_short_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_int", native_ushort, native_int, H5T__conv_ushort_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_uint", native_ushort, native_uint, H5T__conv_ushort_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_schar", native_short, native_schar, H5T__conv_short_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_uchar", native_short, native_uchar, H5T__conv_short_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_schar", native_ushort, native_schar, H5T__conv_ushort_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_uchar", native_ushort, native_uchar, H5T__conv_ushort_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_llong", native_short, native_llong, H5T__conv_short_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ullong", native_short, native_ullong, H5T__conv_short_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_llong", native_ushort, native_llong, H5T__conv_ushort_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_ullong", native_ushort, native_ullong, H5T__conv_ushort_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_long", native_short, native_long, H5T__conv_short_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ulong", native_short, native_ulong, H5T__conv_short_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_long", native_ushort, native_long, H5T__conv_ushort_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_ulong", native_ushort, native_ulong, H5T__conv_ushort_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ushort", native_short, native_ushort, H5T__conv_short_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_short", native_ushort, native_short, H5T__conv_ushort_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_int", native_short, native_int, H5T__conv_short_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_uint", native_short, native_uint, H5T__conv_short_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_int", native_ushort, native_int, H5T__conv_ushort_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_uint", native_ushort, native_uint, H5T__conv_ushort_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_schar", native_short, native_schar, H5T__conv_short_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_uchar", native_short, native_uchar, H5T__conv_short_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_schar", native_ushort, native_schar, H5T__conv_ushort_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_uchar", native_ushort, native_uchar, H5T__conv_ushort_uchar, H5AC_ind_dxpl_id, FALSE); /* From int */ - status |= H5T_register(H5T_PERS_HARD, "int_llong", native_int, native_llong, H5T__conv_int_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ullong", native_int, native_ullong, H5T__conv_int_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_llong", native_uint, native_llong, H5T__conv_uint_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ullong", native_uint, native_ullong, H5T__conv_uint_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_long", native_int, native_long, H5T__conv_int_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ulong", native_int, native_ulong, H5T__conv_int_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_long", native_uint, native_long, H5T__conv_uint_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ulong", native_uint, native_ulong, H5T__conv_uint_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_short", native_int, native_short, H5T__conv_int_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ushort", native_int, native_ushort, H5T__conv_int_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_short", native_uint, native_short, H5T__conv_uint_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ushort", native_uint, native_ushort, H5T__conv_uint_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_uint", native_int, native_uint, H5T__conv_int_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_int", native_uint, native_int, H5T__conv_uint_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_schar", native_int, native_schar, H5T__conv_int_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_uchar", native_int, native_uchar, H5T__conv_int_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_schar", native_uint, native_schar, H5T__conv_uint_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_uchar", native_uint, native_uchar, H5T__conv_uint_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_llong", native_int, native_llong, H5T__conv_int_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ullong", native_int, native_ullong, H5T__conv_int_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_llong", native_uint, native_llong, H5T__conv_uint_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ullong", native_uint, native_ullong, H5T__conv_uint_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_long", native_int, native_long, H5T__conv_int_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ulong", native_int, native_ulong, H5T__conv_int_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_long", native_uint, native_long, H5T__conv_uint_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ulong", native_uint, native_ulong, H5T__conv_uint_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_short", native_int, native_short, H5T__conv_int_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ushort", native_int, native_ushort, H5T__conv_int_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_short", native_uint, native_short, H5T__conv_uint_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ushort", native_uint, native_ushort, H5T__conv_uint_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_uint", native_int, native_uint, H5T__conv_int_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_int", native_uint, native_int, H5T__conv_uint_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_schar", native_int, native_schar, H5T__conv_int_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_uchar", native_int, native_uchar, H5T__conv_int_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_schar", native_uint, native_schar, H5T__conv_uint_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_uchar", native_uint, native_uchar, H5T__conv_uint_uchar, H5AC_ind_dxpl_id, FALSE); /* From char */ - status |= H5T_register(H5T_PERS_HARD, "schar_llong", native_schar, native_llong, H5T__conv_schar_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ullong", native_schar, native_ullong, H5T__conv_schar_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_llong", native_uchar, native_llong, H5T__conv_uchar_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ullong", native_uchar, native_ullong, H5T__conv_uchar_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_long", native_schar, native_long, H5T__conv_schar_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ulong", native_schar, native_ulong, H5T__conv_schar_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_long", native_uchar, native_long, H5T__conv_uchar_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ulong", native_uchar, native_ulong, H5T__conv_uchar_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_short", native_schar, native_short, H5T__conv_schar_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ushort", native_schar, native_ushort, H5T__conv_schar_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_short", native_uchar, native_short, H5T__conv_uchar_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ushort", native_uchar, native_ushort, H5T__conv_uchar_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_int", native_schar, native_int, H5T__conv_schar_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_uint", native_schar, native_uint, H5T__conv_schar_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_int", native_uchar, native_int, H5T__conv_uchar_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_uint", native_uchar, native_uint, H5T__conv_uchar_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_uchar", native_schar, native_uchar, H5T__conv_schar_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_schar", native_uchar, native_schar, H5T__conv_uchar_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_llong", native_schar, native_llong, H5T__conv_schar_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ullong", native_schar, native_ullong, H5T__conv_schar_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_llong", native_uchar, native_llong, H5T__conv_uchar_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ullong", native_uchar, native_ullong, H5T__conv_uchar_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_long", native_schar, native_long, H5T__conv_schar_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ulong", native_schar, native_ulong, H5T__conv_schar_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_long", native_uchar, native_long, H5T__conv_uchar_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ulong", native_uchar, native_ulong, H5T__conv_uchar_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_short", native_schar, native_short, H5T__conv_schar_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ushort", native_schar, native_ushort, H5T__conv_schar_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_short", native_uchar, native_short, H5T__conv_uchar_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ushort", native_uchar, native_ushort, H5T__conv_uchar_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_int", native_schar, native_int, H5T__conv_schar_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_uint", native_schar, native_uint, H5T__conv_schar_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_int", native_uchar, native_int, H5T__conv_uchar_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_uint", native_uchar, native_uint, H5T__conv_uchar_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_uchar", native_schar, native_uchar, H5T__conv_schar_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_schar", native_uchar, native_schar, H5T__conv_uchar_schar, H5AC_ind_dxpl_id, FALSE); /* From char to floats */ - status |= H5T_register(H5T_PERS_HARD, "schar_flt", native_schar, native_float, H5T__conv_schar_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T__conv_schar_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T__conv_schar_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_flt", native_schar, native_float, H5T__conv_schar_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T__conv_schar_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T__conv_schar_ldouble, H5AC_ind_dxpl_id, FALSE); /* From unsigned char to floats */ - status |= H5T_register(H5T_PERS_HARD, "uchar_flt", native_uchar, native_float, H5T__conv_uchar_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T__conv_uchar_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T__conv_uchar_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_flt", native_uchar, native_float, H5T__conv_uchar_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T__conv_uchar_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T__conv_uchar_ldouble, H5AC_ind_dxpl_id, FALSE); /* From short to floats */ - status |= H5T_register(H5T_PERS_HARD, "short_flt", native_short, native_float, H5T__conv_short_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T__conv_short_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T__conv_short_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_flt", native_short, native_float, H5T__conv_short_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T__conv_short_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T__conv_short_ldouble, H5AC_ind_dxpl_id, FALSE); /* From unsigned short to floats */ - status |= H5T_register(H5T_PERS_HARD, "ushort_flt", native_ushort, native_float, H5T__conv_ushort_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T__conv_ushort_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T__conv_ushort_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_flt", native_ushort, native_float, H5T__conv_ushort_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T__conv_ushort_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T__conv_ushort_ldouble, H5AC_ind_dxpl_id, FALSE); /* From int to floats */ - status |= H5T_register(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T__conv_int_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T__conv_int_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T__conv_int_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T__conv_int_ldouble, H5AC_ind_dxpl_id, FALSE); /* From unsigned int to floats */ - status |= H5T_register(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T__conv_uint_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T__conv_uint_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T__conv_uint_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T__conv_uint_ldouble, H5AC_ind_dxpl_id, FALSE); /* From long to floats */ - status |= H5T_register(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T__conv_long_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T__conv_long_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T__conv_long_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T__conv_long_ldouble, H5AC_ind_dxpl_id, FALSE); /* From unsigned long to floats */ - status |= H5T_register(H5T_PERS_HARD, "ulong_flt", native_ulong, native_float, H5T__conv_ulong_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T__conv_ulong_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T__conv_ulong_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_flt", native_ulong, native_float, H5T__conv_ulong_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T__conv_ulong_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T__conv_ulong_ldouble, H5AC_ind_dxpl_id, FALSE); /* From long long to floats */ - status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble, H5AC_ind_dxpl_id, FALSE); /* From unsigned long long to floats */ - status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble, H5AC_ind_dxpl_id, FALSE); /* From floats to char */ - status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar, H5AC_ind_dxpl_id, FALSE); /* From floats to unsigned char */ - status |= H5T_register(H5T_PERS_HARD, "flt_uchar", native_float, native_uchar, H5T__conv_float_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_uchar", native_float, native_uchar, H5T__conv_float_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar, H5AC_ind_dxpl_id, FALSE); /* From floats to short */ - status |= H5T_register(H5T_PERS_HARD, "flt_short", native_float, native_short, H5T__conv_float_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_short", native_float, native_short, H5T__conv_float_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short, H5AC_ind_dxpl_id, FALSE); /* From floats to unsigned short */ - status |= H5T_register(H5T_PERS_HARD, "flt_ushort", native_float, native_ushort, H5T__conv_float_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T__conv_ldouble_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ushort", native_float, native_ushort, H5T__conv_float_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T__conv_ldouble_ushort, H5AC_ind_dxpl_id, FALSE); /* From floats to int */ - status |= H5T_register(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int, H5AC_ind_dxpl_id, FALSE); /* From floats to unsigned int */ - status |= H5T_register(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_dxpl_id, FALSE); + /* From floats to long */ + status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_ind_dxpl_id, FALSE); /* From floats to unsigned long */ - status |= H5T_register(H5T_PERS_HARD, "flt_ulong", native_float, native_ulong, H5T__conv_float_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ulong", native_float, native_ulong, H5T__conv_float_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong, H5AC_ind_dxpl_id, FALSE); /* From floats to long long */ - status |= H5T_register(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T__conv_float_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T__conv_double_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T__conv_float_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T__conv_double_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong, H5AC_ind_dxpl_id, FALSE); /* From floats to unsigned long long */ - status |= H5T_register(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong, H5AC_ind_dxpl_id, FALSE); /* * The special no-op conversion is the fastest, so we list it last. The * data types we use are not important as long as the source and * destination are equal. */ - status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T__conv_noop, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T__conv_noop, H5AC_ind_dxpl_id, FALSE); /* Initialize the +/- Infinity values for floating-point types */ status |= H5T_init_inf(); @@ -1401,7 +1399,7 @@ H5T_term_interface(void) H5T__print_stats(path, &nprint/*in,out*/); path->cdata.command = H5T_CONV_FREE; if((path->func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, - (size_t)0, (size_t)0, NULL, NULL,H5AC_dxpl_id) < 0) { + (size_t)0, (size_t)0, NULL, NULL,H5AC_ind_dxpl_id) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function " @@ -1986,7 +1984,7 @@ H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api) case H5T_VLEN: case H5T_ENUM: HGOTO_DONE(H5T_detect_class(dt->shared->parent, cls, from_api)); - + break; case H5T_NO_CLASS: case H5T_INTEGER: case H5T_FLOAT: @@ -2925,7 +2923,7 @@ H5T_decode(const unsigned char *buf) HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype") /* Decode the serialized datatype message */ - if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_dxpl_id, NULL, H5O_DTYPE_ID, buf))) + if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_ind_dxpl_id, NULL, H5O_DTYPE_ID, buf))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object") /* Mark datatype as being in memory now */ @@ -3211,7 +3209,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) switch(new_dt->shared->type) { case H5T_COMPOUND: { - int accum_change = 0; /* Amount of change in the offset of the fields */ + ssize_t accum_change = 0; /* Amount of change in the offset of the fields */ /* * Copy all member fields to new type, then overwrite the @@ -3239,13 +3237,17 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) new_dt->shared->u.compnd.memb[i].type = tmp; HDassert(tmp != NULL); + /* Range check against compound member's offset */ + if ((accum_change < 0) && ((ssize_t) new_dt->shared->u.compnd.memb[i].offset < accum_change)) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype"); + /* Apply the accumulated size change to the offset of the field */ - new_dt->shared->u.compnd.memb[i].offset += accum_change; + new_dt->shared->u.compnd.memb[i].offset += (size_t) accum_change; if(old_dt->shared->u.compnd.sorted != H5T_SORT_VALUE) { for(old_match = -1, j = 0; j < old_dt->shared->u.compnd.nmembs; j++) { if(!HDstrcmp(new_dt->shared->u.compnd.memb[i].name, old_dt->shared->u.compnd.memb[j].name)) { - old_match = j; + old_match = (int) j; break; } /* end if */ } /* end for */ @@ -3255,20 +3257,23 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "fields in datatype corrupted"); } /* end if */ else - old_match = i; + old_match = (int) i; /* If the field changed size, add that change to the accumulated size change */ if(new_dt->shared->u.compnd.memb[i].type->shared->size != old_dt->shared->u.compnd.memb[old_match].type->shared->size) { /* Adjust the size of the member */ new_dt->shared->u.compnd.memb[i].size = (old_dt->shared->u.compnd.memb[old_match].size*tmp->shared->size)/old_dt->shared->u.compnd.memb[old_match].type->shared->size; - accum_change += (new_dt->shared->u.compnd.memb[i].type->shared->size - old_dt->shared->u.compnd.memb[old_match].type->shared->size); + accum_change += (ssize_t) (new_dt->shared->u.compnd.memb[i].type->shared->size - old_dt->shared->u.compnd.memb[old_match].type->shared->size); } /* end if */ } /* end for */ - /* Apply the accumulated size change to the size of the compound struct */ - new_dt->shared->size += accum_change; + /* Range check against datatype size */ + if ((accum_change < 0) && ((ssize_t) new_dt->shared->size < accum_change)) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, NULL, "invalid field size in datatype"); + /* Apply the accumulated size change to the size of the compound struct */ + new_dt->shared->size += (size_t) accum_change; } break; @@ -3313,6 +3318,13 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) new_dt->shared->size=new_dt->shared->u.array.nelem*new_dt->shared->parent->shared->size; break; + case H5T_NO_CLASS: + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_NCLASSES: default: break; } /* end switch */ @@ -3530,6 +3542,16 @@ H5T__free(H5T_t *dt) H5MM_xfree(dt->shared->u.opaque.tag); break; + case H5T_NO_CLASS: + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_REFERENCE: + case H5T_VLEN: + case H5T_ARRAY: + case H5T_NCLASSES: default: break; } /* end switch */ @@ -3796,11 +3818,14 @@ H5T_set_size(H5T_t *dt, size_t size) case H5T_ARRAY: case H5T_REFERENCE: HDassert("can't happen" && 0); + break; case H5T_NO_CLASS: case H5T_NCLASSES: HDassert("invalid type" && 0); + break; default: HDassert("not implemented yet" && 0); + break; } /* Commit (if we didn't convert this type to a VL string) */ @@ -3875,7 +3900,6 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) unsigned *idx1 = NULL, *idx2 = NULL; size_t base_size; hbool_t swapped; - int i, j; unsigned u; int tmp; int ret_value = 0; @@ -3930,24 +3954,32 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) for(u = 0; u < dt1->shared->u.compnd.nmembs; u++) idx1[u] = idx2[u] = u; if(dt1->shared->u.enumer.nmembs > 1) { - for(i = dt1->shared->u.compnd.nmembs - 1, swapped = TRUE; swapped && i >= 0; --i) + int i; + + for(i = (int) dt1->shared->u.compnd.nmembs - 1, swapped = TRUE; swapped && i >= 0; --i) { + int j; + for(j = 0, swapped=FALSE; j < i; j++) if(HDstrcmp(dt1->shared->u.compnd.memb[idx1[j]].name, dt1->shared->u.compnd.memb[idx1[j + 1]].name) > 0) { - tmp = idx1[j]; + unsigned tmp_idx = idx1[j]; idx1[j] = idx1[j + 1]; - idx1[j + 1] = tmp; + idx1[j + 1] = tmp_idx; swapped = TRUE; } - for(i = dt2->shared->u.compnd.nmembs - 1, swapped = TRUE; swapped && i >= 0; --i) + } + for(i = (int) dt2->shared->u.compnd.nmembs - 1, swapped = TRUE; swapped && i >= 0; --i) { + int j; + for(j = 0, swapped = FALSE; j<i; j++) if(HDstrcmp(dt2->shared->u.compnd.memb[idx2[j]].name, dt2->shared->u.compnd.memb[idx2[j + 1]].name) > 0) { - tmp = idx2[j]; + unsigned tmp_idx = idx2[j]; idx2[j] = idx2[j + 1]; - idx2[j + 1] = tmp; + idx2[j + 1] = tmp_idx; swapped = TRUE; } + } } /* end if */ #ifdef H5T_DEBUG @@ -4007,28 +4039,39 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed"); for (u=0; u<dt1->shared->u.enumer.nmembs; u++) idx1[u] = u; - if(dt1->shared->u.enumer.nmembs > 1) - for (i=dt1->shared->u.enumer.nmembs-1, swapped=TRUE; swapped && i>=0; --i) - for (j=0, swapped=FALSE; j<i; j++) + if(dt1->shared->u.enumer.nmembs > 1) { + int i; + for (i = (int) dt1->shared->u.enumer.nmembs - 1, swapped = TRUE; swapped && i >= 0; --i) { + int j; + + for (j = 0, swapped = FALSE; j < i; j++) if (HDstrcmp(dt1->shared->u.enumer.name[idx1[j]], dt1->shared->u.enumer.name[idx1[j+1]]) > 0) { - tmp = idx1[j]; + unsigned tmp_idx = idx1[j]; idx1[j] = idx1[j+1]; - idx1[j+1] = tmp; + idx1[j+1] = tmp_idx; swapped = TRUE; } + } + } for (u=0; u<dt2->shared->u.enumer.nmembs; u++) idx2[u] = u; - if(dt2->shared->u.enumer.nmembs > 1) - for (i=dt2->shared->u.enumer.nmembs-1, swapped=TRUE; swapped && i>=0; --i) - for (j=0, swapped=FALSE; j<i; j++) + if(dt2->shared->u.enumer.nmembs > 1) { + int i; + + for (i = (int) dt2->shared->u.enumer.nmembs - 1, swapped = TRUE; swapped && i >= 0; --i) { + int j; + + for (j = 0, swapped = FALSE; j < i; j++) if (HDstrcmp(dt2->shared->u.enumer.name[idx2[j]], dt2->shared->u.enumer.name[idx2[j+1]]) > 0) { - tmp = idx2[j]; + unsigned tmp_idx = idx2[j]; idx2[j] = idx2[j+1]; - idx2[j+1] = tmp; + idx2[j+1] = tmp_idx; swapped = TRUE; } + } + } #ifdef H5T_DEBUG /* I don't quite trust the code above yet :-) --RPM */ @@ -4148,6 +4191,14 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) HGOTO_DONE(1); break; + case H5T_NO_CLASS: + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_REFERENCE: + case H5T_NCLASSES: default: /* * Atomic datatypes... @@ -4255,13 +4306,23 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) case H5R_BADTYPE: case H5R_MAXTYPE: HDassert("invalid type" && 0); + break; default: HDassert("not implemented yet" && 0); + break; } break; + case H5T_NO_CLASS: + case H5T_OPAQUE: + case H5T_COMPOUND: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + case H5T_NCLASSES: default: HDassert("not implemented yet" && 0); + break; } break; } /* end switch */ @@ -4535,7 +4596,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, } /* end if */ if(cmp > 0) md++; - HDmemmove(H5T_g.path + md + 1, H5T_g.path + md, (H5T_g.npaths - md) * sizeof(H5T_path_t*)); + HDmemmove(H5T_g.path + md + 1, H5T_g.path + md, (size_t) (H5T_g.npaths - md) * sizeof(H5T_path_t*)); H5T_g.npaths++; H5T_g.path[md] = path; table = path; @@ -5000,6 +5061,17 @@ H5T_is_sensible(const H5T_t *dt) ret_value=FALSE; break; + case H5T_NO_CLASS: + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_VLEN: + case H5T_ARRAY: + case H5T_NCLASSES: default: /* Assume all other datatype are sensible to store on disk */ ret_value=TRUE; @@ -5041,7 +5113,6 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) htri_t changed; /* Whether H5T_set_loc changed the type (even if the size didn't change) */ htri_t ret_value = 0; /* Indicate that success, but no location change */ unsigned i; /* Local index variable */ - int accum_change; /* Amount of change in the offset of the fields */ size_t old_size; /* Previous size of a field */ FUNC_ENTER_NOAPI(FAIL) @@ -5075,14 +5146,21 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) break; case H5T_COMPOUND: /* Check each field and recurse on VL, compound and array type */ + { + ssize_t accum_change = 0; /* Amount of change in the offset of the fields */ + /* Sort the fields based on offsets */ H5T__sort_value(dt, NULL); - for (i=0,accum_change=0; i<dt->shared->u.compnd.nmembs; i++) { + for (i=0; i<dt->shared->u.compnd.nmembs; i++) { H5T_t *memb_type; /* Member's datatype pointer */ + /* Range check against compound member's offset */ + if ((accum_change < 0) && ((ssize_t) dt->shared->u.compnd.memb[i].offset < accum_change)) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype"); + /* Apply the accumulated size change to the offset of the field */ - dt->shared->u.compnd.memb[i].offset += accum_change; + dt->shared->u.compnd.memb[i].offset += (size_t) accum_change; /* Set the member type pointer (for convenience) */ memb_type=dt->shared->u.compnd.memb[i].type; @@ -5105,13 +5183,18 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) dt->shared->u.compnd.memb[i].size = (dt->shared->u.compnd.memb[i].size*memb_type->shared->size)/old_size; /* Add that change to the accumulated size change */ - accum_change += (memb_type->shared->size - (int)old_size); + accum_change += (ssize_t) (memb_type->shared->size - old_size); } /* end if */ } /* end if */ } /* end for */ + /* Range check against datatype size */ + if ((accum_change < 0) && ((ssize_t) dt->shared->size < accum_change)) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype"); + /* Apply the accumulated size change to the datatype */ - dt->shared->size = (size_t)(dt->shared->size + accum_change); + dt->shared->size += (size_t) accum_change; + } break; case H5T_VLEN: /* Recurse on the VL information if it's VL, compound or array, then free VL sequence */ @@ -5145,6 +5228,15 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) } /* end if */ break; + case H5T_NO_CLASS: + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_ENUM: + case H5T_NCLASSES: default: break; } /* end switch */ @@ -5235,6 +5327,15 @@ H5T_upgrade_version_cb(H5T_t *dt, void *op_value) dt->shared->version = dt->shared->parent->shared->version; break; + case H5T_NO_CLASS: + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_TIME: + case H5T_STRING: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_REFERENCE: + case H5T_NCLASSES: default: break; } /* end switch */ @@ -489,7 +489,7 @@ H5TS_win32_thread_exit(void) *-------------------------------------------------------------------------- */ H5TS_thread_t -H5TS_create_thread(void *func, H5TS_attr_t *attr, void *udata) +H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr, void *udata) { H5TS_thread_t ret_value; diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h index cc22f96..5394b77 100644 --- a/src/H5TSprivate.h +++ b/src/H5TSprivate.h @@ -122,7 +122,7 @@ H5_DLL herr_t H5TS_mutex_lock(H5TS_mutex_t *mutex); H5_DLL herr_t H5TS_mutex_unlock(H5TS_mutex_t *mutex); H5_DLL herr_t H5TS_cancel_count_inc(void); H5_DLL herr_t H5TS_cancel_count_dec(void); -H5_DLL H5TS_thread_t H5TS_create_thread(void * func, H5TS_attr_t * attr, void *udata); +H5_DLL H5TS_thread_t H5TS_create_thread(void *(*func)(void *), H5TS_attr_t * attr, void *udata); #if defined c_plusplus || defined __cplusplus } diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 7359a56..024cc83 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -558,7 +558,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) H5O_type_t obj_type; /* Type of object at location */ H5G_loc_t type_loc; /* Group object for datatype */ hbool_t obj_found = FALSE; /* Object at 'name' found */ - hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datatype */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datatype */ hid_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index a8881fb..f1586bd 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -200,7 +200,7 @@ H5Topen1(hid_t loc_id, const char *name) H5O_type_t obj_type; /* Type of object at location */ H5G_loc_t type_loc; /* Group object for datatype */ hbool_t obj_found = FALSE; /* Object at 'name' found */ - hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datatype */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datatype */ hid_t ret_value = FAIL; FUNC_ENTER_API(FAIL) diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 1a97f39..960a811 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -396,7 +396,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value") HDmemcpy(memb_value, tmp_memb_value, H5T_get_size(super_type)); - if(H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0, memb_value, NULL, H5P_DEFAULT) < 0) + if(H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0, memb_value, NULL, H5P_DATASET_XFER_DEFAULT) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value") if(H5T__enum_insert(new_type, memb_name, memb_value) < 0) @@ -418,8 +418,7 @@ H5VM_hyper_disjointp(unsigned n, HGOTO_DONE(TRUE) for(u = 0; u < n; u++) { - HDassert(size1[u] < HSIZET_MAX); - HDassert(size2[u] < HSIZET_MAX); + HDcompile_assert(sizeof(uint32_t) <= sizeof(hsize_t)); if(0 == size1[u] || 0 == size2[u]) HGOTO_DONE(TRUE) @@ -1259,21 +1258,84 @@ done: * The chunk index is placed in the CHUNK_IDX location for return * from this function * - * Return: Non-negative on success/Negative on failure + * Return: Chunk index on success (can't fail) * * Programmer: Quincey Koziol * Monday, April 21, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ -herr_t +hsize_t H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, - const hsize_t *down_nchunks, hsize_t *chunk_idx) + const hsize_t *down_nchunks) { - hsize_t scaled_coord[H5VM_HYPER_NDIMS]; /* Scaled, coordinates, in terms of chunks */ - unsigned u; /* Local index variable */ + hsize_t scaled_coord[H5VM_HYPER_NDIMS]; /* Scaled, coordinates, in terms of chunks */ + hsize_t chunk_idx; /* Chunk index computed */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(ndims <= H5VM_HYPER_NDIMS); + HDassert(coord); + HDassert(chunk); + HDassert(down_nchunks); + + /* Defer to H5VM_chunk_index_scaled */ + chunk_idx = H5VM_chunk_index_scaled(ndims, coord, chunk, down_nchunks, scaled_coord); + + FUNC_LEAVE_NOAPI(chunk_idx) +} /* end H5VM_chunk_index() */ + + +/*------------------------------------------------------------------------- + * Function: H5VM_chunk_index_scaled + * + * Purpose: Given a coordinate offset (COORD), the size of each chunk + * (CHUNK), the number of chunks in each dimension (NCHUNKS) + * and the number of dimensions of all of these (NDIMS), calculate + * a "chunk index" for the chunk that the coordinate offset is + * located in. + * + * The chunk index starts at 0 and increases according to the + * fastest changing dimension, then the next fastest, etc. + * + * For example, with a 3x5 chunk size and 6 chunks in the fastest + * changing dimension and 3 chunks in the slowest changing + * dimension, the chunk indices are as follows: + * + * +-----+-----+-----+-----+-----+-----+ + * | | | | | | | + * | 0 | 1 | 2 | 3 | 4 | 5 | + * | | | | | | | + * +-----+-----+-----+-----+-----+-----+ + * | | | | | | | + * | 6 | 7 | 8 | 9 | 10 | 11 | + * | | | | | | | + * +-----+-----+-----+-----+-----+-----+ + * | | | | | | | + * | 12 | 13 | 14 | 15 | 16 | 17 | + * | | | | | | | + * +-----+-----+-----+-----+-----+-----+ + * + * The chunk index is placed in the CHUNK_IDX location for return + * from this function + * + * Note: This routine is identical to H5VM_chunk_index(), except for + * caching the scaled information. Make changes in both places. + * + * Return: Chunk index on success (can't fail) + * + * Programmer: Vailin Choi + * Monday, February 9, 2015 + * + *------------------------------------------------------------------------- + */ +hsize_t +H5VM_chunk_index_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, + const hsize_t *down_nchunks, hsize_t *scaled) +{ + hsize_t chunk_idx; /* Computed chunk index */ + unsigned u; /* Local index variable */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -1281,17 +1343,19 @@ H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, HDassert(ndims <= H5VM_HYPER_NDIMS); HDassert(coord); HDassert(chunk); - HDassert(chunk_idx); + HDassert(down_nchunks); + HDassert(scaled); /* Compute the scaled coordinates for actual coordinates */ - for(u=0; u<ndims; u++) - scaled_coord[u]=coord[u]/chunk[u]; + /* (Note that the 'scaled' array is an 'OUT' parameter) */ + for(u = 0; u < ndims; u++) + scaled[u] = coord[u] / chunk[u]; /* Compute the chunk index */ - *chunk_idx=H5VM_array_offset_pre(ndims,down_nchunks,scaled_coord); /*lint !e772 scaled_coord will always be initialized */ + chunk_idx = H5VM_array_offset_pre(ndims, down_nchunks, scaled); /*lint !e772 scaled_coord will always be initialized */ - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5VM_chunk_index() */ + FUNC_LEAVE_NOAPI(chunk_idx) +} /* end H5VM_chunk_index_scaled() */ /*------------------------------------------------------------------------- diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h index 20821b2..8ddb5ee 100644 --- a/src/H5VMprivate.h +++ b/src/H5VMprivate.h @@ -89,8 +89,10 @@ H5_DLL hsize_t H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset); H5_DLL herr_t H5VM_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t *coords); -H5_DLL herr_t H5VM_chunk_index(unsigned ndims, const hsize_t *coord, - const uint32_t *chunk, const hsize_t *down_nchunks, hsize_t *chunk_idx); +H5_DLL hsize_t H5VM_chunk_index(unsigned ndims, const hsize_t *coord, + const uint32_t *chunk, const hsize_t *down_nchunks); +H5_DLL hsize_t H5VM_chunk_index_scaled(unsigned ndims, const hsize_t *coord, + const uint32_t *chunk, const hsize_t *down_nchunks, hsize_t *scaled); H5_DLL ssize_t H5VM_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize_t dst_off_arr[], size_t src_max_nseq, size_t *src_curr_seq, size_t src_len_arr[], @@ -410,6 +412,29 @@ H5VM_log2_of2(uint32_t n) /*------------------------------------------------------------------------- + * Function: H5VM_power2up + * + * Purpose: Round up a number to the next power of 2 + * + * Return: Return the number which is a power of 2 + * + * Programmer: Vailin Choi; Nov 2014 + * + *------------------------------------------------------------------------- + */ +static H5_inline hsize_t UNUSED +H5VM_power2up(hsize_t n) +{ + hsize_t ret_value = 1; /* Return value */ + + while(ret_value < n) + ret_value <<= 1; + + return(ret_value); +} /* H5VM_power2up */ + + +/*------------------------------------------------------------------------- * Function: H5VM_limit_enc_size * * Purpose: Determine the # of bytes needed to encode values within a diff --git a/src/H5api_adpt.h b/src/H5api_adpt.h index 845a9a0..7602310 100644 --- a/src/H5api_adpt.h +++ b/src/H5api_adpt.h @@ -21,59 +21,16 @@ #ifndef H5API_ADPT_H #define H5API_ADPT_H +#ifdef __cplusplus +#define __attribute__(X) /*void*/ +#endif /* __cplusplus */ +#ifndef H5_HAVE_ATTRIBUTE +#define __attribute__(X) /*void*/ +#endif /* H5_HAVE_ATTRIBUTE */ + /* This will only be defined if HDF5 was built with CMake */ #ifdef H5_BUILT_AS_DYNAMIC_LIB -#if defined (hdf5_EXPORTS) - #define _HDF5DLL_ -#else - #define _HDF5USEDLL_ -#endif - -#if defined (hdf5_test_EXPORTS) - #define _HDF5TESTDLL_ -#else - #define _HDF5TESTUSEDLL_ -#endif - -#if defined (hdf5_tools_EXPORTS) - #define _HDF5TOOLSDLL_ -#else - #define _HDF5TOOLSUSEDLL_ -#endif - -#if defined (hdf5_cpp_EXPORTS) - #define HDF5_CPPDLL_EXPORTS -#else - #define HDF5CPP_USEDLL -#endif - -#if defined (hdf5_hl_EXPORTS) - #define _HDF5_HLDLL_EXPORTS_ -#else - #define _HDF5USEHLDLL_ -#endif - -#if defined (hdf5_hl_cpp_EXPORTS) - #define HDF5_HL_CPPDLL_EXPORTS -#else - #define HDF5USE_HLCPPDLL -#endif - -#if defined (hdf5_f90cstub_EXPORTS) - #define HDF5FORT_CSTUB_DLL_EXPORTS -#else - #define HDF5FORT_CSTUB_USEDLL -#endif - -#if defined (hdf5_test_f90cstub_EXPORTS) - #define HDF5FORTTEST_CSTUB_DLL_EXPORTS -#endif - -#if defined (hdf5_hl_f90cstub_EXPORTS) - #define HDF5_HL_F90CSTUBDLL_EXPORTS -#endif - #if defined(hdf5_EXPORTS) #if defined (_MSC_VER) /* MSVC Compiler Case */ #define H5_DLL __declspec(dllexport) @@ -281,144 +238,25 @@ #define HDF5_HL_F90CSTUBDLLVAR extern #endif /* HDF5_HL_F90CSTUBDLL */ -#elif defined(H5_BUILT_AS_STATIC_LIB) +#else #define H5_DLL - #define H5_HLDLL - #define H5_HLCPPDLL - #define HDF5_HL_F90CSTUBDLL #define H5_DLLVAR extern - #define H5_DLLCPP #define H5TEST_DLL #define H5TEST_DLLVAR extern #define H5TOOLS_DLL #define H5TOOLS_DLLVAR extern + #define H5_DLLCPP + #define H5_DLLCPPVAR extern + #define H5_HLDLL + #define H5_HLDLLVAR extern + #define H5_HLCPPDLL + #define H5_HLCPPDLLVAR extern #define H5_FCDLL #define H5_FCDLLVAR extern #define H5_FCTESTDLL #define H5_FCTESTDLLVAR extern - -#else -/* This is the original HDFGroup defined preprocessor code which should still work - * with the VS projects that are maintained by "The HDF Group" - * The Visual Studio project files will not be supported in the next major release of 1.10. - */ - -#if defined(H5_HAVE_WIN32_API) - -#if defined(_HDF5DLL_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ -#define H5_DLL __declspec(dllexport) -#define H5_DLLVAR extern __declspec(dllexport) -#elif defined(_HDF5USEDLL_) -#define H5_DLL __declspec(dllimport) -#define H5_DLLVAR __declspec(dllimport) -#else -#define H5_DLL -#define H5_DLLVAR extern -#endif /* _HDF5DLL_ */ - -#if defined(_HDF5TESTDLL_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ -#define H5TEST_DLL __declspec(dllexport) -#define H5TEST_DLLVAR extern __declspec(dllexport) -#elif defined(_HDF5TESTUSEDLL_) -#define H5TEST_DLL __declspec(dllimport) -#define H5TEST_DLLVAR __declspec(dllimport) -#else -#define H5TEST_DLL -#define H5TEST_DLLVAR extern -#endif /* _HDF5TESTDLL_ */ - -#if defined(_HDF5TOOLSDLL_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ -#define H5TOOLS_DLL __declspec(dllexport) -#define H5TOOLS_DLLVAR extern __declspec(dllexport) -#elif defined(_HDF5TOOLSUSEDLL_) -#define H5TOOLS_DLL __declspec(dllimport) -#define H5TOOLS_DLLVAR __declspec(dllimport) -#else -#define H5TOOLS_DLL -#define H5TOOLS_DLLVAR extern -#endif /* _HDF5TOOLSDLL_ */ - -#if defined(_HDF5_HLDLL_EXPORTS_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ -#define H5_HLDLL __declspec(dllexport) -#elif defined(_HDF5USEHLDLL_) -#define H5_HLDLL __declspec(dllimport) -#else -#define H5_HLDLL -#endif /* _HDF5_HLDLL_EXPORTS */ - -#if defined(HDF5_HL_CPPDLL_EXPORTS) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ -#define H5_HLCPPDLL __declspec(dllexport) -#elif defined(HDF5USE_HLCPPDLL) -#define H5_HLCPPDLL __declspec(dllimport) -#else -#define H5_HLCPPDLL -#endif /*HDF5_HL_CPPDLL_EXPORTS*/ - -#if defined(HDF5_HL_F90CSTUBDLL_EXPORTS) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ -#define HDF5_HL_F90CSTUBDLL __declspec(dllexport) -#elif defined(HDF5USE_HLF90CSTUBDLL) -#define HDF5_HL_F90CSTUBDLL __declspec(dllimport) -#else -#define HDF5_HL_F90CSTUBDLL -#endif /*HDF5_HL_F90CSTUBDLL_EXPORTS*/ - - -#if defined(HDF5FORT_CSTUB_DLL_EXPORTS) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ -#define H5_FCDLL __declspec(dllexport) -#define H5_FCDLLVAR extern __declspec(dllexport) -#elif defined(HDF5FORT_CSTUB_USEDLL) -#define H5_FCDLL __declspec(dllimport) -#define H5_FCDLLVAR __declspec(dllimport) -#else -#define H5_FCDLL -#define H5_FCDLLVAR extern -#endif /* _HDF5_FORTRANDLL_EXPORTS_ */ - -#if defined(HDF5FORTTEST_CSTUB_DLL_EXPORTS) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ -#define H5_FCTESTDLL __declspec(dllexport) -#define H5_FCTESTDLLVAR extern __declspec(dllexport) -#elif defined(HDF5FORTTEST_CSTUB_USEDLL) -#define H5_FCTESTDLL __declspec(dllimport) -#define H5_FCTESTDLLVAR __declspec(dllimport) -#else -#define H5_FCTESTDLL -#define H5_FCTESTDLLVAR extern -#endif /* _HDF5_FORTRANDLL_EXPORTS_ */ - -/* Added to export or to import C++ APIs - BMR (02-15-2002) */ -#if defined(HDF5_CPPDLL_EXPORTS) /* this name is generated at creation */ -#define H5_DLLCPP __declspec(dllexport) -#elif defined(HDF5CPP_USEDLL) -#define H5_DLLCPP __declspec(dllimport) -#else -#define H5_DLLCPP -#endif /* HDF5_CPPDLL_EXPORTS */ - -#else /*H5_HAVE_WIN32_API*/ -#define H5_DLL -#define H5_HLDLL -#define H5_HLCPPDLL -#define HDF5_HL_F90CSTUBDLL -#define H5_DLLVAR extern -#define H5_DLLCPP -#define H5TEST_DLL -#define H5TEST_DLLVAR extern -#define H5TOOLS_DLL -#define H5TOOLS_DLLVAR extern -#define H5_FCDLL -#define H5_FCDLLVAR extern -#define H5_FCTESTDLL -#define H5_FCTESTDLLVAR extern -#endif /*H5_HAVE_WIN32_API*/ + #define HDF5_HL_F90CSTUBDLL + #define HDF5_HL_F90CSTUBDLLVAR extern +#endif /* H5_BUILT_AS_DYNAMIC_LIB */ #endif /* H5API_ADPT_H */ - -#endif /* */ diff --git a/src/H5detect.c b/src/H5detect.c index fc0570c..15736bd 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -73,7 +73,7 @@ static const char *FileHeader = "\n\ #define H5JMP_BUF sigjmp_buf #define H5SETJMP(buf) HDsigsetjmp(buf, 1) #define H5LONGJMP(buf, val) HDsiglongjmp(buf, val) -#define H5HAVE_SIGJMP # sigsetjmp/siglongjmp are supported. +#define H5HAVE_SIGJMP /* sigsetjmp/siglongjmp are supported. */ #elif defined(H5_HAVE_LONGJMP) #define H5JMP_BUF jmp_buf #define H5SETJMP(buf) HDsetjmp(buf) @@ -90,41 +90,41 @@ static const char *FileHeader = "\n\ * was detected. */ typedef struct detected_t { - const char *varname; - int size; /*total byte size */ - int precision; /*meaningful bits */ - int offset; /*bit offset to meaningful bits */ - int perm[32]; /*for detection of byte order */ - int is_vax; /*for vax (float & double) only */ - int sign; /*location of sign bit */ - int mpos, msize, imp;/*information about mantissa */ - int epos, esize; /*information about exponent */ - unsigned long bias; /*exponent bias for floating pt.*/ - size_t align; /*required byte alignment */ - size_t comp_align; /*alignment for structure */ + const char *varname; + unsigned int size; /* total byte size */ + unsigned int precision; /* meaningful bits */ + unsigned int offset; /* bit offset to meaningful bits */ + int perm[32]; /* for detection of byte order */ + hbool_t is_vax; /* for vax (float & double) only */ + unsigned int sign; /* location of sign bit */ + unsigned int mpos, msize, imp; /* information about mantissa */ + unsigned int epos, esize; /* information about exponent */ + unsigned long bias; /* exponent bias for floating pt */ + unsigned int align; /* required byte alignment */ + unsigned int comp_align; /* alignment for structure */ } detected_t; /* This structure holds structure alignment for pointers, hvl_t, hobj_ref_t, * hdset_reg_ref_t */ typedef struct malign_t { const char *name; - size_t comp_align; /*alignment for structure */ + unsigned int comp_align; /* alignment for structure */ } malign_t; /* global variables types detection code */ -static detected_t d_g[MAXDETECT]; -static malign_t m_g[MAXDETECT]; -static volatile int nd_g = 0, na_g = 0; +H5_GCC_DIAG_OFF(larger-than=) +static detected_t d_g[MAXDETECT]; +H5_GCC_DIAG_ON(larger-than=) +static malign_t m_g[MAXDETECT]; +static volatile int nd_g = 0, na_g = 0; static void print_results(int nd, detected_t *d, int na, malign_t *m); static void iprint(detected_t *); static int byte_cmp(int, const void *, const void *, const unsigned char *); -static int bit_cmp(int, int *, volatile void *, volatile void *, - const unsigned char *); +static unsigned int bit_cmp(unsigned int, int *, void *, void *, const unsigned char *); static void fix_order(int, int, int *, const char **); -static int imp_bit(int, int *, volatile void *, volatile void *, - const unsigned char *); -static unsigned long find_bias(int, int, int *, volatile void *); +static unsigned int imp_bit(unsigned int, int *, void *, void *, const unsigned char *); +static unsigned int find_bias(unsigned int, unsigned int, int *, void *); static void precision (detected_t*); static void print_header(void); static void detect_C89_integers(void); @@ -136,7 +136,7 @@ static void detect_C99_integers16(void); static void detect_C99_integers32(void); static void detect_C99_integers64(void); static void detect_alignments(void); -static size_t align_g[] = {1, 2, 4, 8, 16}; +static unsigned int align_g[] = {1, 2, 4, 8, 16}; static int align_status_g = 0; /* ALIGNMENT Signal Status */ static int sigbus_handler_called_g = 0; /* how many times called */ static int sigsegv_handler_called_g = 0;/* how many times called */ @@ -167,39 +167,41 @@ static H5JMP_BUF jbuf_g; static void precision (detected_t *d) { - int n; + unsigned int n; - if (0==d->msize) { - /* - * An integer. The permutation can have negative values at the - * beginning or end which represent padding of bytes. We must adjust - * the precision and offset accordingly. - */ - if (d->perm[0] < 0) { - /* - * Lower addresses are padded. - */ - for (n=0; n<d->size && d->perm[n]<0; n++) /*void*/; - d->precision = 8*(d->size-n); - d->offset = 0; - } else if (d->perm[d->size - 1] < 0) { - /* - * Higher addresses are padded. - */ - for (n=0; n<d->size && d->perm[d->size-(n+1)]; n++) /*void*/; - d->precision = 8*(d->size-n); - d->offset = 8*n; - } else { - /* - * No padding. - */ - d->precision = 8*d->size; - d->offset = 0; - } + if (0 == d->msize) { + /* + * An integer. The permutation can have negative values at the + * beginning or end which represent padding of bytes. We must adjust + * the precision and offset accordingly. + */ + if (d->perm[0] < 0) { + /* + * Lower addresses are padded. + */ + for (n = 0; n < d->size && d->perm[n] < 0; n++) + /*void*/; + d->precision = 8 * (d->size - n); + d->offset = 0; + } else if (d->perm[d->size - 1] < 0) { + /* + * Higher addresses are padded. + */ + for (n = 0; n < d->size && d->perm[d->size - (n + 1)]; n++) + /*void*/; + d->precision = 8 * (d->size - n); + d->offset = 8 * n; + } else { + /* + * No padding. + */ + d->precision = 8 * d->size; + d->offset = 0; + } } else { - /* A floating point */ - d->offset = MIN3 (d->mpos, d->epos, d->sign); - d->precision = d->msize + d->esize + 1; + /* A floating point */ + d->offset = MIN3(d->mpos, d->epos, d->sign); + d->precision = d->msize + d->esize + 1; } } @@ -251,7 +253,8 @@ precision (detected_t *d) INFO.size = sizeof(TYPE); \ \ for(_i = sizeof(DETECT_TYPE), _v = 0; _i > 0; --_i) \ - _v = (_v << 8) + _i; \ + _v = (DETECT_TYPE) ((DETECT_TYPE) (_v << 8) + (DETECT_TYPE) _i); \ + \ for(_i = 0, _x = (unsigned char *)&_v; _i < (signed)sizeof(DETECT_TYPE); _i++) { \ _j = (*_x++) - 1; \ HDassert(_j < (signed)sizeof(DETECT_TYPE)); \ @@ -290,9 +293,6 @@ precision (detected_t *d) * absence of implicit mantissa bit, and exponent bias and * initializes a detected_t structure with those properties. * - * Note: 'volatile' is used for the variables below to prevent the - * compiler from optimizing them away. - * * Return: void * * Programmer: Robb Matzke @@ -302,12 +302,12 @@ precision (detected_t *d) *------------------------------------------------------------------------- */ #define DETECT_F(TYPE,VAR,INFO) { \ - volatile TYPE _v1, _v2, _v3; \ + TYPE _v1, _v2, _v3; \ unsigned char _buf1[sizeof(TYPE)], _buf3[sizeof(TYPE)]; \ unsigned char _pad_mask[sizeof(TYPE)]; \ unsigned char _byte_mask; \ int _i, _j, _last = (-1); \ - char *_mesg; \ + const char *_mesg; \ \ HDmemset(&INFO, 0, sizeof(INFO)); \ INFO.varname = #VAR; \ @@ -326,11 +326,13 @@ precision (detected_t *d) _v1 = (TYPE)4.0L; \ HDmemcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ for(_i = 0; _i < (int)sizeof(TYPE); _i++) \ - for(_byte_mask = (unsigned char)1; _byte_mask; _byte_mask <<= 1) { \ + for(_byte_mask = (unsigned char)1; _byte_mask; _byte_mask = (unsigned char) (_byte_mask << 1)) { \ _buf1[_i] ^= _byte_mask; \ HDmemcpy((void *)&_v2, (const void *)_buf1, sizeof(TYPE)); \ + H5_GCC_DIAG_OFF(float-equal) \ if(_v1 != _v2) \ _pad_mask[_i] |= _byte_mask; \ + H5_GCC_DIAG_ON(float-equal) \ _buf1[_i] ^= _byte_mask; \ } /* end for */ \ \ @@ -368,7 +370,7 @@ precision (detected_t *d) _v1 = (TYPE)1.0L; \ _v2 = (TYPE)1.5L; \ INFO.msize = bit_cmp (sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ - INFO.msize += 1 + (INFO.imp?0:1) - INFO.mpos; \ + INFO.msize += 1 + (unsigned int) (INFO.imp ? 0 : 1) - INFO.mpos; \ \ /* Exponent */ \ INFO.epos = INFO.mpos + INFO.msize; \ @@ -415,14 +417,13 @@ precision (detected_t *d) TYPE x; \ } s; \ \ - COMP_ALIGN = (size_t)((char*)(&(s.x)) - (char*)(&s)); \ + COMP_ALIGN = (unsigned int)((char*)(&(s.x)) - (char*)(&s)); \ } #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) #define ALIGNMENT(TYPE,INFO) { \ - char *volatile _buf = NULL; \ - volatile TYPE _val = 1; \ - volatile TYPE _val2; \ + char *volatile _buf = NULL; \ + TYPE _val = 1, _val2; \ volatile size_t _ano = 0; \ void (*_handler)(int) = HDsignal(SIGBUS, sigbus_handler); \ void (*_handler2)(int) = HDsignal(SIGSEGV, sigsegv_handler);\ @@ -445,8 +446,10 @@ precision (detected_t *d) else /* Little-Endian */ \ HDmemcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \ _val2 = *((TYPE*)(_buf+align_g[_ano])); \ + H5_GCC_DIAG_OFF(float-equal) \ if(_val!=_val2) \ H5LONGJMP(jbuf_g, 1); \ + H5_GCC_DIAG_ON(float-equal) \ /* End Cray Check */ \ (INFO.align)=align_g[_ano]; \ } else { \ @@ -881,63 +884,69 @@ done:\n\ static void iprint(detected_t *d) { - int i, j, k, pass; + unsigned int pass; - for (pass=(d->size-1)/4; pass>=0; --pass) { - /* - * Print the byte ordering above the bit fields. - */ - printf(" * "); - for (i=MIN(pass*4+3,d->size-1); i>=pass*4; --i) { - printf ("%4d", d->perm[i]); - if (i>pass*4) HDfputs (" ", stdout); - } + for (pass = (d->size - 1) / 4; ; --pass) { + unsigned int i, k; + /* + * Print the byte ordering above the bit fields. + */ + printf(" * "); + for (i = MIN(pass * 4 + 3, d->size - 1); i >= pass * 4; --i) { + printf("%4d", d->perm[i]); + if (i > pass * 4) HDfputs(" ", stdout); + if (!i) break; + } - /* - * Print the bit fields - */ - printf("\n * "); - for (i=MIN(pass*4+3,d->size-1), - k=MIN(pass*32+31,8*d->size-1); - i>=pass*4; --i) { - for (j=7; j>=0; --j) { - if (k==d->sign && d->msize) { - HDputchar('S'); - } else if (k>=d->epos && k<d->epos+d->esize) { - HDputchar('E'); - } else if (k>=d->mpos && k<d->mpos+d->msize) { - HDputchar('M'); - } else if (d->msize) { - HDputchar('?'); /*unknown floating point bit */ - } else if (d->sign) { - HDputchar('I'); - } else { - HDputchar('U'); - } - --k; - } - if (i>pass*4) HDputchar(' '); - } - HDputchar('\n'); + /* + * Print the bit fields + */ + printf("\n * "); + for (i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31, + 8 * d->size - 1); i >= pass * 4; --i) { + unsigned int j; + + for (j = 8; j > 0; --j) { + if (k == d->sign && d->msize) { + HDputchar('S'); + } else if (k >= d->epos && k < d->epos + d->esize) { + HDputchar('E'); + } else if (k >= d->mpos && k < d->mpos + d->msize) { + HDputchar('M'); + } else if (d->msize) { + HDputchar('?'); /*unknown floating point bit */ + } else if (d->sign) { + HDputchar('I'); + } else { + HDputchar('U'); + } + --k; + } + if (i > pass * 4) HDputchar(' '); + if (!i) break; + } + HDputchar('\n'); + if (!pass) break; } /* * Is there an implicit bit in the mantissa. */ if (d->msize) { - printf(" * Implicit bit? %s\n", d->imp ? "yes" : "no"); + printf(" * Implicit bit? %s\n", d->imp ? "yes" : "no"); } /* * Alignment */ - if (0==d->align) { - printf(" * Alignment: NOT CALCULATED\n"); - } else if (1==d->align) { - printf(" * Alignment: none\n"); + if (0 == d->align) { + printf(" * Alignment: NOT CALCULATED\n"); + } else if (1 == d->align) { + printf(" * Alignment: none\n"); } else { - printf(" * Alignment: %lu\n", (unsigned long)(d->align)); + printf(" * Alignment: %lu\n", (unsigned long) (d->align)); } + } @@ -985,31 +994,25 @@ byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) * actual order to little endian. Ignores differences where * the corresponding bit in pad_mask is set to 0. * - * Return: Success: Index of first differing bit. - * - * Failure: -1 - * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jun 13, 1996 - * - * Modifications: + * Return: Index of first differing bit. * *------------------------------------------------------------------------- */ -static int -bit_cmp(int nbytes, int *perm, volatile void *_a, volatile void *_b, - const unsigned char *pad_mask) +static unsigned int +bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, + const unsigned char *pad_mask) { - int i, j; - volatile unsigned char *a = (volatile unsigned char *) _a; - volatile unsigned char *b = (volatile unsigned char *) _b; - unsigned char aa, bb; + unsigned int i; + unsigned char *a = (unsigned char *) _a; + unsigned char *b = (unsigned char *) _b; + unsigned char aa, bb; for (i = 0; i < nbytes; i++) { - HDassert(perm[i] < nbytes); - if ((aa = a[perm[i]] & pad_mask[perm[i]]) - != (bb = b[perm[i]] & pad_mask[perm[i]])) { + HDassert(perm[i] < (int) nbytes); + if ((aa = (unsigned char) (a[perm[i]] & pad_mask[perm[i]])) + != (bb = (unsigned char) (b[perm[i]] & pad_mask[perm[i]]))) { + unsigned int j; + for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { if ((aa & 1) != (bb & 1)) return i * 8 + j; } @@ -1017,7 +1020,9 @@ bit_cmp(int nbytes, int *perm, volatile void *_a, volatile void *_b, HDabort(); } } - return -1; + fprintf(stderr, "INTERNAL ERROR"); + HDabort(); + return 0; } @@ -1123,21 +1128,19 @@ fix_order(int n, int last, int *perm, const char **mesg) * *------------------------------------------------------------------------- */ -static int -imp_bit(int n, int *perm, volatile void *_a, volatile void *_b, - const unsigned char *pad_mask) +static unsigned int +imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_mask) { - volatile unsigned char *a = (volatile unsigned char *) _a; - volatile unsigned char *b = (volatile unsigned char *) _b; - int changed, major, minor; - int msmb; /*most significant mantissa bit */ + unsigned char *a = (unsigned char *) _a; + unsigned char *b = (unsigned char *) _b; + unsigned int changed, major, minor; + unsigned int msmb; /* most significant mantissa bit */ /* * Look for the least significant bit that has changed between * A and B. This is the least significant bit of the exponent. */ changed = bit_cmp(n, perm, a, b, pad_mask); - HDassert(changed >= 0); /* * The bit to the right (less significant) of the changed bit should @@ -1174,22 +1177,22 @@ imp_bit(int n, int *perm, volatile void *_a, volatile void *_b, * *------------------------------------------------------------------------- */ -static unsigned long -find_bias(int epos, int esize, int *perm, volatile void *_a) +static unsigned int +find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) { - unsigned char *a = (unsigned char *) _a; - unsigned char mask; - unsigned long b, shift = 0, nbits, bias = 0; + unsigned char *a = (unsigned char *) _a; + unsigned char mask; + unsigned int b, shift = 0, nbits, bias = 0; while (esize > 0) { - nbits = MIN(esize, (8 - epos % 8)); - mask = (1 << nbits) - 1; - b = (a[perm[epos / 8]] >> (epos % 8)) & mask; - bias |= b << shift; - - shift += nbits; - esize -= nbits; - epos += nbits; + nbits = MIN(esize, (8 - epos % 8)); + mask = (unsigned char) ((1 << nbits) - 1); + b = (unsigned int) (a[perm[epos / 8]] >> (epos % 8)) & mask; + bias |= b << shift; + + shift += nbits; + esize -= nbits; + epos += nbits; } return bias; } @@ -1667,7 +1670,7 @@ detect_alignments(void) static int verify_signal_handlers(int signum, void (*handler)(int)) { void (*save_handler)(int) = HDsignal(signum, handler); - int i, val; + volatile int i, val; int ntries=5; volatile int nfailures=0; volatile int nsuccesses=0; diff --git a/src/H5private.h b/src/H5private.h index 1164a2d..d1bbc24 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -275,12 +275,10 @@ #endif /* - * Does the compiler support the __attribute__(()) syntax? This is how gcc - * suppresses warnings about unused function arguments. It's no big deal if - * we don't. + * Does the compiler support the __attribute__(()) syntax? It's no + * big deal if we don't. */ #ifdef __cplusplus -# define __attribute__(X) /*void*/ # define UNUSED /*void*/ # define NORETURN /*void*/ #else /* __cplusplus */ @@ -288,7 +286,6 @@ # define UNUSED __attribute__((unused)) # define NORETURN __attribute__((noreturn)) #else -# define __attribute__(X) /*void*/ # define UNUSED /*void*/ # define NORETURN /*void*/ #endif diff --git a/src/H5public.h b/src/H5public.h index 0e866be..7b9625b 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -94,10 +94,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 215 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 218 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.215" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.218" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/H5system.c b/src/H5system.c index 437a004..56db380 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -313,7 +313,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 'G': if(!HDstrcmp(modifier, "h")) { float x = (float)va_arg(ap, double); - n = fprintf(stream, format_templ, x); + n = fprintf(stream, format_templ, (double)x); } else if(!*modifier || !HDstrcmp(modifier, "l")) { double x = va_arg(ap, double); n = fprintf(stream, format_templ, x); |