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