| 1619 | } |
| 1620 | |
| 1621 | static enum ifwi_ret ifwi_extract(void) |
| 1622 | { |
| 1623 | if (!param.file_name) { |
| 1624 | ERROR("%s: -f option required\n", __func__); |
| 1625 | return COMMAND_ERR; |
| 1626 | } |
| 1627 | |
| 1628 | if (!param.subpart_name) { |
| 1629 | ERROR("%s: -n option required\n", __func__); |
| 1630 | return COMMAND_ERR; |
| 1631 | } |
| 1632 | |
| 1633 | int type = find_type_by_name(param.subpart_name); |
| 1634 | if (type == -1) |
| 1635 | return COMMAND_ERR; |
| 1636 | |
| 1637 | if (type == S_BPDT_TYPE) { |
| 1638 | INFO("Tool does not support raw extract for %s\n", |
| 1639 | param.subpart_name); |
| 1640 | return NO_ACTION_REQUIRED; |
| 1641 | } |
| 1642 | |
| 1643 | if (buffer_size(&ifwi_image.subpart_buf[type]) == 0) { |
| 1644 | ERROR("Image does not contain sub-partition %s(%d).\n", |
| 1645 | param.subpart_name, type); |
| 1646 | return COMMAND_ERR; |
| 1647 | } |
| 1648 | |
| 1649 | INFO("Extracting sub-partition %s(%d).\n", param.subpart_name, type); |
| 1650 | if (param.dir_ops) |
| 1651 | return ifwi_dir_extract(type); |
| 1652 | |
| 1653 | return ifwi_raw_extract(type); |
| 1654 | } |
| 1655 | |
| 1656 | static enum ifwi_ret ifwi_print(void) |
| 1657 | { |
nothing calls this directly
no test coverage detected