Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

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

Proto:static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt, gpt_entry **ptes)

Type:int

Parameter:

TypeParameterName
struct parsed_partitions *state
gpt_header **gpt
gpt_entry **ptes
586  good_pgpt = 0 , good_agpt = 0 , good_pmbr = 0
587  gpt_header * pgpt = NULL, * agpt = NULL
588  gpt_entry * pptes = NULL, * aptes = NULL
590  total_sectors = NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they >> 9
593  If Not ptes Then Return 0
596  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
597  If Not This allows a kernel command line option 'gpt' to override* the test for invalid PMBR. Not __initdata because reloading* the partition tables happens after init too. Then
599  legacymbr = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
600  If Not legacymbr Then Go to fail
603  ad_lba(): Read bytes from disk, starting at given LBA*@state: disk parsed partitions*@lba: the Logical Block Address of the partition table*@buffer: destination buffer*@count: bytes to read* Description: Reads @count bytes from @state->bdev into @buffer.
604  good_pmbr = s_pmbr_valid(): test Protective MBR for validity*@mbr: pointer to a legacy mbr structure*@total_sectors: amount of sectors in the device* Description: Checks for a valid protective or hybrid* master boot record (MBR)
605  kfree(legacymbr)
607  If Not good_pmbr Then Go to fail
610  pr_debug("Device has a %s MBR\n", good_pmbr == GPT_MBR_PROTECTIVE ? "protective" : "hybrid")
615  good_pgpt = 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.
617  If good_pgpt Then good_agpt = 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.
621  If Not good_agpt && This allows a kernel command line option 'gpt' to override* the test for invalid PMBR. Not __initdata because reloading* the partition tables happens after init too. Then good_agpt = 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.
625  If Not good_pgpt && Not good_agpt Then Go to fail
628  mpare_gpts() - Search disk for valid GPT headers and PTEs*@pgpt: primary GPT header*@agpt: alternate GPT header*@lastlba: last LBA number* Description: Returns nothing. Sanity checks pgpt and agpt fields* and prints warnings on discrepancies.
631  If good_pgpt Then
632  gpt = pgpt
633  ptes = pptes
634  kfree(agpt)
635  kfree(aptes)
636  If Not good_agpt Then pr_warn("Alternate GPT is invalid, using primary GPT.\n")
638  Return 1
640  Else if good_agpt Then
641  gpt = agpt
642  ptes = aptes
643  kfree(pgpt)
644  kfree(pptes)
645  pr_warn("Primary GPT is invalid, using alternate GPT.\n")
646  Return 1
649  fail :
650  kfree(pgpt)
651  kfree(agpt)
652  kfree(pptes)
653  kfree(aptes)
654  * gpt = NULL
655  * ptes = NULL
656  Return 0
Caller
NameDescribe
efi_partition_partition(struct parsed_partitions *state)*@state: disk parsed partitions* Description: called from check.c, if the disk contains GPT* partitions, sets up partition entries in the kernel.* If the first block on the disk is a legacy MBR,