summaryrefslogtreecommitdiff
path: root/kernel_call/platform_match.h
diff options
context:
space:
mode:
Diffstat (limited to 'kernel_call/platform_match.h')
-rwxr-xr-xkernel_call/platform_match.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/kernel_call/platform_match.h b/kernel_call/platform_match.h
new file mode 100755
index 0000000..18479a8
--- /dev/null
+++ b/kernel_call/platform_match.h
@@ -0,0 +1,62 @@
+/*
+ * platform_match.h
+ * Brandon Azad
+ */
+#ifndef VOUCHER_SWAP__PLATFORM_MATCH_H_
+#define VOUCHER_SWAP__PLATFORM_MATCH_H_
+
+#include <stdbool.h>
+
+/*
+ * platform_matches_device
+ *
+ * Description:
+ * Check whether the current platform matches the specified device or range of devices.
+ *
+ * Match format:
+ * The match string may either specify a single device glob or a range of device globs. For
+ * example:
+ *
+ * "iPhone11,8" Matches only iPhone11,8
+ * "iPhone11,*" Matches all iPhone11 devices, including e.g. iPhone11,4.
+ * "iPhone*,*" Matches all iPhone devices.
+ * "iPhone11,4-iPhone11,8" Matches all iPhone devices between 11,4 and 11,8, inclusive.
+ * "iPhone10,*-11,*" Matches all iPhone10 and iPhone11 devices.
+ *
+ * As a special case, "*" matches all devices.
+ */
+bool platform_matches_device(const char *device_range);
+
+/*
+ * platform_matches_build
+ *
+ * Description:
+ * Check whether the current platform matches the specified build version or range of build
+ * versions.
+ *
+ * Match format:
+ * The match string may either specify a single build version or a range of build versions.
+ * For example:
+ *
+ * "16C50" Matches only build 16C50.
+ * "16B92-16C50" Matches all builds between 16B92 and 16C50, inclusive.
+ *
+ * As a special case, either build version may be replaced with "*" to indicate a lack of
+ * lower or upper bound:
+ *
+ * "*-16B92" Matches all builds up to and including 16B92.
+ * "16C50-*" Matches build 16C50 and later.
+ * "*" Matches all build versions.
+ */
+bool platform_matches_build(const char *build_range);
+
+/*
+ * platform_matches
+ *
+ * Description:
+ * A convenience function that combines platform_matches_device() and
+ * platform_matches_build().
+ */
+bool platform_matches(const char *device_range, const char *build_range);
+
+#endif