diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-12-14 07:42:13 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-12-14 07:42:13 (GMT) |
commit | f6c7631b3c40e03abe228cf9b3c2308c610d04cd (patch) | |
tree | 312cfcc9ada49a73b0e2867bfd933d10bf2c17da /src/H5FAdbg.c | |
parent | 59c2f32bc7fcd550d5162ebbf3899e2c4a16d3e1 (diff) | |
download | hdf5-f6c7631b3c40e03abe228cf9b3c2308c610d04cd.zip hdf5-f6c7631b3c40e03abe228cf9b3c2308c610d04cd.tar.gz hdf5-f6c7631b3c40e03abe228cf9b3c2308c610d04cd.tar.bz2 |
[svn-r28624] Minor normalization of H5FA package with revise_chunks.
Tested on:
Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1
serial only
(these changes have been in revise_chunks for a long time)
Diffstat (limited to 'src/H5FAdbg.c')
-rw-r--r-- | src/H5FAdbg.c | 132 |
1 files changed, 65 insertions, 67 deletions
diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c index 2f8fda2..2dc51c5 100644 --- a/src/H5FAdbg.c +++ b/src/H5FAdbg.c @@ -15,9 +15,9 @@ /*------------------------------------------------------------------------- * - * Created: H5FAdbg.c + * Created: H5FAdbg.c * - * Purpose: Dump debugging information about a fixed array. + * Purpose: Dump debugging information about a fixed array. * *------------------------------------------------------------------------- */ @@ -80,13 +80,13 @@ /*------------------------------------------------------------------------- - * Function: H5FA__hdr_debug + * Function: H5FA__hdr_debug * - * Purpose: Prints debugging info about a fixed array header. + * Purpose: Prints debugging info about a fixed array header. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -97,8 +97,8 @@ H5FA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth, const H5FA_class_t *cls, haddr_t obj_addr)) /* Local variables */ - H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ - void *dbg_ctx = NULL; /* Fixed array debugging context */ + H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ + void *dbg_ctx = NULL; /* Fixed array debugging context */ /* Check arguments */ HDassert(f); @@ -113,58 +113,58 @@ H5FA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, if(cls->crt_dbg_ctx) { /* Create debugging context */ if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, dxpl_id, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") + H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") } /* end if */ /* Load the fixed array header */ if(NULL == (hdr = H5FA__hdr_protect(f, dxpl_id, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") /* Print opening message */ HDfprintf(stream, "%*sFixed Array Header...\n", indent, ""); /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Array class ID:", hdr->cparam.cls->name); + "Array class ID:", hdr->cparam.cls->name); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Header size:", - hdr->size); + "Header size:", + hdr->size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Raw Element Size:", - (unsigned)hdr->cparam.raw_elmt_size); + "Raw Element Size:", + (unsigned)hdr->cparam.raw_elmt_size); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, - "Native Element Size (on this platform):", - hdr->cparam.cls->nat_elmt_size); + "Native Element Size (on this platform):", + hdr->cparam.cls->nat_elmt_size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Max. # of elements in data block page:", - (unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits)); + "Max. # of elements in data block page:", + (unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits)); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements in Fixed Array:", hdr->stats.nelmts); + "Number of elements in Fixed Array:", hdr->stats.nelmts); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Fixed Array Data Block Address:", hdr->dblk_addr); + "Fixed Array Data Block Address:", hdr->dblk_addr); CATCH if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") + H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") if(hdr && H5FA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PKG) /* end H5FA__hdr_debug() */ /*------------------------------------------------------------------------- - * Function: H5FA__dblock_debug + * Function: H5FA__dblock_debug * - * Purpose: Prints debugging info about a fixed array data block. + * Purpose: Prints debugging info about a fixed array data block. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi + * Programmer: Vailin Choi * Thursday, April 30, 2009 * *------------------------------------------------------------------------- @@ -177,7 +177,7 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Local variables */ H5FA_hdr_t *hdr = NULL; /* Shared fixed array header */ H5FA_dblock_t *dblock = NULL; /* Fixed array data block */ - void *dbg_ctx = NULL; /* Fixed array context */ + void *dbg_ctx = NULL; /* Fixed array context */ size_t u; /* Local index variable */ /* Check arguments */ @@ -194,12 +194,12 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde if(cls->crt_dbg_ctx) { /* Create debugging context */ if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, dxpl_id, obj_addr))) - H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") + H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context") } /* end if */ /* Load the fixed array header */ if(NULL == (hdr = H5FA__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") + H5E_THROW(H5E_CANTPROTECT, "unable to load fixed array header") /* Protect data block */ if(NULL == (dblock = H5FA__dblock_protect(hdr, dxpl_id, addr, H5AC__READ_ONLY_FLAG))) @@ -210,26 +210,26 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Array class ID:", hdr->cparam.cls->name); + "Array class ID:", hdr->cparam.cls->name); HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of Data Block:", dblock->addr); HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data Block size:", dblock->size); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements in Data Block:", hdr->cparam.nelmts); + "Number of elements in Data Block:", hdr->cparam.nelmts); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of pages in Data Block:", dblock->npages); + "Number of pages in Data Block:", dblock->npages); HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, - "Number of elements per Data Block page:", dblock->dblk_page_nelmts); + "Number of elements per Data Block page:", dblock->dblk_page_nelmts); if(dblock->npages) { /* paging */ - size_t dblk_page_nelmts; /* # of elements in a data block page */ + size_t dblk_page_nelmts; /* # of elements in a data block page */ haddr_t dblk_page_addr; /* Address of a data block page */ size_t page_idx; /* Page index within data block */ - HDfprintf(stream, "%*sPaging:\n", indent, ""); + HDfprintf(stream, "%*sPaging:\n", indent, ""); - /* Iterate over the pages */ - dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock); - dblk_page_nelmts = dblock->dblk_page_nelmts; + /* Iterate over the pages */ + dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock); + dblk_page_nelmts = dblock->dblk_page_nelmts; /* Read and print each page's elements in the data block */ for(page_idx = 0; page_idx < dblock->npages; page_idx++) { @@ -237,51 +237,49 @@ H5FA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde HDfprintf(stream, "%*s%-*s %Hu %s\n", indent, "", fwidth, "Page %Zu:", page_idx, "empty"); - } /* end if */ + } /* end if */ else { /* get the page */ H5FA_dblk_page_t *dblk_page; /* Pointer to a data block page */ - hsize_t nelmts_left; /* Remaining elements in the last data block page */ + hsize_t nelmts_left; /* Remaining elements in the last data block page */ /* Check for last page */ - if(((page_idx + 1) == dblock->npages) && (nelmts_left = hdr->cparam.nelmts % dblock->dblk_page_nelmts)) - dblk_page_nelmts = (size_t)nelmts_left; + if(((page_idx + 1) == dblock->npages) && (nelmts_left = hdr->cparam.nelmts % dblock->dblk_page_nelmts)) + dblk_page_nelmts = (size_t)nelmts_left; if(NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dxpl_id, dblk_page_addr, dblk_page_nelmts, H5AC__READ_ONLY_FLAG))) H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr) - HDfprintf(stream, "%*sElements in page %Zu:\n", indent, "", page_idx); - for(u = 0; u < dblk_page_nelmts; u++) { - /* Call the class's 'debug' callback */ - if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, - ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") - } /* end for */ - if(H5FA__dblk_page_unprotect(dblk_page, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") - - /* Advance to next page address */ - dblk_page_addr += dblock->dblk_page_size; - } /* paging */ - } /* end for npages */ + HDfprintf(stream, "%*sElements in page %Zu:\n", indent, "", page_idx); + for(u = 0; u < dblk_page_nelmts; u++) { + /* Call the class's 'debug' callback */ + if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) + H5E_THROW(H5E_CANTGET, "can't get element for debugging") + } /* end for */ + if(H5FA__dblk_page_unprotect(dblk_page, dxpl_id, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block page") + + /* Advance to next page address */ + dblk_page_addr += dblock->dblk_page_size; + } /* paging */ + } /* end for npages */ } /* end if */ else { /* not paging */ - /* Print the elements in the data block */ - HDfprintf(stream, "%*sElements:\n", indent, ""); - for(u = 0; u < hdr->cparam.nelmts; u++) { - /* Call the class's 'debug' callback */ - if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, - ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - H5E_THROW(H5E_CANTGET, "can't get element for debugging") - } /* end for */ + /* Print the elements in the data block */ + HDfprintf(stream, "%*sElements:\n", indent, ""); + for(u = 0; u < hdr->cparam.nelmts; u++) { + /* Call the class's 'debug' callback */ + if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) + H5E_THROW(H5E_CANTGET, "can't get element for debugging") + } /* end for */ } /* end else */ CATCH if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") + H5E_THROW(H5E_CANTRELEASE, "unable to release fixed array debugging context") if(dblock && H5FA__dblock_unprotect(dblock, dxpl_id, H5AC__NO_FLAGS_SET) < 0) H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array data block") if(hdr && H5FA__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") + H5E_THROW(H5E_CANTUNPROTECT, "unable to release fixed array header") END_FUNC(PKG) /* end H5FA__dblock_debug() */ |