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