| 1 | #ifndef FS__FILE_H__ |
| 2 | #define FS__FILE_H__ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | #include <stddef.h> |
| 6 | #include <stdbool.h> |
| 7 | #include <lib/part.h> |
| 8 | #if defined (UEFI) |
| 9 | # include <efi.h> |
| 10 | #endif |
| 11 | |
| 12 | extern bool case_insensitive_fopen; |
| 13 | |
| 14 | bool fs_get_guid(struct guid *guid, struct volume *part); |
| 15 | char *fs_get_label(struct volume *part); |
| 16 | |
| 17 | struct file_handle { |
| 18 | bool is_memfile; |
| 19 | bool readall; |
| 20 | bool is_high_mem; |
| 21 | struct volume *vol; |
| 22 | char *path; |
| 23 | size_t path_len; |
| 24 | void *fd; |
| 25 | uint64_t (*read)(void *fd, void *buf, uint64_t loc, uint64_t count); |
| 26 | void (*close)(void *fd); |
| 27 | uint64_t size; |
| 28 | uint64_t load_addr_64; |
| 29 | #if defined (UEFI) |
| 30 | EFI_HANDLE efi_part_handle; |
| 31 | #endif |
| 32 | bool pxe; |
| 33 | uint32_t pxe_ip; |
| 34 | uint16_t pxe_port; |
| 35 | }; |
| 36 | |
| 37 | struct file_handle *fopen(struct volume *part, const char *filename); |
| 38 | uint64_t fread(struct file_handle *fd, void *buf, uint64_t loc, uint64_t count); |
| 39 | void fclose(struct file_handle *fd); |
| 40 | |
| 41 | #endif |