Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:ldm_validate_tocblocks - Validate the table of contents and its backups*@state: Partition check state including device holding the LDM Database*@base: Offset, into @state->bdev, of the database*@ldb: Cache of the database structures* Find and compare the

Proto:static bool ldm_validate_tocblocks(struct parsed_partitions *state, unsigned long base, struct ldmdb *ldb)

Type:bool

Parameter:

TypeParameterName
struct parsed_partitions *state
unsigned longbase
struct ldmdb *ldb
356  static const int off[4] = {Tables of contents. , OFF_TOCB2, OFF_TOCB3, OFF_TOCB4}
362  bool result = false
364  BUG_ON(!state || !ldb)
365  ph = Cache of the database
366  tb[0] = toc
367  tb[1] = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
368  If Not tb[1] Then
369  ldm_crit("Out of memory.")
370  Go to err
372  tb[2] = tb[1] + size of tb[1]
373  tb[3] = tb[2] + size of tb[2]
380  When i < 4 cycle
381  data = read_part_sector(state, base + off[i], & sect)
382  If Not data Then
383  ldm_error("Disk read failed for TOCBLOCK %d.", i)
384  Continue
386  If ldm_parse_tocblock - Read the LDM Database TOCBLOCK structure*@data: Raw database TOCBLOCK structure loaded from the device*@toc: In-memory toc structure in which to return parsed information* This parses the LDM Database TOCBLOCK (table of contents) Then nr_tbs++
388  put_dev_sector(sect)
390  If Not nr_tbs Then
391  ldm_crit("Failed to find a valid TOCBLOCK.")
392  Go to err
395  If bitmap1_start + bitmap1_size > config_size || bitmap2_start + bitmap2_size > config_size Then
398  ldm_crit("The bitmaps are out of range. Giving up.")
399  Go to err
402  When i < nr_tbs cycle
404  ldm_crit("TOCBLOCKs 0 and %d do not match.", i)
405  Go to err
408  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 %d TOCBLOCKs successfully.", nr_tbs)
409  result = true
410  err :
411  kfree(tb[1])
412  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