Home | History | Annotate | Download | only in cgpt

Lines Matching full:drive

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