summaryrefslogtreecommitdiff
path: root/firmware/include/buflib.h
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-01-18 18:57:06 +0000
committerAidan MacDonald <amachronic@protonmail.com>2022-02-12 10:24:32 -0500
commite8faf2f2adeb9066de3c968a57803bb262f61ee1 (patch)
tree130c2e3d904da7876ac88ea089f85f48cab5e313 /firmware/include/buflib.h
parent95dfc489b5a602f68202b206c434f8485e9d3915 (diff)
downloadrockbox-e8faf2f2adeb9066de3c968a57803bb262f61ee1.tar.gz
rockbox-e8faf2f2adeb9066de3c968a57803bb262f61ee1.zip
buflib: add a common dummy callbacks struct & use it
There are various allocations that can't be moved or shrunk. Provide a global callback struct for this use case instead of making each caller declare its own dummy struct. Also fixed ROLO and x1000 installer code which incorrectly used movable allocations. Change-Id: I00088396b9826e02e69a4a33477fe1a7816374f1
Diffstat (limited to 'firmware/include/buflib.h')
-rw-r--r--firmware/include/buflib.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/firmware/include/buflib.h b/firmware/include/buflib.h
index 7f534c6ce0..e805ebbf1b 100644
--- a/firmware/include/buflib.h
+++ b/firmware/include/buflib.h
@@ -129,6 +129,12 @@ struct buflib_callbacks {
129 void (*sync_callback)(int handle, bool sync_on); 129 void (*sync_callback)(int handle, bool sync_on);
130}; 130};
131 131
132/** A set of all NULL callbacks for use with allocations that need to stay
133 * locked in RAM and not moved or shrunk. These type of allocations should
134 * be avoided as much as possible to avoid memory fragmentation but it can
135 * suitable for short-lived allocations. */
136extern struct buflib_callbacks buflib_ops_locked;
137
132#define BUFLIB_SHRINK_SIZE_MASK (~BUFLIB_SHRINK_POS_MASK) 138#define BUFLIB_SHRINK_SIZE_MASK (~BUFLIB_SHRINK_POS_MASK)
133#define BUFLIB_SHRINK_POS_FRONT (1u<<31) 139#define BUFLIB_SHRINK_POS_FRONT (1u<<31)
134#define BUFLIB_SHRINK_POS_BACK (1u<<30) 140#define BUFLIB_SHRINK_POS_BACK (1u<<30)