1 #ifndef ANDROID_PERMS_H
2 # define ANDROID_PERMS_H
3
4 # include "config.h"
5 # include <ext2fs/ext2fs.h>
6
7 typedef void (*fs_config_f)(const char *path, int dir,
8 const char *target_out_path,
9 unsigned *uid, unsigned *gid,
10 unsigned *mode, uint64_t *capabilities);
11
12 /*
13 * Represents a range of UID/GID mapping.
14 * This maps the id in [|parent_id|, |parent_id| + |length|) into
15 * [|child_id|, |child_id| + |length|)
16 */
17 struct ugid_map_entry {
18 unsigned int child_id;
19 unsigned int parent_id;
20 unsigned int length;
21 };
22
23 struct ugid_map {
24 /* The number of elements in |entries|. */
25 size_t size;
26
27 /* An array of entries. If |size| is 0, this is a null pointer. */
28 struct ugid_map_entry* entries;
29 };
30
31 # ifdef _WIN32
32 struct selabel_handle;
android_configure_fs(ext2_filsys fs,char * src_dir,char * target_out,char * mountpoint,void * seopts,unsigned int nopt,char * fs_config_file,time_t fixed_time,const struct ugid_map * uid_map,const struct ugdi_map * gid_map)33 static inline errcode_t android_configure_fs(ext2_filsys fs,
34 char *src_dir,
35 char *target_out,
36 char *mountpoint,
37 void *seopts,
38 unsigned int nopt,
39 char *fs_config_file,
40 time_t fixed_time,
41 const struct ugid_map* uid_map,
42 const struct ugdi_map* gid_map)
43 {
44 return 0;
45 }
46 # else
47 # include <selinux/selinux.h>
48 # include <selinux/label.h>
49 # if defined(__ANDROID__)
50 # include <selinux/android.h>
51 # include <private/android_filesystem_config.h>
52 # include <private/canned_fs_config.h>
53 # include <private/fs_config.h>
54 # else /* !__ANDROID__ */
55 #include "dac_config.h"
56 # endif
57
58 errcode_t android_configure_fs(ext2_filsys fs, char *src_dir,
59 char *target_out,
60 char *mountpoint,
61 struct selinux_opt *seopts,
62 unsigned int nopt,
63 char *fs_config_file, time_t fixed_time,
64 const struct ugid_map* uid_map,
65 const struct ugid_map* gid_map);
66
67 # endif
68 #endif /* !ANDROID_PERMS_H */
69