Lines Matching refs:gpt

23 int CheckParameters(GptData *gpt)  in CheckParameters()  argument
26 if (gpt->sector_bytes != SECTOR_SIZE) in CheckParameters()
34 if (gpt->gpt_drive_sectors == 0 || in CheckParameters()
35 (!(gpt->flags & GPT_FLAG_EXTERNAL) && in CheckParameters()
36 gpt->gpt_drive_sectors != gpt->streaming_drive_sectors)) { in CheckParameters()
45 if (gpt->gpt_drive_sectors < in CheckParameters()
237 int GptSanityCheck(GptData *gpt) in GptSanityCheck() argument
240 GptHeader *header1 = (GptHeader *)(gpt->primary_header); in GptSanityCheck()
241 GptHeader *header2 = (GptHeader *)(gpt->secondary_header); in GptSanityCheck()
242 GptEntry *entries1 = (GptEntry *)(gpt->primary_entries); in GptSanityCheck()
243 GptEntry *entries2 = (GptEntry *)(gpt->secondary_entries); in GptSanityCheck()
246 gpt->valid_headers = 0; in GptSanityCheck()
247 gpt->valid_entries = 0; in GptSanityCheck()
249 retval = CheckParameters(gpt); in GptSanityCheck()
254 if (0 == CheckHeader(header1, 0, gpt->streaming_drive_sectors, in GptSanityCheck()
255 gpt->gpt_drive_sectors, gpt->flags)) { in GptSanityCheck()
256 gpt->valid_headers |= MASK_PRIMARY; in GptSanityCheck()
259 if (0 == CheckHeader(header2, 1, gpt->streaming_drive_sectors, in GptSanityCheck()
260 gpt->gpt_drive_sectors, gpt->flags)) { in GptSanityCheck()
261 gpt->valid_headers |= MASK_SECONDARY; in GptSanityCheck()
266 if (!gpt->valid_headers) in GptSanityCheck()
277 gpt->valid_entries |= MASK_PRIMARY; in GptSanityCheck()
279 gpt->valid_entries |= MASK_SECONDARY; in GptSanityCheck()
285 if (MASK_BOTH == gpt->valid_headers && !gpt->valid_entries) { in GptSanityCheck()
287 gpt->valid_entries |= MASK_PRIMARY; in GptSanityCheck()
289 gpt->valid_entries |= MASK_SECONDARY; in GptSanityCheck()
290 if (gpt->valid_entries) { in GptSanityCheck()
296 gpt->valid_headers &= ~MASK_PRIMARY; in GptSanityCheck()
301 if (!gpt->valid_entries) in GptSanityCheck()
308 if (MASK_BOTH == gpt->valid_headers && in GptSanityCheck()
310 gpt->valid_headers &= ~MASK_SECONDARY; in GptSanityCheck()
315 void GptRepair(GptData *gpt) in GptRepair() argument
317 GptHeader *header1 = (GptHeader *)(gpt->primary_header); in GptRepair()
318 GptHeader *header2 = (GptHeader *)(gpt->secondary_header); in GptRepair()
319 GptEntry *entries1 = (GptEntry *)(gpt->primary_entries); in GptRepair()
320 GptEntry *entries2 = (GptEntry *)(gpt->secondary_entries); in GptRepair()
324 if (MASK_NONE == gpt->valid_headers || MASK_NONE == gpt->valid_entries) in GptRepair()
328 if (MASK_PRIMARY == gpt->valid_headers) { in GptRepair()
331 header2->my_lba = gpt->gpt_drive_sectors - GPT_HEADER_SECTORS; in GptRepair()
335 gpt->modified |= GPT_MODIFIED_HEADER2; in GptRepair()
337 else if (MASK_SECONDARY == gpt->valid_headers) { in GptRepair()
342 gpt->streaming_drive_sectors - GPT_HEADER_SECTORS; in GptRepair()
346 gpt->modified |= GPT_MODIFIED_HEADER1; in GptRepair()
348 gpt->valid_headers = MASK_BOTH; in GptRepair()
352 if (MASK_PRIMARY == gpt->valid_entries) { in GptRepair()
355 gpt->modified |= GPT_MODIFIED_ENTRIES2; in GptRepair()
357 else if (MASK_SECONDARY == gpt->valid_entries) { in GptRepair()
360 gpt->modified |= GPT_MODIFIED_ENTRIES1; in GptRepair()
362 gpt->valid_entries = MASK_BOTH; in GptRepair()
406 void GetCurrentKernelUniqueGuid(GptData *gpt, void *dest) in GetCurrentKernelUniqueGuid() argument
408 GptEntry *entries = (GptEntry *)gpt->primary_entries; in GetCurrentKernelUniqueGuid()
409 GptEntry *e = entries + gpt->current_kernel; in GetCurrentKernelUniqueGuid()
413 void GptModified(GptData *gpt) { in GptModified() argument
414 GptHeader *header = (GptHeader *)gpt->primary_header; in GptModified()
417 header->entries_crc32 = Crc32(gpt->primary_entries, in GptModified()
421 gpt->modified |= GPT_MODIFIED_HEADER1 | GPT_MODIFIED_ENTRIES1; in GptModified()
428 gpt->valid_headers = MASK_PRIMARY; in GptModified()
429 gpt->valid_entries = MASK_PRIMARY; in GptModified()
430 GptRepair(gpt); in GptModified()