|
|
@ -10,6 +10,12 @@ typedef struct { |
|
|
|
const char *errstr; |
|
|
|
const char *errstr; |
|
|
|
} db_t; |
|
|
|
} db_t; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
|
|
|
|
uint64_t start; |
|
|
|
|
|
|
|
size_t records; |
|
|
|
|
|
|
|
unsigned char *data; |
|
|
|
|
|
|
|
} block_t; |
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
typedef struct { |
|
|
|
uint64_t num; |
|
|
|
uint64_t num; |
|
|
|
unsigned char data[REC_LEN]; |
|
|
|
unsigned char data[REC_LEN]; |
|
|
@ -21,8 +27,8 @@ extern int db_close(db_t *db); |
|
|
|
extern int db_rd_rec(db_t *db, rec_t *rec); |
|
|
|
extern int db_rd_rec(db_t *db, rec_t *rec); |
|
|
|
extern int db_wr_rec(db_t *db, rec_t *rec); |
|
|
|
extern int db_wr_rec(db_t *db, rec_t *rec); |
|
|
|
|
|
|
|
|
|
|
|
extern int db_rd_blk(db_t *db, uint64_t start, size_t len, rec_t *list); |
|
|
|
extern int db_rd_blk(db_t *db, block_t *blk); |
|
|
|
extern int db_wr_blk(db_t *db, uint64_t start, size_t len, rec_t *list); |
|
|
|
extern int db_wr_blk(db_t *db, block_t *blk); |
|
|
|
|
|
|
|
|
|
|
|
extern int db_rd_list(db_t *db, rec_t *list, size_t list_len); |
|
|
|
extern int db_rd_list(db_t *db, rec_t *list, size_t list_len); |
|
|
|
extern int db_wr_list(db_t *db, rec_t *list, size_t list_len); |
|
|
|
extern int db_wr_list(db_t *db, rec_t *list, size_t list_len); |
|
|
|