summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2007-02-07 17:04:21 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2007-02-07 17:04:21 (GMT)
commit5dd40af99f77add84e87b6a725de60ac7fce14c0 (patch)
tree1ad5dc007198885253732c93338811278f02fd79 /src
parented7d456e512d9f2319d8ebe67feb44d842be8c07 (diff)
downloadhdf5-5dd40af99f77add84e87b6a725de60ac7fce14c0.zip
hdf5-5dd40af99f77add84e87b6a725de60ac7fce14c0.tar.gz
hdf5-5dd40af99f77add84e87b6a725de60ac7fce14c0.tar.bz2
[svn-r13254] Cleaned up superblock extension code and added some more helpful comments.
Tested on Windows, smirom, and kagiso.
Diffstat (limited to 'src')
-rw-r--r--src/H5F.c24
-rw-r--r--src/H5Fsuper.c32
-rw-r--r--src/H5Oshmesg.c6
3 files changed, 23 insertions, 39 deletions
diff --git a/src/H5F.c b/src/H5F.c
index ed253d1..236c07d 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1403,20 +1403,24 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
if(H5G_mkroot(file, dxpl_id, NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group")
- /* JAMES: probably out of order or something. Also not the right test. */
- /* Create the superblock extension OH */
+ /* Create the superblock extension and write "extra" superblock data.
+ * Currently, the extension is only needed if Shared Object Header
+ * Messages are enabled.
+ */
if(file->shared->sohm_nindexes > 0) {
H5O_loc_t ext_loc; /* Superblock extension location */
H5O_shmesg_table_t sohm_table;
- /* JAMES: should this go here, or in SMinit? Or in init_superblock? */
- /* This isn't actually a group, but the default group creation
- * list should work fine.
+ /* The superblock extension isn't actually a group, but the
+ * default group creation list should work fine.
+ * If we don't supply a size for the object header, HDF5 will
+ * allocate H5O_MIN_SIZE by default. This is currently
+ * big enough to hold the biggest possible extension, but should
+ * be tuned if more information is added to the superblock
+ * extension.
*/
H5O_loc_reset(&ext_loc);
- /* JAMES: bump the number of open objects to avoid closing the file here */
- file->nopen_objs++;
- if(H5O_create(file, dxpl_id, 0 /* JAMES */, H5P_GROUP_CREATE_DEFAULT, &ext_loc) < 0)
+ if(H5O_create(file, dxpl_id, 0, H5P_GROUP_CREATE_DEFAULT, &ext_loc) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, NULL, "unable to create superblock extension")
/* Record this address */
@@ -1430,6 +1434,10 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d
if(H5O_msg_create(&ext_loc, H5O_SHMESG_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &sohm_table, dxpl_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to update type header message")
+ /* Close the extension. Bump the version number to avoid closing the
+ * file (since this will be the only open object).
+ */
+ file->nopen_objs++;
if(H5O_close(&ext_loc) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to close superblock extension")
file->nopen_objs--;
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 034eaac..dc31a97 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -245,15 +245,6 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr,
H5F_addr_decode(f, (const uint8_t **)&p, &shared->base_addr/*out*/);
H5F_addr_decode(f, (const uint8_t **)&p, &(shared->extension_addr)/*out*/);
- /* If the superblock version is greater than 1, read in the shared OH message table information */
-#ifdef JAMES
- if(super_vers >= HDF5_SUPERBLOCK_VERSION_2) {
- H5F_addr_decode(f, (const uint8_t **)&p, &shared->sohm_addr/*out*/);
- shared->sohm_vers = *p++;
- shared->sohm_nindexes = *p++;
- }
-#endif /* JAMES */
-
H5F_addr_decode(f, (const uint8_t **)&p, &stored_eoa/*out*/);
H5F_addr_decode(f, (const uint8_t **)&p, &shared->driver_addr/*out*/);
if(H5G_obj_ent_decode(f, (const uint8_t **)&p, root_loc->oloc/*out*/) < 0)
@@ -396,17 +387,16 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr,
/* Read the file's superblock extension, if there is one. */
if(shared->extension_addr != HADDR_UNDEF && super_vers >= HDF5_SUPERBLOCK_VERSION_2) {
H5O_loc_t ext_loc;
-/* JAMES H5O_shmesg_table_t sohm_table; */
H5O_loc_reset(&ext_loc);
ext_loc.file = f;
ext_loc.addr = shared->extension_addr;
- /* JAMES: bump the number of open objects to avoid closing the file here */
- f->nopen_objs++;
+ /* Open the superblock extension */
if(H5O_open(&ext_loc) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to open superblock extension")
+ /* Read in shared message information, if it exists */
if(NULL == H5O_msg_read(&ext_loc, H5O_SHMESG_ID, &shared->sohm_table, dxpl_id)) {
H5E_clear_stack(NULL);
shared->sohm_addr = HADDR_UNDEF;
@@ -417,11 +407,11 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr,
shared->sohm_vers = shared->sohm_table.version;
shared->sohm_nindexes = shared->sohm_table.nindexes;
}
- /* JAMES
- HDassert(sohm_table.addr == shared->sohm_addr);
- HDassert(sohm_table.version == shared->sohm_vers);
- HDassert(sohm_table.nindexes == shared->sohm_nindexes);
-*/
+
+ /* Close the extension. Bump the version number 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--;
@@ -662,14 +652,6 @@ H5F_write_superblock(H5F_t *f, hid_t dxpl_id)
H5F_addr_encode(f, &p, f->shared->base_addr);
H5F_addr_encode(f, &p, f->shared->extension_addr);
-#ifdef JAMES
- if(super_vers >= HDF5_SUPERBLOCK_VERSION_2) {
- H5F_addr_encode(f, &p, f->shared->sohm_addr);
- *p++ = f->shared->sohm_vers;
- *p++ = f->shared->sohm_nindexes;
- }
-#endif /* JAMES */
-
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)
diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c
index c006f1c..f2c80f9 100644
--- a/src/H5Oshmesg.c
+++ b/src/H5Oshmesg.c
@@ -26,12 +26,6 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Opkg.h" /* Object headers */
#include "H5MMprivate.h" /* Memory management */
-#ifdef JAMES
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Pprivate.h" /* Property lists */
-#endif /* JAMES */
-
static void *H5O_shmesg_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags, const uint8_t *p);
static herr_t H5O_shmesg_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);