boards/sim: Defconfigs for nand and mnemofs
Adds nand and mnemofs sim configs. Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
This commit is contained in:
parent
a2ed0ddd72
commit
fc31c61730
3
.gitignore
vendored
3
.gitignore
vendored
@ -72,3 +72,6 @@ tools/gdb/__pycache__
|
|||||||
.ccls-cache
|
.ccls-cache
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
imx9-sdimage.img
|
imx9-sdimage.img
|
||||||
|
kwarning
|
||||||
|
SAVEMake.defs
|
||||||
|
SAVEconfig
|
@ -5,34 +5,25 @@
|
|||||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
# modifications.
|
# modifications.
|
||||||
#
|
#
|
||||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
|
||||||
CONFIG_ARCH="sim"
|
CONFIG_ARCH="sim"
|
||||||
CONFIG_ARCH_BOARD="sim"
|
CONFIG_ARCH_BOARD="sim"
|
||||||
CONFIG_ARCH_BOARD_SIM=y
|
CONFIG_ARCH_BOARD_SIM=y
|
||||||
CONFIG_ARCH_CHIP="sim"
|
CONFIG_ARCH_CHIP="sim"
|
||||||
CONFIG_ARCH_SIM=y
|
CONFIG_ARCH_SIM=y
|
||||||
CONFIG_BOARDCTL_APP_SYMTAB=y
|
|
||||||
CONFIG_BOARDCTL_POWEROFF=y
|
|
||||||
CONFIG_BOARDCTL_ROMDISK=y
|
|
||||||
CONFIG_BOARD_LOOPSPERMSEC=0
|
|
||||||
CONFIG_BOOT_RUNFROMEXTSRAM=y
|
|
||||||
CONFIG_BUILTIN=y
|
|
||||||
CONFIG_DEBUG_SYMBOLS=y
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
CONFIG_DEV_ZERO=y
|
CONFIG_DISABLE_MQUEUE=y
|
||||||
CONFIG_EXAMPLES_HELLO=y
|
CONFIG_DISABLE_POSIX_TIMERS=y
|
||||||
CONFIG_FS_PROCFS=y
|
CONFIG_DISABLE_PTHREAD=y
|
||||||
|
CONFIG_FS_FAT=y
|
||||||
|
CONFIG_FS_NXFFS=y
|
||||||
CONFIG_IDLETHREAD_STACKSIZE=4096
|
CONFIG_IDLETHREAD_STACKSIZE=4096
|
||||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
CONFIG_INIT_ENTRYPOINT="nxffs_main"
|
||||||
CONFIG_LIBC_EXECFUNCS=y
|
CONFIG_LIBC_RAND_ORDER=3
|
||||||
CONFIG_LIBC_MAX_EXITFUNS=1
|
CONFIG_MTD=y
|
||||||
CONFIG_NSH_ARCHINIT=y
|
CONFIG_NXFFS_SCAN_VOLUME=y
|
||||||
CONFIG_NSH_BUILTIN_APPS=y
|
CONFIG_RAMMTD=y
|
||||||
CONFIG_NSH_READLINE=y
|
CONFIG_RAMMTD_FLASHSIM=y
|
||||||
CONFIG_READLINE_TABCOMPLETION=y
|
CONFIG_START_DAY=29
|
||||||
CONFIG_SCHED_HAVE_PARENT=y
|
CONFIG_START_MONTH=4
|
||||||
CONFIG_SCHED_WAITPID=y
|
CONFIG_START_YEAR=2011
|
||||||
CONFIG_SIM_SPI=y
|
CONFIG_TESTING_NXFFS=y
|
||||||
CONFIG_START_MONTH=6
|
|
||||||
CONFIG_START_YEAR=2008
|
|
||||||
CONFIG_SYSTEM_NSH=y
|
|
||||||
CONFIG_SYSTEM_SPITOOL=y
|
|
||||||
|
80
boards/sim/sim/sim/configs/mnemofs/defconfig
Normal file
80
boards/sim/sim/sim/configs/mnemofs/defconfig
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||||
|
CONFIG_ARCH="sim"
|
||||||
|
CONFIG_ARCH_BOARD="sim"
|
||||||
|
CONFIG_ARCH_BOARD_SIM=y
|
||||||
|
CONFIG_ARCH_CHIP="sim"
|
||||||
|
CONFIG_ARCH_SIM=y
|
||||||
|
CONFIG_BOARDCTL_APP_SYMTAB=y
|
||||||
|
CONFIG_BOARDCTL_POWEROFF=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=0
|
||||||
|
CONFIG_BOOT_RUNFROMEXTSRAM=y
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DEV_GPIO=y
|
||||||
|
CONFIG_DEV_LOOP=y
|
||||||
|
CONFIG_DEV_ZERO=y
|
||||||
|
CONFIG_ETC_FATDEVNO=2
|
||||||
|
CONFIG_ETC_ROMFS=y
|
||||||
|
CONFIG_ETC_ROMFSDEVNO=1
|
||||||
|
CONFIG_EXAMPLES_GPIO=y
|
||||||
|
CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_FAT_LCNAMES=y
|
||||||
|
CONFIG_FAT_LFN=y
|
||||||
|
CONFIG_FRAME_POINTER=y
|
||||||
|
CONFIG_FSUTILS_PASSWD=y
|
||||||
|
CONFIG_FSUTILS_PASSWD_READONLY=y
|
||||||
|
CONFIG_FS_BINFS=y
|
||||||
|
CONFIG_FS_FAT=y
|
||||||
|
CONFIG_FS_MNEMOFS=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_FS_RAMMAP=y
|
||||||
|
CONFIG_FS_ROMFS=y
|
||||||
|
CONFIG_GPIO_LOWER_HALF=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=4096
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_IOEXPANDER=y
|
||||||
|
CONFIG_IOEXPANDER_DUMMY=y
|
||||||
|
CONFIG_LIBC_ENVPATH=y
|
||||||
|
CONFIG_LIBC_EXECFUNCS=y
|
||||||
|
CONFIG_LIBC_LOCALE=y
|
||||||
|
CONFIG_LIBC_LOCALE_CATALOG=y
|
||||||
|
CONFIG_LIBC_LOCALE_GETTEXT=y
|
||||||
|
CONFIG_LIBC_MAX_EXITFUNS=1
|
||||||
|
CONFIG_LIBC_NUMBERED_ARGS=y
|
||||||
|
CONFIG_MM_CUSTOMIZE_MANAGER=y
|
||||||
|
CONFIG_MTD=y
|
||||||
|
CONFIG_MTD_NAND=y
|
||||||
|
CONFIG_MTD_NAND_RAM=y
|
||||||
|
CONFIG_MTD_NAND_RAM_DEBUG=y
|
||||||
|
CONFIG_MTD_NAND_RAM_STATUS=5
|
||||||
|
CONFIG_MTD_NAND_WRAPPER=y
|
||||||
|
CONFIG_MTD_NAND_WRAPPER_DEBUG_LEVEL=3
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_CONSOLE_LOGIN=y
|
||||||
|
CONFIG_NSH_FILE_APPS=y
|
||||||
|
CONFIG_NSH_MOTD=y
|
||||||
|
CONFIG_NSH_MOTD_STRING="MOTD: username=admin password=Administrator"
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_PATH_INITIAL="/bin"
|
||||||
|
CONFIG_PSEUDOFS_ATTRIBUTES=y
|
||||||
|
CONFIG_PSEUDOFS_SOFTLINKS=y
|
||||||
|
CONFIG_READLINE_TABCOMPLETION=y
|
||||||
|
CONFIG_SCHED_BACKTRACE=y
|
||||||
|
CONFIG_SCHED_HAVE_PARENT=y
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_SIM_ASAN=y
|
||||||
|
CONFIG_SIM_WALLTIME_SIGNAL=y
|
||||||
|
CONFIG_START_MONTH=6
|
||||||
|
CONFIG_START_YEAR=2008
|
||||||
|
CONFIG_SYSTEM_DUMPSTACK=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_TESTING_NAND_SIM=y
|
79
boards/sim/sim/sim/configs/nand/defconfig
Normal file
79
boards/sim/sim/sim/configs/nand/defconfig
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||||
|
CONFIG_ARCH="sim"
|
||||||
|
CONFIG_ARCH_BOARD="sim"
|
||||||
|
CONFIG_ARCH_BOARD_SIM=y
|
||||||
|
CONFIG_ARCH_CHIP="sim"
|
||||||
|
CONFIG_ARCH_SIM=y
|
||||||
|
CONFIG_BOARDCTL_APP_SYMTAB=y
|
||||||
|
CONFIG_BOARDCTL_POWEROFF=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=0
|
||||||
|
CONFIG_BOOT_RUNFROMEXTSRAM=y
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_DEBUG_SYMBOLS=y
|
||||||
|
CONFIG_DEV_GPIO=y
|
||||||
|
CONFIG_DEV_LOOP=y
|
||||||
|
CONFIG_DEV_ZERO=y
|
||||||
|
CONFIG_ETC_FATDEVNO=2
|
||||||
|
CONFIG_ETC_ROMFS=y
|
||||||
|
CONFIG_ETC_ROMFSDEVNO=1
|
||||||
|
CONFIG_EXAMPLES_GPIO=y
|
||||||
|
CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_FAT_LCNAMES=y
|
||||||
|
CONFIG_FAT_LFN=y
|
||||||
|
CONFIG_FRAME_POINTER=y
|
||||||
|
CONFIG_FSUTILS_PASSWD=y
|
||||||
|
CONFIG_FSUTILS_PASSWD_READONLY=y
|
||||||
|
CONFIG_FS_BINFS=y
|
||||||
|
CONFIG_FS_FAT=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_FS_RAMMAP=y
|
||||||
|
CONFIG_FS_ROMFS=y
|
||||||
|
CONFIG_GPIO_LOWER_HALF=y
|
||||||
|
CONFIG_IDLETHREAD_STACKSIZE=4096
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_IOEXPANDER=y
|
||||||
|
CONFIG_IOEXPANDER_DUMMY=y
|
||||||
|
CONFIG_LIBC_ENVPATH=y
|
||||||
|
CONFIG_LIBC_EXECFUNCS=y
|
||||||
|
CONFIG_LIBC_LOCALE=y
|
||||||
|
CONFIG_LIBC_LOCALE_CATALOG=y
|
||||||
|
CONFIG_LIBC_LOCALE_GETTEXT=y
|
||||||
|
CONFIG_LIBC_MAX_EXITFUNS=1
|
||||||
|
CONFIG_LIBC_NUMBERED_ARGS=y
|
||||||
|
CONFIG_MM_CUSTOMIZE_MANAGER=y
|
||||||
|
CONFIG_MTD=y
|
||||||
|
CONFIG_MTD_NAND=y
|
||||||
|
CONFIG_MTD_NAND_RAM=y
|
||||||
|
CONFIG_MTD_NAND_RAM_DEBUG=y
|
||||||
|
CONFIG_MTD_NAND_RAM_STATUS=5
|
||||||
|
CONFIG_MTD_NAND_WRAPPER=y
|
||||||
|
CONFIG_MTD_NAND_WRAPPER_DEBUG_LEVEL=3
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_CONSOLE_LOGIN=y
|
||||||
|
CONFIG_NSH_FILE_APPS=y
|
||||||
|
CONFIG_NSH_MOTD=y
|
||||||
|
CONFIG_NSH_MOTD_STRING="MOTD: username=admin password=Administrator"
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_PATH_INITIAL="/bin"
|
||||||
|
CONFIG_PSEUDOFS_ATTRIBUTES=y
|
||||||
|
CONFIG_PSEUDOFS_SOFTLINKS=y
|
||||||
|
CONFIG_READLINE_TABCOMPLETION=y
|
||||||
|
CONFIG_SCHED_BACKTRACE=y
|
||||||
|
CONFIG_SCHED_HAVE_PARENT=y
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_SIM_ASAN=y
|
||||||
|
CONFIG_SIM_WALLTIME_SIGNAL=y
|
||||||
|
CONFIG_START_MONTH=6
|
||||||
|
CONFIG_START_YEAR=2008
|
||||||
|
CONFIG_SYSTEM_DUMPSTACK=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_TESTING_NAND_SIM=y
|
@ -78,7 +78,8 @@
|
|||||||
|
|
||||||
static int nand_markblock(FAR struct nand_dev_s *nand, off_t block);
|
static int nand_markblock(FAR struct nand_dev_s *nand, off_t block);
|
||||||
static int nand_checkblock(FAR struct nand_dev_s *nand, off_t block);
|
static int nand_checkblock(FAR struct nand_dev_s *nand, off_t block);
|
||||||
#ifdef CONFIG_MTD_NAND_BLOCKCHECK
|
#if defined(CONFIG_MTD_NAND_BLOCKCHECK) && defined(CONFIG_DEBUG_INFO) && \
|
||||||
|
defined(CONFIG_DEBUG_FS)
|
||||||
static int nand_devscan(FAR struct nand_dev_s *nand);
|
static int nand_devscan(FAR struct nand_dev_s *nand);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -193,8 +193,8 @@ static void nand_ram_storage_status(void)
|
|||||||
bad = (nand_ram_flash_spare[i].bad != NAND_RAM_BLOCK_GOOD);
|
bad = (nand_ram_flash_spare[i].bad != NAND_RAM_BLOCK_GOOD);
|
||||||
|
|
||||||
NAND_RAM_STATUS_LOG(
|
NAND_RAM_STATUS_LOG(
|
||||||
"Block %3d, Page %6d, Bad: %1d |"
|
"Block %3" PRIi32 ", Page %6" PRIi32 ", Bad: %1" PRIi32 " |"
|
||||||
" Reads: %6d, Writes: %6d, Erases: %6d\n",
|
" Reads: %6" PRIi32 ", Writes: %6" PRIi32 ", Erases: %6" PRIi32 "\n",
|
||||||
i >> NAND_RAM_LOG_PAGES_PER_BLOCK, i, bad,
|
i >> NAND_RAM_LOG_PAGES_PER_BLOCK, i, bad,
|
||||||
reads, writes, erases);
|
reads, writes, erases);
|
||||||
}
|
}
|
||||||
@ -289,9 +289,9 @@ int nand_ram_eraseblock(FAR struct nand_raw_s *raw, off_t block)
|
|||||||
nand_ram_ins_i++;
|
nand_ram_ins_i++;
|
||||||
|
|
||||||
NAND_RAM_LOG(
|
NAND_RAM_LOG(
|
||||||
"[LOWER %lu | %s] Block %d, Start Page: %d, Last Page: %d",
|
"[LOWER %" PRIu64 " | %s] Block %" PRIi32 ", Start Page: %" PRIi32
|
||||||
nand_ram_ins_i, "eraseblock", block, start_page, end_page - 1
|
", Last Page: %" PRIi32, nand_ram_ins_i, "eraseblock", block, start_page,
|
||||||
);
|
end_page - 1);
|
||||||
nand_ram_status();
|
nand_ram_status();
|
||||||
|
|
||||||
/* [start_page, end_page) is cleared (all bits are set) */
|
/* [start_page, end_page) is cleared (all bits are set) */
|
||||||
@ -304,7 +304,8 @@ int nand_ram_eraseblock(FAR struct nand_raw_s *raw, off_t block)
|
|||||||
nand_ram_flash_spare[i].free = NAND_RAM_PAGE_FREE;
|
nand_ram_flash_spare[i].free = NAND_RAM_PAGE_FREE;
|
||||||
}
|
}
|
||||||
|
|
||||||
NAND_RAM_LOG("[LOWER %lu | %s] Done\n", nand_ram_ins_i, "eraseblock");
|
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Done\n", nand_ram_ins_i,
|
||||||
|
"eraseblock");
|
||||||
|
|
||||||
nxmutex_unlock(&nand_ram_dev_mut);
|
nxmutex_unlock(&nand_ram_dev_mut);
|
||||||
|
|
||||||
@ -345,14 +346,14 @@ int nand_ram_rawread(FAR struct nand_raw_s *raw, off_t block,
|
|||||||
nxmutex_lock(&nand_ram_dev_mut);
|
nxmutex_lock(&nand_ram_dev_mut);
|
||||||
nand_ram_ins_i++;
|
nand_ram_ins_i++;
|
||||||
|
|
||||||
NAND_RAM_LOG("[LOWER %lu | %s] Page %d\n",
|
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Page %" PRIi32 "\n",
|
||||||
nand_ram_ins_i, "rawread", read_page);
|
nand_ram_ins_i, "rawread", read_page);
|
||||||
nand_ram_status();
|
nand_ram_status();
|
||||||
|
|
||||||
if (nand_ram_flash_spare[read_page].bad != NAND_RAM_BLOCK_GOOD)
|
if (nand_ram_flash_spare[read_page].bad != NAND_RAM_BLOCK_GOOD)
|
||||||
{
|
{
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
NAND_RAM_LOG("[LOWER %lu | %s] Failed: %s\n",
|
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Failed: %s\n",
|
||||||
nand_ram_ins_i, "rawread", EFAULT_STR);
|
nand_ram_ins_i, "rawread", EFAULT_STR);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
@ -377,7 +378,7 @@ int nand_ram_rawread(FAR struct nand_raw_s *raw, off_t block,
|
|||||||
memcpy(spare, (const void *)read_page_spare, NAND_RAM_SPARE_SIZE);
|
memcpy(spare, (const void *)read_page_spare, NAND_RAM_SPARE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NAND_RAM_LOG("[LOWER %lu | %s] Done\n", nand_ram_ins_i, "rawread");
|
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Done\n", nand_ram_ins_i, "rawread");
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
nxmutex_unlock(&nand_ram_dev_mut);
|
nxmutex_unlock(&nand_ram_dev_mut);
|
||||||
@ -421,14 +422,14 @@ int nand_ram_rawwrite(FAR struct nand_raw_s *raw, off_t block,
|
|||||||
nxmutex_lock(&nand_ram_dev_mut);
|
nxmutex_lock(&nand_ram_dev_mut);
|
||||||
nand_ram_ins_i++;
|
nand_ram_ins_i++;
|
||||||
|
|
||||||
NAND_RAM_LOG("[LOWER %lu | %s] Page %d\n",
|
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Page %" PRIi32 "\n",
|
||||||
nand_ram_ins_i, "rawwrite", write_page);
|
nand_ram_ins_i, "rawwrite", write_page);
|
||||||
nand_ram_status();
|
nand_ram_status();
|
||||||
|
|
||||||
if (nand_ram_flash_spare[write_page].free != NAND_RAM_PAGE_FREE)
|
if (nand_ram_flash_spare[write_page].free != NAND_RAM_PAGE_FREE)
|
||||||
{
|
{
|
||||||
ret = -EACCES;
|
ret = -EACCES;
|
||||||
NAND_RAM_LOG("[LOWER %lu | %s] Failed: %s\n",
|
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Failed: %s\n",
|
||||||
nand_ram_ins_i, "rawwrite", EACCES_STR);
|
nand_ram_ins_i, "rawwrite", EACCES_STR);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
@ -447,7 +448,8 @@ int nand_ram_rawwrite(FAR struct nand_raw_s *raw, off_t block,
|
|||||||
memcpy((FAR void *)write_page_spare, data, NAND_RAM_SPARE_SIZE);
|
memcpy((FAR void *)write_page_spare, data, NAND_RAM_SPARE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NAND_RAM_LOG("[LOWER %lu | %s] Done\n", nand_ram_ins_i, "rawwrite");
|
NAND_RAM_LOG("[LOWER %" PRIu64 " | %s] Done\n", nand_ram_ins_i,
|
||||||
|
"rawwrite");
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
nxmutex_unlock(&nand_ram_dev_mut);
|
nxmutex_unlock(&nand_ram_dev_mut);
|
||||||
|
@ -107,7 +107,7 @@ static mutex_t nand_wrapper_dev_mut;
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int nand_wrapper_erase(FAR struct mtd_dev_s *dev, off_t startblock,
|
int nand_wrapper_erase(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||||
size_t nblocks)
|
size_t nblocks)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
FAR struct nand_wrapper_dev_s *nand_dev;
|
FAR struct nand_wrapper_dev_s *nand_dev;
|
||||||
@ -116,20 +116,21 @@ int nand_wrapper_erase(FAR struct mtd_dev_s *dev, off_t startblock,
|
|||||||
|
|
||||||
nxmutex_lock(&nand_wrapper_dev_mut);
|
nxmutex_lock(&nand_wrapper_dev_mut);
|
||||||
nand_wrapper_ins_i++;
|
nand_wrapper_ins_i++;
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Startblock: %d, N Blocks: %ld\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Startblock: %" PRIi32
|
||||||
nand_wrapper_ins_i, "erase", startblock, nblocks);
|
", N Blocks: %zu\n", nand_wrapper_ins_i, "erase",
|
||||||
|
startblock, nblocks);
|
||||||
DEBUGASSERT(nand_dev && nand_dev->under.mtd.erase);
|
DEBUGASSERT(nand_dev && nand_dev->under.mtd.erase);
|
||||||
|
|
||||||
ret = nand_dev->under.mtd.erase(dev, startblock, nblocks);
|
ret = nand_dev->under.mtd.erase(dev, startblock, nblocks);
|
||||||
|
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Done\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Done\n",
|
||||||
nand_wrapper_ins_i, "erase");
|
nand_wrapper_ins_i, "erase");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Failed: %d!\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Failed: %" PRIi32 "!\n",
|
||||||
nand_wrapper_ins_i, "erase", ret);
|
nand_wrapper_ins_i, "erase", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +161,7 @@ int nand_wrapper_erase(FAR struct mtd_dev_s *dev, off_t startblock,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
ssize_t nand_wrapper_bread(FAR struct mtd_dev_s *dev, off_t startpage,
|
ssize_t nand_wrapper_bread(FAR struct mtd_dev_s *dev, off_t startpage,
|
||||||
size_t npages, FAR uint8_t *buffer)
|
size_t npages, FAR uint8_t *buffer)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
FAR struct nand_wrapper_dev_s *nand_dev;
|
FAR struct nand_wrapper_dev_s *nand_dev;
|
||||||
@ -169,8 +170,8 @@ ssize_t nand_wrapper_bread(FAR struct mtd_dev_s *dev, off_t startpage,
|
|||||||
|
|
||||||
nxmutex_lock(&nand_wrapper_dev_mut);
|
nxmutex_lock(&nand_wrapper_dev_mut);
|
||||||
nand_wrapper_ins_i++;
|
nand_wrapper_ins_i++;
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] "
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] "
|
||||||
"Startblock: %d, N Pages: %ld, Buffer: %p\n",
|
"Startblock: %" PRIi32 ", N Pages: %zu, Buffer: %p\n",
|
||||||
nand_wrapper_ins_i, "bread", startpage, npages, buffer);
|
nand_wrapper_ins_i, "bread", startpage, npages, buffer);
|
||||||
DEBUGASSERT(nand_dev && nand_dev->under.mtd.bread);
|
DEBUGASSERT(nand_dev && nand_dev->under.mtd.bread);
|
||||||
|
|
||||||
@ -178,12 +179,12 @@ ssize_t nand_wrapper_bread(FAR struct mtd_dev_s *dev, off_t startpage,
|
|||||||
|
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Done\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Done\n",
|
||||||
nand_wrapper_ins_i, "bread");
|
nand_wrapper_ins_i, "bread");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Failed: %d!\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Failed: %" PRIi32 "!\n",
|
||||||
nand_wrapper_ins_i, "bread", ret);
|
nand_wrapper_ins_i, "bread", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +217,7 @@ ssize_t nand_wrapper_bread(FAR struct mtd_dev_s *dev, off_t startpage,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
ssize_t nand_wrapper_bwrite(FAR struct mtd_dev_s *dev, off_t startpage,
|
ssize_t nand_wrapper_bwrite(FAR struct mtd_dev_s *dev, off_t startpage,
|
||||||
size_t npages, FAR const uint8_t *buffer)
|
size_t npages, FAR const uint8_t *buffer)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
FAR struct nand_wrapper_dev_s *nand_dev;
|
FAR struct nand_wrapper_dev_s *nand_dev;
|
||||||
@ -225,8 +226,8 @@ ssize_t nand_wrapper_bwrite(FAR struct mtd_dev_s *dev, off_t startpage,
|
|||||||
|
|
||||||
nxmutex_lock(&nand_wrapper_dev_mut);
|
nxmutex_lock(&nand_wrapper_dev_mut);
|
||||||
nand_wrapper_ins_i++;
|
nand_wrapper_ins_i++;
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] "
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] "
|
||||||
"Startblock: %d, N Pages: %ld, Buffer: %p \n",
|
"Startblock: %" PRIi32 ", N Pages: %zu, Buffer: %p\n",
|
||||||
nand_wrapper_ins_i, "bwrite", startpage, npages, buffer);
|
nand_wrapper_ins_i, "bwrite", startpage, npages, buffer);
|
||||||
DEBUGASSERT(nand_dev && nand_dev->under.mtd.bwrite);
|
DEBUGASSERT(nand_dev && nand_dev->under.mtd.bwrite);
|
||||||
|
|
||||||
@ -234,12 +235,12 @@ ssize_t nand_wrapper_bwrite(FAR struct mtd_dev_s *dev, off_t startpage,
|
|||||||
|
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Done\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Done\n",
|
||||||
nand_wrapper_ins_i, "bwrite");
|
nand_wrapper_ins_i, "bwrite");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Failed: %d!\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Failed: %" PRIi32 "!\n",
|
||||||
nand_wrapper_ins_i, "bwrite", ret);
|
nand_wrapper_ins_i, "bwrite", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +270,7 @@ ssize_t nand_wrapper_bwrite(FAR struct mtd_dev_s *dev, off_t startpage,
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int nand_wrapper_ioctl(FAR struct mtd_dev_s *dev, int cmd,
|
int nand_wrapper_ioctl(FAR struct mtd_dev_s *dev, int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
FAR struct nand_wrapper_dev_s *nand_dev;
|
FAR struct nand_wrapper_dev_s *nand_dev;
|
||||||
@ -278,20 +279,20 @@ int nand_wrapper_ioctl(FAR struct mtd_dev_s *dev, int cmd,
|
|||||||
|
|
||||||
nxmutex_lock(&nand_wrapper_dev_mut);
|
nxmutex_lock(&nand_wrapper_dev_mut);
|
||||||
nand_wrapper_ins_i++;
|
nand_wrapper_ins_i++;
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Command: %d, Arg : %ld\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Command: %" PRIi32
|
||||||
nand_wrapper_ins_i, "ioctl", cmd, arg);
|
", Arg : %zu\n", nand_wrapper_ins_i, "ioctl", cmd, arg);
|
||||||
DEBUGASSERT(nand_dev && nand_dev->under.mtd.ioctl);
|
DEBUGASSERT(nand_dev && nand_dev->under.mtd.ioctl);
|
||||||
|
|
||||||
ret = nand_dev->under.mtd.ioctl(dev, cmd, arg);
|
ret = nand_dev->under.mtd.ioctl(dev, cmd, arg);
|
||||||
|
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Done\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Done\n",
|
||||||
nand_wrapper_ins_i, "ioctl");
|
nand_wrapper_ins_i, "ioctl");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Failed: %d!\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Failed: %" PRIi32 "!\n",
|
||||||
nand_wrapper_ins_i, "ioctl", ret);
|
nand_wrapper_ins_i, "ioctl", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,7 +329,7 @@ int nand_wrapper_isbad(FAR struct mtd_dev_s *dev, off_t block)
|
|||||||
|
|
||||||
nxmutex_lock(&nand_wrapper_dev_mut);
|
nxmutex_lock(&nand_wrapper_dev_mut);
|
||||||
nand_wrapper_ins_i++;
|
nand_wrapper_ins_i++;
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Block: %d\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Block: %" PRIi32 "\n",
|
||||||
nand_wrapper_ins_i, "isbad", block);
|
nand_wrapper_ins_i, "isbad", block);
|
||||||
DEBUGASSERT(nand_dev && nand_dev->under.mtd.isbad);
|
DEBUGASSERT(nand_dev && nand_dev->under.mtd.isbad);
|
||||||
|
|
||||||
@ -336,12 +337,12 @@ int nand_wrapper_isbad(FAR struct mtd_dev_s *dev, off_t block)
|
|||||||
|
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Done %d\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Done %" PRIi32 "\n",
|
||||||
nand_wrapper_ins_i, "isbad", ret);
|
nand_wrapper_ins_i, "isbad", ret);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Failed: %d!\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Failed: %" PRIi32 "!\n",
|
||||||
nand_wrapper_ins_i, "isbad", ret);
|
nand_wrapper_ins_i, "isbad", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +379,7 @@ int nand_wrapper_markbad(FAR struct mtd_dev_s *dev, off_t block)
|
|||||||
|
|
||||||
nxmutex_lock(&nand_wrapper_dev_mut);
|
nxmutex_lock(&nand_wrapper_dev_mut);
|
||||||
nand_wrapper_ins_i++;
|
nand_wrapper_ins_i++;
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Blocks: %d\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Blocks: %" PRIi32 "\n",
|
||||||
nand_wrapper_ins_i, "markbad", block);
|
nand_wrapper_ins_i, "markbad", block);
|
||||||
DEBUGASSERT(nand_dev && nand_dev->under.mtd.markbad);
|
DEBUGASSERT(nand_dev && nand_dev->under.mtd.markbad);
|
||||||
|
|
||||||
@ -386,12 +387,12 @@ int nand_wrapper_markbad(FAR struct mtd_dev_s *dev, off_t block)
|
|||||||
|
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Done\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Done\n",
|
||||||
nand_wrapper_ins_i, "markbad");
|
nand_wrapper_ins_i, "markbad");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NAND_WRAPPER_LOG("[UPPER %lu | %s] Failed: %d!\n",
|
NAND_WRAPPER_LOG("[UPPER %" PRIu64 " | %s] Failed: %" PRIi32 "!\n",
|
||||||
nand_wrapper_ins_i, "markbad", ret);
|
nand_wrapper_ins_i, "markbad", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +557,8 @@ static ssize_t mnemofs_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
f = filep->f_priv;
|
f = filep->f_priv;
|
||||||
DEBUGASSERT(f != NULL);
|
DEBUGASSERT(f != NULL);
|
||||||
|
|
||||||
finfo("Mnemofs read %lu bytes from %u offset", buflen, f->com->off);
|
finfo("Mnemofs read %zu bytes from %" PRIu32 " offset", buflen,
|
||||||
|
f->com->off);
|
||||||
|
|
||||||
/* Check if allowed to read. */
|
/* Check if allowed to read. */
|
||||||
|
|
||||||
@ -579,7 +580,7 @@ static ssize_t mnemofs_read(FAR struct file *filep, FAR char *buffer,
|
|||||||
buffer, buflen);
|
buffer, buflen);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
finfo("Error while reading. Ret: %d.", ret);
|
finfo("Error while reading. Ret: %zd.", ret);
|
||||||
goto errout_with_lock;
|
goto errout_with_lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,7 +594,7 @@ errout_with_lock:
|
|||||||
nxmutex_unlock(&MFS_LOCK(sb));
|
nxmutex_unlock(&MFS_LOCK(sb));
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
finfo("Mnemofs read exited with %d.", ret);
|
finfo("Mnemofs read exited with %zd.", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -642,7 +643,8 @@ static ssize_t mnemofs_write(FAR struct file *filep, FAR const char *buffer,
|
|||||||
f = filep->f_priv;
|
f = filep->f_priv;
|
||||||
DEBUGASSERT(f != NULL);
|
DEBUGASSERT(f != NULL);
|
||||||
|
|
||||||
finfo("Mnemofs write %lu bytes at offset %u.", buflen, f->com->off);
|
finfo("Mnemofs write %zu bytes at offset %" PRIu32, buflen,
|
||||||
|
f->com->off);
|
||||||
|
|
||||||
/* Check if allowed to write. */
|
/* Check if allowed to write. */
|
||||||
|
|
||||||
@ -674,7 +676,7 @@ errout_with_lock:
|
|||||||
finfo("Lock released.");
|
finfo("Lock released.");
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
finfo("Mnemofs write exited with %d.", ret);
|
finfo("Mnemofs write exited with %zd.", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -800,7 +802,7 @@ static int mnemofs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
FAR struct inode *drv;
|
FAR struct inode *drv;
|
||||||
FAR struct mfs_sb_s *sb;
|
FAR struct mfs_sb_s *sb;
|
||||||
|
|
||||||
finfo("Mnemofs ioctl with cmd %u and arg %ld", cmd, arg);
|
finfo("Mnemofs ioctl with cmd %" PRIu32 "and arg %zu.", cmd, arg);
|
||||||
|
|
||||||
inode = filep->f_inode;
|
inode = filep->f_inode;
|
||||||
sb = inode->i_private;
|
sb = inode->i_private;
|
||||||
|
@ -282,7 +282,6 @@ static int is_blk_writeable(FAR struct mfs_sb_s * const sb, const mfs_t blk)
|
|||||||
int mfs_ba_fmt(FAR struct mfs_sb_s * const sb)
|
int mfs_ba_fmt(FAR struct mfs_sb_s * const sb)
|
||||||
{
|
{
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
uint8_t log;
|
|
||||||
|
|
||||||
/* We need at least 5 blocks, as one is occupied by superblock, at least
|
/* We need at least 5 blocks, as one is occupied by superblock, at least
|
||||||
* one for the journal, 2 for journal's master blocks, and at least one for
|
* one for the journal, 2 for journal's master blocks, and at least one for
|
||||||
@ -306,8 +305,6 @@ int mfs_ba_fmt(FAR struct mfs_sb_s * const sb)
|
|||||||
|
|
||||||
MFS_BA(sb).c_pg = MFS_BLK2PG(sb, MFS_BA(sb).s_blk);
|
MFS_BA(sb).c_pg = MFS_BLK2PG(sb, MFS_BA(sb).s_blk);
|
||||||
|
|
||||||
log = ceil(log2(MFS_NBLKS(sb)));
|
|
||||||
|
|
||||||
/* MFS_BA(sb).k_del_elemsz = ((log + 7) & (-8)) / 8; */
|
/* MFS_BA(sb).k_del_elemsz = ((log + 7) & (-8)) / 8; */
|
||||||
|
|
||||||
MFS_BA(sb).k_del = kmm_zalloc(sizeof(size_t) * MFS_NBLKS(sb));
|
MFS_BA(sb).k_del = kmm_zalloc(sizeof(size_t) * MFS_NBLKS(sb));
|
||||||
|
@ -325,7 +325,6 @@ int mfs_ctz_rdfromoff(FAR const struct mfs_sb_s * const sb,
|
|||||||
{
|
{
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
mfs_t i;
|
mfs_t i;
|
||||||
mfs_t rd_sz;
|
|
||||||
mfs_t cur_pg;
|
mfs_t cur_pg;
|
||||||
mfs_t cur_idx;
|
mfs_t cur_idx;
|
||||||
mfs_t cur_pgoff;
|
mfs_t cur_pgoff;
|
||||||
@ -351,7 +350,6 @@ int mfs_ctz_rdfromoff(FAR const struct mfs_sb_s * const sb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_pg = mfs_ctz_travel(sb, ctz.idx_e, ctz.pg_e, cur_idx);
|
cur_pg = mfs_ctz_travel(sb, ctz.idx_e, ctz.pg_e, cur_idx);
|
||||||
rd_sz = 0;
|
|
||||||
|
|
||||||
if (predict_false(cur_pg == 0))
|
if (predict_false(cur_pg == 0))
|
||||||
{
|
{
|
||||||
@ -444,8 +442,7 @@ int mfs_ctz_wrtnode(FAR struct mfs_sb_s * const sb,
|
|||||||
struct mfs_ctz_s ctz;
|
struct mfs_ctz_s ctz;
|
||||||
FAR struct mfs_delta_s *delta;
|
FAR struct mfs_delta_s *delta;
|
||||||
|
|
||||||
finfo("Write LRU node %p at depth %u, with %u delta(s) to flash.", node,
|
finfo("Write LRU node %p at depth %u.", node, node->depth);
|
||||||
node->depth, list_length(&node->delta));
|
|
||||||
|
|
||||||
/* Traverse common CTZ blocks. */
|
/* Traverse common CTZ blocks. */
|
||||||
|
|
||||||
@ -487,8 +484,8 @@ int mfs_ctz_wrtnode(FAR struct mfs_sb_s * const sb,
|
|||||||
upper = MIN(prev + lower + ctz_blkdatasz(sb, cur_idx), rem_sz);
|
upper = MIN(prev + lower + ctz_blkdatasz(sb, cur_idx), rem_sz);
|
||||||
upper_og = upper;
|
upper_og = upper;
|
||||||
|
|
||||||
finfo("Remaining Size %u. Lower %u, Upper %u, Current Offset %u",
|
finfo("Remaining Size %" PRIu32 ". Lower %" PRIu32 ", Upper %" PRIu32
|
||||||
rem_sz, lower, upper, tmp - buf);
|
", Current Offset %zd.", rem_sz, lower, upper, tmp - buf);
|
||||||
|
|
||||||
/* Retrieving original data. */
|
/* Retrieving original data. */
|
||||||
|
|
||||||
@ -501,8 +498,8 @@ int mfs_ctz_wrtnode(FAR struct mfs_sb_s * const sb,
|
|||||||
|
|
||||||
list_for_every_entry(&node->delta, delta, struct mfs_delta_s, list)
|
list_for_every_entry(&node->delta, delta, struct mfs_delta_s, list)
|
||||||
{
|
{
|
||||||
finfo("Checking delta %p in node %p. Offset %u, bytes %u.", delta,
|
finfo("Checking delta %p in node %p. Offset %" PRIu32 ", bytes %"
|
||||||
node, delta->off, delta->n_b);
|
PRIu32, delta, node, delta->off, delta->n_b);
|
||||||
|
|
||||||
lower_upd = MAX(lower, delta->off);
|
lower_upd = MAX(lower, delta->off);
|
||||||
upper_upd = MIN(upper, delta->off + delta->n_b);
|
upper_upd = MIN(upper, delta->off + delta->n_b);
|
||||||
@ -569,7 +566,7 @@ int mfs_ctz_wrtnode(FAR struct mfs_sb_s * const sb,
|
|||||||
|
|
||||||
written = true;
|
written = true;
|
||||||
|
|
||||||
finfo("Written data to page %u.", new_pg);
|
finfo("Written data to page %" PRIu32, new_pg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -655,8 +652,8 @@ mfs_t mfs_ctz_travel(FAR const struct mfs_sb_s * const sb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
finfo("Travel from index %u at page %u to index %u at page %u.", idx_src,
|
finfo("Travel from index %" PRIu32 " at page %" PRIu32 " to index %" PRIu32
|
||||||
pg_src, idx_dest, pg);
|
" at page %" PRIu32 ".", idx_src, pg_src, idx_dest, pg);
|
||||||
|
|
||||||
return pg;
|
return pg;
|
||||||
}
|
}
|
||||||
|
@ -626,7 +626,6 @@ int mfs_jrnl_wrlog(FAR struct mfs_sb_s * const sb,
|
|||||||
{
|
{
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
mfs_t jrnl_pg;
|
mfs_t jrnl_pg;
|
||||||
mfs_t jrnl_blk;
|
|
||||||
FAR char *buf = NULL;
|
FAR char *buf = NULL;
|
||||||
FAR char *tmp = NULL;
|
FAR char *tmp = NULL;
|
||||||
const mfs_t log_sz = sizeof(mfs_t) + MFS_LOGSZ(node->depth);
|
const mfs_t log_sz = sizeof(mfs_t) + MFS_LOGSZ(node->depth);
|
||||||
@ -655,7 +654,6 @@ int mfs_jrnl_wrlog(FAR struct mfs_sb_s * const sb,
|
|||||||
|
|
||||||
/* Store */
|
/* Store */
|
||||||
|
|
||||||
jrnl_blk = mfs_jrnl_blkidx2blk(sb, MFS_JRNL(sb).log_cblkidx);
|
|
||||||
jrnl_pg = MFS_JRNL(sb).log_cpg;
|
jrnl_pg = MFS_JRNL(sb).log_cpg;
|
||||||
|
|
||||||
/* TODO: It assumes it takes only one page per log. */
|
/* TODO: It assumes it takes only one page per log. */
|
||||||
|
@ -193,8 +193,8 @@ static void lru_nodesearch(FAR const struct mfs_sb_s * const sb,
|
|||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
finfo("Node search ended with match of node %p at depth %u"
|
finfo("Node search ended with match of node %p at depth %u"
|
||||||
" for CTZ of %u size with range [%u, %u).", n, n->depth, n->sz,
|
" for CTZ of %" PRIu32 " size with range [%" PRIu32 ", %" PRIi32
|
||||||
n->range_min, n->range_max);
|
").", n, n->depth, n->sz, n->range_min, n->range_max);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -325,9 +325,9 @@ static int lru_nodeflush(FAR struct mfs_sb_s * const sb,
|
|||||||
|
|
||||||
if (rm_node)
|
if (rm_node)
|
||||||
{
|
{
|
||||||
finfo("Deleting node. Old size: %u.", list_length(&MFS_LRU(sb)));
|
finfo("Deleting node. Old size: %zu.", list_length(&MFS_LRU(sb)));
|
||||||
list_delete_init(&node->list);
|
list_delete_init(&node->list);
|
||||||
finfo("Deleted node. New size: %u.", list_length(&MFS_LRU(sb)));
|
finfo("Deleted node. New size: %zu.", list_length(&MFS_LRU(sb)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -428,13 +428,13 @@ static int lru_wrtooff(FAR struct mfs_sb_s * const sb, const mfs_t data_off,
|
|||||||
struct mfs_node_s, list);
|
struct mfs_node_s, list);
|
||||||
list_delete_init(&last_node->list);
|
list_delete_init(&last_node->list);
|
||||||
list_add_tail(&MFS_LRU(sb), &node->list);
|
list_add_tail(&MFS_LRU(sb), &node->list);
|
||||||
finfo("LRU flushing node complete, now only %u nodes",
|
finfo("LRU flushing node complete, now only %zu nodes",
|
||||||
list_length(&MFS_LRU(sb)));
|
list_length(&MFS_LRU(sb)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
list_add_tail(&MFS_LRU(sb), &node->list);
|
list_add_tail(&MFS_LRU(sb), &node->list);
|
||||||
finfo("Node inserted into LRU, and it now %u node(s).",
|
finfo("Node inserted into LRU, and it now %zu node(s).",
|
||||||
list_length(&MFS_LRU(sb)));
|
list_length(&MFS_LRU(sb)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -502,10 +502,10 @@ static int lru_wrtooff(FAR struct mfs_sb_s * const sb, const mfs_t data_off,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
finfo("Delta attached to node %p. Now there are %lu nodes and the node has"
|
finfo("Delta attached to node %p. Now there are %zu nodes and the"
|
||||||
" %lu deltas. Node with range [%u, %u).", node,
|
" node has %zu deltas. Node with range [%" PRIu32 ", %"
|
||||||
list_length(&MFS_LRU(sb)), list_length(&node->delta),
|
PRIu32 ").", node, list_length(&MFS_LRU(sb)),
|
||||||
node->range_min, node->range_max);
|
list_length(&node->delta), node->range_min, node->range_max);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -730,7 +730,7 @@ int mfs_lru_flush(FAR struct mfs_sb_s * const sb)
|
|||||||
* big), the stack depth for this will be 7.
|
* big), the stack depth for this will be 7.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
finfo("Sorting the LRU. No. of nodes: %u.", list_length(&MFS_LRU(sb)));
|
finfo("Sorting the LRU. No. of nodes: %zu", list_length(&MFS_LRU(sb)));
|
||||||
|
|
||||||
lru_sort(sb, MFS_LRU(sb).next, MFS_LRU(sb).prev);
|
lru_sort(sb, MFS_LRU(sb).next, MFS_LRU(sb).prev);
|
||||||
MFS_FLUSH(sb) = true;
|
MFS_FLUSH(sb) = true;
|
||||||
|
@ -191,13 +191,12 @@ static FAR const char *deser_mn(FAR const char * const in,
|
|||||||
int mfs_mn_init(FAR struct mfs_sb_s * const sb, const mfs_t jrnl_blk)
|
int mfs_mn_init(FAR struct mfs_sb_s * const sb, const mfs_t jrnl_blk)
|
||||||
{
|
{
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
bool found = false;
|
||||||
mfs_t i = 0;
|
mfs_t i = 0;
|
||||||
mfs_t mblk1;
|
mfs_t mblk1;
|
||||||
mfs_t mblk2;
|
|
||||||
mfs_t jrnl_blk_tmp;
|
|
||||||
mfs_t blkidx;
|
mfs_t blkidx;
|
||||||
mfs_t pg_in_blk;
|
mfs_t pg_in_blk;
|
||||||
bool found = false;
|
mfs_t jrnl_blk_tmp;
|
||||||
uint16_t hash;
|
uint16_t hash;
|
||||||
struct mfs_mn_s mn;
|
struct mfs_mn_s mn;
|
||||||
const mfs_t sz = sizeof(struct mfs_mn_s) - sizeof(mn.pg);
|
const mfs_t sz = sizeof(struct mfs_mn_s) - sizeof(mn.pg);
|
||||||
@ -206,7 +205,7 @@ int mfs_mn_init(FAR struct mfs_sb_s * const sb, const mfs_t jrnl_blk)
|
|||||||
struct mfs_jrnl_log_s log;
|
struct mfs_jrnl_log_s log;
|
||||||
|
|
||||||
mblk1 = mfs_jrnl_blkidx2blk(sb, MFS_JRNL(sb).n_blks);
|
mblk1 = mfs_jrnl_blkidx2blk(sb, MFS_JRNL(sb).n_blks);
|
||||||
mblk2 = mfs_jrnl_blkidx2blk(sb, MFS_JRNL(sb).n_blks + 1);
|
|
||||||
mn.jrnl_blk = jrnl_blk;
|
mn.jrnl_blk = jrnl_blk;
|
||||||
mn.mblk_idx = 0;
|
mn.mblk_idx = 0;
|
||||||
mn.pg = MFS_BLK2PG(sb, mblk1);
|
mn.pg = MFS_BLK2PG(sb, mblk1);
|
||||||
@ -362,8 +361,6 @@ int mfs_mn_move(FAR struct mfs_sb_s * const sb, struct mfs_ctz_s root,
|
|||||||
const mfs_t root_sz)
|
const mfs_t root_sz)
|
||||||
{
|
{
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
mfs_t mblk1;
|
|
||||||
mfs_t mblk2;
|
|
||||||
struct mfs_mn_s mn;
|
struct mfs_mn_s mn;
|
||||||
const mfs_t sz = sizeof(struct mfs_mn_s) - sizeof(mn.pg);
|
const mfs_t sz = sizeof(struct mfs_mn_s) - sizeof(mn.pg);
|
||||||
char buf[sz + 1];
|
char buf[sz + 1];
|
||||||
@ -373,9 +370,7 @@ int mfs_mn_move(FAR struct mfs_sb_s * const sb, struct mfs_ctz_s root,
|
|||||||
/* TODO: Move journal. Master blocks are full. */
|
/* TODO: Move journal. Master blocks are full. */
|
||||||
}
|
}
|
||||||
|
|
||||||
mblk1 = mfs_jrnl_blkidx2blk(sb, MFS_JRNL(sb).n_blks);
|
mn = MFS_MN(sb);
|
||||||
mblk2 = mfs_jrnl_blkidx2blk(sb, MFS_JRNL(sb).n_blks + 1);
|
|
||||||
mn = MFS_MN(sb);
|
|
||||||
|
|
||||||
mn.root_ctz = root;
|
mn.root_ctz = root;
|
||||||
mn.root_sz = root_sz;
|
mn.root_sz = root_sz;
|
||||||
|
@ -102,7 +102,7 @@ uint8_t mfs_arrhash(FAR const char *arr, ssize_t len)
|
|||||||
hash %= (1 << 8);
|
hash %= (1 << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
finfo("Hash calculated for size %ld to be %d.", len, hash % (1 << 8));
|
finfo("Hash calculated for size %zd to be %d.", len, hash % (1 << 8));
|
||||||
|
|
||||||
return hash % (1 << 8);
|
return hash % (1 << 8);
|
||||||
}
|
}
|
||||||
@ -123,7 +123,7 @@ uint16_t mfs_hash(FAR const char *arr, ssize_t len)
|
|||||||
hash %= (1 << MFS_HASHSZ);
|
hash %= (1 << MFS_HASHSZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
finfo("Hash calculated for size %ld to be %u.", len, hash);
|
finfo("Hash calculated for size %zd to be %" PRIi32, len, hash);
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user