Lines Matching refs:drive
17 struct drive drive; in CgptGetBootPartitionNumber() local
24 if (CGPT_OK != DriveOpen(params->drive_name, &drive, O_RDONLY, in CgptGetBootPartitionNumber()
28 if (GPT_SUCCESS != (gpt_retval = GptValidityCheck(&drive.gpt))) { in CgptGetBootPartitionNumber()
35 if (CGPT_OK != ReadPMBR(&drive)) { in CgptGetBootPartitionNumber()
42 GuidToStr(&drive.pmbr.boot_guid, buf, sizeof(buf)); in CgptGetBootPartitionNumber()
44 int numEntries = GetNumberOfEntries(&drive); in CgptGetBootPartitionNumber()
47 GptEntry *entry = GetEntry(&drive.gpt, ANY_VALID, i); in CgptGetBootPartitionNumber()
49 if (GuidEqual(&entry->unique, &drive.pmbr.boot_guid)) { in CgptGetBootPartitionNumber()
61 (void) DriveClose(&drive, 1); in CgptGetBootPartitionNumber()
67 struct drive drive; in CgptBoot() local
78 if (CGPT_OK != DriveOpen(params->drive_name, &drive, mode, in CgptBoot()
83 if (CGPT_OK != ReadPMBR(&drive)) { in CgptBoot()
89 drive.pmbr.magic[0] = 0x1d; in CgptBoot()
90 drive.pmbr.magic[1] = 0x9a; in CgptBoot()
91 drive.pmbr.sig[0] = 0x55; in CgptBoot()
92 drive.pmbr.sig[1] = 0xaa; in CgptBoot()
93 memset(&drive.pmbr.part, 0, sizeof(drive.pmbr.part)); in CgptBoot()
94 drive.pmbr.part[0].f_head = 0x00; in CgptBoot()
95 drive.pmbr.part[0].f_sect = 0x02; in CgptBoot()
96 drive.pmbr.part[0].f_cyl = 0x00; in CgptBoot()
97 drive.pmbr.part[0].type = 0xee; in CgptBoot()
98 drive.pmbr.part[0].l_head = 0xff; in CgptBoot()
99 drive.pmbr.part[0].l_sect = 0xff; in CgptBoot()
100 drive.pmbr.part[0].l_cyl = 0xff; in CgptBoot()
101 drive.pmbr.part[0].f_lba = htole32(1); in CgptBoot()
103 if (drive.gpt.streaming_drive_sectors < 0xffffffff) in CgptBoot()
104 max = drive.gpt.streaming_drive_sectors - 1; in CgptBoot()
105 drive.pmbr.part[0].num_sect = htole32(max); in CgptBoot()
109 if (GPT_SUCCESS != (gpt_retval = GptValidityCheck(&drive.gpt))) { in CgptBoot()
115 if (params->partition > GetNumberOfEntries(&drive)) { in CgptBoot()
121 GptEntry *entry = GetEntry(&drive.gpt, ANY_VALID, index); in CgptBoot()
122 memcpy(&drive.pmbr.boot_guid, &entry->unique, sizeof(Guid)); in CgptBoot()
132 int n = read(fd, drive.pmbr.bootcode, sizeof(drive.pmbr.bootcode)); in CgptBoot()
143 GuidToStr(&drive.pmbr.boot_guid, buf, sizeof(buf)); in CgptBoot()
147 if (mode == O_RDONLY || CGPT_OK == WritePMBR(&drive)) in CgptBoot()
151 (void) DriveClose(&drive, 1); in CgptBoot()