Skip to content
Commit 09574e68 authored by Phil Hindman's avatar Phil Hindman Committed by David Leach
Browse files

fs: littlefs: Gracefully fail when static buffers are too small



The cache_size and lookahead_size are set at compile time using the
CONFIG_FS_LITTLEFS_CACHE_SIZE and CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE values
from Kconfig, or from the cache-size and lookahead-size properties in a
'zephyr,fstab,littlefs' compatible in the devicetree.  Those values are
also used to statically allocate buffers that are pointed at by the
read_buffer, prog_buffer, and lookahead_buffer members of the lfs_config
structure.

At runtime, when using a block device, the cache_size and lookahead_size
are updated to be multiples of the underlying block device's block_size,
which may make them bigger than the original size used to allocate the
static buffers. Log an error and fail the operation when this occurs.

Signed-off-by: default avatarPhil Hindman <phindman@xes-inc.com>
parent 87ce37f7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment