summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5F.c21
-rw-r--r--src/H5FD.c20
-rw-r--r--src/H5FDcore.c1
-rw-r--r--src/H5FDdirect.c1
-rw-r--r--src/H5FDfamily.c32
-rw-r--r--src/H5FDlog.c1
-rw-r--r--src/H5FDmpio.c1
-rw-r--r--src/H5FDmpiposix.c1
-rw-r--r--src/H5FDmulti.c63
-rw-r--r--src/H5FDpublic.h1
-rw-r--r--src/H5FDsec2.c93
-rw-r--r--src/H5FDstdio.c1
-rw-r--r--src/H5FDwindows.c1
-rw-r--r--src/H5Fsuper.c127
-rw-r--r--src/H5MFaggr.c3
-rw-r--r--src/H5MFdbg.c71
-rwxr-xr-xsrc/H5SM.c34
17 files changed, 296 insertions, 176 deletions
diff --git a/src/H5F.c b/src/H5F.c
index f7c0022..327f934 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1139,8 +1139,6 @@ H5F_dest(H5F_t *f, hid_t dxpl_id)
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_dest() */
-
-
/*-------------------------------------------------------------------------
* Function: H5F_open
@@ -1796,13 +1794,6 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info")
} /* end if */
- /* flush (and invalidate, if requested) the entire metadata cache */
- H5AC_flags = 0;
- 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 metadata cache")
-
/* Truncate the file to the current allocated size */
/* (needs to happen before superblock write, since the 'eoa' value is
* written in superblock -QAK)
@@ -1811,9 +1802,19 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level truncate failed")
/* Write the superblock to disk */
- if(H5F_super_write(f, dxpl_id) != SUCCEED)
+ /* (needs to happen before metadata flush (H5AC_flush), since the information
+ * in the superblock extension may be updated - 2008/10/14, QAK)
+ */
+ if(H5F_super_write(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write superblock to file")
+ /* Flush (and invalidate, if requested) the entire metadata cache */
+ H5AC_flags = 0;
+ 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 metadata cache")
+
/* Flush out the metadata accumulator */
if(H5F_accum_flush(f, dxpl_id) < 0)
HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator")
diff --git a/src/H5FD.c b/src/H5FD.c
index 9eacd3e..4c316d1 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -1712,15 +1712,27 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags)
herr_t
H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_get_fs_type_map)
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5FD_get_fs_type_map, FAIL)
+ /* Sanity check */
HDassert(file);
+ HDassert(file && file->cls);
HDassert(type_map);
- /* Copy free space type mapping */
- HDmemcpy(type_map, file->cls->fl_map, sizeof(file->cls->fl_map));
+ /* Check for VFD class providing a type map retrieval rouine */
+ if(file->cls->get_type_map) {
+ /* Retrieve type mapping for this file */
+ if((file->cls->get_type_map)(file, type_map) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get type map failed")
+ } /* end if */
+ else
+ /* Copy class's default free space type mapping */
+ HDmemcpy(type_map, file->cls->fl_map, sizeof(file->cls->fl_map));
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_get_fs_type_map() */
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 8840720..68a0655 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -121,6 +121,7 @@ static const H5FD_class_t H5FD_core_g = {
H5FD_core_close, /*close */
H5FD_core_cmp, /*cmp */
H5FD_core_query, /*query */
+ NULL, /*get_type_map */
NULL, /*alloc */
NULL, /*free */
H5FD_core_get_eoa, /*get_eoa */
diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c
index 88a2af0..61eb318 100644
--- a/src/H5FDdirect.c
+++ b/src/H5FDdirect.c
@@ -190,6 +190,7 @@ static const H5FD_class_t H5FD_direct_g = {
H5FD_direct_close, /*close */
H5FD_direct_cmp, /*cmp */
H5FD_direct_query, /*query */
+ NULL, /*get_type_map */
NULL, /*alloc */
NULL, /*free */
H5FD_direct_get_eoa, /*get_eoa */
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 3e09f76..cfad5e3 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -128,6 +128,7 @@ static const H5FD_class_t H5FD_family_g = {
H5FD_family_close, /*close */
H5FD_family_cmp, /*cmp */
H5FD_family_query, /*query */
+ NULL, /*get_type_map */
NULL, /*alloc */
NULL, /*free */
H5FD_family_get_eoa, /*get_eoa */
@@ -976,22 +977,22 @@ done:
static herr_t
H5FD_family_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */)
{
- herr_t ret_value=SUCCEED;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(H5FD_family_query, FAIL)
/* Set the VFL feature flags that this driver supports */
if(flags) {
- *flags=0;
- *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
- *flags|=H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes. */
- *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */
- *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
- }
+ *flags = 0;
+ *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
+ *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes. */
+ *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */
+ *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_family_query() */
/*-------------------------------------------------------------------------
@@ -1372,35 +1373,32 @@ done:
* Purpose: Flushes all family members.
*
* Return: Success: 0
- *
* Failure: -1, as many files flushed as possible.
*
* Programmer: Robb Matzke
* Wednesday, August 4, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
H5FD_family_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing)
{
H5FD_family_t *file = (H5FD_family_t*)_file;
- unsigned u, nerrors=0;
- herr_t ret_value=SUCCEED; /* Return value */
+ unsigned u, nerrors = 0;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_family_flush, FAIL)
- for (u=0; u<file->nmembs; u++)
- if (file->memb[u] && H5FD_flush(file->memb[u], dxpl_id, closing)<0)
+ for(u = 0; u < file->nmembs; u++)
+ if(file->memb[u] && H5FD_flush(file->memb[u], dxpl_id, closing) < 0)
nerrors++;
- if (nerrors)
+ if(nerrors)
HGOTO_ERROR(H5E_IO, H5E_BADVALUE, FAIL, "unable to flush member files")
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_family_flush() */
/*-------------------------------------------------------------------------
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 2a4dae6..f7eb349 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -225,6 +225,7 @@ static const H5FD_class_t H5FD_log_g = {
H5FD_log_close, /*close */
H5FD_log_cmp, /*cmp */
H5FD_log_query, /*query */
+ NULL, /*get_type_map */
H5FD_log_alloc, /*alloc */
NULL, /*free */
H5FD_log_get_eoa, /*get_eoa */
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index ea5a768..57da069 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -113,6 +113,7 @@ static const H5FD_class_mpi_t H5FD_mpio_g = {
H5FD_mpio_close, /*close */
NULL, /*cmp */
H5FD_mpio_query, /*query */
+ NULL, /*get_type_map */
NULL, /*alloc */
NULL, /*free */
H5FD_mpio_get_eoa, /*get_eoa */
diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c
index 03e8cb3..245fc3e 100644
--- a/src/H5FDmpiposix.c
+++ b/src/H5FDmpiposix.c
@@ -221,6 +221,7 @@ static const H5FD_class_mpi_t H5FD_mpiposix_g = {
H5FD_mpiposix_close, /*close */
H5FD_mpiposix_cmp, /*cmp */
H5FD_mpiposix_query, /*query */
+ NULL, /*get_type_map */
NULL, /*alloc */
NULL, /*free */
H5FD_mpiposix_get_eoa, /*get_eoa */
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 6b53d9e..2be54f8 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -66,16 +66,6 @@
assert(LOOPVAR>0 && LOOPVAR<H5FD_MEM_NTYPES); \
if (_seen[LOOPVAR]++) continue;
-#ifdef LATER
-#define MAPPED_MEMBERS(MAP,LOOPVAR) { \
- H5FD_mem_t _unmapped, LOOPVAR; \
- \
- for (_unmapped=H5FD_MEM_SUPER; _unmapped<H5FD_MEM_NTYPES; _unmapped=_unmapped+1) { \
- LOOPVAR = MAP[_unmapped]; \
- if (H5FD_MEM_DEFAULT==LOOPVAR) LOOPVAR=_unmapped; \
- assert(LOOPVAR>0 && LOOPVAR<H5FD_MEM_NTYPES);
-#endif /* LATER */
-
#define ALL_MEMBERS(LOOPVAR) { \
H5FD_mem_t LOOPVAR; \
for (LOOPVAR=H5FD_MEM_DEFAULT; LOOPVAR<H5FD_MEM_NTYPES; LOOPVAR=(H5FD_mem_t)(LOOPVAR+1)) {
@@ -140,6 +130,7 @@ 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 herr_t H5FD_multi_get_type_map(const H5FD_t *file, H5FD_mem_t *type_map);
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);
@@ -173,6 +164,7 @@ static const H5FD_class_t H5FD_multi_g = {
H5FD_multi_close, /*close */
H5FD_multi_cmp, /*cmp */
H5FD_multi_query, /*query */
+ H5FD_multi_get_type_map, /*get_type_map */
H5FD_multi_alloc, /*alloc */
H5FD_multi_free, /*free */
H5FD_multi_get_eoa, /*get_eoa */
@@ -480,7 +472,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map,
}
if (!memb_addr) {
for (mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt=(H5FD_mem_t)(mt+1))
- _memb_addr[mt] = (mt?mt-1:0) * HADDR_MAX/H5FD_MEM_NTYPES;
+ _memb_addr[mt] = (hsize_t)(mt ? (mt - 1) : 0) * HADDR_MAX / H5FD_MEM_NTYPES;
memb_addr = _memb_addr;
}
@@ -717,7 +709,7 @@ static hsize_t
H5FD_multi_sb_size(H5FD_t *_file)
{
H5FD_multi_t *file = (H5FD_multi_t*)_file;
- int nseen = 0;
+ unsigned nseen = 0;
hsize_t nbytes = 8; /*size of header*/
/* Clear the error stack */
@@ -803,9 +795,9 @@ 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], mt);
memcpy(p, &(file->fa.memb_addr[mt]), sizeof(haddr_t));
p += sizeof(haddr_t);
+ memb_eoa = H5FDget_eoa(file->memb[mt], mt);
memcpy(p, &memb_eoa, sizeof(haddr_t));
p += sizeof(haddr_t);
nseen++;
@@ -824,7 +816,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name/*out*/,
} END_MEMBERS;
return 0;
-}
+} /* end H5FD_multi_sb_encode() */
/*-------------------------------------------------------------------------
@@ -982,7 +974,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
} END_MEMBERS;
return 0;
-}
+} /* end H5FD_multi_sb_decode() */
/*-------------------------------------------------------------------------
@@ -1424,13 +1416,38 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */)
/* Set the VFL feature flags that this driver supports */
if(flags) {
- *flags=0;
- *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */
- *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
- }
+ *flags = 0;
+ *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */
+ *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
+ } /* end if */
return(0);
-}
+} /* end H5FD_multi_query() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5FD_multi_get_type_map
+ *
+ * Purpose: Retrieve the memory type mapping for this file
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, October 9, 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map)
+{
+ const H5FD_multi_t *file = (const H5FD_multi_t*)_file;
+
+ /* Copy file's free space type mapping */
+ memcpy(type_map, file->fa.memb_map, sizeof(file->fa.memb_map));
+
+ return(0);
+} /* end H5FD_multi_get_type_map() */
/*-------------------------------------------------------------------------
@@ -1463,7 +1480,7 @@ 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_eoa"; /* Function Name for error reporting */
+ static const char *func="H5FD_multi_get_eoa"; /* Function Name for error reporting */
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
@@ -1523,7 +1540,7 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type)
}
return eoa;
-}
+} /* end H5FD_multi_get_eoa() */
/*-------------------------------------------------------------------------
@@ -1575,7 +1592,7 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa)
H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1)
return 0;
-}
+} /* end H5FD_multi_set_eoa() */
/*-------------------------------------------------------------------------
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index f960a1c..fa30202 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -218,6 +218,7 @@ typedef struct H5FD_class_t {
herr_t (*close)(H5FD_t *file);
int (*cmp)(const H5FD_t *f1, const H5FD_t *f2);
herr_t (*query)(const H5FD_t *f1, unsigned long *flags);
+ herr_t (*get_type_map)(const H5FD_t *file, H5FD_mem_t *type_map);
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);
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index cd3419b..3b09005 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -170,6 +170,7 @@ static const H5FD_class_t H5FD_sec2_g = {
H5FD_sec2_close, /*close */
H5FD_sec2_cmp, /*cmp */
H5FD_sec2_query, /*query */
+ NULL, /*get_type_map */
NULL, /*alloc */
NULL, /*free */
H5FD_sec2_get_eoa, /*get_eoa */
@@ -568,11 +569,11 @@ H5FD_sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type)
FUNC_ENTER_NOAPI(H5FD_sec2_get_eoa, HADDR_UNDEF)
/* Set return value */
- ret_value=file->eoa;
+ ret_value = file->eoa;
done:
FUNC_LEAVE_NOAPI(ret_value)
-}
+} /* end H5FD_sec2_get_eoa() */
/*-------------------------------------------------------------------------
@@ -688,73 +689,70 @@ done:
*
* Return: Success: Zero. Result is stored in caller-supplied
* buffer BUF.
- *
* Failure: -1, Contents of buffer BUF are undefined.
*
* Programmer: Robb Matzke
* Thursday, July 29, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
static herr_t
-H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr,
- size_t size, void *buf/*out*/)
+H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id,
+ haddr_t addr, size_t size, void *buf/*out*/)
{
H5FD_sec2_t *file = (H5FD_sec2_t*)_file;
ssize_t nbytes;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_sec2_read, FAIL)
- assert(file && file->pub.cls);
- assert(buf);
+ HDassert(file && file->pub.cls);
+ HDassert(buf);
/* Check for overflow conditions */
- if (HADDR_UNDEF==addr)
+ if(!H5F_addr_defined(addr))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined")
- if (REGION_OVERFLOW(addr, size))
+ if(REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
- if (addr+size>file->eoa)
+ if((addr + size) > file->eoa)
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
/* Seek to the correct location */
- if ((addr!=file->pos || OP_READ!=file->op) &&
- HDlseek(file->fd, (file_offset_t)addr, SEEK_SET)<0)
+ if((addr != file->pos || OP_READ != file->op) &&
+ HDlseek(file->fd, (file_offset_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
/*
* Read data, being careful of interrupted system calls, partial results,
* and the end of the file.
*/
- while (size>0) {
+ while(size > 0) {
do {
nbytes = HDread(file->fd, buf, size);
- } while (-1==nbytes && EINTR==errno);
- if (-1==nbytes) /* error */
+ } while(-1 == nbytes && EINTR == errno);
+ if(-1 == nbytes) /* error */
HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
- if (0==nbytes) {
+ if(0 == nbytes) {
/* end of file but not end of format address space */
HDmemset(buf, 0, size);
break;
- }
- assert(nbytes>=0);
- assert((size_t)nbytes<=size);
- H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t);
+ } /* end if */
+ HDassert(nbytes >= 0);
+ HDassert((size_t)nbytes <= size);
+ H5_CHECK_OVERFLOW(nbytes, ssize_t, size_t);
size -= (size_t)nbytes;
- H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t);
+ H5_CHECK_OVERFLOW(nbytes, ssize_t, haddr_t);
addr += (haddr_t)nbytes;
- buf = (char*)buf + nbytes;
- }
+ buf = (char *)buf + nbytes;
+ } /* end while */
/* Update current position */
file->pos = addr;
file->op = OP_READ;
done:
- if(ret_value<0) {
+ if(ret_value < 0) {
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
@@ -772,14 +770,11 @@ done:
* DXPL_ID.
*
* Return: Success: Zero
- *
* Failure: -1
*
* Programmer: Robb Matzke
* Thursday, July 29, 1999
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
/* ARGSUSED */
@@ -789,53 +784,53 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
{
H5FD_sec2_t *file = (H5FD_sec2_t*)_file;
ssize_t nbytes;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5FD_sec2_write, FAIL)
- assert(file && file->pub.cls);
- assert(buf);
+ HDassert(file && file->pub.cls);
+ HDassert(buf);
/* Check for overflow conditions */
- if (HADDR_UNDEF==addr)
+ if(!H5F_addr_defined(addr))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined")
- if (REGION_OVERFLOW(addr, size))
+ if(REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
- if (addr+size>file->eoa)
+ if((addr + size) > file->eoa)
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
/* Seek to the correct location */
- if ((addr!=file->pos || OP_WRITE!=file->op) &&
- HDlseek(file->fd, (file_offset_t)addr, SEEK_SET)<0)
+ if((addr != file->pos || OP_WRITE != file->op) &&
+ HDlseek(file->fd, (file_offset_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
/*
* Write the data, being careful of interrupted system calls and partial
* results
*/
- while (size>0) {
+ while(size > 0) {
do {
nbytes = HDwrite(file->fd, buf, size);
- } while (-1==nbytes && EINTR==errno);
- if (-1==nbytes) /* error */
+ } while(-1 == nbytes && EINTR == errno);
+ if(-1 == nbytes) /* error */
HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
- assert(nbytes>0);
- assert((size_t)nbytes<=size);
- H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t);
+ HDassert(nbytes > 0);
+ HDassert((size_t)nbytes <= size);
+ H5_CHECK_OVERFLOW(nbytes, ssize_t, size_t);
size -= (size_t)nbytes;
- H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t);
+ H5_CHECK_OVERFLOW(nbytes, ssize_t, haddr_t);
addr += (haddr_t)nbytes;
- buf = (const char*)buf + nbytes;
- }
+ buf = (const char *)buf + nbytes;
+ } /* end while */
/* Update current position and eof */
file->pos = addr;
file->op = OP_WRITE;
- if (file->pos>file->eof)
+ if(file->pos > file->eof)
file->eof = file->pos;
done:
- if(ret_value<0) {
+ if(ret_value < 0) {
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 59056c9..59e5b1e 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -186,6 +186,7 @@ static const H5FD_class_t H5FD_stdio_g = {
H5FD_stdio_close, /*close */
H5FD_stdio_cmp, /*cmp */
H5FD_stdio_query, /*query */
+ NULL, /*get_type_map */
H5FD_stdio_alloc, /*alloc */
NULL, /*free */
H5FD_stdio_get_eoa, /*get_eoa */
diff --git a/src/H5FDwindows.c b/src/H5FDwindows.c
index 912c721..ef26fec 100644
--- a/src/H5FDwindows.c
+++ b/src/H5FDwindows.c
@@ -159,6 +159,7 @@ static const H5FD_class_t H5FD_windows_g = {
H5FD_windows_close, /*close */
H5FD_windows_cmp, /*cmp */
H5FD_windows_query, /*query */
+ NULL, /*get_type_map */
NULL, /*alloc */
NULL, /*free */
H5FD_windows_get_eoa, /*get_eoa */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 6196557..bd2fe20 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -356,7 +356,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc)
/* File status flags (not really used yet) */
UINT32DECODE(p, status_flags);
HDassert(status_flags <= 255);
- shared->status_flags = status_flags;
+ shared->status_flags = (uint8_t)status_flags;
if(shared->status_flags & ~H5F_SUPER_ALL_FLAGS)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad flag value for superblock")
@@ -567,12 +567,25 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc)
H5O_loc_t ext_loc; /* "Object location" for superblock extension */
H5O_btreek_t btreek; /* v1 B-tree 'K' value message from superblock extension */
H5O_drvinfo_t drvinfo; /* Driver info message from superblock extension */
+ htri_t status; /* Status for message existing */
/* Sanity check - superblock extension should only be defined for
* superblock version >= 2.
*/
HDassert(super_vers >= HDF5_SUPERBLOCK_VERSION_2);
+ /* Check for superblock extension being located "outside" the stored
+ * 'eoa' value, which can occur with the split/multi VFD.
+ */
+ if(H5F_addr_gt(shared->extension_addr, stored_eoa)) {
+ /* Set the 'eoa' for the object header memory type large enough
+ * to give some room for a reasonably sized superblock extension.
+ * (This is _rather_ a kludge -QAK)
+ */
+ if(H5FD_set_eoa(lf, H5FD_MEM_OHDR, (haddr_t)(shared->extension_addr + 1024)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to set end-of-address marker for file")
+ } /* end if */
+
/* Set up "fake" object location for superblock extension */
H5O_loc_reset(&ext_loc);
ext_loc.file = f;
@@ -580,23 +593,44 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc)
/* Open the superblock extension */
if(H5O_open(&ext_loc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to open superblock extension")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open superblock extension")
+
+ /* Check for the extension having a 'driver info' message */
+ if((status = H5O_msg_exists(&ext_loc, H5O_DRVINFO_ID, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to read object header")
+ if(status) {
+ /* Retrieve the 'driver info' structure */
+ if(NULL == H5O_msg_read(&ext_loc, H5O_DRVINFO_ID, &drvinfo, dxpl_id))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "driver info message not present")
+
+ /* Check if driver matches driver information saved. Unfortunately, we can't push this
+ * function to each specific driver because we're checking if the driver is correct.
+ */
+ if(!HDstrncmp(drvinfo.name, "NCSAfami", (size_t)8) && HDstrcmp(lf->cls->name, "family"))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "family driver should be used")
+ if(!HDstrncmp(drvinfo.name, "NCSAmult", (size_t)8) && HDstrcmp(lf->cls->name, "multi"))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "multi driver should be used")
+
+ /* Decode driver information */
+ if(H5FD_sb_decode(lf, drvinfo.name, drvinfo.buf) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to decode driver information")
+
+ /* Reset driver info message */
+ H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo);
+ } /* end if */
/* Read in the shared OH message information if there is any */
if(H5SM_get_info(&ext_loc, c_plist, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read SOHM table information")
- /* Read in v1 B-tree 'K' value message, if it exists */
- if(NULL == H5O_msg_read(&ext_loc, H5O_BTREEK_ID, &btreek, dxpl_id)) {
- /* Reset error from "failed" message read */
- H5E_clear_stack(NULL);
+ /* Check for the extension having a 'v1 B-tree "K"' message */
+ if((status = H5O_msg_exists(&ext_loc, H5O_BTREEK_ID, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to read object header")
+ if(status) {
+ /* Retrieve the 'v1 B-tree "K"' structure */
+ if(NULL == H5O_msg_read(&ext_loc, H5O_BTREEK_ID, &btreek, dxpl_id))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "v1 B-tree 'K' info message not present")
- /* No non-default v1 B-tree 'K' value info in file, use defaults */
- shared->btree_k[H5B_ISTORE_ID] = HDF5_BTREE_ISTORE_IK_DEF;
- shared->btree_k[H5B_SNODE_ID] = HDF5_BTREE_SNODE_IK_DEF;
- shared->sym_leaf_k = H5F_CRT_SYM_LEAF_DEF;
- } /* end if */
- else {
/* Set non-default v1 B-tree 'K' value info from file */
shared->btree_k[H5B_ISTORE_ID] = btreek.btree_k[H5B_ISTORE_ID];
shared->btree_k[H5B_SNODE_ID] = btreek.btree_k[H5B_SNODE_ID];
@@ -607,29 +641,13 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set rank for btree internal nodes")
if(H5P_set(c_plist, H5F_CRT_SYM_LEAF_NAME, &btreek.sym_leaf_k) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set rank for symbol table leaf nodes")
- } /* end else */
-
- /* Read in driver info message, if it exists */
- if(NULL == H5O_msg_read(&ext_loc, H5O_DRVINFO_ID, &drvinfo, dxpl_id)) {
- /* Reset error from "failed" message read */
- H5E_clear_stack(NULL);
} /* end if */
else {
- /* Check if driver matches driver information saved. Unfortunately, we can't push this
- * function to each specific driver because we're checking if the driver is correct.
- */
- if(!HDstrncmp(drvinfo.name, "NCSAfami", (size_t)8) && HDstrcmp(lf->cls->name, "family"))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "family driver should be used")
- if(!HDstrncmp(drvinfo.name, "NCSAmult", (size_t)8) && HDstrcmp(lf->cls->name, "multi"))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "multi driver should be used")
-
- /* Decode driver information */
- if(H5FD_sb_decode(lf, drvinfo.name, drvinfo.buf) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to decode driver information")
-
- /* Reset driver info message */
- H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo);
- } /* end else */
+ /* No non-default v1 B-tree 'K' value info in file, use defaults */
+ shared->btree_k[H5B_ISTORE_ID] = HDF5_BTREE_ISTORE_IK_DEF;
+ shared->btree_k[H5B_SNODE_ID] = HDF5_BTREE_SNODE_IK_DEF;
+ shared->sym_leaf_k = H5F_CRT_SYM_LEAF_DEF;
+ } /* end if */
/* Close the extension. Twiddle the number of open objects to avoid
* closing the file (since this will be the only open object).
@@ -818,7 +836,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
/* Write driver info information to the superblock extension */
drvinfo.len = driver_size;
drvinfo.buf = dbuf;
- if(H5O_msg_create(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &drvinfo, dxpl_id) < 0)
+ if(H5O_msg_create(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &drvinfo, dxpl_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update driver info header message")
} /* end if */
@@ -984,6 +1002,47 @@ H5F_super_write(H5F_t *f, hid_t dxpl_id)
if(H5FD_write(f->shared->lf, dxpl_id, H5FD_MEM_SUPER, (haddr_t)0, superblock_size, buf) < 0)
HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write superblock")
+ /* Check for newer version of superblock format & superblock extension */
+ if(super_vers >= HDF5_SUPERBLOCK_VERSION_2 && H5F_addr_defined(f->shared->extension_addr)) {
+ /* Check for driver info message */
+ H5_ASSIGN_OVERFLOW(driver_size, H5FD_sb_size(f->shared->lf), hsize_t, size_t);
+ if(driver_size > 0) {
+ H5O_loc_t ext_loc; /* "Object location" for superblock extension */
+ H5O_drvinfo_t drvinfo; /* Driver info */
+ uint8_t dbuf[H5F_MAX_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */
+
+ /* Sanity check */
+ HDassert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE);
+
+ /* Encode driver-specific data */
+ if(H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information")
+
+ /* Set up "fake" object location for superblock extension */
+ H5O_loc_reset(&ext_loc);
+ ext_loc.file = f;
+ ext_loc.addr = f->shared->extension_addr;
+
+ /* Open the superblock extension */
+ if(H5O_open(&ext_loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to open superblock extension")
+
+ /* Write driver info information to the superblock extension */
+ drvinfo.len = driver_size;
+ drvinfo.buf = dbuf;
+ if(H5O_msg_write(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &drvinfo, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to update driver info header message")
+
+ /* Close the extension. Twiddle the number of open objects to avoid
+ * closing the file (since this will be the only open object).
+ */
+ f->nopen_objs++;
+ if(H5O_close(&ext_loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to close superblock extension")
+ f->nopen_objs--;
+ } /* end if */
+ } /* end if */
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_super_write() */
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index dda1968..f383e23 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -196,9 +196,6 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
aggr->size += (ext_size - frag_size);
aggr->tot_size += ext_size;
} else {
- haddr_t unused_addr = HADDR_UNDEF; /* Address of unused portion */
- hsize_t unused_size = 0; /* Size of unused portion */
-
if ((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) &&
((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) {
diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c
index ca83b5a..ca87c83 100644
--- a/src/H5MFdbg.c
+++ b/src/H5MFdbg.c
@@ -41,6 +41,7 @@
#include "H5Fpkg.h" /* File access */
#include "H5MFpkg.h" /* File memory management */
+#ifdef H5MF_ALLOC_DEBUG_DUMP
/****************/
/* Local Macros */
@@ -161,10 +162,14 @@ H5MF_sects_dump(H5F_t *f, hid_t dxpl_id, FILE *stream)
haddr_t sda_addr = HADDR_UNDEF; /* Base "small data aggregator" address */
hsize_t sda_size = 0; /* Size of "small data aggregator" */
H5FD_mem_t type; /* Memory type for iteration */
+ int indent = 0; /* Amount to indent */
+ int fwidth = 50; /* Field width */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5MF_sects_dump, FAIL)
+#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC);
+#endif /* H5MF_ALLOC_DEBUG */
/*
* Check arguments.
@@ -175,43 +180,67 @@ HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC);
/* Retrieve the 'eoa' for the file */
if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
-HDfprintf(stderr, "%s: eoa = %a\n", FUNC, eoa);
+#ifdef H5MF_ALLOC_DEBUG
+HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa);
+#endif /* H5MF_ALLOC_DEBUG */
/* Retrieve metadata aggregator info, if available */
H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size);
+#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: ma_addr = %a, ma_size = %Hu, end of ma = %a\n", FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1));
+#endif /* H5MF_ALLOC_DEBUG */
/* Retrieve 'small data' aggregator info, if available */
H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size);
+#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1));
+#endif /* H5MF_ALLOC_DEBUG */
/* Iterate over all the free space types that have managers and dump each free list's space */
for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
-#ifdef QAK
- /* Check if the free space for the file has been initialized */
- if(!f->shared->fs_man[type])
- if(H5MF_alloc_start(f, dxpl_id, type, FALSE) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space")
-#endif /* QAK */
-
- /* If there is a free space manager for this type, iterate over them */
- if(f->shared->fs_man[type]) {
- H5MF_debug_iter_ud_t udata; /* User data for callbacks */
-
- /* Prepare user data for section iteration callback */
- udata.fspace = f->shared->fs_man[type];
- udata.stream = stream;
- udata.indent = 0;
- udata.fwidth = 3;
-
- /* Iterate over all the free space sections */
- if(H5FS_sect_iterate(f, dxpl_id, f->shared->fs_man[type], H5MF_sects_debug_cb, &udata) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space")
+ /* Print header for type */
+ HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)type);
+
+ /* Check for this type being mapped to another type */
+ if(H5FD_MEM_DEFAULT == f->shared->fs_type_map[type] ||
+ type == f->shared->fs_type_map[type]) {
+ /* Retrieve the 'eoa' for this file memory type */
+ if(HADDR_UNDEF == (eoa = H5FD_get_eoa(f->shared->lf, type)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed")
+ HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3),
+ "eoa:",
+ eoa);
+
+ /* Print header for sections */
+ HDfprintf(stream, "%*sSections:\n", indent + 3, "");
+
+ /* If there is a free space manager for this type, iterate over them */
+ if(f->shared->fs_man[type]) {
+ H5MF_debug_iter_ud_t udata; /* User data for callbacks */
+
+ /* Prepare user data for section iteration callback */
+ udata.fspace = f->shared->fs_man[type];
+ udata.stream = stream;
+ udata.indent = indent + 6;
+ udata.fwidth = MAX(0, fwidth - 6);
+
+ /* Iterate over all the free space sections */
+ if(H5FS_sect_iterate(f, dxpl_id, f->shared->fs_man[type], H5MF_sects_debug_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space")
+ } /* end if */
+ else {
+ /* No sections of this type */
+ HDfprintf(stream, "%*s<none>\n", indent + 6, "");
+ } /* end else */
} /* end if */
+ else {
+ HDfprintf(stream, "%*sMapped to type = %u\n", indent, "", (unsigned)f->shared->fs_type_map[type]);
+ } /* end else */
} /* end for */
done:
HDfprintf(stderr, "%s: Done dumping file free space sections\n", FUNC);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5MF_sects_dump() */
+#endif /* H5MF_ALLOC_DEBUG_DUMP */
diff --git a/src/H5SM.c b/src/H5SM.c
index f782e68..d942399 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -1759,6 +1759,7 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
H5F_file_t *shared = f->shared; /* Shared file info (convenience variable) */
H5O_shmesg_table_t sohm_table; /* SOHM message from superblock extension */
H5SM_master_table_t *table = NULL; /* SOHM master table */
+ htri_t status; /* Status for message existing */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5SM_get_info, FAIL)
@@ -1768,27 +1769,20 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
HDassert(f && shared);
HDassert(fc_plist);
- /* Read in shared message information, if it exists */
- if(NULL == H5O_msg_read(ext_loc, H5O_SHMESG_ID, &sohm_table, dxpl_id)) {
- /* Reset error from "failed" message read */
- H5E_clear_stack(NULL);
-
- /* No SOHM info in file */
- shared->sohm_addr = HADDR_UNDEF;
- shared->sohm_nindexes = 0;
- shared->sohm_vers = 0;
-
- /* Shared object header messages are disabled */
- if(H5P_set(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &shared->sohm_nindexes) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set number of SOHM indexes")
- } /* end if */
- else {
+ /* Check for the extension having a 'shared message info' message */
+ if((status = H5O_msg_exists(ext_loc, H5O_SHMESG_ID, dxpl_id)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to read object header")
+ if(status) {
unsigned index_flags[H5O_SHMESG_MAX_NINDEXES]; /* Message flags for each index */
unsigned minsizes[H5O_SHMESG_MAX_NINDEXES]; /* Minimum message size for each index */
unsigned sohm_l2b; /* SOHM list-to-btree cutoff */
unsigned sohm_b2l; /* SOHM btree-to-list cutoff */
unsigned u; /* Local index variable */
+ /* Retrieve the 'shared message info' structure */
+ if(NULL == H5O_msg_read(ext_loc, H5O_SHMESG_ID, &sohm_table, dxpl_id))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "shared message info message not present")
+
/* Portably initialize the arrays */
HDmemset(index_flags, 0, sizeof(index_flags));
HDmemset(minsizes, 0, sizeof(minsizes));
@@ -1836,6 +1830,16 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist, hid_t dxpl_id)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list")
if(H5P_set(fc_plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, &sohm_b2l) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list")
+ } /* end if */
+ else {
+ /* No SOHM info in file */
+ shared->sohm_addr = HADDR_UNDEF;
+ shared->sohm_nindexes = 0;
+ shared->sohm_vers = 0;
+
+ /* Shared object header messages are disabled */
+ if(H5P_set(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &shared->sohm_nindexes) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set number of SOHM indexes")
} /* end else */
done: