/**************************************************************************** * NCSA HDF * * Software Development Group * * National Center for Supercomputing Applications * * University of Illinois at Urbana-Champaign * * 605 E. Springfield, Champaign IL 61820 * * * * For conditions of distribution and use, see the accompanying * * hdf/COPYING file. * * * ****************************************************************************/ /* $Id$ */ /* * This file contains macros & information for file access */ #ifndef _H5Fprivate_H #define _H5Fprivate_H #include /* This is a near top-level header! Try not to include much! */ #include #ifdef PHDF5 #ifndef MPI_SUCCESS #include #include #endif #endif /* * Feature: Define this constant to be non-zero if you want to enable code * that minimizes the number of calls to lseek(). This has a huge * performance benefit on some systems. Set this constant to zero * on the compiler command line to disable that optimization. */ #ifndef H5F_OPT_SEEK # define H5F_OPT_SEEK 1 #endif /* * Feature: Define this constant on the compiler command-line if you want to * see some debugging messages on stderr. */ #ifdef NDEBUG # undef H5F_DEBUG #endif /* Maximum size of boot-block buffer */ #define H5F_BOOTBLOCK_SIZE 1024 /* Define the HDF5 file signature */ #define H5F_SIGNATURE "\211HDF\r\n\032\n" #define H5F_SIGNATURE_LEN 8 /* size of size_t and off_t as they exist on disk */ #define H5F_SIZEOF_ADDR(F) ((F)->shared->create_parms.sizeof_addr) #define H5F_SIZEOF_SIZE(F) ((F)->shared->create_parms.sizeof_size) /* * File open flags. */ #define H5F_ACC_WRITE 0x0001 /* Open file for read/write access */ #define H5F_ACC_CREAT 0x0002 /* Create non-existing files */ #define H5F_ACC_EXCL 0x0004 /* Fail if file exists */ #define H5F_ACC_TRUNC 0x0008 /* Truncate existing file */ #define H5F_ACC_DEBUG 0x00010 /* Print debug info */ /* * Encode and decode macros for file meta-data. * Currently, all file meta-data is little-endian. */ /* For non-little-endian platforms, encode each byte by itself */ #ifdef WORDS_BIGENDIAN # define INT16ENCODE(p, i) { \ *(p) = (uint8)( (uintn)(i) & 0xff); (p)++; \ *(p) = (uint8)(((uintn)(i) >> 8) & 0xff); (p)++; \ } # define UINT16ENCODE(p, i) { \ *(p) = (uint8)( (i) & 0xff); (p)++; \ *(p) = (uint8)(((uintn)(i) >> 8) & 0xff); (p)++; \ } # define INT32ENCODE(p, i) { \ *(p) = (uint8)( (uint32)(i) & 0xff); (p)++; \ *(p) = (uint8)(((uint32)(i) >> 8) & 0xff); (p)++; \ *(p) = (uint8)(((uint32)(i) >> 16) & 0xff); (p)++; \ *(p) = (uint8)(((uint32)(i) >> 24) & 0xff); (p)++; \ } # define UINT32ENCODE(p, i) { \ *(p) = (uint8)( (i) & 0xff); (p)++; \ *(p) = (uint8)(((i) >> 8) & 0xff); (p)++; \ *(p) = (uint8)(((i) >> 16) & 0xff); (p)++; \ *(p) = (uint8)(((i) >> 24) & 0xff); (p)++; \ } # define INT64ENCODE(p, n) { \ int64 _n = (n); \ intn _i; \ uint8 *_p = (uint8*)(p); \ for (_i=0; _i>=8) { \ *_p++ = _n & 0xff; \ } \ for (/*void*/; _i<8; _i++) { \ *_p++ = (n)<0 ? 0xff : 0; \ } \ (p) = (uint8*)(p)+8; \ } # define UINT64ENCODE(p, n) { \ uint64 _n = (n); \ intn _i; \ uint8 *_p = (uint8*)(p); \ for (_i=0; _i>=8) { \ *_p++ = _n & 0xff; \ } \ for (/*void*/; _i<8; _i++) { \ *_p++ = 0; \ } \ (p) = (uint8*)(p)+8; \ } # define INT16DECODE(p, i) { \ (i) = (int16)((*(p) & 0xff)); (p)++; \ (i) |= (int16)((*(p) & 0xff) << 8); (p)++; \ } # define UINT16DECODE(p, i) { \ (i) = (uint16) (*(p) & 0xff); (p)++; \ (i) |= (uint16)((*(p) & 0xff) << 8); (p)++; \ } # define INT32DECODE(p, i) { \ (i) = ( *(p) & 0xff); (p)++; \ (i) |= ((int32)(*(p) & 0xff) << 8); (p)++; \ (i) |= ((int32)(*(p) & 0xff) << 16); (p)++; \ (i) |= ((int32)(*(p) & 0xff) << 24); (p)++; \ } # define UINT32DECODE(p, i) { \ (i) = (uint32)(*(p) & 0xff); (p)++; \ (i) |= ((uint32)(*(p) & 0xff) << 8); (p)++; \ (i) |= ((uint32)(*(p) & 0xff) << 16); (p)++; \ (i) |= ((uint32)(*(p) & 0xff) << 24); (p)++; \ } # define INT64DECODE(p, n) { \ /* WE DON'T CHECK FOR OVERFLOW! */ \ int64 _n = 0; \ intn _i; \ (p) += 8; \ for (_i=0; _i0) #define H5F_addr_ge(A1,A2) (H5F_addr_cmp(A1,A2)>=0) intn H5F_addr_cmp(const haddr_t *, const haddr_t *); hbool_t H5F_addr_defined(const haddr_t *); void H5F_addr_undef(haddr_t *); void H5F_addr_reset(haddr_t *); hbool_t H5F_addr_zerop(const haddr_t *); void H5F_addr_encode(H5F_t *, uint8 **, const haddr_t *); void H5F_addr_decode(H5F_t *, const uint8 **, haddr_t *); void H5F_addr_print(FILE *, const haddr_t *); void H5F_addr_pow2(uintn, haddr_t *); void H5F_addr_inc(haddr_t *, size_t); void H5F_addr_add(haddr_t *, const haddr_t *); uintn H5F_addr_hash(const haddr_t *, uintn mod); #endif