BCH: Add readonly configuration for BCH devices

Signed-off-by: Shoukui Zhang <zhangshoukui@xiaomi.com>
This commit is contained in:
Shoukui Zhang 2023-12-11 11:27:40 +08:00 committed by Xiang Xiao
parent e085f0ee80
commit 5d3d123272
2 changed files with 10 additions and 0 deletions

View File

@ -28,4 +28,10 @@ config BCH_BUFFER_ALIGNMENT
int "Buffer aligned bytes"
default 0
config BCH_DEVICE_READONLY
bool "Set BCH device readonly"
default n
---help---
Set bch devices read-only
endif # BCH

View File

@ -198,7 +198,11 @@ static int file_vopen(FAR struct file *filep, FAR const char *path,
/* Get the file structure of the opened character driver proxy */
#ifdef CONFIG_BCH_DEVICE_READONLY
ret = block_proxy(filep, path, O_RDOK);
#else
ret = block_proxy(filep, path, oflags);
#endif
#ifdef CONFIG_FS_NOTIFY
if (ret >= 0)
{