diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5F.c | 8 | ||||
-rw-r--r-- | src/H5FD.c | 63 | ||||
-rw-r--r-- | src/H5FDcore.c | 14 | ||||
-rw-r--r-- | src/H5FDdirect.c | 14 | ||||
-rw-r--r-- | src/H5FDfamily.c | 18 | ||||
-rw-r--r-- | src/H5FDlog.c | 14 | ||||
-rw-r--r-- | src/H5FDmpio.c | 14 | ||||
-rw-r--r-- | src/H5FDmpiposix.c | 14 | ||||
-rw-r--r-- | src/H5FDmulti.c | 163 | ||||
-rw-r--r-- | src/H5FDprivate.h | 4 | ||||
-rw-r--r-- | src/H5FDpublic.h | 8 | ||||
-rw-r--r-- | src/H5FDsec2.c | 14 | ||||
-rw-r--r-- | src/H5FDstdio.c | 19 | ||||
-rw-r--r-- | src/H5FDstream.c | 14 | ||||
-rw-r--r-- | src/H5Fsuper.c | 12 | ||||
-rw-r--r-- | src/H5MF.c | 7 |
16 files changed, 282 insertions, 118 deletions
@@ -766,7 +766,7 @@ H5F_locate_signature(H5FD_t *file, hid_t dxpl_id) /* Find the least N such that 2^N is larger than the file size */ if (HADDR_UNDEF==(addr=H5FD_get_eof(file)) || - HADDR_UNDEF==(eoa=H5FD_get_eoa(file))) + HADDR_UNDEF==(eoa=H5FD_get_eoa(file, H5FD_MEM_SUPER))) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to obtain EOF/EOA value") for (maxpow=0; addr; maxpow++) addr>>=1; @@ -778,7 +778,7 @@ H5F_locate_signature(H5FD_t *file, hid_t dxpl_id) */ for (n=8; n<maxpow; n++) { addr = (8==n) ? 0 : (haddr_t)1 << n; - if (H5FD_set_eoa(file, addr+H5F_SIGNATURE_LEN) < 0) + if (H5FD_set_eoa(file, H5FD_MEM_SUPER, addr+H5F_SIGNATURE_LEN) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to set EOA value for file signature") if (H5FD_read(file, H5FD_MEM_SUPER, dxpl_id, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to read file signature") @@ -791,7 +791,7 @@ H5F_locate_signature(H5FD_t *file, hid_t dxpl_id) * failure. */ if (n>=maxpow) { - (void)H5FD_set_eoa(file, eoa); /* Ignore return value */ + (void)H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa); /* Ignore return value */ HGOTO_ERROR(H5E_IO, H5E_CANTINIT, HADDR_UNDEF, "unable to find a valid file signature") } @@ -2718,7 +2718,7 @@ H5F_get_eoa(const H5F_t *f) assert(f->shared); /* Dispatch to driver */ - if (HADDR_UNDEF==(ret_value=H5FD_get_eoa(f->shared->lf))) + if (HADDR_UNDEF==(ret_value=H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") done: @@ -2117,7 +2117,7 @@ H5FD_update_eoa(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); assert(size > 0); - eoa = file->cls->get_eoa(file); + eoa = file->cls->get_eoa(file, type); #ifdef H5F_DEBUG if(file->alignment * file->threshold != 1 && H5DEBUG(F)) @@ -2138,7 +2138,7 @@ H5FD_update_eoa(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) eoa += wasted; - if(file->cls->set_eoa(file, eoa) < 0) + if(file->cls->set_eoa(file, type, eoa) < 0) HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed") } /* end if */ @@ -2149,7 +2149,7 @@ H5FD_update_eoa(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) ret_value = eoa; eoa += size; - if(file->cls->set_eoa(file, eoa) < 0) + if(file->cls->set_eoa(file, type, eoa) < 0) HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed") /* Free the wasted memory */ @@ -2440,9 +2440,9 @@ HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type if(file->cls->get_eoa) { haddr_t eoa; - eoa = file->cls->get_eoa(file); + eoa = file->cls->get_eoa(file, type); if(eoa == (last->addr+last->size)) { - if(file->cls->set_eoa(file, last->addr) < 0) + if(file->cls->set_eoa(file, type, last->addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "set end of space allocation request failed") /* Remove this free block from the list */ @@ -2618,7 +2618,7 @@ H5FD_can_extend(const H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size, FUNC_ENTER_NOAPI(H5FD_can_extend, FAIL) /* Retrieve the end of the address space */ - if(HADDR_UNDEF==(eoa=H5FD_get_eoa(file))) + if(HADDR_UNDEF==(eoa=H5FD_get_eoa(file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") /* Check if the block is exactly at the end of the file */ @@ -2713,7 +2713,7 @@ HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu, extra_requested = %Hu\n #endif /* H5FD_ALLOC_DEBUG */ /* Retrieve the end of the address space */ - if(HADDR_UNDEF==(eoa=H5FD_get_eoa(file))) + if(HADDR_UNDEF==(eoa=H5FD_get_eoa(file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") /* Map request type to free list */ @@ -2760,7 +2760,7 @@ HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu, extra_requested = %Hu\n /* Extend the file */ eoa += extra_requested; - if(file->cls->set_eoa(file, eoa) < 0) + if(file->cls->set_eoa(file, type, eoa) < 0) HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, FAIL, "file allocation request failed") /* Update the metadata and/or small data block */ @@ -2835,11 +2835,14 @@ done: * Friday, July 30, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ haddr_t -H5FDget_eoa(H5FD_t *file) +H5FDget_eoa(H5FD_t *file, H5FD_mem_t type) { haddr_t ret_value; @@ -2849,9 +2852,11 @@ H5FDget_eoa(H5FD_t *file) /* Check args */ if(!file || !file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer") + if(type<H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file type") /* The real work */ - if(HADDR_UNDEF==(ret_value=H5FD_get_eoa(file))) + if(HADDR_UNDEF==(ret_value=H5FD_get_eoa(file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed") done: @@ -2872,11 +2877,14 @@ done: * Wednesday, August 4, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ haddr_t -H5FD_get_eoa(const H5FD_t *file) +H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type) { haddr_t ret_value; @@ -2884,7 +2892,7 @@ H5FD_get_eoa(const H5FD_t *file) assert(file && file->cls); /* Dispatch to driver */ - if(HADDR_UNDEF==(ret_value=(file->cls->get_eoa)(file))) + if(HADDR_UNDEF==(ret_value=(file->cls->get_eoa)(file, type))) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") done: @@ -2916,11 +2924,14 @@ done: * Friday, July 30, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ herr_t -H5FDset_eoa(H5FD_t *file, haddr_t addr) +H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr) { herr_t ret_value=SUCCEED; /* Return value */ @@ -2930,12 +2941,14 @@ H5FDset_eoa(H5FD_t *file, haddr_t addr) /* Check args */ if(!file || !file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") + if(type<H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file type") if(!H5F_addr_defined(addr) || addr>file->maxaddr) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value") /* The real work */ - if(H5FD_set_eoa(file, addr) < 0) + if(H5FD_set_eoa(file, type, addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed") done: @@ -2956,11 +2969,14 @@ done: * Wednesday, August 4, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ herr_t -H5FD_set_eoa(H5FD_t *file, haddr_t addr) +H5FD_set_eoa(H5FD_t *file, H5FD_mem_t UNUSED type, haddr_t addr) { herr_t ret_value=SUCCEED; /* Return value */ @@ -2970,7 +2986,7 @@ H5FD_set_eoa(H5FD_t *file, haddr_t addr) assert(H5F_addr_defined(addr) && addr<=file->maxaddr); /* Dispatch to driver */ - if((file->cls->set_eoa)(file, addr) < 0) + if((file->cls->set_eoa)(file, type, addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed") done: @@ -3801,6 +3817,12 @@ done: * Programmer: Quincey Koziol * Monday, October 6, 2003 * + * Modifications: + * Raymond Lu + * 5 January 2007 + * Due to the complexity EOA for Multi driver, this function + * is made failed for now. + * *------------------------------------------------------------------------- */ hssize_t @@ -3812,7 +3834,7 @@ H5FD_get_freespace(const H5FD_t *file) hsize_t ma_size = 0; /* Size of "metadata aggregator" */ haddr_t sda_addr = HADDR_UNDEF; /* Base "small data aggregator" address */ hsize_t sda_size = 0; /* Size of "small data aggregator" */ - haddr_t eoa; /* End of allocated space in the file */ + haddr_t eoa = 0; /* End of allocated space in the file */ hssize_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI(H5FD_get_freespace, FAIL) @@ -3821,8 +3843,13 @@ H5FD_get_freespace(const H5FD_t *file) HDassert(file); HDassert(file->cls); + /* Multi driver doesn't support this function because of the complexity. + * It doesn't have eoa for the whole file. */ + if(file->driver_id == H5FD_MULTI) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "Multi driver doesn't support this function") + /* Retrieve the 'eoa' for the file */ - eoa = file->cls->get_eoa(file); + eoa = file->cls->get_eoa(file, H5FD_MEM_DEFAULT); /* Check for aggregating metadata allocations */ if(file->feature_flags & H5FD_FEAT_AGGREGATE_METADATA) { diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 72ed14d..4c0d906 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -90,8 +90,8 @@ static H5FD_t *H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); static herr_t H5FD_core_close(H5FD_t *_file); static int H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2); -static haddr_t H5FD_core_get_eoa(const H5FD_t *_file); -static herr_t H5FD_core_set_eoa(H5FD_t *_file, haddr_t addr); +static haddr_t H5FD_core_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_core_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_core_get_eof(const H5FD_t *_file); static herr_t H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_core_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -570,11 +570,14 @@ done: * Monday, August 2, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static haddr_t -H5FD_core_get_eoa(const H5FD_t *_file) +H5FD_core_get_eoa(const H5FD_t *_file, H5FD_mem_t type) { haddr_t ret_value; /* Return value */ @@ -605,11 +608,14 @@ done: * Thursday, July 29, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static herr_t -H5FD_core_set_eoa(H5FD_t *_file, haddr_t addr) +H5FD_core_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { H5FD_core_t *file = (H5FD_core_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index b981e13..6a68743 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -160,8 +160,8 @@ static H5FD_t *H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, static herr_t H5FD_direct_close(H5FD_t *_file); static int H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_direct_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_direct_get_eoa(const H5FD_t *_file); -static herr_t H5FD_direct_set_eoa(H5FD_t *_file, haddr_t addr); +static haddr_t H5FD_direct_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr); static haddr_t H5FD_direct_get_eof(const H5FD_t *_file); static herr_t H5FD_direct_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_direct_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -717,11 +717,14 @@ done: * Wednesday, 20 September 2006 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static haddr_t -H5FD_direct_get_eoa(const H5FD_t *_file) +H5FD_direct_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { const H5FD_direct_t *file = (const H5FD_direct_t*)_file; haddr_t ret_value; /* Return value */ @@ -751,11 +754,14 @@ done: * Wednesday, 20 September 2006 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static herr_t -H5FD_direct_set_eoa(H5FD_t *_file, haddr_t addr) +H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { H5FD_direct_t *file = (H5FD_direct_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 8b678b5..249edbb 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -97,8 +97,8 @@ static H5FD_t *H5FD_family_open(const char *name, unsigned flags, static herr_t H5FD_family_close(H5FD_t *_file); static int H5FD_family_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_family_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_family_get_eoa(const H5FD_t *_file); -static herr_t H5FD_family_set_eoa(H5FD_t *_file, haddr_t eoa); +static haddr_t H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa); static haddr_t H5FD_family_get_eof(const H5FD_t *_file); static herr_t H5FD_family_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, @@ -1012,11 +1012,14 @@ done: * Wednesday, August 4, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static haddr_t -H5FD_family_get_eoa(const H5FD_t *_file) +H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { const H5FD_family_t *file = (const H5FD_family_t*)_file; haddr_t ret_value; /* Return value */ @@ -1044,11 +1047,14 @@ done: * Wednesday, August 4, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static herr_t -H5FD_family_set_eoa(H5FD_t *_file, haddr_t eoa) +H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) { H5FD_family_t *file = (H5FD_family_t*)_file; haddr_t addr=eoa; @@ -1087,11 +1093,11 @@ H5FD_family_set_eoa(H5FD_t *_file, haddr_t eoa) /* Set the EOA marker for the member */ H5_CHECK_OVERFLOW(file->memb_size,hsize_t,haddr_t); if (addr>(haddr_t)file->memb_size) { - if(H5FD_set_eoa(file->memb[u], (haddr_t)file->memb_size)<0) + if(H5FD_set_eoa(file->memb[u], type, (haddr_t)file->memb_size)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set file eoa") addr -= file->memb_size; } else { - if(H5FD_set_eoa(file->memb[u], addr)<0) + if(H5FD_set_eoa(file->memb[u], type, addr)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set file eoa") addr = 0; } diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 06212e8..ce48d16 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -181,8 +181,8 @@ static herr_t H5FD_log_close(H5FD_t *_file); static int H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_log_query(const H5FD_t *_f1, unsigned long *flags); static haddr_t H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); -static haddr_t H5FD_log_get_eoa(const H5FD_t *_file); -static herr_t H5FD_log_set_eoa(H5FD_t *_file, haddr_t addr); +static haddr_t H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_log_get_eof(const H5FD_t *_file); static herr_t H5FD_log_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -886,11 +886,14 @@ done: * Monday, August 2, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static haddr_t -H5FD_log_get_eoa(const H5FD_t *_file) +H5FD_log_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { const H5FD_log_t *file = (const H5FD_log_t*)_file; haddr_t ret_value; /* Return value */ @@ -920,11 +923,14 @@ done: * Thursday, July 29, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static herr_t -H5FD_log_set_eoa(H5FD_t *_file, haddr_t addr) +H5FD_log_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { H5FD_log_t *file = (H5FD_log_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 8178b7a..b2bca34 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -72,8 +72,8 @@ static H5FD_t *H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr); static herr_t H5FD_mpio_close(H5FD_t *_file); static herr_t H5FD_mpio_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_mpio_get_eoa(const H5FD_t *_file); -static herr_t H5FD_mpio_set_eoa(H5FD_t *_file, haddr_t addr); +static haddr_t H5FD_mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_mpio_get_eof(const H5FD_t *_file); static herr_t H5FD_mpio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, @@ -1175,11 +1175,14 @@ done: * Friday, August 6, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static haddr_t -H5FD_mpio_get_eoa(const H5FD_t *_file) +H5FD_mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; haddr_t ret_value; /* Return value */ @@ -1212,11 +1215,14 @@ done: * Friday, August 6, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_set_eoa(H5FD_t *_file, haddr_t addr) +H5FD_mpio_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index df76070..548bdc7 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -181,8 +181,8 @@ static H5FD_t *H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_i static herr_t H5FD_mpiposix_close(H5FD_t *_file); static int H5FD_mpiposix_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_mpiposix_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_mpiposix_get_eoa(const H5FD_t *_file); -static herr_t H5FD_mpiposix_set_eoa(H5FD_t *_file, haddr_t addr); +static haddr_t H5FD_mpiposix_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type); +static herr_t H5FD_mpiposix_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_mpiposix_get_eof(const H5FD_t *_file); static herr_t H5FD_mpiposix_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -951,11 +951,14 @@ done: * Thursday, July 11, 2002 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static haddr_t -H5FD_mpiposix_get_eoa(const H5FD_t *_file) +H5FD_mpiposix_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { const H5FD_mpiposix_t *file = (const H5FD_mpiposix_t*)_file; haddr_t ret_value; /* Return value */ @@ -987,11 +990,14 @@ done: * Thursday, July 11, 2002 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static herr_t -H5FD_mpiposix_set_eoa(H5FD_t *_file, haddr_t addr) +H5FD_mpiposix_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index b4c4277..6131db1 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -106,7 +106,9 @@ typedef struct H5FD_multi_t { H5FD_multi_fapl_t fa; /*driver-specific file access properties*/ haddr_t memb_next[H5FD_MEM_NTYPES];/*addr of next member */ H5FD_t *memb[H5FD_MEM_NTYPES]; /*member pointers */ - haddr_t eoa; /*end of allocated addresses */ + /*haddr_t eoa;*/ /*end of allocated addresses. Took it out + *because individual files have their own + *eoa. */ unsigned flags; /*file open flags saved for debugging */ char *name; /*name passed to H5Fopen or H5Fcreate */ } H5FD_multi_t; @@ -137,8 +139,8 @@ static H5FD_t *H5FD_multi_open(const char *name, unsigned flags, static herr_t H5FD_multi_close(H5FD_t *_file); static int H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_multi_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_multi_get_eoa(const H5FD_t *_file); -static herr_t H5FD_multi_set_eoa(H5FD_t *_file, haddr_t eoa); +static haddr_t H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa); static haddr_t H5FD_multi_get_eof(const H5FD_t *_file); static herr_t H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static haddr_t H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); @@ -777,8 +779,10 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, name[8] = '\0'; assert(7==H5FD_MEM_NTYPES); - for (m=H5FD_MEM_SUPER; m<H5FD_MEM_NTYPES; m=(H5FD_mem_t)(m+1)) + + for (m=H5FD_MEM_SUPER; m<H5FD_MEM_NTYPES; m=(H5FD_mem_t)(m+1)) { buf[m-1] = (unsigned char)file->fa.memb_map[m]; + } buf[6] = 0; buf[7] = 0; @@ -792,7 +796,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/, p = buf+8; assert(sizeof(haddr_t)<=8); UNIQUE_MEMBERS(file->fa.memb_map, mt) { - memb_eoa = H5FDget_eoa(file->memb[mt]); + memb_eoa = H5FDget_eoa(file->memb[mt], mt); memcpy(p, &(file->fa.memb_addr[mt]), sizeof(haddr_t)); p += sizeof(haddr_t); memcpy(p, &memb_eoa, sizeof(haddr_t)); @@ -872,11 +876,13 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) * Read the map and count the unique members. */ memset(map, 0, sizeof map); + for (i=0; i<6; i++) { map[i+1] = (H5FD_mem_t)buf[i]; if (file->fa.memb_map[i+1]!=map[i+1]) map_changed=TRUE; } + UNIQUE_MEMBERS(map, mt) { nseen++; } END_MEMBERS; @@ -964,7 +970,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) /* Set the EOA marker for all open files */ UNIQUE_MEMBERS(file->fa.memb_map, mt) { if (file->memb[mt]) - if(H5FDset_eoa(file->memb[mt], memb_eoa[mt])<0) + if(H5FDset_eoa(file->memb[mt], mt, memb_eoa[mt])<0) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_CANTSET, "set_eoa() failed", -1) } END_MEMBERS; @@ -1435,18 +1441,81 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) * Wednesday, August 4, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. + * If the TYPE is H5FD_MEM_DEFAULT, simply find the biggest + * EOA of individual file because the EOA for the whole file + * is meaningless. * *------------------------------------------------------------------------- */ static haddr_t -H5FD_multi_get_eoa(const H5FD_t *_file) +H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) { const H5FD_multi_t *file = (const H5FD_multi_t*)_file; + haddr_t eoa = 0; + haddr_t memb_eoa = 0; + static const char *func="H5FD_multi_eof"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear_stack(H5E_DEFAULT); - return file->eoa; + /* The library used to have EOA for the whole file. But it's + * taken out because it makes little sense for MULTI files. + * However, the library sometimes queries it through H5F_get_eoa. + * Here the code finds the biggest EOA for individual file if + * the query is from H5F_get_eoa (TYPE is H5FD_MEM_DEFAULT). + */ + if(H5FD_MEM_DEFAULT == type) { + UNIQUE_MEMBERS(file->fa.memb_map, mt) { + if (file->memb[mt]) { + /* Retrieve EOA */ + H5E_BEGIN_TRY { + memb_eoa = H5FDget_eoa(file->memb[mt], mt); + } H5E_END_TRY; + + if (HADDR_UNDEF==memb_eoa) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", HADDR_UNDEF) + } else if (file->fa.relax) { + /* + * The member is not open yet (maybe it doesn't exist). Make the + * best guess about the end-of-file. + */ + memb_eoa = file->memb_next[mt]; + assert(HADDR_UNDEF!=memb_eoa); + } else { + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF) + } + + if(memb_eoa > eoa) + eoa = memb_eoa; + } END_MEMBERS; + } else { + H5FD_mem_t mmt = file->fa.memb_map[type]; + if (H5FD_MEM_DEFAULT==mmt) mmt = type; + + if (file->memb[mmt]) { + H5E_BEGIN_TRY { + eoa = H5FDget_eoa(file->memb[mmt], mmt); + } H5E_END_TRY; + + if (HADDR_UNDEF==eoa) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", HADDR_UNDEF) + } else if (file->fa.relax) { +int i; + /* + * The member is not open yet (maybe it doesn't exist). Make the + * best guess about the end-of-file. + */ + eoa = file->memb_next[mmt]; + assert(HADDR_UNDEF!=eoa); + } else { + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eoa", HADDR_UNDEF) + } + } + + return eoa; } @@ -1466,43 +1535,29 @@ H5FD_multi_get_eoa(const H5FD_t *_file) * Wednesday, August 4, 1999 * * Modifications: + * Raymond Lu + * 10 January 2007 + * EOA for the whole file is discarded because it's meaningless + * for MULTI file. This function only sets eoa for individual + * file. * *------------------------------------------------------------------------- */ static herr_t -H5FD_multi_set_eoa(H5FD_t *_file, haddr_t eoa) +H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) { H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_mem_t mt, mmt; herr_t status; static const char *func="H5FD_multi_set_eoa"; /* Function Name for error reporting */ /* Clear the error stack */ H5Eclear_stack(H5E_DEFAULT); - /* Find the subfile in which the new EOA value falls */ - for (mt=H5FD_MEM_SUPER; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1)) { - mmt = file->fa.memb_map[mt]; - if (H5FD_MEM_DEFAULT==mmt) mmt = mt; - assert(mmt>0 && mmt<H5FD_MEM_NTYPES); - - if (eoa>=file->fa.memb_addr[mmt] && eoa<file->memb_next[mmt]) { - break; - } - } - assert(mt<H5FD_MEM_NTYPES); - - /* Set subfile eoa */ - if (file->memb[mmt]) { - H5E_BEGIN_TRY { - status = H5FDset_eoa(file->memb[mmt], eoa-file->fa.memb_addr[mmt]); - } H5E_END_TRY; - if (status<0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1) - } - - /* Save new eoa for return later */ - file->eoa = eoa; + H5E_BEGIN_TRY { + status = H5FDset_eoa(file->memb[type], type, eoa); + } H5E_END_TRY; + if (status<0) + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1) return 0; } @@ -1524,6 +1579,10 @@ H5FD_multi_set_eoa(H5FD_t *_file, haddr_t eoa) * Wednesday, August 4, 1999 * * Modifications: + * Raymond Lu + * 5 January 2007 + * Multi driver no longer has EOA for the whole file. Calculate + * it in the same way as EOF instead. * *------------------------------------------------------------------------- */ @@ -1531,7 +1590,8 @@ static haddr_t H5FD_multi_get_eof(const H5FD_t *_file) { const H5FD_multi_t *file = (const H5FD_multi_t*)_file; - haddr_t eof=0, tmp; + haddr_t eof=0, tmp_eof; + haddr_t eoa=0, tmp_eoa; static const char *func="H5FD_multi_eof"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -1539,29 +1599,41 @@ H5FD_multi_get_eof(const H5FD_t *_file) UNIQUE_MEMBERS(file->fa.memb_map, mt) { if (file->memb[mt]) { + /* Retrieve EOF */ H5E_BEGIN_TRY { - tmp = H5FDget_eof(file->memb[mt]); + tmp_eof = H5FDget_eof(file->memb[mt]); } H5E_END_TRY; - if (HADDR_UNDEF==tmp) + + if (HADDR_UNDEF==tmp_eof) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF) - if (tmp>0) tmp += file->fa.memb_addr[mt]; + if (tmp_eof>0) tmp_eof += file->fa.memb_addr[mt]; + /* Retrieve EOA */ + H5E_BEGIN_TRY { + tmp_eoa = H5FDget_eoa(file->memb[mt], mt); + } H5E_END_TRY; + + if (HADDR_UNDEF==tmp_eoa) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", HADDR_UNDEF) } else if (file->fa.relax) { /* * The member is not open yet (maybe it doesn't exist). Make the * best guess about the end-of-file. */ - tmp = file->memb_next[mt]; - assert(HADDR_UNDEF!=tmp); + tmp_eof = file->memb_next[mt]; + assert(HADDR_UNDEF!=tmp_eof); + tmp_eoa = file->memb_next[mt]; + assert(HADDR_UNDEF!=tmp_eoa); } else { H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF) } - if (tmp>eof) eof = tmp; + if (tmp_eof>eof) eof = tmp_eof; + if (tmp_eoa>eoa) eoa = tmp_eoa; } END_MEMBERS; - return MAX(file->eoa, eof); + return MAX(eoa, eof); } @@ -1628,6 +1700,8 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) if (HADDR_UNDEF==(addr=H5FDalloc(file->memb[mmt], type, dxpl_id, size))) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file can't alloc", HADDR_UNDEF) addr += file->fa.memb_addr[mmt]; + +/*#ifdef TMP if ( addr + size > file->eoa ) { if ( H5FD_multi_set_eoa(_file, addr + size) < 0 ) { @@ -1636,6 +1710,11 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) "can't set eoa", HADDR_UNDEF) } } +#else + if ( addr + size > file->eoa ) + file->eoa = addr + size; +#endif */ + return addr; } @@ -1831,7 +1910,7 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) for (mt=1; mt<H5FD_MEM_NTYPES; mt++) { if (HADDR_UNDEF!=file->memb_addr[mt]) { - haddr_t eoa = H5FDget_eoa(file->memb[mt]); + haddr_t eoa = H5FDget_eoa(file->memb[mt], mt); fprintf(stderr, " %6d %20llu %20llu %20llu %s\n", (int)mt, (unsigned long_long)(file->memb_addr[mt]), (unsigned long_long)eoa, diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 6660e49..0d8a6e2 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -59,8 +59,8 @@ H5_DLL haddr_t H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t H5_DLL herr_t H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); H5_DLL haddr_t H5FD_realloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsize_t old_size, hsize_t new_size); -H5_DLL haddr_t H5FD_get_eoa(const H5FD_t *file); -H5_DLL herr_t H5FD_set_eoa(H5FD_t *file, haddr_t addr); +H5_DLL haddr_t H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type); +H5_DLL herr_t H5FD_set_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr); H5_DLL haddr_t H5FD_get_eof(const H5FD_t *file); H5_DLL herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/); diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h index e6467d5..4eedbf1 100644 --- a/src/H5FDpublic.h +++ b/src/H5FDpublic.h @@ -200,8 +200,8 @@ typedef struct H5FD_class_t { haddr_t (*alloc)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size); herr_t (*free)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); - haddr_t (*get_eoa)(const H5FD_t *file); - herr_t (*set_eoa)(H5FD_t *file, haddr_t addr); + haddr_t (*get_eoa)(const H5FD_t *file, H5FD_mem_t type); + herr_t (*set_eoa)(H5FD_t *file, H5FD_mem_t type, haddr_t addr); haddr_t (*get_eof)(const H5FD_t *file); herr_t (*get_handle)(H5FD_t *file, hid_t fapl, void**file_handle); herr_t (*read)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, @@ -289,8 +289,8 @@ H5_DLL herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size); H5_DLL haddr_t H5FDrealloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t old_size, hsize_t new_size); -H5_DLL haddr_t H5FDget_eoa(H5FD_t *file); -H5_DLL herr_t H5FDset_eoa(H5FD_t *file, haddr_t eof); +H5_DLL haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type); +H5_DLL herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa); H5_DLL haddr_t H5FDget_eof(H5FD_t *file); H5_DLL herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle); H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index af020db..11adf75 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -149,8 +149,8 @@ static H5FD_t *H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, static herr_t H5FD_sec2_close(H5FD_t *_file); static int H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_sec2_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_sec2_get_eoa(const H5FD_t *_file); -static herr_t H5FD_sec2_set_eoa(H5FD_t *_file, haddr_t addr); +static haddr_t H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_sec2_get_eof(const H5FD_t *_file); static herr_t H5FD_sec2_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -556,11 +556,14 @@ done: * Monday, August 2, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static haddr_t -H5FD_sec2_get_eoa(const H5FD_t *_file) +H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { const H5FD_sec2_t *file = (const H5FD_sec2_t*)_file; haddr_t ret_value; /* Return value */ @@ -590,11 +593,14 @@ done: * Thursday, July 29, 1999 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static herr_t -H5FD_sec2_set_eoa(H5FD_t *_file, haddr_t addr) +H5FD_sec2_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { H5FD_sec2_t *file = (H5FD_sec2_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 92ea653..32466bc 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -152,8 +152,8 @@ static H5FD_t *H5FD_stdio_open(const char *name, unsigned flags, static herr_t H5FD_stdio_close(H5FD_t *lf); static int H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_stdio_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_stdio_get_eoa(const H5FD_t *_file); -static herr_t H5FD_stdio_set_eoa(H5FD_t *_file, haddr_t addr); +static haddr_t H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t type); +static herr_t H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_stdio_get_eof(const H5FD_t *_file); static herr_t H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_stdio_read(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, @@ -538,12 +538,16 @@ H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */) * Monday, August 2, 1999 * * Modifications: - * Stolen from the sec2 driver - QAK, 10/18/99 + * Stolen from the sec2 driver - QAK, 10/18/99 + * + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static haddr_t -H5FD_stdio_get_eoa(const H5FD_t *_file) +H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*unused*/ type) { const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; @@ -569,12 +573,15 @@ H5FD_stdio_get_eoa(const H5FD_t *_file) * Thursday, July 29, 1999 * * Modifications: - * Stolen from the sec2 driver - QAK, 10/18/99 + * Stolen from the sec2 driver - QAK, 10/18/99 * + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. *------------------------------------------------------------------------- */ static herr_t -H5FD_stdio_set_eoa(H5FD_t *_file, haddr_t addr) +H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*unused*/ type, haddr_t addr) { H5FD_stdio_t *file = (H5FD_stdio_t*)_file; diff --git a/src/H5FDstream.c b/src/H5FDstream.c index 70ce836..d89c718 100644 --- a/src/H5FDstream.c +++ b/src/H5FDstream.c @@ -171,8 +171,8 @@ static H5FD_t *H5FD_stream_open (const char *name, unsigned flags, static herr_t H5FD_stream_flush (H5FD_t *_stream, hid_t dxpl_id, unsigned closing); static herr_t H5FD_stream_close (H5FD_t *_stream); static herr_t H5FD_stream_query(const H5FD_t *_f1, unsigned long *flags); -static haddr_t H5FD_stream_get_eoa (const H5FD_t *_stream); -static herr_t H5FD_stream_set_eoa (H5FD_t *_stream, haddr_t addr); +static haddr_t H5FD_stream_get_eoa (const H5FD_t *_stream, H5FD_mem_t type); +static herr_t H5FD_stream_set_eoa (H5FD_t *_stream, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_stream_get_eof (const H5FD_t *_stream); static herr_t H5FD_stream_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_stream_read (H5FD_t *_stream, H5FD_mem_t type, @@ -897,11 +897,14 @@ done: * Tuesday, September 12, 2000 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static haddr_t -H5FD_stream_get_eoa (const H5FD_t *_stream) +H5FD_stream_get_eoa (const H5FD_t *_stream, H5FD_mem_t UNUSED type) { const H5FD_stream_t *stream = (const H5FD_stream_t *) _stream; haddr_t ret_value; /* Return value */ @@ -930,11 +933,14 @@ done: * Tuesday, September 12, 2000 * * Modifications: + * Raymond Lu + * 21 Dec. 2006 + * Added the parameter TYPE. It's only used for MULTI driver. * *------------------------------------------------------------------------- */ static herr_t -H5FD_stream_set_eoa (H5FD_t *_stream, haddr_t addr) +H5FD_stream_set_eoa (H5FD_t *_stream, H5FD_mem_t UNUSED type, haddr_t addr) { H5FD_stream_t *stream = (H5FD_stream_t *) _stream; herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index d8c5d0e..62ada4e 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -120,7 +120,7 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr, start_p = p = sbuf; buf_size=sizeof(sbuf); - if (H5FD_set_eoa(lf, shared->super_addr + fixed_size) < 0 || + if (H5FD_set_eoa(lf, H5FD_MEM_SUPER, shared->super_addr + fixed_size) < 0 || H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, shared->super_addr, fixed_size, p) < 0) HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "unable to read superblock") } else { @@ -216,7 +216,7 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr, /* The buffer (buf) is either passed in or the "local_buf" variable now */ if(!buf) { - if (H5FD_set_eoa(lf, shared->super_addr + fixed_size+variable_size) < 0 || + if (H5FD_set_eoa(lf, H5FD_MEM_SUPER, shared->super_addr + fixed_size+variable_size) < 0 || H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, shared->super_addr + fixed_size, variable_size, p) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read superblock") @@ -292,7 +292,7 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr, driver_p = p = dbuf; dbuf_size=sizeof(dbuf); - if (H5FD_set_eoa(lf, drv_addr + 16) < 0 || + if (H5FD_set_eoa(lf, H5FD_MEM_SUPER, drv_addr + 16) < 0 || H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr, (size_t)16, p) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read driver information block") } /* end if */ @@ -319,7 +319,7 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr, assert((driver_size + 16) <= dbuf_size); if(!buf) { - if (H5FD_set_eoa(lf, drv_addr + 16 + driver_size) < 0 || + if (H5FD_set_eoa(lf, H5FD_MEM_SUPER, drv_addr + 16 + driver_size) < 0 || H5FD_read(lf, H5FD_MEM_SUPER, dxpl_id, drv_addr+16, driver_size, p) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read file driver information") } /* end if */ @@ -365,7 +365,7 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr, * Tell the file driver how much address space has already been * allocated so that it knows how to allocate additional memory. */ - if (H5FD_set_eoa(lf, stored_eoa) < 0) + if (H5FD_set_eoa(lf, H5FD_MEM_SUPER, stored_eoa) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to set end-of-address marker for file") /* Decode shared object header message information and store it in the @@ -595,7 +595,7 @@ H5F_write_superblock(H5F_t *f, hid_t dxpl_id) *p++ = f->shared->sohm_vers; *p++ = f->shared->sohm_nindexes; } - H5F_addr_encode(f, &p, H5FD_get_eoa(f->shared->lf)); + H5F_addr_encode(f, &p, H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER)); H5F_addr_encode(f, &p, f->shared->driver_addr); if(H5G_obj_ent_encode(f, &p, H5G_oloc(f->shared->root_grp))<0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode root group information") @@ -38,6 +38,7 @@ #include "H5Fpkg.h" #include "H5FDprivate.h" #include "H5MFprivate.h" +#include "H5FDmulti.h" /*multiple files partitioned by mem usage */ /*------------------------------------------------------------------------- @@ -234,14 +235,16 @@ done: hbool_t H5MF_alloc_overflow(H5F_t *f, hsize_t size) { - hsize_t space_needed; /* Accumulator variable */ - size_t c; /* Local index variable */ + hsize_t space_needed = 0; /* Accumulator variable */ + H5FD_mem_t type; /* Type of memory */ + size_t c; /* Local index variable */ hbool_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOFUNC(H5MF_alloc_overflow) /* Start with the current end of the file's address. */ space_needed = (hsize_t)H5F_get_eoa(f); + HDassert(H5F_addr_defined(space_needed)); /* Subtract the file's base address to get the actual amount of |