diff options
Diffstat (limited to 'src/H5Fpkg.h')
-rw-r--r-- | src/H5Fpkg.h | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index d2c43b5..18bc7ef 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -83,6 +83,21 @@ #define H5F_SUPERBLOCK_FIXED_SIZE ( H5F_SIGNATURE_LEN \ + 1) /* superblock version */ +/* The H5F_SUPERBLOCK_MINIMAL_VARLEN_SIZE is the minimal amount of super block + * variable length data guarnateed to load the sizeof offsets and the sizeof + * lengths fields in all versions of the superblock. + * + * This is necessary in the V3 cache, as on the initial load, we need to + * get enough of the superblock to determine its version and size so that + * the metadata cache can load the correct amount of data from file to + * allow the second deserialization attempt to succeed. + * + * The value selected will have to be revisited for each new version + * of the super block. Note that the current value is one byte larger + * than it needs to be. + */ +#define H5F_SUPERBLOCK_MINIMAL_VARLEN_SIZE 7 + /* Macros for computing variable-size superblock size */ #define H5F_SUPERBLOCK_VARLEN_SIZE_COMMON \ (2 /* freespace, and root group versions */ \ @@ -115,14 +130,14 @@ + (sizeof_addr) /* EOF address */ \ + (sizeof_addr) /* root group object header address */ \ + H5F_SIZEOF_CHKSUM) /* superblock checksum (keep this last) */ -#define H5F_SUPERBLOCK_VARLEN_SIZE(v, f) ( \ - (v == 0 ? H5F_SUPERBLOCK_VARLEN_SIZE_V0(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) : 0) \ - + (v == 1 ? H5F_SUPERBLOCK_VARLEN_SIZE_V1(H5F_SIZEOF_ADDR(f), H5F_SIZEOF_SIZE(f)) : 0) \ - + (v == 2 ? H5F_SUPERBLOCK_VARLEN_SIZE_V2(H5F_SIZEOF_ADDR(f)) : 0)) +#define H5F_SUPERBLOCK_VARLEN_SIZE(v, sizeof_addr, sizeof_size) ( \ + (v == 0 ? H5F_SUPERBLOCK_VARLEN_SIZE_V0(sizeof_addr, sizeof_size) : 0) \ + + (v == 1 ? H5F_SUPERBLOCK_VARLEN_SIZE_V1(sizeof_addr, sizeof_size) : 0) \ + + (v == 2 ? H5F_SUPERBLOCK_VARLEN_SIZE_V2(sizeof_addr) : 0)) /* Total size of superblock, depends on superblock version */ -#define H5F_SUPERBLOCK_SIZE(v, f) ( H5F_SUPERBLOCK_FIXED_SIZE \ - + H5F_SUPERBLOCK_VARLEN_SIZE(v, f)) +#define H5F_SUPERBLOCK_SIZE(s) ( H5F_SUPERBLOCK_FIXED_SIZE \ + + H5F_SUPERBLOCK_VARLEN_SIZE((s)->super_vers, (s)->sizeof_addr, (s)->sizeof_size)) /* For superblock version 0 & 1: Offset to the file consistency flags (status_flags) in the superblock (excluding H5F_SUPERBLOCK_FIXED_SIZE) */ @@ -156,6 +171,26 @@ typedef struct H5F_super_ud_t { * H5Fefc.c) */ typedef struct H5F_efc_t H5F_efc_t; +/* Structure for passing 'user data' to superblock cache callbacks */ +typedef struct H5F_superblock_cache_ud_t { +/* IN: */ + H5F_t *f; /* Pointer to file */ + hbool_t ignore_drvrinfo; /* Indicate if the driver info should be ignored */ +/* OUT: */ + unsigned sym_leaf_k; /* Symbol table leaf node's 'K' value */ + unsigned btree_k[H5B_NUM_BTREE_ID]; /* B-tree key values for each type */ + haddr_t stored_eof; /* End-of-file in file */ + hbool_t drvrinfo_removed; /* Indicate if the driver info was removed */ + unsigned super_vers; /* Superblock version obtained in get_load_size callback. + * It will be used later in verify_chksum callback + */ +} H5F_superblock_cache_ud_t; + +typedef struct H5F_drvrinfo_cache_ud_t { + H5F_t *f; /* Pointer to file */ + haddr_t driver_addr; /* address of driver info block */ +} H5F_drvrinfo_cache_ud_t; + /* Structure for metadata & "small [raw] data" block aggregation fields */ struct H5F_blk_aggr_t { unsigned long feature_flag; /* Feature flag type */ @@ -205,6 +240,8 @@ typedef struct H5F_mtab_t { typedef struct H5F_super_t { H5AC_info_t cache_info; /* Cache entry information structure */ unsigned super_vers; /* Superblock version */ + uint8_t sizeof_addr; /* Size of addresses in file */ + uint8_t sizeof_size; /* Size of offsets in file */ uint8_t status_flags; /* File status flags */ unsigned sym_leaf_k; /* Size of leaves in symbol tables */ unsigned btree_k[H5B_NUM_BTREE_ID]; /* B-tree key values for each type */ @@ -226,6 +263,13 @@ typedef struct H5F_super_t { struct H5F_file_t { H5FD_t *lf; /* Lower level file handle for I/O */ H5F_super_t *sblock; /* Pointer to (pinned) superblock for file */ + H5O_drvinfo_t *drvinfo; /* Pointer to the (pinned) driver info + * cache entry. This field is only defined + * for older versions of the super block, + * and then only when a driver information + * block is present. At all other times + * it should be NULL. + */ unsigned nrefs; /* Ref count for times file is opened */ unsigned flags; /* Access Permissions for file */ H5F_mtab_t mtab; /* File mount table */ @@ -322,6 +366,7 @@ H5FL_EXTERN(H5F_t); H5FL_EXTERN(H5F_file_t); H5_DLLVAR const H5AC_class_t H5AC_SUPERBLOCK[1]; +H5_DLLVAR const H5AC_class_t H5AC_DRVRINFO[1]; /******************************/ |