part: Implement unified namespace between GPT partition UUIDs and filesystem UUIDs
This commit is contained in:
parent
7545864f5b
commit
08d53bff58
@ -101,5 +101,5 @@ The format for `root` changes depending on the resource used.
|
||||
A resource can be one of the following:
|
||||
* `boot` - The `root` is the 1-based decimal value representing the partition on the boot drive. If omitted, the partition containing the configuration file on the boot drive is used. For example: `boot://2/...` will use partition 2 of the boot drive and `boot:///...` will use the partition containing the config file on the boot drive.
|
||||
* `bios` - The `root` takes the form of `drive:partition`; for example: `bios://3:1/...` would use BIOS drive 3, partition 1. Partitions and BIOS drives are both 1-based. Omitting the drive is possible; for example: `bios://:2/...`. Omitting the drive makes Limine use the boot drive.
|
||||
* `guid` - The `root` takes the form of a GUID/UUID, such as `guid://736b5698-5ae1-4dff-be2c-ef8f44a61c52/...`. It is a filesystem GUID and not a partition GUID.
|
||||
* `tftp` - The `root` is the ip address of the tftp server to load the file from, if the root is left empty (`tftp:///file.elf`) the file will be loaded from the server limine booted from.
|
||||
* `guid` - The `root` takes the form of a GUID/UUID, such as `guid://736b5698-5ae1-4dff-be2c-ef8f44a61c52/...`. The GUID is that of either a filesystem, when available, or a GPT partition GUID, when using GPT, in a unified namespace.
|
||||
* `tftp` - The `root` is the IP address of the tftp server to load the file from. If the root is left empty (`tftp:///...`) the file will be loaded from the server Limine booted from. This resource is only available when booting off PXE.
|
||||
|
BIN
limine-pxe.bin
BIN
limine-pxe.bin
Binary file not shown.
BIN
limine.bin
BIN
limine.bin
Binary file not shown.
BIN
stage2.map
BIN
stage2.map
Binary file not shown.
@ -88,6 +88,9 @@ static int gpt_get_part(struct part *ret, int drive, int partition) {
|
||||
ret->guid = guid;
|
||||
}
|
||||
|
||||
ret->part_guid_valid = true;
|
||||
ret->part_guid = entry.unique_partition_guid;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -137,6 +140,8 @@ static int mbr_get_part(struct part *ret, int drive, int partition) {
|
||||
ret->guid = guid;
|
||||
}
|
||||
|
||||
ret->part_guid_valid = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -205,15 +210,21 @@ load_up:
|
||||
}
|
||||
|
||||
bool part_get_by_guid(struct part *part, struct guid *guid) {
|
||||
for (size_t i = 0; i < part_index_i; i++) {
|
||||
if (!part_index[i].guid_valid)
|
||||
continue;
|
||||
if (!memcmp(&part_index[i].guid, guid, 16)) {
|
||||
*part = part_index[i];
|
||||
return true;
|
||||
size_t i;
|
||||
for (i = 0; i < part_index_i; i++) {
|
||||
if (part_index[i].guid_valid
|
||||
&& memcmp(&part_index[i].guid, guid, 16) == 0) {
|
||||
goto found;
|
||||
}
|
||||
if (part_index[i].part_guid_valid
|
||||
&& memcmp(&part_index[i].part_guid, guid, 16) == 0) {
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
found:
|
||||
*part = part_index[i];
|
||||
return true;
|
||||
}
|
||||
|
||||
int part_read(struct part *part, void *buffer, uint64_t loc, uint64_t count) {
|
||||
|
@ -17,6 +17,8 @@ struct part {
|
||||
uint64_t sect_count;
|
||||
bool guid_valid;
|
||||
struct guid guid;
|
||||
bool part_guid_valid;
|
||||
struct guid part_guid;
|
||||
};
|
||||
|
||||
void part_create_index(void);
|
||||
|
Loading…
Reference in New Issue
Block a user