diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2023-03-14 12:19:48 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2023-03-21 16:23:54 -0400 |
commit | d40a598970b04bfe3a867a5e12debc45c149b46b (patch) | |
tree | 26e974f910f7d3047adfbc536d8e10c2d973b7e9 /apps/plugin.c | |
parent | 2fb2364686e5470437f0ee3d214662d51067eb90 (diff) | |
download | rockbox-d40a598970b04bfe3a867a5e12debc45c149b46b.tar.gz rockbox-d40a598970b04bfe3a867a5e12debc45c149b46b.zip |
plugins: Simplify plugin/codec API versioning
Replace the minimum version bound with a check on the size of
the API struct. The version only needs to be incremented for
ABI breaking changes. Additions to the API won't need to touch
the version number, resulting in fewer merge conflicts.
Change-Id: I916a04a7bf5890dcf5d615ce30087643165f8e1f
Diffstat (limited to 'apps/plugin.c')
-rw-r--r-- | apps/plugin.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index cdbe340ddd..1a0aedf3cc 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -864,10 +864,8 @@ int plugin_load(const char* plugin, const void* parameter) | |||
864 | } | 864 | } |
865 | 865 | ||
866 | p_hdr = lc_get_header(current_plugin_handle); | 866 | p_hdr = lc_get_header(current_plugin_handle); |
867 | |||
868 | hdr = p_hdr ? &p_hdr->lc_hdr : NULL; | 867 | hdr = p_hdr ? &p_hdr->lc_hdr : NULL; |
869 | 868 | ||
870 | |||
871 | if (hdr == NULL | 869 | if (hdr == NULL |
872 | || hdr->magic != PLUGIN_MAGIC | 870 | || hdr->magic != PLUGIN_MAGIC |
873 | || hdr->target_id != TARGET_ID | 871 | || hdr->target_id != TARGET_ID |
@@ -881,13 +879,15 @@ int plugin_load(const char* plugin, const void* parameter) | |||
881 | splash(HZ*2, ID2P(LANG_PLUGIN_WRONG_MODEL)); | 879 | splash(HZ*2, ID2P(LANG_PLUGIN_WRONG_MODEL)); |
882 | return -1; | 880 | return -1; |
883 | } | 881 | } |
884 | if (hdr->api_version > PLUGIN_API_VERSION | 882 | |
885 | || hdr->api_version < PLUGIN_MIN_API_VERSION) | 883 | if (hdr->api_version != PLUGIN_API_VERSION || |
884 | p_hdr->api_size > sizeof(struct plugin_api)) | ||
886 | { | 885 | { |
887 | lc_close(current_plugin_handle); | 886 | lc_close(current_plugin_handle); |
888 | splash(HZ*2, ID2P(LANG_PLUGIN_WRONG_VERSION)); | 887 | splash(HZ*2, ID2P(LANG_PLUGIN_WRONG_VERSION)); |
889 | return -1; | 888 | return -1; |
890 | } | 889 | } |
890 | |||
891 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 891 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
892 | /* tlsf crashes observed on arm with 0x4 aligned addresses */ | 892 | /* tlsf crashes observed on arm with 0x4 aligned addresses */ |
893 | plugin_size = ALIGN_UP(hdr->end_addr - pluginbuf, 0x8); | 893 | plugin_size = ALIGN_UP(hdr->end_addr - pluginbuf, 0x8); |