diff options
Diffstat (limited to 'src')
48 files changed, 2935 insertions, 2247 deletions
@@ -98,7 +98,7 @@ H5_debug_t H5_debug_g; /*debugging info */ herr_t H5_init_library(void) { - herr_t ret_value=SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5_init_library, FAIL) /* @@ -151,7 +151,7 @@ H5_init_library(void) if (!H5_dont_atexit_g) { (void)HDatexit(H5_term_library); H5_dont_atexit_g = TRUE; - } + } /* end if */ /* * Initialize interfaces that might not be able to initialize themselves @@ -163,19 +163,19 @@ H5_init_library(void) * The link interface needs to be initialized so that link property lists * have their properties registered. */ - if (H5E_init()<0) + if(H5E_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize error interface") - if (H5P_init()<0) + if(H5P_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize property list interface") - if (H5F_init()<0) + if(H5F_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize file interface") - if (H5T_init()<0) + if(H5T_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize datatype interface") - if (H5D_init()<0) + if(H5D_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize dataset interface") - if (H5AC_init()<0) + if(H5AC_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize metadata caching interface") - if (H5L_init()<0) + if(H5L_init() < 0) HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to initialize link interface") /* Debugging? */ @@ -184,7 +184,7 @@ H5_init_library(void) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5_init_library() */ /*------------------------------------------------------------------------- @@ -71,7 +71,6 @@ DESCRIPTION static herr_t H5A_init_interface(void) { - H5P_genclass_t *crt_pclass; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5A_init_interface) @@ -82,24 +81,9 @@ H5A_init_interface(void) if(H5I_register_type(H5I_ATTR, (size_t)H5I_ATTRID_HASHSIZE, H5A_RESERVED_ATOMS, (H5I_free_t)H5A_close) < H5I_FILE) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface") - /* =========Attribute Creation Property Class Initialization========= */ - /* Register the default attribute creation properties */ - assert(H5P_CLS_ATTRIBUTE_CREATE_g!=(-1)); - - /* Get the pointer to the attribute creation class */ - if (NULL == (crt_pclass = H5I_object(H5P_CLS_ATTRIBUTE_CREATE_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_ATTRIBUTE_CREATE_g==(-1)) { - /* Register the default attribute creation property list */ - if ((H5P_LST_ATTRIBUTE_CREATE_g = H5P_create_id (crt_pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list") - } /* end if */ - done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5A_init_interface() */ /*-------------------------------------------------------------------------- @@ -75,14 +75,6 @@ static herr_t H5D_extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id); static herr_t H5D_set_extent(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id); static herr_t H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); -/* Property list callbacks */ -static int H5D_crt_fill_value_cmp(const void *value1, const void *value2, size_t size); -static int H5D_crt_ext_file_list_cmp(const void *value1, const void *value2, size_t size); -static int H5D_crt_data_pipeline_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5D_xfer_xform_del(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5D_xfer_xform_copy(const char* name, size_t size, void* value); -static herr_t H5D_xfer_xform_close(const char* name, size_t size, void* value); - /*********************/ /* Package Variables */ /*********************/ @@ -160,77 +152,7 @@ NOTES static herr_t H5D_init_interface(void) { - /* Dataset Transfer property class variables. In sequence, they are, - * - Transfer Property list class to modify - * - Default value for maximum data transform buffer size - * - Default value for maximum temp buffer size - * - Default value for type conversion buffer - * - Default value for background buffer - * - Default value for B-tree node split ratios - * - Default value for hyperslab caching - * - Default value for hyperslab cache limit - * - Default value for vlen allocation function - * - Default value for vlen allocation information - * - Default value for vlen free function - * - Default value for vlen free information - * - Default value for file driver ID - * - Default value for file driver info - * - Default value for 'gather reads' property - * - Default value for vector size - * - Default value for I/O transfer mode - * - Default value for EDC property - * - Default value for filter callback - * - Default value for datatype conversion callback - */ - H5P_genclass_t *xfer_pclass; - size_t def_max_temp_buf = H5D_XFER_MAX_TEMP_BUF_DEF; - void *def_tconv_buf = H5D_XFER_TCONV_BUF_DEF; - void *def_bkgr_buf = H5D_XFER_BKGR_BUF_DEF; - H5T_bkg_t def_bkgr_buf_type = H5D_XFER_BKGR_BUF_TYPE_DEF; - double def_btree_split_ratio[3] = H5D_XFER_BTREE_SPLIT_RATIO_DEF; - H5MM_allocate_t def_vlen_alloc = H5D_XFER_VLEN_ALLOC_DEF; - void *def_vlen_alloc_info = H5D_XFER_VLEN_ALLOC_INFO_DEF; - H5MM_free_t def_vlen_free = H5D_XFER_VLEN_FREE_DEF; - void *def_vlen_free_info = H5D_XFER_VLEN_FREE_INFO_DEF; - hid_t def_vfl_id = H5D_XFER_VFL_ID_DEF; - void *def_vfl_info = H5D_XFER_VFL_INFO_DEF; - size_t def_hyp_vec_size = H5D_XFER_HYPER_VECTOR_SIZE_DEF; -#ifdef H5_HAVE_PARALLEL - H5FD_mpio_xfer_t def_io_xfer_mode = H5D_XFER_IO_XFER_MODE_DEF; - H5FD_mpio_collective_opt_t def_io_xfer_opt_mode = H5D_XFER_IO_XFER_OPT_MODE_DEF; - H5FD_mpio_chunk_opt_t def_mpio_chunk_opt_mode = H5D_XFER_MPIO_CHUNK_OPT_HARD_DEF; - H5FD_mpio_collective_opt_t def_mpio_collective_opt_mode = H5D_XFER_MPIO_COLLECTIVE_OPT_DEF; - unsigned def_mpio_chunk_opt_num = H5D_XFER_MPIO_CHUNK_OPT_NUM_DEF; - unsigned def_mpio_chunk_opt_ratio = H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEF; -#endif /* H5_HAVE_PARALLEL */ - H5Z_EDC_t enable_edc = H5D_XFER_EDC_DEF; - H5Z_cb_t filter_cb = H5D_XFER_FILTER_CB_DEF; - H5T_conv_cb_t conv_cb = H5D_XFER_CONV_CB_DEF; - void *def_xfer_xform = H5D_XFER_XFORM_DEF; - - /* Dataset creation property class variables. In sequence, they are, - * - Creation property list class to modify - * - Default value for storage layout property - * - Default value for chunk dimensionality property - * - Default value for chunk size - * - Default value for fill value - * - Default value for external file list - * - Default value for data filter pipeline - */ - H5P_genclass_t *crt_pclass; - H5D_layout_t layout = H5D_CRT_LAYOUT_DEF; - unsigned chunk_ndims = H5D_CRT_CHUNK_DIM_DEF; - size_t chunk_size[H5O_LAYOUT_NDIMS] = H5D_CRT_CHUNK_SIZE_DEF; - H5O_fill_t fill = H5D_CRT_FILL_VALUE_DEF; - H5D_alloc_time_t alloc_time = H5D_CRT_ALLOC_TIME_DEF; - unsigned alloc_time_state = H5D_CRT_ALLOC_TIME_STATE_DEF; - H5D_fill_time_t fill_time = H5D_CRT_FILL_TIME_DEF; - H5O_efl_t efl = H5D_CRT_EXT_FILE_LIST_DEF; - H5O_pline_t pline = H5D_CRT_DATA_PIPELINE_DEF; - H5P_genplist_t *def_dcpl; /* Default Dataset Creation Property list */ - size_t nprops; /* Number of properties */ - H5P_genclass_t *acc_pclass; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_init_interface) @@ -239,173 +161,13 @@ H5D_init_interface(void) if(H5I_register_type(H5I_DATASET, (size_t)H5I_DATASETID_HASHSIZE, H5D_RESERVED_ATOMS, (H5I_free_t)H5D_close)<H5I_FILE) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize interface") - /* =========Dataset Transfer Property Class Initialization========= */ - /* Register the default dataset transfer properties */ - assert(H5P_CLS_DATASET_XFER_g!=(-1)); - - /* Get the pointer to the dataset transfer class */ - if (NULL == (xfer_pclass = H5I_object(H5P_CLS_DATASET_XFER_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Get the number of properties in the class */ - if(H5P_get_nprops_pclass(xfer_pclass,&nprops,FALSE)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties") - - /* Assume that if there are properties in the class, they are the default ones */ - if(nprops==0) { - /* Register the max. temp buffer size property */ - if(H5P_register(xfer_pclass,H5D_XFER_MAX_TEMP_BUF_NAME,H5D_XFER_MAX_TEMP_BUF_SIZE,&def_max_temp_buf,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the type conversion buffer property */ - if(H5P_register(xfer_pclass,H5D_XFER_TCONV_BUF_NAME,H5D_XFER_TCONV_BUF_SIZE,&def_tconv_buf,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the background buffer property */ - if(H5P_register(xfer_pclass,H5D_XFER_BKGR_BUF_NAME,H5D_XFER_BKGR_BUF_SIZE,&def_bkgr_buf,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the background buffer type property */ - if(H5P_register(xfer_pclass,H5D_XFER_BKGR_BUF_TYPE_NAME,H5D_XFER_BKGR_BUF_TYPE_SIZE,&def_bkgr_buf_type,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the B-Tree node splitting ratios property */ - if(H5P_register(xfer_pclass,H5D_XFER_BTREE_SPLIT_RATIO_NAME,H5D_XFER_BTREE_SPLIT_RATIO_SIZE,def_btree_split_ratio,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the vlen allocation function property */ - if(H5P_register(xfer_pclass,H5D_XFER_VLEN_ALLOC_NAME,H5D_XFER_VLEN_ALLOC_SIZE,&def_vlen_alloc,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the vlen allocation information property */ - if(H5P_register(xfer_pclass,H5D_XFER_VLEN_ALLOC_INFO_NAME,H5D_XFER_VLEN_ALLOC_INFO_SIZE,&def_vlen_alloc_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the vlen free function property */ - if(H5P_register(xfer_pclass,H5D_XFER_VLEN_FREE_NAME,H5D_XFER_VLEN_FREE_SIZE,&def_vlen_free,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the vlen free information property */ - if(H5P_register(xfer_pclass,H5D_XFER_VLEN_FREE_INFO_NAME,H5D_XFER_VLEN_FREE_INFO_SIZE,&def_vlen_free_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the file driver ID property */ - if(H5P_register(xfer_pclass,H5D_XFER_VFL_ID_NAME,H5D_XFER_VFL_ID_SIZE,&def_vfl_id,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the file driver info property */ - if(H5P_register(xfer_pclass,H5D_XFER_VFL_INFO_NAME,H5D_XFER_VFL_INFO_SIZE,&def_vfl_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the vector size property */ - if(H5P_register(xfer_pclass,H5D_XFER_HYPER_VECTOR_SIZE_NAME,H5D_XFER_HYPER_VECTOR_SIZE_SIZE,&def_hyp_vec_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - -#ifdef H5_HAVE_PARALLEL - /* Register the I/O transfer mode property */ - if(H5P_register(xfer_pclass,H5D_XFER_IO_XFER_MODE_NAME,H5D_XFER_IO_XFER_MODE_SIZE,&def_io_xfer_mode,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register(xfer_pclass,H5D_XFER_IO_XFER_OPT_MODE_NAME,H5D_XFER_IO_XFER_OPT_MODE_SIZE,&def_io_xfer_opt_mode,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register(xfer_pclass,H5D_XFER_MPIO_COLLECTIVE_OPT_NAME,H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE,&def_mpio_collective_opt_mode,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register(xfer_pclass,H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME,H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE,&def_mpio_chunk_opt_mode,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register(xfer_pclass,H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME,H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE,&def_mpio_chunk_opt_num,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - if(H5P_register(xfer_pclass,H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME,H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE,&def_mpio_chunk_opt_ratio,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") -#endif /* H5_HAVE_PARALLEL */ - - /* Register the EDC property */ - if(H5P_register(xfer_pclass,H5D_XFER_EDC_NAME,H5D_XFER_EDC_SIZE,&enable_edc,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the filter callback property */ - if(H5P_register(xfer_pclass,H5D_XFER_FILTER_CB_NAME,H5D_XFER_FILTER_CB_SIZE,&filter_cb,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the type conversion callback property */ - if(H5P_register(xfer_pclass,H5D_XFER_CONV_CB_NAME,H5D_XFER_CONV_CB_SIZE,&conv_cb,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the data transform property */ - if(H5P_register(xfer_pclass,H5D_XFER_XFORM_NAME,H5D_XFER_XFORM_SIZE,&def_xfer_xform,NULL,NULL,NULL,H5D_XFER_XFORM_DEL,H5D_XFER_XFORM_COPY,NULL,H5D_XFER_XFORM_CLOSE)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - } /* end if */ - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_DATASET_XFER_g==(-1)) { - /* Register the default data transfer property list */ - if ((H5P_LST_DATASET_XFER_g = H5P_create_id (xfer_pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list") - } /* end if */ - - /* =========Dataset Creation Property Class Initialization========== */ - /* Register the default dataset creation properties */ - assert(H5P_CLS_DATASET_CREATE_g != -1); - - /* Get the pointer to the dataset creation class */ - if(NULL == (crt_pclass = H5I_object(H5P_CLS_DATASET_CREATE_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Get the number of properties in the class */ - if(H5P_get_nprops_pclass(crt_pclass,&nprops,FALSE)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties") - - /* Assume that if there are properties in the class, they are the default ones */ - if(nprops==0) { - /* Register the storage layout property */ - if(H5P_register(crt_pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &layout, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the chunking dimensionality property */ - if(H5P_register(crt_pclass, H5D_CRT_CHUNK_DIM_NAME, H5D_CRT_CHUNK_DIM_SIZE, &chunk_ndims, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the chunking size property */ - if(H5P_register(crt_pclass, H5D_CRT_CHUNK_SIZE_NAME, H5D_CRT_CHUNK_SIZE_SIZE, chunk_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the fill value property */ - if(H5P_register(crt_pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &fill, NULL, NULL, NULL, NULL, NULL, H5D_CRT_FILL_VALUE_CMP, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the space allocation time property */ - if(H5P_register(crt_pclass, H5D_CRT_ALLOC_TIME_NAME, H5D_CRT_ALLOC_TIME_SIZE, &alloc_time, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the space allocation time state property */ - if(H5P_register(crt_pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &alloc_time_state, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the fill value writing time property */ - if(H5P_register(crt_pclass, H5D_CRT_FILL_TIME_NAME, H5D_CRT_FILL_TIME_SIZE, &fill_time, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the external file list property */ - if(H5P_register(crt_pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &efl, NULL, NULL, NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the data pipeline property */ - if(H5P_register(crt_pclass, H5D_CRT_DATA_PIPELINE_NAME, H5D_CRT_DATA_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5D_CRT_DATA_PIPELINE_CMP, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - } /* end if */ - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_DATASET_CREATE_g==(-1)) { - /* Register the default data transfer property list */ - if ((H5P_LST_DATASET_CREATE_g = H5P_create_id (crt_pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list") - } /* end if */ - /* Reset the "default dataset" information */ - HDmemset(&H5D_def_dset,0,sizeof(H5D_shared_t)); + HDmemset(&H5D_def_dset, 0, sizeof(H5D_shared_t)); - /* Get the default dataset cretion property list values and initialize the + /* Get the default dataset creation property list values and initialize the * default dataset with them. */ - if (NULL == (def_dcpl = H5I_object(H5P_LST_DATASET_CREATE_g))) + if(NULL == (def_dcpl = H5I_object(H5P_LST_DATASET_CREATE_g))) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get default dataset creation property list") /* Set up the default allocation time information */ @@ -421,37 +183,23 @@ H5D_init_interface(void) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") /* Get the default fill value time */ - if (H5P_get(def_dcpl, H5D_CRT_FILL_TIME_NAME, &H5D_def_dset.fill_time) < 0) + if(H5P_get(def_dcpl, H5D_CRT_FILL_TIME_NAME, &H5D_def_dset.fill_time) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill time") /* Get the default fill value */ - if (H5P_get(def_dcpl, H5D_CRT_FILL_VALUE_NAME, &H5D_def_dset.fill) < 0) + if(H5P_get(def_dcpl, H5D_CRT_FILL_VALUE_NAME, &H5D_def_dset.fill) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill value") /* Reset the "default DXPL cache" information */ - HDmemset(&H5D_def_dxpl_cache,0,sizeof(H5D_dxpl_cache_t)); + HDmemset(&H5D_def_dxpl_cache, 0, sizeof(H5D_dxpl_cache_t)); /* Get the default DXPL cache information */ - if (H5D_get_dxpl_cache_real(H5P_DATASET_XFER_DEFAULT, &H5D_def_dxpl_cache) < 0) + if(H5D_get_dxpl_cache_real(H5P_DATASET_XFER_DEFAULT, &H5D_def_dxpl_cache) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve default DXPL info") - /* ========== Dataset Access Property Class Initialization ============*/ - assert(H5P_CLS_DATASET_ACCESS_g!=-1); - - /* Get the pointer to dataset creation class */ - if(NULL == (acc_pclass = H5I_object(H5P_CLS_DATASET_ACCESS_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_DATASET_ACCESS_g == (-1)) { - /* Register the default dataset access property list */ - if((H5P_LST_DATASET_ACCESS_g = H5P_create_id(acc_pclass))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") - } /* end if */ - done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5D_init_interface() */ /*------------------------------------------------------------------------- @@ -510,606 +258,6 @@ H5D_term_interface(void) FUNC_LEAVE_NOAPI(n) } -/*------------------------------------------------------------------------- - * Function: H5D_xfer_xform_del - * - * Purpose: Frees memory allocated by H5D_xfer_xform_set - * - * Return: Success: SUCCEED, Failure: FAIL - * - * Programmer: Leon Arber larber@uiuc.edu - * - * - * Date: April 9, 2004 - * - * Comments: Private function, calls private H5Z_xform_destroy - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5D_xfer_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5D_xfer_xform_del, FAIL) - - assert(value); - - if(H5Z_xform_destroy(*(H5Z_data_xform_t **)value)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing the parse tree") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5D_xfer_xform_copy - * - * Purpose: Creates a copy of the user's data transform string and its - * associated parse tree. - * - * Return: Success: SUCCEED, Failure: FAIL - * - * Programmer: Leon Arber larber@uiuc.edu - * - * - * Date: April 9, 2004 - * - * Comments: Public function, calls private H5Z_xform_copy_tree - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5D_xfer_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5D_xfer_xform_copy, FAIL) - - if(H5Z_xform_copy((H5Z_data_xform_t **)value)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error copying the data transform info") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5D_xfer_xform_close - * - * Purpose: Frees memory allocated by H5D_xfer_xform_set - * - * Return: Success: SUCCEED, Failure: FAIL - * - * Programmer: Leon Arber larber@uiuc.edu - * - * Date: April 9, 2004 - * - * Comments: private function, calls H5Z_xform_destroy_parse_tree - * Identical to H5D_xfer_xform_del - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -static herr_t -H5D_xfer_xform_close(const char UNUSED *name, size_t UNUSED size, void *value) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5D_xfer_xform_close, FAIL) - - assert(value); - - if(H5Z_xform_destroy(*(H5Z_data_xform_t **)value)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing the parse tree") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5D_crt_copy - * - * Purpose: Callback routine which is called whenever any dataset - * creation property list is copied. This routine copies - * the properties from the old list to the new list. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Raymond Lu - * Tuesday, October 2, 2001 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -herr_t -H5D_crt_copy(hid_t new_plist_id, hid_t old_plist_id, void UNUSED *copy_data) -{ - H5O_fill_t src_fill, dst_fill; - H5O_efl_t src_efl, dst_efl; - H5O_pline_t src_pline, dst_pline; - H5P_genplist_t *old_plist; - H5P_genplist_t *new_plist; - herr_t ret_value=SUCCEED; - - FUNC_ENTER_NOAPI(H5D_crt_copy, FAIL) - - /* Verify property list ID */ - if (NULL == (new_plist = H5I_object(new_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") - if (NULL == (old_plist = H5I_object(old_plist_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") - - /* Get the fill value, external file list, and data pipeline properties - * from the old property list */ - if(H5P_get(old_plist, H5D_CRT_FILL_VALUE_NAME, &src_fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") - if(H5P_get(old_plist, H5D_CRT_EXT_FILE_LIST_NAME, &src_efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") - if(H5P_get(old_plist, H5D_CRT_DATA_PIPELINE_NAME, &src_pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Make copies of fill value, external file list, and data pipeline */ - if(src_fill.buf) { - if(NULL==H5O_copy(H5O_FILL_ID, &src_fill, &dst_fill)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy fill value") - } /* end if */ - else { - dst_fill.type = dst_fill.buf = NULL; - dst_fill.size = src_fill.size; - } - HDmemset(&dst_efl,0,sizeof(H5O_efl_t)); - if(NULL==H5O_copy(H5O_EFL_ID, &src_efl, &dst_efl)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy external file list") - if(NULL==H5O_copy(H5O_PLINE_ID, &src_pline, &dst_pline)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy data pipeline") - - /* Set the fill value, external file list, and data pipeline property - * for the new property list */ - if(H5P_set(new_plist, H5D_CRT_FILL_VALUE_NAME, &dst_fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value") - if(H5P_set(new_plist, H5D_CRT_EXT_FILE_LIST_NAME, &dst_efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list") - if(H5P_set(new_plist, H5D_CRT_DATA_PIPELINE_NAME, &dst_pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5D_crt_close - * - * Purpose: Callback routine which is called whenever any dataset create - * property list is closed. This routine performs any generic - * cleanup needed on the properties the library put into the list. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Quincey Koziol - * Wednesday, July 11, 2001 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -herr_t -H5D_crt_close(hid_t dcpl_id, void UNUSED *close_data) -{ - H5O_fill_t fill; - H5O_efl_t efl; - H5O_pline_t pline; - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5D_crt_close, FAIL) - - /* Check arguments */ - if (NULL == (plist = H5I_object(dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") - - /* Get the fill value, external file list, and data pipeline properties - * from the old property list */ - if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") - if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") - if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") - - /* Clean up any values set for the fill-value, external file-list and - * data pipeline */ - if(H5O_reset(H5O_FILL_ID, &fill)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release fill info") - if(H5O_reset(H5O_EFL_ID, &efl)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release external file list info") - if(H5O_reset(H5O_PLINE_ID, &pline)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release pipeline info") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_crt_close() */ - - -/*------------------------------------------------------------------------- - * Function: H5D_crt_fill_value_cmp - * - * Purpose: Callback routine which is called whenever the fill value - * property in the dataset creation property list is compared. - * - * Return: positive if VALUE1 is greater than VALUE2, negative if - * VALUE2 is greater than VALUE1 and zero if VALUE1 and - * VALUE2 are equal. - * - * Programmer: Quincey Koziol - * Wednesday, January 7, 2004 - * - *------------------------------------------------------------------------- - */ -static int -H5D_crt_fill_value_cmp(const void *value1, const void *value2, size_t UNUSED size) -{ - const H5O_fill_t *fill1=(const H5O_fill_t *)value1, /* Create local aliases for values */ - *fill2=(const H5O_fill_t *)value2; - int cmp_value; /* Value from comparison */ - herr_t ret_value=0; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_crt_fill_value_cmp) - - /* Sanity check */ - assert(fill1); - assert(fill2); - assert(size==sizeof(H5O_fill_t)); - - /* Check the size of fill values */ - if(fill1->size < fill2->size) HGOTO_DONE(-1); - if(fill1->size > fill2->size) HGOTO_DONE(1); - - /* Check the types of the fill values */ - if(fill1->type==NULL && fill2->type!=NULL) HGOTO_DONE(-1); - if(fill1->type!=NULL && fill2->type==NULL) HGOTO_DONE(1); - if(fill1->type!=NULL) - if((cmp_value=H5T_cmp(fill1->type,fill2->type, FALSE))!=0) - HGOTO_DONE(cmp_value); - - /* Check the fill values in the buffers */ - if(fill1->buf==NULL && fill2->buf!=NULL) HGOTO_DONE(-1); - if(fill1->buf!=NULL && fill2->buf==NULL) HGOTO_DONE(1); - if(fill1->buf!=NULL) - if((cmp_value=HDmemcmp(fill1->buf,fill2->buf,fill1->size))!=0) - HGOTO_DONE(cmp_value); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_crt_fill_value_cmp() */ - - -/*------------------------------------------------------------------------- - * Function: H5D_crt_ext_file_list_cmp - * - * Purpose: Callback routine which is called whenever the external file - * list property in the dataset creation property list is - * compared. - * - * Return: positive if VALUE1 is greater than VALUE2, negative if - * VALUE2 is greater than VALUE1 and zero if VALUE1 and - * VALUE2 are equal. - * - * Programmer: Quincey Koziol - * Wednesday, January 7, 2004 - * - *------------------------------------------------------------------------- - */ -static int -H5D_crt_ext_file_list_cmp(const void *value1, const void *value2, size_t UNUSED size) -{ - const H5O_efl_t *efl1=(const H5O_efl_t *)value1, /* Create local aliases for values */ - *efl2=(const H5O_efl_t *)value2; - int cmp_value; /* Value from comparison */ - herr_t ret_value=0; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_crt_ext_file_list_cmp) - - /* Sanity check */ - assert(efl1); - assert(efl2); - assert(size==sizeof(H5O_efl_t)); - - /* Check the heap address of external file lists */ - if(H5F_addr_defined(efl1->heap_addr) || H5F_addr_defined(efl2->heap_addr)) { - if(!H5F_addr_defined(efl1->heap_addr) && H5F_addr_defined(efl2->heap_addr)) HGOTO_DONE(-1); - if(H5F_addr_defined(efl1->heap_addr) && !H5F_addr_defined(efl2->heap_addr)) HGOTO_DONE(1); - if((cmp_value=H5F_addr_cmp(efl1->heap_addr,efl2->heap_addr))!=0) - HGOTO_DONE(cmp_value); - } /* end if */ - - /* Check the number of allocated efl entries */ - if(efl1->nalloc < efl2->nalloc) HGOTO_DONE(-1); - if(efl1->nalloc > efl2->nalloc) HGOTO_DONE(1); - - /* Check the number of used efl entries */ - if(efl1->nused < efl2->nused) HGOTO_DONE(-1); - if(efl1->nused > efl2->nused) HGOTO_DONE(1); - - /* Check the efl entry information */ - if(efl1->slot==NULL && efl2->slot!=NULL) HGOTO_DONE(-1); - if(efl1->slot!=NULL && efl2->slot==NULL) HGOTO_DONE(1); - if(efl1->slot!=NULL && efl1->nused>0) { - size_t u; /* Local index variable */ - - /* Loop through all entries, comparing them */ - for(u=0; u<efl1->nused; u++) { - /* Check the name offset of the efl entry */ - if(efl1->slot[u].name_offset < efl2->slot[u].name_offset) HGOTO_DONE(-1); - if(efl1->slot[u].name_offset > efl2->slot[u].name_offset) HGOTO_DONE(1); - - /* Check the name of the efl entry */ - if(efl1->slot[u].name==NULL && efl2->slot[u].name!=NULL) HGOTO_DONE(-1); - if(efl1->slot[u].name!=NULL && efl2->slot[u].name==NULL) HGOTO_DONE(1); - if(efl1->slot[u].name!=NULL) - if((cmp_value=HDstrcmp(efl1->slot[u].name,efl2->slot[u].name))!=0) - HGOTO_DONE(cmp_value); - - /* Check the file offset of the efl entry */ - if(efl1->slot[u].offset < efl2->slot[u].offset) HGOTO_DONE(-1); - if(efl1->slot[u].offset > efl2->slot[u].offset) HGOTO_DONE(1); - - /* Check the file size of the efl entry */ - if(efl1->slot[u].size < efl2->slot[u].size) HGOTO_DONE(-1); - if(efl1->slot[u].size > efl2->slot[u].size) HGOTO_DONE(1); - } /* end for */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_crt_ext_file_list_cmp() */ - - -/*------------------------------------------------------------------------- - * Function: H5D_crt_data_pipeline_cmp - * - * Purpose: Callback routine which is called whenever the filter pipeline - * property in the dataset creation property list is compared. - * - * Return: positive if VALUE1 is greater than VALUE2, negative if - * VALUE2 is greater than VALUE1 and zero if VALUE1 and - * VALUE2 are equal. - * - * Programmer: Quincey Koziol - * Wednesday, January 7, 2004 - * - *------------------------------------------------------------------------- - */ -static int -H5D_crt_data_pipeline_cmp(const void *value1, const void *value2, size_t UNUSED size) -{ - const H5O_pline_t *pline1=(const H5O_pline_t *)value1, /* Create local aliases for values */ - *pline2=(const H5O_pline_t *)value2; - int cmp_value; /* Value from comparison */ - herr_t ret_value=0; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_crt_data_pipeline_cmp) - - /* Sanity check */ - assert(pline1); - assert(pline2); - assert(size==sizeof(H5O_pline_t)); - - /* Check the number of allocated pipeline entries */ - if(pline1->nalloc < pline2->nalloc) HGOTO_DONE(-1); - if(pline1->nalloc > pline2->nalloc) HGOTO_DONE(1); - - /* Check the number of used pipeline entries */ - if(pline1->nused < pline2->nused) HGOTO_DONE(-1); - if(pline1->nused > pline2->nused) HGOTO_DONE(1); - - /* Check the filter entry information */ - if(pline1->filter==NULL && pline2->filter!=NULL) HGOTO_DONE(-1); - if(pline1->filter!=NULL && pline2->filter==NULL) HGOTO_DONE(1); - if(pline1->filter!=NULL && pline1->nused>0) { - size_t u; /* Local index variable */ - - /* Loop through all filters, comparing them */ - for(u=0; u<pline1->nused; u++) { - /* Check the ID of the filter */ - if(pline1->filter[u].id < pline2->filter[u].id) HGOTO_DONE(-1); - if(pline1->filter[u].id > pline2->filter[u].id) HGOTO_DONE(1); - - /* Check the flags for the filter */ - if(pline1->filter[u].flags < pline2->filter[u].flags) HGOTO_DONE(-1); - if(pline1->filter[u].flags > pline2->filter[u].flags) HGOTO_DONE(1); - - /* Check the name of the filter */ - if(pline1->filter[u].name==NULL && pline2->filter[u].name!=NULL) HGOTO_DONE(-1); - if(pline1->filter[u].name!=NULL && pline2->filter[u].name==NULL) HGOTO_DONE(1); - if(pline1->filter[u].name!=NULL) - if((cmp_value=HDstrcmp(pline1->filter[u].name,pline2->filter[u].name))!=0) - HGOTO_DONE(cmp_value); - - /* Check the number of parameters for the filter */ - if(pline1->filter[u].cd_nelmts < pline2->filter[u].cd_nelmts) HGOTO_DONE(-1); - if(pline1->filter[u].cd_nelmts > pline2->filter[u].cd_nelmts) HGOTO_DONE(1); - - /* Check the filter parameter information */ - if(pline1->filter[u].cd_values==NULL && pline2->filter[u].cd_values!=NULL) HGOTO_DONE(-1); - if(pline1->filter[u].cd_values!=NULL && pline2->filter[u].cd_values==NULL) HGOTO_DONE(1); - if(pline1->filter[u].cd_values!=NULL && pline1->filter[u].cd_nelmts>0) { - size_t v; /* Local index variable */ - - /* Loop through all parameters, comparing them */ - for(v=0; v<pline1->filter[u].cd_nelmts; v++) { - /* Check each parameter for the filter */ - if(pline1->filter[u].cd_values[v] < pline2->filter[u].cd_values[v]) HGOTO_DONE(-1); - if(pline1->filter[u].cd_values[v] > pline2->filter[u].cd_values[v]) HGOTO_DONE(1); - } /* end for */ - } /* end if */ - } /* end for */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_crt_data_pipeline_cmp() */ - - -/*------------------------------------------------------------------------- - * Function: H5D_xfer_create - * - * Purpose: Callback routine which is called whenever any dataset transfer - * property list is created. This routine performs any generic - * initialization needed on the properties the library put into - * the list. - * Right now, it's just allocating the driver-specific dataset - * transfer information. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Quincey Koziol - * Thursday, August 2, 2001 - * - * Notes: This same routine is currently used for the 'copy' callback. - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -herr_t -H5D_xfer_create(hid_t dxpl_id, void UNUSED *create_data) -{ - hid_t driver_id; /* VFL driver ID */ - void *driver_info; /* VFL driver info */ - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5D_xfer_create, FAIL) - - /* Check arguments */ - if (NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") - - /* Get the driver information */ - if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID") - if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver info") - - /* Check if we have a valid driver ID */ - if(driver_id>0) { - /* Set the driver for the property list */ - if(H5FD_dxpl_open(plist, driver_id, driver_info)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_xfer_create() */ - - -/*------------------------------------------------------------------------- - * Function: H5D_xfer_copy - * - * Purpose: Callback routine which is called whenever any dataset - * transfer property list is copied. This routine copies - * the properties from the old list to the new list. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Raymond Lu - * Tuesday, October 2, 2001 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -herr_t -H5D_xfer_copy(hid_t new_dxpl_id, hid_t old_dxpl_id, void UNUSED *copy_data) -{ - hid_t driver_id; - void* driver_info; - H5P_genplist_t *new_plist; /* New property list */ - H5P_genplist_t *old_plist; /* Old property list */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5D_xfer_copy, FAIL) - - if(NULL == (new_plist = H5I_object(new_dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - if(NULL == (old_plist = H5I_object(old_dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - - /* Get values from old property list */ - if(H5P_get(old_plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID") - if(H5P_get(old_plist, H5D_XFER_VFL_INFO_NAME, &driver_info)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info") - - if(driver_id > 0) { - /* Set the driver for the property list */ - if(H5FD_dxpl_open(new_plist, driver_id, driver_info)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*------------------------------------------------------------------------- - * Function: H5D_xfer_close - * - * Purpose: Callback routine which is called whenever any dataset transfer - * property list is closed. This routine performs any generic - * cleanup needed on the properties the library put into the list. - * Right now, it's just freeing the driver-specific dataset - * transfer information. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Quincey Koziol - * Wednesday, July 11, 2001 - * - *------------------------------------------------------------------------- - */ -/* ARGSUSED */ -herr_t -H5D_xfer_close(hid_t dxpl_id, void UNUSED *close_data) -{ - hid_t driver_id; /* VFL driver ID */ - void *driver_info; /* VFL driver info */ - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5D_xfer_close, FAIL) - - /* Check arguments */ - if (NULL == (plist = H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") - - if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID") - if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info") - if(driver_id>0) { - /* Close the driver for the property list */ - if(H5FD_dxpl_close(driver_id, driver_info)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D_xfer_close() */ - /*-------------------------------------------------------------------------- NAME @@ -1134,28 +282,28 @@ static herr_t H5D_get_dcpl_cache(hid_t dcpl_id, H5D_dcpl_cache_t *cache) { H5P_genplist_t *dc_plist; /* Data transfer property list */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_get_dcpl_cache) /* Check args */ - assert(cache); + HDassert(cache); /* Get the dataset transfer property list */ if (NULL == (dc_plist = H5I_object(dcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") /* Get I/O pipeline info */ - if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &cache->pline)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve I/O pipeline info") + if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &cache->pline) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve I/O pipeline info") /* Get fill value info */ - if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &cache->fill)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve fill value info") + if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &cache->fill) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve fill value info") /* Get fill time info */ - if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &cache->fill_time)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve fill time") + if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &cache->fill_time) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve fill time") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2697,7 +1845,7 @@ done: static herr_t H5D_open_oid(H5D_t *dataset, hid_t dxpl_id) { - H5O_fill_new_t fill = {NULL, 0, NULL, H5D_ALLOC_TIME_LATE, H5D_CRT_FILL_TIME_DEF, TRUE}; + H5O_fill_new_t fill = {NULL, 0, NULL, H5D_ALLOC_TIME_LATE, H5D_FILL_TIME_IFSET, TRUE}; unsigned alloc_time_state; /* Allocation time state */ H5O_fill_t *fill_prop; /* Pointer to dataset's fill value area */ H5O_pline_t pline; /* I/O pipeline information */ @@ -2840,7 +1988,7 @@ H5D_open_oid(H5D_t *dataset, hid_t dxpl_id) } /* end switch */ /*lint !e788 All appropriate cases are covered */ /* Set the default fill time */ - fill.fill_time=H5D_CRT_FILL_TIME_DEF; + fill.fill_time = H5D_FILL_TIME_IFSET; } /* end if */ if(fill.fill_defined) { if(NULL==H5O_copy(H5O_FILL_ID, &fill, fill_prop)) diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 09b83ec..ec8508c 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -133,7 +133,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) size_t npoints; /* Number of points in space */ size_t ptsperbuf; /* Maximum # of points which fit in the buffer */ size_t elmt_size; /* Size of each element */ - size_t bufsize=H5D_XFER_MAX_TEMP_BUF_DEF; /* Size of buffer to write */ + size_t bufsize = H5D_TEMP_BUF_SIZE; /* Size of buffer to write */ size_t size; /* Current # of points to write */ hsize_t offset; /* Offset of dataset */ void *buf = NULL; /* Buffer for fill value writing */ @@ -1042,7 +1042,7 @@ H5D_contig_copy(H5F_t *f_src, H5O_layout_t *layout_src, H5F_t *f_dst, /* Set up number of bytes to copy, and initial buffer size */ total_src_nbytes = layout_src->u.contig.size; H5_CHECK_OVERFLOW(total_src_nbytes,hsize_t,size_t); - buf_size = MIN(H5D_XFER_MAX_TEMP_BUF_DEF, (size_t)total_src_nbytes); + buf_size = MIN(H5D_TEMP_BUF_SIZE, (size_t)total_src_nbytes); /* If there's a source datatype, set up type conversion information */ if(dt_src) { diff --git a/src/H5Dio.c b/src/H5Dio.c index 333852e..dbaae38 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -1026,7 +1026,7 @@ H5D_contig_read(H5D_io_info_t *io_info, hsize_t nelmts, * to the same size as the default, and then the dataset elements are * too large for the buffer... - QAK */ - if(target_size==H5D_XFER_MAX_TEMP_BUF_DEF) { + if(target_size == H5D_TEMP_BUF_SIZE) { /* If the buffer is too small to hold even one element, make it bigger */ if(target_size<max_type_size) target_size = max_type_size; @@ -1283,7 +1283,7 @@ H5D_contig_write(H5D_io_info_t *io_info, hsize_t nelmts, * to the same size as the default, and then the dataset elements are * too large for the buffer... - QAK */ - if(target_size==H5D_XFER_MAX_TEMP_BUF_DEF) { + if(target_size == H5D_TEMP_BUF_SIZE) { /* If the buffer is too small to hold even one element, make it bigger */ if(target_size<max_type_size) target_size = max_type_size; @@ -1570,7 +1570,7 @@ H5D_chunk_read(H5D_io_info_t *io_info, hsize_t nelmts, * to the same size as the default, and then the dataset elements are * too large for the buffer... - QAK */ - if(target_size==H5D_XFER_MAX_TEMP_BUF_DEF) { + if(target_size == H5D_TEMP_BUF_SIZE) { /* If the buffer is too small to hold even one element, make it bigger */ if(target_size<max_type_size) target_size = max_type_size; @@ -1891,7 +1891,7 @@ H5D_chunk_write(H5D_io_info_t *io_info, hsize_t nelmts, * to the same size as the default, and then the dataset elements are * too large for the buffer... - QAK */ - if(target_size==H5D_XFER_MAX_TEMP_BUF_DEF) { + if(target_size == H5D_TEMP_BUF_SIZE) { /* If the buffer is too small to hold even one element, make it bigger */ if(target_size<max_type_size) target_size = max_type_size; diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 7e5b5ce..70c8c7a 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -54,6 +54,7 @@ (io_info)->dxpl_id=dxpl_i; \ (io_info)->store=str + /****************************/ /* Package Private Typedefs */ /****************************/ diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 537aa76..9a4b024 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -40,152 +40,44 @@ # undef H5D_DEBUG #endif -/* ======== Dataset creation properties ======== */ -/* Definitions for storage layout property */ -#define H5D_CRT_LAYOUT_NAME "layout" -#define H5D_CRT_LAYOUT_SIZE sizeof(H5D_layout_t) -#define H5D_CRT_LAYOUT_DEF H5D_CONTIGUOUS -/* Definitions for chunk dimensionality property */ -#define H5D_CRT_CHUNK_DIM_NAME "chunk_ndims" -#define H5D_CRT_CHUNK_DIM_SIZE sizeof(unsigned) -#define H5D_CRT_CHUNK_DIM_DEF 1 -/* Definitions for chunk size */ -#define H5D_CRT_CHUNK_SIZE_NAME "chunk_size" -#define H5D_CRT_CHUNK_SIZE_SIZE sizeof(size_t[H5O_LAYOUT_NDIMS]) -#define H5D_CRT_CHUNK_SIZE_DEF {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,\ - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} -/* Definitions for fill value. size=0 means fill value will be 0 as - * library default; size=-1 means fill value is undefined. */ -#define H5D_CRT_FILL_VALUE_NAME "fill_value" -#define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t) -#define H5D_CRT_FILL_VALUE_DEF {NULL, 0, NULL} -#define H5D_CRT_FILL_VALUE_CMP H5D_crt_fill_value_cmp -/* Definitions for space allocation time */ -#define H5D_CRT_ALLOC_TIME_NAME "alloc_time" -#define H5D_CRT_ALLOC_TIME_SIZE sizeof(H5D_alloc_time_t) -#define H5D_CRT_ALLOC_TIME_DEF H5D_ALLOC_TIME_LATE -#define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state" -#define H5D_CRT_ALLOC_TIME_STATE_SIZE sizeof(unsigned) -#define H5D_CRT_ALLOC_TIME_STATE_DEF 1 -/* Definitions for time of fill value writing */ -#define H5D_CRT_FILL_TIME_NAME "fill_time" -#define H5D_CRT_FILL_TIME_SIZE sizeof(H5D_fill_time_t) -#define H5D_CRT_FILL_TIME_DEF H5D_FILL_TIME_IFSET -/* Definitions for external file list */ -#define H5D_CRT_EXT_FILE_LIST_NAME "efl" -#define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t) -#define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL} -#define H5D_CRT_EXT_FILE_LIST_CMP H5D_crt_ext_file_list_cmp -/* Definitions for data filter pipeline */ -#define H5D_CRT_DATA_PIPELINE_NAME "pline" -#define H5D_CRT_DATA_PIPELINE_SIZE sizeof(H5O_pline_t) -#define H5D_CRT_DATA_PIPELINE_DEF {0, 0, NULL} -#define H5D_CRT_DATA_PIPELINE_CMP H5D_crt_data_pipeline_cmp +/* ======== Dataset creation property names ======== */ +#define H5D_CRT_LAYOUT_NAME "layout" /* Storage layout */ +#define H5D_CRT_CHUNK_DIM_NAME "chunk_ndims" /* Chunk dimensionality */ +#define H5D_CRT_CHUNK_SIZE_NAME "chunk_size" /* Chunk size */ +#define H5D_CRT_FILL_VALUE_NAME "fill_value" /* Fill value */ +#define H5D_CRT_ALLOC_TIME_NAME "alloc_time" /* Space allocation time */ +#define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state" /* Space allocation time state */ +#define H5D_CRT_FILL_TIME_NAME "fill_time" /* Time of fill value writing */ +#define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */ +#define H5D_CRT_DATA_PIPELINE_NAME "pline" /* Data filter pipeline */ /* ======== Data transfer properties ======== */ -/* Definitions for maximum temp buffer size property */ -#define H5D_XFER_MAX_TEMP_BUF_NAME "max_temp_buf" -#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t) -#define H5D_XFER_MAX_TEMP_BUF_DEF (1024*1024) -/* Definitions for type conversion buffer property */ -#define H5D_XFER_TCONV_BUF_NAME "tconv_buf" -#define H5D_XFER_TCONV_BUF_SIZE sizeof(void *) -#define H5D_XFER_TCONV_BUF_DEF NULL -/* Definitions for background buffer property */ -#define H5D_XFER_BKGR_BUF_NAME "bkgr_buf" -#define H5D_XFER_BKGR_BUF_SIZE sizeof(void *) -#define H5D_XFER_BKGR_BUF_DEF NULL -/* Definitions for background buffer type property */ -#define H5D_XFER_BKGR_BUF_TYPE_NAME "bkgr_buf_type" -#define H5D_XFER_BKGR_BUF_TYPE_SIZE sizeof(H5T_bkg_t) -#define H5D_XFER_BKGR_BUF_TYPE_DEF H5T_BKG_NO -/* Definitions for B-tree node splitting ratio property */ -/* (These default B-tree node splitting ratios are also used for splitting - * group's B-trees as well as chunked dataset's B-trees - QAK) - */ -#define H5D_XFER_BTREE_SPLIT_RATIO_NAME "btree_split_ratio" -#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3]) -#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1, 0.5, 0.9} -/* Definitions for vlen allocation function property */ -#define H5D_XFER_VLEN_ALLOC_NAME "vlen_alloc" -#define H5D_XFER_VLEN_ALLOC_SIZE sizeof(H5MM_allocate_t) -#define H5D_XFER_VLEN_ALLOC_DEF NULL -/* Definitions for vlen allocation info property */ -#define H5D_XFER_VLEN_ALLOC_INFO_NAME "vlen_alloc_info" -#define H5D_XFER_VLEN_ALLOC_INFO_SIZE sizeof(void *) -#define H5D_XFER_VLEN_ALLOC_INFO_DEF NULL -/* Definitions for vlen free function property */ -#define H5D_XFER_VLEN_FREE_NAME "vlen_free" -#define H5D_XFER_VLEN_FREE_SIZE sizeof(H5MM_free_t) -#define H5D_XFER_VLEN_FREE_DEF NULL -/* Definitions for vlen free info property */ -#define H5D_XFER_VLEN_FREE_INFO_NAME "vlen_free_info" -#define H5D_XFER_VLEN_FREE_INFO_SIZE sizeof(void *) -#define H5D_XFER_VLEN_FREE_INFO_DEF NULL -/* Definitions for file driver ID property */ -#define H5D_XFER_VFL_ID_NAME "vfl_id" -#define H5D_XFER_VFL_ID_SIZE sizeof(hid_t) -#define H5D_XFER_VFL_ID_DEF H5FD_VFD_DEFAULT -/* Definitions for file driver info property */ -#define H5D_XFER_VFL_INFO_NAME "vfl_info" -#define H5D_XFER_VFL_INFO_SIZE sizeof(void *) -#define H5D_XFER_VFL_INFO_DEF NULL -/* Definitions for hyperslab vector size property */ -/* (Be cautious about increasing the default size, there are arrays allocated - * on the stack which depend on it - QAK) - */ -#define H5D_XFER_HYPER_VECTOR_SIZE_NAME "vec_size" -#define H5D_XFER_HYPER_VECTOR_SIZE_SIZE sizeof(size_t) -#define H5D_XFER_HYPER_VECTOR_SIZE_DEF 1024 -/* Definitions for I/O transfer mode property */ -#define H5D_XFER_IO_XFER_MODE_NAME "io_xfer_mode" -#define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t) -#define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT - -/* Definitions for I/O optimization transfer mode property(using MPI-IO independent IO with file set view) */ -#define H5D_XFER_IO_XFER_OPT_MODE_NAME "io_xfer_opt_mode" -#define H5D_XFER_IO_XFER_OPT_MODE_SIZE sizeof(H5FD_mpio_collective_opt_t) -#define H5D_XFER_IO_XFER_OPT_MODE_DEF H5FD_MPIO_COLLECTIVE_IO -/* Definitions for optimization of MPI-IO transfer mode property */ -#define H5D_XFER_MPIO_COLLECTIVE_OPT_NAME "mpio_collective_opt" -#define H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE sizeof(H5FD_mpio_collective_opt_t) -#define H5D_XFER_MPIO_COLLECTIVE_OPT_DEF H5FD_MPIO_COLLECTIVE_IO - -#define H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME "mpio_chunk_opt_hard" -#define H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE sizeof(H5FD_mpio_chunk_opt_t) -#define H5D_XFER_MPIO_CHUNK_OPT_HARD_DEF H5FD_MPIO_CHUNK_DEFAULT - -#define H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME "mpio_chunk_opt_num" -#define H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE sizeof(unsigned) -#define H5D_XFER_MPIO_CHUNK_OPT_NUM_DEF H5D_ONE_LINK_CHUNK_IO_THRESHOLD - -#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME "mpio_chunk_opt_ratio" -#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE sizeof(unsigned) -#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEF H5D_MULTI_CHUNK_IO_COL_THRESHOLD -/* Definitions for EDC property */ -#define H5D_XFER_EDC_NAME "err_detect" -#define H5D_XFER_EDC_SIZE sizeof(H5Z_EDC_t) -#define H5D_XFER_EDC_DEF H5Z_ENABLE_EDC -/* Definitions for filter callback function property */ -#define H5D_XFER_FILTER_CB_NAME "filter_cb" -#define H5D_XFER_FILTER_CB_SIZE sizeof(H5Z_cb_t) -#define H5D_XFER_FILTER_CB_DEF {NULL,NULL} -/* Definitions for type conversion callback function property */ -#define H5D_XFER_CONV_CB_NAME "type_conv_cb" -#define H5D_XFER_CONV_CB_SIZE sizeof(H5T_conv_cb_t) -#define H5D_XFER_CONV_CB_DEF {NULL,NULL} -/* Definitions for data transform property */ -#define H5D_XFER_XFORM_NAME "data_transform" -#define H5D_XFER_XFORM_SIZE sizeof(void *) -#define H5D_XFER_XFORM_DEF NULL -#define H5D_XFER_XFORM_DEL H5D_xfer_xform_del -#define H5D_XFER_XFORM_COPY H5D_xfer_xform_copy -#define H5D_XFER_XFORM_CLOSE H5D_xfer_xform_close +#define H5D_XFER_MAX_TEMP_BUF_NAME "max_temp_buf" /* Maximum temp buffer size */ +#define H5D_XFER_TCONV_BUF_NAME "tconv_buf" /* Type conversion buffer */ +#define H5D_XFER_BKGR_BUF_NAME "bkgr_buf" /* Background buffer */ +#define H5D_XFER_BKGR_BUF_TYPE_NAME "bkgr_buf_type" /* Background buffer type */ +#define H5D_XFER_BTREE_SPLIT_RATIO_NAME "btree_split_ratio" /* B-tree node splitting ratio */ +#define H5D_XFER_VLEN_ALLOC_NAME "vlen_alloc" /* Vlen allocation function */ +#define H5D_XFER_VLEN_ALLOC_INFO_NAME "vlen_alloc_info" /* Vlen allocation info */ +#define H5D_XFER_VLEN_FREE_NAME "vlen_free" /* Vlen free function */ +#define H5D_XFER_VLEN_FREE_INFO_NAME "vlen_free_info" /* Vlen free info */ +#define H5D_XFER_VFL_ID_NAME "vfl_id" /* File driver ID */ +#define H5D_XFER_VFL_INFO_NAME "vfl_info" /* File driver info */ +#define H5D_XFER_HYPER_VECTOR_SIZE_NAME "vec_size" /* Hyperslab vector size */ +#ifdef H5_HAVE_PARALLEL +#define H5D_XFER_IO_XFER_MODE_NAME "io_xfer_mode" /* I/O transfer mode */ +#define H5D_XFER_IO_XFER_OPT_MODE_NAME "io_xfer_opt_mode" /* I/O optimization transfer mode (using MPI-IO independent IO with file set view) */ +#define H5D_XFER_MPIO_COLLECTIVE_OPT_NAME "mpio_collective_opt" /* Optimization of MPI-IO transfer mode */ +#define H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME "mpio_chunk_opt_hard" +#define H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME "mpio_chunk_opt_num" +#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME "mpio_chunk_opt_ratio" +#endif /* H5_HAVE_PARALLEL */ +#define H5D_XFER_EDC_NAME "err_detect" /* EDC */ +#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */ +#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */ +#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */ #ifdef H5_HAVE_INSTRUMENTED_LIBRARY -/* Definitions for collective chunk I/O property */ -#define H5D_XFER_COLL_CHUNK_NAME "coll_chunk" -#define H5D_XFER_COLL_CHUNK_SIZE sizeof(unsigned) -#define H5D_XFER_COLL_CHUNK_DEF 1 +#define H5D_XFER_COLL_CHUNK_NAME "coll_chunk" /* Collective chunk I/O */ #define H5D_XFER_COLL_CHUNK_LINK_HARD_NAME "coll_chunk_link_hard" #define H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME "coll_chunk_multi_hard" #define H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME "coll_chunk_link_true" @@ -194,6 +86,18 @@ #define H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME "coll_chunk_multi_ind" #endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ +/* Default temporary buffer size */ +#define H5D_TEMP_BUF_SIZE (1024 * 1024) + +/* Default I/O vector size */ +#define H5D_IO_VECTOR_SIZE 1024 + +/* Default VL allocation & free info */ +#define H5D_VLEN_ALLOC NULL +#define H5D_VLEN_ALLOC_INFO NULL +#define H5D_VLEN_FREE NULL +#define H5D_VLEN_FREE_INFO NULL + /****************************/ /* Library Private Typedefs */ /****************************/ @@ -255,13 +159,6 @@ H5_DLL herr_t H5D_close(H5D_t *dataset); H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset); H5_DLL H5G_name_t *H5D_nameof(H5D_t *dataset); H5_DLL H5T_t *H5D_typeof(const H5D_t *dset); -H5_DLL herr_t H5D_crt_copy(hid_t new_plist_t, hid_t old_plist_t, - void *copy_data); -H5_DLL herr_t H5D_crt_close(hid_t dxpl_id, void *close_data); -H5_DLL herr_t H5D_xfer_create(hid_t dxpl_id, void *create_data); -H5_DLL herr_t H5D_xfer_copy(hid_t new_plist_id, hid_t old_plist_id, - void *copy_data); -H5_DLL herr_t H5D_xfer_close(hid_t dxpl_id, void *close_data); H5_DLL herr_t H5D_flush(const H5F_t *f, hid_t dxpl_id, unsigned flags); H5_DLL herr_t H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t **cache); H5_DLL herr_t H5D_get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache); diff --git a/src/H5Dselect.c b/src/H5Dselect.c index 07038c7..ce7d9a4 100644 --- a/src/H5Dselect.c +++ b/src/H5Dselect.c @@ -82,12 +82,12 @@ H5D_select_fscat (H5D_io_info_t *io_info, const void *_buf) { const uint8_t *buf=_buf; /* Alias for pointer arithmetic */ - hsize_t _off[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence offsets */ + hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */ hsize_t *off=NULL; /* Pointer to sequence offsets */ hsize_t mem_off; /* Offset in memory */ size_t mem_curr_seq; /* "Current sequence" in memory */ size_t dset_curr_seq; /* "Current sequence" in dataset */ - size_t _len[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence lengths */ + size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */ size_t *len=NULL; /* Array to store sequence lengths */ size_t orig_mem_len, mem_len; /* Length of sequence in memory */ size_t nseq; /* Number of sequences generated */ @@ -105,7 +105,7 @@ H5D_select_fscat (H5D_io_info_t *io_info, assert(TRUE==H5P_isa_class(io_info->dxpl_id,H5P_DATASET_XFER)); /* Allocate the vector I/O arrays */ - if(io_info->dxpl_cache->vec_size!=H5D_XFER_HYPER_VECTOR_SIZE_DEF) { + if(io_info->dxpl_cache->vec_size != H5D_IO_VECTOR_SIZE) { if((len = H5FL_SEQ_MALLOC(size_t,io_info->dxpl_cache->vec_size))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array"); if((off = H5FL_SEQ_MALLOC(hsize_t,io_info->dxpl_cache->vec_size))==NULL) @@ -139,7 +139,7 @@ H5D_select_fscat (H5D_io_info_t *io_info, } /* end while */ done: - if(io_info->dxpl_cache->vec_size!=H5D_XFER_HYPER_VECTOR_SIZE_DEF) { + if(io_info->dxpl_cache->vec_size != H5D_IO_VECTOR_SIZE) { if(len!=NULL) H5FL_SEQ_FREE(size_t,len); if(off!=NULL) @@ -176,12 +176,12 @@ H5D_select_fgath (H5D_io_info_t *io_info, void *_buf/*out*/) { uint8_t *buf=_buf; /* Alias for pointer arithmetic */ - hsize_t _off[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence offsets */ + hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */ hsize_t *off=NULL; /* Pointer to sequence offsets */ hsize_t mem_off; /* Offset in memory */ size_t mem_curr_seq; /* "Current sequence" in memory */ size_t dset_curr_seq; /* "Current sequence" in dataset */ - size_t _len[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence lengths */ + size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */ size_t *len=NULL; /* Pointer to sequence lengths */ size_t orig_mem_len, mem_len; /* Length of sequence in memory */ size_t nseq; /* Number of sequences generated */ @@ -200,7 +200,7 @@ H5D_select_fgath (H5D_io_info_t *io_info, assert (_buf); /* Allocate the vector I/O arrays */ - if(io_info->dxpl_cache->vec_size!=H5D_XFER_HYPER_VECTOR_SIZE_DEF) { + if(io_info->dxpl_cache->vec_size != H5D_IO_VECTOR_SIZE) { if((len = H5FL_SEQ_MALLOC(size_t,io_info->dxpl_cache->vec_size))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate I/O length vector array"); if((off = H5FL_SEQ_MALLOC(hsize_t,io_info->dxpl_cache->vec_size))==NULL) @@ -234,7 +234,7 @@ H5D_select_fgath (H5D_io_info_t *io_info, } /* end while */ done: - if(io_info->dxpl_cache->vec_size!=H5D_XFER_HYPER_VECTOR_SIZE_DEF) { + if(io_info->dxpl_cache->vec_size != H5D_IO_VECTOR_SIZE) { if(len!=NULL) H5FL_SEQ_FREE(size_t,len); if(off!=NULL) @@ -266,9 +266,9 @@ H5D_select_mscat (const void *_tscat_buf, const H5S_t *space, { uint8_t *buf=(uint8_t *)_buf; /* Get local copies for address arithmetic */ const uint8_t *tscat_buf=(const uint8_t *)_tscat_buf; - hsize_t _off[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence offsets */ + hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */ hsize_t *off=NULL; /* Pointer to sequence offsets */ - size_t _len[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence lengths */ + size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */ size_t *len=NULL; /* Pointer to sequence lengths */ size_t curr_len; /* Length of bytes left to process in sequence */ size_t nseq; /* Number of sequences generated */ @@ -286,7 +286,7 @@ H5D_select_mscat (const void *_tscat_buf, const H5S_t *space, assert (buf); /* Allocate the vector I/O arrays */ - if(dxpl_cache->vec_size!=H5D_XFER_HYPER_VECTOR_SIZE_DEF) { + if(dxpl_cache->vec_size != H5D_IO_VECTOR_SIZE) { if((len = H5FL_SEQ_MALLOC(size_t,dxpl_cache->vec_size))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array"); if((off = H5FL_SEQ_MALLOC(hsize_t,dxpl_cache->vec_size))==NULL) @@ -319,7 +319,7 @@ H5D_select_mscat (const void *_tscat_buf, const H5S_t *space, } /* end while */ done: - if(dxpl_cache->vec_size!=H5D_XFER_HYPER_VECTOR_SIZE_DEF) { + if(dxpl_cache->vec_size != H5D_IO_VECTOR_SIZE) { if(len!=NULL) H5FL_SEQ_FREE(size_t,len); if(off!=NULL) @@ -353,9 +353,9 @@ H5D_select_mgath (const void *_buf, const H5S_t *space, { const uint8_t *buf=(const uint8_t *)_buf; /* Get local copies for address arithmetic */ uint8_t *tgath_buf=(uint8_t *)_tgath_buf; - hsize_t _off[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence offsets */ + hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */ hsize_t *off=NULL; /* Pointer to sequence offsets */ - size_t _len[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence lengths */ + size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */ size_t *len=NULL; /* Pointer to sequence lengths */ size_t curr_len; /* Length of bytes left to process in sequence */ size_t nseq; /* Number of sequences generated */ @@ -373,7 +373,7 @@ H5D_select_mgath (const void *_buf, const H5S_t *space, assert (tgath_buf); /* Allocate the vector I/O arrays */ - if(dxpl_cache->vec_size!=H5D_XFER_HYPER_VECTOR_SIZE_DEF) { + if(dxpl_cache->vec_size != H5D_IO_VECTOR_SIZE) { if((len = H5FL_SEQ_MALLOC(size_t,dxpl_cache->vec_size))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "can't allocate I/O length vector array"); if((off = H5FL_SEQ_MALLOC(hsize_t,dxpl_cache->vec_size))==NULL) @@ -406,7 +406,7 @@ H5D_select_mgath (const void *_buf, const H5S_t *space, } /* end while */ done: - if(dxpl_cache->vec_size!=H5D_XFER_HYPER_VECTOR_SIZE_DEF) { + if(dxpl_cache->vec_size != H5D_IO_VECTOR_SIZE) { if(len!=NULL) H5FL_SEQ_FREE(size_t,len); if(off!=NULL) @@ -439,13 +439,13 @@ H5D_select_read(H5D_io_info_t *io_info, hbool_t mem_iter_init=0; /* Memory selection iteration info has been initialized */ H5S_sel_iter_t file_iter; /* File selection iteration info */ hbool_t file_iter_init=0; /* File selection iteration info has been initialized */ - hsize_t _mem_off[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence offsets in memory */ + hsize_t _mem_off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets in memory */ hsize_t *mem_off=NULL; /* Pointer to sequence offsets in memory */ - hsize_t _file_off[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence offsets in the file */ + hsize_t _file_off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets in the file */ hsize_t *file_off=NULL; /* Pointer to sequence offsets in the file */ - size_t _mem_len[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence lengths in memory */ + size_t _mem_len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths in memory */ size_t *mem_len=NULL; /* Pointer to sequence lengths in memory */ - size_t _file_len[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence lengths in the file */ + size_t _file_len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths in the file */ size_t *file_len=NULL; /* Pointer to sequence lengths in the file */ size_t mem_nseq; /* Number of sequences generated in the file */ size_t file_nseq; /* Number of sequences generated in memory */ @@ -477,7 +477,7 @@ H5D_select_read(H5D_io_info_t *io_info, mem_iter_init=1; /* Memory selection iteration info has been initialized */ /* Allocate the vector I/O arrays */ - if(io_info->dxpl_cache->vec_size!=H5D_XFER_HYPER_VECTOR_SIZE_DEF) { + if(io_info->dxpl_cache->vec_size != H5D_IO_VECTOR_SIZE) { if((mem_len = H5FL_SEQ_MALLOC(size_t,io_info->dxpl_cache->vec_size))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array"); if((mem_off = H5FL_SEQ_MALLOC(hsize_t,io_info->dxpl_cache->vec_size))==NULL) @@ -546,7 +546,7 @@ done: } /* end if */ /* Free vector arrays */ - if(io_info->dxpl_cache->vec_size!=H5D_XFER_HYPER_VECTOR_SIZE_DEF) { + if(io_info->dxpl_cache->vec_size != H5D_IO_VECTOR_SIZE) { if(file_len!=NULL) H5FL_SEQ_FREE(size_t,file_len); if(file_off!=NULL) @@ -583,13 +583,13 @@ H5D_select_write(H5D_io_info_t *io_info, hbool_t mem_iter_init=0; /* Memory selection iteration info has been initialized */ H5S_sel_iter_t file_iter; /* File selection iteration info */ hbool_t file_iter_init=0; /* File selection iteration info has been initialized */ - hsize_t _mem_off[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence offsets in memory */ + hsize_t _mem_off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets in memory */ hsize_t *mem_off=NULL; /* Pointer to sequence offsets in memory */ - hsize_t _file_off[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence offsets in the file */ + hsize_t _file_off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets in the file */ hsize_t *file_off=NULL; /* Pointer to sequence offsets in the file */ - size_t _mem_len[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence lengths in memory */ + size_t _mem_len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths in memory */ size_t *mem_len=NULL; /* Pointer to sequence lengths in memory */ - size_t _file_len[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence lengths in the file */ + size_t _file_len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths in the file */ size_t *file_len=NULL; /* Pointer to sequence lengths in the file */ size_t mem_nseq; /* Number of sequences generated in the file */ size_t file_nseq; /* Number of sequences generated in memory */ @@ -610,7 +610,7 @@ H5D_select_write(H5D_io_info_t *io_info, assert(buf); /* Allocate the vector I/O arrays */ - if(io_info->dxpl_cache->vec_size!=H5D_XFER_HYPER_VECTOR_SIZE_DEF) { + if(io_info->dxpl_cache->vec_size != H5D_IO_VECTOR_SIZE) { if((mem_len = H5FL_SEQ_MALLOC(size_t,io_info->dxpl_cache->vec_size))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array"); if((mem_off = H5FL_SEQ_MALLOC(hsize_t,io_info->dxpl_cache->vec_size))==NULL) @@ -689,7 +689,7 @@ done: } /* end if */ /* Free vector arrays */ - if(io_info->dxpl_cache->vec_size!=H5D_XFER_HYPER_VECTOR_SIZE_DEF) { + if(io_info->dxpl_cache->vec_size != H5D_IO_VECTOR_SIZE) { if(file_len!=NULL) H5FL_SEQ_FREE(size_t,file_len); if(file_off!=NULL) @@ -114,107 +114,17 @@ done: * Purpose: Initialize interface-specific information. * * Return: Success: non-negative - * * Failure: negative * * Programmer: Robb Matzke * Friday, November 20, 1998 * - * Modifications: - * Robb Matzke, 4 Aug 1997 - * Changed pablo mask from H5_mask to H5F_mask for the FUNC_LEAVE call. - * It was already H5F_mask for the PABLO_TRACE_ON call. - * - * Kim Yates, 1998-08-16 - * Added .disp, .btype, .ftype to H5F_access_t. - * - * Robb Matzke, 1999-02-19 - * Added initialization for the H5I_FILE_CLOSING ID group. - * - * Raymond Lu, April 10, 2000 - * Put SRB into the 'Register predefined file drivers' list. - * - * Thomas Radke, 2000-09-12 - * Put Stream VFD into the 'Register predefined file drivers' list. - * - * Raymond Lu, 2001-10-14 - * Change File creation property list to generic property list mechanism. - * - * J. Mainzer, 2005-03-10 - * Updated function for changes in property list entries required - * by the new metadata cache. - * *------------------------------------------------------------------------- */ static herr_t H5F_init_interface(void) { - size_t nprops; /* Number of properties */ - herr_t ret_value = SUCCEED; - - /* File creation property class variables. In sequence, they are - * - File create property list class to modify - * - Default value for size of file user block - * - Default value for 1/2 rank for symbol table leaf nodes - * - Default value for 1/2 rank for btree internal nodes - * - Default value for byte number in an address - * - Default value for byte number for object size - * - Default value for version number of superblock - * - Default value for free-space version number - * - Default value for object directory version number - * - Default value for share-header format version - */ - H5P_genclass_t *crt_pclass; - hsize_t userblock_size = H5F_CRT_USER_BLOCK_DEF; - unsigned sym_leaf_k = H5F_CRT_SYM_LEAF_DEF; - unsigned btree_k[H5B_NUM_BTREE_ID] = H5F_CRT_BTREE_RANK_DEF; - size_t sizeof_addr = H5F_CRT_ADDR_BYTE_NUM_DEF; - size_t sizeof_size = H5F_CRT_OBJ_BYTE_NUM_DEF; - unsigned superblock_ver = H5F_CRT_SUPER_VERS_DEF; - unsigned freespace_ver = H5F_CRT_FREESPACE_VERS_DEF; - unsigned objectdir_ver = H5F_CRT_OBJ_DIR_VERS_DEF; - unsigned sharedheader_ver = H5F_CRT_SHARE_HEAD_VERS_DEF; - /* File access property class variables. In sequence, they are - * - File access property class to modify - * - Initial metadata cache resize configuration - * - Size of raw data chunk cache(elements) - * - Size of raw data chunk cache(bytes) - * - Preemption for reading chunks - * - Threshold for alignment - * - Alignment - * - Minimum metadata allocation block size - * - Maximum sieve buffer size - * - Garbage-collect reference - * - File driver ID - * - File driver info - */ - H5P_genclass_t *acs_pclass; - H5AC_cache_config_t - mdc_initCacheCfg = H5F_ACS_META_CACHE_INIT_CONFIG_DEF; - size_t rdcc_nelmts = H5F_ACS_DATA_CACHE_ELMT_SIZE_DEF; - size_t rdcc_nbytes = H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF; - double rdcc_w0 = H5F_ACS_PREEMPT_READ_CHUNKS_DEF; - hsize_t threshold = H5F_ACS_ALIGN_THRHD_DEF; - hsize_t alignment = H5F_ACS_ALIGN_DEF; - hsize_t meta_block_size = H5F_ACS_META_BLOCK_SIZE_DEF; - size_t sieve_buf_size = H5F_ACS_SIEVE_BUF_SIZE_DEF; - hsize_t sdata_block_size = H5F_ACS_SDATA_BLOCK_SIZE_DEF; - unsigned gc_ref = H5F_ACS_GARBG_COLCT_REF_DEF; - hid_t driver_id = H5F_ACS_FILE_DRV_ID_DEF; - void *driver_info = H5F_ACS_FILE_DRV_INFO_DEF; - H5F_close_degree_t close_degree = H5F_CLOSE_DEGREE_DEF; - hsize_t family_offset = H5F_ACS_FAMILY_OFFSET_DEF; - hsize_t family_newsize = H5F_ACS_FAMILY_NEWSIZE_DEF; - hbool_t family_to_sec2 = H5F_ACS_FAMILY_TO_SEC2_DEF; - H5FD_mem_t mem_type = H5F_ACS_MULTI_TYPE_DEF; - hbool_t latest_format = H5F_ACS_LATEST_FORMAT_DEF; - - /* File mount property class variable. - * - Mount property class to modify - * - whether absolute symlinks is local to file - */ - H5P_genclass_t *mnt_pclass; - hbool_t local = H5F_MNT_SYM_LOCAL_DEF; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5F_init_interface) @@ -224,185 +134,9 @@ H5F_init_interface(void) if(H5I_register_type(H5I_FILE, (size_t)H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<H5I_FILE) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface") - /* ========== File Creation Property Class Initialization ============*/ - assert(H5P_CLS_FILE_CREATE_g!=-1); - - /* Get the pointer to file creation class */ - if(NULL == (crt_pclass = H5I_object(H5P_CLS_FILE_CREATE_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Get the number of properties in the class */ - if(H5P_get_nprops_pclass(crt_pclass,&nprops,FALSE) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties") - - /* Assume that if there are properties in the class, they are the default ones */ - if(nprops==0) { - /* Register the user block size */ - if(H5P_register(crt_pclass,H5F_CRT_USER_BLOCK_NAME,H5F_CRT_USER_BLOCK_SIZE, &userblock_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the 1/2 rank for symbol table leaf nodes */ - if(H5P_register(crt_pclass,H5F_CRT_SYM_LEAF_NAME,H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the 1/2 rank for btree internal nodes */ - if(H5P_register(crt_pclass,H5F_CRT_BTREE_RANK_NAME,H5F_CRT_BTREE_RANK_SIZE, btree_k,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the byte number for an address */ - if(H5P_register(crt_pclass,H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the byte number for object size */ - if(H5P_register(crt_pclass,H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE,&sizeof_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the superblock version number */ - if(H5P_register(crt_pclass,H5F_CRT_SUPER_VERS_NAME,H5F_CRT_SUPER_VERS_SIZE, &superblock_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the free-space version number */ - if(H5P_register(crt_pclass,H5F_CRT_FREESPACE_VERS_NAME, H5F_CRT_FREESPACE_VERS_SIZE,&freespace_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the object directory version number */ - if(H5P_register(crt_pclass,H5F_CRT_OBJ_DIR_VERS_NAME, H5F_CRT_OBJ_DIR_VERS_SIZE,&objectdir_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the shared-header version number */ - if(H5P_register(crt_pclass,H5F_CRT_SHARE_HEAD_VERS_NAME, H5F_CRT_SHARE_HEAD_VERS_SIZE, &sharedheader_ver,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - } /* end if */ - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_FILE_CREATE_g==(-1)) { - /* Register the default file creation property list */ - if((H5P_LST_FILE_CREATE_g = H5P_create_id(crt_pclass)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") - } /* end if */ - - /* ========== File Access Property Class Initialization ============*/ - assert(H5P_CLS_FILE_ACCESS_g!=-1); - - /* Get the pointer to file creation class */ - if(NULL == (acs_pclass = H5I_object(H5P_CLS_FILE_ACCESS_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Get the number of properties in the class */ - if(H5P_get_nprops_pclass(acs_pclass,&nprops,FALSE) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties") - - /* Assume that if there are properties in the class, they are the default ones */ - if(nprops==0) { - - /* Register the initial metadata cache resize configuration */ - if(H5P_register(acs_pclass,H5F_ACS_META_CACHE_INIT_CONFIG_NAME,H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the size of raw data chunk cache (elements) */ - if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME,H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the size of raw data chunk cache(bytes) */ - if(H5P_register(acs_pclass,H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME,H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the preemption for reading chunks */ - if(H5P_register(acs_pclass,H5F_ACS_PREEMPT_READ_CHUNKS_NAME,H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the threshold for alignment */ - if(H5P_register(acs_pclass,H5F_ACS_ALIGN_THRHD_NAME,H5F_ACS_ALIGN_THRHD_SIZE, &threshold,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the alignment */ - if(H5P_register(acs_pclass,H5F_ACS_ALIGN_NAME,H5F_ACS_ALIGN_SIZE, &alignment,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the minimum metadata allocation block size */ - if(H5P_register(acs_pclass,H5F_ACS_META_BLOCK_SIZE_NAME,H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the maximum sieve buffer size */ - if(H5P_register(acs_pclass,H5F_ACS_SIEVE_BUF_SIZE_NAME,H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the minimum "small data" allocation block size */ - if(H5P_register(acs_pclass,H5F_ACS_SDATA_BLOCK_SIZE_NAME,H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the garbage collection reference */ - if(H5P_register(acs_pclass,H5F_ACS_GARBG_COLCT_REF_NAME,H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the file driver ID */ - if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_ID_NAME,H5F_ACS_FILE_DRV_ID_SIZE, &driver_id,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the file driver info */ - if(H5P_register(acs_pclass,H5F_ACS_FILE_DRV_INFO_NAME,H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the file close degree */ - if(H5P_register(acs_pclass,H5F_CLOSE_DEGREE_NAME,H5F_CLOSE_DEGREE_SIZE, &close_degree,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the offset of family driver info */ - if(H5P_register(acs_pclass,H5F_ACS_FAMILY_OFFSET_NAME,H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the private property of new family file size. It's used by h5repart only. */ - if(H5P_register(acs_pclass,H5F_ACS_FAMILY_NEWSIZE_NAME,H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */ - if(H5P_register(acs_pclass,H5F_ACS_FAMILY_TO_SEC2_NAME,H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the data type of multi driver info */ - if(H5P_register(acs_pclass,H5F_ACS_MULTI_TYPE_NAME,H5F_ACS_MULTI_TYPE_SIZE, &mem_type,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - - /* Register the 'use the latest version of the format' flag */ - if(H5P_register(acs_pclass,H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &latest_format, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - } /* end if */ - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_FILE_ACCESS_g==(-1)) { - /* Register the default file access property list */ - if((H5P_LST_FILE_ACCESS_g = H5P_create_id(acs_pclass)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") - } /* end if */ - - /* ================ Mount Porperty Class Initialization ==============*/ - assert(H5P_CLS_MOUNT_g!=-1); - - /* Get the pointer to file mount class */ - if(NULL == (mnt_pclass = H5I_object(H5P_CLS_MOUNT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Get the number of properties in the class */ - if(H5P_get_nprops_pclass(mnt_pclass,&nprops,FALSE) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties") - - /* Assume that if there are properties in the class, they are the default ones */ - if(nprops==0) { - /* Register property of whether symlinks is local to file */ - if(H5P_register(mnt_pclass,H5F_MNT_SYM_LOCAL_NAME,H5F_MNT_SYM_LOCAL_SIZE, &local,NULL,NULL,NULL,NULL,NULL,NULL,NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - } /* end if */ - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_MOUNT_g==(-1)) { - /* Register the default file mount property list */ - if((H5P_LST_MOUNT_g = H5P_create_id(mnt_pclass)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") - } /* end if */ - done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5F_init_interface() */ /*------------------------------------------------------------------------- @@ -447,155 +181,6 @@ H5F_term_interface(void) FUNC_LEAVE_NOAPI(n) } - -/*---------------------------------------------------------------------------- - * Function: H5F_acs_create - * - * Purpose: Callback routine which is called whenever a file access - * property list is closed. This routine performs any generic - * initialization needed on the properties the library put into - * the list. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Raymond Lu - * Tuesday, Oct 23, 2001 - * - * Modifications: - * - *---------------------------------------------------------------------------- - */ -/* ARGSUSED */ -herr_t -H5F_acs_create(hid_t fapl_id, void UNUSED *copy_data) -{ - hid_t driver_id; - void* driver_info; - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5F_acs_create, FAIL) - - /* Check argument */ - if(NULL == (plist = H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - - /* Retrieve properties */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver ID") - if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info") - - if(driver_id > 0) { - /* Set the driver for the property list */ - if(H5FD_fapl_open(plist, driver_id, driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*-------------------------------------------------------------------------- - * Function: H5F_acs_copy - * - * Purpose: Callback routine which is called whenever a file access - * property list is copied. This routine performs any generic - * copy needed on the properties. - * - * Return: Success: Non-negative - * Failure: Negative - * Programmer: Raymond Lu - * Tuesday, Oct 23, 2001 - * - * Modifications: - * - *-------------------------------------------------------------------------- - */ -/* ARGSUSED */ -herr_t -H5F_acs_copy(hid_t new_fapl_id, hid_t old_fapl_id, void UNUSED *copy_data) -{ - hid_t driver_id; - void* driver_info; - H5P_genplist_t *new_plist; /* New property list */ - H5P_genplist_t *old_plist; /* Old property list */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5F_acs_copy, FAIL) - - if(NULL == (new_plist = H5I_object(new_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - if(NULL == (old_plist = H5I_object(old_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") - - /* Get values from old property list */ - if(H5P_get(old_plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver ID") - if(H5P_get(old_plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info") - - if(driver_id > 0) { - /* Set the driver for the property list */ - if(H5FD_fapl_open(new_plist, driver_id, driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - - -/*-------------------------------------------------------------------------- - * Function: H5F_acs_close - * - * Purpose: Callback routine which is called whenever a file access - * property list is closed. This routine performs any generic - * cleanup needed on the properties. - * - * Return: Success: Non-negative - * - * Failure: Negative - * - * Programmer: Raymond Lu - * Tuesday, Oct 23, 2001 - * - * Modifications: - * - *--------------------------------------------------------------------------- - */ -/* ARGSUSED */ -herr_t -H5F_acs_close(hid_t fapl_id, void UNUSED *close_data) -{ - hid_t driver_id; - void *driver_info; - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5F_acs_close, FAIL) - - /* Check argument */ - if(NULL == (plist = H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - - if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) - HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ - if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) - HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ - - if(driver_id > 0) { - /* Close the driver for the property list */ - if(H5FD_fapl_close(driver_id, driver_info) < 0) - HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} - #ifdef NOT_YET /*------------------------------------------------------------------------- @@ -846,7 +431,7 @@ H5F_get_access_plist(H5F_t *f) /* Make a copy of the default file access property list */ if(NULL == (old_plist = H5I_object(H5P_LST_FILE_ACCESS_g))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") - if((ret_value=H5P_copy_plist(old_plist)) < 0) + if((ret_value = H5P_copy_plist(old_plist)) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "can't copy file access property list") if(NULL == (new_plist = H5I_object(ret_value))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") @@ -858,14 +443,12 @@ H5F_get_access_plist(H5F_t *f) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache element size") if(H5P_set(new_plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache byte size") - if(H5P_set(new_plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks") if(H5P_set(new_plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment threshold") if(H5P_set(new_plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment") - if(H5P_set(new_plist, H5F_ACS_GARBG_COLCT_REF_NAME, &(f->shared->gc_ref)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set garbage collect reference") if(H5P_set(new_plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->lf->def_meta_block_size)) < 0) @@ -881,7 +464,7 @@ H5F_get_access_plist(H5F_t *f) * Since we're resetting the driver ID and info, close them if they * exist in this new property list. */ - if (H5F_acs_close(ret_value, NULL) < 0) + if(H5P_facc_close(ret_value, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't free the old driver information") /* Increment the reference count on the driver ID and insert it into the property list */ @@ -896,9 +479,9 @@ H5F_get_access_plist(H5F_t *f) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file driver info") /* Set the file close degree appropriately */ - if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0) { + if(f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0) { HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") - } else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0) { + } else if(f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0) { HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") } @@ -1948,7 +1531,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d * second time or later, verify the access property list value matches * the degree in shared file structure. */ - if(H5P_get(a_plist, H5F_CLOSE_DEGREE_NAME, &fc_degree) < 0) + if(H5P_get(a_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file close degree") if(shared->nrefs == 1) { @@ -113,7 +113,7 @@ static unsigned long file_serial_no; static herr_t H5FD_init_interface(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FD_init_interface) @@ -121,11 +121,11 @@ H5FD_init_interface(void) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Reset the file serial numbers */ - file_serial_no=0; + file_serial_no = 0; done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_init_interface() */ /*------------------------------------------------------------------------- @@ -396,36 +396,30 @@ done: * Programmer: Robb Matzke * Friday, August 20, 1999 * - * Modifications: - * - * Raymond Lu - * Tuesday, Oct 23, 2001 - * Changed the file access list to the new generic property - * list. - * *------------------------------------------------------------------------- */ H5FD_class_t * H5FD_get_class(hid_t id) { - H5P_genplist_t *plist; /* Property list pointer */ - H5FD_class_t *ret_value=NULL; - hid_t driver_id = -1; + H5FD_class_t *ret_value = NULL; FUNC_ENTER_NOAPI(H5FD_get_class, NULL) - if(H5I_VFL==H5I_get_type(id)) { + if(H5I_VFL == H5I_get_type(id)) ret_value = H5I_object(id); - } else { + else { + H5P_genplist_t *plist; /* Property list pointer */ + hid_t driver_id = -1; + /* Get the plist structure */ if(NULL == (plist = H5I_object(id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "can't find object for ID") - if(TRUE==H5P_isa_class(id,H5P_FILE_ACCESS)) { + if(TRUE == H5P_isa_class(id, H5P_FILE_ACCESS)) { if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID") ret_value = H5FD_get_class(driver_id); - } else if(TRUE==H5P_isa_class(id,H5P_DATASET_XFER)) { + } else if(TRUE == H5P_isa_class(id, H5P_DATASET_XFER)) { if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID") ret_value = H5FD_get_class(driver_id); @@ -436,7 +430,7 @@ H5FD_get_class(hid_t id) done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_get_class() */ /*------------------------------------------------------------------------- @@ -609,14 +603,12 @@ done: * Programmer: Quincey Koziol * Thursday, October 23, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *), void *pl) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FD_pl_close) @@ -624,7 +616,8 @@ H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *), void *pl) if(pl && free_func) { if((free_func)(pl) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver free request failed") - } else + } /* end if */ + else H5MM_xfree(pl); /* Decrement reference count for driver */ @@ -776,18 +769,18 @@ done: herr_t H5FD_fapl_close(hid_t driver_id, void *fapl) { - H5FD_class_t *driver=NULL; - herr_t ret_value=SUCCEED; /* Return value */ + H5FD_class_t *driver = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_fapl_close, FAIL) /* Check args */ - if(driver_id>0) { - if(NULL==(driver=H5I_object(driver_id))) + if(driver_id > 0) { + if(NULL == (driver = H5I_object(driver_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") /* Close the driver for the property list */ - if(H5FD_pl_close(driver_id,driver->fapl_free,fapl) < 0) + if(H5FD_pl_close(driver_id, driver->fapl_free, fapl) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver fapl_free request failed") } /* end if */ diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 4a830cd..8a6a27a 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -313,7 +313,7 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu herr_t ret_value; FUNC_ENTER_API(H5Pset_fapl_direct, FAIL) - H5TRACE4("e","ihhh",fapl_id,boundary,block_size,cbuf_size); + H5TRACE4("e","izzz",fapl_id,boundary,block_size,cbuf_size); if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 3a5e9eb..3586e6c 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -224,14 +224,11 @@ H5FD_sec2_init_interface(void) * library. * * Return: Success: The driver ID for the sec2 driver. - * * Failure: Negative. * * Programmer: Robb Matzke * Thursday, July 29, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ hid_t @@ -241,15 +238,15 @@ H5FD_sec2_init(void) FUNC_ENTER_NOAPI(H5FD_sec2_init, FAIL) - if (H5I_VFL!=H5I_get_type(H5FD_SEC2_g)) - H5FD_SEC2_g = H5FD_register(&H5FD_sec2_g,sizeof(H5FD_class_t)); + if(H5I_VFL != H5I_get_type(H5FD_SEC2_g)) + H5FD_SEC2_g = H5FD_register(&H5FD_sec2_g, sizeof(H5FD_class_t)); /* Set return value */ - ret_value=H5FD_SEC2_g; + ret_value = H5FD_SEC2_g; done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5FD_sec2_init() */ /*--------------------------------------------------------------------------- diff --git a/src/H5Ffake.c b/src/H5Ffake.c index f9adc39..97e2e2f 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -81,7 +81,7 @@ H5F_fake_alloc(size_t sizeof_size) /* Only set fields necessary for clients */ if(sizeof_size == 0) - f->shared->sizeof_size = H5F_CRT_OBJ_BYTE_NUM_DEF; + f->shared->sizeof_size = H5F_OBJ_SIZE_SIZE; else f->shared->sizeof_size = sizeof_size; diff --git a/src/H5Fmount.c b/src/H5Fmount.c index 20950d0..8d765f8 100644 --- a/src/H5Fmount.c +++ b/src/H5Fmount.c @@ -132,7 +132,7 @@ H5F_mount(H5G_loc_t *loc, const char *name, H5F_t *child, HDassert(loc); HDassert(name && *name); HDassert(child); - HDassert(TRUE == H5P_isa_class(plist_id,H5P_MOUNT)); + HDassert(TRUE == H5P_isa_class(plist_id, H5P_FILE_MOUNT)); /* Set up dataset location to fill in */ mp_loc.oloc = &mp_oloc; @@ -488,9 +488,9 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) if(NULL == (child = H5I_object_verify(child_id,H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") if(H5P_DEFAULT == plist_id) - plist_id = H5P_MOUNT_DEFAULT; + plist_id = H5P_FILE_MOUNT_DEFAULT; else - if(TRUE != H5P_isa_class(plist_id, H5P_MOUNT)) + if(TRUE != H5P_isa_class(plist_id, H5P_FILE_MOUNT)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property list") /* Do the mount */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 168a156..ce18ef5 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -323,149 +323,48 @@ typedef struct H5F_t H5F_t; # define H5F_OVERFLOW_HSIZET2OFFT(X) 0 #endif -/* ========= File Creation properties ============ */ -/* Definitions for the size of the file user block in bytes */ -#define H5F_CRT_USER_BLOCK_NAME "block_size" -#define H5F_CRT_USER_BLOCK_SIZE sizeof(hsize_t) -#define H5F_CRT_USER_BLOCK_DEF 0 -/* Definitions for the 1/2 rank for symbol table leaf nodes */ -#define H5F_CRT_SYM_LEAF_NAME "symbol_leaf" -#define H5F_CRT_SYM_LEAF_SIZE sizeof(unsigned) -#define H5F_CRT_SYM_LEAF_DEF 4 -/* Definitions for the 1/2 rank for btree internal nodes */ -#define H5F_CRT_BTREE_RANK_NAME "btree_rank" -#define H5F_CRT_BTREE_RANK_SIZE sizeof(unsigned[H5B_NUM_BTREE_ID]) -#define H5F_CRT_BTREE_RANK_DEF {HDF5_BTREE_SNODE_IK_DEF,HDF5_BTREE_ISTORE_IK_DEF} -/* Definitions for byte number in an address */ -#define H5F_CRT_ADDR_BYTE_NUM_NAME "addr_byte_num" -#define H5F_CRT_ADDR_BYTE_NUM_SIZE sizeof(size_t) -#define H5F_CRT_ADDR_BYTE_NUM_DEF sizeof(haddr_t) -/* Definitions for byte number for object size */ -#define H5F_CRT_OBJ_BYTE_NUM_NAME "obj_byte_num" -#define H5F_CRT_OBJ_BYTE_NUM_SIZE sizeof(size_t) -#define H5F_CRT_OBJ_BYTE_NUM_DEF sizeof(hsize_t) -/* Definitions for version number of the superblock */ -#define H5F_CRT_SUPER_VERS_NAME "super_version" -#define H5F_CRT_SUPER_VERS_SIZE sizeof(unsigned) -#define H5F_CRT_SUPER_VERS_DEF HDF5_SUPERBLOCK_VERSION_DEF -/* Definitions for free-space version number */ -#define H5F_CRT_FREESPACE_VERS_NAME "free_space_version" -#define H5F_CRT_FREESPACE_VERS_SIZE sizeof(unsigned) -#define H5F_CRT_FREESPACE_VERS_DEF HDF5_FREESPACE_VERSION -/* Definitions for object directory version number */ -#define H5F_CRT_OBJ_DIR_VERS_NAME "obj_dir_version" -#define H5F_CRT_OBJ_DIR_VERS_SIZE sizeof(unsigned) -#define H5F_CRT_OBJ_DIR_VERS_DEF HDF5_OBJECTDIR_VERSION -/* Definitions for shared-header format version */ -#define H5F_CRT_SHARE_HEAD_VERS_NAME "share_head_version" -#define H5F_CRT_SHARE_HEAD_VERS_SIZE sizeof(unsigned) -#define H5F_CRT_SHARE_HEAD_VERS_DEF HDF5_SHAREDHEADER_VERSION +/* Sizes of object addresses & sizes in the file (in bytes) */ +#define H5F_OBJ_ADDR_SIZE sizeof(haddr_t) +#define H5F_OBJ_SIZE_SIZE sizeof(hsize_t) /* File-wide default character encoding can not yet be set via the file * creation property list and is always ASCII. */ -#define H5F_CRT_DEFAULT_CSET H5T_CSET_ASCII +#define H5F_DEFAULT_CSET H5T_CSET_ASCII + +/* ========= File Creation properties ============ */ +#define H5F_CRT_USER_BLOCK_NAME "block_size" /* Size of the file user block in bytes */ +#define H5F_CRT_SYM_LEAF_NAME "symbol_leaf" /* 1/2 rank for symbol table leaf nodes */ +#define H5F_CRT_BTREE_RANK_NAME "btree_rank" /* 1/2 rank for btree internal nodes */ +#define H5F_CRT_ADDR_BYTE_NUM_NAME "addr_byte_num" /* Byte number in an address */ +#define H5F_CRT_OBJ_BYTE_NUM_NAME "obj_byte_num" /* Byte number for object size */ +#define H5F_CRT_SUPER_VERS_NAME "super_version" /* Version number of the superblock */ +#define H5F_CRT_FREESPACE_VERS_NAME "free_space_version" /* Free-space version number */ +#define H5F_CRT_OBJ_DIR_VERS_NAME "obj_dir_version" /* Object directory version number */ +#define H5F_CRT_SHARE_HEAD_VERS_NAME "share_head_version" /* Shared-header format version */ /* ========= File Access properties ============ */ -/* Definitions for the initial metadata cache resize configuration */ -#define H5F_ACS_META_CACHE_INIT_CONFIG_NAME "mdc_initCacheCfg" -#define H5F_ACS_META_CACHE_INIT_CONFIG_SIZE sizeof(H5AC_cache_config_t) -#define H5F_ACS_META_CACHE_INIT_CONFIG_DEF H5AC__DEFAULT_CACHE_CONFIG - -/* Definitions for size of raw data chunk cache(elements) */ -#define H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME "rdcc_nelmts" -#define H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE sizeof(size_t) -#define H5F_ACS_DATA_CACHE_ELMT_SIZE_DEF 521 - -/* Definition for size of raw data chunk cache(bytes) */ -#define H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" -#define H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE sizeof(size_t) -#define H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF (1024*1024) - -/* Definition for preemption read chunks first */ -#define H5F_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" -#define H5F_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double) -#define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75 - -/* Definition for threshold for alignment */ -#define H5F_ACS_ALIGN_THRHD_NAME "threshold" -#define H5F_ACS_ALIGN_THRHD_SIZE sizeof(hsize_t) -#define H5F_ACS_ALIGN_THRHD_DEF 1 - -/* Definition for alignment */ -#define H5F_ACS_ALIGN_NAME "align" -#define H5F_ACS_ALIGN_SIZE sizeof(hsize_t) -#define H5F_ACS_ALIGN_DEF 1 - -/* Definition for minimum metadata allocation block size (when - aggregating metadata allocations. */ -#define H5F_ACS_META_BLOCK_SIZE_NAME "meta_block_size" -#define H5F_ACS_META_BLOCK_SIZE_SIZE sizeof(hsize_t) -#define H5F_ACS_META_BLOCK_SIZE_DEF 2048 - -/* Definition for maximum sieve buffer size (when data sieving - is allowed by file driver */ -#define H5F_ACS_SIEVE_BUF_SIZE_NAME "sieve_buf_size" -#define H5F_ACS_SIEVE_BUF_SIZE_SIZE sizeof(size_t) -#define H5F_ACS_SIEVE_BUF_SIZE_DEF (64*1024) - -/* Definition for minimum "small data" allocation block size (when - aggregating "small" raw data allocations. */ -#define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" -#define H5F_ACS_SDATA_BLOCK_SIZE_SIZE sizeof(hsize_t) -#define H5F_ACS_SDATA_BLOCK_SIZE_DEF 2048 - -/* Definition for garbage-collect references */ -#define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" -#define H5F_ACS_GARBG_COLCT_REF_SIZE sizeof(unsigned) -#define H5F_ACS_GARBG_COLCT_REF_DEF 0 - -/* Definition for file driver ID */ -#define H5F_ACS_FILE_DRV_ID_NAME "driver_id" -#define H5F_ACS_FILE_DRV_ID_SIZE sizeof(hid_t) -#define H5F_ACS_FILE_DRV_ID_DEF H5FD_SEC2 - -/* Definition for file driver info */ -#define H5F_ACS_FILE_DRV_INFO_NAME "driver_info" -#define H5F_ACS_FILE_DRV_INFO_SIZE sizeof(void*) -#define H5F_ACS_FILE_DRV_INFO_DEF NULL - -/* Definition for file close degree */ -#define H5F_CLOSE_DEGREE_NAME "close_degree" -#define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) -#define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT - -/* Definition for offset position in file for family file driver */ -#define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" -#define H5F_ACS_FAMILY_OFFSET_SIZE sizeof(hsize_t) -#define H5F_ACS_FAMILY_OFFSET_DEF 0 - -/* Definition for new member size of family driver. It's private - * property only used by h5repart */ -#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" -#define H5F_ACS_FAMILY_NEWSIZE_SIZE sizeof(hsize_t) -#define H5F_ACS_FAMILY_NEWSIZE_DEF 0 - -/* Definition for whether to convert family to sec2 driver. It's private - * property only used by h5repart */ -#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" -#define H5F_ACS_FAMILY_TO_SEC2_SIZE sizeof(hbool_t) -#define H5F_ACS_FAMILY_TO_SEC2_DEF FALSE - -/* Definition for data type in multi file driver */ -#define H5F_ACS_MULTI_TYPE_NAME "multi_type" -#define H5F_ACS_MULTI_TYPE_SIZE sizeof(H5FD_mem_t) -#define H5F_ACS_MULTI_TYPE_DEF H5FD_MEM_DEFAULT - -/* Definition for 'use latest format version' flag */ -#define H5F_ACS_LATEST_FORMAT_NAME "latest_format" -#define H5F_ACS_LATEST_FORMAT_SIZE sizeof(hbool_t) -#define H5F_ACS_LATEST_FORMAT_DEF FALSE +#define H5F_ACS_META_CACHE_INIT_CONFIG_NAME "mdc_initCacheCfg" /* Initial metadata cache resize configuration */ +#define H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME "rdcc_nelmts" /* Size of raw data chunk cache(elements) */ +#define H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME "rdcc_nbytes" /* Size of raw data chunk cache(bytes) */ +#define H5F_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ +#define H5F_ACS_ALIGN_THRHD_NAME "threshold" /* Threshold for alignment */ +#define H5F_ACS_ALIGN_NAME "align" /* Alignment */ +#define H5F_ACS_META_BLOCK_SIZE_NAME "meta_block_size" /* Minimum metadata allocation block size (when aggregating metadata allocations) */ +#define H5F_ACS_SIEVE_BUF_SIZE_NAME "sieve_buf_size" /* Maximum sieve buffer size (when data sieving is allowed by file driver) */ +#define H5F_ACS_SDATA_BLOCK_SIZE_NAME "sdata_block_size" /* Minimum "small data" allocation block size (when aggregating "small" raw data allocations) */ +#define H5F_ACS_GARBG_COLCT_REF_NAME "gc_ref" /* Garbage-collect references */ +#define H5F_ACS_FILE_DRV_ID_NAME "driver_id" /* File driver ID */ +#define H5F_ACS_FILE_DRV_INFO_NAME "driver_info" /* File driver info */ +#define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */ +#define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */ +#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */ +#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" /* Whether to convert family to sec2 driver. (private property only used by h5repart) */ +#define H5F_ACS_MULTI_TYPE_NAME "multi_type" /* Data type in multi file driver */ +#define H5F_ACS_LATEST_FORMAT_NAME "latest_format" /* 'Use latest format version' flag */ /* ======================== File Mount properties ====================*/ -/* Definition for whether absolute symlinks local to file. */ -#define H5F_MNT_SYM_LOCAL_NAME "local" -#define H5F_MNT_SYM_LOCAL_SIZE sizeof(hbool_t) -#define H5F_MNT_SYM_LOCAL_DEF FALSE +#define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */ + #ifdef H5_HAVE_PARALLEL /* Which process writes metadata */ @@ -530,11 +429,8 @@ H5_DLL void H5F_addr_encode(const H5F_t *, uint8_t** /*in,out*/, haddr_t); H5_DLL void H5F_addr_decode(const H5F_t *, const uint8_t** /*in,out*/, haddr_t* /*out*/); -/* Callback functions for file access class */ -H5_DLL herr_t H5F_acs_create(hid_t fapl_id, void *close_data); -H5_DLL herr_t H5F_acs_close(hid_t fapl_id, void *close_data); -H5_DLL herr_t H5F_acs_copy(hid_t new_fapl_id, hid_t old_fapl_id, - void *close_data); +/* File access property list callbacks */ +H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data); /* Shared file list related routines */ H5_DLL herr_t H5F_sfile_assert_num(unsigned n); @@ -546,4 +442,5 @@ H5_DLL herr_t H5F_fake_free(H5F_t *f); /* Debugging functions */ H5_DLL herr_t H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth); -#endif +#endif /* _H5Fprivate_H */ + @@ -1151,61 +1151,17 @@ done: static herr_t H5G_init_interface(void) { - H5P_genclass_t *crt_pclass, *acc_pclass, *cpy_pclass; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5G_init_interface); + FUNC_ENTER_NOAPI_NOINIT(H5G_init_interface) /* Initialize the atom group for the group IDs */ - if(H5I_register_type(H5I_GROUP, (size_t)H5I_GROUPID_HASHSIZE, H5G_RESERVED_ATOMS, - (H5I_free_t)H5G_close) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to initialize interface"); - - /* ========== Group Creation Property Class Initialization ============*/ - assert(H5P_CLS_GROUP_CREATE_g!=-1); - - /* Get the pointer to group creation class */ - if(NULL == (crt_pclass = H5I_object(H5P_CLS_GROUP_CREATE_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_GROUP_CREATE_g == (-1)) { - /* Register the default group creation property list */ - if((H5P_LST_GROUP_CREATE_g = H5P_create_id(crt_pclass))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") - } /* end if */ - - /* ========== Group Access Property Class Initialization ============*/ - assert(H5P_CLS_GROUP_ACCESS_g!=-1); - - /* Get the pointer to group creation class */ - if(NULL == (acc_pclass = H5I_object(H5P_CLS_GROUP_ACCESS_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_GROUP_ACCESS_g == (-1)) { - /* Register the default group creation property list */ - if((H5P_LST_GROUP_ACCESS_g = H5P_create_id(acc_pclass))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") - } /* end if */ - - /* ========== Object Copy Property Class Initialization ============*/ - assert(H5P_CLS_OBJECT_COPY_g!=-1); - - /* Get the pointer to group access class */ - if(NULL == (cpy_pclass = H5I_object(H5P_CLS_OBJECT_COPY_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_OBJECT_COPY_g == (-1)) { - /* Register the default group access property list */ - if((H5P_LST_OBJECT_COPY_g = H5P_create_id(cpy_pclass))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") - } /* end if */ + if(H5I_register_type(H5I_GROUP, (size_t)H5I_GROUPID_HASHSIZE, H5G_RESERVED_ATOMS, (H5I_free_t)H5G_close) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to initialize interface") done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_init_interface() */ /*------------------------------------------------------------------------- diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index ee7b520..0612771 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -140,6 +140,7 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *d herr_t ret_value; FUNC_ENTER_API(H5Gmove2, FAIL) + H5TRACE4("e","isis",src_loc_id,src_name,dst_loc_id,dst_name); if((ret_value = H5Lmove(src_loc_id, src_name, dst_loc_id, dst_name, H5P_DEFAULT, H5P_DEFAULT)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "couldn't move link") @@ -186,6 +187,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) herr_t ret_value; FUNC_ENTER_API(H5Gget_linkval, FAIL) + H5TRACE4("e","iszx",loc_id,name,size,buf); if((ret_value = H5Lget_linkval(loc_id, name, size, buf, H5P_DEFAULT)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info") diff --git a/src/H5Glink.c b/src/H5Glink.c index cc86edd..6611ea0 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -221,7 +221,7 @@ H5G_link_convert(H5F_t *f, hid_t dxpl_id, H5O_link_t *lnk, haddr_t lheap_addr, HDassert(ent); /* Set (default) common info for link */ - lnk->cset = H5F_CRT_DEFAULT_CSET; + lnk->cset = H5F_DEFAULT_CSET; lnk->corder = 0; lnk->corder_valid = FALSE; /* Creation order not valid for this link */ lnk->name = H5MM_xstrdup(name); diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 4e72774..d683eff 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -378,7 +378,7 @@ H5G_loc_insert(H5G_loc_t *grp_loc, const char *name, H5G_loc_t *obj_loc, /* Create link object for the object location */ lnk.type = H5L_TYPE_HARD; - lnk.cset = H5F_CRT_DEFAULT_CSET; + lnk.cset = H5F_DEFAULT_CSET; lnk.corder = 0; /* Will be reset if the group is tracking creation order */ lnk.corder_valid = FALSE; /* Indicate that the creation order isn't valid (yet) */ /* Casting away const OK -QAK */ diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 8d534a8..9824a8c 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1976,7 +1976,7 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, HDassert(0 && "Unknown entry type"); /* Set up common link data */ - lnk.cset = H5F_CRT_DEFAULT_CSET; /* XXX: Allow user to set this */ + lnk.cset = H5F_DEFAULT_CSET; /* XXX: Allow user to set this */ lnk.corder = 0; /* Creation order is not tracked for old-style links */ lnk.corder_valid = FALSE; /* Creation order is not valid */ /* lnk.name = name; */ /* This will be set in callback */ diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 04eb75c..2bbc540 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -96,10 +96,9 @@ H5G_CRT_GINFO_EST_NUM_ENTRIES, \ H5G_CRT_GINFO_EST_NAME_LEN} -/* definitions for copying objects */ -#define H5G_CPY_OPTION_NAME "copy object" -#define H5G_CPY_OPTION_SIZE sizeof(unsigned) -#define H5G_CPY_OPTION_DEF 0 +/* ========= Object Copy properties ============ */ +#define H5G_CPY_OPTION_NAME "copy object" /* Copy options */ + /* Type of operation being performed for call to H5G_name_replace() */ typedef enum { diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 68e8dfc..c1f8440 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -207,7 +207,7 @@ static herr_t H5G_traverse_ud(H5G_loc_t *grp_loc/*in,out*/, H5O_link_t *lnk, if(NULL == (lapl = H5I_object(lapl_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "unable to get property list from ID") - if(H5P_set(lapl, H5L_NLINKS_NAME, nlinks) < 0) + if(H5P_set(lapl, H5L_ACS_NLINKS_NAME, nlinks) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set nlink info") /* User-defined callback function */ @@ -789,11 +789,11 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver /* Set nlinks value from property list, if it exists */ if(lapl_id == H5P_DEFAULT) - nlinks = H5L_NLINKS_DEF; + nlinks = H5L_NUM_LINKS; else { if(NULL == (lapl = H5I_object(lapl_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_get(lapl, H5L_NLINKS_NAME, &nlinks) < 0) + if(H5P_get(lapl, H5L_ACS_NLINKS_NAME, &nlinks) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of links") } /* end else */ diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index c91240a..934bcda 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -67,4 +67,5 @@ H5_DLL int H5I_inc_type_ref(H5I_type_t type); H5_DLL herr_t H5I_dec_type_ref(H5I_type_t type); H5_DLL int H5I_get_type_ref(H5I_type_t type); -#endif +#endif /* _H5Iprivate_H */ + diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index 1efa6ad..9c2ae24 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -98,4 +98,5 @@ H5_DLL htri_t H5Itype_exists(H5I_type_t type); #ifdef __cplusplus } #endif -#endif +#endif /* _H5Ipublic_H */ + @@ -312,63 +312,17 @@ done: static herr_t H5L_init_interface(void) { - H5P_genclass_t *crt_pclass; - H5P_genclass_t *acc_pclass; - size_t nprops; /* Number of properties */ - unsigned intmd_group = H5L_CRT_INTERMEDIATE_GROUP_DEF; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5L_init_interface) - /* =========Link Creation Property Class Initialization========= */ - /* Register the default attribute creation properties */ - assert(H5P_CLS_LINK_CREATE_g!=(-1)); - - /* Get the pointer to the link creation class */ - if (NULL == (crt_pclass = H5I_object(H5P_CLS_LINK_CREATE_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Get the number of properties in the class */ - if(H5P_get_nprops_pclass(crt_pclass,&nprops,FALSE)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties") - - /* Assume that if there are properties in the class, they are the default ones */ - if(nprops==0) { - /* Register create intermediate groups property */ - if(H5P_register(crt_pclass,H5L_CRT_INTERMEDIATE_GROUP_NAME,H5L_CRT_INTERMEDIATE_GROUP_SIZE, - &intmd_group,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - } - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_LINK_CREATE_g==(-1)) { - /* Register the default link creation property list */ - if ((H5P_LST_LINK_CREATE_g = H5P_create_id (crt_pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list") - } /* end if */ - - /* ========== Link Access Property Class Initialization ============*/ - assert(H5P_CLS_LINK_ACCESS_g!=-1); - - /* Get the pointer to link access class */ - if(NULL == (acc_pclass = H5I_object(H5P_CLS_LINK_ACCESS_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_LINK_ACCESS_g == (-1)) { - /* Register the default link access property list */ - if((H5P_LST_LINK_ACCESS_g = H5P_create_id(acc_pclass))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default LAPL") - } /* end if */ - - /* Initialize user-defined link classes */ if(H5L_register_external() <0) HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register external link class") done: FUNC_LEAVE_NOAPI(ret_value) -} +} /* end H5L_init_interface() */ /*------------------------------------------------------------------------- @@ -396,6 +350,7 @@ H5L_term_interface(void) FUNC_LEAVE_NOAPI(n) } + /*------------------------------------------------------------------------- * Function: H5Lmove @@ -1222,7 +1177,7 @@ H5L_create_real(H5G_loc_t *link_loc, const char *link_name, H5G_name_t *obj_path { char *norm_link_name = NULL; /* Pointer to normalized link name */ unsigned target_flags = H5G_TARGET_NORMAL; /* Flags to pass to group traversal function */ - H5T_cset_t char_encoding = H5F_CRT_DEFAULT_CSET; /* Character encoding for link */ + H5T_cset_t char_encoding = H5F_DEFAULT_CSET; /* Character encoding for link */ H5P_genplist_t* lc_plist; /* Link creation property list */ H5L_trav_ud2_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1976,7 +1931,7 @@ H5L_move(H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc, hid_t lapl_id, hid_t dxpl_id) { unsigned target_flags = H5G_TARGET_MOUNT|H5G_TARGET_SLINK|H5G_TARGET_UDLINK; - H5T_cset_t char_encoding = H5F_CRT_DEFAULT_CSET; /* Character encoding for link */ + H5T_cset_t char_encoding = H5F_DEFAULT_CSET; /* Character encoding for link */ H5P_genplist_t* lc_plist; /* Link creation property list */ H5P_genplist_t* la_plist; /* Link access property list */ H5L_trav_ud3_t udata; /* User data for traversal */ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 6255764..094bde3 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -322,7 +322,7 @@ H5Lunpack_elink_val(char *ext_linkval, size_t link_size, char **filename, herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Lunpack_elink_val, FAIL) - H5TRACE3("e","s*s*s",ext_linkval,filename,obj_path); + H5TRACE4("e","sz*s*s",ext_linkval,link_size,filename,obj_path); if(ext_linkval == NULL ) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an external link linkval buffer") diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index 4f152ae..1816e7d 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -26,19 +26,15 @@ #include "H5Gprivate.h" #include "H5Oprivate.h" -/* Definitions for creating intermediate groups */ -#define H5L_CRT_INTERMEDIATE_GROUP_NAME "intermediate_group" -#define H5L_CRT_INTERMEDIATE_GROUP_SIZE sizeof(unsigned) -#define H5L_CRT_INTERMEDIATE_GROUP_DEF 0 - -/* Definitions for accessing links */ -#define H5L_NLINKS_NAME "max soft links" -#define H5L_NLINKS_SIZE sizeof(size_t) -#define H5L_NLINKS_DEF 16 /*max symlinks to follow per lookup */ - -#define H5L_ELINK_PREFIX_NAME "external link prefix" -#define H5L_ELINK_PREFIX_SIZE sizeof(char *) -#define H5L_ELINK_PREFIX_DEF NULL /*default is no prefix */ +/* Default number of soft links to traverse */ +#define H5L_NUM_LINKS 16 + +/* ======== Link creation property names ======== */ +#define H5L_CRT_INTERMEDIATE_GROUP_NAME "intermediate_group" /* Create intermediate groups flag */ + +/* ======== Link access property names ======== */ +#define H5L_ACS_NLINKS_NAME "max soft links" /* Number of soft links to traverse */ +#define H5L_ACS_ELINK_PREFIX_NAME "external link prefix" /* External link prefix */ /* General operations on links */ H5_DLL herr_t H5L_link(H5G_loc_t *new_loc, const char *new_name, diff --git a/src/H5Onull.c b/src/H5Onull.c index 0b8d742..5240112 100644 --- a/src/H5Onull.c +++ b/src/H5Onull.c @@ -20,8 +20,6 @@ * * Purpose: The null message. * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -51,3 +49,4 @@ const H5O_msg_class_t H5O_MSG_NULL[1] = {{ NULL, /*no post copy native value to file */ NULL /*no debug method */ }}; + @@ -43,14 +43,14 @@ * Predefined property list classes. These are initialized at runtime by * H5P_init_interface() in this source file. */ -hid_t H5P_CLS_NO_CLASS_g = FAIL; +hid_t H5P_CLS_ROOT_g = FAIL; hid_t H5P_CLS_OBJECT_CREATE_g = FAIL; hid_t H5P_CLS_FILE_CREATE_g = FAIL; hid_t H5P_CLS_FILE_ACCESS_g = FAIL; hid_t H5P_CLS_DATASET_CREATE_g = FAIL; hid_t H5P_CLS_DATASET_ACCESS_g = FAIL; hid_t H5P_CLS_DATASET_XFER_g = FAIL; -hid_t H5P_CLS_MOUNT_g = FAIL; +hid_t H5P_CLS_FILE_MOUNT_g = FAIL; hid_t H5P_CLS_GROUP_CREATE_g = FAIL; hid_t H5P_CLS_GROUP_ACCESS_g = FAIL; hid_t H5P_CLS_DATATYPE_CREATE_g = FAIL; @@ -65,13 +65,12 @@ hid_t H5P_CLS_STRING_CREATE_g = FAIL; * Predefined property lists for each predefined class. These are initialized * at runtime by H5P_init_interface() in this source file. */ -hid_t H5P_LST_NO_CLASS_g = FAIL; hid_t H5P_LST_FILE_CREATE_g = FAIL; hid_t H5P_LST_FILE_ACCESS_g = FAIL; hid_t H5P_LST_DATASET_CREATE_g = FAIL; hid_t H5P_LST_DATASET_ACCESS_g = FAIL; hid_t H5P_LST_DATASET_XFER_g = FAIL; -hid_t H5P_LST_MOUNT_g = FAIL; +hid_t H5P_LST_FILE_MOUNT_g = FAIL; hid_t H5P_LST_GROUP_CREATE_g = FAIL; hid_t H5P_LST_GROUP_ACCESS_g = FAIL; hid_t H5P_LST_DATATYPE_CREATE_g = FAIL; @@ -85,6 +84,101 @@ hid_t H5P_LST_LINK_ACCESS_g = FAIL; static unsigned H5P_next_rev=0; #define H5P_GET_NEXT_REV (H5P_next_rev++) +/* Root property list class library initialization object */ +const H5P_libclass_t H5P_CLS_ROOT[1] = {{ + "root", /* Class name for debugging */ + NULL, /* Parent class ID */ + &H5P_CLS_ROOT_g, /* Pointer to class ID */ + NULL, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + +/* Object creation property list class library initialization object */ +/* (move to proper source code file when used for real) */ +const H5P_libclass_t H5P_CLS_OCRT[1] = {{ + "object create", /* Class name for debugging */ + &H5P_CLS_ROOT_g, /* Parent class ID */ + &H5P_CLS_OBJECT_CREATE_g, /* Pointer to class ID */ + NULL, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + +/* Group access property list class library initialization object */ +/* (move to proper source code file when used for real) */ +const H5P_libclass_t H5P_CLS_GACC[1] = {{ + "group access", /* Class name for debugging */ + &H5P_CLS_LINK_ACCESS_g, /* Parent class ID */ + &H5P_CLS_GROUP_ACCESS_g, /* Pointer to class ID */ + &H5P_LST_GROUP_ACCESS_g, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + +/* Dataset access property list class library initialization object */ +/* (move to proper source code file when used for real) */ +const H5P_libclass_t H5P_CLS_DACC[1] = {{ + "dataset access", /* Class name for debugging */ + &H5P_CLS_LINK_ACCESS_g, /* Parent class ID */ + &H5P_CLS_DATASET_ACCESS_g, /* Pointer to class ID */ + &H5P_LST_DATASET_ACCESS_g, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + +/* Datatype creation property list class library initialization object */ +/* (move to proper source code file when used for real) */ +const H5P_libclass_t H5P_CLS_TCRT[1] = {{ + "datatype create", /* Class name for debugging */ + &H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */ + &H5P_CLS_DATATYPE_CREATE_g, /* Pointer to class ID */ + &H5P_LST_DATATYPE_CREATE_g, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + +/* Datatype access property list class library initialization object */ +/* (move to proper source code file when used for real) */ +const H5P_libclass_t H5P_CLS_TACC[1] = {{ + "datatype access", /* Class name for debugging */ + &H5P_CLS_LINK_ACCESS_g, /* Parent class ID */ + &H5P_CLS_DATATYPE_ACCESS_g, /* Pointer to class ID */ + &H5P_LST_DATATYPE_ACCESS_g, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + /* Declare a free list to manage the H5P_genprop_t struct */ H5FL_DEFINE(H5P_genprop_t); @@ -103,11 +197,7 @@ typedef struct { } H5P_check_class_t; /* Local static functions */ -static H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, - const char *name, unsigned internal, - H5P_cls_create_func_t cls_create, void *create_data, - H5P_cls_copy_func_t cls_copy, void *copy_data, - H5P_cls_close_func_t cls_close, void *close_data); +static herr_t H5P_init_class(const H5P_libclass_t *lib_class); static herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name); static H5P_genprop_t *H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type); static herr_t H5P_free_prop(H5P_genprop_t *prop); @@ -201,14 +291,71 @@ done: herr_t H5P_init(void) { - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5P_init, FAIL); + FUNC_ENTER_NOAPI(H5P_init, FAIL) /* FUNC_ENTER() does all the work */ done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_init() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_init_class + * + * Purpose: Initialize a library class + * + * Return: Pointer to class created on success/NULL on failure + * + * Programmer: Quincey Koziol + * October 31, 2006 + *------------------------------------------------------------------------- + */ +static herr_t +H5P_init_class(const H5P_libclass_t *lib_class) +{ + H5P_genclass_t *par_class = NULL; /* Parent class of new class */ + H5P_genclass_t *new_class; /* New property list class created */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5P_init_class) + + /* Sanity checks */ + HDassert(lib_class); + HDassert(lib_class->par_class_id || lib_class == H5P_CLS_ROOT); + HDassert(lib_class->class_id); + HDassert(*lib_class->class_id == (-1)); + + /* Check for parent class */ + if(lib_class->par_class_id) { + /* Get the pointer to the parent class */ + if(NULL == (par_class = H5I_object(*lib_class->par_class_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") + } /* end if */ + + /* Allocate the object create class */ + if(NULL == (new_class = H5P_create_class(par_class, lib_class->name, 1, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data))) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") + + /* Call routine to register properties for class */ + if(lib_class->reg_prop_func && (*lib_class->reg_prop_func)(new_class) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register properties") + + /* Register the object create class */ + if((*lib_class->class_id = H5I_register(H5I_GENPROP_CLS, new_class)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class") + + /* Only register the default property list if it hasn't been created yet */ + if(lib_class->def_plist_id && *lib_class->def_plist_id == (-1)) { + /* Register the default property list for the new class*/ + if((*lib_class->def_plist_id = H5P_create_id(new_class)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register default property list for class") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_init_class() */ /*-------------------------------------------------------------------------- @@ -216,310 +363,123 @@ NAME H5P_init_interface -- Initialize interface-specific information USAGE herr_t H5P_init_interface() - RETURNS Non-negative on success/Negative on failure DESCRIPTION Initializes any interface-specific data or routines. - -Modification: - - Peter Cao - May 08, 2005 - Add Group creation property, Add object creation property class. - group, dataset and datatype creation property classes are inherited from - the object creation property class - --------------------------------------------------------------------------*/ static herr_t H5P_init_interface(void) { - H5P_genclass_t *root_class; /* Pointer to root property list class created */ - H5P_genclass_t *pclass; /* Pointer to property list class to create */ - /* Link access property class variables. In sequence, they are, - * - Access property list class to modify - * - Default value for "user-supplied data" - * - Default value for "max number of soft links to traverse" - */ - H5P_genclass_t *lacc_class; /* Pointer to link access property list class created */ - size_t nlinks = H5L_NLINKS_DEF; - char * elink_prefix = H5L_ELINK_PREFIX_DEF; - /* Group creation property class variables. In sequence, they are, - * - Creation property list class to modify - * - Default value for "group info" - * - Default value for "link info" - */ - H5P_genclass_t *gcrt_class; /* Pointer to group creation property list class created */ - H5O_ginfo_t ginfo = H5G_CRT_GROUP_INFO_DEF; - H5O_linfo_t linfo = H5G_CRT_LINK_INFO_DEF; - /* Object creation property class variables. In sequence, they are, - * - Creation property list class to modify - */ - H5P_genclass_t *ocrt_class; /* Pointer to object (dataset, group, or datatype) creation property list class created */ - /* String creation property class variables. In sequence, they are, - * - Creation property list class to modify - * - Default value for "character encoding" - */ - H5P_genclass_t *strcrt_class; /* Pointer to string creation class */ - H5T_cset_t char_encoding = H5P_CHAR_ENCODING_DEF; - /* Object copy property class variables. In sequence, they are, - * - Copy property list class to modify - * - Default value for "object copy parameters" - */ - H5P_genclass_t *ocpy_class; /* Pointer to group copying property list class */ - unsigned ocpy_option = H5G_CPY_OPTION_DEF; - size_t nprops; /* Number of properties */ herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT(H5P_init_interface); + FUNC_ENTER_NOAPI_NOINIT(H5P_init_interface) /* * Initialize the Generic Property class & object groups. */ - if (H5I_register_type(H5I_GENPROP_CLS, (size_t)H5I_GENPROPCLS_HASHSIZE, 0, (H5I_free_t)H5P_close_class) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group"); - if (H5I_register_type(H5I_GENPROP_LST, (size_t)H5I_GENPROPOBJ_HASHSIZE, 0, (H5I_free_t)H5P_close) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group"); - - /* Create root property list class */ - - /* Allocate the root class */ - assert(H5P_CLS_NO_CLASS_g==(-1)); - if (NULL==(root_class = H5P_create_class (NULL,"root",1,NULL,NULL,NULL,NULL,NULL,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); - - /* Register the root class */ - if ((H5P_CLS_NO_CLASS_g = H5I_register (H5I_GENPROP_CLS, root_class))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class") - - /* Create object property class */ - - /* Allocate the object class */ - assert(H5P_CLS_OBJECT_CREATE_g==(-1)); - if (NULL==(ocrt_class = H5P_create_class (root_class,"object create",1,NULL,NULL,NULL,NULL,NULL,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - - /* Register the object class */ - if ((H5P_CLS_OBJECT_CREATE_g = H5I_register (H5I_GENPROP_CLS, ocrt_class))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class") - - /* Create object copy property class */ - - /* Allocate the object copy class */ - HDassert(H5P_CLS_OBJECT_COPY_g == (-1)); - if(NULL == (ocpy_class = H5P_create_class(root_class, "object copy", 1, NULL, NULL, NULL, NULL, NULL, NULL))) + if(H5I_register_type(H5I_GENPROP_CLS, (size_t)H5I_GENPROPCLS_HASHSIZE, 0, (H5I_free_t)H5P_close_class) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") + if(H5I_register_type(H5I_GENPROP_LST, (size_t)H5I_GENPROPOBJ_HASHSIZE, 0, (H5I_free_t)H5P_close) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") + + /* Create root property list class + * + * All other property list classes ultimately inherit from this class. + */ + if(H5P_init_class(H5P_CLS_ROOT) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Register the object copy class */ - if((H5P_CLS_OBJECT_COPY_g = H5I_register(H5I_GENPROP_CLS, ocpy_class)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class") - - /* Get the number of properties in the class */ - if(H5P_get_nprops_pclass(ocpy_class, &nprops, FALSE) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties") - - /* Assume that if there are properties in the class, they are the default ones */ - if(nprops == 0) { - /* Register group info */ - if(H5P_register(ocpy_class, H5G_CPY_OPTION_NAME, H5G_CPY_OPTION_SIZE, - &ocpy_option, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - } /* end if */ + /* + * Initialize property list classes for library. + */ - /* Create link property classes (which need to be inherited by later classes */ - /* Allocate the link access class */ - HDassert(H5P_CLS_LINK_ACCESS_g == (-1)); - if(NULL == (lacc_class = H5P_create_class(root_class, "link access", 1, NULL, NULL, NULL, NULL, NULL, NULL))) + /* Create object create property class + * + * Classes that create objects should inherit from this class + * For example: group, dataset and named datatype creation classes... + */ + if(H5P_init_class(H5P_CLS_OCRT) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Register the link access class */ - if((H5P_CLS_LINK_ACCESS_g = H5I_register(H5I_GENPROP_CLS, lacc_class)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class") + /* Create string creation property class + * + * Classes that contain strings should inherit from this class + * For example, links and attributes have names associated with them. + */ + if(H5P_init_class(H5P_CLS_STRCRT) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Get the number of properties in the class */ - if(H5P_get_nprops_pclass(lacc_class, &nprops, FALSE) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties") - - /* Assume that if there are properties in the class, they are the default ones */ - if(nprops == 0) { - /* Register property for number of links traversed */ - if(H5P_register(lacc_class, H5L_NLINKS_NAME, H5L_NLINKS_SIZE, - &nlinks, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register property for external link prefix */ - if(H5P_register(lacc_class, H5L_ELINK_PREFIX_NAME, H5L_ELINK_PREFIX_SIZE, - &elink_prefix, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - } /* end if */ + /* Create link access property classes (which need to be inherited by later classes */ + /* Create string creation property class + * + * Classes that access objects in the file should inherit from this class + * For example: group, dataset and named datatype access classes... + */ + if(H5P_init_class(H5P_CLS_LACC) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Register the group creation and group access property classes */ - /* (Register the group property classes before file property classes, so + /* Create group creation property class + * + * (Register the group property classes before file property classes, so * file creation property class can inherit from group creation property * class, which is used to allow application to control the group creation * properties of the root group of a file. -QAK) */ + if(H5P_init_class(H5P_CLS_GCRT) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Allocate the group creation class */ - HDassert(H5P_CLS_GROUP_CREATE_g == (-1)); - if(NULL == (gcrt_class = H5P_create_class(ocrt_class, "group create", 1, NULL, NULL, NULL, NULL, NULL, NULL))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); - - /* Register the group creation class */ - if((H5P_CLS_GROUP_CREATE_g = H5I_register(H5I_GENPROP_CLS, gcrt_class)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); - - /* Get the number of properties in the class */ - if(H5P_get_nprops_pclass(gcrt_class, &nprops, FALSE) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties") - - /* Assume that if there are properties in the class, they are the default ones */ - if(nprops == 0) { - /* Register group info */ - if(H5P_register(gcrt_class, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, - &ginfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register link info */ - if(H5P_register(gcrt_class, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, - &linfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - } /* end if */ - - /* Allocate the group access class */ - HDassert(H5P_CLS_GROUP_ACCESS_g == (-1)); - if(NULL == (pclass = H5P_create_class(lacc_class, "group access", 1, NULL, NULL, NULL, NULL, NULL, NULL))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); - - /* Register the group access class */ - if((H5P_CLS_GROUP_ACCESS_g = H5I_register(H5I_GENPROP_CLS, pclass)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); - - /* Register the file creation and file access property classes */ - - /* Allocate the file creation class */ - assert(H5P_CLS_FILE_CREATE_g==(-1)); - if (NULL==(pclass = H5P_create_class (gcrt_class,"file create",1,NULL,NULL,NULL,NULL,NULL,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); - - /* Register the file creation class */ - if ((H5P_CLS_FILE_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); - - /* Allocate the file access class */ - assert(H5P_CLS_FILE_ACCESS_g==(-1)); - if (NULL==(pclass = H5P_create_class (root_class,"file access",1,H5F_acs_create,NULL,H5F_acs_copy,NULL,H5F_acs_close,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); - - /* Register the file access class */ - if ((H5P_CLS_FILE_ACCESS_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); - - /* Register the dataset creation, dataset access and data xfer property classes */ - - /* Allocate the dataset creation class */ - assert(H5P_CLS_DATASET_CREATE_g==(-1)); - if (NULL==(pclass = H5P_create_class (ocrt_class,"dataset create",1,NULL,NULL,H5D_crt_copy,NULL,H5D_crt_close,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); - - /* Register the dataset creation class */ - if ((H5P_CLS_DATASET_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); - - /* Allocate the dataset access class */ - assert(H5P_CLS_DATASET_ACCESS_g==(-1)); - if (NULL==(pclass = H5P_create_class (lacc_class,"dataset access",1,NULL,NULL,NULL,NULL,NULL,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); - - /* Register the dataset access class */ - if ((H5P_CLS_DATASET_ACCESS_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); - - /* Allocate the data xfer class */ - assert(H5P_CLS_DATASET_XFER_g==(-1)); - if (NULL==(pclass = H5P_create_class (root_class,"data xfer",1,H5D_xfer_create,NULL,H5D_xfer_copy,NULL,H5D_xfer_close,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); - - /* Register the data xfer class */ - if ((H5P_CLS_DATASET_XFER_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); - - /* Register the mount property classes */ - - /* Allocate the mount class */ - assert(H5P_CLS_MOUNT_g==(-1)); - if (NULL==(pclass = H5P_create_class (root_class,"file mount",1,NULL,NULL,NULL,NULL,NULL,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); + /* Create object copy property class */ + if(H5P_init_class(H5P_CLS_OCPY) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Register the mount class */ - if ((H5P_CLS_MOUNT_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); + /* Create group access property class */ + if(H5P_init_class(H5P_CLS_GACC) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Register the named datatype creation and named datatype access property classes */ + /* Create file creation property class */ + if(H5P_init_class(H5P_CLS_FCRT) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Allocate the datatype creation class */ - assert(H5P_CLS_DATATYPE_CREATE_g==(-1)); - if (NULL==(pclass = H5P_create_class (ocrt_class,"datatype create",1,NULL,NULL,NULL,NULL,NULL,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); + /* Create file access property class */ + if(H5P_init_class(H5P_CLS_FACC) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Register the datatype creation class */ - if ((H5P_CLS_DATATYPE_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); + /* Create dataset creation property class */ + if(H5P_init_class(H5P_CLS_DCRT) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Allocate the datatype access class */ - assert(H5P_CLS_DATATYPE_ACCESS_g==(-1)); - if (NULL==(pclass = H5P_create_class (lacc_class,"datatype access",1,NULL /*H5T_acs_create*/,NULL,NULL /*H5T_acs_copy*/,NULL,NULL /*H5T_acs_close*/,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); + /* Create dataset access property class */ + if(H5P_init_class(H5P_CLS_DACC) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Register the datatype access class */ - if ((H5P_CLS_DATATYPE_ACCESS_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); + /* Create data transfer property class */ + if(H5P_init_class(H5P_CLS_DXFR) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Create string creation property class - * Objects that contain strings should inherit from this class - * For example, links and attributes have names associated with them. */ - - /* Allocate the string creation class */ - assert(H5P_CLS_STRING_CREATE_g==(-1)); - if (NULL==(strcrt_class = H5P_create_class (root_class,"string create",1,NULL,NULL,NULL,NULL,NULL,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); - - /* Register the string class */ - if ((H5P_CLS_STRING_CREATE_g = H5I_register (H5I_GENPROP_CLS, strcrt_class))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); - - /* Get the number of properties in the string class */ - if(H5P_get_nprops_pclass(strcrt_class,&nprops,FALSE)<0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't query number of properties") - - /* Assume that if there are properties in the class, they are the default ones */ - if(nprops==0) { - /* Register character encoding */ - if(H5P_register(strcrt_class,H5P_CHAR_ENCODING_NAME,H5P_CHAR_ENCODING_SIZE, - &char_encoding,NULL,NULL,NULL,NULL,NULL,NULL,NULL)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - } /* end if */ + /* Create file mount property class */ + if(H5P_init_class(H5P_CLS_FMNT) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Allocate the attribute creation class */ - assert(H5P_CLS_ATTRIBUTE_CREATE_g==(-1)); - if (NULL==(pclass = H5P_create_class (strcrt_class,"attribute create",1,NULL,NULL,NULL,NULL,NULL,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); + /* Create datatype creation property class */ + if(H5P_init_class(H5P_CLS_TCRT) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Register the attribute creation class */ - if ((H5P_CLS_ATTRIBUTE_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); + /* Create datatype access property class */ + if(H5P_init_class(H5P_CLS_TACC) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Allocate the link creation class */ - assert(H5P_CLS_LINK_CREATE_g==(-1)); - if (NULL==(pclass = H5P_create_class (strcrt_class,"link create",1,NULL,NULL,NULL,NULL,NULL,NULL))) - HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); + /* Create attribute creation property class */ + if(H5P_init_class(H5P_CLS_ACRT) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") - /* Register the link creation class */ - if ((H5P_CLS_LINK_CREATE_g = H5I_register (H5I_GENPROP_CLS, pclass))<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); + /* Create link creation property class */ + if(H5P_init_class(H5P_CLS_LCRT) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_init_interface() */ /*-------------------------------------------------------------------------- @@ -564,9 +524,7 @@ H5P_term_interface(void) /* Reset the default property lists, if they've been closed */ if(H5I_nmembers(H5I_GENPROP_LST)==0) { - H5P_LST_NO_CLASS_g = - H5P_CLS_OBJECT_CREATE_g = - H5P_LST_FILE_CREATE_g = + H5P_LST_FILE_CREATE_g = H5P_LST_FILE_ACCESS_g = H5P_LST_DATASET_CREATE_g = H5P_LST_DATASET_ACCESS_g = @@ -575,12 +533,11 @@ H5P_term_interface(void) H5P_LST_GROUP_ACCESS_g = H5P_LST_DATATYPE_CREATE_g = H5P_LST_DATATYPE_ACCESS_g = - H5P_CLS_STRING_CREATE_g = H5P_LST_ATTRIBUTE_CREATE_g = H5P_LST_OBJECT_COPY_g = H5P_LST_LINK_CREATE_g = H5P_LST_LINK_ACCESS_g = - H5P_LST_MOUNT_g = (-1); + H5P_LST_FILE_MOUNT_g = (-1); } /* end if */ } /* end if */ @@ -590,7 +547,7 @@ H5P_term_interface(void) /* Reset the default property lists, if they've been closed */ if(H5I_nmembers(H5I_GENPROP_CLS)==0) { - H5P_CLS_NO_CLASS_g = + H5P_CLS_ROOT_g = H5P_CLS_OBJECT_CREATE_g = H5P_CLS_FILE_CREATE_g = H5P_CLS_FILE_ACCESS_g = @@ -606,7 +563,7 @@ H5P_term_interface(void) H5P_CLS_OBJECT_COPY_g = H5P_CLS_LINK_CREATE_g = H5P_CLS_LINK_ACCESS_g = - H5P_CLS_MOUNT_g = (-1); + H5P_CLS_FILE_MOUNT_g = (-1); } /* end if */ } /* end if */ } else { @@ -1587,17 +1544,16 @@ H5P_check_class(void *_obj, hid_t UNUSED id, void *_key) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static H5P_genclass_t * +H5P_genclass_t * H5P_create_class(H5P_genclass_t *par_class, const char *name, unsigned internal, H5P_cls_create_func_t cls_create, void *create_data, H5P_cls_copy_func_t cls_copy, void *copy_data, - H5P_cls_close_func_t cls_close, void *close_data - ) + H5P_cls_close_func_t cls_close, void *close_data) { H5P_genclass_t *pclass=NULL; /* Property list class created */ H5P_genclass_t *ret_value; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5P_create_class); + FUNC_ENTER_NOAPI(H5P_create_class, NULL) assert(name); /* Allow internal classes to break some rules */ @@ -1644,12 +1600,11 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, unsigned internal, done: /* Free any resources allocated */ - if(ret_value==NULL) { + if(ret_value==NULL) if(pclass!=NULL) H5FL_FREE(H5P_genclass_t,pclass); - } - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5P_create_class() */ @@ -5993,3 +5948,4 @@ H5Pclose_class(hid_t cls_id) done: FUNC_LEAVE_API(ret_value); } /* H5Pclose_class() */ + diff --git a/src/H5Pacpl.c b/src/H5Pacpl.c index 6374dc0..fd5f5de 100644 --- a/src/H5Pacpl.c +++ b/src/H5Pacpl.c @@ -12,14 +12,72 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Pacpl.c + * January 2 2006 + * James Laird <jlaird@ncsa.uiuc.edu> + * + * Purpose: Attribute creation property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ -/* Private header files */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Ppkg.h" /* Property lists */ -/* Local datatypes */ -/* Static function prototypes */ +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Attribute creation property list class library initialization object */ +const H5P_libclass_t H5P_CLS_ACRT[1] = {{ + "attribute create", /* Class name for debugging */ + &H5P_CLS_STRING_CREATE_g, /* Parent class ID */ + &H5P_CLS_ATTRIBUTE_CREATE_g, /* Pointer to class ID */ + &H5P_LST_ATTRIBUTE_CREATE_g, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 42de1a5..7c258e6 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -12,10 +12,26 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Pdcpl.c + * February 26 1998 + * Robb Matzke <matzke@llnl.gov> + * + * Purpose: Dataset creation property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ -/* Private header files */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ @@ -24,11 +40,513 @@ #include "H5Ppkg.h" /* Property lists */ #include "H5Zprivate.h" /* Data filters */ -/* Local datatypes */ -/* Static function prototypes */ +/****************/ +/* Local Macros */ +/****************/ + +/* ======== Dataset creation properties ======== */ +/* Definitions for storage layout property */ +#define H5D_CRT_LAYOUT_SIZE sizeof(H5D_layout_t) +#define H5D_CRT_LAYOUT_DEF H5D_CONTIGUOUS +/* Definitions for chunk dimensionality property */ +#define H5D_CRT_CHUNK_DIM_SIZE sizeof(unsigned) +#define H5D_CRT_CHUNK_DIM_DEF 1 +/* Definitions for chunk size */ +#define H5D_CRT_CHUNK_SIZE_SIZE sizeof(size_t[H5O_LAYOUT_NDIMS]) +#define H5D_CRT_CHUNK_SIZE_DEF {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,\ + 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} +/* Definitions for fill value. size=0 means fill value will be 0 as + * library default; size=-1 means fill value is undefined. */ +#define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t) +#define H5D_CRT_FILL_VALUE_DEF {NULL, 0, NULL} +#define H5D_CRT_FILL_VALUE_CMP H5P_dcrt_fill_value_cmp +/* Definitions for space allocation time */ +#define H5D_CRT_ALLOC_TIME_SIZE sizeof(H5D_alloc_time_t) +#define H5D_CRT_ALLOC_TIME_DEF H5D_ALLOC_TIME_LATE +#define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state" +#define H5D_CRT_ALLOC_TIME_STATE_SIZE sizeof(unsigned) +#define H5D_CRT_ALLOC_TIME_STATE_DEF 1 +/* Definitions for time of fill value writing */ +#define H5D_CRT_FILL_TIME_SIZE sizeof(H5D_fill_time_t) +#define H5D_CRT_FILL_TIME_DEF H5D_FILL_TIME_IFSET +/* Definitions for external file list */ +#define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t) +#define H5D_CRT_EXT_FILE_LIST_DEF {HADDR_UNDEF, 0, 0, NULL} +#define H5D_CRT_EXT_FILE_LIST_CMP H5P_dcrt_ext_file_list_cmp +/* Definitions for data filter pipeline */ +#define H5D_CRT_DATA_PIPELINE_SIZE sizeof(H5O_pline_t) +#define H5D_CRT_DATA_PIPELINE_DEF {0, 0, NULL} +#define H5D_CRT_DATA_PIPELINE_CMP H5P_dcrt_data_pipeline_cmp + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* General routines */ static herr_t H5P_set_layout(H5P_genplist_t *plist, H5D_layout_t layout); +/* Property class callbacks */ +static herr_t H5P_dcrt_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P_dcrt_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data); +static herr_t H5P_dcrt_close(hid_t dxpl_id, void *close_data); + +/* Property callbacks */ +static int H5P_dcrt_fill_value_cmp(const void *value1, const void *value2, size_t size); +static int H5P_dcrt_ext_file_list_cmp(const void *value1, const void *value2, size_t size); +static int H5P_dcrt_data_pipeline_cmp(const void *value1, const void *value2, size_t size); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Dataset creation property list class library initialization object */ +const H5P_libclass_t H5P_CLS_DCRT[1] = {{ + "dataset create", /* Class name for debugging */ + &H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */ + &H5P_CLS_DATASET_CREATE_g, /* Pointer to class ID */ + &H5P_LST_DATASET_CREATE_g, /* Pointer to default property list ID */ + H5P_dcrt_reg_prop, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + H5P_dcrt_copy, /* Class copy callback */ + NULL, /* Class copy callback info */ + H5P_dcrt_close, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + + +/*------------------------------------------------------------------------- + * Function: H5P_dcrt_reg_prop + * + * Purpose: Register the dataset creation property list class's properties + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * October 31, 2006 + *------------------------------------------------------------------------- + */ +static herr_t +H5P_dcrt_reg_prop(H5P_genclass_t *pclass) +{ + H5D_layout_t layout = H5D_CRT_LAYOUT_DEF; /* Default storage layout */ + unsigned chunk_ndims = H5D_CRT_CHUNK_DIM_DEF; /* Default rank for chunks */ + size_t chunk_size[H5O_LAYOUT_NDIMS] = H5D_CRT_CHUNK_SIZE_DEF; /* Default chunk size */ + H5O_fill_t fill = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */ + H5D_alloc_time_t alloc_time = H5D_CRT_ALLOC_TIME_DEF; /* Default allocation time */ + unsigned alloc_time_state = H5D_CRT_ALLOC_TIME_STATE_DEF; /* Default allocation time state */ + H5D_fill_time_t fill_time = H5D_CRT_FILL_TIME_DEF; /* Default fill time */ + H5O_efl_t efl = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */ + H5O_pline_t pline = H5D_CRT_DATA_PIPELINE_DEF; /* Default I/O pipeline setting */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5P_dcrt_reg_prop) + + /* Register the storage layout property */ + if(H5P_register(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &layout, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the chunking dimensionality property */ + if(H5P_register(pclass, H5D_CRT_CHUNK_DIM_NAME, H5D_CRT_CHUNK_DIM_SIZE, &chunk_ndims, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the chunking size property */ + if(H5P_register(pclass, H5D_CRT_CHUNK_SIZE_NAME, H5D_CRT_CHUNK_SIZE_SIZE, chunk_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the fill value property */ + if(H5P_register(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &fill, NULL, NULL, NULL, NULL, NULL, H5D_CRT_FILL_VALUE_CMP, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the space allocation time property */ + if(H5P_register(pclass, H5D_CRT_ALLOC_TIME_NAME, H5D_CRT_ALLOC_TIME_SIZE, &alloc_time, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the space allocation time state property */ + if(H5P_register(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &alloc_time_state, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the fill value writing time property */ + if(H5P_register(pclass, H5D_CRT_FILL_TIME_NAME, H5D_CRT_FILL_TIME_SIZE, &fill_time, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the external file list property */ + if(H5P_register(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &efl, NULL, NULL, NULL, NULL, NULL, H5D_CRT_EXT_FILE_LIST_CMP, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the data pipeline property */ + if(H5P_register(pclass, H5D_CRT_DATA_PIPELINE_NAME, H5D_CRT_DATA_PIPELINE_SIZE, &pline, NULL, NULL, NULL, NULL, NULL, H5D_CRT_DATA_PIPELINE_CMP, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dcrt_reg_prop() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_dcrt_copy + * + * Purpose: Callback routine which is called whenever any dataset + * creation property list is copied. This routine copies + * the properties from the old list to the new list. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Raymond Lu + * Tuesday, October 2, 2001 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data) +{ + H5O_fill_t src_fill, dst_fill; /* Source & destination fill values */ + H5O_efl_t src_efl, dst_efl; /* Source & destination external file lists */ + H5O_pline_t src_pline, dst_pline; /* Source & destination I/O pipelines */ + H5P_genplist_t *src_plist; /* Pointer to source property list */ + H5P_genplist_t *dst_plist; /* Pointer to destination property list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5P_dcrt_copy) + + /* Verify property list IDs */ + if(NULL == (dst_plist = H5I_object(dst_plist_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + if(NULL == (src_plist = H5I_object(src_plist_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + + /* Get the fill value, external file list, and data pipeline properties + * from the old property list */ + if(H5P_get(src_plist, H5D_CRT_FILL_VALUE_NAME, &src_fill) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + if(H5P_get(src_plist, H5D_CRT_EXT_FILE_LIST_NAME, &src_efl) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") + if(H5P_get(src_plist, H5D_CRT_DATA_PIPELINE_NAME, &src_pline) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + + /* Make copies of fill value, external file list, and data pipeline */ + if(src_fill.buf) { + if(NULL == H5O_copy(H5O_FILL_ID, &src_fill, &dst_fill)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy fill value") + } /* end if */ + else { + dst_fill.type = dst_fill.buf = NULL; + dst_fill.size = src_fill.size; + } /* end else */ + HDmemset(&dst_efl, 0, sizeof(H5O_efl_t)); + if(NULL == H5O_copy(H5O_EFL_ID, &src_efl, &dst_efl)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy external file list") + if(NULL == H5O_copy(H5O_PLINE_ID, &src_pline, &dst_pline)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy data pipeline") + + /* Set the fill value, external file list, and data pipeline property + * for the destination property list */ + if(H5P_set(dst_plist, H5D_CRT_FILL_VALUE_NAME, &dst_fill) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value") + if(H5P_set(dst_plist, H5D_CRT_EXT_FILE_LIST_NAME, &dst_efl) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list") + if(H5P_set(dst_plist, H5D_CRT_DATA_PIPELINE_NAME, &dst_pline) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dcrt_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_dcrt_close + * + * Purpose: Callback routine which is called whenever any dataset create + * property list is closed. This routine performs any generic + * cleanup needed on the properties the library put into the list. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, July 11, 2001 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_dcrt_close(hid_t dcpl_id, void UNUSED *close_data) +{ + H5O_fill_t fill; /* Fill value */ + H5O_efl_t efl; /* External file list */ + H5O_pline_t pline; /* I/O pipeline */ + H5P_genplist_t *plist; /* Property list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5P_dcrt_close) + + /* Check arguments */ + if(NULL == (plist = H5I_object(dcpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + + /* Get the fill value, external file list, and data pipeline properties + * from the old property list */ + if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") + if(H5P_get(plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + + /* Clean up any values set for the fill-value, external file-list and + * data pipeline */ + if(H5O_reset(H5O_FILL_ID, &fill) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release fill info") + if(H5O_reset(H5O_EFL_ID, &efl) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release external file list info") + if(H5O_reset(H5O_PLINE_ID, &pline) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release pipeline info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dcrt_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_dcrt_fill_value_cmp + * + * Purpose: Callback routine which is called whenever the fill value + * property in the dataset creation property list is compared. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + * Programmer: Quincey Koziol + * Wednesday, January 7, 2004 + * + *------------------------------------------------------------------------- + */ +static int +H5P_dcrt_fill_value_cmp(const void *_fill1, const void *_fill2, size_t UNUSED size) +{ + const H5O_fill_t *fill1 = (const H5O_fill_t *)_fill1, /* Create local aliases for values */ + *fill2 = (const H5O_fill_t *)_fill2; + int cmp_value; /* Value from comparison */ + herr_t ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_dcrt_fill_value_cmp) + + /* Sanity check */ + HDassert(fill1); + HDassert(fill2); + HDassert(size == sizeof(H5O_fill_t)); + + /* Check the size of fill values */ + if(fill1->size < fill2->size) HGOTO_DONE(-1); + if(fill1->size > fill2->size) HGOTO_DONE(1); + + /* Check the types of the fill values */ + if(fill1->type == NULL && fill2->type != NULL) HGOTO_DONE(-1); + if(fill1->type != NULL && fill2->type == NULL) HGOTO_DONE(1); + if(fill1->type != NULL) + if((cmp_value = H5T_cmp(fill1->type, fill2->type, FALSE)) != 0) + HGOTO_DONE(cmp_value); + + /* Check the fill values in the buffers */ + if(fill1->buf == NULL && fill2->buf != NULL) HGOTO_DONE(-1); + if(fill1->buf != NULL && fill2->buf == NULL) HGOTO_DONE(1); + if(fill1->buf != NULL) + if((cmp_value = HDmemcmp(fill1->buf, fill2->buf, fill1->size)) != 0) + HGOTO_DONE(cmp_value); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dcrt_fill_value_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_dcrt_ext_file_list_cmp + * + * Purpose: Callback routine which is called whenever the external file + * list property in the dataset creation property list is + * compared. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + * Programmer: Quincey Koziol + * Wednesday, January 7, 2004 + * + *------------------------------------------------------------------------- + */ +static int +H5P_dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, size_t UNUSED size) +{ + const H5O_efl_t *efl1 = (const H5O_efl_t *)_efl1, /* Create local aliases for values */ + *efl2 = (const H5O_efl_t *)_efl2; + int cmp_value; /* Value from comparison */ + herr_t ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_dcrt_ext_file_list_cmp) + + /* Sanity check */ + HDassert(efl1); + HDassert(efl2); + HDassert(size == sizeof(H5O_efl_t)); + + /* Check the heap address of external file lists */ + if(H5F_addr_defined(efl1->heap_addr) || H5F_addr_defined(efl2->heap_addr)) { + if(!H5F_addr_defined(efl1->heap_addr) && H5F_addr_defined(efl2->heap_addr)) HGOTO_DONE(-1); + if(H5F_addr_defined(efl1->heap_addr) && !H5F_addr_defined(efl2->heap_addr)) HGOTO_DONE(1); + if((cmp_value = H5F_addr_cmp(efl1->heap_addr, efl2->heap_addr)) != 0) + HGOTO_DONE(cmp_value); + } /* end if */ + + /* Check the number of allocated efl entries */ + if(efl1->nalloc < efl2->nalloc) HGOTO_DONE(-1); + if(efl1->nalloc > efl2->nalloc) HGOTO_DONE(1); + + /* Check the number of used efl entries */ + if(efl1->nused < efl2->nused) HGOTO_DONE(-1); + if(efl1->nused > efl2->nused) HGOTO_DONE(1); + + /* Check the efl entry information */ + if(efl1->slot == NULL && efl2->slot != NULL) HGOTO_DONE(-1); + if(efl1->slot != NULL && efl2->slot == NULL) HGOTO_DONE(1); + if(efl1->slot != NULL && efl1->nused > 0) { + size_t u; /* Local index variable */ + + /* Loop through all entries, comparing them */ + for(u = 0; u < efl1->nused; u++) { + /* Check the name offset of the efl entry */ + if(efl1->slot[u].name_offset < efl2->slot[u].name_offset) HGOTO_DONE(-1); + if(efl1->slot[u].name_offset > efl2->slot[u].name_offset) HGOTO_DONE(1); + + /* Check the name of the efl entry */ + if(efl1->slot[u].name == NULL && efl2->slot[u].name != NULL) HGOTO_DONE(-1); + if(efl1->slot[u].name != NULL && efl2->slot[u].name == NULL) HGOTO_DONE(1); + if(efl1->slot[u].name != NULL) + if((cmp_value = HDstrcmp(efl1->slot[u].name, efl2->slot[u].name)) != 0) + HGOTO_DONE(cmp_value); + + /* Check the file offset of the efl entry */ + if(efl1->slot[u].offset < efl2->slot[u].offset) HGOTO_DONE(-1); + if(efl1->slot[u].offset > efl2->slot[u].offset) HGOTO_DONE(1); + + /* Check the file size of the efl entry */ + if(efl1->slot[u].size < efl2->slot[u].size) HGOTO_DONE(-1); + if(efl1->slot[u].size > efl2->slot[u].size) HGOTO_DONE(1); + } /* end for */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dcrt_ext_file_list_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_dcrt_data_pipeline_cmp + * + * Purpose: Callback routine which is called whenever the filter pipeline + * property in the dataset creation property list is compared. + * + * Return: positive if VALUE1 is greater than VALUE2, negative if + * VALUE2 is greater than VALUE1 and zero if VALUE1 and + * VALUE2 are equal. + * + * Programmer: Quincey Koziol + * Wednesday, January 7, 2004 + * + *------------------------------------------------------------------------- + */ +static int +H5P_dcrt_data_pipeline_cmp(const void *_pline1, const void *_pline2, size_t UNUSED size) +{ + const H5O_pline_t *pline1 = (const H5O_pline_t *)_pline1, /* Create local aliases for values */ + *pline2 = (const H5O_pline_t *)_pline2; + int cmp_value; /* Value from comparison */ + herr_t ret_value = 0; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5P_dcrt_data_pipeline_cmp) + + /* Sanity check */ + HDassert(pline1); + HDassert(pline2); + HDassert(size == sizeof(H5O_pline_t)); + + /* Check the number of allocated pipeline entries */ + if(pline1->nalloc < pline2->nalloc) HGOTO_DONE(-1); + if(pline1->nalloc > pline2->nalloc) HGOTO_DONE(1); + + /* Check the number of used pipeline entries */ + if(pline1->nused < pline2->nused) HGOTO_DONE(-1); + if(pline1->nused > pline2->nused) HGOTO_DONE(1); + + /* Check the filter entry information */ + if(pline1->filter == NULL && pline2->filter != NULL) HGOTO_DONE(-1); + if(pline1->filter != NULL && pline2->filter == NULL) HGOTO_DONE(1); + if(pline1->filter != NULL && pline1->nused > 0) { + size_t u; /* Local index variable */ + + /* Loop through all filters, comparing them */ + for(u = 0; u < pline1->nused; u++) { + /* Check the ID of the filter */ + if(pline1->filter[u].id < pline2->filter[u].id) HGOTO_DONE(-1); + if(pline1->filter[u].id > pline2->filter[u].id) HGOTO_DONE(1); + + /* Check the flags for the filter */ + if(pline1->filter[u].flags < pline2->filter[u].flags) HGOTO_DONE(-1); + if(pline1->filter[u].flags > pline2->filter[u].flags) HGOTO_DONE(1); + + /* Check the name of the filter */ + if(pline1->filter[u].name == NULL && pline2->filter[u].name != NULL) HGOTO_DONE(-1); + if(pline1->filter[u].name != NULL && pline2->filter[u].name == NULL) HGOTO_DONE(1); + if(pline1->filter[u].name != NULL) + if((cmp_value = HDstrcmp(pline1->filter[u].name, pline2->filter[u].name)) != 0) + HGOTO_DONE(cmp_value); + + /* Check the number of parameters for the filter */ + if(pline1->filter[u].cd_nelmts < pline2->filter[u].cd_nelmts) HGOTO_DONE(-1); + if(pline1->filter[u].cd_nelmts > pline2->filter[u].cd_nelmts) HGOTO_DONE(1); + + /* Check the filter parameter information */ + if(pline1->filter[u].cd_values == NULL && pline2->filter[u].cd_values != NULL) HGOTO_DONE(-1); + if(pline1->filter[u].cd_values != NULL && pline2->filter[u].cd_values == NULL) HGOTO_DONE(1); + if(pline1->filter[u].cd_values != NULL && pline1->filter[u].cd_nelmts > 0) { + size_t v; /* Local index variable */ + + /* Loop through all parameters, comparing them */ + for(v = 0; v < pline1->filter[u].cd_nelmts; v++) { + /* Check each parameter for the filter */ + if(pline1->filter[u].cd_values[v] < pline2->filter[u].cd_values[v]) HGOTO_DONE(-1); + if(pline1->filter[u].cd_values[v] > pline2->filter[u].cd_values[v]) HGOTO_DONE(1); + } /* end for */ + } /* end if */ + } /* end for */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dcrt_data_pipeline_cmp() */ + /*------------------------------------------------------------------------- * Function: H5P_set_layout @@ -866,7 +1384,8 @@ H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, #endif /* H5_WANT_H5_V1_6_COMPAT */ /* Check args */ - if(cd_nelmts || cd_values) { + if(cd_nelmts || cd_values) +{ /* * It's likely that users forget to initialize this on input, so * we'll check that it has a reasonable value. The actual number @@ -967,7 +1486,8 @@ H5Pget_filter_by_id(hid_t plist_id, H5Z_filter_t id, unsigned int *flags/*out*/, #endif /* H5_WANT_H5_V1_6_COMPAT */ /* Check args */ - if(cd_nelmts || cd_values) { + if(cd_nelmts || cd_values) +{ /* * It's likely that users forget to initialize this on input, so * we'll check that it has a reasonable value. The actual number diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 2a9b919..ea5a6bd 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -12,18 +12,536 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Pdxpl.c + * March 16 1998 + * Robb Matzke <matzke@llnl.gov> + * + * Purpose: Data transfer property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ -/* Private header files */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ #include "H5Ppkg.h" /* Property lists */ -/* Local datatypes */ -/* Static function prototypes */ +/****************/ +/* Local Macros */ +/****************/ + +/* ======== Data transfer properties ======== */ +/* Definitions for maximum temp buffer size property */ +#define H5D_XFER_MAX_TEMP_BUF_SIZE sizeof(size_t) +#define H5D_XFER_MAX_TEMP_BUF_DEF H5D_TEMP_BUF_SIZE +/* Definitions for type conversion buffer property */ +#define H5D_XFER_TCONV_BUF_SIZE sizeof(void *) +#define H5D_XFER_TCONV_BUF_DEF NULL +/* Definitions for background buffer property */ +#define H5D_XFER_BKGR_BUF_SIZE sizeof(void *) +#define H5D_XFER_BKGR_BUF_DEF NULL +/* Definitions for background buffer type property */ +#define H5D_XFER_BKGR_BUF_TYPE_SIZE sizeof(H5T_bkg_t) +#define H5D_XFER_BKGR_BUF_TYPE_DEF H5T_BKG_NO +/* Definitions for B-tree node splitting ratio property */ +/* (These default B-tree node splitting ratios are also used for splitting + * group's B-trees as well as chunked dataset's B-trees - QAK) + */ +#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3]) +#define H5D_XFER_BTREE_SPLIT_RATIO_DEF {0.1, 0.5, 0.9} +/* Definitions for vlen allocation function property */ +#define H5D_XFER_VLEN_ALLOC_SIZE sizeof(H5MM_allocate_t) +#define H5D_XFER_VLEN_ALLOC_DEF H5D_VLEN_ALLOC +/* Definitions for vlen allocation info property */ +#define H5D_XFER_VLEN_ALLOC_INFO_SIZE sizeof(void *) +#define H5D_XFER_VLEN_ALLOC_INFO_DEF H5D_VLEN_ALLOC_INFO +/* Definitions for vlen free function property */ +#define H5D_XFER_VLEN_FREE_SIZE sizeof(H5MM_free_t) +#define H5D_XFER_VLEN_FREE_DEF H5D_VLEN_FREE +/* Definitions for vlen free info property */ +#define H5D_XFER_VLEN_FREE_INFO_SIZE sizeof(void *) +#define H5D_XFER_VLEN_FREE_INFO_DEF H5D_VLEN_FREE_INFO +/* Definitions for file driver ID property */ +#define H5D_XFER_VFL_ID_SIZE sizeof(hid_t) +#define H5D_XFER_VFL_ID_DEF H5FD_VFD_DEFAULT +/* Definitions for file driver info property */ +#define H5D_XFER_VFL_INFO_SIZE sizeof(void *) +#define H5D_XFER_VFL_INFO_DEF NULL +/* Definitions for hyperslab vector size property */ +/* (Be cautious about increasing the default size, there are arrays allocated + * on the stack which depend on it - QAK) + */ +#define H5D_XFER_HYPER_VECTOR_SIZE_SIZE sizeof(size_t) +#define H5D_XFER_HYPER_VECTOR_SIZE_DEF H5D_IO_VECTOR_SIZE +/* Definitions for I/O transfer mode property */ +#define H5D_XFER_IO_XFER_MODE_SIZE sizeof(H5FD_mpio_xfer_t) +#define H5D_XFER_IO_XFER_MODE_DEF H5FD_MPIO_INDEPENDENT +/* Definitions for I/O optimization transfer mode property(using MPI-IO independent IO with file set view) */ +#define H5D_XFER_IO_XFER_OPT_MODE_SIZE sizeof(H5FD_mpio_collective_opt_t) +#define H5D_XFER_IO_XFER_OPT_MODE_DEF H5FD_MPIO_COLLECTIVE_IO +/* Definitions for optimization of MPI-IO transfer mode property */ +#define H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE sizeof(H5FD_mpio_collective_opt_t) +#define H5D_XFER_MPIO_COLLECTIVE_OPT_DEF H5FD_MPIO_COLLECTIVE_IO +#define H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE sizeof(H5FD_mpio_chunk_opt_t) +#define H5D_XFER_MPIO_CHUNK_OPT_HARD_DEF H5FD_MPIO_CHUNK_DEFAULT +#define H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE sizeof(unsigned) +#define H5D_XFER_MPIO_CHUNK_OPT_NUM_DEF H5D_ONE_LINK_CHUNK_IO_THRESHOLD +#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE sizeof(unsigned) +#define H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEF H5D_MULTI_CHUNK_IO_COL_THRESHOLD +/* Definitions for EDC property */ +#define H5D_XFER_EDC_SIZE sizeof(H5Z_EDC_t) +#define H5D_XFER_EDC_DEF H5Z_ENABLE_EDC +/* Definitions for filter callback function property */ +#define H5D_XFER_FILTER_CB_SIZE sizeof(H5Z_cb_t) +#define H5D_XFER_FILTER_CB_DEF {NULL,NULL} +/* Definitions for type conversion callback function property */ +#define H5D_XFER_CONV_CB_SIZE sizeof(H5T_conv_cb_t) +#define H5D_XFER_CONV_CB_DEF {NULL,NULL} +/* Definitions for data transform property */ +#define H5D_XFER_XFORM_SIZE sizeof(void *) +#define H5D_XFER_XFORM_DEF NULL +#define H5D_XFER_XFORM_DEL H5P_dxfr_xform_del +#define H5D_XFER_XFORM_COPY H5P_dxfr_xform_copy +#define H5D_XFER_XFORM_CLOSE H5P_dxfr_xform_close +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY +/* Definitions for collective chunk I/O property */ +#define H5D_XFER_COLL_CHUNK_SIZE sizeof(unsigned) +#define H5D_XFER_COLL_CHUNK_DEF 1 +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Property class callbacks */ +static herr_t H5P_dxfr_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P_dxfr_create(hid_t dxpl_id, void *create_data); +static herr_t H5P_dxfr_copy(hid_t dst_dxpl_id, hid_t src_dxpl_id, void *copy_data); +static herr_t H5P_dxfr_close(hid_t dxpl_id, void *close_data); + +/* Property list callbacks */ +static herr_t H5P_dxfr_xform_del(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P_dxfr_xform_copy(const char* name, size_t size, void* value); +static herr_t H5P_dxfr_xform_close(const char* name, size_t size, void* value); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Data transfer property list class library initialization object */ +const H5P_libclass_t H5P_CLS_DXFR[1] = {{ + "data transfer", /* Class name for debugging */ + &H5P_CLS_ROOT_g, /* Parent class ID */ + &H5P_CLS_DATASET_XFER_g, /* Pointer to class ID */ + &H5P_LST_DATASET_XFER_g, /* Pointer to default property list ID */ + H5P_dxfr_reg_prop, /* Default property registration routine */ + H5P_dxfr_create, /* Class creation callback */ + NULL, /* Class creation callback info */ + H5P_dxfr_copy, /* Class copy callback */ + NULL, /* Class copy callback info */ + H5P_dxfr_close, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + + +/*------------------------------------------------------------------------- + * Function: H5P_dxfr_reg_prop + * + * Purpose: Register the data transfer property list class's properties + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * October 31, 2006 + *------------------------------------------------------------------------- + */ +static herr_t +H5P_dxfr_reg_prop(H5P_genclass_t *pclass) +{ + size_t def_max_temp_buf = H5D_XFER_MAX_TEMP_BUF_DEF; /* Default value for maximum temp buffer size */ + void *def_tconv_buf = H5D_XFER_TCONV_BUF_DEF; /* Default value for type conversion buffer */ + void *def_bkgr_buf = H5D_XFER_BKGR_BUF_DEF; /* Default value for background buffer */ + H5T_bkg_t def_bkgr_buf_type = H5D_XFER_BKGR_BUF_TYPE_DEF; + double def_btree_split_ratio[3] = H5D_XFER_BTREE_SPLIT_RATIO_DEF; /* Default value for B-tree node split ratios */ + H5MM_allocate_t def_vlen_alloc = H5D_XFER_VLEN_ALLOC_DEF; /* Default value for vlen allocation function */ + void *def_vlen_alloc_info = H5D_XFER_VLEN_ALLOC_INFO_DEF; /* Default value for vlen allocation information */ + H5MM_free_t def_vlen_free = H5D_XFER_VLEN_FREE_DEF; /* Default value for vlen free function */ + void *def_vlen_free_info = H5D_XFER_VLEN_FREE_INFO_DEF; /* Default value for vlen free information */ + hid_t def_vfl_id = H5D_XFER_VFL_ID_DEF; /* Default value for file driver ID */ + void *def_vfl_info = H5D_XFER_VFL_INFO_DEF; /* Default value for file driver info */ + size_t def_hyp_vec_size = H5D_XFER_HYPER_VECTOR_SIZE_DEF; /* Default value for vector size */ +#ifdef H5_HAVE_PARALLEL + H5FD_mpio_xfer_t def_io_xfer_mode = H5D_XFER_IO_XFER_MODE_DEF; /* Default value for I/O transfer mode */ + H5FD_mpio_collective_opt_t def_io_xfer_opt_mode = H5D_XFER_IO_XFER_OPT_MODE_DEF; + H5FD_mpio_chunk_opt_t def_mpio_chunk_opt_mode = H5D_XFER_MPIO_CHUNK_OPT_HARD_DEF; + H5FD_mpio_collective_opt_t def_mpio_collective_opt_mode = H5D_XFER_MPIO_COLLECTIVE_OPT_DEF; + unsigned def_mpio_chunk_opt_num = H5D_XFER_MPIO_CHUNK_OPT_NUM_DEF; + unsigned def_mpio_chunk_opt_ratio = H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEF; +#endif /* H5_HAVE_PARALLEL */ + H5Z_EDC_t enable_edc = H5D_XFER_EDC_DEF; /* Default value for EDC property */ + H5Z_cb_t filter_cb = H5D_XFER_FILTER_CB_DEF; /* Default value for filter callback */ + H5T_conv_cb_t conv_cb = H5D_XFER_CONV_CB_DEF; /* Default value for datatype conversion callback */ + void *def_xfer_xform = H5D_XFER_XFORM_DEF; /* Default value for data transform */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5P_dxfr_reg_prop) + + /* Register the max. temp buffer size property */ + if(H5P_register(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &def_max_temp_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the type conversion buffer property */ + if(H5P_register(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &def_tconv_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the background buffer property */ + if(H5P_register(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &def_bkgr_buf, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the background buffer type property */ + if(H5P_register(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &def_bkgr_buf_type, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the B-Tree node splitting ratios property */ + if(H5P_register(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, def_btree_split_ratio, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the vlen allocation function property */ + if(H5P_register(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &def_vlen_alloc, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the vlen allocation information property */ + if(H5P_register(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &def_vlen_alloc_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the vlen free function property */ + if(H5P_register(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &def_vlen_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the vlen free information property */ + if(H5P_register(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &def_vlen_free_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the file driver ID property */ + if(H5P_register(pclass, H5D_XFER_VFL_ID_NAME, H5D_XFER_VFL_ID_SIZE, &def_vfl_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the file driver info property */ + if(H5P_register(pclass, H5D_XFER_VFL_INFO_NAME, H5D_XFER_VFL_INFO_SIZE, &def_vfl_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the vector size property */ + if(H5P_register(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &def_hyp_vec_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +#ifdef H5_HAVE_PARALLEL + /* Register the I/O transfer mode property */ + if(H5P_register(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &def_io_xfer_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + if(H5P_register(pclass, H5D_XFER_IO_XFER_OPT_MODE_NAME, H5D_XFER_IO_XFER_OPT_MODE_SIZE, &def_io_xfer_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + if(H5P_register(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &def_mpio_collective_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + if(H5P_register(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &def_mpio_chunk_opt_mode, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + if(H5P_register(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &def_mpio_chunk_opt_num, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + if(H5P_register(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &def_mpio_chunk_opt_ratio, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#endif /* H5_HAVE_PARALLEL */ + + /* Register the EDC property */ + if(H5P_register(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &enable_edc, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the filter callback property */ + if(H5P_register(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &filter_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the type conversion callback property */ + if(H5P_register(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &conv_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the data transform property */ + if(H5P_register(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &def_xfer_xform, NULL, NULL, NULL, H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, NULL, H5D_XFER_XFORM_CLOSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dxfr_reg_prop() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_dxfr_create + * + * Purpose: Callback routine which is called whenever any dataset transfer + * property list is created. This routine performs any generic + * initialization needed on the properties the library put into + * the list. + * Right now, it's just allocating the driver-specific dataset + * transfer information. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Quincey Koziol + * Thursday, August 2, 2001 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_dxfr_create(hid_t dxpl_id, void UNUSED *create_data) +{ + hid_t driver_id; /* VFL driver ID */ + void *driver_info; /* VFL driver info */ + H5P_genplist_t *plist; /* Property list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5P_dxfr_create) + + /* Check arguments */ + if(NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") + + /* Get the driver information */ + if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID") + if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver info") + + /* Check if we have a valid driver ID */ + if(driver_id > 0) { + /* Set the driver for the property list */ + if(H5FD_dxpl_open(plist, driver_id, driver_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dxfr_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_dxfr_copy + * + * Purpose: Callback routine which is called whenever any dataset + * transfer property list is copied. This routine copies + * the properties from the old list to the new list. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Raymond Lu + * Tuesday, October 2, 2001 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_dxfr_copy(hid_t dst_dxpl_id, hid_t src_dxpl_id, void UNUSED *copy_data) +{ + hid_t driver_id; + void* driver_info; + H5P_genplist_t *dst_plist; /* Destination property list */ + H5P_genplist_t *src_plist; /* Source property list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5P_dxfr_copy) + + if(NULL == (dst_plist = H5I_object(dst_dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + if(NULL == (src_plist = H5I_object(src_dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + + /* Get values from old property list */ + if(H5P_get(src_plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve VFL driver ID") + if(H5P_get(src_plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get drver info") + + if(driver_id > 0) { + /* Set the driver for the property list */ + if(H5FD_dxpl_open(dst_plist, driver_id, driver_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dxfr_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_dxfr_close + * + * Purpose: Callback routine which is called whenever any dataset transfer + * property list is closed. This routine performs any generic + * cleanup needed on the properties the library put into the list. + * Right now, it's just freeing the driver-specific dataset + * transfer information. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Quincey Koziol + * Wednesday, July 11, 2001 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_dxfr_close(hid_t dxpl_id, void UNUSED *close_data) +{ + hid_t driver_id; /* VFL driver ID */ + void *driver_info; /* VFL driver info */ + H5P_genplist_t *plist; /* Property list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5P_dxfr_close) + + /* Check arguments */ + if(NULL == (plist = H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") + + if(H5P_get(plist, H5D_XFER_VFL_ID_NAME, &driver_id) < 0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver ID") + if(H5P_get(plist, H5D_XFER_VFL_INFO_NAME, &driver_info) < 0) + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve VFL driver info") + if(driver_id > 0) { + /* Close the driver for the property list */ + if(H5FD_dxpl_close(driver_id, driver_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset driver") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dxfr_close() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_dxfr_xform_del + * + * Purpose: Frees memory allocated by H5P_dxfr_xform_set + * + * Return: Success: SUCCEED, Failure: FAIL + * + * Programmer: Leon Arber larber@uiuc.edu + * + * Date: April 9, 2004 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_dxfr_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5P_dxfr_xform_del, FAIL) + + HDassert(value); + + if(H5Z_xform_destroy(*(H5Z_data_xform_t **)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing the parse tree") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dxfr_xform_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_dxfr_xform_copy + * + * Purpose: Creates a copy of the user's data transform string and its + * associated parse tree. + * + * Return: Success: SUCCEED, Failure: FAIL + * + * Programmer: Leon Arber larber@uiuc.edu + * + * Date: April 9, 2004 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_dxfr_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5P_dxfr_xform_copy, FAIL) + + if(H5Z_xform_copy((H5Z_data_xform_t **)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error copying the data transform info") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dxfr_xform_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P_dxfr_xform_close + * + * Purpose: Frees memory allocated by H5P_dxfr_xform_set + * + * Return: Success: SUCCEED, Failure: FAIL + * + * Programmer: Leon Arber larber@uiuc.edu + * + * Date: April 9, 2004 + * + *------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_dxfr_xform_close(const char UNUSED *name, size_t UNUSED size, void *value) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5P_dxfr_xform_close, FAIL) + + HDassert(value); + + if(H5Z_xform_destroy(*(H5Z_data_xform_t **)value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing the parse tree") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_dxfr_xform_close() */ /*------------------------------------------------------------------------- diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index bcb7cd4..1f88afb 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -12,10 +12,26 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Pfapl.c + * February 26 1998 + * Robb Matzke <matzke@llnl.gov> + * + * Purpose: File access property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ -/* Private header files */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ @@ -27,14 +43,394 @@ /* Default file driver - see H5Pget_driver() */ #include "H5FDsec2.h" /* Posix unbuffered I/O file driver */ -/* Local datatypes */ -/* Static function prototypes */ +/****************/ +/* Local Macros */ +/****************/ + +/* ========= File Access properties ============ */ +/* Definitions for the initial metadata cache resize configuration */ +#define H5F_ACS_META_CACHE_INIT_CONFIG_SIZE sizeof(H5AC_cache_config_t) +#define H5F_ACS_META_CACHE_INIT_CONFIG_DEF H5AC__DEFAULT_CACHE_CONFIG +/* Definitions for size of raw data chunk cache(elements) */ +#define H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE sizeof(size_t) +#define H5F_ACS_DATA_CACHE_ELMT_SIZE_DEF 521 +/* Definition for size of raw data chunk cache(bytes) */ +#define H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE sizeof(size_t) +#define H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF (1024*1024) +/* Definition for preemption read chunks first */ +#define H5F_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double) +#define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75 +/* Definition for threshold for alignment */ +#define H5F_ACS_ALIGN_THRHD_SIZE sizeof(hsize_t) +#define H5F_ACS_ALIGN_THRHD_DEF 1 +/* Definition for alignment */ +#define H5F_ACS_ALIGN_SIZE sizeof(hsize_t) +#define H5F_ACS_ALIGN_DEF 1 +/* Definition for minimum metadata allocation block size (when + aggregating metadata allocations. */ +#define H5F_ACS_META_BLOCK_SIZE_SIZE sizeof(hsize_t) +#define H5F_ACS_META_BLOCK_SIZE_DEF 2048 +/* Definition for maximum sieve buffer size (when data sieving + is allowed by file driver */ +#define H5F_ACS_SIEVE_BUF_SIZE_SIZE sizeof(size_t) +#define H5F_ACS_SIEVE_BUF_SIZE_DEF (64*1024) +/* Definition for minimum "small data" allocation block size (when + aggregating "small" raw data allocations. */ +#define H5F_ACS_SDATA_BLOCK_SIZE_SIZE sizeof(hsize_t) +#define H5F_ACS_SDATA_BLOCK_SIZE_DEF 2048 +/* Definition for garbage-collect references */ +#define H5F_ACS_GARBG_COLCT_REF_SIZE sizeof(unsigned) +#define H5F_ACS_GARBG_COLCT_REF_DEF 0 +/* Definition for file driver ID */ +#define H5F_ACS_FILE_DRV_ID_SIZE sizeof(hid_t) +#define H5F_ACS_FILE_DRV_ID_DEF H5FD_SEC2 +/* Definition for file driver info */ +#define H5F_ACS_FILE_DRV_INFO_SIZE sizeof(void*) +#define H5F_ACS_FILE_DRV_INFO_DEF NULL +/* Definition for file close degree */ +#define H5F_CLOSE_DEGREE_SIZE sizeof(H5F_close_degree_t) +#define H5F_CLOSE_DEGREE_DEF H5F_CLOSE_DEFAULT +/* Definition for offset position in file for family file driver */ +#define H5F_ACS_FAMILY_OFFSET_SIZE sizeof(hsize_t) +#define H5F_ACS_FAMILY_OFFSET_DEF 0 +/* Definition for new member size of family driver. It's private + * property only used by h5repart */ +#define H5F_ACS_FAMILY_NEWSIZE_SIZE sizeof(hsize_t) +#define H5F_ACS_FAMILY_NEWSIZE_DEF 0 +/* Definition for whether to convert family to sec2 driver. It's private + * property only used by h5repart */ +#define H5F_ACS_FAMILY_TO_SEC2_SIZE sizeof(hbool_t) +#define H5F_ACS_FAMILY_TO_SEC2_DEF FALSE +/* Definition for data type in multi file driver */ +#define H5F_ACS_MULTI_TYPE_SIZE sizeof(H5FD_mem_t) +#define H5F_ACS_MULTI_TYPE_DEF H5FD_MEM_DEFAULT +/* Definition for 'use latest format version' flag */ +#define H5F_ACS_LATEST_FORMAT_SIZE sizeof(hbool_t) +#define H5F_ACS_LATEST_FORMAT_DEF FALSE + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* General routines */ static herr_t H5P_set_family_offset(H5P_genplist_t *plist, hsize_t offset); static herr_t H5P_get_family_offset(H5P_genplist_t *plist, hsize_t *offset); static herr_t H5P_set_multi_type(H5P_genplist_t *plist, H5FD_mem_t type); static herr_t H5P_get_multi_type(H5P_genplist_t *plist, H5FD_mem_t *type); +/* Property class callbacks */ +static herr_t H5P_facc_reg_prop(H5P_genclass_t *pclass); +static herr_t H5P_facc_create(hid_t fapl_id, void *copy_data); +static herr_t H5P_facc_copy(hid_t new_plist_t, hid_t old_plist_t, void *copy_data); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* File access property list class library initialization object */ +const H5P_libclass_t H5P_CLS_FACC[1] = {{ + "file access", /* Class name for debugging */ + &H5P_CLS_ROOT_g, /* Parent class ID */ + &H5P_CLS_FILE_ACCESS_g, /* Pointer to class ID */ + &H5P_LST_FILE_ACCESS_g, /* Pointer to default property list ID */ + H5P_facc_reg_prop, /* Default property registration routine */ + H5P_facc_create, /* Class creation callback */ + NULL, /* Class creation callback info */ + H5P_facc_copy, /* Class copy callback */ + NULL, /* Class copy callback info */ + H5P_facc_close, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5P_facc_reg_prop + * + * Purpose: Register the file access property list class's properties + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * October 31, 2006 + *------------------------------------------------------------------------- + */ +static herr_t +H5P_facc_reg_prop(H5P_genclass_t *pclass) +{ + H5AC_cache_config_t mdc_initCacheCfg = H5F_ACS_META_CACHE_INIT_CONFIG_DEF; /* Default metadata cache settings */ + size_t rdcc_nelmts = H5F_ACS_DATA_CACHE_ELMT_SIZE_DEF; /* Default raw data chunk cache # of elements */ + size_t rdcc_nbytes = H5F_ACS_DATA_CACHE_BYTE_SIZE_DEF; /* Default raw data chunk cache # of bytes */ + double rdcc_w0 = H5F_ACS_PREEMPT_READ_CHUNKS_DEF; /* Default raw data chunk cache dirty ratio */ + hsize_t threshold = H5F_ACS_ALIGN_THRHD_DEF; /* Default allocation alignment threshold */ + hsize_t alignment = H5F_ACS_ALIGN_DEF; /* Default allocation alignment value */ + hsize_t meta_block_size = H5F_ACS_META_BLOCK_SIZE_DEF; /* Default metadata allocation block size */ + size_t sieve_buf_size = H5F_ACS_SIEVE_BUF_SIZE_DEF; /* Default raw data I/O sieve buffer size */ + hsize_t sdata_block_size = H5F_ACS_SDATA_BLOCK_SIZE_DEF; /* Default small data allocation block size */ + unsigned gc_ref = H5F_ACS_GARBG_COLCT_REF_DEF; /* Default garbage collection for references setting */ + hid_t driver_id = H5F_ACS_FILE_DRV_ID_DEF; /* Default VFL driver ID */ + void *driver_info = H5F_ACS_FILE_DRV_INFO_DEF; /* Default VFL driver info */ + H5F_close_degree_t close_degree = H5F_CLOSE_DEGREE_DEF; /* Default file close degree */ + hsize_t family_offset = H5F_ACS_FAMILY_OFFSET_DEF; /* Default offset for family VFD */ + hsize_t family_newsize = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */ + hbool_t family_to_sec2 = H5F_ACS_FAMILY_TO_SEC2_DEF; /* Default ?? for family VFD */ + H5FD_mem_t mem_type = H5F_ACS_MULTI_TYPE_DEF; /* Default file space type for multi VFD */ + hbool_t latest_format = H5F_ACS_LATEST_FORMAT_DEF; /* Default setting for "use the latest version of the format" flag */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5P_facc_reg_prop) + + /* Register the initial metadata cache resize configuration */ + if(H5P_register(pclass, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, H5F_ACS_META_CACHE_INIT_CONFIG_SIZE, &mdc_initCacheCfg, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the size of raw data chunk cache (elements) */ + if(H5P_register(pclass, H5F_ACS_DATA_CACHE_ELMT_SIZE_NAME, H5F_ACS_DATA_CACHE_ELMT_SIZE_SIZE, &rdcc_nelmts, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the size of raw data chunk cache(bytes) */ + if(H5P_register(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the preemption for reading chunks */ + if(H5P_register(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the threshold for alignment */ + if(H5P_register(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &threshold, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the alignment */ + if(H5P_register(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &alignment, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the minimum metadata allocation block size */ + if(H5P_register(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &meta_block_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the maximum sieve buffer size */ + if(H5P_register(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &sieve_buf_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the minimum "small data" allocation block size */ + if(H5P_register(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &sdata_block_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the garbage collection reference */ + if(H5P_register(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &gc_ref, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the file driver ID */ + if(H5P_register(pclass, H5F_ACS_FILE_DRV_ID_NAME, H5F_ACS_FILE_DRV_ID_SIZE, &driver_id, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the file driver info */ + if(H5P_register(pclass, H5F_ACS_FILE_DRV_INFO_NAME, H5F_ACS_FILE_DRV_INFO_SIZE, &driver_info, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the file close degree */ + if(H5P_register(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &close_degree, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the offset of family driver info */ + if(H5P_register(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &family_offset, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the private property of new family file size. It's used by h5repart only. */ + if(H5P_register(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &family_newsize, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */ + if(H5P_register(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &family_to_sec2, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the data type of multi driver info */ + if(H5P_register(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &mem_type, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the 'use the latest version of the format' flag */ + if(H5P_register(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &latest_format, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_facc_reg_prop() */ + + +/*---------------------------------------------------------------------------- + * Function: H5P_facc_create + * + * Purpose: Callback routine which is called whenever a file access + * property list is closed. This routine performs any generic + * initialization needed on the properties the library put into + * the list. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Raymond Lu + * Tuesday, Oct 23, 2001 + * + *---------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_facc_create(hid_t fapl_id, void UNUSED *copy_data) +{ + hid_t driver_id; + H5P_genplist_t *plist; /* Property list */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT(H5P_facc_create) + + /* Check argument */ + if(NULL == (plist = H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Retrieve driver ID property */ + if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") + + if(driver_id > 0) { + void *driver_info; + + /* Retrieve driver info property */ + if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver info") + + /* Set the driver for the property list */ + if(H5FD_fapl_open(plist, driver_id, driver_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_facc_create() */ + + +/*-------------------------------------------------------------------------- + * Function: H5P_facc_copy + * + * Purpose: Callback routine which is called whenever a file access + * property list is copied. This routine performs any generic + * copy needed on the properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Raymond Lu + * Tuesday, Oct 23, 2001 + * + *-------------------------------------------------------------------------- + */ +/* ARGSUSED */ +static herr_t +H5P_facc_copy(hid_t dst_fapl_id, hid_t src_fapl_id, void UNUSED *copy_data) +{ + hid_t driver_id; + H5P_genplist_t *src_plist; /* Source property list */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT(H5P_facc_copy) + + /* Get driver ID from source property list */ + if(NULL == (src_plist = H5I_object(src_fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + if(H5P_get(src_plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") + + if(driver_id > 0) { + H5P_genplist_t *dst_plist; /* Destination property list */ + void *driver_info; + + /* Get driver info from source property list */ + if(H5P_get(src_plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver info") + + /* Set the driver for the destination property list */ + if(NULL == (dst_plist = H5I_object(dst_fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") + if(H5FD_fapl_open(dst_plist, driver_id, driver_info) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_facc_copy() */ + + +/*-------------------------------------------------------------------------- + * Function: H5P_facc_close + * + * Purpose: Callback routine which is called whenever a file access + * property list is closed. This routine performs any generic + * cleanup needed on the properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Raymond Lu + * Tuesday, Oct 23, 2001 + * + *--------------------------------------------------------------------------- + */ +/* ARGSUSED */ +herr_t +H5P_facc_close(hid_t fapl_id, void UNUSED *close_data) +{ + hid_t driver_id; + H5P_genplist_t *plist; /* Property list */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(H5P_facc_close, FAIL) + + /* Check argument */ + if(NULL == (plist = H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + + /* Get driver ID property */ + if(H5P_get(plist, H5F_ACS_FILE_DRV_ID_NAME, &driver_id) < 0) + HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ + + if(driver_id > 0) { + void *driver_info; + + /* Get driver info property */ + if(H5P_get(plist, H5F_ACS_FILE_DRV_INFO_NAME, &driver_info) < 0) + HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ + + /* Close the driver for the property list */ + if(H5FD_fapl_close(driver_id, driver_info) < 0) + HGOTO_DONE(FAIL) /* Can't return errors when library is shutting down */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_facc_close() */ + /*------------------------------------------------------------------------- * Function: H5Pset_alignment @@ -1146,22 +1542,22 @@ herr_t H5Pset_fclose_degree(hid_t plist_id, H5F_close_degree_t degree) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_API(H5Pset_fclose_degree, FAIL); + FUNC_ENTER_API(H5Pset_fclose_degree, FAIL) H5TRACE2("e","iFd",plist_id,degree); /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set values */ - if(H5P_set(plist, H5F_CLOSE_DEGREE_NAME, °ree) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree"); + if(H5P_set(plist, H5F_ACS_CLOSE_DEGREE_NAME, °ree) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_fclose_degree() */ /*------------------------------------------------------------------------- @@ -1178,23 +1574,25 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5Pget_fclose_degree(hid_t plist_id, H5F_close_degree_t *degree) +herr_t +H5Pget_fclose_degree(hid_t plist_id, H5F_close_degree_t *degree) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_API(H5Pget_fclose_degree, FAIL); + FUNC_ENTER_API(H5Pget_fclose_degree, FAIL) + H5TRACE2("e","i*Fd",plist_id,degree); /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); + if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if( degree && (H5P_get(plist, H5F_CLOSE_DEGREE_NAME, degree) < 0) ) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree"); + if(degree && H5P_get(plist, H5F_ACS_CLOSE_DEGREE_NAME, degree) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree") done: - FUNC_LEAVE_API(ret_value); -} + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_fclose_degree() */ /*------------------------------------------------------------------------- diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index 48ae10d..994b6be 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -12,19 +12,181 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Pfcpl.c + * January 6 1998 + * Robb Matzke <matzke@llnl.gov> + * + * Purpose: File creation property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ -/* Private header files */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Bprivate.h" /* B-tree subclass names */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ #include "H5Ppkg.h" /* Property lists */ -/* Local datatypes */ -/* Static function prototypes */ +/****************/ +/* Local Macros */ +/****************/ + +/* ========= File Creation properties ============ */ +/* Definitions for the size of the file user block in bytes */ +#define H5F_CRT_USER_BLOCK_SIZE sizeof(hsize_t) +#define H5F_CRT_USER_BLOCK_DEF 0 +/* Definitions for the 1/2 rank for symbol table leaf nodes */ +#define H5F_CRT_SYM_LEAF_SIZE sizeof(unsigned) +#define H5F_CRT_SYM_LEAF_DEF 4 +/* Definitions for the 1/2 rank for btree internal nodes */ +#define H5F_CRT_BTREE_RANK_SIZE sizeof(unsigned[H5B_NUM_BTREE_ID]) +#define H5F_CRT_BTREE_RANK_DEF {HDF5_BTREE_SNODE_IK_DEF,HDF5_BTREE_ISTORE_IK_DEF} +/* Definitions for byte number in an address */ +#define H5F_CRT_ADDR_BYTE_NUM_SIZE sizeof(size_t) +#define H5F_CRT_ADDR_BYTE_NUM_DEF H5F_OBJ_ADDR_SIZE +/* Definitions for byte number for object size */ +#define H5F_CRT_OBJ_BYTE_NUM_SIZE sizeof(size_t) +#define H5F_CRT_OBJ_BYTE_NUM_DEF H5F_OBJ_SIZE_SIZE +/* Definitions for version number of the superblock */ +#define H5F_CRT_SUPER_VERS_SIZE sizeof(unsigned) +#define H5F_CRT_SUPER_VERS_DEF HDF5_SUPERBLOCK_VERSION_DEF +/* Definitions for free-space version number */ +#define H5F_CRT_FREESPACE_VERS_SIZE sizeof(unsigned) +#define H5F_CRT_FREESPACE_VERS_DEF HDF5_FREESPACE_VERSION +/* Definitions for object directory version number */ +#define H5F_CRT_OBJ_DIR_VERS_SIZE sizeof(unsigned) +#define H5F_CRT_OBJ_DIR_VERS_DEF HDF5_OBJECTDIR_VERSION +/* Definitions for shared-header format version */ +#define H5F_CRT_SHARE_HEAD_VERS_SIZE sizeof(unsigned) +#define H5F_CRT_SHARE_HEAD_VERS_DEF HDF5_SHAREDHEADER_VERSION + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Property class callbacks */ +static herr_t H5P_fcrt_reg_prop(H5P_genclass_t *pclass); + +/*********************/ +/* Package Variables */ +/*********************/ + +/* File creation property list class library initialization object */ +const H5P_libclass_t H5P_CLS_FCRT[1] = {{ + "file create", /* Class name for debugging */ + &H5P_CLS_GROUP_CREATE_g, /* Parent class ID */ + &H5P_CLS_FILE_CREATE_g, /* Pointer to class ID */ + &H5P_LST_FILE_CREATE_g, /* Pointer to default property list ID */ + H5P_fcrt_reg_prop, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5P_fcrt_reg_prop + * + * Purpose: Register the file creation property list class's properties + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * October 31, 2006 + *------------------------------------------------------------------------- + */ +static herr_t +H5P_fcrt_reg_prop(H5P_genclass_t *pclass) +{ + hsize_t userblock_size = H5F_CRT_USER_BLOCK_DEF; /* Default userblock size */ + unsigned sym_leaf_k = H5F_CRT_SYM_LEAF_DEF; /* Default size for symbol table leaf nodes */ + unsigned btree_k[H5B_NUM_BTREE_ID] = H5F_CRT_BTREE_RANK_DEF; /* Default 'K' values for B-trees in file */ + size_t sizeof_addr = H5F_CRT_ADDR_BYTE_NUM_DEF; /* Default size of addresses in the file */ + size_t sizeof_size = H5F_CRT_OBJ_BYTE_NUM_DEF; /* Default size of sizes in the file */ + unsigned superblock_ver = H5F_CRT_SUPER_VERS_DEF; /* Default superblock version # */ + unsigned freespace_ver = H5F_CRT_FREESPACE_VERS_DEF;/* Default free space version # */ + unsigned objectdir_ver = H5F_CRT_OBJ_DIR_VERS_DEF; /* Default object directory version # */ + unsigned sharedheader_ver = H5F_CRT_SHARE_HEAD_VERS_DEF; /* Default shared header message version # */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5P_fcrt_reg_prop) + + /* Register the user block size */ + if(H5P_register(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &userblock_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the 1/2 rank for symbol table leaf nodes */ + if(H5P_register(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &sym_leaf_k, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the 1/2 rank for btree internal nodes */ + if(H5P_register(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, btree_k, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the byte number for an address */ + if(H5P_register(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &sizeof_addr, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the byte number for object size */ + if(H5P_register(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &sizeof_size, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the superblock version number */ + if(H5P_register(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &superblock_ver, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the free-space version number */ + if(H5P_register(pclass, H5F_CRT_FREESPACE_VERS_NAME, H5F_CRT_FREESPACE_VERS_SIZE, &freespace_ver, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the object directory version number */ + if(H5P_register(pclass, H5F_CRT_OBJ_DIR_VERS_NAME, H5F_CRT_OBJ_DIR_VERS_SIZE, &objectdir_ver, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register the shared-header version number */ + if(H5P_register(pclass, H5F_CRT_SHARE_HEAD_VERS_NAME, H5F_CRT_SHARE_HEAD_VERS_SIZE, &sharedheader_ver, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_fcrt_reg_prop() */ /*------------------------------------------------------------------------- diff --git a/src/H5Pfmpl.c b/src/H5Pfmpl.c new file mode 100644 index 0000000..1f2e8c6 --- /dev/null +++ b/src/H5Pfmpl.c @@ -0,0 +1,121 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*------------------------------------------------------------------------- + * + * Created: H5Pmtpl.c + * November 1 2006 + * Quincey Koziol <koziol@hdfgroup.org> + * + * Purpose: File mount property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ +#define H5P_PACKAGE /*suppress error about including H5Ppkg */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Ppkg.h" /* Property lists */ + + +/****************/ +/* Local Macros */ +/****************/ + +/* ======================== File Mount properties ====================*/ +/* Definition for whether absolute symlinks local to file. */ +#define H5F_MNT_SYM_LOCAL_SIZE sizeof(hbool_t) +#define H5F_MNT_SYM_LOCAL_DEF FALSE + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Property class callbacks */ +static herr_t H5P_fmnt_reg_prop(H5P_genclass_t *pclass); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* File mount property list class library initialization object */ +const H5P_libclass_t H5P_CLS_FMNT[1] = {{ + "file mount", /* Class name for debugging */ + &H5P_CLS_ROOT_g, /* Parent class ID */ + &H5P_CLS_FILE_MOUNT_g, /* Pointer to class ID */ + &H5P_LST_FILE_MOUNT_g, /* Pointer to default property list ID */ + H5P_fmnt_reg_prop, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + + +/*------------------------------------------------------------------------- + * Function: H5P_fmnt_reg_prop + * + * Purpose: Register the file mount property list class's properties + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * October 31, 2006 + *------------------------------------------------------------------------- + */ +static herr_t +H5P_fmnt_reg_prop(H5P_genclass_t *pclass) +{ + hbool_t local = H5F_MNT_SYM_LOCAL_DEF; /* Whether symlinks are local to file */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5P_fmnt_reg_prop) + + /* Register property of whether symlinks is local to file */ + if(H5P_register(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &local, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_fmnt_reg_prop() */ + diff --git a/src/H5Pgcpl.c b/src/H5Pgcpl.c index 5e4d281..2fa79e1 100644 --- a/src/H5Pgcpl.c +++ b/src/H5Pgcpl.c @@ -12,17 +12,118 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Pgcpl.c + * August 29 2006 + * Quincey Koziol <koziol@ncsa.uiuc.edu> + * + * Purpose: Group creation property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ -/* Private header files */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5Ppkg.h" /* Property lists */ -/* Local datatypes */ -/* Static function prototypes */ +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Property class callbacks */ +static herr_t H5P_gcrt_reg_prop(H5P_genclass_t *pclass); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Group creation property list class library initialization object */ +const H5P_libclass_t H5P_CLS_GCRT[1] = {{ + "group create", /* Class name for debugging */ + &H5P_CLS_OBJECT_CREATE_g, /* Parent class ID */ + &H5P_CLS_GROUP_CREATE_g, /* Pointer to class ID */ + &H5P_LST_GROUP_CREATE_g, /* Pointer to default property list ID */ + H5P_gcrt_reg_prop, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5P_gcrt_reg_prop + * + * Purpose: Initialize the group creation property list class + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * October 31, 2006 + *------------------------------------------------------------------------- + */ +herr_t +H5P_gcrt_reg_prop(H5P_genclass_t *pclass) +{ + H5O_ginfo_t ginfo = H5G_CRT_GROUP_INFO_DEF; /* Default group info settings */ + H5O_linfo_t linfo = H5G_CRT_LINK_INFO_DEF; /* Default link info settings */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5P_gcrt_reg_prop, FAIL) + + /* Register group info property */ + if(H5P_register(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, + &ginfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register link info property */ + if(H5P_register(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, + &linfo, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_gcrt_reg_prop() */ /*------------------------------------------------------------------------- diff --git a/src/H5Plapl.c b/src/H5Plapl.c index b91aa05..795f5e0 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -12,18 +12,125 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Plapl.c + * July 14 2006 + * James Laird <jlaird@ncsa.uiuc.edu> + * + * Purpose: Link access property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ -/* Private header files */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5Ppkg.h" /* Property lists */ -/* Local datatypes */ -/* Static function prototypes */ +/****************/ +/* Local Macros */ +/****************/ + +/* ======== Link access properties ======== */ +/* Definitions for number of soft links to traverse */ +#define H5L_ACS_NLINKS_SIZE sizeof(size_t) +#define H5L_ACS_NLINKS_DEF H5L_NUM_LINKS /*max symlinks to follow per lookup */ +/* Definitions for external link prefix */ +#define H5L_ACS_ELINK_PREFIX_SIZE sizeof(char *) +#define H5L_ACS_ELINK_PREFIX_DEF NULL /*default is no prefix */ + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Property class callbacks */ +static herr_t H5P_lacc_reg_prop(H5P_genclass_t *pclass); + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Dataset creation property list class library initialization object */ +const H5P_libclass_t H5P_CLS_LACC[1] = {{ + "link access", /* Class name for debugging */ + &H5P_CLS_ROOT_g, /* Parent class ID */ + &H5P_CLS_LINK_ACCESS_g, /* Pointer to class ID */ + &H5P_LST_LINK_ACCESS_g, /* Pointer to default property list ID */ + H5P_lacc_reg_prop, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5P_lacc_reg_prop + * + * Purpose: Register the dataset creation property list class's properties + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * October 31, 2006 + *------------------------------------------------------------------------- + */ +herr_t +H5P_lacc_reg_prop(H5P_genclass_t *pclass) +{ + size_t nlinks = H5L_ACS_NLINKS_DEF; /* Default number of soft links to traverse */ + char *elink_prefix = H5L_ACS_ELINK_PREFIX_DEF; /* Default external link prefix string */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5P_lacc_reg_prop, FAIL) + + /* Register property for number of links traversed */ + if(H5P_register(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, + &nlinks, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + + /* Register property for external link prefix */ + if(H5P_register(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, + &elink_prefix, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_lacc_reg_prop() */ /*------------------------------------------------------------------------- @@ -64,7 +171,7 @@ H5Pset_nlinks(hid_t plist_id, size_t nlinks) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set number of links */ - if(H5P_set(plist, H5L_NLINKS_NAME, &nlinks) < 0) + if(H5P_set(plist, H5L_ACS_NLINKS_NAME, &nlinks) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set nlink info") done: @@ -105,7 +212,7 @@ H5Pget_nlinks(hid_t plist_id, size_t *nlinks) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the current number of links */ - if(H5P_get(plist, H5L_NLINKS_NAME, nlinks) < 0) + if(H5P_get(plist, H5L_ACS_NLINKS_NAME, nlinks) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of links") done: @@ -145,7 +252,7 @@ H5Pset_elink_prefix(hid_t plist_id, const char *prefix) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set prefix */ - if(H5P_set(plist, H5L_ELINK_PREFIX_NAME, &prefix) < 0) + if(H5P_set(plist, H5L_ACS_ELINK_PREFIX_NAME, &prefix) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") done: @@ -186,7 +293,7 @@ H5Pget_elink_prefix(hid_t plist_id, char **prefix) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the current prefix */ - if(H5P_get(plist, H5L_ELINK_PREFIX_NAME, prefix) < 0) + if(H5P_get(plist, H5L_ACS_ELINK_PREFIX_NAME, prefix) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix") done: diff --git a/src/H5Plcpl.c b/src/H5Plcpl.c index c4a85a9..bdbfd84 100644 --- a/src/H5Plcpl.c +++ b/src/H5Plcpl.c @@ -12,17 +12,119 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Plcpl.c + * May 8 2006 + * Peter Cao <xcao@ncsa.uiuc.edu> + * + * Purpose: Link creation property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ -/* Private header files */ + +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5Ppkg.h" /* Property lists */ -/* Local datatypes */ -/* Static function prototypes */ +/****************/ +/* Local Macros */ +/****************/ + +/* ======== Link creation properties ======== */ +/* Definitions for create intermediate groups flag */ +#define H5L_CRT_INTERMEDIATE_GROUP_SIZE sizeof(unsigned) +#define H5L_CRT_INTERMEDIATE_GROUP_DEF 0 + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Property class callbacks */ +static herr_t H5P_lcrt_reg_prop(H5P_genclass_t *pclass); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Link creation property list class library initialization object */ +const H5P_libclass_t H5P_CLS_LCRT[1] = {{ + "link create", /* Class name for debugging */ + &H5P_CLS_STRING_CREATE_g, /* Parent class ID */ + &H5P_CLS_LINK_CREATE_g, /* Pointer to class ID */ + &H5P_LST_LINK_CREATE_g, /* Pointer to default property list ID */ + H5P_lcrt_reg_prop, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5P_lcrt_reg_prop + * + * Purpose: Register the dataset creation property list class's properties + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * October 31, 2006 + *------------------------------------------------------------------------- + */ +herr_t +H5P_lcrt_reg_prop(H5P_genclass_t *pclass) +{ + unsigned intmd_group = H5L_CRT_INTERMEDIATE_GROUP_DEF; /* Default setting for creating intermediate groups */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5P_lcrt_reg_prop, FAIL) + + /* Register create intermediate groups property */ + if(H5P_register(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, + &intmd_group, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_lcrt_reg_prop() */ /*------------------------------------------------------------------------- diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index 717ed38..b080fb1 100755 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -12,17 +12,118 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Pocpl.c + * Mar 13 2006 + * Peter Cao <xcao@ncsa.uiuc.edu> + * + * Purpose: Object copying property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ -/* Private header files */ + +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ #include "H5Ppkg.h" /* Property lists */ -/* Local datatypes */ -/* Static function prototypes */ +/****************/ +/* Local Macros */ +/****************/ + +/* ========= Object Copy properties ============ */ +/* Definitions for copy options */ +#define H5G_CPY_OPTION_SIZE sizeof(unsigned) +#define H5G_CPY_OPTION_DEF 0 + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Property class callbacks */ +static herr_t H5P_ocpy_reg_prop(H5P_genclass_t *pclass); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Object copy property list class library initialization object */ +const H5P_libclass_t H5P_CLS_OCPY[1] = {{ + "object copy", /* Class name for debugging */ + &H5P_CLS_ROOT_g, /* Parent class ID */ + &H5P_CLS_OBJECT_COPY_g, /* Pointer to class ID */ + &H5P_LST_OBJECT_COPY_g, /* Pointer to default property list ID */ + H5P_ocpy_reg_prop, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5P_ocpy_reg_prop + * + * Purpose: Initialize the object copy property list class + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * October 31, 2006 + *------------------------------------------------------------------------- + */ +herr_t +H5P_ocpy_reg_prop(H5P_genclass_t *pclass) +{ + unsigned ocpy_option = H5G_CPY_OPTION_DEF; /* Default object copy flags */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5P_ocpy_reg_prop, FAIL) + + /* Register copy options property */ + if(H5P_register(pclass, H5G_CPY_OPTION_NAME, H5G_CPY_OPTION_SIZE, + &ocpy_option, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_ocpy_reg_prop() */ /*------------------------------------------------------------------------- @@ -39,7 +140,7 @@ * H5G_COPY_EXPAND_EXT_LINK_FLAG -- Expand external links into new objects * H5G_COPY_EXPAND_REFERENCE_FLAG -- Copy objects that are pointed by references * H5G_COPY_WITHOUT_ATTR_FLAG -- Copy object without copying attributes -* + * * Return: Non-negative on success/Negative on failure * * Programmer: Peter Cao diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 61ab1a8..2ed9063 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -110,7 +110,59 @@ struct H5P_genplist_t { H5SL_t *props; /* Skip list containing properties */ }; +/* Function pointer for library classes with properties to register */ +typedef herr_t (*H5P_init_class_op_t)(H5P_genclass_t *pclass); +typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); + +/* + * Each library property list class has a variable of this type that contains + * class variables and methods used to initialize the class. + */ +typedef struct H5P_libclass_t { + const char *name; /* Class name */ + + hid_t const * const par_class_id; /* Pointer to global parent class property list class ID */ + hid_t * const class_id; /* Pointer to global property list class ID */ + hid_t * const def_plist_id; /* Pointer to global default property list ID */ + H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */ + + /* Class callback function pointers & info */ + H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ + void *create_data; /* Pointer to user data to pass along to create callback */ + H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ + void *copy_data; /* Pointer to user data to pass along to copy callback */ + H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ + void *close_data; /* Pointer to user data to pass along to close callback */ +} H5P_libclass_t; + +/* + * Library property list classes. + */ + +H5_DLLVAR const H5P_libclass_t H5P_CLS_ROOT[1]; /* Root */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_OCRT[1]; /* Object create */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_STRCRT[1]; /* String create */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_LACC[1]; /* Link access */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_GCRT[1]; /* Group create */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_OCPY[1]; /* Object copy */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_GACC[1]; /* Group access */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_FCRT[1]; /* File creation */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_DCRT[1]; /* Dataset creation */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_DXFR[1]; /* Data transfer */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_FMNT[1]; /* File mount */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_TCRT[1]; /* Datatype creation */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_TACC[1]; /* Datatype access */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_ACRT[1]; /* Attribute creation */ +H5_DLLVAR const H5P_libclass_t H5P_CLS_LCRT[1]; /* Link creation */ + /* Private functions, not part of the publicly documented API */ +H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, + const char *name, unsigned internal, + H5P_cls_create_func_t cls_create, void *create_data, + H5P_cls_copy_func_t cls_copy, void *copy_data, + H5P_cls_close_func_t cls_close, void *close_data); H5_DLL herr_t H5P_add_prop(H5SL_t *props, H5P_genprop_t *prop); H5_DLL herr_t H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod); H5_DLL char *H5P_get_class_path(H5P_genclass_t *pclass); @@ -118,6 +170,9 @@ H5_DLL H5P_genclass_t *H5P_open_class_path(const char *path); H5_DLL int H5P_tbbt_strcmp(const void *k1, const void *k2, int cmparg); H5_DLL herr_t H5P_close_class(void *_pclass); +/* Class initialization routines */ +H5_DLL herr_t H5P_ocpy_init(H5P_genclass_t *pclass); + /* Testing functions */ #ifdef H5P_TESTING H5_DLL char *H5P_get_class_path_test(hid_t pclass_id); diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index f81c233..5209893 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -28,7 +28,7 @@ /* String creation properties */ #define H5P_CHAR_ENCODING_NAME "character_encoding" #define H5P_CHAR_ENCODING_SIZE sizeof(H5T_cset_t) -#define H5P_CHAR_ENCODING_DEF H5F_CRT_DEFAULT_CSET +#define H5P_CHAR_ENCODING_DEF H5F_DEFAULT_CSET /* Forward declarations for anonymous H5P objects */ typedef struct H5P_genplist_t H5P_genplist_t; diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index ed671c5..c19a1f9 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -80,14 +80,14 @@ typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data); #define H5OPEN #endif /* _H5private_H */ -#define H5P_NO_CLASS (H5OPEN H5P_CLS_NO_CLASS_g) +#define H5P_ROOT (H5OPEN H5P_CLS_ROOT_g) #define H5P_OBJECT_CREATE (H5OPEN H5P_CLS_OBJECT_CREATE_g) #define H5P_FILE_CREATE (H5OPEN H5P_CLS_FILE_CREATE_g) #define H5P_FILE_ACCESS (H5OPEN H5P_CLS_FILE_ACCESS_g) #define H5P_DATASET_CREATE (H5OPEN H5P_CLS_DATASET_CREATE_g) #define H5P_DATASET_ACCESS (H5OPEN H5P_CLS_DATASET_ACCESS_g) #define H5P_DATASET_XFER (H5OPEN H5P_CLS_DATASET_XFER_g) -#define H5P_MOUNT (H5OPEN H5P_CLS_MOUNT_g) +#define H5P_FILE_MOUNT (H5OPEN H5P_CLS_FILE_MOUNT_g) #define H5P_GROUP_CREATE (H5OPEN H5P_CLS_GROUP_CREATE_g) #define H5P_GROUP_ACCESS (H5OPEN H5P_CLS_GROUP_ACCESS_g) #define H5P_DATATYPE_CREATE (H5OPEN H5P_CLS_DATATYPE_CREATE_g) @@ -97,14 +97,14 @@ typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data); #define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_g) #define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_g) #define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_g) -H5_DLLVAR hid_t H5P_CLS_NO_CLASS_g; +H5_DLLVAR hid_t H5P_CLS_ROOT_g; H5_DLLVAR hid_t H5P_CLS_OBJECT_CREATE_g; H5_DLLVAR hid_t H5P_CLS_FILE_CREATE_g; H5_DLLVAR hid_t H5P_CLS_FILE_ACCESS_g; H5_DLLVAR hid_t H5P_CLS_DATASET_CREATE_g; H5_DLLVAR hid_t H5P_CLS_DATASET_ACCESS_g; H5_DLLVAR hid_t H5P_CLS_DATASET_XFER_g; -H5_DLLVAR hid_t H5P_CLS_MOUNT_g; +H5_DLLVAR hid_t H5P_CLS_FILE_MOUNT_g; H5_DLLVAR hid_t H5P_CLS_GROUP_CREATE_g; H5_DLLVAR hid_t H5P_CLS_GROUP_ACCESS_g; H5_DLLVAR hid_t H5P_CLS_DATATYPE_CREATE_g; @@ -118,33 +118,28 @@ H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_g; /* * The library created default property lists * - * NOTE: When adding H5P_* macros, remember to redefine them in H5Pprivate.h - * */ -#define H5P_NO_CLASS_DEFAULT (H5OPEN H5P_LST_NO_CLASS_g) #define H5P_OBJ_CLASS_DEFAULT (H5OPEN H5P_LST_OBJ_CLASS_g) #define H5P_FILE_CREATE_DEFAULT (H5OPEN H5P_LST_FILE_CREATE_g) #define H5P_FILE_ACCESS_DEFAULT (H5OPEN H5P_LST_FILE_ACCESS_g) #define H5P_DATASET_CREATE_DEFAULT (H5OPEN H5P_LST_DATASET_CREATE_g) #define H5P_DATASET_ACCESS_DEFAULT (H5OPEN H5P_LST_DATASET_ACCESS_g) #define H5P_DATASET_XFER_DEFAULT (H5OPEN H5P_LST_DATASET_XFER_g) -#define H5P_MOUNT_DEFAULT (H5OPEN H5P_LST_MOUNT_g) +#define H5P_FILE_MOUNT_DEFAULT (H5OPEN H5P_LST_FILE_MOUNT_g) #define H5P_GROUP_CREATE_DEFAULT (H5OPEN H5P_LST_GROUP_CREATE_g) #define H5P_GROUP_ACCESS_DEFAULT (H5OPEN H5P_LST_GROUP_ACCESS_g) #define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_g) #define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_g) -#define H5P_STRING_CLASS_DEFAULT (H5OPEN H5P_LST_STRING_CLASS_g) #define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_g) #define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_g) #define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_g) #define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_g) -H5_DLLVAR hid_t H5P_LST_NO_CLASS_g; H5_DLLVAR hid_t H5P_LST_FILE_CREATE_g; H5_DLLVAR hid_t H5P_LST_FILE_ACCESS_g; H5_DLLVAR hid_t H5P_LST_DATASET_CREATE_g; H5_DLLVAR hid_t H5P_LST_DATASET_ACCESS_g; H5_DLLVAR hid_t H5P_LST_DATASET_XFER_g; -H5_DLLVAR hid_t H5P_LST_MOUNT_g; +H5_DLLVAR hid_t H5P_LST_FILE_MOUNT_g; H5_DLLVAR hid_t H5P_LST_GROUP_CREATE_g; H5_DLLVAR hid_t H5P_LST_GROUP_ACCESS_g; H5_DLLVAR hid_t H5P_LST_DATATYPE_CREATE_g; diff --git a/src/H5Pstrcpl.c b/src/H5Pstrcpl.c index 6a307c0..46fe02d 100644 --- a/src/H5Pstrcpl.c +++ b/src/H5Pstrcpl.c @@ -12,16 +12,113 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/*------------------------------------------------------------------------- + * + * Created: H5Pstrcpl.c + * October 26 2005 + * James Laird <jlaird@ncsa.uiuc.edu> + * + * Purpose: String creation property list class routines + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ #define H5P_PACKAGE /*suppress error about including H5Ppkg */ -/* Private header files */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ #include "H5Ppkg.h" /* Property lists */ -/* Local datatypes */ -/* Static function prototypes */ +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Property class callbacks */ +static herr_t H5P_strcrt_reg_prop(H5P_genclass_t *pclass); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* String creation property list class library initialization object */ +const H5P_libclass_t H5P_CLS_STRCRT[1] = {{ + "string create", /* Class name for debugging */ + &H5P_CLS_ROOT_g, /* Parent class ID */ + &H5P_CLS_STRING_CREATE_g, /* Pointer to class ID */ + NULL, /* Pointer to default property list ID */ + H5P_strcrt_reg_prop, /* Default property registration routine */ + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5P_strcrt_reg_prop + * + * Purpose: Register the dataset creation property list class's properties + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * October 31, 2006 + *------------------------------------------------------------------------- + */ +herr_t +H5P_strcrt_reg_prop(H5P_genclass_t *pclass) +{ + H5T_cset_t char_encoding = H5P_CHAR_ENCODING_DEF; /* Default character set encoding */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(H5P_strcrt_reg_prop, FAIL) + + /* Register character encoding */ + if(H5P_register(pclass, H5P_CHAR_ENCODING_NAME, H5P_CHAR_ENCODING_SIZE, + &char_encoding, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_strcrt_reg_prop() */ + /*------------------------------------------------------------------------- * Function: H5Pset_char_encoding diff --git a/src/H5Sselect.c b/src/H5Sselect.c index a7d8106..a12339b 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -1058,10 +1058,10 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of element in dataspace */ hssize_t nelmts; /* Number of elements in selection */ hsize_t space_size[H5O_LAYOUT_NDIMS]; /* Dataspace size */ - hsize_t off[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence offsets */ + hsize_t off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */ hsize_t curr_off; /* Current offset within sequence */ hsize_t tmp_off; /* Temporary offset within sequence */ - size_t len[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence lengths */ + size_t len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */ size_t curr_len; /* Length of bytes left to process in sequence */ size_t nseq; /* Number of sequences generated */ size_t curr_seq; /* Current sequnce being worked on */ @@ -1112,7 +1112,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t /* Loop, while elements left in selection */ while(max_elem>0 && user_ret==0) { /* Get the sequences of bytes */ - if(H5S_SELECT_GET_SEQ_LIST(space, 0, &iter, (size_t)H5D_XFER_HYPER_VECTOR_SIZE_DEF, max_elem, &nseq, &nelem, off, len) < 0) + if(H5S_SELECT_GET_SEQ_LIST(space, 0, &iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Loop, while sequences left to process */ @@ -1438,8 +1438,8 @@ H5S_select_fill(void *_fill, size_t fill_size, const H5S_t *space, void *_buf) uint8_t *buf; /* Current location in buffer */ void *fill=_fill; /* Alias for fill-value buffer */ hssize_t nelmts; /* Number of elements in selection */ - hsize_t off[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence offsets */ - size_t len[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence lengths */ + hsize_t off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */ + size_t len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */ size_t nseq; /* Number of sequences generated */ size_t curr_seq; /* Current sequnce being worked on */ size_t nelem; /* Number of elements used in sequences */ @@ -1474,7 +1474,7 @@ H5S_select_fill(void *_fill, size_t fill_size, const H5S_t *space, void *_buf) /* Loop, while elements left in selection */ while(max_elem>0) { /* Get the sequences of bytes */ - if(H5S_SELECT_GET_SEQ_LIST(space, 0, &iter, (size_t)H5D_XFER_HYPER_VECTOR_SIZE_DEF, max_elem, &nseq, &nelem, off, len) < 0) + if(H5S_SELECT_GET_SEQ_LIST(space, 0, &iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0) HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Loop over sequences */ @@ -419,7 +419,7 @@ static H5T_t *H5T_decode(const unsigned char *buf); #define H5T_INIT_TYPE_STRING_COMMON { \ H5T_INIT_TYPE_ALLOC_COMMON(H5T_STRING) \ H5T_INIT_TYPE_NUM_COMMON(H5T_ORDER_NONE) \ - dt->shared->u.atomic.u.s.cset = H5F_CRT_DEFAULT_CSET; \ + dt->shared->u.atomic.u.s.cset = H5F_DEFAULT_CSET; \ } #define H5T_INIT_TYPE_CSTRING_CORE { \ @@ -732,58 +732,57 @@ H5T_init_interface(void) herr_t status; unsigned copied_dtype=1; /* Flag to indicate whether datatype was copied or allocated (for error cleanup) */ H5P_genclass_t *crt_pclass; /* Property list class for datatype creation properties */ - H5P_genclass_t *acc_pclass; /* Property list class for datatype access properties */ herr_t ret_value=SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5T_init_interface); + FUNC_ENTER_NOAPI_NOINIT(H5T_init_interface) /* Initialize the atom group for the file IDs */ - if (H5I_register_type(H5I_DATATYPE, (size_t)H5I_DATATYPEID_HASHSIZE, H5T_RESERVED_ATOMS, (H5I_free_t)H5T_close)<0) - HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface"); + if(H5I_register_type(H5I_DATATYPE, (size_t)H5I_DATATYPEID_HASHSIZE, H5T_RESERVED_ATOMS, (H5I_free_t)H5T_close)<0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Make certain there aren't too many classes of datatypes defined */ /* Only 16 (numbered 0-15) are supported in the current file format */ - assert(H5T_NCLASSES<16); + HDassert(H5T_NCLASSES < 16); /* Perform any necessary hardware initializations */ if(H5T_init_hw()<0) - HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface") /* * Initialize pre-defined native data types from code generated during * the library configuration by H5detect. */ - if (H5TN_init_interface()<0) - HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface"); + if(H5TN_init_interface()<0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Get the atomic datatype structures needed by the initialization code below */ - if (NULL==(native_schar=H5I_object(H5T_NATIVE_SCHAR_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); - if (NULL==(native_uchar=H5I_object(H5T_NATIVE_UCHAR_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); - if (NULL==(native_short=H5I_object(H5T_NATIVE_SHORT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); - if (NULL==(native_ushort=H5I_object(H5T_NATIVE_USHORT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); - if (NULL==(native_int=H5I_object(H5T_NATIVE_INT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); - if (NULL==(native_uint=H5I_object(H5T_NATIVE_UINT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); - if (NULL==(native_long=H5I_object(H5T_NATIVE_LONG_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); - if (NULL==(native_ulong=H5I_object(H5T_NATIVE_ULONG_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); - if (NULL==(native_llong=H5I_object(H5T_NATIVE_LLONG_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); - if (NULL==(native_ullong=H5I_object(H5T_NATIVE_ULLONG_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); - if (NULL==(native_float=H5I_object(H5T_NATIVE_FLOAT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); - if (NULL==(native_double=H5I_object(H5T_NATIVE_DOUBLE_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); + if(NULL==(native_schar=H5I_object(H5T_NATIVE_SCHAR_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + if(NULL==(native_uchar=H5I_object(H5T_NATIVE_UCHAR_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + if(NULL==(native_short=H5I_object(H5T_NATIVE_SHORT_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + if(NULL==(native_ushort=H5I_object(H5T_NATIVE_USHORT_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + if(NULL==(native_int=H5I_object(H5T_NATIVE_INT_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + if(NULL==(native_uint=H5I_object(H5T_NATIVE_UINT_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + if(NULL==(native_long=H5I_object(H5T_NATIVE_LONG_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + if(NULL==(native_ulong=H5I_object(H5T_NATIVE_ULONG_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + if(NULL==(native_llong=H5I_object(H5T_NATIVE_LLONG_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + if(NULL==(native_ullong=H5I_object(H5T_NATIVE_ULLONG_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + if(NULL==(native_float=H5I_object(H5T_NATIVE_FLOAT_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + if(NULL==(native_double=H5I_object(H5T_NATIVE_DOUBLE_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") #if H5_SIZEOF_LONG_DOUBLE !=0 - if (NULL==(native_ldouble=H5I_object(H5T_NATIVE_LDOUBLE_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); + if(NULL==(native_ldouble=H5I_object(H5T_NATIVE_LDOUBLE_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") #endif /*------------------------------------------------------------ @@ -1001,13 +1000,13 @@ H5T_init_interface(void) fixedpt = native_int; floatpt = native_float; if (NULL == (compound = H5T_create(H5T_COMPOUND, (size_t)1))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (NULL == (enum_type = H5T_create(H5T_ENUM, (size_t)1))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (NULL == (vlen = H5T_vlen_create(native_int))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (NULL == (array = H5T_array_create(native_int, 1, dim))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + 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); @@ -1305,7 +1304,7 @@ H5T_init_interface(void) status |= H5T_init_inf(); if (status<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function(s)"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function(s)") /* ========== Datatype Creation Property Class Initialization ============*/ assert(H5P_CLS_DATATYPE_CREATE_g!=-1); @@ -1325,20 +1324,6 @@ H5T_init_interface(void) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") } /* end if */ - /* ========== Datatype Access Property Class Initialization ============*/ - assert(H5P_CLS_DATATYPE_ACCESS_g!=-1); - - /* Get the pointer to dataset access class */ - if(NULL == (acc_pclass = H5I_object(H5P_CLS_DATATYPE_ACCESS_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") - - /* Only register the default property list if it hasn't been created yet */ - if(H5P_LST_DATATYPE_ACCESS_g == (-1)) { - /* Register the default dataset access property list */ - if((H5P_LST_DATATYPE_ACCESS_g = H5P_create_id(acc_pclass))<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") - } /* end if */ - done: /* General cleanup */ if (compound!=NULL) @@ -1364,8 +1349,8 @@ done: } /* end if */ } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5T_init_interface() */ /*------------------------------------------------------------------------- diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 5a8bd18..95d0e21 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -57,10 +57,10 @@ static herr_t H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_b /* Default settings for variable-length allocation routines */ static H5T_vlen_alloc_info_t H5T_vlen_def_vl_alloc_info ={ - H5D_XFER_VLEN_ALLOC_DEF, - H5D_XFER_VLEN_ALLOC_INFO_DEF, - H5D_XFER_VLEN_FREE_DEF, - H5D_XFER_VLEN_FREE_INFO_DEF + H5D_VLEN_ALLOC, + H5D_VLEN_ALLOC_INFO, + H5D_VLEN_FREE, + H5D_VLEN_FREE_INFO }; diff --git a/src/Makefile.am b/src/Makefile.am index d37c4bc..364ba6b 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -60,7 +60,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Ocont.c H5Odtype.c H5Oefl.c H5Ofill.c H5Oginfo.c H5Olayout.c \ H5Olinfo.c H5Olink.c H5Omtime.c \ H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \ - H5P.c H5Pacpl.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pgcpl.c \ + H5P.c H5Pacpl.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ + H5Pgcpl.c \ H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pstrcpl.c H5Ptest.c H5R.c H5RC.c \ H5RS.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \ H5Sselect.c H5Stest.c \ diff --git a/src/Makefile.in b/src/Makefile.in index d16791f..3bb42ad 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -105,16 +105,16 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \ H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omtime.lo H5Oname.lo \ H5Onull.lo H5Opline.lo H5Osdspace.lo H5Oshared.lo H5Ostab.lo \ H5P.lo H5Pacpl.lo H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo \ - H5Pgcpl.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pstrcpl.lo \ - H5Ptest.lo H5R.lo H5RC.lo H5RS.lo H5S.lo H5Sall.lo H5Shyper.lo \ - H5Smpio.lo H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo \ - H5SL.lo H5ST.lo H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo \ - H5Tcompound.lo H5Tconv.lo H5Tcset.lo H5Tenum.lo H5Tfields.lo \ - H5Tfixed.lo H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo \ - H5Toh.lo H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo \ - H5Tstrpad.lo H5Tvlen.lo H5TS.lo H5V.lo H5Z.lo H5Zdeflate.lo \ - H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo H5Zszip.lo \ - H5Zscaleoffset.lo H5Ztrans.lo + H5Pfmpl.lo H5Pgcpl.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo \ + H5Pstrcpl.lo H5Ptest.lo H5R.lo H5RC.lo H5RS.lo H5S.lo \ + H5Sall.lo H5Shyper.lo H5Smpio.lo H5Snone.lo H5Spoint.lo \ + H5Sselect.lo H5Stest.lo H5SL.lo H5ST.lo H5T.lo H5Tarray.lo \ + H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo \ + H5Tenum.lo H5Tfields.lo H5Tfixed.lo H5Tfloat.lo H5Tinit.lo \ + H5Tnative.lo H5Toffset.lo H5Toh.lo H5Topaque.lo H5Torder.lo \ + H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo H5Tvlen.lo H5TS.lo H5V.lo \ + H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \ + H5Zszip.lo H5Zscaleoffset.lo H5Ztrans.lo libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS) PROGRAMS = $(noinst_PROGRAMS) H5detect_SOURCES = H5detect.c @@ -411,7 +411,8 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Ocont.c H5Odtype.c H5Oefl.c H5Ofill.c H5Oginfo.c H5Olayout.c \ H5Olinfo.c H5Olink.c H5Omtime.c \ H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \ - H5P.c H5Pacpl.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pgcpl.c \ + H5P.c H5Pacpl.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ + H5Pgcpl.c \ H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pstrcpl.c H5Ptest.c H5R.c H5RC.c \ H5RS.c H5S.c H5Sall.c H5Shyper.c H5Smpio.c H5Snone.c H5Spoint.c \ H5Sselect.c H5Stest.c \ @@ -669,6 +670,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pdxpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfapl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfcpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pfmpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Pgcpl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Plapl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Plcpl.Plo@am__quote@ |