bigbiff | 32cbabe | 2020-04-12 19:16:19 -0400 | [diff] [blame] | 1 | |
| 2 | #ifndef TWRPAPEX_HPP |
| 3 | #define TWRPAPEX_HPP |
| 4 | |
| 5 | #include <string> |
| 6 | #include <vector> |
| 7 | #include <filesystem> |
| 8 | |
| 9 | #include <sys/types.h> |
| 10 | #include <sys/stat.h> |
| 11 | #include <sys/ioctl.h> |
| 12 | #include <linux/loop.h> |
| 13 | #include <sys/mount.h> |
| 14 | #include <sys/sysmacros.h> |
| 15 | #include <fcntl.h> |
| 16 | #include <unistd.h> |
| 17 | |
| 18 | #include <ziparchive/zip_archive.h> |
| 19 | #include "twcommon.h" |
| 20 | |
bigbiff | 32cbabe | 2020-04-12 19:16:19 -0400 | [diff] [blame] | 21 | #define APEX_DIR "/system_root/system/apex" |
| 22 | #define APEX_PAYLOAD "apex_payload.img" |
| 23 | #define LOOP_BLOCK_DEVICE_DIR "/dev/block/" |
bigbiff | ad58e1b | 2020-07-06 20:24:34 -0400 | [diff] [blame] | 24 | #define APEX_BASE "/apex/" |
bigbiff | 0e97f7e | 2021-02-25 10:16:59 -0500 | [diff] [blame^] | 25 | #define LOOP_CONTROL "/dev/loop-control" |
bigbiff | 32cbabe | 2020-04-12 19:16:19 -0400 | [diff] [blame] | 26 | |
| 27 | class twrpApex { |
| 28 | public: |
| 29 | bool loadApexImages(); |
| 30 | |
| 31 | private: |
| 32 | std::string unzipImage(std::string file); |
bigbiff | 0e97f7e | 2021-02-25 10:16:59 -0500 | [diff] [blame^] | 33 | bool mountApexOnLoopbackDevices(std::vector<std::string> apexFiles); |
bigbiff | 32cbabe | 2020-04-12 19:16:19 -0400 | [diff] [blame] | 34 | bool loadApexImage(std::string fileToMount, size_t loop_device_number); |
| 35 | }; |
| 36 | #endif |