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>
|
2022-09-02 03:29:12 +03:00
|
|
|
#if defined (UEFI)
|
2021-09-27 05:04:15 +03:00
|
|
|
# include <efi.h>
|
|
|
|
#endif
|
2020-11-01 23:25:35 +03:00
|
|
|
|
2022-09-01 15:02:53 +03:00
|
|
|
extern bool case_insensitive_fopen;
|
|
|
|
|
2021-02-06 16:40:55 +03:00
|
|
|
bool fs_get_guid(struct guid *guid, struct volume *part);
|
2022-07-02 11:43:10 +03:00
|
|
|
char *fs_get_label(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;
|
2022-07-07 11:08:55 +03:00
|
|
|
char *path;
|
2023-01-20 19:27:41 +03:00
|
|
|
size_t path_len;
|
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;
|
2022-09-02 03:29:12 +03:00
|
|
|
#if defined (UEFI)
|
2021-09-27 05:04:15 +03:00
|
|
|
EFI_HANDLE efi_part_handle;
|
|
|
|
#endif
|
2022-03-18 01:46:48 +03:00
|
|
|
bool pxe;
|
|
|
|
uint32_t pxe_ip;
|
|
|
|
uint16_t pxe_port;
|
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
|