Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: fs/partitions/efi.c

Issue 3026039: [RFC] CHROMIUM: Two patches for comments: EFI GUID boot for dm-verity (Closed) Base URL: http://src.chromium.org/git/kernel.git
Patch Set: fix desc. dont always wait Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « drivers/md/dm-verity.c ('k') | include/linux/efi.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /************************************************************ 1 /************************************************************
2 * EFI GUID Partition Table handling 2 * EFI GUID Partition Table handling
3 * 3 *
4 * http://www.uefi.org/specs/ 4 * http://www.uefi.org/specs/
5 * http://www.intel.com/technology/efi/ 5 * http://www.intel.com/technology/efi/
6 * 6 *
7 * efi.[ch] by Matt Domsch <Matt_Domsch@dell.com> 7 * efi.[ch] by Matt Domsch <Matt_Domsch@dell.com>
8 * Copyright 2000,2001,2002,2004 Dell Inc. 8 * Copyright 2000,2001,2002,2004 Dell Inc.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 /* If this is a RAID volume, tell md */ 630 /* If this is a RAID volume, tell md */
631 if (!efi_guidcmp(ptes[i].partition_type_guid, 631 if (!efi_guidcmp(ptes[i].partition_type_guid,
632 PARTITION_LINUX_RAID_GUID)) 632 PARTITION_LINUX_RAID_GUID))
633 state->parts[i+1].flags = 1; 633 state->parts[i+1].flags = 1;
634 } 634 }
635 kfree(ptes); 635 kfree(ptes);
636 kfree(gpt); 636 kfree(gpt);
637 printk("\n"); 637 printk("\n");
638 return 1; 638 return 1;
639 } 639 }
640
641 /**
642 * efi_find_partition(efi_guid_t *guid, struct block_device *bdev)
643 * @guid
644 * @bdev
645 *
646 * Returns:
647 * -1 if an error occurred
648 * 0 if there was no match (or not GPT)
649 * >=1 is the index of the partition found.
650 *
651 */
652 int efi_find_partition(efi_guid_t *guid, struct block_device *bdev) {
653 gpt_header *gpt = NULL;
654 gpt_entry *ptes = NULL;
655 u32 i;
656 struct parsed_partitions *state;
657 int part = 0;
658
659 if (!bdev || !guid)
660 return -1;
661
662 state = kzalloc(sizeof(struct parsed_partitions), GFP_KERNEL);
663 if (!state)
664 return -1;
665
666 state->limit = disk_max_parts(bdev->bd_disk);
667 pr_debug(KERN_WARNING "efi_find_partition looking for gpt\n");
668
669 if (!find_valid_gpt(bdev, &gpt, &ptes) || !gpt || !ptes) {
670 pr_debug(KERN_WARNING "efi_find_partition no GPT\n");
671 kfree(gpt);
672 kfree(ptes);
673 kfree(state);
674 return 0;
675 }
676
677 pr_debug("GUID Partition Table is valid! Yea!\n");
678
679 pr_debug(KERN_WARNING "efi_find_partition: 0 -> %d (limit:%d)\n",
680 le32_to_cpu(gpt->num_partition_entries),
681 state->limit);
682 for (i = 0; i < le32_to_cpu(gpt->num_partition_entries) &&
683 i < state->limit-1; i++) {
684 if (!is_pte_valid(&ptes[i], last_lba(bdev)))
685 continue;
686
687 /* Bails on first hit so duped "unique" GUIDs will be FCFS. */
688 if (!efi_guidcmp(ptes[i].unique_partition_guid,
689 *guid)) {
690 part = i + 1;
691 break;
692 }
693 }
694 kfree(ptes);
695 kfree(gpt);
696 kfree(state);
697 return part;
698 }
OLDNEW
« no previous file with comments | « drivers/md/dm-verity.c ('k') | include/linux/efi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698