Lines Matching refs:pl

966 	struct partlist *pl;  in partlist_alloc()  local
968 if ((pl = calloc(1, sizeof (*pl))) == NULL) { in partlist_alloc()
973 pl->pl_device = calloc(1, sizeof (*pl->pl_device)); in partlist_alloc()
974 if (pl->pl_device == NULL) { in partlist_alloc()
976 free(pl); in partlist_alloc()
980 return (pl); in partlist_alloc()
984 partlist_free(struct partlist *pl) in partlist_free() argument
989 switch (pl->pl_type) { in partlist_free()
992 free(pl->pl_stage); in partlist_free()
995 if (pl->pl_stage != NULL) { in partlist_free()
996 bblock = pl->pl_stage; in partlist_free()
1003 if (pl->pl_device->stage.mntpnt != NULL) { in partlist_free()
1004 if (umount(pl->pl_device->stage.mntpnt) == 0) in partlist_free()
1005 (void) rmdir(pl->pl_device->stage.mntpnt); in partlist_free()
1006 free(pl->pl_device->stage.mntpnt); in partlist_free()
1008 device = pl->pl_device; in partlist_free()
1010 free(pl->pl_device); in partlist_free()
1012 free(pl->pl_src_data); in partlist_free()
1013 free(pl->pl_devname); in partlist_free()
1014 free(pl); in partlist_free()
1068 get_slice(ib_data_t *data, struct partlist *pl, struct dk_gpt *vtoc, in get_slice() argument
1072 ib_device_t *device = pl->pl_device; in get_slice()
1093 pl->pl_devname = ptr; in get_slice()
1119 struct partlist *pl; in allocate_slice() local
1122 if ((pl = partlist_alloc()) == NULL) in allocate_slice()
1125 pl->pl_device = calloc(1, sizeof (*pl->pl_device)); in allocate_slice()
1126 if (pl->pl_device == NULL) { in allocate_slice()
1128 partlist_free(pl); in allocate_slice()
1131 if (!get_slice(data, pl, vtoc, tag)) { in allocate_slice()
1132 partlist_free(pl); in allocate_slice()
1137 if (pl->pl_devname == NULL) in allocate_slice()
1138 partlist_free(pl); in allocate_slice()
1140 *plp = pl; in allocate_slice()
1148 struct partlist *pl; in probe_gpt() local
1174 if (!allocate_slice(data, vtoc, V_BOOT, &pl)) in probe_gpt()
1176 if (pl != NULL) { in probe_gpt()
1177 pl->pl_src_name = stage1; in probe_gpt()
1178 pl->pl_type = IB_BBLK_STAGE1; in probe_gpt()
1179 pl->pl_cb.compare = compare_stage1_cb; in probe_gpt()
1180 pl->pl_cb.install = install_stage1_cb; in probe_gpt()
1181 pl->pl_cb.read = read_stage1_cb; in probe_gpt()
1182 pl->pl_cb.read_bbl = read_stage1_bbl_cb; in probe_gpt()
1183 pl->pl_cb.print = print_stage1_cb; in probe_gpt()
1184 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_gpt()
1193 if (!allocate_slice(data, vtoc, V_BOOT, &pl)) in probe_gpt()
1195 if (pl != NULL) { in probe_gpt()
1196 pl->pl_src_name = stage2; in probe_gpt()
1197 pl->pl_type = IB_BBLK_STAGE2; in probe_gpt()
1198 pl->pl_cb.compare = compare_einfo_cb; in probe_gpt()
1199 pl->pl_cb.install = install_stage2_cb; in probe_gpt()
1200 pl->pl_cb.read = read_stage2_cb; in probe_gpt()
1201 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_gpt()
1202 pl->pl_cb.print = print_einfo_cb; in probe_gpt()
1203 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_gpt()
1207 if (!allocate_slice(data, vtoc, V_SYSTEM, &pl)) in probe_gpt()
1209 if (pl != NULL) { in probe_gpt()
1210 pl->pl_device->stage.path = "/EFI/Boot/" BOOTIA32; in probe_gpt()
1211 pl->pl_src_name = efi32; in probe_gpt()
1212 pl->pl_type = IB_BBLK_EFI; in probe_gpt()
1213 pl->pl_cb.compare = compare_einfo_cb; in probe_gpt()
1214 pl->pl_cb.install = install_esp_cb; in probe_gpt()
1215 pl->pl_cb.read = read_einfo_esp_cb; in probe_gpt()
1216 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_gpt()
1217 pl->pl_cb.print = print_einfo_cb; in probe_gpt()
1218 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_gpt()
1220 if (!allocate_slice(data, vtoc, V_SYSTEM, &pl)) in probe_gpt()
1222 if (pl != NULL) { in probe_gpt()
1223 pl->pl_device->stage.path = "/EFI/Boot/" BOOTX64; in probe_gpt()
1224 pl->pl_src_name = efi64; in probe_gpt()
1225 pl->pl_type = IB_BBLK_EFI; in probe_gpt()
1226 pl->pl_cb.compare = compare_einfo_cb; in probe_gpt()
1227 pl->pl_cb.install = install_esp_cb; in probe_gpt()
1228 pl->pl_cb.read = read_einfo_esp_cb; in probe_gpt()
1229 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_gpt()
1230 pl->pl_cb.print = print_einfo_cb; in probe_gpt()
1231 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_gpt()
1235 pl = partlist_alloc(); in probe_gpt()
1236 if (pl == NULL) in probe_gpt()
1239 device = pl->pl_device; in probe_gpt()
1241 if ((pl->pl_devname = strdup(data->target.path)) == NULL) { in probe_gpt()
1243 partlist_free(pl); in probe_gpt()
1254 pl->pl_src_name = stage1; in probe_gpt()
1255 pl->pl_type = IB_BBLK_STAGE1; in probe_gpt()
1256 pl->pl_cb.compare = compare_stage1_cb; in probe_gpt()
1257 pl->pl_cb.install = install_stage1_cb; in probe_gpt()
1258 pl->pl_cb.read = read_stage1_cb; in probe_gpt()
1259 pl->pl_cb.read_bbl = read_stage1_bbl_cb; in probe_gpt()
1260 pl->pl_cb.print = print_stage1_cb; in probe_gpt()
1261 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_gpt()
1265 pl = partlist_alloc(); in probe_gpt()
1266 if (pl == NULL) in probe_gpt()
1269 device = pl->pl_device; in probe_gpt()
1272 if ((pl->pl_devname = strdup(data->target.path)) == NULL) { in probe_gpt()
1282 pl->pl_src_name = stage2; in probe_gpt()
1283 pl->pl_type = IB_BBLK_STAGE2; in probe_gpt()
1284 pl->pl_cb.compare = compare_einfo_cb; in probe_gpt()
1285 pl->pl_cb.install = install_stage2_cb; in probe_gpt()
1286 pl->pl_cb.read = read_stage2_cb; in probe_gpt()
1287 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_gpt()
1288 pl->pl_cb.print = print_einfo_cb; in probe_gpt()
1289 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_gpt()
1301 struct partlist *pl; in get_start_sector() local
1335 pl = STAILQ_FIRST(data->plist); in get_start_sector()
1336 if (!read_stage1_cb(pl)) in get_start_sector()
1339 mbr = (struct mboot *)pl->pl_stage; in get_start_sector()
1349 rval = libfdisk_init(&epp, pl->pl_devname, part, FDISK_READ_DISK); in get_start_sector()
1400 struct partlist *pl; in probe_vtoc() local
1473 pl = partlist_alloc(); in probe_vtoc()
1474 if (pl == NULL) { in probe_vtoc()
1478 pl->pl_devname = ptr; in probe_vtoc()
1479 device = pl->pl_device; in probe_vtoc()
1500 pl->pl_src_name = stage1; in probe_vtoc()
1501 pl->pl_type = IB_BBLK_STAGE1; in probe_vtoc()
1502 pl->pl_cb.compare = compare_stage1_cb; in probe_vtoc()
1503 pl->pl_cb.install = install_stage1_cb; in probe_vtoc()
1504 pl->pl_cb.read = read_stage1_cb; in probe_vtoc()
1505 pl->pl_cb.read_bbl = read_stage1_bbl_cb; in probe_vtoc()
1506 pl->pl_cb.print = print_stage1_cb; in probe_vtoc()
1507 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_vtoc()
1510 pl = partlist_alloc(); in probe_vtoc()
1511 if (pl == NULL) { in probe_vtoc()
1515 pl->pl_devname = strdup(ptr); in probe_vtoc()
1516 if (pl->pl_devname == NULL) { in probe_vtoc()
1517 partlist_free(pl); in probe_vtoc()
1520 pl->pl_device->stage.devtype = data->device.devtype; in probe_vtoc()
1521 pl->pl_device->stage.id = device->stage.id; in probe_vtoc()
1522 pl->pl_device->stage.offset = BBLK_BLKLIST_OFF; in probe_vtoc()
1523 pl->pl_device->stage.tag = device->stage.tag; in probe_vtoc()
1524 pl->pl_device->stage.start = device->stage.start; in probe_vtoc()
1525 pl->pl_device->stage.size = device->stage.size; in probe_vtoc()
1526 pl->pl_src_name = stage2; in probe_vtoc()
1527 pl->pl_type = IB_BBLK_STAGE2; in probe_vtoc()
1528 pl->pl_cb.compare = compare_einfo_cb; in probe_vtoc()
1529 pl->pl_cb.install = install_stage2_cb; in probe_vtoc()
1530 pl->pl_cb.read = read_stage2_cb; in probe_vtoc()
1531 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_vtoc()
1532 pl->pl_cb.print = print_einfo_cb; in probe_vtoc()
1533 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_vtoc()
1543 struct partlist *pl; in probe_mbr() local
1553 pl = STAILQ_FIRST(data->plist); in probe_mbr()
1554 if (!read_stage1_cb(pl)) in probe_mbr()
1557 mbr = (struct mboot *)pl->pl_stage; in probe_mbr()
1571 path = (char *)pl->pl_devname; in probe_mbr()
1572 if ((pl = partlist_alloc()) == NULL) in probe_mbr()
1574 device = pl->pl_device; in probe_mbr()
1581 pl->pl_devname = strdup(path); in probe_mbr()
1582 if (pl->pl_devname == NULL) { in probe_mbr()
1584 partlist_free(pl); in probe_mbr()
1593 pl->pl_src_name = stage2; in probe_mbr()
1594 pl->pl_type = IB_BBLK_STAGE2; in probe_mbr()
1595 pl->pl_cb.compare = compare_einfo_cb; in probe_mbr()
1596 pl->pl_cb.install = install_stage2_cb; in probe_mbr()
1597 pl->pl_cb.read = read_stage2_cb; in probe_mbr()
1598 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_mbr()
1599 pl->pl_cb.print = print_einfo_cb; in probe_mbr()
1600 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_mbr()
1608 partlist_free(pl); in probe_mbr()
1619 partlist_free(pl); in probe_mbr()
1622 pl->pl_devname = ptr; in probe_mbr()
1628 pl->pl_src_name = stage1; in probe_mbr()
1629 pl->pl_type = IB_BBLK_STAGE1; in probe_mbr()
1630 pl->pl_cb.compare = compare_stage1_cb; in probe_mbr()
1631 pl->pl_cb.install = install_stage1_cb; in probe_mbr()
1632 pl->pl_cb.read = read_stage1_cb; in probe_mbr()
1633 pl->pl_cb.read_bbl = read_stage1_bbl_cb; in probe_mbr()
1634 pl->pl_cb.print = print_stage1_cb; in probe_mbr()
1635 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_mbr()
1637 pl = partlist_alloc(); in probe_mbr()
1638 if (pl == NULL) in probe_mbr()
1640 device = pl->pl_device; in probe_mbr()
1641 pl->pl_devname = strdup(ptr); in probe_mbr()
1642 if (pl->pl_devname == NULL) { in probe_mbr()
1644 partlist_free(pl); in probe_mbr()
1655 pl->pl_src_name = stage2; in probe_mbr()
1656 pl->pl_type = IB_BBLK_STAGE2; in probe_mbr()
1657 pl->pl_cb.compare = compare_einfo_cb; in probe_mbr()
1658 pl->pl_cb.install = install_stage2_cb; in probe_mbr()
1659 pl->pl_cb.read = read_stage2_cb; in probe_mbr()
1660 pl->pl_cb.read_bbl = read_stage2_file_cb; in probe_mbr()
1661 pl->pl_cb.print = print_einfo_cb; in probe_mbr()
1662 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_mbr()
1670 struct partlist *pl; in probe_device() local
1681 if ((pl = partlist_alloc()) == NULL) in probe_device()
1686 partlist_free(pl); in probe_device()
1692 pl->pl_devname = (char *)dev; in probe_device()
1694 pl->pl_type = IB_BBLK_FILE; in probe_device()
1695 pl->pl_cb.read = read_einfo_file_cb; in probe_device()
1696 pl->pl_cb.print = print_einfo_cb; in probe_device()
1697 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_device()
1711 partlist_free(pl); in probe_device()
1717 partlist_free(pl); in probe_device()
1724 partlist_free(pl); in probe_device()
1728 pl->pl_devname = p0; in probe_device()
1737 if ((fd = open_device(pl->pl_devname)) == -1) { in probe_device()
1738 partlist_free(pl); in probe_device()
1745 pl->pl_src_name = stage1; in probe_device()
1746 pl->pl_type = IB_BBLK_MBR; in probe_device()
1747 pl->pl_cb.compare = compare_mbr_cb; in probe_device()
1748 pl->pl_cb.install = install_stage1_cb; in probe_device()
1749 pl->pl_cb.read = read_stage1_cb; in probe_device()
1750 pl->pl_cb.read_bbl = read_stage1_bbl_cb; in probe_device()
1751 pl->pl_cb.print = print_stage1_cb; in probe_device()
1752 STAILQ_INSERT_TAIL(data->plist, pl, pl_next); in probe_device()
1929 prepare_bootblock(ib_data_t *data, struct partlist *pl, char *updt_str) in prepare_bootblock() argument
1934 assert(pl != NULL); in prepare_bootblock()
1936 bblock = pl->pl_src_data; in prepare_bootblock()
1992 struct partlist *pl; in prepare_bblocks() local
2005 STAILQ_FOREACH(pl, data->plist, pl_next) { in prepare_bblocks()
2006 if (pl->pl_type == IB_BBLK_STAGE2) { in prepare_bblocks()
2007 stage2 = pl; in prepare_bblocks()
2013 if (pl->pl_cb.compare != NULL && in prepare_bblocks()
2014 pl->pl_cb.compare(pl)) in prepare_bblocks()
2023 STAILQ_FOREACH(pl, data->plist, pl_next) { in prepare_bblocks()
2024 switch (pl->pl_type) { in prepare_bblocks()
2026 mbr = pl; in prepare_bblocks()
2029 stage1 = pl; in prepare_bblocks()
2035 prepare_bootblock(data, pl, update_str); in prepare_bblocks()
2077 struct partlist *pl; in handle_install() local
2143 STAILQ_FOREACH(pl, data.plist, pl_next) { in handle_install()
2144 if (!pl->pl_cb.read(pl)) { in handle_install()
2147 if (!pl->pl_cb.read_bbl(pl)) { in handle_install()
2153 if (pl->pl_type != IB_BBLK_EFI) in handle_install()
2162 while ((pl = STAILQ_LAST(data.plist, partlist, pl_next)) != in handle_install()
2164 if (pl->pl_cb.compare != NULL && in handle_install()
2165 pl->pl_cb.compare(pl)) { in handle_install()
2166 if (pl->pl_cb.install != NULL) in handle_install()
2167 pl->pl_cb.install(&data, pl); in handle_install()
2169 STAILQ_REMOVE(data.plist, pl, partlist, pl_next); in handle_install()
2170 partlist_free(pl); in handle_install()
2176 while ((pl = STAILQ_LAST(data.plist, partlist, pl_next)) != NULL) { in handle_install()
2177 STAILQ_REMOVE(data.plist, pl, partlist, pl_next); in handle_install()
2178 partlist_free(pl); in handle_install()
2203 struct partlist *pl; in handle_getinfo() local
2226 STAILQ_FOREACH(pl, data.plist, pl_next) { in handle_getinfo()
2227 if (pl->pl_cb.read(pl)) in handle_getinfo()
2228 pl->pl_cb.print(pl); in handle_getinfo()
2234 while ((pl = STAILQ_LAST(data.plist, partlist, pl_next)) != NULL) { in handle_getinfo()
2235 STAILQ_REMOVE(data.plist, pl, partlist, pl_next); in handle_getinfo()
2236 partlist_free(pl); in handle_getinfo()