This patch looks good to me.
Just one small thing. Why do these two functions return a signed value if obj_len is unsigned?
On 2020-12-22 14:57:11, Simon Kuenzer <simon.kuenzer@xxxxxxxxx> wrote:
Adopts to the changed meaning of `CONFIG_LIBUKALLLC_IFSTATS` and provide
`uk_alloc_availmem()` and `uk_alloc_maxalloc()` always.
Signed-off-by: Simon Kuenzer
---
lib/ukallocpool/pool.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/ukallocpool/pool.c b/lib/ukallocpool/pool.c
index 390f6b92..0ff24c38 100644
--- a/lib/ukallocpool/pool.c
+++ b/lib/ukallocpool/pool.c
@@ -208,14 +208,19 @@ void uk_allocpool_return_batch(struct uk_allocpool *p,
_prepend_free_obj(p, obj[i]);
}
-#if CONFIG_LIBUKALLOC_IFSTATS
static ssize_t pool_availmem(struct uk_alloc *a)
{
struct uk_allocpool *p = ukalloc2pool(a);
- return (size_t) p->free_obj_count * p->obj_len;
+ return (ssize_t) (p->free_obj_count * p->obj_len);
+}
+
+static ssize_t pool_maxalloc(struct uk_alloc *a)
+{
+ struct uk_allocpool *p = ukalloc2pool(a);
+
+ return (ssize_t) p->obj_len;
}
-#endif
size_t uk_allocpool_reqmem(unsigned int obj_count, size_t obj_len,
size_t obj_align)
@@ -300,6 +305,8 @@ out:
pool_free,
pool_posix_memalign,
uk_memalign_compat,
+ pool_maxalloc,
+ pool_availmem,
NULL);
#if CONFIG_LIBUKALLOC_IFSTATS
p->self.availmem = pool_availmem;
--
2.20.1