函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\partitions\efi.c Create Date:2022-07-27 19:07:03
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称: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.

函数原型:static int is_gpt_valid(struct parsed_partitions *state, u64 lba, gpt_header **gpt, gpt_entry **ptes)

返回类型:int

参数:

类型参数名称
struct parsed_partitions *state
u64lba
gpt_header **gpt
gpt_entry **ptes
343  如果非ptes则返回:0
345  如果非gpt等于alloc_read_gpt_header(): Allocates GPT header, reads into it from disk*@state: disk parsed partitions*@lba: the Logical Block Address of the partition table* Description: returns GPT header on success, NULL on error. Allocates则返回:0
349  如果le64_to_cpu(signature)不等于GPT_HEADER_SIGNATURE
350  pr_debug("GUID Partition Table Header signature is wrong:%lld != %lld\n", (unsignedlonglong)le64_to_cpu(signature), (unsignedlonglong)GPT_HEADER_SIGNATURE)
354  转到:fail
358  如果le32_to_cpu(header_size)大于bdev_logical_block_size(bdev)则
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  转到:fail
367  如果le32_to_cpu(header_size)小于sizeof(gpt_header)则
368  pr_debug("GUID Partition Table Header size is too small: %u < %zu\n", le32_to_cpu(header_size), sizeof(gpt_header))
371  转到:fail
375  origcrc等于le32_to_cpu(header_crc32)
376  header_crc32等于0
377  crc等于_crc32() - EFI version of crc32 function*@buf: buffer to calculate crc32 of*@len: length of buf* Description: Returns EFI-style CRC32 value for @buf* This function uses the little endian Ethernet polynomial
379  如果crc不等于origcrc
380  pr_debug("GUID Partition Table Header CRC is wrong: %x != %x\n", crc, origcrc)
382  转到:fail
384  header_crc32等于cpu_to_le32(origcrc)
388  如果le64_to_cpu(my_lba)不等于lba
389  pr_debug("GPT my_lba incorrect: %lld != %lld\n", (unsignedlonglong)le64_to_cpu(my_lba), (unsignedlonglong)lba)
392  转到:fail
398  lastlba等于last_lba(): return number of last logical block of device*@bdev: block device* Description: Returns last LBA value on success, 0 on error.* This is stored (by sd and ide-geometry) in* the part[0] entry for this disk, and is the number of
399  如果le64_to_cpu(first_usable_lba)大于lastlba
400  pr_debug("GPT: first_usable_lba incorrect: %lld > %lld\n", (unsignedlonglong)le64_to_cpu(first_usable_lba), (unsignedlonglong)lastlba)
403  转到:fail
405  如果le64_to_cpu(last_usable_lba)大于lastlba
406  pr_debug("GPT: last_usable_lba incorrect: %lld > %lld\n", (unsignedlonglong)le64_to_cpu(last_usable_lba), (unsignedlonglong)lastlba)
409  转到:fail
411  如果le64_to_cpu(last_usable_lba)小于le64_to_cpu(first_usable_lba)则
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  转到:fail
418  如果le32_to_cpu(sizeof_partition_entry)不等于sizeof(gpt_entry)则
419  pr_debug("GUID Partition Entry Size check failed.\n")
420  转到:fail
424  pt_size等于le32_to_cpu(num_partition_entries)乘le32_to_cpu(sizeof_partition_entry)
426  如果pt_size大于Maximum allocatable size
427  pr_debug("GUID Partition Table is too large: %llu > %lu bytes\n", (unsignedlonglong)pt_size, Maximum allocatable size )
429  转到:fail
432  如果非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则转到:fail
436  crc等于_crc32() - EFI version of crc32 function*@buf: buffer to calculate crc32 of*@len: length of buf* Description: Returns EFI-style CRC32 value for @buf* This function uses the little endian Ethernet polynomial
438  如果crc不等于le32_to_cpu(partition_entry_array_crc32)则
439  pr_debug("GUID Partition Entry Array CRC check failed.\n")
440  转到:fail_ptes
444  返回:1
446  fail_ptes :
447  释放内存
448  * ptes = NULL
449  fail :
450  释放内存
451  * gpt = NULL
452  返回:0
调用者
名称描述
find_valid_gptd_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.