1 
2 #ifndef _IDMAP_H_
3 #define _IDMAP_H_
4 
5 #define LOG_TAG "idmap"
6 
7 #include <utils/Log.h>
8 #include <utils/Vector.h>
9 
10 #include <errno.h>
11 #include <stdio.h>
12 
13 #ifndef TEMP_FAILURE_RETRY
14 // Used to retry syscalls that can return EINTR.
15 #define TEMP_FAILURE_RETRY(exp) ({         \
16     typeof (exp) _rc;                      \
17     do {                                   \
18         _rc = (exp);                       \
19     } while (_rc == -1 && errno == EINTR); \
20     _rc; })
21 #endif
22 
23 int idmap_create_path(const char *target_apk_path, const char *overlay_apk_path,
24         const char *idmap_path);
25 
26 int idmap_create_fd(const char *target_apk_path, const char *overlay_apk_path, int fd);
27 
28 // Regarding target_package_name: the idmap_scan implementation should
29 // be able to extract this from the manifest in target_apk_path,
30 // simplifying the external API.
31 int idmap_scan(const char *target_package_name, const char *target_apk_path,
32         const char *idmap_dir, const android::Vector<const char *> *overlay_dirs);
33 
34 int idmap_inspect(const char *idmap_path);
35 
36 #endif // _IDMAP_H_
37