loader/gpt.c
GPT_ENTRY * FindPartWithGuid(EFI_GUID *Guid) {
   UINTN     i;
   GPT_ENTRY *Found = NULL;
   GPT_DATA  *GptData;

   if ((Guid == NULL) || (gPartitions == NULL))
      return NULL;

   GptData = gPartitions;
   while ((GptData != NULL) && (!Found)) {
      i = 0;
      while ((i < GptData->Header->entry_count) && (!Found)) {
         if (GuidsAreEqual((EFI_GUID*) &(GptData->Entries[i].partition_guid), Guid)) {
            Found = AllocateZeroPool(sizeof(GPT_ENTRY));
            CopyMem(Found, &GptData->Entries[i], sizeof(GPT_ENTRY));
         } else {
            i++;
         } // if/else
      } // while(scanning entries)
      GptData = GptData->NextEntry;
   } // while(scanning GPTs)
   return Found;
}
// Look in gPartitions for a partition with the specified Guid. If found, return
// a pointer to that partition's data. If not found, return a NULL pointer.
// The calling function is responsible for freeing the returned memory.
Look in gPartitions for a partition with the specified Guid. If found, return
a pointer to that partition's data. If not found, return a NULL pointer.
The calling function is responsible for freeing the returned memory.
Look in gPartitions for a partition with the specified Guid . If found return a pointer to that partition ' s data . If not found return a NULL pointer . The calling function is responsible for freeing the returned memory .
GPT_ENTRY * FindPartWithGuid(EFI_GUID *Guid) {
   UINTN     i;
   GPT_ENTRY *Found = NULL;
   GPT_DATA  *GptData;
   if ((Guid == NULL) || (gPartitions == NULL))
      return NULL;
   GptData = gPartitions;
   while ((GptData != NULL) && (!Found)) {
      i = 0;
      while ((i < GptData->Header->entry_count) && (!Found)) {
         if (GuidsAreEqual((EFI_GUID*) &(GptData->Entries[i].partition_guid), Guid)) {
            Found = AllocateZeroPool(sizeof(GPT_ENTRY));
            CopyMem(Found, &GptData->Entries[i], sizeof(GPT_ENTRY));
         } else {
            i++;
         } 
      } 
      GptData = GptData->NextEntry;
   } 
   return Found;
}
GPT_ENTRY * FindPartWithGuid ( EFI_GUID * Guid ) { UINTN i ; GPT_ENTRY * Found = NULL ; GPT_DATA * GptData ; if ( ( Guid == NULL ) || ( gPartitions == NULL ) ) return NULL ; GptData = gPartitions ; while ( ( GptData != NULL ) && ( ! Found ) ) { i = 0 ; while ( ( i < GptData -> Header -> entry_count ) && ( ! Found ) ) { if ( GuidsAreEqual ( ( EFI_GUID * ) & ( GptData -> Entries [ i ] . partition_guid ) , Guid ) ) { Found = AllocateZeroPool ( sizeof ( GPT_ENTRY ) ) ; CopyMem ( Found , & GptData -> Entries [ i ] , sizeof ( GPT_ENTRY ) ) ; } else { i ++ ; } } GptData = GptData -> NextEntry ; } return Found ; }
Look in gPartitions for a partition with the specified Guid.
Look in gPartitions for a partition with the specified Guid .
// if/else // while(scanning entries) // while(scanning GPTs)