Lines Matching refs:gpt

288 					 gpt_header *gpt)  in alloc_read_gpt_entries()  argument
293 if (!gpt) in alloc_read_gpt_entries()
296 count = (size_t)le32_to_cpu(gpt->num_partition_entries) * in alloc_read_gpt_entries()
297 le32_to_cpu(gpt->sizeof_partition_entry); in alloc_read_gpt_entries()
304 if (read_lba(state, le64_to_cpu(gpt->partition_entry_lba), in alloc_read_gpt_entries()
325 gpt_header *gpt; in alloc_read_gpt_header() local
328 gpt = kmalloc(ssz, GFP_KERNEL); in alloc_read_gpt_header()
329 if (!gpt) in alloc_read_gpt_header()
332 if (read_lba(state, lba, (u8 *) gpt, ssz) < ssz) { in alloc_read_gpt_header()
333 kfree(gpt); in alloc_read_gpt_header()
334 gpt=NULL; in alloc_read_gpt_header()
338 return gpt; in alloc_read_gpt_header()
352 gpt_header **gpt, gpt_entry **ptes) in is_gpt_valid() argument
359 if (!(*gpt = alloc_read_gpt_header(state, lba))) in is_gpt_valid()
363 if (le64_to_cpu((*gpt)->signature) != GPT_HEADER_SIGNATURE) { in is_gpt_valid()
366 (unsigned long long)le64_to_cpu((*gpt)->signature), in is_gpt_valid()
372 if (le32_to_cpu((*gpt)->header_size) > in is_gpt_valid()
375 le32_to_cpu((*gpt)->header_size), in is_gpt_valid()
381 if (le32_to_cpu((*gpt)->header_size) < sizeof(gpt_header)) { in is_gpt_valid()
383 le32_to_cpu((*gpt)->header_size), in is_gpt_valid()
389 origcrc = le32_to_cpu((*gpt)->header_crc32); in is_gpt_valid()
390 (*gpt)->header_crc32 = 0; in is_gpt_valid()
391 crc = efi_crc32((const unsigned char *) (*gpt), le32_to_cpu((*gpt)->header_size)); in is_gpt_valid()
398 (*gpt)->header_crc32 = cpu_to_le32(origcrc); in is_gpt_valid()
402 if (le64_to_cpu((*gpt)->my_lba) != lba) { in is_gpt_valid()
404 (unsigned long long)le64_to_cpu((*gpt)->my_lba), in is_gpt_valid()
413 if (le64_to_cpu((*gpt)->first_usable_lba) > lastlba) { in is_gpt_valid()
415 (unsigned long long)le64_to_cpu((*gpt)->first_usable_lba), in is_gpt_valid()
419 if (le64_to_cpu((*gpt)->last_usable_lba) > lastlba) { in is_gpt_valid()
421 (unsigned long long)le64_to_cpu((*gpt)->last_usable_lba), in is_gpt_valid()
425 if (le64_to_cpu((*gpt)->last_usable_lba) < le64_to_cpu((*gpt)->first_usable_lba)) { in is_gpt_valid()
427 (unsigned long long)le64_to_cpu((*gpt)->last_usable_lba), in is_gpt_valid()
428 (unsigned long long)le64_to_cpu((*gpt)->first_usable_lba)); in is_gpt_valid()
432 if (le32_to_cpu((*gpt)->sizeof_partition_entry) != sizeof(gpt_entry)) { in is_gpt_valid()
438 pt_size = (u64)le32_to_cpu((*gpt)->num_partition_entries) * in is_gpt_valid()
439 le32_to_cpu((*gpt)->sizeof_partition_entry); in is_gpt_valid()
446 if (!(*ptes = alloc_read_gpt_entries(state, *gpt))) in is_gpt_valid()
452 if (crc != le32_to_cpu((*gpt)->partition_entry_array_crc32)) { in is_gpt_valid()
464 kfree(*gpt); in is_gpt_valid()
465 *gpt = NULL; in is_gpt_valid()
597 static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt, in find_valid_gpt() argument
646 *gpt = pgpt; in find_valid_gpt()
655 *gpt = agpt; in find_valid_gpt()
668 *gpt = NULL; in find_valid_gpt()
694 gpt_header *gpt = NULL; in efi_partition() local
699 if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) { in efi_partition()
700 kfree(gpt); in efi_partition()
707 for (i = 0; i < le32_to_cpu(gpt->num_partition_entries) && i < state->limit-1; i++) { in efi_partition()
741 kfree(gpt); in efi_partition()