1
0
mirror of https://github.com/fumiama/fumidb.git synced 2026-06-06 01:00:32 +08:00
Files
fumidb/include/file.h
源文雨 67b9176615 add types
2022-05-01 21:16:17 +08:00

38 lines
759 B
C

#ifndef _FILE_H_
#define _FILE_H_
#include <stdint.h>
#define HEADERSZ 256
// 初始化并写入数据库文件头
// 返回:
// 0 成功
// 1 write 失败
// EOF lseek 失败
int init_file_header_page(int fd);
// 获得数据库版本
uint16_t get_db_version(int fd);
// 设置 ptr of unused blk 字段
// 返回:
// 0 成功
// 1 write 失败
// EOF lseek 失败
int set_first_unused_block(int fd, uint64_t ptr);
// 获得 ptr of unused blk 字段
uint64_t get_first_unused_block(int fd);
// 设置 ptr of next table 字段
// 返回:
// 0 成功
// 1 write 失败
// EOF lseek 失败
int set_first_table(int fd, uint64_t ptr);
// 获得 ptr of next table 字段
uint64_t get_first_table(int fd);
#endif