2020-01-23 03:48:35 +03:00
|
|
|
#ifndef __FS__ECHFS_H__
|
|
|
|
#define __FS__ECHFS_H__
|
2020-01-22 03:55:40 +03:00
|
|
|
|
2020-03-15 02:12:09 +03:00
|
|
|
#include <stdint.h>
|
2020-11-01 23:25:35 +03:00
|
|
|
#include <stdbool.h>
|
2020-04-15 14:21:44 +03:00
|
|
|
#include <lib/part.h>
|
2020-11-01 23:25:35 +03:00
|
|
|
#include <lib/blib.h>
|
2020-03-15 02:12:09 +03:00
|
|
|
|
|
|
|
struct echfs_dir_entry {
|
|
|
|
uint64_t parent_id;
|
|
|
|
uint8_t type;
|
|
|
|
char name[201];
|
|
|
|
uint64_t atime;
|
|
|
|
uint64_t mtime;
|
|
|
|
uint16_t perms;
|
|
|
|
uint16_t owner;
|
|
|
|
uint16_t group;
|
|
|
|
uint64_t ctime;
|
|
|
|
uint64_t payload;
|
|
|
|
uint64_t size;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct echfs_file_handle {
|
2021-03-04 11:15:10 +03:00
|
|
|
struct volume *part;
|
2020-03-15 02:12:09 +03:00
|
|
|
uint64_t block_size;
|
|
|
|
uint64_t block_count;
|
|
|
|
uint64_t dir_length;
|
|
|
|
uint64_t alloc_table_size;
|
|
|
|
uint64_t alloc_table_offset;
|
|
|
|
uint64_t dir_offset;
|
2021-10-21 02:27:05 +03:00
|
|
|
uint64_t file_block_count;
|
2020-04-19 01:58:33 +03:00
|
|
|
uint64_t *alloc_map;
|
2020-03-15 02:12:09 +03:00
|
|
|
struct echfs_dir_entry dir_entry;
|
|
|
|
};
|
|
|
|
|
2021-02-06 16:40:55 +03:00
|
|
|
int echfs_check_signature(struct volume *part);
|
|
|
|
bool echfs_get_guid(struct guid *guid, struct volume *part);
|
2020-04-14 06:20:55 +03:00
|
|
|
|
2021-10-21 02:27:05 +03:00
|
|
|
bool echfs_open(struct echfs_file_handle *ret, struct volume *part, const char *filename);
|
|
|
|
void echfs_read(struct echfs_file_handle *file, void *buf, uint64_t loc, uint64_t count);
|
|
|
|
void echfs_close(struct echfs_file_handle *file);
|
2020-01-22 03:55:40 +03:00
|
|
|
|
|
|
|
#endif
|