blob: 48501dccc23df91e1d07206964ac6e36867d69ab [file] [log] [blame]
#ifndef TUX3_DLEAF_H
#define TUX3_DLEAF_H
struct dleaf_req {
struct btree_key_range key; /* index and count */
int seg_cnt; /* How many segs are available */
int seg_max; /* Max size of seg[] */
struct block_segment *seg; /* Pointer to seg[] */
int seg_idx; /* use by dleaf_write() internally */
int overwrite;
/* Callback to allocate blocks to ->seg for write */
int (*seg_find)(struct btree *, struct dleaf_req *, int, unsigned,
unsigned *);
int (*seg_alloc)(struct btree *, struct dleaf_req *, int);
void (*seg_free)(struct btree *, block_t, unsigned);
};
static inline unsigned seg_total_count(struct block_segment *seg, int nr_segs)
{
unsigned total = 0;
int i;
for (i = 0; i < nr_segs; i++)
total += seg[i].count;
return total;
}
#endif /* !TUX3_DLEAF_H */