summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5F.c38
-rw-r--r--src/H5Fdbg.c2
-rw-r--r--src/H5Fpkg.h8
-rw-r--r--src/H5Fsuper.c47
-rw-r--r--src/H5G.c9
-rw-r--r--src/H5O.c1
-rw-r--r--src/H5Omessage.c1
-rw-r--r--src/H5Opkg.h8
-rw-r--r--src/H5Oprivate.h15
-rwxr-xr-xsrc/H5Pocpl.c2
-rwxr-xr-xsrc/Makefile.am2
-rw-r--r--src/Makefile.in13
12 files changed, 127 insertions, 19 deletions
diff --git a/src/H5F.c b/src/H5F.c
index df58a5e..60956c7 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -915,7 +915,7 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf)
HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared file structure")
f->shared->super_addr = HADDR_UNDEF;
f->shared->base_addr = HADDR_UNDEF;
- f->shared->freespace_addr = HADDR_UNDEF;
+ f->shared->extension_addr = HADDR_UNDEF;
f->shared->sohm_addr = HADDR_UNDEF;
f->shared->sohm_vers = HDF5_SHAREDHEADER_VERSION;
f->shared->sohm_nindexes = 0;
@@ -1064,6 +1064,9 @@ done:
* Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002
* Added `id to name' support.
*
+ * James Laird, 2007-1-29
+ * H5F_dest now frees superblock extension oloc.
+ *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -1399,6 +1402,39 @@ 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 */
+ 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.
+ */
+ 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)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, NULL, "unable to create superblock extension")
+
+ /* Record this address */
+ file->shared->extension_addr = ext_loc.addr;
+
+ /* Write shared message information to the extension */
+ sohm_table.addr = file->shared->sohm_addr;
+ sohm_table.version = file->shared->sohm_vers;
+ sohm_table.nindexes = file->shared->sohm_nindexes;
+
+ 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")
+
+ if(H5O_close(&ext_loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to close superblock extension")
+ file->nopen_objs--;
+ }
+
+
/* Write the superblock to the file */
/* (This must be after the root group is created, since the root
* group's symbol table entry is part of the superblock)
diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c
index 3ac3abc..80598d1 100644
--- a/src/H5Fdbg.c
+++ b/src/H5Fdbg.c
@@ -125,7 +125,7 @@ H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth)
HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth,
"Base address:", f->shared->base_addr);
HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
- "Free list address:", f->shared->freespace_addr);
+ "Superblock extension address (formerly free space address):", f->shared->extension_addr);
HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
"Shared object header message table address:", f->shared->sohm_addr);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 1d6cc3f..d1457df 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -38,6 +38,7 @@
#include "H5FLprivate.h" /* Free Lists */
#include "H5FOprivate.h" /* File objects */
#include "H5Gprivate.h" /* Groups */
+#include "H5Oprivate.h" /* Object header messages */
#include "H5RCprivate.h" /* Reference counted object functions */
/*
@@ -91,8 +92,8 @@
( 2 /* indexed B-tree internal k */ \
+ H5F_SIZEOF_ADDR(f) /* base address */ \
+ H5F_SIZEOF_ADDR(f) /* free space address */ \
- + H5F_SIZEOF_ADDR(f) /* shared message table address */ \
- + 2 /* shared message version and number of indexes */ \
+/* + H5F_SIZEOF_ADDR(f) /* shared message table address */ \
+/* JAMES + 2 /* shared message version and number of indexes */ \
+ H5F_SIZEOF_ADDR(f) /* EOF address */ \
+ H5F_SIZEOF_ADDR(f) /* driver block address */ \
+ H5G_SIZEOF_ENTRY(f) /* root group ptr */ \
@@ -140,7 +141,8 @@ typedef struct H5F_file_t {
size_t sizeof_size; /* Size of offsets in file */
haddr_t super_addr; /* Absolute address of super block */
haddr_t base_addr; /* Absolute base address for rel.addrs. */
- haddr_t freespace_addr; /* Relative address of free-space info */
+ haddr_t extension_addr; /* Relative address of superblock extension */
+ H5O_shmesg_table_t sohm_table; /* Shared message table information */
haddr_t sohm_addr; /* Relative address of shared object header message table */
unsigned sohm_vers; /* Version of shared message table on disk */
unsigned sohm_nindexes; /* Number of shared messages indexes in the table */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index c8ff253..e6bd53c 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -242,13 +242,17 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr,
HDmemcpy(shared->btree_k, btree_k, sizeof(unsigned) * (size_t)H5B_NUM_BTREE_ID); /* Keep a local copy also */
H5F_addr_decode(f, (const uint8_t **)&p, &shared->base_addr/*out*/);
- H5F_addr_decode(f, (const uint8_t **)&p, &shared->freespace_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 */
- if(super_vers > HDF5_SUPERBLOCK_VERSION_1) {
+#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)
@@ -388,6 +392,39 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc, haddr_t addr,
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")
+ /* 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++;
+ if(H5O_open(&ext_loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to open superblock extension")
+
+ if(NULL == H5O_msg_read(&ext_loc, H5O_SHMESG_ID, &shared->sohm_table, dxpl_id)) {
+ H5E_clear_stack(NULL);
+ shared->sohm_addr = HADDR_UNDEF;
+ shared->sohm_nindexes = 0;
+ shared->sohm_vers = 0;
+ } else {
+ shared->sohm_addr = shared->sohm_table.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);
+*/
+ if(H5O_close(&ext_loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENFILE, FAIL, "unable to close superblock extension")
+ f->nopen_objs--;
+ }
/* Decode shared object header message information and store it in the
* fcpl */
@@ -622,12 +659,16 @@ 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->freespace_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/H5G.c b/src/H5G.c
index 588e923..c040fb6 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -1055,8 +1055,13 @@ H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *loc)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "can't copy group object location")
f->shared->root_grp->shared->fo_count = 1;
- HDassert(1 == f->nopen_objs);
- f->nopen_objs = 0;
+ /* The only other open object should be the superblock extension, if it
+ * exists. Don't count either the superblock extension or the root group
+ * in the number of open objects in the file.
+ */
+ HDassert((1 == f->nopen_objs) ||
+ (2 == f->nopen_objs && HADDR_UNDEF != f->shared->extension_addr));
+ f->nopen_objs--;
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5O.c b/src/H5O.c
index ccebb8c..403639a 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -101,6 +101,7 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
H5O_MSG_CONT, /*0x0010 Object header continuation */
H5O_MSG_STAB, /*0x0011 Symbol table */
H5O_MSG_MTIME_NEW, /*0x0012 New Object modification date and time */
+ H5O_MSG_SHMESG, /*0x0013 File-wide shared message table */
};
/* Header object ID to class mapping */
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index 2831d6b..0a1773b 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -1763,6 +1763,7 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
HDassert(type);
HDassert(mesg);
HDassert(oh_flags_ptr);
+ HDassert(type->copy);
/* Reset existing native information for the header's message */
H5O_msg_reset_real(type, idx_msg->native);
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 86ad44b..b0c5c01 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -30,7 +30,7 @@
#define H5O_NMESGS 8 /*initial number of messages */
#define H5O_NCHUNKS 2 /*initial number of chunks */
#define H5O_MIN_SIZE 32 /*min obj header data size */
-#define H5O_MSG_TYPES 19 /* # of types of messages */
+#define H5O_MSG_TYPES 20 /* # of types of messages */
#define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */
/* Versions of object header structure */
@@ -401,6 +401,12 @@ H5_DLLVAR const H5O_msg_class_t H5O_MSG_STAB[1];
*/
H5_DLLVAR const H5O_msg_class_t H5O_MSG_MTIME_NEW[1];
+/* Shared Message information message (0x000a)
+ * A message for the superblock extension, holding information about
+ * the file-wide shared message "SOHM" table
+ */
+H5_DLLVAR const H5O_msg_class_t H5O_MSG_SHMESG[1];
+
/*
* Object header "object" types
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 4a9dc95..a3df7fb 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -69,6 +69,8 @@ typedef struct H5O_t H5O_t;
#define H5O_MSG_FLAG_CONSTANT 0x01u
#define H5O_MSG_FLAG_SHARED 0x02u
#define H5O_MSG_FLAG_DONTSHARE 0x04u
+#define H5O_MSG_FLAG_FAIL_IF_UNKNOWN 0x08u
+#define H5O_MSG_FLAG_CURRENT 0x10u
#define H5O_MSG_FLAG_BITS (H5O_MSG_FLAG_CONSTANT|H5O_MSG_FLAG_SHARED|H5O_MSG_FLAG_DONTSHARE)
/* Flags for updating messages */
@@ -132,6 +134,7 @@ typedef struct H5O_copy_t {
#define H5O_CONT_ID 0x0010 /* Object header continuation message. */
#define H5O_STAB_ID 0x0011 /* Symbol table message. */
#define H5O_MTIME_NEW_ID 0x0012 /* Modification time message. (New) */
+#define H5O_SHMESG_ID 0x0013 /* Shared message "SOHM" table. */
/* Shared object message flags.
@@ -369,6 +372,18 @@ typedef struct H5O_stab_t {
haddr_t heap_addr; /*address of name heap */
} H5O_stab_t;
+/*
+ * Shared message table message
+ * Information about file-wide shared message table, stored in superblock
+ * extension
+ * (Data structure in memory)
+ */
+typedef struct H5O_shmesg_table_t {
+ haddr_t addr; /*file address of SOHM table */
+ unsigned version; /*SOHM table version number */
+ unsigned nindexes; /*number of indexes in the table */
+} H5O_shmesg_table_t;
+
/* Typedef for iteration operations */
typedef herr_t (*H5O_operator_t)(const void *mesg/*in*/, unsigned idx,
void *operator_data/*in,out*/);
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index 482598d..2fa5f47 100755
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -306,7 +306,7 @@ H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags)
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(H5Pget_attr_creation_order, FAIL)
- H5TRACE2("e", "ix", plist_id, crt_order_flags);
+ H5TRACE2("e", "i*Iu", plist_id, crt_order_flags);
/* Get values */
if(crt_order_flags) {
diff --git a/src/Makefile.am b/src/Makefile.am
index 4976735..7a7d044 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -65,7 +65,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Olayout.c \
H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \
H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \
- H5Otest.c \
+ H5Oshmesg.c H5Otest.c \
H5P.c H5Pacpl.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
H5Pgcpl.c \
H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index fd49c21..c66e967 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -104,11 +104,11 @@ am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5Ocopy.lo H5Odbg.lo H5Odtype.lo H5Oefl.lo H5Ofill.lo \
H5Oginfo.lo H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo \
H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo H5Osdspace.lo \
- H5Oshared.lo H5Ostab.lo H5Otest.lo H5P.lo H5Pacpl.lo \
- H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo \
- H5Pgcpl.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo H5Pocpypl.lo \
- H5Pstrcpl.lo H5Ptest.lo H5R.lo H5RC.lo H5RS.lo H5S.lo \
- H5Sall.lo H5Shyper.lo H5Smpio.lo H5Snone.lo H5Spoint.lo \
+ H5Oshared.lo H5Ostab.lo H5Oshmesg.lo H5Otest.lo H5P.lo \
+ H5Pacpl.lo H5Pdcpl.lo H5Pdxpl.lo H5Pfapl.lo H5Pfcpl.lo \
+ H5Pfmpl.lo H5Pgcpl.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo \
+ H5Pocpypl.lo H5Pstrcpl.lo H5Ptest.lo H5R.lo H5RC.lo H5RS.lo \
+ H5S.lo H5Sall.lo H5Shyper.lo H5Smpio.lo H5Snone.lo H5Spoint.lo \
H5Sselect.lo H5Stest.lo H5SL.lo H5SM.lo H5SMbtree2.lo \
H5SMcache.lo H5SMtest.lo H5ST.lo H5T.lo H5Tarray.lo H5Tbit.lo \
H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo H5Tenum.lo \
@@ -423,7 +423,7 @@ libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Olayout.c \
H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \
H5Oname.c H5Onull.c H5Opline.c H5Osdspace.c H5Oshared.c H5Ostab.c \
- H5Otest.c \
+ H5Oshmesg.c H5Otest.c \
H5P.c H5Pacpl.c H5Pdcpl.c H5Pdxpl.c H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
H5Pgcpl.c \
H5Plapl.c H5Plcpl.c H5Pocpl.c H5Pocpypl.c H5Pstrcpl.c H5Ptest.c \
@@ -689,6 +689,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Opline.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Osdspace.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oshared.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Oshmesg.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Ostab.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Otest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5P.Plo@am__quote@