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