limine/common/fs/file.h

41 lines
968 B
C
Raw Normal View History

2020-04-14 06:20:55 +03:00
#ifndef __FS__FILE_H__
#define __FS__FILE_H__
#include <stdint.h>
#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>
#if defined (UEFI)
# include <efi.h>
#endif
2020-11-01 23:25:35 +03:00
extern bool case_insensitive_fopen;
bool fs_get_guid(struct guid *guid, struct volume *part);
char *fs_get_label(struct volume *part);
2020-04-14 06:20:55 +03:00
struct file_handle {
bool is_memfile;
2021-10-21 02:27:05 +03:00
bool readall;
struct volume *vol;
char *path;
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;
#if defined (UEFI)
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);
void *freadall(struct file_handle *fd, uint32_t type);
2020-04-14 06:20:55 +03:00
#endif