Lines Matching defs:gh

45 struct gpt_header	gh;
150 gh.gh_sig = letoh64(legh.gh_sig);
151 if (gh.gh_sig != GPTSIGNATURE) {
153 GPTSIGNATURE, gh.gh_sig);
157 gh.gh_rev = letoh32(legh.gh_rev);
158 if (gh.gh_rev != GPTREVISION) {
160 GPTREVISION, gh.gh_rev);
164 gh.gh_lba_self = letoh64(legh.gh_lba_self);
165 if (gh.gh_lba_self != sector) {
167 sector, gh.gh_lba_self);
171 gh.gh_size = letoh32(legh.gh_size);
172 if (gh.gh_size != GPTMINHDRSIZE) {
174 GPTMINHDRSIZE, gh.gh_size);
178 gh.gh_part_size = letoh32(legh.gh_part_size);
179 if (gh.gh_part_size != GPTMINPARTSIZE) {
181 GPTMINPARTSIZE, gh.gh_part_size);
185 if ((dl.d_secsize % gh.gh_part_size) != 0) {
187 dl.d_secsize, gh.gh_part_size);
191 gh.gh_part_num = letoh32(legh.gh_part_num);
192 if (gh.gh_part_num > NGPTPARTITIONS) {
194 NGPTPARTITIONS, gh.gh_part_num);
198 gh.gh_csum = letoh32(legh.gh_csum);
200 legh.gh_csum = crc32((unsigned char *)&legh, gh.gh_size);
201 if (legh.gh_csum != gh.gh_csum) {
203 legh.gh_csum, gh.gh_csum);
205 if (swap32(legh.gh_csum) != gh.gh_csum)
209 gpbytes = gh.gh_part_num * gh.gh_part_size;
213 gh.gh_lba_end = letoh64(legh.gh_lba_end);
214 if (gh.gh_lba_end > lba_end) {
216 gh.gh_lba_end, lba_end);
217 gh.gh_lba_end = lba_end;
220 gh.gh_lba_start = letoh64(legh.gh_lba_start);
221 if (gh.gh_lba_start >= gh.gh_lba_end) {
223 gh.gh_lba_end, gh.gh_lba_start);
227 gh.gh_part_lba = letoh64(legh.gh_part_lba);
228 if (gh.gh_lba_self == GPTSECTOR) {
229 if (gh.gh_part_lba <= GPTSECTOR) {
231 "got %llu\n", GPTSECTOR, gh.gh_part_lba);
234 if (gh.gh_part_lba + gpsectors > gh.gh_lba_start) {
236 "got %llu\n", gh.gh_lba_start,
237 gh.gh_part_lba + gpsectors);
241 if (gh.gh_part_lba <= gh.gh_lba_end) {
243 "got %llu\n", gh.gh_lba_end, gh.gh_part_lba);
246 if (gh.gh_part_lba + gpsectors > gh.gh_lba_self) {
248 "got %llu\n", gh.gh_lba_self,
249 gh.gh_part_lba + gpsectors);
254 gh.gh_lba_alt = letoh32(legh.gh_lba_alt);
255 gh.gh_part_csum = letoh32(legh.gh_part_csum);
256 gh.gh_rsvd = letoh32(legh.gh_rsvd); /* Should always be 0. */
257 uuid_dec_le(&legh.gh_guid, &gh.gh_guid);
272 gh.gh_part_lba);
274 gpbytes = gh.gh_part_num * gh.gh_part_size;
280 if (DISK_readbytes(legp, gh.gh_part_lba, gpbytes))
284 if (gh_part_csum != gh.gh_part_csum) {
286 "got 0x%x\n", gh.gh_part_csum, gh_part_csum);
288 if (swap32(gh_part_csum) != gh.gh_part_csum)
293 for (pn = 0; pn < gh.gh_part_num; pn++) {
344 memset(&gh, 0, sizeof(gh));
366 sig = htole64(gh.gh_sig);
379 printf("gh_rev : %u\n", gh.gh_rev);
380 printf("gh_size : %u (%zd)\n", gh.gh_size, sizeof(gh));
381 printf("gh_csum : 0x%x\n", gh.gh_csum);
382 printf("gh_rsvd : %u\n", gh.gh_rsvd);
383 printf("gh_lba_self : %llu\n", gh.gh_lba_self);
384 printf("gh_lba_alt : %llu\n", gh.gh_lba_alt);
385 printf("gh_lba_start : %llu\n", gh.gh_lba_start);
386 printf("gh_lba_end : %llu\n", gh.gh_lba_end);
388 uuid_to_string(&gh.gh_guid, &p, &status);
391 printf("gh_gh_part_lba : %llu\n", gh.gh_part_lba);
392 printf("gh_gh_part_num : %u (%zu)\n", gh.gh_part_num, nitems(gp));
393 printf("gh_gh_part_size: %u (%zu)\n", gh.gh_part_size, sizeof(gp[0]));
394 printf("gh_gh_part_csum: 0x%x\n", gh.gh_part_csum);
400 disk.dk_name, gh.gh_lba_start, gh.gh_lba_end, size);
407 uuid_to_string(&gh.gh_guid, &guidstr, &status);
416 for (pn = 0; pn < gh.gh_part_num; pn++) {
482 if (start < gh.gh_lba_start || end > gh.gh_lba_end)
496 for (pn = 0; pn < gh.gh_part_num; pn++) {
513 for (pn = 0; pn < gh.gh_part_num; pn++) {
517 if (pn == gh.gh_part_num)
549 if (pn != gh.gh_part_num)
563 memcpy(&oldgh, &gh, sizeof(oldgh));
564 memset(&gh, 0, sizeof(gh));
579 gh.gh_sig = GPTSIGNATURE;
580 gh.gh_rev = GPTREVISION;
581 gh.gh_size = GPTMINHDRSIZE;
582 gh.gh_csum = 0;
583 gh.gh_rsvd = 0;
584 gh.gh_lba_self = 1;
585 gh.gh_lba_alt = DL_GETDSIZE(&dl) - 1;
586 gh.gh_lba_start = needed;
587 gh.gh_lba_end = DL_GETDSIZE(&dl) - needed;
588 uuid_create(&gh.gh_guid, &status);
590 memcpy(&gh, &oldgh, sizeof(gh));
593 gh.gh_part_lba = 2;
594 gh.gh_part_num = NGPTPARTITIONS;
595 gh.gh_part_size = GPTMINPARTSIZE;
596 gh.gh_part_csum = 0;
614 for (pn = 0; pn < gh.gh_part_num; pn++) {
698 gpbytes = gh.gh_part_num * gh.gh_part_size;
710 legh.gh_lba_start = htole64(gh.gh_lba_start);
711 legh.gh_lba_end = htole64(gh.gh_lba_end);
712 uuid_enc_le(&legh.gh_guid, &gh.gh_guid);
714 legh.gh_part_num = htole32(gh.gh_part_num);
721 for (pn = 0; pn < gh.gh_part_num; pn++) {
732 legh.gh_csum = htole32(crc32((unsigned char *)&legh, gh.gh_size));
734 if (DISK_writebytes(&legh, GPTSECTOR, gh.gh_size) ||
742 legh.gh_csum = htole32(crc32((unsigned char *)&legh, gh.gh_size));
744 if (DISK_writebytes(&legh, altgh, gh.gh_size) ||
786 for (pn = 0; pn < gh.gh_part_num; pn++) {
787 if (gp[pn].gp_lba_start >= gh.gh_lba_start)
812 bs = gh.gh_lba_start;
813 ns = gh.gh_lba_end - bs + 1;
826 nextbs = gh.gh_lba_end + 1;
852 bs = gh.gh_lba_start;
864 bs = getuint64("Partition offset", bs, gh.gh_lba_start, gh.gh_lba_end);
865 for (i = 0; i < gh.gh_part_num; i++) {
892 ns = gh.gh_lba_end - bs + 1;