Function report |
Source Code:block\partitions\efi.c |
Create Date:2022-07-28 17:31:43 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:mpare_gpts() - Search disk for valid GPT headers and PTEs*@pgpt: primary GPT header*@agpt: alternate GPT header*@lastlba: last LBA number* Description: Returns nothing. Sanity checks pgpt and agpt fields* and prints warnings on discrepancies.
Proto:static void compare_gpts(gpt_header *pgpt, gpt_header *agpt, u64 lastlba)
Type:void
Parameter:
| Type | Parameter | Name |
|---|---|---|
| gpt_header * | pgpt | |
| gpt_header * | agpt | |
| u64 | lastlba |
| 485 | error_found = 0 |
| 488 | If le64_to_cpu(my_lba) != le64_to_cpu(alternate_lba) Then |
| 489 | pr_warn("GPT:Primary header LBA != Alt. header alternate_lba\n") |
| 490 | pr_warn("GPT:%lld != %lld\n", (unsignedlonglong)le64_to_cpu(my_lba), (unsignedlonglong)le64_to_cpu(alternate_lba)) |
| 493 | error_found++ |
| 495 | If le64_to_cpu(alternate_lba) != le64_to_cpu(my_lba) Then |
| 496 | pr_warn("GPT:Primary header alternate_lba != Alt. header my_lba\n") |
| 497 | pr_warn("GPT:%lld != %lld\n", (unsignedlonglong)le64_to_cpu(alternate_lba), (unsignedlonglong)le64_to_cpu(my_lba)) |
| 500 | error_found++ |
| 502 | If le64_to_cpu(first_usable_lba) != le64_to_cpu(first_usable_lba) Then |
| 504 | pr_warn("GPT:first_usable_lbas don't match.\n") |
| 505 | pr_warn("GPT:%lld != %lld\n", (unsignedlonglong)le64_to_cpu(first_usable_lba), (unsignedlonglong)le64_to_cpu(first_usable_lba)) |
| 508 | error_found++ |
| 510 | If le64_to_cpu(last_usable_lba) != le64_to_cpu(last_usable_lba) Then |
| 512 | pr_warn("GPT:last_usable_lbas don't match.\n") |
| 513 | pr_warn("GPT:%lld != %lld\n", (unsignedlonglong)le64_to_cpu(last_usable_lba), (unsignedlonglong)le64_to_cpu(last_usable_lba)) |
| 516 | error_found++ |
| 518 | If efi_guidcmp(disk_guid, disk_guid) Then |
| 519 | pr_warn("GPT:disk_guids don't match.\n") |
| 520 | error_found++ |
| 522 | If le32_to_cpu(num_partition_entries) != le32_to_cpu(num_partition_entries) Then |
| 524 | pr_warn("GPT:num_partition_entries don't match: 0x%x != 0x%x\n", le32_to_cpu(num_partition_entries), le32_to_cpu(num_partition_entries)) |
| 528 | error_found++ |
| 530 | If le32_to_cpu(sizeof_partition_entry) != le32_to_cpu(sizeof_partition_entry) Then |
| 532 | pr_warn("GPT:sizeof_partition_entry values don't match: 0x%x != 0x%x\n", le32_to_cpu(sizeof_partition_entry), le32_to_cpu(sizeof_partition_entry)) |
| 536 | error_found++ |
| 538 | If le32_to_cpu(partition_entry_array_crc32) != le32_to_cpu(partition_entry_array_crc32) Then |
| 540 | pr_warn("GPT:partition_entry_array_crc32 values don't match: 0x%x != 0x%x\n", le32_to_cpu(partition_entry_array_crc32), le32_to_cpu(partition_entry_array_crc32)) |
| 544 | error_found++ |
| 546 | If le64_to_cpu(alternate_lba) != lastlba Then |
| 547 | pr_warn("GPT:Primary header thinks Alt. header is not at the end of the disk.\n") |
| 548 | pr_warn("GPT:%lld != %lld\n", (unsignedlonglong)le64_to_cpu(alternate_lba), (unsignedlonglong)lastlba) |
| 551 | error_found++ |
| 554 | If le64_to_cpu(my_lba) != lastlba Then |
| 555 | pr_warn("GPT:Alternate GPT header not at the end of the disk.\n") |
| 556 | pr_warn("GPT:%lld != %lld\n", (unsignedlonglong)le64_to_cpu(my_lba), (unsignedlonglong)lastlba) |
| 559 | error_found++ |
| 562 | If error_found Then pr_warn("GPT: Use GNU Parted to correct GPT errors.\n") |
| 564 | Return |
| Name | Describe |
|---|---|
| find_valid_gpt | d_valid_gpt() - Search disk for valid GPT headers and PTEs*@state: disk parsed partitions*@gpt: GPT header ptr, filled on return.*@ptes: PTEs ptr, filled on return.* Description: Returns 1 if valid, 0 on error. |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |