1 | #include <libkern/libkern.h> |
---|---|
2 | #include <libkern/section_keywords.h> |
3 | #include <libkern/compression/compression.h> |
4 | |
5 | #if defined(SECURITY_READ_ONLY_LATE) |
6 | SECURITY_READ_ONLY_LATE(const compression_ki_t*) compression_ki_ptr = NULL; |
7 | static SECURITY_READ_ONLY_LATE(registration_callback_t) registration_callback = NULL; |
8 | #else |
9 | const compression_ki_t* compression_ki_ptr = NULL; |
10 | static registration_callback_t registration_callback = NULL; |
11 | #endif |
12 | |
13 | void |
14 | compression_interface_register(const compression_ki_t *ki) |
15 | { |
16 | if (compression_ki_ptr) { |
17 | panic("compression interface already set"); |
18 | } |
19 | |
20 | compression_ki_ptr = ki; |
21 | |
22 | if (registration_callback) { |
23 | registration_callback(); |
24 | } |
25 | } |
26 | |
27 | void |
28 | compression_interface_set_registration_callback(registration_callback_t callback) |
29 | { |
30 | if (callback && registration_callback) { |
31 | panic("compression interface registration callback is already set"); |
32 | } |
33 | |
34 | registration_callback = callback; |
35 | } |
36 |