H5Fprivate.h

00001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00002  * Copyright by The HDF Group.                                               *
00003  * Copyright by the Board of Trustees of the University of Illinois.         *
00004  * All rights reserved.                                                      *
00005  *                                                                           *
00006  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
00007  * terms governing use, modification, and redistribution, is contained in    *
00008  * the files COPYING and Copyright.html.  COPYING can be found at the root   *
00009  * of the source code distribution tree; Copyright.html can be found at the  *
00010  * root level of an installed copy of the electronic HDF5 document set and   *
00011  * is linked from the top-level documents page.  It can also be found at     *
00012  * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
00013  * access to either file, you may request a copy from help@hdfgroup.org.     *
00014  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00015 
00016 /*
00017  * This file contains macros & information for file access
00018  */
00019 
00020 #ifndef _H5Fprivate_H
00021 #define _H5Fprivate_H
00022 
00023 /* Include package's public header */
00024 #include "H5Fpublic.h"
00025 
00026 /* Public headers needed by this file */
00027 #include "H5FDpublic.h"         /* File drivers                         */
00028 
00029 /* Private headers needed by this file */
00030 
00031 /****************************/
00032 /* Library Private Typedefs */
00033 /****************************/
00034 
00035 /* Main file structure */
00036 typedef struct H5F_t H5F_t;
00037 
00038 /* Block aggregation structure */
00039 typedef struct H5F_blk_aggr_t H5F_blk_aggr_t;
00040 
00041 /*===----------------------------------------------------------------------===
00042  *                              Flush Flags
00043  *===----------------------------------------------------------------------===
00044  *
00045  *  Flags passed into the flush routines which indicate what type of
00046  *  flush we want to do. They can be ORed together.
00047  */
00048 #define H5F_FLUSH_NONE       (0U)       /* No flags specified                       */
00049 #define H5F_FLUSH_INVALIDATE (1U << 0)  /* Invalidate cached data                   */
00050 #define H5F_FLUSH_CLOSING    (1U << 1)  /* Closing the file                         */
00051 
00052 /*
00053  * Encode and decode macros for file meta-data.
00054  * Currently, all file meta-data is little-endian.
00055  */
00056 
00057 #  define INT16ENCODE(p, i) {                                                 \
00058    *(p) = (uint8_t)( (unsigned)(i)       & 0xff); (p)++;                      \
00059    *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++;                      \
00060 }
00061 
00062 #  define UINT16ENCODE(p, i) {                                                \
00063    *(p) = (uint8_t)( (unsigned)(i)       & 0xff); (p)++;                      \
00064    *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); (p)++;                      \
00065 }
00066 
00067 #  define INT32ENCODE(p, i) {                                                 \
00068    *(p) = (uint8_t)( (uint32_t)(i)        & 0xff); (p)++;                     \
00069    *(p) = (uint8_t)(((uint32_t)(i) >>  8) & 0xff); (p)++;                     \
00070    *(p) = (uint8_t)(((uint32_t)(i) >> 16) & 0xff); (p)++;                     \
00071    *(p) = (uint8_t)(((uint32_t)(i) >> 24) & 0xff); (p)++;                     \
00072 }
00073 
00074 #  define UINT32ENCODE(p, i) {                                                \
00075    *(p) = (uint8_t)( (i)        & 0xff); (p)++;                               \
00076    *(p) = (uint8_t)(((i) >>  8) & 0xff); (p)++;                               \
00077    *(p) = (uint8_t)(((i) >> 16) & 0xff); (p)++;                               \
00078    *(p) = (uint8_t)(((i) >> 24) & 0xff); (p)++;                               \
00079 }
00080 
00081 /* Encode a 32-bit unsigned integer into a variable-sized buffer */
00082 /* (Assumes that the high bits of the integer are zero) */
00083 #  define UINT32ENCODE_VAR(p, n, l) {                                         \
00084    uint32_t _n = (n);                                                         \
00085    size_t _i;                                                                 \
00086    uint8_t *_p = (uint8_t*)(p);                                               \
00087                                                                               \
00088    for(_i = 0; _i < l; _i++, _n >>= 8)                                        \
00089       *_p++ = (uint8_t)(_n & 0xff);                                           \
00090    (p) = (uint8_t*)(p) + l;                                                   \
00091 }
00092 
00093 #  define INT64ENCODE(p, n) {                                                 \
00094    int64_t _n = (n);                                                          \
00095    size_t _i;                                                                 \
00096    uint8_t *_p = (uint8_t*)(p);                                               \
00097                                                                               \
00098    for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8)                         \
00099       *_p++ = (uint8_t)(_n & 0xff);                                           \
00100    for (/*void*/; _i < 8; _i++)                                               \
00101       *_p++ = (n) < 0 ? 0xff : 0;                                             \
00102    (p) = (uint8_t*)(p)+8;                                                     \
00103 }
00104 
00105 #  define UINT64ENCODE(p, n) {                                                \
00106    uint64_t _n = (n);                                                         \
00107    size_t _i;                                                                 \
00108    uint8_t *_p = (uint8_t*)(p);                                               \
00109                                                                               \
00110    for (_i = 0; _i < sizeof(uint64_t); _i++, _n >>= 8)                        \
00111       *_p++ = (uint8_t)(_n & 0xff);                                           \
00112    for (/*void*/; _i < 8; _i++)                                               \
00113       *_p++ = 0;                                                              \
00114    (p) = (uint8_t*)(p) + 8;                                                   \
00115 }
00116 
00117 /* Encode a 64-bit unsigned integer into a variable-sized buffer */
00118 /* (Assumes that the high bits of the integer are zero) */
00119 #  define UINT64ENCODE_VAR(p, n, l) {                                         \
00120    uint64_t _n = (n);                                                         \
00121    size_t _i;                                                                 \
00122    uint8_t *_p = (uint8_t*)(p);                                               \
00123                                                                               \
00124    for(_i = 0; _i < l; _i++, _n >>= 8)                                        \
00125       *_p++ = (uint8_t)(_n & 0xff);                                           \
00126    (p) = (uint8_t*)(p) + l;                                                   \
00127 }
00128 
00129 /* DECODE converts little endian bytes pointed by p to integer values and store
00130  * it in i.  For signed values, need to do sign-extension when converting
00131  * the last byte which carries the sign bit.
00132  * The macros does not require i be of a certain byte sizes.  It just requires
00133  * i be big enough to hold the intended value range.  E.g. INT16DECODE works
00134  * correctly even if i is actually a 64bit int like in a Cray.
00135  */
00136 
00137 #  define INT16DECODE(p, i) {                                                 \
00138    (i)  = (int16_t)((*(p) & 0xff));      (p)++;                               \
00139    (i) |= (int16_t)(((*(p) & 0xff) << 8) |                                    \
00140                    ((*(p) & 0x80) ? ~0xffff : 0x0)); (p)++;                   \
00141 }
00142 
00143 #  define UINT16DECODE(p, i) {                                                \
00144    (i)  = (uint16_t) (*(p) & 0xff);       (p)++;                              \
00145    (i) |= (uint16_t)((*(p) & 0xff) << 8); (p)++;                              \
00146 }
00147 
00148 #  define INT32DECODE(p, i) {                                                 \
00149    (i)  = (          *(p) & 0xff);        (p)++;                              \
00150    (i) |= ((int32_t)(*(p) & 0xff) <<  8); (p)++;                              \
00151    (i) |= ((int32_t)(*(p) & 0xff) << 16); (p)++;                              \
00152    (i) |= ((int32_t)(((*(p) & 0xff) << 24) |                                  \
00153                    ((*(p) & 0x80) ? ~0xffffffff : 0x0))); (p)++;              \
00154 }
00155 
00156 #  define UINT32DECODE(p, i) {                                                \
00157    (i)  =  (uint32_t)(*(p) & 0xff);        (p)++;                             \
00158    (i) |= ((uint32_t)(*(p) & 0xff) <<  8); (p)++;                             \
00159    (i) |= ((uint32_t)(*(p) & 0xff) << 16); (p)++;                             \
00160    (i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++;                             \
00161 }
00162 
00163 /* Decode a variable-sized buffer into a 32-bit unsigned integer */
00164 /* (Assumes that the high bits of the integer will be zero) */
00165 /* (Note: this is exactly the same code as the 64-bit variable-length decoder
00166  *      and bugs/improvements should be make in both places - QAK)
00167  */
00168 #  define UINT32DECODE_VAR(p, n, l) {                                         \
00169    size_t _i;                                                                 \
00170                                                                               \
00171    n = 0;                                                                     \
00172    (p) += l;                                                                  \
00173    for (_i = 0; _i < l; _i++)                                                 \
00174       n = (n << 8) | *(--p);                                                  \
00175    (p) += l;                                                                  \
00176 }
00177 
00178 #  define INT64DECODE(p, n) {                                                 \
00179    /* WE DON'T CHECK FOR OVERFLOW! */                                         \
00180    size_t _i;                                                                 \
00181                                                                               \
00182    n = 0;                                                                     \
00183    (p) += 8;                                                                  \
00184    for (_i = 0; _i < sizeof(int64_t); _i++)                                           \
00185       n = (n << 8) | *(--p);                                                  \
00186    (p) += 8;                                                                  \
00187 }
00188 
00189 #  define UINT64DECODE(p, n) {                                                \
00190    /* WE DON'T CHECK FOR OVERFLOW! */                                         \
00191    size_t _i;                                                                 \
00192                                                                               \
00193    n = 0;                                                                     \
00194    (p) += 8;                                                                  \
00195    for (_i = 0; _i < sizeof(uint64_t); _i++)                                  \
00196       n = (n << 8) | *(--p);                                                  \
00197    (p) += 8;                                                                  \
00198 }
00199 
00200 /* Decode a variable-sized buffer into a 64-bit unsigned integer */
00201 /* (Assumes that the high bits of the integer will be zero) */
00202 /* (Note: this is exactly the same code as the 32-bit variable-length decoder
00203  *      and bugs/improvements should be make in both places - QAK)
00204  */
00205 #  define UINT64DECODE_VAR(p, n, l) {                                         \
00206    size_t _i;                                                                 \
00207                                                                               \
00208    n = 0;                                                                     \
00209    (p) += l;                                                                  \
00210    for (_i = 0; _i < l; _i++)                                                 \
00211       n = (n << 8) | *(--p);                                                  \
00212    (p) += l;                                                                  \
00213 }
00214 
00215 /* Address-related macros */
00216 #define H5F_addr_overflow(X,Z)  (HADDR_UNDEF==(X) ||                          \
00217                                  HADDR_UNDEF==(X)+(haddr_t)(Z) ||             \
00218                                  (X)+(haddr_t)(Z)<(X))
00219 #define H5F_addr_hash(X,M)      ((unsigned)((X)%(M)))
00220 #define H5F_addr_defined(X)     ((X)!=HADDR_UNDEF)
00221 /* The H5F_addr_eq() macro guarantees that Y is not HADDR_UNDEF by making
00222  * certain that X is not HADDR_UNDEF and then checking that X equals Y
00223  */
00224 #define H5F_addr_eq(X,Y)        ((X)!=HADDR_UNDEF &&                          \
00225                                  (X)==(Y))
00226 #define H5F_addr_ne(X,Y)        (!H5F_addr_eq((X),(Y)))
00227 #define H5F_addr_lt(X,Y)        ((X)!=HADDR_UNDEF &&                          \
00228                                  (Y)!=HADDR_UNDEF &&                          \
00229                                  (X)<(Y))
00230 #define H5F_addr_le(X,Y)        ((X)!=HADDR_UNDEF &&                          \
00231                                  (Y)!=HADDR_UNDEF &&                          \
00232                                  (X)<=(Y))
00233 #define H5F_addr_gt(X,Y)        ((X)!=HADDR_UNDEF &&                          \
00234                                  (Y)!=HADDR_UNDEF &&                          \
00235                                  (X)>(Y))
00236 #define H5F_addr_ge(X,Y)        ((X)!=HADDR_UNDEF &&                          \
00237                                  (Y)!=HADDR_UNDEF &&                          \
00238                                  (X)>=(Y))
00239 #define H5F_addr_cmp(X,Y)       (H5F_addr_eq((X), (Y)) ? 0 :                  \
00240                                  (H5F_addr_lt((X), (Y)) ? -1 : 1))
00241 #define H5F_addr_pow2(N)        ((haddr_t)1<<(N))
00242 #define H5F_addr_overlap(O1,L1,O2,L2) (((O1) < (O2) && ((O1) + (L1)) > (O2)) || \
00243                                  ((O1) >= (O2) && (O1) < ((O2) + (L2))))
00244 
00245 /* If the module using this macro is allowed access to the private variables, access them directly */
00246 #ifdef H5F_PACKAGE
00247 #define H5F_INTENT(F)           ((F)->intent)
00248 #define H5F_FCPL(F)             ((F)->shared->fcpl_id)
00249 #define H5F_SIZEOF_ADDR(F)      ((F)->shared->sizeof_addr)
00250 #define H5F_SIZEOF_SIZE(F)      ((F)->shared->sizeof_size)
00251 #define H5F_SYM_LEAF_K(F)       ((F)->shared->sym_leaf_k)
00252 #define H5F_KVALUE(F,T)         ((F)->shared->btree_k[(T)->id])
00253 #define H5F_RDCC_NSLOTS(F)      ((F)->shared->rdcc_nslots)
00254 #define H5F_RDCC_NBYTES(F)      ((F)->shared->rdcc_nbytes)
00255 #define H5F_RDCC_W0(F)          ((F)->shared->rdcc_w0)
00256 #define H5F_BASE_ADDR(F)        ((F)->shared->base_addr)
00257 #define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared)
00258 #define H5F_SIEVE_BUF_SIZE(F)   ((F)->shared->sieve_buf_size)
00259 #define H5F_GC_REF(F)           ((F)->shared->gc_ref)
00260 #define H5F_USE_LATEST_FORMAT(F) ((F)->shared->latest_format)
00261 #define H5F_EXTPATH(F)          ((F)->extpath)
00262 #define H5F_NAME(F)             ((F)->name)
00263 #define H5F_GET_FC_DEGREE(F)    ((F)->shared->fc_degree)
00264 #define H5F_STORE_MSG_CRT_IDX(F)    ((F)->shared->store_msg_crt_idx)
00265 #define H5F_HAS_FEATURE(F,FL)   ((F)->shared->lf->feature_flags & (FL))
00266 #define H5F_DRIVER_ID(F)        ((F)->shared->lf->driver_id)
00267 #define H5F_GET_FILENO(F,FILENUM) ((FILENUM) = (F)->shared->lf->fileno)
00268 #else /* H5F_PACKAGE */
00269 #define H5F_INTENT(F)           (H5F_get_intent(F))
00270 #define H5F_FCPL(F)             (H5F_get_fcpl(F))
00271 #define H5F_SIZEOF_ADDR(F)      (H5F_sizeof_addr(F))
00272 #define H5F_SIZEOF_SIZE(F)      (H5F_sizeof_size(F))
00273 #define H5F_SYM_LEAF_K(F)       (H5F_sym_leaf_k(F))
00274 #define H5F_KVALUE(F,T)         (H5F_Kvalue(F,T))
00275 #define H5F_RDCC_NSLOTS(F)      (H5F_rdcc_nslots(F))
00276 #define H5F_RDCC_NBYTES(F)      (H5F_rdcc_nbytes(F))
00277 #define H5F_RDCC_W0(F)          (H5F_rdcc_w0(F))
00278 #define H5F_BASE_ADDR(F)        (H5F_get_base_addr(F))
00279 #define H5F_GRP_BTREE_SHARED(F) (H5F_grp_btree_shared(F))
00280 #define H5F_SIEVE_BUF_SIZE(F)   (H5F_sieve_buf_size(F))
00281 #define H5F_GC_REF(F)           (H5F_gc_ref(F))
00282 #define H5F_USE_LATEST_FORMAT(F) (H5F_use_latest_format(F))
00283 #define H5F_EXTPATH(F)          (H5F_get_extpath(F))
00284 #define H5F_NAME(F)             (H5F_get_name(F))
00285 #define H5F_GET_FC_DEGREE(F)    (H5F_get_fc_degree(F))
00286 #define H5F_STORE_MSG_CRT_IDX(F) (H5F_store_msg_crt_idx(F))
00287 #define H5F_HAS_FEATURE(F,FL)   (H5F_has_feature(F,FL))
00288 #define H5F_DRIVER_ID(F)        (H5F_get_driver_id(F))
00289 #define H5F_GET_FILENO(F,FILENUM) (H5F_get_fileno((F), &(FILENUM)))
00290 #endif /* H5F_PACKAGE */
00291 
00292 
00293 /* Macros to encode/decode offset/length's for storing in the file */
00294 #define H5F_ENCODE_OFFSET(f,p,o) switch(H5F_SIZEOF_ADDR(f)) {                 \
00295     case 4: UINT32ENCODE(p,o); break;                                         \
00296     case 8: UINT64ENCODE(p,o); break;                                         \
00297     case 2: UINT16ENCODE(p,o); break;                                         \
00298 }
00299 
00300 #define H5F_DECODE_OFFSET(f,p,o) switch (H5F_SIZEOF_ADDR (f)) {               \
00301     case 4: UINT32DECODE(p, o); break;                                        \
00302     case 8: UINT64DECODE(p, o); break;                                        \
00303     case 2: UINT16DECODE(p, o); break;                                        \
00304 }
00305 
00306 #define H5F_ENCODE_LENGTH(f,p,l) switch(H5F_SIZEOF_SIZE(f)) {                 \
00307     case 4: UINT32ENCODE(p,l); break;                                         \
00308     case 8: UINT64ENCODE(p,l); break;                                         \
00309     case 2: UINT16ENCODE(p,l); break;                                         \
00310     default: HDassert("bad sizeof size" && 0);                                \
00311 }
00312 
00313 #define H5F_DECODE_LENGTH(f,p,l) switch(H5F_SIZEOF_SIZE(f)) {                 \
00314     case 4: UINT32DECODE(p,l); break;                                         \
00315     case 8: UINT64DECODE(p,l); break;                                         \
00316     case 2: UINT16DECODE(p,l); break;                                         \
00317     default: HDassert("bad sizeof size" && 0);                                \
00318 }
00319 
00320 /*
00321  * Macros that check for overflows.  These are somewhat dangerous to fiddle
00322  * with.
00323  */
00324 #if (H5_SIZEOF_SIZE_T >= H5_SIZEOF_OFF_T)
00325 #   define H5F_OVERFLOW_SIZET2OFFT(X)                                         \
00326     ((size_t)(X)>=(size_t)((size_t)1<<(8*sizeof(off_t)-1)))
00327 #else
00328 #   define H5F_OVERFLOW_SIZET2OFFT(X) 0
00329 #endif
00330 #if (H5_SIZEOF_HSIZE_T >= H5_SIZEOF_OFF_T)
00331 #   define H5F_OVERFLOW_HSIZET2OFFT(X)                                        \
00332     ((hsize_t)(X)>=(hsize_t)((hsize_t)1<<(8*sizeof(off_t)-1)))
00333 #else
00334 #   define H5F_OVERFLOW_HSIZET2OFFT(X) 0
00335 #endif
00336 
00337 /* Sizes of object addresses & sizes in the file (in bytes) */
00338 #define H5F_OBJ_ADDR_SIZE   sizeof(haddr_t)
00339 #define H5F_OBJ_SIZE_SIZE   sizeof(hsize_t)
00340 
00341 /* File-wide default character encoding can not yet be set via the file
00342  * creation property list and is always ASCII. */
00343 #define H5F_DEFAULT_CSET H5T_CSET_ASCII
00344 
00345 /* ========= File Creation properties ============ */
00346 #define H5F_CRT_USER_BLOCK_NAME      "block_size"       /* Size of the file user block in bytes */
00347 #define H5F_CRT_SYM_LEAF_NAME        "symbol_leaf"      /* 1/2 rank for symbol table leaf nodes */
00348 #define H5F_CRT_SYM_LEAF_DEF         4
00349 #define H5F_CRT_BTREE_RANK_NAME      "btree_rank"       /* 1/2 rank for btree internal nodes    */
00350 #define H5F_CRT_ADDR_BYTE_NUM_NAME   "addr_byte_num"    /* Byte number in an address            */
00351 #define H5F_CRT_OBJ_BYTE_NUM_NAME    "obj_byte_num"     /* Byte number for object size          */
00352 #define H5F_CRT_SUPER_VERS_NAME      "super_version"    /* Version number of the superblock     */
00353 #define H5F_CRT_SHMSG_NINDEXES_NAME  "num_shmsg_indexes" /* Number of shared object header message indexes */
00354 #define H5F_CRT_SHMSG_INDEX_TYPES_NAME "shmsg_message_types" /* Types of message in each index */
00355 #define H5F_CRT_SHMSG_INDEX_MINSIZE_NAME "shmsg_message_minsize" /* Minimum size of messages in each index */
00356 #define H5F_CRT_SHMSG_LIST_MAX_NAME  "shmsg_list_max"   /* Shared message list maximum size */
00357 #define H5F_CRT_SHMSG_BTREE_MIN_NAME "shmsg_btree_min"  /* Shared message B-tree minimum size */
00358 
00359 
00360 
00361 /* ========= File Access properties ============ */
00362 #define H5F_ACS_META_CACHE_INIT_CONFIG_NAME     "mdc_initCacheCfg" /* Initial metadata cache resize configuration */
00363 #define H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME       "rdcc_nslots"   /* Size of raw data chunk cache(slots) */
00364 #define H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME       "rdcc_nbytes"   /* Size of raw data chunk cache(bytes) */
00365 #define H5F_ACS_PREEMPT_READ_CHUNKS_NAME        "rdcc_w0"       /* Preemption read chunks first */
00366 #define H5F_ACS_ALIGN_THRHD_NAME                "threshold"     /* Threshold for alignment */
00367 #define H5F_ACS_ALIGN_NAME                      "align"         /* Alignment */
00368 #define H5F_ACS_META_BLOCK_SIZE_NAME            "meta_block_size" /* Minimum metadata allocation block size (when aggregating metadata allocations) */
00369 #define H5F_ACS_SIEVE_BUF_SIZE_NAME             "sieve_buf_size" /* Maximum sieve buffer size (when data sieving is allowed by file driver) */
00370 #define H5F_ACS_SDATA_BLOCK_SIZE_NAME           "sdata_block_size" /* Minimum "small data" allocation block size (when aggregating "small" raw data allocations) */
00371 #define H5F_ACS_GARBG_COLCT_REF_NAME            "gc_ref"        /* Garbage-collect references */
00372 #define H5F_ACS_FILE_DRV_ID_NAME                "driver_id"     /* File driver ID */
00373 #define H5F_ACS_FILE_DRV_INFO_NAME              "driver_info"   /* File driver info */
00374 #define H5F_ACS_CLOSE_DEGREE_NAME               "close_degree"  /* File close degree */
00375 #define H5F_ACS_FAMILY_OFFSET_NAME              "family_offset" /* Offset position in file for family file driver */
00376 #define H5F_ACS_FAMILY_NEWSIZE_NAME             "family_newsize" /* New member size of family driver.  (private property only used by h5repart) */
00377 #define H5F_ACS_FAMILY_TO_SEC2_NAME             "family_to_sec2" /* Whether to convert family to sec2 driver.  (private property only used by h5repart) */
00378 #define H5F_ACS_MULTI_TYPE_NAME                 "multi_type"    /* Data type in multi file driver */
00379 #define H5F_ACS_LATEST_FORMAT_NAME              "latest_format" /* 'Use latest format version' flag */
00380 
00381 /* ======================== File Mount properties ====================*/
00382 #define H5F_MNT_SYM_LOCAL_NAME          "local"                 /* Whether absolute symlinks local to file. */
00383 
00384 
00385 #ifdef H5_HAVE_PARALLEL
00386 /* Which process writes metadata */
00387 #define H5_PAR_META_WRITE 0
00388 #endif /* H5_HAVE_PARALLEL */
00389 
00390 /* Version #'s of the major components of the file format */
00391 #define HDF5_SUPERBLOCK_VERSION_DEF     0       /* The default super block format         */
00392 #define HDF5_SUPERBLOCK_VERSION_1       1       /* Version with non-default B-tree 'K' value */
00393 #define HDF5_SUPERBLOCK_VERSION_2       2       /* Revised version with superblock extension and checksum */
00394 #define HDF5_SUPERBLOCK_VERSION_LATEST  HDF5_SUPERBLOCK_VERSION_2       /* The maximum super block format    */
00395 #define HDF5_FREESPACE_VERSION          0       /* of the Free-Space Info         */
00396 #define HDF5_OBJECTDIR_VERSION          0       /* of the Object Directory format */
00397 #define HDF5_SHAREDHEADER_VERSION       0       /* of the Shared-Header Info      */
00398 #define HDF5_DRIVERINFO_VERSION_0       0       /* of the Driver Information Block*/
00399 
00400 /* B-tree internal 'K' values */
00401 #define HDF5_BTREE_SNODE_IK_DEF         16
00402 #define HDF5_BTREE_CHUNK_IK_DEF         32      /* Note! this value is assumed
00403                                                     to be 32 for version 0
00404                                                     of the superblock and
00405                                                     if it is changed, the code
00406                                                     must compensate. -QAK
00407                                                  */
00408 
00409 /* Macros to define signatures of all objects in the file */
00410 
00411 /* Size of signature information (on disk) */
00412 /* (all on-disk signatures should be this length) */
00413 #define H5_SIZEOF_MAGIC               4
00414 
00415 /* v1 B-tree node signature */
00416 #define H5B_MAGIC                       "TREE"
00417 
00418 /* v2 B-tree signatures */
00419 #define H5B2_HDR_MAGIC                  "BTHD"          /* Header */
00420 #define H5B2_INT_MAGIC                  "BTIN"          /* Internal node */
00421 #define H5B2_LEAF_MAGIC                 "BTLF"          /* Leaf node */
00422 
00423 /* Extensible array signatures */
00424 #define H5EA_HDR_MAGIC                  "EAHD"          /* Header */
00425 #define H5EA_IBLOCK_MAGIC               "EAIB"          /* Index block */
00426 #define H5EA_DBLOCK_MAGIC               "EADB"          /* Data block */
00427 
00428 /* Free space signatures */
00429 #define H5FS_HDR_MAGIC                  "FSHD"          /* Header */
00430 #define H5FS_SINFO_MAGIC                "FSSE"          /* Serialized sections */
00431 
00432 /* Symbol table node signature */
00433 #define H5G_NODE_MAGIC                  "SNOD"
00434 
00435 /* Fractal heap signatures */
00436 #define H5HF_HDR_MAGIC                  "FRHP"          /* Header */
00437 #define H5HF_IBLOCK_MAGIC               "FHIB"          /* Indirect block */
00438 #define H5HF_DBLOCK_MAGIC               "FHDB"          /* Direct block */
00439 
00440 /* Global heap signature */
00441 #define H5HG_MAGIC                      "GCOL"
00442 
00443 /* Local heap signature */
00444 #define H5HL_MAGIC                      "HEAP"
00445 
00446 /* Object header signatures */
00447 #define H5O_HDR_MAGIC                   "OHDR"          /* Header */
00448 #define H5O_CHK_MAGIC                   "OCHK"          /* Continuation chunk */
00449 
00450 /* Shared Message signatures */
00451 #define H5SM_TABLE_MAGIC                "SMTB"          /* Shared Message Table */
00452 #define H5SM_LIST_MAGIC                 "SMLI"          /* Shared Message List */
00453 
00454 
00455 /* Forward declarations for prototype arguments */
00456 struct H5B_class_t;
00457 struct H5RC_t;
00458 
00459 /* Private functions */
00460 H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id,
00461     hid_t fapl_id, hid_t dxpl_id);
00462 H5_DLL herr_t H5F_try_close(H5F_t *f);
00463 H5_DLL unsigned H5F_incr_nopen_objs(H5F_t *f);
00464 H5_DLL unsigned H5F_decr_nopen_objs(H5F_t *f);
00465 
00466 /* Functions than retrieve values from the file struct */
00467 H5_DLL unsigned H5F_get_intent(const H5F_t *f);
00468 H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref);
00469 H5_DLL char *H5F_get_extpath(const H5F_t *f);
00470 H5_DLL char *H5F_get_name(const H5F_t *f);
00471 H5_DLL hid_t H5F_get_id(H5F_t *file, hbool_t app_ref);
00472 H5_DLL size_t H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref);
00473 H5_DLL size_t H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *obj_id_list, hbool_t app_ref);
00474 
00475 /* Functions than retrieve values set/cached from the superblock/FCPL */
00476 H5_DLL hid_t H5F_get_fcpl(const H5F_t *f);
00477 H5_DLL size_t H5F_sizeof_addr(const H5F_t *f);
00478 H5_DLL size_t H5F_sizeof_size(const H5F_t *f);
00479 H5_DLL unsigned H5F_sym_leaf_k(const H5F_t *f);
00480 H5_DLL unsigned H5F_Kvalue(const H5F_t *f, const struct H5B_class_t *type);
00481 H5_DLL size_t H5F_rdcc_nbytes(const H5F_t *f);
00482 H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f);
00483 H5_DLL double H5F_rdcc_w0(const H5F_t *f);
00484 H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f);
00485 H5_DLL struct H5RC_t *H5F_grp_btree_shared(const H5F_t *f);
00486 H5_DLL size_t H5F_sieve_buf_size(const H5F_t *f);
00487 H5_DLL unsigned H5F_gc_ref(const H5F_t *f);
00488 H5_DLL hbool_t H5F_use_latest_format(const H5F_t *f);
00489 H5_DLL H5F_close_degree_t H5F_get_fc_degree(const H5F_t *f);
00490 H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f);
00491 
00492 /* Functions that retrieve values from VFD layer */
00493 H5_DLL hbool_t H5F_has_feature(const H5F_t *f, unsigned feature);
00494 H5_DLL hid_t H5F_get_driver_id(const H5F_t *f);
00495 H5_DLL herr_t H5F_get_fileno(const H5F_t *f, unsigned long *filenum);
00496 H5_DLL haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type);
00497 
00498 /* Functions than check file mounting information */
00499 H5_DLL hbool_t H5F_is_mount(const H5F_t *file);
00500 H5_DLL hbool_t H5F_has_mount(const H5F_t *file);
00501 
00502 /* Functions that operate on blocks of bytes wrt super block */
00503 H5_DLL herr_t H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr,
00504                 size_t size, hid_t dxpl_id, void *buf/*out*/);
00505 H5_DLL herr_t H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr,
00506                 size_t size, hid_t dxpl_id, const void *buf);
00507 
00508 /* Address-related functions */
00509 H5_DLL void H5F_addr_encode(const H5F_t *, uint8_t** /*in,out*/, haddr_t);
00510 H5_DLL void H5F_addr_encode_len(size_t addr_len, uint8_t** /*in,out*/, haddr_t);
00511 H5_DLL void H5F_addr_decode(const H5F_t *, const uint8_t** /*in,out*/,
00512     haddr_t* /*out*/);
00513 H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t** /*in,out*/,
00514     haddr_t* /*out*/);
00515 
00516 /* File access property list callbacks */
00517 H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data);
00518 
00519 /* Shared file list related routines */
00520 H5_DLL herr_t H5F_sfile_assert_num(unsigned n);
00521 
00522 /* Routines for creating & destroying "fake" file structures */
00523 H5_DLL H5F_t *H5F_fake_alloc(size_t sizeof_size);
00524 H5_DLL herr_t H5F_fake_free(H5F_t *f);
00525 
00526 /* Parallel I/O (i.e. MPI) related routines */
00527 #ifdef H5_HAVE_PARALLEL
00528 H5_DLL int H5F_mpi_get_rank(const H5F_t *f);
00529 H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f);
00530 H5_DLL int H5F_mpi_get_size(const H5F_t *f);
00531 #endif /* H5_HAVE_PARALLEL */
00532 
00533 /* Debugging functions */
00534 H5_DLL herr_t H5F_debug(H5F_t *f, FILE * stream, int indent, int fwidth);
00535 
00536 #endif /* _H5Fprivate_H */
00537