Whamcloud - gitweb
79871272040b0c82e874250b84b063c83e0e3c4c
[tools/e2fsprogs.git] / contrib / android / perms.h
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;
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 #  endif
52 #  include <private/android_filesystem_config.h>
53 #  include <private/canned_fs_config.h>
54 #  include <private/fs_config.h>
55
56 errcode_t android_configure_fs(ext2_filsys fs, char *src_dir,
57                                char *target_out,
58                                char *mountpoint,
59                                struct selinux_opt *seopts,
60                                unsigned int nopt,
61                                char *fs_config_file, time_t fixed_time,
62                                const struct ugid_map* uid_map,
63                                const struct ugid_map* gid_map);
64
65 # endif
66 #endif /* !ANDROID_PERMS_H */