Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:block\partitions\ldm.c Create Date:2022-07-28 17:27:31
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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

Proto:static bool ldm_validate_privheads(struct parsed_partitions *state, struct privhead *ph1)

Type:bool

Parameter:

TypeParameterName
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] = Allocation memory
279  ph[2] = Allocation memory
280  If Not ph[1] || Not ph[2] Then
281  ldm_crit("Out of memory.")
282  Go to out
286  config_start = 0
289  When i < 3 cycle
290  data = read_part_sector(state, config_start + off[i], & sect)
292  If Not data Then
293  ldm_crit("Disk read failed.")
294  Go to 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  If Not result Then
299  ldm_error("Cannot find PRIVHEAD %d.", i + 1)
300  If i < 2 Then Go to out
302  Else Break
307  num_sects = i_size >> 9
309  If config_start > num_sects || config_start + config_size > num_sects Then
311  ldm_crit("Database extends beyond the end of the disk.")
312  Go to out
315  If logical_disk_start > config_start || logical_disk_start + logical_disk_size > config_start Then
318  ldm_crit("Disk and database overlap.")
319  Go to out
322  If Not 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 Then
323  ldm_crit("Primary and backup PRIVHEADs don't match.")
324  Go to 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  kfree(ph[1])
335  kfree(ph[2])
336  Return result
Caller
NameDescribe
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