summaryrefslogtreecommitdiff
path: root/apps/plugin.h
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2023-03-14 12:19:48 +0000
committerAidan MacDonald <amachronic@protonmail.com>2023-03-21 16:23:54 -0400
commitd40a598970b04bfe3a867a5e12debc45c149b46b (patch)
tree26e974f910f7d3047adfbc536d8e10c2d973b7e9 /apps/plugin.h
parent2fb2364686e5470437f0ee3d214662d51067eb90 (diff)
downloadrockbox-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.h')
-rw-r--r--apps/plugin.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/apps/plugin.h b/apps/plugin.h
index 286a5e2794..cf6a1bc4e4 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -157,13 +157,12 @@ int plugin_open(const char *plugin, const char *parameter);
157 157
158#define PLUGIN_MAGIC 0x526F634B /* RocK */ 158#define PLUGIN_MAGIC 0x526F634B /* RocK */
159 159
160/* increase this every time the api struct changes */ 160/*
161#define PLUGIN_API_VERSION 265 161 * Increment this whenever a change breaks the plugin ABI,
162 162 * when this happens please take the opportunity to sort in
163/* update this to latest version if a change to the api struct breaks 163 * any new functions "waiting" at the end of the list.
164 backwards compatibility (and please take the opportunity to sort in any 164 */
165 new function which are "waiting" at the end of the function table) */ 165#define PLUGIN_API_VERSION 266
166#define PLUGIN_MIN_API_VERSION 260
167 166
168/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ 167/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
169 168
@@ -962,6 +961,7 @@ struct plugin_header {
962 struct lc_header lc_hdr; /* must be the first */ 961 struct lc_header lc_hdr; /* must be the first */
963 enum plugin_status(*entry_point)(const void*); 962 enum plugin_status(*entry_point)(const void*);
964 const struct plugin_api **api; 963 const struct plugin_api **api;
964 size_t api_size;
965}; 965};
966 966
967#ifdef PLUGIN 967#ifdef PLUGIN
@@ -973,14 +973,15 @@ extern unsigned char plugin_end_addr[];
973 const struct plugin_header __header \ 973 const struct plugin_header __header \
974 __attribute__ ((section (".header")))= { \ 974 __attribute__ ((section (".header")))= { \
975 { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ 975 { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
976 plugin_start_addr, plugin_end_addr }, plugin__start, &rb }; 976 plugin_start_addr, plugin_end_addr, }, \
977 plugin__start, &rb, sizeof(struct plugin_api) };
977#else /* PLATFORM_HOSTED */ 978#else /* PLATFORM_HOSTED */
978#define PLUGIN_HEADER \ 979#define PLUGIN_HEADER \
979 const struct plugin_api *rb DATA_ATTR; \ 980 const struct plugin_api *rb DATA_ATTR; \
980 const struct plugin_header __header \ 981 const struct plugin_header __header \
981 __attribute__((visibility("default"))) = { \ 982 __attribute__((visibility("default"))) = { \
982 { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, NULL, NULL }, \ 983 { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, NULL, NULL }, \
983 plugin__start, &rb }; 984 plugin__start, &rb, sizeof(struct plugin_api) };
984#endif /* CONFIG_PLATFORM */ 985#endif /* CONFIG_PLATFORM */
985#endif /* PLUGIN */ 986#endif /* PLUGIN */
986 987