H5HLpkg.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  * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
00018  *             Wednesday, July 9, 2003
00019  *
00020  * Purpose:     This file contains declarations which are visible
00021  *              only within the H5HL package. Source files outside the
00022  *              H5HL package should include H5HLprivate.h instead.
00023  */
00024 #ifndef H5HL_PACKAGE
00025 #error "Do not include this file outside the H5HL package!"
00026 #endif
00027 
00028 #ifndef _H5HLpkg_H
00029 #define _H5HLpkg_H
00030 
00031 /* Get package's private header */
00032 #include "H5HLprivate.h"
00033 
00034 /* Other private headers needed by this file */
00035 #include "H5ACprivate.h"        /* Metadata cache                       */
00036 #include "H5FLprivate.h"        /* Free lists                           */
00037 
00038 
00039 /*****************************/
00040 /* Package Private Variables */
00041 /*****************************/
00042 
00043 /* The cache subclass */
00044 H5_DLLVAR const H5AC_class_t H5AC_LHEAP[1];
00045 
00046 /* Declare extern the free list to manage the H5HL_free_t struct */
00047 H5FL_EXTERN(H5HL_free_t);
00048 
00049 /* Declare extern the free list to manage the H5HL_t struct */
00050 H5FL_EXTERN(H5HL_t);
00051 
00052 /* Declare extern the PQ free list to manage the heap chunk information */
00053 H5FL_BLK_EXTERN(lheap_chunk);
00054 
00055 
00056 /**************************/
00057 /* Package Private Macros */
00058 /**************************/
00059 
00060 #define H5HL_SIZEOF_HDR(F)                                                    \
00061     H5HL_ALIGN(H5_SIZEOF_MAGIC +        /*heap signature                */    \
00062                4 +                      /*reserved                      */    \
00063                H5F_SIZEOF_SIZE (F) +    /*data size                     */    \
00064                H5F_SIZEOF_SIZE (F) +    /*free list head                */    \
00065                H5F_SIZEOF_ADDR (F))     /*data address                  */
00066 
00067 
00068 /****************************/
00069 /* Package Private Typedefs */
00070 /****************************/
00071 
00072 typedef struct H5HL_free_t {
00073     size_t              offset;         /*offset of free block          */
00074     size_t              size;           /*size of free block            */
00075     struct H5HL_free_t  *prev;          /*previous entry in free list   */
00076     struct H5HL_free_t  *next;          /*next entry in free list       */
00077 } H5HL_free_t;
00078 
00079 struct H5HL_t {
00080     H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
00081                             /* first field in structure */
00082     haddr_t                 addr;       /*address of data               */
00083     size_t                  heap_alloc; /*size of heap on disk and in mem */
00084     uint8_t                *chunk;      /*the chunk, including header   */
00085     H5HL_free_t            *freelist;   /*the free list                 */
00086 };
00087 
00088 
00089 /******************************/
00090 /* Package Private Prototypes */
00091 /******************************/
00092 
00093 H5_DLL herr_t H5HL_dest(H5F_t *f, H5HL_t *heap);
00094 H5_DLL herr_t H5HL_size(const H5F_t *f, const H5HL_t *heap, size_t *size_ptr);
00095 
00096 #endif /* _H5HLpkg_H */
00097