summaryrefslogtreecommitdiffstats
path: root/contrib/android/perms.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 09:25:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 09:25:10 +0000
commit5dced3d1b3deca80e01415a2e35dc7972dcbfae7 (patch)
tree6a403684e0978f0287d7f0ec0e5aab1fd31a59e1 /contrib/android/perms.h
parentInitial commit. (diff)
downloade2fsprogs-5dced3d1b3deca80e01415a2e35dc7972dcbfae7.tar.xz
e2fsprogs-5dced3d1b3deca80e01415a2e35dc7972dcbfae7.zip
Adding upstream version 1.47.0.upstream/1.47.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--contrib/android/perms.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/contrib/android/perms.h b/contrib/android/perms.h
new file mode 100644
index 0000000..9ea3f95
--- /dev/null
+++ b/contrib/android/perms.h
@@ -0,0 +1,65 @@
+#ifndef ANDROID_PERMS_H
+# define ANDROID_PERMS_H
+
+# include <ext2fs/ext2fs.h>
+
+typedef void (*fs_config_f)(const char *path, int dir,
+ const char *target_out_path,
+ unsigned *uid, unsigned *gid,
+ unsigned *mode, uint64_t *capabilities);
+
+/*
+ * Represents a range of UID/GID mapping.
+ * This maps the id in [|parent_id|, |parent_id| + |length|) into
+ * [|child_id|, |child_id| + |length|)
+ */
+struct ugid_map_entry {
+ unsigned int child_id;
+ unsigned int parent_id;
+ unsigned int length;
+};
+
+struct ugid_map {
+ /* The number of elements in |entries|. */
+ size_t size;
+
+ /* An array of entries. If |size| is 0, this is a null pointer. */
+ struct ugid_map_entry* entries;
+};
+
+# ifdef _WIN32
+struct selabel_handle;
+static inline errcode_t 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)
+{
+ return 0;
+}
+# else
+# include <selinux/selinux.h>
+# include <selinux/label.h>
+# if defined(__ANDROID__)
+# include <selinux/android.h>
+# endif
+# include <private/android_filesystem_config.h>
+# include <private/canned_fs_config.h>
+# include <private/fs_config.h>
+
+errcode_t android_configure_fs(ext2_filsys fs, char *src_dir,
+ char *target_out,
+ char *mountpoint,
+ struct selinux_opt *seopts,
+ unsigned int nopt,
+ char *fs_config_file, time_t fixed_time,
+ const struct ugid_map* uid_map,
+ const struct ugid_map* gid_map);
+
+# endif
+#endif /* !ANDROID_PERMS_H */