gpt/gpt.c
gpt_partition_range gpt_find_partition_by_guid(const void* entries, const gpt_guid* guid, uint32_t num_entries)
{
  gpt_partition_entry* gpt_entries = (gpt_partition_entry*) entries;
  for (uint32_t i = 0; i < num_entries; i++) {
    if (guid_equal(&gpt_entries[i].partition_type_guid, guid)) {
      return (gpt_partition_range) {
        .first_lba = gpt_entries[i].first_lba,
        .last_lba = gpt_entries[i].last_lba,
      };
    }
  }
  return (gpt_partition_range) { .first_lba = 0, .last_lba = 0 };
}
/**
 * Search the given block of partition entries for a partition with the given
 * GUID. Return a range of [0, 0] to indicate that the partition was not found.
 */
Search the given block of partition entries for a partition with the given
GUID. Return a range of [0, 0] to indicate that the partition was not found.
Search the given block of partition entries for a partition with the given GUID . Return a range of [ 0 0 ] to indicate that the partition was not found .
gpt_partition_range gpt_find_partition_by_guid(const void* entries, const gpt_guid* guid, uint32_t num_entries)
{
  gpt_partition_entry* gpt_entries = (gpt_partition_entry*) entries;
  for (uint32_t i = 0; i < num_entries; i++) {
    if (guid_equal(&gpt_entries[i].partition_type_guid, guid)) {
      return (gpt_partition_range) {
        .first_lba = gpt_entries[i].first_lba,
        .last_lba = gpt_entries[i].last_lba,
      };
    }
  }
  return (gpt_partition_range) { .first_lba = 0, .last_lba = 0 };
}
gpt_partition_range gpt_find_partition_by_guid ( const void * entries , const gpt_guid * guid , uint32_t num_entries ) { gpt_partition_entry * gpt_entries = ( gpt_partition_entry * ) entries ; for ( uint32_t i = 0 ; i < num_entries ; i ++ ) { if ( guid_equal ( & gpt_entries [ i ] . partition_type_guid , guid ) ) { return ( gpt_partition_range ) { . first_lba = gpt_entries [ i ] . first_lba , . last_lba = gpt_entries [ i ] . last_lba , } ; } } return ( gpt_partition_range ) { . first_lba = 0 , . last_lba = 0 } ; }
Search the given block of partition entries for a partition with the given
 GUID.
Search the given block of partition entries for a partition with the given GUID .