mirror of
https://github.com/fumiama/fumidb.git
synced 2026-06-08 20:10:25 +08:00
add some funcs of table
This commit is contained in:
12
src/file.c
12
src/file.c
@@ -37,6 +37,12 @@ uint64_t get_first_unused_block(int fd) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
uint64_t get_next_unused_block(int fd, uint64_t ptr) {
|
||||
if(lseek(fd, ptr, SEEK_SET) < 0) return EOF;
|
||||
readle64(fd, ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
int set_first_table(int fd, uint64_t ptr) {
|
||||
uint8_t buf[8];
|
||||
if(lseek(fd, 16, SEEK_SET) < 0) return EOF;
|
||||
@@ -50,3 +56,9 @@ uint64_t get_first_table(int fd) {
|
||||
readle64(fd, ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
uint64_t get_next_table(int fd, uint64_t ptr) {
|
||||
if(lseek(fd, ptr, SEEK_SET) < 0) return EOF;
|
||||
readle64(fd, ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user