Lines Matching refs:iter
67 struct part_iter *iter = NULL; in find_by_sig() local
74 if (!(iter = pi_begin(&diskinfo, opt.piflags))) in find_by_sig()
77 if (iter->type == typedos && iter->dos.disk_sig == mbr_sig) in find_by_sig()
79 pi_del(&iter); in find_by_sig()
83 *_boot_part = iter; in find_by_sig()
94 struct part_iter *iter = NULL; in find_by_guid() local
101 if (!(iter = pi_begin(&diskinfo, opt.piflags))) in find_by_guid()
104 if (iter->type == typegpt) in find_by_guid()
106 if (!memcmp(&iter->gpt.part_guid, gpt_guid, sizeof *gpt_guid)) in find_by_guid()
108 } while (!pi_next(iter)); in find_by_guid()
109 pi_del(&iter); in find_by_guid()
113 *_boot_part = iter; in find_by_guid()
123 struct part_iter *iter = NULL; in find_by_label() local
130 if (!(iter = pi_begin(&diskinfo, opt.piflags))) in find_by_label()
133 if (iter->type == typegpt) in find_by_label()
134 while (!pi_next(iter)) { in find_by_label()
135 if (!strcmp(label, iter->gpt.part_label)) in find_by_label()
138 pi_del(&iter); in find_by_label()
142 *_boot_part = iter; in find_by_label()
275 struct part_iter *iter = NULL; in find_dp() local
285 if (find_by_sig(strtoul(opt.drivename + 4, NULL, 0), &iter) < 0) { in find_dp()
292 if (find_by_guid(&gpt_guid, &iter) < 0) { in find_dp()
301 if (find_by_label(opt.drivename + 6, &iter) < 0) { in find_dp()
314 if (!(iter = pi_begin(&diskinfo, opt.piflags))) in find_dp()
334 if (!(iter = pi_begin(&diskinfo, opt.piflags))) in find_dp()
340 if (iter->abs_lba == fs_lba) in find_dp()
342 } while (!pi_next(iter)); in find_dp()
344 if (iter->status) { in find_dp()
357 if (!iter->index && opt.partition) { in find_dp()
361 if (iter->index == partition) in find_dp()
363 } while (!pi_next(iter)); in find_dp()
364 if (iter->status) { in find_dp()
370 if (!(iter->di.disk & 0x80) && iter->index) { in find_dp()
374 *_iter = iter; in find_dp()
379 pi_del(&iter); in find_dp()
383 static int setup_handover(const struct part_iter *iter, in setup_handover() argument
393 if (iter->index == 0) { in setup_handover()
402 if (iter->length < len) in setup_handover()
403 len = iter->length; in setup_handover()
404 lba2chs(&ha->start, &iter->di, 0, L2C_CADD); in setup_handover()
405 lba2chs(&ha->end, &iter->di, len - 1, L2C_CADD); in setup_handover()
410 } else if (iter->type == typegpt) { in setup_handover()
413 synth_size += sizeof *plen + iter->gpt.pe_size; in setup_handover()
419 lba2chs(&ha->start, &iter->di, iter->abs_lba, L2C_CADD); in setup_handover()
420 lba2chs(&ha->end, &iter->di, iter->abs_lba + iter->length - 1, L2C_CADD); in setup_handover()
427 if (iter->abs_lba < ha->start_lba) in setup_handover()
428 ha->start_lba = iter->abs_lba; in setup_handover()
429 if (iter->length < ha->length) in setup_handover()
430 ha->length = iter->length; in setup_handover()
433 plen[0] = iter->gpt.pe_size; in setup_handover()
435 memcpy(plen + 1, iter->record, plen[0]); in setup_handover()
442 } else if (iter->type == typedos) { in setup_handover()
449 memcpy(ha, iter->record, synth_size); in setup_handover()
451 lba2chs(&ha->start, &iter->di, iter->abs_lba, L2C_CADD); in setup_handover()
452 lba2chs(&ha->end, &iter->di, iter->abs_lba + iter->length - 1, L2C_CADD); in setup_handover()
453 ha->start_lba = iter->abs_lba; in setup_handover()
454 ha->length = iter->length; in setup_handover()
476 struct part_iter *iter = NULL; in main() local
504 if (find_dp(&iter)) in main()
508 if (manglepe_fixchs(iter)) in main()
510 if (manglepe_hide(iter)) in main()
530 sdat.size = iter->di.bps; in main()
536 if (!(sdat.data = disk_read_sectors(&iter->di, iter->abs_lba, 1))) { in main()
555 if (setup_handover(iter, &hdat)) in main()
568 mangler_init(iter); in main()
569 mangler_handover(iter, &hdat); in main()
570 mangler_grldr(iter); in main()
577 if (manglef_grub(iter, &fdat)) in main()
583 if (manglef_bpb(iter, &fdat)) in main()
586 if (mangles_bpb(iter, &sdat)) in main()
589 if (mangles_save(iter, &sdat, sbck)) in main()
614 iter->di.disk, iter->di.bps, in main()
615 iter->di.lbacnt, iter->di.cyl * iter->di.head * iter->di.spt, in main()
616 iter->di.cyl, iter->di.head, iter->di.spt); in main()
617 dprintf("iter idx: %d\n", iter->index); in main()
618 dprintf("iter lba: %"PRIu64"\n", iter->abs_lba); in main()
634 pi_del(&iter); in main()