From fe76b00dc68cf59cf38a2f1b3de5e0a6a12afb9e Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Mon, 15 Oct 2001 14:36:48 -0500 Subject: [svn-r4543] Purpose: Changed the file creation property list to the new generic property list. Platform tested: IRIX64, SunOS5.7, FreeBSD --- src/H5.c | 6 - src/H5B.c | 64 +++++--- src/H5Bprivate.h | 5 +- src/H5D.c | 18 +-- src/H5F.c | 460 ++++++++++++++++++++++++++++++++++++++++--------------- src/H5Fpkg.h | 7 +- src/H5Fprivate.h | 63 +++++--- src/H5Gnode.c | 42 +++-- src/H5Gpkg.h | 4 +- src/H5P.c | 205 ++++++++++++++----------- src/H5Pprivate.h | 1 - src/H5Ppublic.h | 8 +- 12 files changed, 573 insertions(+), 310 deletions(-) diff --git a/src/H5.c b/src/H5.c index a6cd6db..1e1a6ff 100644 --- a/src/H5.c +++ b/src/H5.c @@ -1974,9 +1974,6 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...) /* property lists are converted to generic property */ /* lists -QAK */ switch (H5P_get_class(id_type)) { - case H5P_FILE_CREATE_OLD: - fprintf(out, "H5P_FILE_CREATE"); - break; case H5P_FILE_ACCESS_OLD: fprintf(out, "H5P_FILE_ACCESS"); break; @@ -2140,9 +2137,6 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...) case H5P_NO_CLASS_OLD: fprintf (out, "H5P_NO_CLASS"); break; - case H5P_FILE_CREATE_OLD: - fprintf (out, "H5P_FILE_CREATE"); - break; case H5P_FILE_ACCESS_OLD: fprintf (out, "H5P_FILE_ACCESS"); break; diff --git a/src/H5B.c b/src/H5B.c index 85c7c06..9d82d42 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -229,8 +229,8 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, bt->nchildren = 0; if (NULL==(bt->page=H5FL_BLK_ALLOC(page,size,1)) || NULL==(bt->native=H5FL_BLK_ALLOC(native_block,total_native_keysize,0)) || - NULL==(bt->child=H5FL_ARR_ALLOC(haddr_t,(size_t)(2*H5B_K(f,type)),0)) || - NULL==(bt->key=H5FL_ARR_ALLOC(H5B_key_t,(size_t)(2*H5B_K(f,type)+1),0))) { + NULL==(bt->child=H5FL_ARR_ALLOC(haddr_t,(size_t)(2*H5B_Kvalue(f,type)),0)) || + NULL==(bt->key=H5FL_ARR_ALLOC(H5B_key_t,(size_t)(2*H5B_Kvalue(f,type)+1),0))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree root node"); } @@ -241,7 +241,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, * translated to native format. */ for (i = 0, offset = H5B_SIZEOF_HDR(f); - i < 2 * H5B_K(f, type); + i < 2 * H5B_Kvalue(f, type); i++, offset += bt->sizeof_rkey + H5F_SIZEOF_ADDR(f)) { bt->key[i].dirty = FALSE; @@ -253,9 +253,9 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, /* * The last possible key... */ - bt->key[2 * H5B_K(f, type)].dirty = FALSE; - bt->key[2 * H5B_K(f, type)].rkey = bt->page + offset; - bt->key[2 * H5B_K(f, type)].nkey = NULL; + bt->key[2 * H5B_Kvalue(f, type)].dirty = FALSE; + bt->key[2 * H5B_Kvalue(f, type)].rkey = bt->page + offset; + bt->key[2 * H5B_Kvalue(f, type)].nkey = NULL; /* * Cache the new B-tree node. @@ -284,6 +284,22 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, FUNC_LEAVE(ret_value); } +int H5B_Kvalue(H5F_t *f, const H5B_class_t *type) +{ + int ret_value = FAIL; + int btree_k[8]={0}; + + FUNC_ENTER(H5B_Kvalue, FAIL); + + assert(f); + assert(type); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "unable to get rank for btree internal nodes"); + + FUNC_LEAVE(btree_k[type->id]); +} + /*------------------------------------------------------------------------- * Function: H5B_load @@ -333,8 +349,8 @@ H5B_load(H5F_t *f, haddr_t addr, const void *_type, void *udata) bt->ndirty = 0; if (NULL==(bt->page=H5FL_BLK_ALLOC(page,size,0)) || NULL==(bt->native=H5FL_BLK_ALLOC(native_block,total_nkey_size,0)) || - NULL==(bt->key=H5FL_ARR_ALLOC(H5B_key_t,(size_t)(2*H5B_K(f,type)+1),0)) || - NULL==(bt->child=H5FL_ARR_ALLOC(haddr_t,(size_t)(2*H5B_K(f,type)),0))) { + NULL==(bt->key=H5FL_ARR_ALLOC(H5B_key_t,(size_t)(2*H5B_Kvalue(f,type)+1),0)) || + NULL==(bt->child=H5FL_ARR_ALLOC(haddr_t,(size_t)(2*H5B_Kvalue(f,type)),0))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -366,7 +382,7 @@ H5B_load(H5F_t *f, haddr_t addr, const void *_type, void *udata) H5F_addr_decode(f, (const uint8_t **) &p, &(bt->right)); /* the child/key pairs */ - for (i = 0; i < 2 * H5B_K(f, type); i++) { + for (i = 0; i < 2 * H5B_Kvalue(f, type); i++) { bt->key[i].dirty = FALSE; bt->key[i].rkey = p; @@ -381,9 +397,9 @@ H5B_load(H5F_t *f, haddr_t addr, const void *_type, void *udata) } } - bt->key[2 * H5B_K(f, type)].dirty = FALSE; - bt->key[2 * H5B_K(f, type)].rkey = p; - bt->key[2 * H5B_K(f, type)].nkey = NULL; + bt->key[2 * H5B_Kvalue(f, type)].dirty = FALSE; + bt->key[2 * H5B_Kvalue(f, type)].rkey = p; + bt->key[2 * H5B_Kvalue(f, type)].nkey = NULL; ret_value = bt; done: @@ -653,9 +669,9 @@ H5B_split(H5F_t *f, const H5B_class_t *type, H5B_t *old_bt, haddr_t old_addr, /* * Initialize variables. */ - assert(old_bt->nchildren == 2 * H5B_K(f, type)); + assert(old_bt->nchildren == 2 * H5B_Kvalue(f, type)); recsize = old_bt->sizeof_rkey + H5F_SIZEOF_ADDR(f); - k = H5B_K(f, type); + k = H5B_Kvalue(f, type); #ifdef H5B_DEBUG if (H5DEBUG(B)) { @@ -1048,7 +1064,7 @@ H5B_insert_child(H5F_t *f, const H5B_class_t *type, H5B_t *bt, FUNC_ENTER(H5B_insert_child, FAIL); assert(bt); - assert(bt->nchildren<2*H5B_K(f, type)); + assert(bt->nchildren<2*H5B_Kvalue(f, type)); bt->dirty = TRUE; recsize = bt->sizeof_rkey + H5F_SIZEOF_ADDR(f); @@ -1436,7 +1452,7 @@ H5B_insert_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, /* * If this node is full then split it before inserting the new child. */ - if (bt->nchildren == 2 * H5B_K(f, type)) { + if (bt->nchildren == 2 * H5B_Kvalue(f, type)) { if (H5B_split(f, type, bt, addr, idx, split_ratios, udata, new_node_p/*out*/)<0) { HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, @@ -1563,8 +1579,8 @@ H5B_iterate (H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) * We've reached the left-most leaf. Now follow the right-sibling * pointer from leaf to leaf until we've processed all leaves. */ - if (NULL==(child=H5FL_ARR_ALLOC(haddr_t,(size_t)(2*H5B_K(f,type)),0)) || - NULL==(key=H5MM_malloc((2*H5B_K(f, type)+1)*type->sizeof_nkey))) { + if (NULL==(child=H5FL_ARR_ALLOC(haddr_t,(size_t)(2*H5B_Kvalue(f,type)),0)) || + NULL==(key=H5MM_malloc((2*H5B_Kvalue(f, type)+1)*type->sizeof_nkey))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } @@ -2012,20 +2028,20 @@ H5B_nodesize(H5F_t *f, const H5B_class_t *type, assert(f); assert(type); assert(sizeof_rkey > 0); - assert(H5B_K(f, type) > 0); + assert(H5B_Kvalue(f, type) > 0); /* * Total native key size. */ if (total_nkey_size) { - *total_nkey_size = (2 * H5B_K(f, type) + 1) * type->sizeof_nkey; + *total_nkey_size = (2 * H5B_Kvalue(f, type) + 1) * type->sizeof_nkey; } /* * Total node size. */ size = (H5B_SIZEOF_HDR(f) + /*node header */ - 2 * H5B_K(f, type) * H5F_SIZEOF_ADDR(f) + /*child pointers */ - (2 * H5B_K(f, type) + 1) * sizeof_rkey); /*keys */ + 2 * H5B_Kvalue(f, type) * H5F_SIZEOF_ADDR(f) + /*child pointers */ + (2 * H5B_Kvalue(f, type) + 1) * sizeof_rkey); /*keys */ FUNC_LEAVE(size); } @@ -2080,7 +2096,7 @@ H5B_copy(H5F_t *f, const H5B_t *old_bt) HDmemcpy(ret_value,old_bt,sizeof(H5B_t)); /* Compute the number of keys in this node */ - nkeys=2*H5B_K(f,old_bt->type); + nkeys=2*H5B_Kvalue(f,old_bt->type); if (NULL==(ret_value->page=H5FL_BLK_ALLOC(page,size,0)) || NULL==(ret_value->native=H5FL_BLK_ALLOC(native_block,total_native_keysize,0)) || @@ -2184,7 +2200,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, HDfprintf(stream, "%*s%-*s %d (%d)\n", indent, "", fwidth, "Number of children (max):", (int) (bt->nchildren), - (int) (2 * H5B_K(f, type))); + (int) (2 * H5B_Kvalue(f, type))); /* * Print the child addresses diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index b4283a5..f24f725 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -40,9 +40,6 @@ 4 + /*type, level, num entries */ \ 2*H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */ -#define H5B_K(F,TYPE) /*K value given file and Btree subclass */ \ - ((F)->shared->fcpl->btree_k[(TYPE)->id]) - typedef enum H5B_ins_t { H5B_INS_ERROR = -1, /*error return value */ H5B_INS_NOOP = 0, /*insert made no changes */ @@ -139,4 +136,6 @@ __DLL__ herr_t H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata); __DLL__ herr_t H5B_iterate (H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata); +__DLL__ int H5B_Kvalue(H5F_t *f, const H5B_class_t *type); + #endif diff --git a/src/H5D.c b/src/H5D.c index 7446aa6..e9e0984 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -405,12 +405,12 @@ H5D_crt_copy(hid_t new_plist_id, hid_t old_plist_id, void UNUSED *copy_data) /* Set the fill value, external file list, and data pipeline property * for the new property list */ if(H5P_set(new_plist_id, H5D_CRT_FILL_VALUE_NAME, &dst_fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set fill value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value"); if(H5P_set(new_plist_id, H5D_CRT_EXT_FILE_LIST_NAME, &dst_efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list"); if(H5P_set(new_plist_id, H5D_CRT_DATA_PIPELINE_NAME, &dst_pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set pipeline"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline"); done: FUNC_LEAVE(ret_value); @@ -988,7 +988,7 @@ H5Dget_create_plist(hid_t dset_id) } /* Get the fill value property */ - if(H5Pget(ret_value, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) + if(H5P_get(ret_value, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); /* Copy the dataset type into the fill value message */ if(copied_fill.type==NULL) @@ -998,7 +998,7 @@ H5Dget_create_plist(hid_t dset_id) } /* Set back the fill value property to property list */ if(H5P_set(ret_value, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) - HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + HRETURN_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property list fill value"); FUNC_LEAVE (ret_value); @@ -1523,7 +1523,7 @@ H5D_create(H5G_entry_t *loc, const char *name, const H5T_t *type, HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to update fill value header message"); if(H5P_set(new_dset->dcpl_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't set fill value"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, "can't set fill value"); /* Update the type and space header messages */ if (H5O_modify(&(new_dset->ent), H5O_DTYPE, 0, @@ -1816,7 +1816,7 @@ H5D_open_oid(H5G_entry_t *ent) HDmemset(&fill, 0, sizeof(fill)); } if(H5P_set(dataset->dcpl_id, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't set fill value"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set fill value"); /* Get the optional filters message */ HDmemset(&pline,0,sizeof(H5O_pline_t)); @@ -1825,7 +1825,7 @@ H5D_open_oid(H5G_entry_t *ent) HDmemset(&pline, 0, sizeof(pline)); } if(H5P_set(dataset->dcpl_id, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't set pipeline"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set pipeline"); #ifdef H5_HAVE_PARALLEL /* If MPIO is used, no filter support yet. */ @@ -1886,7 +1886,7 @@ H5D_open_oid(H5G_entry_t *ent) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "storage address is undefined and no external file list"); if(H5P_set(dataset->dcpl_id, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set external file list"); } /* diff --git a/src/H5F.c b/src/H5F.c index 0ff503c..73d180e 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -48,29 +48,6 @@ #define PABLO_MASK H5F_mask -/* - * Define the default file creation property list. - */ -const H5F_create_t H5F_create_dflt = { - 0, /* Default user-block size */ - 4, /* Default 1/2 rank for symtab leaf nodes */ - { /* Default 1/2 rank for btree intern nodes */ - 16, /* Symbol table internal nodes */ - 32, /* Indexed storage internal nodes */ - 0, /* unused */ - 0, /* unused */ - 0, /* unused */ - 0, /* unused */ - 0, /* unused */ - 0, /* unused */ - }, - sizeof(haddr_t), /* Default offset size */ - sizeof(hsize_t), /* Default length size */ - HDF5_BOOTBLOCK_VERSION, /* Current Boot-Block version # */ - HDF5_FREESPACE_VERSION, /* Current Free-Space info version # */ - HDF5_OBJECTDIR_VERSION, /* Current Object Directory info version # */ - HDF5_SHAREDHEADER_VERSION, /* Current Shared-Header format version # */ -}; /* * Define the default file access property list. The template is initialized @@ -161,6 +138,9 @@ H5F_init(void) * * 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. *------------------------------------------------------------------------- */ static herr_t @@ -168,6 +148,29 @@ H5F_init_interface(void) { herr_t ret_value = SUCCEED; herr_t status; + + /* 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 bootblock + * - 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; + int sym_leaf_k = H5F_CRT_SYM_LEAF_DEF; + int btree_k[8] = 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; + int bootblock_ver = H5F_CRT_BOOT_VERS_DEF; + int freespace_ver = H5F_CRT_FREESPACE_VERS_DEF; + int objectdir_ver = H5F_CRT_OBJ_DIR_VERS_DEF; + int sharedheader_ver = H5F_CRT_SHARE_HEAD_VERS_DEF; FUNC_ENTER(H5F_init_interface, FAIL); @@ -195,7 +198,81 @@ H5F_init_interface(void) "unable to initialize interface"); } -/* Register the default file creation & access properties */ + + assert(H5P_CLS_FILE_CREATE_g!=-1); + + /* ========== File Creation Property Class Initialization ============*/ + /* Get the pointer to file creation class */ + if(H5I_GENPROP_CLS != H5I_get_type(H5P_CLS_FILE_CREATE_g) || + NULL == (crt_pclass = H5I_object(H5P_CLS_FILE_CREATE_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); + + /* 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)<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)<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)<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)<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)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, + "can't insert property into class"); + + /* Register the bootblock version number */ + if(H5P_register(crt_pclass,H5F_CRT_BOOT_VERS_NAME,H5F_CRT_BOOT_VERS_SIZE, + &bootblock_ver,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)<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)<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)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, + "can't insert property into class"); + + /* Register the default file creation property list */ + if((H5P_LST_FILE_CREATE_g = H5Pcreate_list(H5P_CLS_FILE_CREATE_g))<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, + "can't insert property into class"); + + +/* Register the default file access properties */ /* Register predefined file drivers */ H5E_BEGIN_TRY { @@ -240,6 +317,7 @@ H5F_init_interface(void) H5F_access_dflt.driver_id = H5FD_SEC2; /*default driver*/ H5F_access_dflt.driver_info = NULL; /*driver file access properties*/ +done: FUNC_LEAVE(ret_value); } @@ -417,6 +495,9 @@ H5F_encode_length_unusual(const H5F_t *f, uint8_t **p, uint8_t *l) * Calls H5P_copy() to copy the property list and H5P_close() to free * that property list if an error occurs. * + * Raymond Lu, Oct 14, 2001 + * Changed to generic property list. + * *------------------------------------------------------------------------- */ hid_t @@ -424,7 +505,6 @@ H5Fget_create_plist(hid_t file_id) { H5F_t *file = NULL; hid_t ret_value = FAIL; - H5P_t *plist = NULL; FUNC_ENTER(H5Fget_create_plist, FAIL); H5TRACE1("i","i",file_id); @@ -435,17 +515,10 @@ H5Fget_create_plist(hid_t file_id) } /* Create the property list object to return */ - if (NULL==(plist=H5P_copy(H5P_FILE_CREATE, file->shared->fcpl))) { + if((ret_value=H5P_copy_new(file->shared->fcpl_id)) < 0) { HRETURN_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to copy file creation properties"); } - - /* Create an atom */ - if ((ret_value = H5P_create(H5P_FILE_CREATE, plist)) < 0) { - H5P_close(plist); - HRETURN_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, - "unable to register property list"); - } FUNC_LEAVE(ret_value); } @@ -690,6 +763,9 @@ H5Fis_hdf5(const char *name) * * Modifications: * + * Raymond Lu, Oct 14, 2001 + * Changed to generic property list. + * *------------------------------------------------------------------------- */ static H5F_t * @@ -697,7 +773,6 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id) { H5F_t *f=NULL, *ret_value=NULL; int n; - const H5F_create_t *fcpl=NULL; const H5F_access_t *fapl=NULL; FUNC_ENTER(H5F_new, NULL); @@ -721,11 +796,13 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id) * new file handle. We do this early because some values might need * to change as the file is being opened. */ - fcpl = (H5P_DEFAULT==fcpl_id)? &H5F_create_dflt : (const H5F_create_t *)H5I_object(fcpl_id); - if (NULL==(f->shared->fcpl=H5P_copy(H5P_FILE_CREATE, fcpl))) { - HRETURN_ERROR(H5E_FILE, H5E_CANTINIT, NULL, - "unable to copy file creation property list"); - } + if(H5P_DEFAULT == fcpl_id) + fcpl_id = H5P_FILE_CREATE_DEFAULT; + if(H5I_GENPROP_LST != H5I_get_type(fcpl_id) || + TRUE != H5Pisa_class(fcpl_id, H5P_FILE_CREATE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not property list"); + f->shared->fcpl_id = H5P_copy_new(fcpl_id); + fapl = (H5P_DEFAULT==fapl_id)? &H5F_access_dflt : (const H5F_access_t *)H5I_object(fapl_id); f->shared->mdc_nelmts = fapl->mdc_nelmts; @@ -811,7 +888,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id) static herr_t H5F_dest(H5F_t *f) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER(H5F_dest, FAIL); @@ -842,7 +919,12 @@ H5F_dest(H5F_t *f) } /* end if */ /* Destroy file creation properties */ - H5P_close(f->shared->fcpl); + if(H5I_GENPROP_LST != H5I_get_type(f->shared->fcpl_id)) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, + "not a property list"); + if((ret_value=H5Pclose_list(f->shared->fcpl_id)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, + "can't close property list"); /* Destroy shared file struct */ if (H5FD_close(f->shared->lf)<0) { @@ -871,7 +953,8 @@ H5F_dest(H5F_t *f) */ --f->nrefs; } - + +done: FUNC_LEAVE(ret_value); } @@ -945,6 +1028,10 @@ H5F_dest(H5F_t *f) * we open the file in one step. Otherwise if the first attempt * to open the file fails then we skip the second attempt if the * arguments would be the same. + * + * Raymond Lu, 2001-10-14 + * Changed to generic property list. + * *------------------------------------------------------------------------- */ H5F_t * @@ -965,6 +1052,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) unsigned tent_flags; /*tentative flags */ char driver_name[9]; /*file driver name/version */ hbool_t driver_has_cmp; /*`cmp' callback defined? */ + hsize_t userblock_size = 0; + int boot_vers; + int freespace_vers; + int obj_dir_vers; + int share_head_vers; + size_t sizeof_addr = 0; + size_t sizeof_size = 0; + int sym_leaf_k = 0; + int btree_k[8] = {0}; FUNC_ENTER(H5F_open, NULL); @@ -1089,7 +1185,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * which we have already insured is a proper size. The base address * is set to the same thing as the superblock for now. */ - shared->boot_addr = shared->fcpl->userblock_size; + if(H5P_get(shared->fcpl_id, H5F_CRT_USER_BLOCK_NAME, &userblock_size) + < 0) + HRETURN_ERROR(H5E_FILE, H5E_CANTGET, NULL, + "unable to get user block size"); + shared->boot_addr = userblock_size; shared->base_addr = shared->boot_addr; shared->consist_flags = 0x03; if (H5F_flush(file, H5F_SCOPE_LOCAL, FALSE, TRUE)<0) { @@ -1110,7 +1210,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) "unable to find file signature"); } if (H5FD_set_eoa(lf, shared->boot_addr+fixed_size)<0 || - H5FD_read(lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, shared->boot_addr, fixed_size, buf)<0) { + H5FD_read(lf, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, + shared->boot_addr, fixed_size, buf)<0) { HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock"); } @@ -1119,72 +1220,94 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) p = buf + H5F_SIGNATURE_LEN; /* Superblock version */ - shared->fcpl->bootblock_ver = *p++; - if (HDF5_BOOTBLOCK_VERSION!=shared->fcpl->bootblock_ver) { - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "bad superblock version number"); - } + boot_vers = *p++; + if(HDF5_BOOTBLOCK_VERSION != boot_vers) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, + "bad superblock version number"); + if(H5P_set(shared->fcpl_id, H5F_CRT_BOOT_VERS_NAME, &boot_vers) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, + "unable to set boot version"); /* Freespace version */ - shared->fcpl->freespace_ver = *p++; - if (HDF5_FREESPACE_VERSION!=shared->fcpl->freespace_ver) { - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "bad free space version number"); - } + freespace_vers = *p++; + if(HDF5_FREESPACE_VERSION != freespace_vers) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, + "bad free space version number"); + if(H5P_set(shared->fcpl_id, H5F_CRT_FREESPACE_VERS_NAME, + &freespace_vers)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, + "unable to free space version"); /* Root group version number */ - shared->fcpl->objectdir_ver = *p++; - if (HDF5_OBJECTDIR_VERSION!=shared->fcpl->objectdir_ver) { - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "bad root group version number"); - } + obj_dir_vers = *p++; + if(HDF5_OBJECTDIR_VERSION != obj_dir_vers) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, + "bad object directory version number"); + if(H5P_set(shared->fcpl_id, H5F_CRT_OBJ_DIR_VERS_NAME, &obj_dir_vers) + < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, + "unable to set object directory version"); /* reserved */ p++; /* Shared header version number */ - shared->fcpl->sharedheader_ver = *p++; - if (HDF5_SHAREDHEADER_VERSION!=shared->fcpl->sharedheader_ver) { - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "bad shared header version number"); - } + share_head_vers = *p++; + if(HDF5_SHAREDHEADER_VERSION != share_head_vers) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, + "bad shared-header format version number"); + if(H5P_set(shared->fcpl_id, H5F_CRT_SHARE_HEAD_VERS_NAME, + &share_head_vers) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, + "unable to set shared-header format version"); /* Size of file addresses */ - shared->fcpl->sizeof_addr = *p++; - if (shared->fcpl->sizeof_addr != 2 && - shared->fcpl->sizeof_addr != 4 && - shared->fcpl->sizeof_addr != 8 && - shared->fcpl->sizeof_addr != 16 && - shared->fcpl->sizeof_addr != 32) { - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "bad file sizeof(address)"); - } + sizeof_addr = *p++; + if (sizeof_addr != 2 && sizeof_addr != 4 && + sizeof_addr != 8 && sizeof_addr != 16 && sizeof_addr != 32) { + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, + "bad byte number in an address"); + } + if(H5P_set(shared->fcpl_id, H5F_CRT_ADDR_BYTE_NUM_NAME,&sizeof_addr)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, + "unable to set byte number in an address"); /* Size of file sizes */ - shared->fcpl->sizeof_size = *p++; - if (shared->fcpl->sizeof_size != 2 && - shared->fcpl->sizeof_size != 4 && - shared->fcpl->sizeof_size != 8 && - shared->fcpl->sizeof_size != 16 && - shared->fcpl->sizeof_size != 32) { - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "bad file sizeof(size)"); - } + sizeof_size = *p++; + if (sizeof_size != 2 && sizeof_size != 4 && + sizeof_size != 8 && sizeof_size != 16 && sizeof_size != 32) { + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, + "bad byte number for object size"); + } + if(H5P_set(shared->fcpl_id, H5F_CRT_OBJ_BYTE_NUM_NAME, &sizeof_size)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, + "unable to set byte number for object size"); /* Reserved byte */ p++; /* Various B-tree sizes */ - UINT16DECODE(p, shared->fcpl->sym_leaf_k); - if (shared->fcpl->sym_leaf_k < 1) { - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, + UINT16DECODE(p, sym_leaf_k); + if(sym_leaf_k < 1) { + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, NULL, "bad symbol table leaf node 1/2 rank"); } - UINT16DECODE(p, shared->fcpl->btree_k[H5B_SNODE_ID]); - if (shared->fcpl->btree_k[H5B_SNODE_ID] < 1) { - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "bad symbol table internal node 1/2 rank"); + if(H5P_set(shared->fcpl_id, H5F_CRT_SYM_LEAF_NAME, &sym_leaf_k)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, + "unable to set rank for symbol table leaf nodes"); + + /* Need 'get' call to set other array values */ + if(H5P_get(shared->fcpl_id, H5F_CRT_BTREE_RANK_NAME, &btree_k)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, + "unable to get rank for btree internal nodes"); + UINT16DECODE(p, btree_k[H5B_SNODE_ID]); + if(btree_k[H5B_SNODE_ID] < 1) { + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, NULL, + "bad 1/2 rank for btree internal nodes"); } + if(H5P_set(shared->fcpl_id, H5F_CRT_BTREE_RANK_NAME, &btree_k)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, + "unable to set rank for btree internal nodes"); /* File consistency flags. Not really used yet */ UINT32DECODE(p, shared->consist_flags); @@ -1261,7 +1384,10 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * The user-defined data is the area of the file before the base * address. */ - shared->fcpl->userblock_size = shared->base_addr; + if(H5P_set(shared->fcpl_id, H5F_CRT_USER_BLOCK_NAME, &(shared->base_addr)) + < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, NULL, + "unable to set usr block size"); /* * Make sure that the data is not truncated. One case where this is @@ -1342,6 +1468,10 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * Robb Matzke, 1999-08-02 * The file creation and file access property lists are passed * to the H5F_open() as object IDs. + * + * Raymond Lu, 2001-10-14 + * Changed to generic property list. + * *------------------------------------------------------------------------- */ hid_t @@ -1366,12 +1496,14 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "mutually exclusive flags for file creation"); } - if (H5P_DEFAULT!=fcpl_id && - (H5P_FILE_CREATE!=H5P_get_class(fcpl_id) || - NULL==H5I_object(fcpl_id))) { - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file creation property list"); - } + + if(H5P_DEFAULT == fcpl_id) + fcpl_id = H5P_FILE_CREATE_DEFAULT; + if(H5I_GENPROP_LST != H5I_get_type(fcpl_id) || + TRUE != H5Pisa_class(fcpl_id, H5P_FILE_CREATE)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "not file create property list"); + if (H5P_DEFAULT!=fapl_id && (H5P_FILE_ACCESS!=H5P_get_class(fapl_id) || NULL==H5I_object(fapl_id))) { @@ -1621,6 +1753,10 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) * Robb Matzke, 1999-08-16 * The driver information block is encoded and either allocated * or written to disk. + * + * Raymond Lu, 2001-10-14 + * Changed to new generic property list. + * *------------------------------------------------------------------------- */ static herr_t @@ -1631,6 +1767,10 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, unsigned nerrors=0, i; size_t superblock_size, driver_size; char driver_name[9]; + int boot_vers, freespace_vers, + obj_dir_vers, share_head_vers, + sym_leaf_k, btree_k[8]={0}; + FUNC_ENTER(H5F_flush, FAIL); @@ -1681,23 +1821,45 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate, "unable to flush meta data cache"); } + if(H5P_get(f->shared->fcpl_id, H5F_CRT_BOOT_VERS_NAME, &boot_vers) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "unable to get boot block version"); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_FREESPACE_VERS_NAME, + &freespace_vers) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "unable to get free space version"); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_OBJ_DIR_VERS_NAME, &obj_dir_vers) + < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "unable to get object directory version"); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_SHARE_HEAD_VERS_NAME, + &share_head_vers) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "unable to get shared-header format version"); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_SYM_LEAF_NAME, &sym_leaf_k) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "unable to get rank for symbol table leaf nodes"); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "unable to get rank for btree internal nodes"); + /* encode the file boot block */ p = sbuf; HDmemcpy(p, H5F_SIGNATURE, H5F_SIGNATURE_LEN); p += H5F_SIGNATURE_LEN; - *p++ = f->shared->fcpl->bootblock_ver; - *p++ = f->shared->fcpl->freespace_ver; - *p++ = f->shared->fcpl->objectdir_ver; + *p++ = boot_vers; + *p++ = freespace_vers; + *p++ = obj_dir_vers; *p++ = 0; /*reserved*/ - *p++ = f->shared->fcpl->sharedheader_ver; + *p++ = share_head_vers; assert (H5F_SIZEOF_ADDR(f)<=255); *p++ = (uint8_t)H5F_SIZEOF_ADDR(f); assert (H5F_SIZEOF_SIZE(f)<=255); *p++ = (uint8_t)H5F_SIZEOF_SIZE(f); *p++ = 0; /*reserved */ - UINT16ENCODE(p, f->shared->fcpl->sym_leaf_k); - UINT16ENCODE(p, f->shared->fcpl->btree_k[H5B_SNODE_ID]); - UINT32ENCODE(p, f->shared->consist_flags); + UINT16ENCODE(p, sym_leaf_k); + UINT16ENCODE(p, btree_k[H5B_SNODE_ID]); + UINT32ENCODE(p, f->shared->consist_flags); H5F_addr_encode(f, &p, f->shared->base_addr); H5F_addr_encode(f, &p, f->shared->freespace_addr); H5F_addr_encode(f, &p, H5FD_get_eoa(f->shared->lf)); @@ -2468,16 +2630,22 @@ H5F_get_intent(H5F_t *f) * * Modifications: * + * Raymond Lu, Oct 14, 2001 + * Changed to generic property list. + * *------------------------------------------------------------------------- */ size_t H5F_sizeof_addr(H5F_t *f) { - FUNC_ENTER(H5F_sizeof_addr, 0); + size_t sizeof_addr = 0; + FUNC_ENTER(H5F_sizeof_addr, 0); assert(f); - - FUNC_LEAVE((f)->shared->fcpl->sizeof_addr) + if(H5P_get(f->shared->fcpl_id, H5F_CRT_ADDR_BYTE_NUM_NAME, &sizeof_addr)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, + "can't get byte number for address"); + FUNC_LEAVE(sizeof_addr); } @@ -2495,16 +2663,22 @@ H5F_sizeof_addr(H5F_t *f) * * Modifications: * + * Raymond Lu, Oct 14, 2001 + * Changed to the new generic property list. + * *------------------------------------------------------------------------- */ size_t H5F_sizeof_size(H5F_t *f) { - FUNC_ENTER(H5F_sizeof_size, 0); + size_t sizeof_size = 0; + FUNC_ENTER(H5F_sizeof_size, 0); assert(f); - - FUNC_LEAVE((f)->shared->fcpl->sizeof_addr) + if(H5P_get(f->shared->fcpl_id, H5F_CRT_OBJ_BYTE_NUM_NAME, &sizeof_size)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, NULL, + "can't get byte number for object size"); + FUNC_LEAVE(sizeof_size); } @@ -2784,12 +2958,21 @@ H5F_addr_pack(H5F_t UNUSED *f, haddr_t *addr_p/*out*/, * Modifications: * Robb Matzke, 1999-07-28 * The ADDR argument is passed by value. + * + * Raymond Lu, 2001-10-14 + * Changed to the new generic property list. + * *------------------------------------------------------------------------- */ herr_t H5F_debug(H5F_t *f, haddr_t UNUSED addr, FILE * stream, int indent, int fwidth) { + hsize_t userblock_size; + int sym_leaf_k, btree_k[8]={0}; + size_t sizeof_addr, sizeof_size; + int boot_vers, freespace_vers, obj_dir_vers, share_head_vers; + FUNC_ENTER(H5F_debug, FAIL); /* check args */ @@ -2799,6 +2982,38 @@ H5F_debug(H5F_t *f, haddr_t UNUSED addr, FILE * stream, int indent, assert(indent >= 0); assert(fwidth >= 0); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_USER_BLOCK_NAME, &userblock_size)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get user block size"); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_SYM_LEAF_NAME, &sym_leaf_k)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get rank for symbol table leaf nodes"); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_BTREE_RANK_NAME, btree_k)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get rank for btree nodes"); + + if(H5P_get(f->shared->fcpl_id, H5F_CRT_ADDR_BYTE_NUM_NAME, &sizeof_addr)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get byte number for an address"); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_OBJ_BYTE_NUM_NAME, &sizeof_size)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get byte number for object size"); + + if(H5P_get(f->shared->fcpl_id, H5F_CRT_BOOT_VERS_NAME, &boot_vers)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get boot block version"); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_FREESPACE_VERS_NAME, + &freespace_vers)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get boot block version"); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_OBJ_DIR_VERS_NAME, &obj_dir_vers)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get object directory version"); + if(H5P_get(f->shared->fcpl_id, H5F_CRT_SHARE_HEAD_VERS_NAME, + &share_head_vers)<0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get shared-header format version"); + /* debug */ HDfprintf(stream, "%*sFile Boot Block...\n", indent, ""); @@ -2822,33 +3037,26 @@ H5F_debug(H5F_t *f, haddr_t UNUSED addr, FILE * stream, int indent, "Free list address:", f->shared->freespace_addr); HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, "Driver information block:", f->shared->driver_addr); + HDfprintf(stream, "%*s%-*s %lu bytes\n", indent, "", fwidth, - "Size of user block:", - (unsigned long) (f->shared->fcpl->userblock_size)); + "Size of user block:", (unsigned long) userblock_size); HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, - "Size of file size_t type:", - (unsigned) (f->shared->fcpl->sizeof_size)); + "Size of file size_t type:", (unsigned) sizeof_size); HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, - "Size of file haddr_t type:", - (unsigned) (f->shared->fcpl->sizeof_addr)); + "Size of file haddr_t type:", (unsigned) sizeof_addr); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Symbol table leaf node 1/2 rank:", - (unsigned) (f->shared->fcpl->sym_leaf_k)); + "Symbol table leaf node 1/2 rank:", (unsigned) sym_leaf_k); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Symbol table internal node 1/2 rank:", - (unsigned) (f->shared->fcpl->btree_k[H5B_SNODE_ID])); + (unsigned) (btree_k[H5B_SNODE_ID])); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Boot block version number:", - (unsigned) (f->shared->fcpl->bootblock_ver)); + "Boot block version number:", (unsigned) boot_vers); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Free list version number:", - (unsigned) (f->shared->fcpl->freespace_ver)); + "Free list version number:", (unsigned) freespace_vers); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Object directory version number:", - (unsigned) (f->shared->fcpl->objectdir_ver)); + "Object directory version number:", (unsigned) obj_dir_vers); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Shared header version number:", - (unsigned) (f->shared->fcpl->sharedheader_ver)); + "Shared header version number:", (unsigned) share_head_vers); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Root group symbol table entry:", diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 2043df5..bcb569b 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -93,12 +93,7 @@ typedef struct H5F_file_t { haddr_t freespace_addr; /* Relative address of free-space info */ haddr_t driver_addr; /* File driver information block address*/ struct H5AC_t *cache; /* The object cache */ - H5F_create_t *fcpl; /* File-creation property list */ - /* This actually ends up being a pointer to a */ - /* H5P_t type, which is returned from H5P_copy */ - /* But that's ok because we only access it like */ - /* a H5F_create_t until we pass it back to */ - /* H5P_close to release it - QAK */ + hid_t fcpl_id; /* File creation property list ID */ int mdc_nelmts; /* Size of meta data cache (elements) */ size_t rdcc_nelmts; /* Size of raw data chunk cache (elmts) */ size_t rdcc_nbytes; /* Size of raw data chunk cache (bytes) */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 46cc34e..10f8de2 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -212,13 +212,9 @@ typedef struct H5F_t H5F_t; #define H5F_addr_pow2(N) ((haddr_t)1<<(N)) /* size of size_t and off_t as they exist on disk */ -#ifdef H5F_PACKAGE -#define H5F_SIZEOF_ADDR(F) ((F)->shared->fcpl->sizeof_addr) -#define H5F_SIZEOF_SIZE(F) ((F)->shared->fcpl->sizeof_size) -#else /* H5F_PACKAGE */ -#define H5F_SIZEOF_ADDR(F) (H5F_sizeof_addr(F)) -#define H5F_SIZEOF_SIZE(F) (H5F_sizeof_size(F)) -#endif /* H5F_PACKAGE */ +#define H5F_SIZEOF_ADDR(F) (H5F_sizeof_addr(F)) +#define H5F_SIZEOF_SIZE(F) (H5F_sizeof_size(F)) + __DLL__ size_t H5F_sizeof_addr(H5F_t *f); __DLL__ size_t H5F_sizeof_size(H5F_t *f); @@ -254,20 +250,44 @@ __DLL__ size_t H5F_sizeof_size(H5F_t *f); case 2: UINT16DECODE(p,l); break; \ } -/* - * File-creation property list. - */ -typedef struct H5F_create_t { - hsize_t userblock_size; /* Size of the file user block in bytes */ - int sym_leaf_k; /* 1/2 rank for symbol table leaf nodes */ - int btree_k[8]; /* 1/2 rank for btree internal nodes */ - size_t sizeof_addr; /* Number of bytes in an address */ - size_t sizeof_size; /* Number of bytes for obj sizes */ - int bootblock_ver; /* Version # of the bootblock */ - int freespace_ver; /* Version # of the free-space information*/ - int objectdir_ver; /* Version # of the object directory format*/ - int sharedheader_ver;/* Version # of the shared header format */ -} H5F_create_t; +/* ========= 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(int) +#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(int[8]) +#define H5F_CRT_BTREE_RANK_DEF {16,32,0} +/* 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 bootblock */ +#define H5F_CRT_BOOT_VERS_NAME "boot_version" +#define H5F_CRT_BOOT_VERS_SIZE sizeof(int) +#define H5F_CRT_BOOT_VERS_DEF HDF5_BOOTBLOCK_VERSION +/* Definitions for free-space version number */ +#define H5F_CRT_FREESPACE_VERS_NAME "free_space_version" +#define H5F_CRT_FREESPACE_VERS_SIZE sizeof(int) +#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(int) +#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(int) +#define H5F_CRT_SHARE_HEAD_VERS_DEF HDF5_SHAREDHEADER_VERSION + /* * File-access property list. @@ -292,7 +312,6 @@ typedef struct H5F_mprop_t { } H5F_mprop_t; /* library variables */ -__DLLVAR__ const H5F_create_t H5F_create_dflt; __DLLVAR__ H5F_access_t H5F_access_dflt; __DLLVAR__ const H5F_mprop_t H5F_mount_dflt; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 9bcb91c..9a25c37 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -219,7 +219,7 @@ static size_t H5G_node_size(H5F_t *f) { return H5G_NODE_SIZEOF_HDR(f) + - (2 * H5G_NODE_K(f)) * H5G_SIZEOF_ENTRY(f); + (2 * H5G_node_k(f)) * H5G_SIZEOF_ENTRY(f); } @@ -272,7 +272,7 @@ H5G_node_create(H5F_t *f, H5B_ins_t UNUSED op, void *_lt_key, "unable to allocate file space"); } sym->dirty = TRUE; - sym->entry = H5FL_ARR_ALLOC(H5G_entry_t,(2*H5G_NODE_K(f)),1); + sym->entry = H5FL_ARR_ALLOC(H5G_entry_t,(2*H5G_node_k(f)),1); if (NULL==sym->entry) { H5FL_FREE(H5G_node_t,sym); HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, @@ -439,7 +439,7 @@ H5G_node_load(H5F_t *f, haddr_t addr, const void * UNUSED _udata1, "memory allocation failed for symbol table node"); p=buf; if (NULL==(sym = H5FL_ALLOC(H5G_node_t,1)) || - NULL==(sym->entry=H5FL_ARR_ALLOC(H5G_entry_t,(2*H5G_NODE_K(f)),1))) { + NULL==(sym->entry=H5FL_ARR_ALLOC(H5G_entry_t,(2*H5G_node_k(f)),1))) { HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } @@ -805,7 +805,7 @@ H5G_node_insert(H5F_t *f, haddr_t addr, void UNUSED *_lt_key, HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert symbol name into heap"); } - if ((size_t)(sn->nsyms) >= 2*H5G_NODE_K(f)) { + if ((size_t)(sn->nsyms) >= 2*H5G_node_k(f)) { /* * The node is full. Split it into a left and right * node and return the address of the new right node (the @@ -823,29 +823,29 @@ H5G_node_insert(H5F_t *f, haddr_t addr, void UNUSED *_lt_key, HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node"); } - HDmemcpy(snrt->entry, sn->entry + H5G_NODE_K(f), - H5G_NODE_K(f) * sizeof(H5G_entry_t)); - snrt->nsyms = H5G_NODE_K(f); + HDmemcpy(snrt->entry, sn->entry + H5G_node_k(f), + H5G_node_k(f) * sizeof(H5G_entry_t)); + snrt->nsyms = H5G_node_k(f); snrt->dirty = TRUE; /* The left node */ - HDmemset(sn->entry + H5G_NODE_K(f), 0, - H5G_NODE_K(f) * sizeof(H5G_entry_t)); - sn->nsyms = H5G_NODE_K(f); + HDmemset(sn->entry + H5G_node_k(f), 0, + H5G_node_k(f) * sizeof(H5G_entry_t)); + sn->nsyms = H5G_node_k(f); sn->dirty = TRUE; /* The middle key */ md_key->offset = sn->entry[sn->nsyms - 1].name_off; /* Where to insert the new entry? */ - if (idx <= (int)H5G_NODE_K(f)) { + if (idx <= (int)H5G_node_k(f)) { insert_into = sn; - if (idx == (int)H5G_NODE_K(f)) + if (idx == (int)H5G_node_k(f)) md_key->offset = offset; } else { - idx -= H5G_NODE_K(f); + idx -= H5G_node_k(f); insert_into = snrt; - if (idx == (int)H5G_NODE_K (f)) { + if (idx == (int)H5G_node_k (f)) { rt_key->offset = offset; *rt_key_changed = TRUE; } @@ -1194,7 +1194,7 @@ H5G_node_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, "Size of Node (in bytes):", (unsigned)H5G_node_size(f)); fprintf(stream, "%*s%-*s %d of %d\n", indent, "", fwidth, "Number of Symbols:", - sn->nsyms, 2 * H5G_NODE_K(f)); + sn->nsyms, 2 * H5G_node_k(f)); indent += 3; fwidth = MAX(0, fwidth - 3); @@ -1213,3 +1213,15 @@ H5G_node_debug(H5F_t *f, haddr_t addr, FILE * stream, int indent, FUNC_LEAVE(SUCCEED); } +unsigned H5G_node_k(H5F_t *f) +{ + int sym_leaf_k; + + FUNC_ENTER(H5G_node_k, FAIL); + + if(H5P_get(f->shared->fcpl_id, H5F_CRT_SYM_LEAF_NAME, &sym_leaf_k) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get rank for symbol table leaf node"); + + FUNC_LEAVE(sym_leaf_k); +} diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 7e5ffa9..1c70e7b 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -21,7 +21,6 @@ #define H5G_NODE_VERS 1 /*symbol table node version number */ #define H5G_SIZE_HINT 1024 /*default root grp size hint */ -#define H5G_NODE_K(F) ((unsigned)((F)->shared->fcpl->sym_leaf_k)) #define H5G_NODE_SIZEOF_HDR(F) (H5G_NODE_SIZEOF_MAGIC + 4) #define H5G_DEFAULT_ROOT_SIZE 32 @@ -138,4 +137,7 @@ __DLL__ herr_t H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, int n); __DLL__ herr_t H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, int n); + +__DLL__ unsigned H5G_node_k(H5F_t *f); + #endif diff --git a/src/H5P.c b/src/H5P.c index 1e73eaf..775ba2b 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -38,7 +38,6 @@ static herr_t H5P_init_interface(void); /* These go away as each old-style property list is converted to a generic */ /* property list -QAK */ hid_t H5P_NO_CLASS=(hid_t)H5P_NO_CLASS_OLD; -hid_t H5P_FILE_CREATE=(hid_t)H5P_FILE_CREATE_OLD; hid_t H5P_FILE_ACCESS=(hid_t)H5P_FILE_ACCESS_OLD; hid_t H5P_MOUNT=(hid_t)H5P_MOUNT_OLD; @@ -344,15 +343,11 @@ H5Pcreate(hid_t type) else { /* Set the type of the property list to create for older property lists */ old_type=(H5P_class_t_old)type; -assert( old_type==H5P_FILE_CREATE_OLD || - old_type==H5P_FILE_ACCESS_OLD || - old_type==H5P_MOUNT_OLD); + assert( old_type==H5P_FILE_ACCESS_OLD || + old_type==H5P_MOUNT_OLD); /* Allocate a new property list and initialize it with default values */ switch (old_type) { - case H5P_FILE_CREATE_OLD: - src = &H5F_create_dflt; - break; case H5P_FILE_ACCESS_OLD: src = &H5F_access_dflt; break; @@ -511,9 +506,6 @@ H5P_close(void *_plist) } break; - case H5P_FILE_CREATE_OLD: - break; - case H5P_MOUNT_OLD: break; @@ -941,10 +933,6 @@ H5P_copy (H5P_class_t_old type, const void *src) /* How big is the property list */ switch (type) { - case H5P_FILE_CREATE_OLD: - size = sizeof(H5F_create_t); - break; - case H5P_FILE_ACCESS_OLD: size = sizeof(H5F_access_t); break; @@ -972,9 +960,6 @@ H5P_copy (H5P_class_t_old type, const void *src) /* Deep-copy pointers */ switch (type) { - case H5P_FILE_CREATE_OLD: - break; - case H5P_FILE_ACCESS_OLD: fa_dst = (H5F_access_t*)dst; @@ -1022,34 +1007,41 @@ H5P_copy (H5P_class_t_old type, const void *src) * * Modifications: * + * Raymond Lu, Oct 14, 2001 + * Change to the new generic property list. + * *------------------------------------------------------------------------- */ herr_t H5Pget_version(hid_t plist_id, int *boot/*out*/, int *freelist/*out*/, int *stab/*out*/, int *shhdr/*out*/) { - H5F_create_t *plist = NULL; FUNC_ENTER(H5Pget_version, FAIL); H5TRACE5("e","ixxxx",plist_id,boot,freelist,stab,shhdr); /* Check arguments */ - if (H5P_FILE_CREATE != H5P_get_class(plist_id) || - NULL == (plist = H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file creation property list"); - } + if(H5I_GENPROP_LST != H5I_get_type(plist_id)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get values */ if (boot) - *boot = plist->bootblock_ver; + if(H5P_get(plist_id, H5F_CRT_BOOT_VERS_NAME, boot) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get boot version"); if (freelist) - *freelist = plist->freespace_ver; + if(H5P_get(plist_id, H5F_CRT_FREESPACE_VERS_NAME, freelist) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get free-space version"); if (stab) - *stab = plist->objectdir_ver; + if(H5P_get(plist_id, H5F_CRT_OBJ_DIR_VERS_NAME, stab) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get object directory version"); if (shhdr) - *shhdr = plist->sharedheader_ver; - + if(H5P_get(plist_id, H5F_CRT_SHARE_HEAD_VERS_NAME, shhdr) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get shared-header version"); + FUNC_LEAVE(SUCCEED); } @@ -1066,23 +1058,23 @@ H5Pget_version(hid_t plist_id, int *boot/*out*/, int *freelist/*out*/, * * Modifications: * + * Raymond Lu, Oct 14, 2001 + * Changed to the new generic property list. + * *------------------------------------------------------------------------- */ herr_t H5Pset_userblock(hid_t plist_id, hsize_t size) { unsigned i; - H5F_create_t *plist = NULL; FUNC_ENTER(H5Pset_userblock, FAIL); H5TRACE2("e","ih",plist_id,size); /* Check arguments */ - if (H5P_FILE_CREATE != H5P_get_class(plist_id) || - NULL == (plist = H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file creation property list"); - } + if(H5I_GENPROP_LST != H5I_get_type(plist_id)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + for (i=8; i<8*sizeof(hsize_t); i++) { hsize_t p2 = 8==i ? 0 : ((hsize_t)1<userblock_size = size; + if(H5P_set(plist_id, H5F_CRT_USER_BLOCK_NAME, &size) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set user block"); FUNC_LEAVE(SUCCEED); } @@ -1115,26 +1108,26 @@ H5Pset_userblock(hid_t plist_id, hsize_t size) * * Modifications: * + * Raymond Lu, Oct 14, 2001 + * Changed to the new generic property list. + * *------------------------------------------------------------------------- */ herr_t H5Pget_userblock(hid_t plist_id, hsize_t *size) { - H5F_create_t *plist = NULL; FUNC_ENTER(H5Pget_userblock, FAIL); H5TRACE2("e","i*h",plist_id,size); /* Check args */ - if (H5P_FILE_CREATE != H5P_get_class(plist_id) || - NULL == (plist = H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file creation property list"); - } + if(H5I_GENPROP_LST != H5I_get_type(plist_id)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get value */ if (size) - *size = plist->userblock_size; + if(H5P_get(plist_id, H5F_CRT_USER_BLOCK_NAME, size) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,"can't get user block"); FUNC_LEAVE(SUCCEED); } @@ -1254,17 +1247,14 @@ H5Pget_alignment(hid_t fapl_id, hsize_t *threshold/*out*/, herr_t H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size) { - H5F_create_t *plist = NULL; FUNC_ENTER(H5Pset_sizes, FAIL); H5TRACE3("e","izz",plist_id,sizeof_addr,sizeof_size); /* Check arguments */ - if (H5P_FILE_CREATE != H5P_get_class(plist_id) || - NULL == (plist = H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file creation property list"); - } + if(H5I_GENPROP_LST != H5I_get_type(plist_id)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + if (sizeof_addr) { if (sizeof_addr != 2 && sizeof_addr != 4 && sizeof_addr != 8 && sizeof_addr != 16) { @@ -1282,9 +1272,13 @@ H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size) /* Set value */ if (sizeof_addr) - plist->sizeof_addr = sizeof_addr; + if(H5P_set(plist_id, H5F_CRT_ADDR_BYTE_NUM_NAME, &sizeof_addr) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, + "can't set byte number for an address"); if (sizeof_size) - plist->sizeof_size = sizeof_size; + if(H5P_set(plist_id, H5F_CRT_OBJ_BYTE_NUM_NAME, &sizeof_size) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, + "can't set byte number for object "); FUNC_LEAVE(SUCCEED); } @@ -1311,23 +1305,22 @@ herr_t H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr /*out */ , size_t *sizeof_size /*out */ ) { - H5F_create_t *plist = NULL; - FUNC_ENTER(H5Pget_sizes, FAIL); H5TRACE3("e","ixx",plist_id,sizeof_addr,sizeof_size); /* Check args */ - if (H5P_FILE_CREATE != H5P_get_class(plist_id) || - NULL == (plist = H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file creation property list"); - } + if(H5I_GENPROP_LST != H5I_get_type(plist_id)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get values */ if (sizeof_addr) - *sizeof_addr = plist->sizeof_addr; + if(H5P_get(plist_id, H5F_CRT_ADDR_BYTE_NUM_NAME, sizeof_addr) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get byte number for an address"); if (sizeof_size) - *sizeof_size = plist->sizeof_size; + if(H5P_get(plist_id, H5F_CRT_OBJ_BYTE_NUM_NAME, sizeof_size) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get byte number for object "); FUNC_LEAVE(SUCCEED); } @@ -1357,28 +1350,38 @@ H5Pget_sizes(hid_t plist_id, * * Modifications: * + * Raymond Lu, Oct 14, 2001 + * Changed to the new generic property list. + * *------------------------------------------------------------------------- */ herr_t H5Pset_sym_k(hid_t plist_id, int ik, int lk) { - H5F_create_t *plist = NULL; + int btree_k[8]={0}; FUNC_ENTER(H5Pset_sym_k, FAIL); H5TRACE3("e","iIsIs",plist_id,ik,lk); /* Check arguments */ - if (H5P_FILE_CREATE != H5P_get_class(plist_id) || - NULL == (plist = H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file creation property list"); - } + if(H5I_GENPROP_LST != H5I_get_type(plist_id)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + /* Set values */ - if (ik > 0) - plist->btree_k[H5B_SNODE_ID] = ik; + if (ik > 0) { + if(H5P_get(plist_id, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get rank for btree interanl nodes"); + btree_k[H5B_SNODE_ID] = ik; + if(H5P_set(plist_id, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, + "can't set rank for btree nodes"); + } if (lk > 0) - plist->sym_leaf_k = lk; + if(H5P_set(plist_id, H5F_CRT_SYM_LEAF_NAME, &lk) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, + "can't set rank for symbol table leaf nodes"); FUNC_LEAVE(SUCCEED); } @@ -1399,27 +1402,34 @@ H5Pset_sym_k(hid_t plist_id, int ik, int lk) * * Modifications: * + * Raymond Lu + * Changed to the new generic property list. + * *------------------------------------------------------------------------- */ herr_t H5Pget_sym_k(hid_t plist_id, int *ik /*out */ , int *lk /*out */ ) { - H5F_create_t *plist = NULL; + int btree_k[8]; FUNC_ENTER(H5Pget_sym_k, FAIL); H5TRACE3("e","ixx",plist_id,ik,lk); /* Check arguments */ - if (H5P_FILE_CREATE != H5P_get_class(plist_id) || - NULL == (plist = H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file creation property list"); - } + if(H5I_GENPROP_LST != H5I_get_type(plist_id)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + /* Get values */ - if (ik) - *ik = plist->btree_k[H5B_SNODE_ID]; + if (ik) { + if(H5P_get(plist_id, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get rank for btree nodes"); + *ik = btree_k[H5B_SNODE_ID]; + } if (lk) - *lk = plist->sym_leaf_k; + if(H5P_get(plist_id, H5F_CRT_SYM_LEAF_NAME, lk) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get rank for symbol table leaf nodes"); FUNC_LEAVE(SUCCEED); } @@ -1439,29 +1449,36 @@ H5Pget_sym_k(hid_t plist_id, int *ik /*out */ , int *lk /*out */ ) * * Modifications: * + * Raymond Lu, Oct 14, 2001 + * Changed to the new generic property list. + * *------------------------------------------------------------------------- */ herr_t H5Pset_istore_k(hid_t plist_id, int ik) { - H5F_create_t *plist = NULL; + int btree_k[8]={0}; FUNC_ENTER(H5Pset_istore_k, FAIL); H5TRACE2("e","iIs",plist_id,ik); /* Check arguments */ - if (H5P_FILE_CREATE != H5P_get_class(plist_id) || - NULL == (plist = H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file creation property list"); - } + if(H5I_GENPROP_LST != H5I_get_type(plist_id)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + if (ik <= 0) { HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value must be positive"); } /* Set value */ - plist->btree_k[H5B_ISTORE_ID] = ik; + if(H5P_get(plist_id, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get rank for btree interanl nodes"); + btree_k[H5B_ISTORE_ID] = ik; + if(H5P_set(plist_id, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, + "can't set rank for btree interanl nodes"); FUNC_LEAVE(SUCCEED); } @@ -1482,26 +1499,30 @@ H5Pset_istore_k(hid_t plist_id, int ik) * * Modifications: * + * Raymond Lu, Oct 14, 2001 + * Changed to the new generic property list. + * *------------------------------------------------------------------------- */ herr_t H5Pget_istore_k(hid_t plist_id, int *ik /*out */ ) { - H5F_create_t *plist = NULL; + int btree_k[8]={0}; FUNC_ENTER(H5Pget_istore_k, FAIL); H5TRACE2("e","ix",plist_id,ik); /* Check arguments */ - if (H5P_FILE_CREATE != H5P_get_class(plist_id) || - NULL == (plist = H5I_object(plist_id))) { - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "not a file creation property list"); - } + if(H5I_GENPROP_LST != H5I_get_type(plist_id)) + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get value */ - if (ik) - *ik = plist->btree_k[H5B_ISTORE_ID]; + if (ik) { + if(H5P_get(plist_id, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) + HRETURN_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, + "can't get rank for btree interanl nodes"); + *ik = btree_k[H5B_ISTORE_ID]; + } FUNC_LEAVE(SUCCEED); } diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index e454f55..212cf4b 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -93,7 +93,6 @@ typedef struct H5P_genplist_tag { typedef struct { /* Union of all the different kinds of property lists */ union { - H5F_create_t fcreate; /* File creation properties */ H5F_access_t faccess; /* File access properties */ H5F_mprop_t mount; /* Mounting properties */ } u; diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index e21368e..d8e8383 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -39,9 +39,8 @@ typedef long off_t; /* Property list classes */ typedef enum H5P_class_t_old { H5P_NO_CLASS_OLD = -1, /*error return value */ - H5P_FILE_CREATE_OLD = 0, /*file creation properties */ - H5P_FILE_ACCESS_OLD = 1, /*file access properties */ - H5P_MOUNT_OLD = 2, /*file mounting properties */ + H5P_FILE_ACCESS_OLD = 0, /*file access properties */ + H5P_MOUNT_OLD = 1, /*file mounting properties */ H5P_NCLASSES_OLD /*this must be last! */ } H5P_class_t_old; @@ -56,7 +55,6 @@ typedef hid_t H5P_class_t; /* Alias H5P_class_t to hid_t */ /* - merge/delete H5Pcopy and H5Pcopy_new */ /* - merge/delete H5Pclose and H5Pclose_list */ __DLLVAR__ hid_t H5P_NO_CLASS; -__DLLVAR__ hid_t H5P_FILE_CREATE; __DLLVAR__ hid_t H5P_FILE_ACCESS; __DLLVAR__ hid_t H5P_MOUNT; @@ -94,7 +92,7 @@ extern "C" { */ #define H5P_NO_CLASS_NEW (H5open(), H5P_CLS_NO_CLASS_g) #define H5P_NO_CLASS_HASH_SIZE 1 /* 1, not 0, otherwise allocations get weird */ -#define H5P_FILE_CREATE_NEW (H5open(), H5P_CLS_FILE_CREATE_g) +#define H5P_FILE_CREATE (H5open(), H5P_CLS_FILE_CREATE_g) #define H5P_FILE_CREATE_HASH_SIZE 17 #define H5P_FILE_ACCESS_NEW (H5open(), H5P_CLS_FILE_ACCESS_g) #define H5P_FILE_ACCESS_HASH_SIZE 17 -- cgit v0.12