Lines Matching refs:drive

16   struct drive drive;  in CgptGetBootPartitionNumber()  local
23 if (CGPT_OK != DriveOpen(params->drive_name, &drive, O_RDONLY, in CgptGetBootPartitionNumber()
27 if (GPT_SUCCESS != (gpt_retval = GptSanityCheck(&drive.gpt))) { in CgptGetBootPartitionNumber()
34 if (CGPT_OK != ReadPMBR(&drive)) { in CgptGetBootPartitionNumber()
41 GuidToStr(&drive.pmbr.boot_guid, buf, sizeof(buf)); in CgptGetBootPartitionNumber()
43 int numEntries = GetNumberOfEntries(&drive); in CgptGetBootPartitionNumber()
46 GptEntry *entry = GetEntry(&drive.gpt, ANY_VALID, i); in CgptGetBootPartitionNumber()
48 if (GuidEqual(&entry->unique, &drive.pmbr.boot_guid)) { in CgptGetBootPartitionNumber()
60 (void) DriveClose(&drive, 1); in CgptGetBootPartitionNumber()
66 struct drive drive; in CgptBoot() local
77 if (CGPT_OK != DriveOpen(params->drive_name, &drive, mode, in CgptBoot()
82 if (CGPT_OK != ReadPMBR(&drive)) { in CgptBoot()
88 drive.pmbr.magic[0] = 0x1d; in CgptBoot()
89 drive.pmbr.magic[1] = 0x9a; in CgptBoot()
90 drive.pmbr.sig[0] = 0x55; in CgptBoot()
91 drive.pmbr.sig[1] = 0xaa; in CgptBoot()
92 memset(&drive.pmbr.part, 0, sizeof(drive.pmbr.part)); in CgptBoot()
93 drive.pmbr.part[0].f_head = 0x00; in CgptBoot()
94 drive.pmbr.part[0].f_sect = 0x02; in CgptBoot()
95 drive.pmbr.part[0].f_cyl = 0x00; in CgptBoot()
96 drive.pmbr.part[0].type = 0xee; in CgptBoot()
97 drive.pmbr.part[0].l_head = 0xff; in CgptBoot()
98 drive.pmbr.part[0].l_sect = 0xff; in CgptBoot()
99 drive.pmbr.part[0].l_cyl = 0xff; in CgptBoot()
100 drive.pmbr.part[0].f_lba = htole32(1); in CgptBoot()
102 if (drive.gpt.streaming_drive_sectors < 0xffffffff) in CgptBoot()
103 max = drive.gpt.streaming_drive_sectors - 1; in CgptBoot()
104 drive.pmbr.part[0].num_sect = htole32(max); in CgptBoot()
108 if (GPT_SUCCESS != (gpt_retval = GptSanityCheck(&drive.gpt))) { in CgptBoot()
114 if (params->partition > GetNumberOfEntries(&drive)) { in CgptBoot()
120 GptEntry *entry = GetEntry(&drive.gpt, ANY_VALID, index); in CgptBoot()
121 memcpy(&drive.pmbr.boot_guid, &entry->unique, sizeof(Guid)); in CgptBoot()
131 int n = read(fd, drive.pmbr.bootcode, sizeof(drive.pmbr.bootcode)); in CgptBoot()
142 GuidToStr(&drive.pmbr.boot_guid, buf, sizeof(buf)); in CgptBoot()
146 if (mode == O_RDONLY || CGPT_OK == WritePMBR(&drive)) in CgptBoot()
150 (void) DriveClose(&drive, 1); in CgptBoot()