ANDROID: ashmem: adjust Kconfig so CONFIG_ASHMEM=y is set with Rust

There are tests in Android that perform feature detection by checking
whether CONFIG_ASHMEM=y is set in the config file. Thus, adjust the
Kconfig file so that CONFIG_ASHMEM=y determines whether either Ashmem
driver is available, and so that CONFIG_ASHMEM_RUST=y determines whether
the Rust driver is used or not.

This also avoids duplication of the help message for ashmem.

The CONFIG_ASHMEM_C boolean is introduced for use in the Makefile. It is
not possible to directly set this option as it has no description.

Bug: 398956719
Bug: 370906207
Change-Id: I2930eb8e02ef2ab61edde8f9b74083ec5abc3557
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
This commit is contained in:
Alice Ryhl
2025-02-25 11:41:11 +00:00
parent a614d4ac56
commit 8835ca02a3
4 changed files with 7 additions and 10 deletions
+1
View File
@@ -589,6 +589,7 @@ CONFIG_VIRTIO_PCI=m
CONFIG_VIRTIO_BALLOON=m
CONFIG_VHOST_VSOCK=y
CONFIG_STAGING=y
CONFIG_ASHMEM=y
CONFIG_ASHMEM_RUST=y
CONFIG_COMMON_CLK_SCPI=y
# CONFIG_SUNXI_CCU is not set
+1
View File
@@ -537,6 +537,7 @@ CONFIG_VIRTIO_PCI=m
CONFIG_VIRTIO_BALLOON=m
CONFIG_VHOST_VSOCK=y
CONFIG_STAGING=y
CONFIG_ASHMEM=y
CONFIG_ASHMEM_RUST=y
CONFIG_REMOTEPROC=y
CONFIG_REMOTEPROC_CDEV=y
+4 -9
View File
@@ -17,15 +17,10 @@ config ASHMEM
because it can discard shared memory units when under memory pressure.
config ASHMEM_RUST
bool "Enable the Anonymous Shared Memory Subsystem in Rust"
depends on SHMEM && RUST && !ASHMEM
select ANDROID_STAGING
help
The ashmem subsystem is a new shared memory allocator, similar to
POSIX SHM but with different behavior and sporting a simpler
file-based API.
bool "Use the Rust implementation of Ashmem"
depends on ASHMEM && RUST
It is, in theory, a good memory allocator for low-memory devices,
because it can discard shared memory units when under memory pressure.
config ASHMEM_C
def_bool ASHMEM && !ASHMEM_RUST
endmenu
+1 -1
View File
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
ccflags-y += -I$(src) # needed for trace events
obj-$(CONFIG_ASHMEM) += ashmem.o
obj-$(CONFIG_ASHMEM_C) += ashmem.o
obj-$(CONFIG_ASHMEM_RUST) += ashmem_rust.o