summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Fdbg.c2
-rw-r--r--src/H5Fpkg.h11
-rw-r--r--src/H5Fsuper.c29
3 files changed, 23 insertions, 19 deletions
diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c
index c3d1ea7..1651004 100644
--- a/src/H5Fdbg.c
+++ b/src/H5Fdbg.c
@@ -106,7 +106,7 @@ H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth)
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Symbol table internal node 1/2 rank:", f->shared->btree_k[H5B_SNODE_ID]);
HDfprintf(stream, "%*s%-*s 0x%02x\n", indent, "", fwidth,
- "File consistency flags:", (unsigned)(f->shared->consist_flags));
+ "File status flags:", (unsigned)(f->shared->status_flags));
HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth,
"Base address:", f->shared->base_addr);
HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 10f219f..8c43ea2 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -54,9 +54,12 @@
#define H5F_SIGNATURE "\211HDF\r\n\032\n"
#define H5F_SIGNATURE_LEN 8
-/*
- * Private file open flags.
- */
+/* Superblock status flags */
+#define H5F_SUPER_WRITE_ACCESS 0x01
+#define H5F_SUPER_FILE_OK 0x02
+#define H5F_SUPER_ALL_FLAGS (H5F_SUPER_WRITE_ACCESS | H5F_SUPER_FILE_OK)
+
+/* Mask for removing private file access flags */
#define H5F_ACC_PUBLIC_FLAGS 0x00ffu
/*
@@ -69,7 +72,7 @@
typedef struct H5F_file_t {
H5FD_t *lf; /* Lower level file handle for I/O */
unsigned nrefs; /* Ref count for times file is opened */
- uint8_t consist_flags; /* File Consistency Flags */
+ uint8_t status_flags; /* File status flags */
unsigned flags; /* Access Permissions for file */
/* Cached values from FCPL/superblock */
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 0df22bb..bf00584 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -292,7 +292,7 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc)
/* Check for older version of superblock format */
if(super_vers < HDF5_SUPERBLOCK_VERSION_2) {
- uint32_t consist_flags; /* File Consistency Flags */
+ uint32_t status_flags; /* File status flags */
unsigned btree_k[H5B_NUM_BTREE_ID]; /* B-tree internal node 'K' values */
unsigned sym_leaf_k; /* Symbol table leaf node's 'K' value */
@@ -351,10 +351,12 @@ H5F_super_read(H5F_t *f, hid_t dxpl_id, H5G_loc_t *root_loc)
* for the indexed storage B-tree internal 'K' value later.
*/
- /* File consistency flags. (Not really used yet) */
- UINT32DECODE(p, consist_flags);
- HDassert(consist_flags <= 255);
- shared->consist_flags = consist_flags;
+ /* File status flags (not really used yet) */
+ UINT32DECODE(p, status_flags);
+ HDassert(status_flags <= 255);
+ shared->status_flags = status_flags;
+ if(shared->status_flags & ~H5F_SUPER_ALL_FLAGS)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad flag value for superblock")
/*
* If the superblock version # is greater than 0, read in the indexed
@@ -480,8 +482,10 @@ 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 byte number for object size")
shared->sizeof_size = sizeof_size; /* Keep a local copy also */
- /* File consistency flags. (Not really used yet) */
- shared->consist_flags = *p++;
+ /* File status flags (not really used yet) */
+ shared->status_flags = *p++;
+ if(shared->status_flags & ~H5F_SUPER_ALL_FLAGS)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad flag value for superblock")
/* Base, superblock extension, end of file & root group object header addresses */
H5F_addr_decode(f, (const uint8_t **)&p, &shared->base_addr/*out*/);
@@ -672,7 +676,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get userblock size")
f->shared->super_addr = userblock_size;
f->shared->base_addr = f->shared->super_addr;
- f->shared->consist_flags = 0x03;
+ f->shared->status_flags = 0;
/* Grab superblock version from property list */
if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super_vers) < 0)
@@ -855,8 +859,6 @@ H5F_super_write(H5F_t *f, hid_t dxpl_id)
/* Check for older version of superblock format */
if(super_vers < HDF5_SUPERBLOCK_VERSION_2) {
- uint32_t consist_flags; /* File Consistency Flags */
-
*p++ = (uint8_t)HDF5_FREESPACE_VERSION; /* (hard-wired) */
*p++ = (uint8_t)HDF5_OBJECTDIR_VERSION; /* (hard-wired) */
*p++ = 0; /* reserved*/
@@ -870,8 +872,7 @@ H5F_super_write(H5F_t *f, hid_t dxpl_id)
UINT16ENCODE(p, f->shared->sym_leaf_k);
UINT16ENCODE(p, f->shared->btree_k[H5B_SNODE_ID]);
- consist_flags = f->shared->consist_flags;
- UINT32ENCODE(p, consist_flags);
+ UINT32ENCODE(p, (uint32_t)f->shared->status_flags);
/*
* Versions of the superblock >0 have the indexed storage B-tree
@@ -921,12 +922,12 @@ H5F_super_write(H5F_t *f, hid_t dxpl_id)
uint32_t chksum; /* Checksum temporary variable */
H5O_loc_t *root_oloc; /* Pointer to root group's object location */
- /* Size of file addresses & offsets, and consistency flags */
+ /* Size of file addresses & offsets, and status flags */
HDassert(H5F_SIZEOF_ADDR(f) <= 255);
*p++ = (uint8_t)H5F_SIZEOF_ADDR(f);
HDassert(H5F_SIZEOF_SIZE(f) <= 255);
*p++ = (uint8_t)H5F_SIZEOF_SIZE(f);
- *p++ = f->shared->consist_flags;
+ *p++ = f->shared->status_flags;
/* Base, superblock extension & end of file addresses */
H5F_addr_encode(f, &p, f->shared->base_addr);