H5HFprivate.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  *
00018  * Created:             H5HFprivate.h
00019  *                      Feb 24 2006
00020  *                      Quincey Koziol <koziol@ncsa.uiuc.edu>
00021  *
00022  * Purpose:             Private header for library accessible fractal heap routines.
00023  *
00024  *-------------------------------------------------------------------------
00025  */
00026 
00027 #ifndef _H5HFprivate_H
00028 #define _H5HFprivate_H
00029 
00030 /* Include package's public header */
00031 #include "H5HFpublic.h"
00032 
00033 /* Private headers needed by this file */
00034 #include "H5Fprivate.h"         /* File access                          */
00035 #include "H5Oprivate.h"         /* Object headers                       */
00036 
00037 /**************************/
00038 /* Library Private Macros */
00039 /**************************/
00040 
00041 /* Limit heap ID length to 4096 + 1, due to # of bits required to store
00042  *      length of 'tiny' objects (12 bits)
00043  */
00044 #define H5HF_MAX_ID_LEN         (4096 + 1)
00045 
00046 
00047 /****************************/
00048 /* Library Private Typedefs */
00049 /****************************/
00050 
00051 /* Creation parameters for doubling-tables */
00052 typedef struct H5HF_dtable_cparam_t {
00053     unsigned    width;          /* Number of columns in the table (must be power of 2) */
00054     size_t      start_block_size; /* Starting block size for table (must be power of 2) */
00055     size_t      max_direct_size; /* Maximum size of a direct block (must be power of 2) */
00056     unsigned    max_index;      /* Maximum ID/offset for table (integer log2 of actual value, ie. the # of bits required) */
00057     unsigned    start_root_rows;        /* Starting number of rows for root indirect block */
00058                                 /* 0 indicates to create the full indirect block for the root,
00059                                  * right from the start.  Doesn't have to be power of 2
00060                                  */
00061 } H5HF_dtable_cparam_t;
00062 
00063 /* Fractal heap creation parameters */
00064 typedef struct H5HF_create_t {
00065     H5HF_dtable_cparam_t managed;/* Mapped object doubling-table creation parameters */
00066     hbool_t checksum_dblocks;   /* Whether the direct blocks should be checksummed */
00067     uint32_t max_man_size;      /* Max. size of object to manage in doubling table */
00068                                 /* (i.e.  min. size of object to store standalone) */
00069     uint16_t id_len;            /* Length of IDs to use for heap objects */
00070                                 /* (0 - make ID just large enough to hold length & offset of object in the heap) */
00071                                 /* (1 - make ID just large enough to allow 'huge' objects to be accessed directly) */
00072                                 /* (n - make ID 'n' bytes in size) */
00073     H5O_pline_t pline;          /* I/O filter pipeline to apply to direct blocks & 'huge' objects */
00074 } H5HF_create_t;
00075 
00076 /* Fractal heap metadata statistics info */
00077 typedef struct H5HF_stat_t {
00078     /* 'Managed' object info */
00079     hsize_t man_size;           /* Size of 'managed' space in heap            */
00080     hsize_t man_alloc_size;     /* Size of 'managed' space allocated in heap  */
00081     hsize_t man_iter_off;       /* Offset of "new block" iterator in 'managed' heap space */
00082     hsize_t man_free_space;     /* Free space within 'managed' heap blocks    */
00083     hsize_t man_nobjs;          /* Number of 'managed' objects in heap        */
00084 
00085     /* 'Huge' object info */
00086     hsize_t huge_size;          /* Size of 'huge' objects in heap             */
00087     hsize_t huge_nobjs;         /* Number of 'huge' objects in heap           */
00088 
00089     /* 'Tiny' object info */
00090     hsize_t tiny_size;          /* Size of 'tiny' objects in heap             */
00091     hsize_t tiny_nobjs;         /* Number of 'tiny' objects in heap           */
00092 } H5HF_stat_t;
00093 
00094 /* Fractal heap info (forward decl - defined in H5HFpkg.h) */
00095 typedef struct H5HF_t H5HF_t;
00096 
00097 /* Typedef for 'op' operations */
00098 typedef herr_t (*H5HF_operator_t)(const void *obj/*in*/, size_t obj_len,
00099         void *op_data/*in,out*/);
00100 
00101 /*****************************/
00102 /* Library-private Variables */
00103 /*****************************/
00104 
00105 
00106 /***************************************/
00107 /* Library-private Function Prototypes */
00108 /***************************************/
00109 
00110 /* General routines for fractal heap operations */
00111 H5_DLL H5HF_t *H5HF_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam);
00112 H5_DLL H5HF_t *H5HF_open(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr);
00113 H5_DLL herr_t H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p/*out*/);
00114 H5_DLL herr_t H5HF_get_heap_addr(H5HF_t *fh, haddr_t *heap_addr/*out*/);
00115 H5_DLL herr_t H5HF_insert(H5HF_t *fh, hid_t dxpl_id, size_t size,
00116     const void *obj, void *id/*out*/);
00117 H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *id,
00118     size_t *obj_len_p/*out*/);
00119 H5_DLL herr_t H5HF_read(H5HF_t *fh, hid_t dxpl_id, const void *id,
00120     void *obj/*out*/);
00121 H5_DLL herr_t H5HF_write(H5HF_t *fh, hid_t dxpl_id, void *id, hbool_t *id_changed,
00122     const void *obj);
00123 H5_DLL herr_t H5HF_op(H5HF_t *fh, hid_t dxpl_id, const void *id,
00124     H5HF_operator_t op, void *op_data);
00125 H5_DLL herr_t H5HF_remove(H5HF_t *fh, hid_t dxpl_id, const void *id);
00126 H5_DLL herr_t H5HF_close(H5HF_t *fh, hid_t dxpl_id);
00127 H5_DLL herr_t H5HF_delete(H5F_t *f, hid_t dxpl_id, haddr_t fh_addr);
00128 
00129 /* Statistics routines */
00130 H5_DLL herr_t H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats);
00131 H5_DLL herr_t H5HF_size(const H5HF_t *fh, hid_t dxpl_id, hsize_t *heap_size/*out*/);
00132 
00133 /* Debugging routines */
00134 #ifdef H5HF_DEBUGGING
00135 H5_DLL herr_t H5HF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
00136     FILE *stream, int indent, int fwidth);
00137 #endif /* H5HF_DEBUGGING */
00138 
00139 #endif /* _H5HFprivate_H */
00140