From 0fc3870786cb5df8d42cad76ca7c86d79024ff37 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Thu, 6 Feb 2025 14:15:19 +0000 Subject: [PATCH] ANDROID: make list_lru/task_work C functions available to Rust Binder calls these C functions directly, so they need to be callable from Rust. This change can be reverted once b/394605825 is fixed. Bug: 388786466 Bug: 394605825 Change-Id: I02af16a1dc50a3a7595c0f40494e8054e563e74d Signed-off-by: Alice Ryhl --- rust/bindings/bindings_helper.h | 3 +++ rust/helpers/binder.c | 22 ++++++++++++++++++++++ rust/helpers/helpers.c | 1 + 3 files changed, 26 insertions(+) create mode 100644 rust/helpers/binder.c diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h index 6af795820d13..2675215ec32e 100644 --- a/rust/bindings/bindings_helper.h +++ b/rust/bindings/bindings_helper.h @@ -13,11 +13,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -27,6 +29,7 @@ #include #include #include +#include #include #include #include diff --git a/rust/helpers/binder.c b/rust/helpers/binder.c new file mode 100644 index 000000000000..71534ac954be --- /dev/null +++ b/rust/helpers/binder.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include + +unsigned long rust_helper_list_lru_count(struct list_lru *lru) +{ + return list_lru_count(lru); +} + +unsigned long rust_helper_list_lru_walk(struct list_lru *lru, + list_lru_walk_cb isolate, void *cb_arg, + unsigned long nr_to_walk) +{ + return list_lru_walk(lru, isolate, cb_arg, nr_to_walk); +} + +void rust_helper_init_task_work(struct callback_head *twork, + task_work_func_t func) +{ + init_task_work(twork, func); +} diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c index 24accbfa244a..c4e5c7d78cf7 100644 --- a/rust/helpers/helpers.c +++ b/rust/helpers/helpers.c @@ -7,6 +7,7 @@ * Sorted alphabetically. */ +#include "binder.c" #include "blk.c" #include "bug.c" #include "build_assert.c"