00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 #ifndef _H5FSprivate_H
00028 #define _H5FSprivate_H
00029 
00030 
00031 #include "H5FSpublic.h"
00032 
00033 
00034 #include "H5Fprivate.h"         
00035 #include "H5FLprivate.h"        
00036 
00037 
00038 
00039 
00040 
00041 
00042 #define H5FS_CLS_GHOST_OBJ      0x01    
00043 
00044 
00045 #define H5FS_CLS_SEPAR_OBJ      0x02    
00046 
00047 
00048 #define H5FS_CLS_MERGE_SYM      0x04    
00049 
00050 
00051 #define H5FS_CLS_ADJUST_OK      0x08    
00052 
00053 
00054 
00055 
00056 
00057 #define H5FS_ADD_DESERIALIZING  0x01    
00058 
00059 #define H5FS_ADD_RETURNED_SPACE 0x02    
00060 
00061 
00062 
00063 
00064 
00065 #define H5FS_ADD_SKIP_VALID     0x04    
00066 
00067 
00068 
00069 
00070 
00071 #define H5FS_DESERIALIZE_NO_ADD  0x01   
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 typedef struct H5FS_t H5FS_t;
00084 
00085 
00086 typedef struct H5FS_section_info_t H5FS_section_info_t;
00087 
00088 
00089 typedef struct H5FS_section_class_t {
00090     
00091     const unsigned type;                
00092     size_t serial_size;                 
00093     unsigned flags;                     
00094     void *cls_private;                  
00095 
00096     
00097     herr_t (*init_cls)(struct H5FS_section_class_t *, void *);          
00098     herr_t (*term_cls)(struct H5FS_section_class_t *);                  
00099 
00100     
00101     herr_t (*add)(H5FS_section_info_t *, unsigned *, void *);       
00102     herr_t (*serialize)(const struct H5FS_section_class_t *, const H5FS_section_info_t *, uint8_t *);        
00103     H5FS_section_info_t *(*deserialize)(const struct H5FS_section_class_t *, hid_t dxpl_id, const uint8_t *, haddr_t, hsize_t, unsigned *);     
00104     htri_t (*can_merge)(const H5FS_section_info_t *, const H5FS_section_info_t *, void *);  
00105     herr_t (*merge)(H5FS_section_info_t *, H5FS_section_info_t *, void *);      
00106     htri_t (*can_shrink)(const H5FS_section_info_t *, void *);        
00107     herr_t (*shrink)(H5FS_section_info_t **, void *);   
00108     herr_t (*free)(H5FS_section_info_t *);              
00109     herr_t (*valid)(const struct H5FS_section_class_t *, const H5FS_section_info_t *);   
00110     H5FS_section_info_t *(*split)(H5FS_section_info_t *, hsize_t);     
00111     herr_t (*debug)(const H5FS_section_info_t *, FILE *, int , int );   
00112 } H5FS_section_class_t;
00113 
00114 
00115 typedef enum H5FS_section_state_t {
00116     H5FS_SECT_LIVE,             
00117     H5FS_SECT_SERIALIZED        
00118 } H5FS_section_state_t;
00119 
00120 
00121 struct H5FS_section_info_t {
00122     haddr_t     addr;                   
00123     hsize_t     size;                   
00124     unsigned    type;                   
00125     H5FS_section_state_t state;         
00126 };
00127 
00128 
00129 typedef enum H5FS_client_t {
00130     H5FS_CLIENT_FHEAP_ID = 0,   
00131     H5FS_CLIENT_FILE_ID,        
00132     H5FS_NUM_CLIENT_ID          
00133 } H5FS_client_t;
00134 
00135 
00136 typedef struct H5FS_create_t {
00137     H5FS_client_t client;               
00138     unsigned shrink_percent;            
00139     unsigned expand_percent;            
00140     unsigned max_sect_addr;             
00141     hsize_t max_sect_size;              
00142 } H5FS_create_t;
00143 
00144 
00145 typedef struct H5FS_stat_t {
00146     hsize_t tot_space;          
00147     hsize_t tot_sect_count;     
00148     hsize_t serial_sect_count;  
00149     hsize_t ghost_sect_count;   
00150 } H5FS_stat_t;
00151 
00152 
00153 
00154 typedef herr_t (*H5FS_operator_t)(const H5FS_section_info_t *sect,
00155         void *operator_data);
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 H5FL_SEQ_EXTERN(H5FS_section_class_t);
00164 
00165 
00166 
00167 
00168 
00169 
00170 
00171 H5_DLL H5FS_t *H5FS_create(H5F_t *f, hid_t dxpl_id, haddr_t *fs_addr,
00172     const H5FS_create_t *fs_create, size_t nclasses,
00173     const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold);
00174 H5_DLL H5FS_t *H5FS_open(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr,
00175     size_t nclasses, const H5FS_section_class_t *classes[], void *cls_init_udata, hsize_t alignment, hsize_t threshold);
00176 H5_DLL herr_t H5FS_size(const H5F_t *f, const H5FS_t *fspace, hsize_t *meta_size);
00177 H5_DLL herr_t H5FS_delete(H5F_t *f, hid_t dxpl_id, haddr_t fs_addr);
00178 H5_DLL herr_t H5FS_close(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace);
00179 
00180 
00181 H5_DLL herr_t H5FS_sect_add(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
00182     H5FS_section_info_t *node, unsigned flags, void *op_data);
00183 H5_DLL herr_t H5FS_sect_try_extend(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
00184     haddr_t addr, hsize_t size, hsize_t extra_requested);
00185 H5_DLL herr_t H5FS_sect_remove(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
00186     H5FS_section_info_t *node);
00187 H5_DLL htri_t H5FS_sect_find(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
00188     hsize_t request, H5FS_section_info_t **node);
00189 H5_DLL herr_t H5FS_sect_iterate(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace, H5FS_operator_t op, void *op_data);
00190 H5_DLL herr_t H5FS_sect_stats(const H5FS_t *fspace, hsize_t *tot_space,
00191     hsize_t *nsects);
00192 H5_DLL herr_t H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
00193     H5FS_section_info_t *sect, unsigned new_class);
00194 
00195 
00196 H5_DLL herr_t H5FS_stat_info(const H5FS_t *fh, H5FS_stat_t *stats);
00197 
00198 
00199 
00200 H5_DLL herr_t H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
00201     FILE *stream, int indent, int fwidth);
00202 H5_DLL herr_t H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
00203     FILE *stream, int indent, int fwidth, haddr_t fs_addr, haddr_t client_addr);
00204 H5_DLL herr_t H5FS_sect_debug(const H5FS_t *fspace, const H5FS_section_info_t *sect,
00205     FILE *stream, int indent, int fwidth);
00206 
00207 #endif 
00208