tests/vboot_kernel_tests.c
/**
 * Prepare a valid GPT header that will pass CheckHeader() tests
 */
Prepare a valid GPT header that will pass CheckHeader() tests
Prepare a valid GPT header that will pass CheckHeader () tests
static void SetupGptHeader(GptHeader *h, int is_secondary)
{
	memset(h, '\0', MOCK_SECTOR_SIZE);
	memcpy(h->signature, GPT_HEADER_SIGNATURE, GPT_HEADER_SIGNATURE_SIZE);
	h->revision = GPT_HEADER_REVISION;
	h->size = MIN_SIZE_OF_HEADER;
	h->size_of_entry = sizeof(GptEntry);
	h->number_of_entries = MAX_NUMBER_OF_ENTRIES;
	if (is_secondary) {
		h->my_lba = MOCK_SECTOR_COUNT - GPT_HEADER_SECTORS;
		h->entries_lba = h->my_lba - CalculateEntriesSectors(h,
							MOCK_SECTOR_SIZE);
	} else {
		h->my_lba = GPT_PMBR_SECTORS;
		h->entries_lba = h->my_lba + 1;
	}
	h->first_usable_lba = 2 + CalculateEntriesSectors(h, MOCK_SECTOR_SIZE);
	h->last_usable_lba = MOCK_SECTOR_COUNT - 2 - CalculateEntriesSectors(h,
								MOCK_SECTOR_SIZE);
	h->header_crc32 = HeaderCrc(h);
}
static void SetupGptHeader ( GptHeader * h , int is_secondary ) { memset ( h , ' \0 ' , MOCK_SECTOR_SIZE ) ; memcpy ( h -> signature , GPT_HEADER_SIGNATURE , GPT_HEADER_SIGNATURE_SIZE ) ; h -> revision = GPT_HEADER_REVISION ; h -> size = MIN_SIZE_OF_HEADER ; h -> size_of_entry = sizeof ( GptEntry ) ; h -> number_of_entries = MAX_NUMBER_OF_ENTRIES ; if ( is_secondary ) { h -> my_lba = MOCK_SECTOR_COUNT - GPT_HEADER_SECTORS ; h -> entries_lba = h -> my_lba - CalculateEntriesSectors ( h , MOCK_SECTOR_SIZE ) ; } else { h -> my_lba = GPT_PMBR_SECTORS ; h -> entries_lba = h -> my_lba + 1 ; } h -> first_usable_lba = 2 + CalculateEntriesSectors ( h , MOCK_SECTOR_SIZE ) ; h -> last_usable_lba = MOCK_SECTOR_COUNT - 2 - CalculateEntriesSectors ( h , MOCK_SECTOR_SIZE ) ; h -> header_crc32 = HeaderCrc ( h ) ; }
Prepare a valid GPT header that will pass CheckHeader() tests
Prepare a valid GPT header that will pass CheckHeader () tests
/* "EFI PART" */ /* 16KB: 128 entries of 128 bytes */ /* Set LBA pointers for primary or secondary header */