mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
bch: specify the alignment of bch buffer by CONFIG_BCH_BUFFER_ALIGNMENT
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
f81ffb51cc
commit
befad07fd4
2 changed files with 9 additions and 1 deletions
|
|
@ -24,4 +24,8 @@ config BCH_ENCRYPTION_KEY_SIZE
|
|||
default 16
|
||||
depends on BCH_ENCRYPTION
|
||||
|
||||
config BCH_BUFFER_ALIGNMENT
|
||||
int "Buffer aligned bytes"
|
||||
default 0
|
||||
|
||||
endif # BCH
|
||||
|
|
|
|||
|
|
@ -112,7 +112,11 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle)
|
|||
|
||||
/* Allocate the sector I/O buffer */
|
||||
|
||||
bch->buffer = (FAR uint8_t *)kmm_malloc(bch->sectsize);
|
||||
#if CONFIG_BCH_BUFFER_ALIGNMENT != 0
|
||||
bch->buffer = kmm_memalign(CONFIG_BCH_BUFFER_ALIGNMENT, bch->sectsize);
|
||||
#else
|
||||
bch->buffer = kmm_malloc(bch->sectsize);
|
||||
#endif
|
||||
if (!bch->buffer)
|
||||
{
|
||||
ferr("ERROR: Failed to allocate sector buffer\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue