diff options
Diffstat (limited to 'src/H5F.c')
-rw-r--r-- | src/H5F.c | 81 |
1 files changed, 48 insertions, 33 deletions
@@ -23,9 +23,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5Aprivate.h" /* Attributes */ #include "H5ACprivate.h" /* Metadata cache */ -#if 1 /* JRM */ #include "H5AC2private.h" /* Metadata cache2 */ -#endif /* JRM */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ @@ -933,15 +931,14 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) */ if(SUCCEED != H5AC_create(f, &(f->shared->mdc_initCacheCfg))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create meta data cache") -#if 1 /* JRM */ - /* create a metadata cache with modified API along side the regular + + /* Create a metadata cache with modified API along side the regular * version. For now, this is just for testing. Once we get it * fully in use, we will delete the old version. */ - if(SUCCEED != H5AC2_create(f, - (H5AC2_cache_config_t *)&(f->shared->mdc_initCacheCfg))) + if(H5AC2_create(f, (H5AC2_cache_config_t *)&(f->shared->mdc_initCacheCfg)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create meta data cache2") -#endif /* JRM */ + /* Create the file's "open object" information */ if(H5FO_create(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure") @@ -1040,12 +1037,10 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) if(H5AC_dest(f, dxpl_id)) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") -#if 1 /* JRM */ /* also destroy the modified cache */ if(H5AC2_dest(f, dxpl_id)) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") -#endif /* JRM */ if(H5FO_dest(f) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") @@ -1719,12 +1714,9 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) if((flags & H5F_FLUSH_INVALIDATE) != 0 ) H5AC_flags |= H5AC__FLUSH_INVALIDATE_FLAG; if(H5AC_flush(f, dxpl_id, H5AC_flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush meta data cache") -#if 1 /* JRM */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache") if(H5AC2_flush(f, dxpl_id, H5AC_flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "unable to flush meta data cache2") -#endif /* JRM */ + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache2") /* * If we are invalidating everything (which only happens just before @@ -3075,7 +3067,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5F_addr_encode + * Function: H5F_addr_encode_len * * Purpose: Encodes an address into the buffer pointed to by *PP and * then increments the pointer to the first byte after the @@ -3086,31 +3078,54 @@ done: * Programmer: Robb Matzke * Friday, November 7, 1997 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ void -H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) +H5F_addr_encode_len(uint8_t **pp/*in,out*/, haddr_t addr, unsigned addr_len) { - unsigned i; + unsigned u; /* Local index variable */ - assert(f); - assert(pp && *pp); + HDassert(pp && *pp); - if (H5F_addr_defined(addr)) { - for (i=0; i<H5F_SIZEOF_ADDR(f); i++) { + if(H5F_addr_defined(addr)) { + for(u = 0; u < addr_len; u++) { *(*pp)++ = (uint8_t)(addr & 0xff); addr >>= 8; - } + } /* end for */ assert("overflow" && 0 == addr); - - } else { - for (i=0; i<H5F_SIZEOF_ADDR(f); i++) + } /* end if */ + else { + for(u = 0; u < addr_len; u++) *(*pp)++ = 0xff; - } -} + } /* end else */ +} /* end H5F_addr_encode_len() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_addr_encode + * + * Purpose: Encodes an address into the buffer pointed to by *PP and + * then increments the pointer to the first byte after the + * address. An undefined value is stored as all 1's. + * + * Return: void + * + * Programmer: Robb Matzke + * Friday, November 7, 1997 + * + * Modifications: + * Robb Matzke, 1999-07-28 + * The ADDR argument is passed by value. + *------------------------------------------------------------------------- + */ +void +H5F_addr_encode(const H5F_t *f, uint8_t **pp/*in,out*/, haddr_t addr) +{ + HDassert(f); + HDassert(pp && *pp); + + H5F_addr_encode_len(pp, addr, H5F_SIZEOF_ADDR(f)); +} /* end H5F_addr_encode() */ /*------------------------------------------------------------------------- @@ -3351,9 +3366,9 @@ H5Fset_mdc_config(hid_t file_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ "H5AC_set_cache_auto_resize_config() failed."); } -#if 1 /* JRM */ + /* pass the resize configuration to the modified cache as well. */ - result = H5AC2_set_cache_auto_resize_config(file->shared->cache2, + result = H5AC2_set_cache_auto_resize_config(file, (H5AC2_cache_config_t *)config_ptr); if ( result != SUCCEED ) { @@ -3361,7 +3376,7 @@ H5Fset_mdc_config(hid_t file_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ "H5AC2_set_cache_auto_resize_config() failed."); } -#endif /* JRM */ + done: FUNC_LEAVE_API(ret_value) |