limine: Add media type to limine_file structure
This commit is contained in:
parent
012e7b0b67
commit
5c7578c54a
12
PROTOCOL.md
12
PROTOCOL.md
|
@ -752,16 +752,21 @@ struct limine_uuid {
|
||||||
uint8_t d[8];
|
uint8_t d[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define LIMINE_MEDIA_TYPE_GENERIC 0
|
||||||
|
#define LIMINE_MEDIA_TYPE_OPTICAL 1
|
||||||
|
#define LIMINE_MEDIA_TYPE_TFTP 2
|
||||||
|
|
||||||
struct limine_file {
|
struct limine_file {
|
||||||
uint64_t revision;
|
uint64_t revision;
|
||||||
void *address;
|
void *address;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
char *path;
|
char *path;
|
||||||
char *cmdline;
|
char *cmdline;
|
||||||
uint64_t partition_index;
|
uint32_t media_type;
|
||||||
uint32_t unused;
|
uint32_t unused;
|
||||||
uint32_t tftp_ip;
|
uint32_t tftp_ip;
|
||||||
uint32_t tftp_port;
|
uint32_t tftp_port;
|
||||||
|
uint32_t partition_index;
|
||||||
uint32_t mbr_disk_id;
|
uint32_t mbr_disk_id;
|
||||||
struct limine_uuid gpt_disk_uuid;
|
struct limine_uuid gpt_disk_uuid;
|
||||||
struct limine_uuid gpt_part_uuid;
|
struct limine_uuid gpt_part_uuid;
|
||||||
|
@ -774,11 +779,12 @@ struct limine_file {
|
||||||
* `size` - The size of the file.
|
* `size` - The size of the file.
|
||||||
* `path` - The path of the file within the volume, with a leading slash.
|
* `path` - The path of the file within the volume, with a leading slash.
|
||||||
* `cmdline` - A command line associated with the file.
|
* `cmdline` - A command line associated with the file.
|
||||||
* `partition_index` - 1-based partition index of the volume from which the
|
* `media_type` - Type of media file resides on.
|
||||||
file was loaded. If 0, it means invalid or unpartitioned.
|
|
||||||
* `tftp_ip` - If non-0, this is the IP of the TFTP server the file was loaded
|
* `tftp_ip` - If non-0, this is the IP of the TFTP server the file was loaded
|
||||||
from.
|
from.
|
||||||
* `tftp_port` - Likewise, but port.
|
* `tftp_port` - Likewise, but port.
|
||||||
|
* `partition_index` - 1-based partition index of the volume from which the
|
||||||
|
file was loaded. If 0, it means invalid or unpartitioned.
|
||||||
* `mbr_disk_id` - If non-0, this is the ID of the disk the file was loaded
|
* `mbr_disk_id` - If non-0, this is the ID of the disk the file was loaded
|
||||||
from as reported in its MBR.
|
from as reported in its MBR.
|
||||||
* `gpt_disk_uuid` - If non-0, this is the UUID of the disk the file was
|
* `gpt_disk_uuid` - If non-0, this is the UUID of the disk the file was
|
||||||
|
|
|
@ -47,11 +47,17 @@ static struct limine_file get_file(struct file_handle *file, char *cmdline) {
|
||||||
struct limine_file ret = {0};
|
struct limine_file ret = {0};
|
||||||
|
|
||||||
if (file->pxe) {
|
if (file->pxe) {
|
||||||
|
ret.media_type = LIMINE_MEDIA_TYPE_TFTP;
|
||||||
|
|
||||||
ret.tftp_ip = file->pxe_ip;
|
ret.tftp_ip = file->pxe_ip;
|
||||||
ret.tftp_port = file->pxe_port;
|
ret.tftp_port = file->pxe_port;
|
||||||
} else {
|
} else {
|
||||||
struct volume *vol = file->vol;
|
struct volume *vol = file->vol;
|
||||||
|
|
||||||
|
if (vol->is_optical) {
|
||||||
|
ret.media_type = LIMINE_MEDIA_TYPE_OPTICAL;
|
||||||
|
}
|
||||||
|
|
||||||
ret.partition_index = vol->partition;
|
ret.partition_index = vol->partition;
|
||||||
|
|
||||||
ret.mbr_disk_id = mbr_get_id(vol);
|
ret.mbr_disk_id = mbr_get_id(vol);
|
||||||
|
|
7
limine.h
7
limine.h
|
@ -24,16 +24,21 @@ struct limine_uuid {
|
||||||
uint8_t d[8];
|
uint8_t d[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define LIMINE_MEDIA_TYPE_GENERIC 0
|
||||||
|
#define LIMINE_MEDIA_TYPE_OPTICAL 1
|
||||||
|
#define LIMINE_MEDIA_TYPE_TFTP 2
|
||||||
|
|
||||||
struct limine_file {
|
struct limine_file {
|
||||||
uint64_t revision;
|
uint64_t revision;
|
||||||
LIMINE_PTR(void *) address;
|
LIMINE_PTR(void *) address;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
LIMINE_PTR(char *) path;
|
LIMINE_PTR(char *) path;
|
||||||
LIMINE_PTR(char *) cmdline;
|
LIMINE_PTR(char *) cmdline;
|
||||||
uint64_t partition_index;
|
uint32_t media_type;
|
||||||
uint32_t unused;
|
uint32_t unused;
|
||||||
uint32_t tftp_ip;
|
uint32_t tftp_ip;
|
||||||
uint32_t tftp_port;
|
uint32_t tftp_port;
|
||||||
|
uint32_t partition_index;
|
||||||
uint32_t mbr_disk_id;
|
uint32_t mbr_disk_id;
|
||||||
struct limine_uuid gpt_disk_uuid;
|
struct limine_uuid gpt_disk_uuid;
|
||||||
struct limine_uuid gpt_part_uuid;
|
struct limine_uuid gpt_part_uuid;
|
||||||
|
|
|
@ -106,6 +106,7 @@ static void print_file(struct limine_file *file) {
|
||||||
e9_printf("File->Size: %x", file->size);
|
e9_printf("File->Size: %x", file->size);
|
||||||
e9_printf("File->Path: %s", file->path);
|
e9_printf("File->Path: %s", file->path);
|
||||||
e9_printf("File->CmdLine: %s", file->cmdline);
|
e9_printf("File->CmdLine: %s", file->cmdline);
|
||||||
|
e9_printf("File->MediaType: %d", file->media_type);
|
||||||
e9_printf("File->PartIndex: %d", file->partition_index);
|
e9_printf("File->PartIndex: %d", file->partition_index);
|
||||||
e9_printf("File->TFTPIP: %d.%d.%d.%d",
|
e9_printf("File->TFTPIP: %d.%d.%d.%d",
|
||||||
(file->tftp_ip & (0xff << 0)) >> 0,
|
(file->tftp_ip & (0xff << 0)) >> 0,
|
||||||
|
|
Loading…
Reference in New Issue