#ifndef cdc_tbl_h__
#define cdc_tbl_h__
/*
* cdc_tbl.h -- common table code
* december 2000, Kyle York
*
*/
typedef struct cdc_tbl cdc_tbl_t;
typedef int (*cdc_tbl_create_fn_t)(cdc_t *, cdc_tbl_t *);
struct cdc_tbl
{
unsigned long count; /* # of tables */
unsigned long blocks; /* blocks / cluster */
unsigned long entries; /* table entries / cluster */
unsigned long block_offset;
unsigned long phantom_value;
int is_phantom; /* non-zero if the table
doesn't exist */
cdc_tbl_create_fn_t create_fn;
struct
{
int dirty; /* non-0 if this page is dirty */
unsigned long block; /* file block number */
unsigned long *data; /* buffer */
} buffer;
comprio_counter_t counter;
};
int cdc_tbl_init(
cdc_t *cdc,
cdc_tbl_t *tbl,
unsigned long blocks,
unsigned long phantom_value,
unsigned long block_offset,
cdc_tbl_create_fn_t create_fn
);
int cdc_tbl_cleanup(cdc_t *cdc, cdc_tbl_t *tbl);
int cdc_tbl_create(cdc_t *cdc, cdc_tbl_t *tbl);
int cdc_tbl_flush(cdc_t *cdc, cdc_tbl_t *tbl);
int cdc_tbl_entry_get(
cdc_t *cdc,
cdc_tbl_t *tbl,
unsigned long entry,
unsigned long *value
);
int cdc_tbl_entry_set(
cdc_t *cdc,
cdc_tbl_t *tbl,
unsigned long entry,
unsigned long value
);
#endif /* cdc_tbl_h__ */
End of Listing