Lines Matching refs:gptdata
24 int AllocAndReadGptData(VbExDiskHandle_t disk_handle, GptData *gptdata) in AllocAndReadGptData() argument
30 gptdata->modified = 0; in AllocAndReadGptData()
33 gptdata->primary_header = (uint8_t *)VbExMalloc(gptdata->sector_bytes); in AllocAndReadGptData()
34 gptdata->secondary_header = in AllocAndReadGptData()
35 (uint8_t *)VbExMalloc(gptdata->sector_bytes); in AllocAndReadGptData()
36 gptdata->primary_entries = (uint8_t *)VbExMalloc(max_entries_bytes); in AllocAndReadGptData()
37 gptdata->secondary_entries = (uint8_t *)VbExMalloc(max_entries_bytes); in AllocAndReadGptData()
39 if (gptdata->primary_header == NULL || in AllocAndReadGptData()
40 gptdata->secondary_header == NULL || in AllocAndReadGptData()
41 gptdata->primary_entries == NULL || in AllocAndReadGptData()
42 gptdata->secondary_entries == NULL) in AllocAndReadGptData()
46 if (0 != VbExDiskRead(disk_handle, 1, 1, gptdata->primary_header)) in AllocAndReadGptData()
50 GptHeader* primary_header = (GptHeader*)gptdata->primary_header; in AllocAndReadGptData()
52 gptdata->streaming_drive_sectors, in AllocAndReadGptData()
53 gptdata->gpt_drive_sectors, in AllocAndReadGptData()
54 gptdata->flags)) { in AllocAndReadGptData()
59 / gptdata->sector_bytes; in AllocAndReadGptData()
63 gptdata->primary_entries)) in AllocAndReadGptData()
70 if (0 != VbExDiskRead(disk_handle, gptdata->gpt_drive_sectors - 1, 1, in AllocAndReadGptData()
71 gptdata->secondary_header)) in AllocAndReadGptData()
75 GptHeader* secondary_header = (GptHeader*)gptdata->secondary_header; in AllocAndReadGptData()
77 gptdata->streaming_drive_sectors, in AllocAndReadGptData()
78 gptdata->gpt_drive_sectors, in AllocAndReadGptData()
79 gptdata->flags)) { in AllocAndReadGptData()
84 / gptdata->sector_bytes; in AllocAndReadGptData()
88 gptdata->secondary_entries)) in AllocAndReadGptData()
103 int WriteAndFreeGptData(VbExDiskHandle_t disk_handle, GptData *gptdata) in WriteAndFreeGptData() argument
106 GptHeader *header = (GptHeader *)gptdata->primary_header; in WriteAndFreeGptData()
109 uint64_t entries_sectors = entries_bytes / gptdata->sector_bytes; in WriteAndFreeGptData()
117 if (gptdata->primary_header) { in WriteAndFreeGptData()
118 GptHeader *h = (GptHeader *)(gptdata->primary_header); in WriteAndFreeGptData()
126 if (gptdata->modified) { in WriteAndFreeGptData()
130 if (gptdata->modified & GPT_MODIFIED_HEADER1) { in WriteAndFreeGptData()
137 gptdata->primary_header)) in WriteAndFreeGptData()
143 if (gptdata->primary_entries) { in WriteAndFreeGptData()
144 if (gptdata->modified & GPT_MODIFIED_ENTRIES1) { in WriteAndFreeGptData()
152 gptdata->primary_entries)) in WriteAndFreeGptData()
158 entries_lba = (gptdata->gpt_drive_sectors - entries_sectors - in WriteAndFreeGptData()
160 if (gptdata->secondary_header) { in WriteAndFreeGptData()
161 GptHeader *h = (GptHeader *)(gptdata->secondary_header); in WriteAndFreeGptData()
163 if (gptdata->modified & GPT_MODIFIED_HEADER2) { in WriteAndFreeGptData()
166 gptdata->gpt_drive_sectors - 1, 1, in WriteAndFreeGptData()
167 gptdata->secondary_header)) in WriteAndFreeGptData()
172 if (gptdata->secondary_entries) { in WriteAndFreeGptData()
173 if (gptdata->modified & GPT_MODIFIED_ENTRIES2) { in WriteAndFreeGptData()
177 gptdata->secondary_entries)) in WriteAndFreeGptData()
186 if (gptdata->primary_header) in WriteAndFreeGptData()
187 VbExFree(gptdata->primary_header); in WriteAndFreeGptData()
188 if (gptdata->primary_entries) in WriteAndFreeGptData()
189 VbExFree(gptdata->primary_entries); in WriteAndFreeGptData()
190 if (gptdata->secondary_entries) in WriteAndFreeGptData()
191 VbExFree(gptdata->secondary_entries); in WriteAndFreeGptData()
192 if (gptdata->secondary_header) in WriteAndFreeGptData()
193 VbExFree(gptdata->secondary_header); in WriteAndFreeGptData()