26 lines
714 B
C
26 lines
714 B
C
#ifndef FILE_SYSTEM_INCLUDED
|
|
#define FILE_SYSTEM_INCLUDED
|
|
|
|
#include "basic.h"
|
|
|
|
typedef struct {
|
|
uint64_t data;
|
|
} Handle;
|
|
|
|
int file_open(string path, Handle *fd);
|
|
void file_close(Handle fd);
|
|
int file_lock(Handle fd);
|
|
int file_unlock(Handle fd);
|
|
int file_sync(Handle fd);
|
|
int file_read(Handle fd, char *dst, int max);
|
|
int file_write(Handle fd, char *src, int len);
|
|
int file_size(Handle fd, size_t *len);
|
|
int file_write_atomic(string path, string content);
|
|
int create_dir(string path);
|
|
int rename_file_or_dir(string oldpath, string newpath);
|
|
int remove_file_or_dir(string path);
|
|
int get_full_path(string path, char *dst);
|
|
int file_read_all(string path, string *data);
|
|
|
|
#endif // FILE_SYSTEM_INCLUDED
|