Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

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

Proto:static bool ldm_parse_privhead(const u8 *data, struct privhead *ph)

Type:bool

Parameter:

TypeParameterName
const u8 *data
struct privhead *ph
69  bool is_vista = false
71  BUG_ON(!data || !ph)
72  If PRIVHEAD != get_unaligned_be64(data) Then
73  ldm_error("Cannot find PRIVHEAD structure. LDM database is corrupt. Aborting.")
75  Return false
77  Offsets and sizes are in sectors. = get_unaligned_be16(data + 0x000C)
78  ver_minor = get_unaligned_be16(data + 0x000E)
79  logical_disk_start = get_unaligned_be64(data + 0x011B)
80  logical_disk_size = get_unaligned_be64(data + 0x0123)
81  config_start = get_unaligned_be64(data + 0x012B)
82  config_size = get_unaligned_be64(data + 0x0133)
84  If Offsets and sizes are in sectors. == 2 && ver_minor == 12 Then is_vista = true
86  If Not is_vista && ( Offsets and sizes are in sectors. != 2 || ver_minor != 11 ) Then
87  ldm_error("Expected PRIVHEAD version 2.11 or 2.12, got %d.%d. Aborting.", Offsets and sizes are in sectors. , ver_minor)
89  Return false
91  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("PRIVHEAD version %d.%d (Windows %s).", Offsets and sizes are in sectors. , ver_minor, is_vista ? "Vista" : "2000/XP")
93  If config_size != Size in sectors (= 1MiB). Then
95  ldm_info("Database is normally %u bytes, it claims to be %llu bytes.", Size in sectors (= 1MiB). , (unsignedlonglong)config_size)
99  If logical_disk_size == 0 || logical_disk_start + logical_disk_size > config_start Then
101  ldm_error("PRIVHEAD disk size doesn't match real disk size")
102  Return false
104  If uuid_parse(data + 0x0030, & disk_id) Then
105  ldm_error("PRIVHEAD contains an invalid GUID.")
106  Return false
108  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("Parsed PRIVHEAD successfully.")
109  Return true
Caller
NameDescribe
ldm_validate_privheadsldm_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