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
23int idmap_create_path(const char *target_apk_path, const char *overlay_apk_path,
24        const char *idmap_path);
25
26int idmap_create_fd(const char *target_apk_path, const char *overlay_apk_path, int fd);
27
28int idmap_verify_fd(const char *target_apk_path, const char *overlay_apk_path, int fd);
29
30// Regarding target_package_name: the idmap_scan implementation should
31// be able to extract this from the manifest in target_apk_path,
32// simplifying the external API.
33int idmap_scan(const char *target_package_name, const char *target_apk_path,
34        const char *idmap_dir, const android::Vector<const char *> *overlay_dirs);
35
36int idmap_inspect(const char *idmap_path);
37
38#endif // _IDMAP_H_
39