2020-04-14 06:20:55 +03:00
|
|
|
#ifndef __FS__FILE_H__
|
|
|
|
#define __FS__FILE_H__
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2021-01-02 23:44:27 +03:00
|
|
|
#include <stddef.h>
|
2020-11-01 23:25:35 +03:00
|
|
|
#include <stdbool.h>
|
2020-11-02 12:17:20 +03:00
|
|
|
#include <lib/part.h>
|
2021-09-27 05:04:15 +03:00
|
|
|
#if uefi == 1
|
|
|
|
# include <efi.h>
|
|
|
|
#endif
|
2020-11-01 23:25:35 +03:00
|
|
|
|
2021-02-06 16:40:55 +03:00
|
|
|
bool fs_get_guid(struct guid *guid, struct volume *part);
|
2020-04-14 06:20:55 +03:00
|
|
|
|
|
|
|
struct file_handle {
|
2021-01-02 23:44:27 +03:00
|
|
|
bool is_memfile;
|
2021-10-21 02:27:05 +03:00
|
|
|
bool readall;
|
2021-11-24 14:24:17 +03:00
|
|
|
struct volume *vol;
|
2020-04-14 06:20:55 +03:00
|
|
|
void *fd;
|
2021-10-21 02:27:05 +03:00
|
|
|
void (*read)(void *fd, void *buf, uint64_t loc, uint64_t count);
|
|
|
|
void (*close)(void *fd);
|
2020-04-14 06:20:55 +03:00
|
|
|
uint64_t size;
|
2021-09-27 05:04:15 +03:00
|
|
|
#if uefi == 1
|
|
|
|
EFI_HANDLE efi_part_handle;
|
|
|
|
#endif
|
2020-04-14 06:20:55 +03:00
|
|
|
};
|
|
|
|
|
2021-10-21 02:27:05 +03:00
|
|
|
struct file_handle *fopen(struct volume *part, const char *filename);
|
|
|
|
void fread(struct file_handle *fd, void *buf, uint64_t loc, uint64_t count);
|
|
|
|
void fclose(struct file_handle *fd);
|
2021-01-02 23:44:27 +03:00
|
|
|
void *freadall(struct file_handle *fd, uint32_t type);
|
2020-04-14 06:20:55 +03:00
|
|
|
|
|
|
|
#endif
|