Skip to content

Commit

Permalink
BCH: Add readonly configuration for BCH devices
Browse files Browse the repository at this point in the history
Signed-off-by: Shoukui Zhang <[email protected]>
  • Loading branch information
Zhangshoukui authored and xiaoxiang781216 committed Sep 18, 2024
1 parent e085f0e commit 5d3d123
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/bch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions fs/vfs/fs_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 5d3d123

Please sign in to comment.