Lines Matching refs:drive
24 static int GptCreate(struct drive *drive, CgptCreateParams *params) { in GptCreate() argument
28 AllocAndClear(&drive->gpt.primary_header, in GptCreate()
29 drive->gpt.sector_bytes * GPT_HEADER_SECTORS); in GptCreate()
30 AllocAndClear(&drive->gpt.secondary_header, in GptCreate()
31 drive->gpt.sector_bytes * GPT_HEADER_SECTORS); in GptCreate()
33 drive->gpt.modified |= (GPT_MODIFIED_HEADER1 | GPT_MODIFIED_ENTRIES1 | in GptCreate()
38 GptHeader *h = (GptHeader *)drive->gpt.primary_header; in GptCreate()
43 h->alternate_lba = drive->gpt.gpt_drive_sectors - GPT_HEADER_SECTORS; in GptCreate()
52 if (drive->gpt.flags & GPT_FLAG_EXTERNAL) { in GptCreate()
63 (GPT_PMBR_SECTORS + GPT_HEADER_SECTORS) * drive->gpt.sector_bytes; in GptCreate()
67 (drive->gpt.gpt_drive_sectors / 2) * drive->gpt.sector_bytes; in GptCreate()
82 if (!(drive->gpt.flags & GPT_FLAG_EXTERNAL)) { in GptCreate()
85 h->last_usable_lba = (drive->gpt.streaming_drive_sectors - GPT_HEADER_SECTORS - in GptCreate()
89 h->last_usable_lba = (drive->gpt.streaming_drive_sectors - 1); in GptCreate()
93 AllocAndClear(&drive->gpt.primary_entries, entries_size); in GptCreate()
94 AllocAndClear(&drive->gpt.secondary_entries, entries_size); in GptCreate()
97 RepairHeader(&drive->gpt, MASK_PRIMARY); in GptCreate()
99 UpdateCrc(&drive->gpt); in GptCreate()
106 struct drive drive; in CgptCreate() local
111 if (CGPT_OK != DriveOpen(params->drive_name, &drive, O_RDWR, in CgptCreate()
115 if (GptCreate(&drive, params)) in CgptCreate()
119 return DriveClose(&drive, 1); in CgptCreate()
123 DriveClose(&drive, 0); in CgptCreate()