Lines Matching full:pl
967 struct partlist *pl; in partlist_alloc() local
969 if ((pl = calloc(1, sizeof (*pl))) == NULL) { in partlist_alloc()
974 pl->pl_device = calloc(1, sizeof (*pl->pl_device)); in partlist_alloc()
975 if (pl->pl_device == NULL) { in partlist_alloc()
977 free(pl); in partlist_alloc()
981 return (pl); in partlist_alloc()
985 partlist_free(struct partlist *pl) in partlist_free() argument
990 switch (pl->pl_type) { in partlist_free()
993 free(pl->pl_stage); in partlist_free()
996 if (pl->pl_stage != NULL) { in partlist_free()
997 bblock = pl->pl_stage; in partlist_free()
1004 if (pl->pl_device->stage.mntpnt != NULL) { in partlist_free()
1005 if (umount(pl->pl_device->stage.mntpnt) == 0) in partlist_free()
1006 (void) rmdir(pl->pl_device->stage.mntpnt); in partlist_free()
1007 free(pl->pl_device->stage.mntpnt); in partlist_free()
1009 device = pl->pl_device; in partlist_free()
1011 free(pl->pl_device); in partlist_free()
1013 free(pl->pl_src_data); in partlist_free()
1014 free(pl->pl_devname); in partlist_free()
1015 free(pl); in partlist_free()
1069 get_slice(ib_data_t *data, struct partlist *pl, struct dk_gpt *vtoc, in get_slice() argument
1073 ib_device_t *device = pl->pl_device; in get_slice()
1094 pl->pl_devname = ptr; in get_slice()
1120 struct partlist *pl; in allocate_slice() local
1123 if ((pl = partlist_alloc()) == NULL) in allocate_slice()
1126 pl->pl_device = calloc(1, sizeof (*pl->pl_device)); in allocate_slice()
1127 if (pl->pl_device == NULL) { in allocate_slice()
1129 partlist_free(pl); in allocate_slice()
1132 if (!get_slice(data, pl, vtoc, tag)) { in allocate_slice()
1133 partlist_free(pl); in allocate_slice()
1138 if (pl->pl_devname == NULL) in allocate_slice()
1139 partlist_free(pl); in allocate_slice()
1141 *plp = pl; in allocate_slice()
1149 struct partlist *pl; in probe_gpt() local
1175 if (!allocate_slice(data, vtoc, V_BOOT, &pl)) in probe_gpt()
1177 if (pl != NULL) { in probe_gpt()
1178 pl->pl_src_name = stage1; in probe_gpt()
1179 pl->pl_type = IB_BBLK_STAGE1; in probe_gpt()
1180 pl->pl_cb.compare = compare_stage1_cb; in probe_gpt()
1181 pl->pl_cb.install = install_stage1_cb; in probe_gpt()
1182 pl->pl_cb.read = read_stage1_cb; in probe_gpt()
1183 pl->pl_cb.read_bbl = read_stage1_bbl_cb; in probe_gpt()
1184 pl->pl_cb.print = print_stage1_cb; in probe_gpt()
1185 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_gpt()
1194 if (!allocate_slice(data, vtoc, V_BOOT, &pl)) in probe_gpt()
1196 if (pl != NULL) { in probe_gpt()
1197 pl->pl_src_name = stage2; in probe_gpt()
1198 pl->pl_type = IB_BBLK_STAGE2; in probe_gpt()
1199 pl->pl_cb.compare = compare_einfo_cb; in probe_gpt()
1200 pl->pl_cb.install = install_stage2_cb; in probe_gpt()
1201 pl->pl_cb.read = read_stage2_cb; in probe_gpt()
1202 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_gpt()
1203 pl->pl_cb.print = print_einfo_cb; in probe_gpt()
1204 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_gpt()
1208 if (!allocate_slice(data, vtoc, V_SYSTEM, &pl)) in probe_gpt()
1210 if (pl != NULL) { in probe_gpt()
1211 pl->pl_device->stage.path = "/EFI/Boot/" BOOTIA32; in probe_gpt()
1212 pl->pl_src_name = efi32; in probe_gpt()
1213 pl->pl_type = IB_BBLK_EFI; in probe_gpt()
1214 pl->pl_cb.compare = compare_einfo_cb; in probe_gpt()
1215 pl->pl_cb.install = install_esp_cb; in probe_gpt()
1216 pl->pl_cb.read = read_einfo_esp_cb; in probe_gpt()
1217 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_gpt()
1218 pl->pl_cb.print = print_einfo_cb; in probe_gpt()
1219 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_gpt()
1221 if (!allocate_slice(data, vtoc, V_SYSTEM, &pl)) in probe_gpt()
1223 if (pl != NULL) { in probe_gpt()
1224 pl->pl_device->stage.path = "/EFI/Boot/" BOOTX64; in probe_gpt()
1225 pl->pl_src_name = efi64; in probe_gpt()
1226 pl->pl_type = IB_BBLK_EFI; in probe_gpt()
1227 pl->pl_cb.compare = compare_einfo_cb; in probe_gpt()
1228 pl->pl_cb.install = install_esp_cb; in probe_gpt()
1229 pl->pl_cb.read = read_einfo_esp_cb; in probe_gpt()
1230 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_gpt()
1231 pl->pl_cb.print = print_einfo_cb; in probe_gpt()
1232 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_gpt()
1236 pl = partlist_alloc(); in probe_gpt()
1237 if (pl == NULL) in probe_gpt()
1240 device = pl->pl_device; in probe_gpt()
1242 if ((pl->pl_devname = strdup(data->target.path)) == NULL) { in probe_gpt()
1244 partlist_free(pl); in probe_gpt()
1255 pl->pl_src_name = stage1; in probe_gpt()
1256 pl->pl_type = IB_BBLK_STAGE1; in probe_gpt()
1257 pl->pl_cb.compare = compare_stage1_cb; in probe_gpt()
1258 pl->pl_cb.install = install_stage1_cb; in probe_gpt()
1259 pl->pl_cb.read = read_stage1_cb; in probe_gpt()
1260 pl->pl_cb.read_bbl = read_stage1_bbl_cb; in probe_gpt()
1261 pl->pl_cb.print = print_stage1_cb; in probe_gpt()
1262 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_gpt()
1266 pl = partlist_alloc(); in probe_gpt()
1267 if (pl == NULL) in probe_gpt()
1270 device = pl->pl_device; in probe_gpt()
1273 if ((pl->pl_devname = strdup(data->target.path)) == NULL) { in probe_gpt()
1283 pl->pl_src_name = stage2; in probe_gpt()
1284 pl->pl_type = IB_BBLK_STAGE2; in probe_gpt()
1285 pl->pl_cb.compare = compare_einfo_cb; in probe_gpt()
1286 pl->pl_cb.install = install_stage2_cb; in probe_gpt()
1287 pl->pl_cb.read = read_stage2_cb; in probe_gpt()
1288 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_gpt()
1289 pl->pl_cb.print = print_einfo_cb; in probe_gpt()
1290 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_gpt()
1302 struct partlist *pl; in get_start_sector() local
1336 pl = STAILQ_FIRST(data->plist); in get_start_sector()
1337 if (!read_stage1_cb(pl)) in get_start_sector()
1340 mbr = (struct mboot *)pl->pl_stage; in get_start_sector()
1350 rval = libfdisk_init(&epp, pl->pl_devname, part, FDISK_READ_DISK); in get_start_sector()
1401 struct partlist *pl; in probe_vtoc() local
1474 pl = partlist_alloc(); in probe_vtoc()
1475 if (pl == NULL) { in probe_vtoc()
1479 pl->pl_devname = ptr; in probe_vtoc()
1480 device = pl->pl_device; in probe_vtoc()
1501 pl->pl_src_name = stage1; in probe_vtoc()
1502 pl->pl_type = IB_BBLK_STAGE1; in probe_vtoc()
1503 pl->pl_cb.compare = compare_stage1_cb; in probe_vtoc()
1504 pl->pl_cb.install = install_stage1_cb; in probe_vtoc()
1505 pl->pl_cb.read = read_stage1_cb; in probe_vtoc()
1506 pl->pl_cb.read_bbl = read_stage1_bbl_cb; in probe_vtoc()
1507 pl->pl_cb.print = print_stage1_cb; in probe_vtoc()
1508 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_vtoc()
1511 pl = partlist_alloc(); in probe_vtoc()
1512 if (pl == NULL) { in probe_vtoc()
1516 pl->pl_devname = strdup(ptr); in probe_vtoc()
1517 if (pl->pl_devname == NULL) { in probe_vtoc()
1518 partlist_free(pl); in probe_vtoc()
1521 pl->pl_device->stage.devtype = data->device.devtype; in probe_vtoc()
1522 pl->pl_device->stage.id = device->stage.id; in probe_vtoc()
1523 pl->pl_device->stage.offset = BBLK_BLKLIST_OFF; in probe_vtoc()
1524 pl->pl_device->stage.tag = device->stage.tag; in probe_vtoc()
1525 pl->pl_device->stage.start = device->stage.start; in probe_vtoc()
1526 pl->pl_device->stage.size = device->stage.size; in probe_vtoc()
1527 pl->pl_src_name = stage2; in probe_vtoc()
1528 pl->pl_type = IB_BBLK_STAGE2; in probe_vtoc()
1529 pl->pl_cb.compare = compare_einfo_cb; in probe_vtoc()
1530 pl->pl_cb.install = install_stage2_cb; in probe_vtoc()
1531 pl->pl_cb.read = read_stage2_cb; in probe_vtoc()
1532 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_vtoc()
1533 pl->pl_cb.print = print_einfo_cb; in probe_vtoc()
1534 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_vtoc()
1544 struct partlist *pl; in probe_mbr() local
1554 pl = STAILQ_FIRST(data->plist); in probe_mbr()
1555 if (!read_stage1_cb(pl)) in probe_mbr()
1558 mbr = (struct mboot *)pl->pl_stage; in probe_mbr()
1572 path = (char *)pl->pl_devname; in probe_mbr()
1573 if ((pl = partlist_alloc()) == NULL) in probe_mbr()
1575 device = pl->pl_device; in probe_mbr()
1582 pl->pl_devname = strdup(path); in probe_mbr()
1583 if (pl->pl_devname == NULL) { in probe_mbr()
1585 partlist_free(pl); in probe_mbr()
1594 pl->pl_src_name = stage2; in probe_mbr()
1595 pl->pl_type = IB_BBLK_STAGE2; in probe_mbr()
1596 pl->pl_cb.compare = compare_einfo_cb; in probe_mbr()
1597 pl->pl_cb.install = install_stage2_cb; in probe_mbr()
1598 pl->pl_cb.read = read_stage2_cb; in probe_mbr()
1599 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_mbr()
1600 pl->pl_cb.print = print_einfo_cb; in probe_mbr()
1601 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_mbr()
1609 partlist_free(pl); in probe_mbr()
1620 partlist_free(pl); in probe_mbr()
1623 pl->pl_devname = ptr; in probe_mbr()
1629 pl->pl_src_name = stage1; in probe_mbr()
1630 pl->pl_type = IB_BBLK_STAGE1; in probe_mbr()
1631 pl->pl_cb.compare = compare_stage1_cb; in probe_mbr()
1632 pl->pl_cb.install = install_stage1_cb; in probe_mbr()
1633 pl->pl_cb.read = read_stage1_cb; in probe_mbr()
1634 pl->pl_cb.read_bbl = read_stage1_bbl_cb; in probe_mbr()
1635 pl->pl_cb.print = print_stage1_cb; in probe_mbr()
1636 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_mbr()
1638 pl = partlist_alloc(); in probe_mbr()
1639 if (pl == NULL) in probe_mbr()
1641 device = pl->pl_device; in probe_mbr()
1642 pl->pl_devname = strdup(ptr); in probe_mbr()
1643 if (pl->pl_devname == NULL) { in probe_mbr()
1645 partlist_free(pl); in probe_mbr()
1656 pl->pl_src_name = stage2; in probe_mbr()
1657 pl->pl_type = IB_BBLK_STAGE2; in probe_mbr()
1658 pl->pl_cb.compare = compare_einfo_cb; in probe_mbr()
1659 pl->pl_cb.install = install_stage2_cb; in probe_mbr()
1660 pl->pl_cb.read = read_stage2_cb; in probe_mbr()
1661 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_mbr()
1662 pl->pl_cb.print = print_einfo_cb; in probe_mbr()
1663 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_mbr()
1671 struct partlist *pl; in probe_device() local
1682 if ((pl = partlist_alloc()) == NULL) in probe_device()
1687 partlist_free(pl); in probe_device()
1693 pl->pl_devname = (char *)dev; in probe_device()
1695 pl->pl_type = IB_BBLK_FILE; in probe_device()
1696 pl->pl_cb.read = read_einfo_file_cb; in probe_device()
1697 pl->pl_cb.print = print_einfo_cb; in probe_device()
1698 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_device()
1712 partlist_free(pl); in probe_device()
1718 partlist_free(pl); in probe_device()
1725 partlist_free(pl); in probe_device()
1729 pl->pl_devname = p0; in probe_device()
1738 if ((fd = open_device(pl->pl_devname)) == -1) { in probe_device()
1739 partlist_free(pl); in probe_device()
1746 pl->pl_src_name = stage1; in probe_device()
1747 pl->pl_type = IB_BBLK_MBR; in probe_device()
1748 pl->pl_cb.compare = compare_mbr_cb; in probe_device()
1749 pl->pl_cb.install = install_stage1_cb; in probe_device()
1750 pl->pl_cb.read = read_stage1_cb; in probe_device()
1751 pl->pl_cb.read_bbl = read_stage1_bbl_cb; in probe_device()
1752 pl->pl_cb.print = print_stage1_cb; in probe_device()
1753 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_device()
1942 prepare_bootblock(ib_data_t *data, struct partlist *pl, char *updt_str) in prepare_bootblock() argument
1947 assert(pl != NULL); in prepare_bootblock()
1949 bblock = pl->pl_src_data; in prepare_bootblock()
2005 struct partlist *pl; in prepare_bblocks() local
2018 STAILQ_FOREACH(pl, data->plist, pl_next) { in prepare_bblocks()
2019 if (pl->pl_type == IB_BBLK_STAGE2) { in prepare_bblocks()
2020 stage2 = pl; in prepare_bblocks()
2026 if (pl->pl_cb.compare != NULL && in prepare_bblocks()
2027 pl->pl_cb.compare(pl)) in prepare_bblocks()
2036 STAILQ_FOREACH(pl, data->plist, pl_next) { in prepare_bblocks()
2037 switch (pl->pl_type) { in prepare_bblocks()
2039 mbr = pl; in prepare_bblocks()
2042 stage1 = pl; in prepare_bblocks()
2048 prepare_bootblock(data, pl, update_str); in prepare_bblocks()
2090 struct partlist *pl; in handle_install() local
2156 STAILQ_FOREACH(pl, data.plist, pl_next) { in handle_install()
2157 if (!pl->pl_cb.read(pl)) { in handle_install()
2160 if (!pl->pl_cb.read_bbl(pl)) { in handle_install()
2166 if (pl->pl_type != IB_BBLK_EFI) in handle_install()
2175 while ((pl = STAILQ_LAST(data.plist, partlist, pl_next)) != in handle_install()
2177 if (pl->pl_cb.compare != NULL && in handle_install()
2178 pl->pl_cb.compare(pl)) { in handle_install()
2179 if (pl->pl_cb.install != NULL) in handle_install()
2180 pl->pl_cb.install(&data, pl); in handle_install()
2182 STAILQ_REMOVE(data.plist, pl, partlist, pl_next); in handle_install()
2183 partlist_free(pl); in handle_install()
2189 while ((pl = STAILQ_LAST(data.plist, partlist, pl_next)) != NULL) { in handle_install()
2190 STAILQ_REMOVE(data.plist, pl, partlist, pl_next); in handle_install()
2191 partlist_free(pl); in handle_install()
2216 struct partlist *pl; in handle_getinfo() local
2239 STAILQ_FOREACH(pl, data.plist, pl_next) { in handle_getinfo()
2240 if (pl->pl_cb.read(pl)) in handle_getinfo()
2241 pl->pl_cb.print(pl); in handle_getinfo()
2247 while ((pl = STAILQ_LAST(data.plist, partlist, pl_next)) != NULL) { in handle_getinfo()
2248 STAILQ_REMOVE(data.plist, pl, partlist, pl_next); in handle_getinfo()
2249 partlist_free(pl); in handle_getinfo()