Function report |
Source Code:block\partitions\efi.c |
Create Date:2022-07-28 17:31:35 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:s_gpt_valid() - tests one GPT header and PTEs for validity*@state: disk parsed partitions*@lba: logical block address of the GPT header to test*@gpt: GPT header ptr, filled on return.*@ptes: PTEs ptr, filled on return.
Proto:static int is_gpt_valid(struct parsed_partitions *state, u64 lba, gpt_header **gpt, gpt_entry **ptes)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct parsed_partitions * | state | |
| u64 | lba | |
| gpt_header ** | gpt | |
| gpt_entry ** | ptes |
| 343 | If Not ptes Then Return 0 |
| 349 | If le64_to_cpu(signature) != GPT_HEADER_SIGNATURE Then |
| 350 | pr_debug("GUID Partition Table Header signature is wrong:%lld != %lld\n", (unsignedlonglong)le64_to_cpu(signature), (unsignedlonglong)GPT_HEADER_SIGNATURE) |
| 354 | Go to fail |
| 358 | If le32_to_cpu(header_size) > bdev_logical_block_size(bdev) Then |
| 360 | pr_debug("GUID Partition Table Header size is too large: %u > %u\n", le32_to_cpu(header_size), bdev_logical_block_size(bdev)) |
| 363 | Go to fail |
| 367 | If le32_to_cpu(header_size) < sizeof(gpt_header) Then |
| 368 | pr_debug("GUID Partition Table Header size is too small: %u < %zu\n", le32_to_cpu(header_size), sizeof(gpt_header)) |
| 371 | Go to fail |
| 375 | origcrc = le32_to_cpu(header_crc32) |
| 376 | header_crc32 = 0 |
| 384 | header_crc32 = cpu_to_le32(origcrc) |
| 388 | If le64_to_cpu(my_lba) != lba Then |
| 389 | pr_debug("GPT my_lba incorrect: %lld != %lld\n", (unsignedlonglong)le64_to_cpu(my_lba), (unsignedlonglong)lba) |
| 392 | Go to fail |
| 399 | If le64_to_cpu(first_usable_lba) > lastlba Then |
| 400 | pr_debug("GPT: first_usable_lba incorrect: %lld > %lld\n", (unsignedlonglong)le64_to_cpu(first_usable_lba), (unsignedlonglong)lastlba) |
| 403 | Go to fail |
| 405 | If le64_to_cpu(last_usable_lba) > lastlba Then |
| 406 | pr_debug("GPT: last_usable_lba incorrect: %lld > %lld\n", (unsignedlonglong)le64_to_cpu(last_usable_lba), (unsignedlonglong)lastlba) |
| 409 | Go to fail |
| 411 | If le64_to_cpu(last_usable_lba) < le64_to_cpu(first_usable_lba) Then |
| 412 | pr_debug("GPT: last_usable_lba incorrect: %lld > %lld\n", (unsignedlonglong)le64_to_cpu(last_usable_lba), (unsignedlonglong)le64_to_cpu(first_usable_lba)) |
| 415 | Go to fail |
| 418 | If le32_to_cpu(sizeof_partition_entry) != sizeof(gpt_entry) Then |
| 426 | If pt_size > Maximum allocatable size Then |
| 427 | pr_debug("GUID Partition Table is too large: %llu > %lu bytes\n", (unsignedlonglong)pt_size, Maximum allocatable size ) |
| 429 | Go to fail |
| 432 | If Not (ptes = alloc_read_gpt_entries(): reads partition entries from disk*@state: disk parsed partitions*@gpt: GPT header* Description: Returns ptes on success, NULL on error) Then Go to fail |
| 438 | If crc != le32_to_cpu(partition_entry_array_crc32) Then |
| 444 | Return 1 |
| 446 | fail_ptes : |
| 448 | * ptes = NULL |
| 449 | fail : |
| 451 | * gpt = NULL |
| 452 | Return 0 |
| 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 |