函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:ldm_validate_privheads - Compare the primary privhead with its backups*@state: Partition check state including device holding the LDM Database*@ph1: Memory struct to fill with ph contents* Read and compare all three privheads from disk

函数原型:static bool ldm_validate_privheads(struct parsed_partitions *state, struct privhead *ph1)

返回类型:bool

参数:

类型参数名称
struct parsed_partitions *state
struct privhead *ph1
268  static const int off[3] = {Offset of the first privheadrelative to the start of thedevice in sectors , Backup private headers. , OFF_PRIV3}
269  struct privhead * ph[3] = {ph1}
272  bool result = false
276  BUG_ON(!state || !ph1)
278  ph[1]等于开辟内存
279  ph[2]等于开辟内存
280  如果非ph[1]或非ph[2]则
281  ldm_crit("Out of memory.")
282  转到:out
286  config_start等于0
289 i小于3循环
290  data等于read_part_sector(state, config_start + off[i], & sect)
292  如果非data
293  ldm_crit("Disk read failed.")
294  转到:out
296  result等于ldm_parse_privhead - Read the LDM Database PRIVHEAD structure*@data: Raw database PRIVHEAD structure loaded from the device*@ph: In-memory privhead structure in which to return parsed information* This parses the LDM database PRIVHEAD structure supplied
297  put_dev_sector(sect)
298  如果非result
299  ldm_error("Cannot find PRIVHEAD %d.", i + 1)
300  如果i小于2则转到:out
302  否则退出
307  num_sects等于i_size右移9位
309  如果config_start大于num_sectsconfig_startconfig_size大于num_sects
311  ldm_crit("Database extends beyond the end of the disk.")
312  转到:out
315  如果logical_disk_start大于config_startlogical_disk_startlogical_disk_size大于config_start
318  ldm_crit("Disk and database overlap.")
319  转到:out
322  如果非ldm_compare_privheads - Compare two privhead objects*@ph1: First privhead*@ph2: Second privhead* This compares the two privhead structures @ph1 and @ph2.* Return: 'true' Identical* 'false' Different
323  ldm_crit("Primary and backup PRIVHEADs don't match.")
324  转到:out
331  ldm_debug/info/error/crit - Output an error message*@f: A printf format string containing the message*@...: Variables to substitute into @f* ldm_debug() writes a DEBUG level message to the syslog but only if the* driver was compiled with debug enabled("Validated PRIVHEADs successfully.")
332  result = true
333  out :
334  释放内存
335  释放内存
336  返回:result
调用者
名称描述
ldm_partitionldm_partition - Find out whether a device is a dynamic disk and handle it*@state: Partition check state including device holding the LDM Database* This determines whether the device @bdev is a dynamic disk and if so creates