drivers/mtd/ftl.c: Fix syslog formats

This commit is contained in:
YAMAMOTO Takashi 2020-11-20 19:21:50 +09:00 committed by Xiang Xiao
parent ec448f64a1
commit b286902266

View File

@ -26,6 +26,7 @@
#include <sys/types.h>
#include <sys/ioctl.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
@ -188,8 +189,8 @@ static ssize_t ftl_reload(FAR void *priv, FAR uint8_t *buffer,
nread = MTD_BREAD(dev->mtd, startblock, nblocks, buffer);
if (nread != nblocks)
{
ferr("ERROR: Read %d blocks starting at block %d failed: %d\n",
nblocks, startblock, nread);
ferr("ERROR: Read %zu blocks starting at block %jd failed: %zd\n",
nblocks, (intmax_t)startblock, nread);
}
return nread;
@ -282,7 +283,8 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
nxfrd = MTD_BREAD(dev->mtd, rwblock, dev->blkper, dev->eblock);
if (nxfrd != dev->blkper)
{
ferr("ERROR: Read erase block %d failed: %d\n", rwblock, nxfrd);
ferr("ERROR: Read erase block %jd failed: %zd\n",
(intmax_t)rwblock, nxfrd);
return -EIO;
}
@ -292,7 +294,8 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
ret = MTD_ERASE(dev->mtd, eraseblock, 1);
if (ret < 0)
{
ferr("ERROR: Erase block=%d failed: %d\n", eraseblock, ret);
ferr("ERROR: Erase block=%jd failed: %d\n",
(intmax_t)eraseblock, ret);
return ret;
}
@ -309,8 +312,8 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
nbytes = dev->geo.erasesize - offset;
}
finfo("Copy %d bytes into erase block=%d at offset=%d\n",
nbytes, eraseblock, offset);
finfo("Copy %d bytes into erase block=%jd at offset=%jd\n",
nbytes, (intmax_t)eraseblock, (intmax_t)offset);
memcpy(dev->eblock + offset, buffer, nbytes);
@ -319,7 +322,8 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
nxfrd = MTD_BWRITE(dev->mtd, rwblock, dev->blkper, dev->eblock);
if (nxfrd != dev->blkper)
{
ferr("ERROR: Write erase block %d failed: %d\n", rwblock, nxfrd);
ferr("ERROR: Write erase block %jd failed: %zu\n",
(intmax_t)rwblock, nxfrd);
return -EIO;
}
@ -347,20 +351,21 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
ret = MTD_ERASE(dev->mtd, eraseblock, 1);
if (ret < 0)
{
ferr("ERROR: Erase block=%d failed: %d\n", eraseblock, ret);
ferr("ERROR: Erase block=%jd failed: %d\n",
(intmax_t)eraseblock, ret);
return ret;
}
/* Write a full erase back to flash */
finfo("Write %d bytes into erase block=%d at offset=0\n",
dev->geo.erasesize, alignedblock);
finfo("Write %" PRId32 " bytes into erase block=%jd at offset=0\n",
dev->geo.erasesize, (intmax_t)alignedblock);
nxfrd = MTD_BWRITE(dev->mtd, alignedblock, dev->blkper, buffer);
if (nxfrd != dev->blkper)
{
ferr("ERROR: Write erase block %d failed: %d\n",
alignedblock, nxfrd);
ferr("ERROR: Write erase block %jd failed: %zu\n",
(intmax_t)alignedblock, nxfrd);
return -EIO;
}
@ -387,8 +392,8 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
nxfrd = MTD_BREAD(dev->mtd, alignedblock, dev->blkper, dev->eblock);
if (nxfrd != dev->blkper)
{
ferr("ERROR: Read erase block %d failed: %d\n",
alignedblock, nxfrd);
ferr("ERROR: Read erase block %jd failed: %zu\n",
(intmax_t)alignedblock, nxfrd);
return -EIO;
}
@ -398,15 +403,16 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
ret = MTD_ERASE(dev->mtd, eraseblock, 1);
if (ret < 0)
{
ferr("ERROR: Erase block=%d failed: %d\n", eraseblock, ret);
ferr("ERROR: Erase block=%jd failed: %d\n",
(intmax_t)eraseblock, ret);
return ret;
}
/* Copy the user data at the beginning the buffered erase block */
nbytes = remaining * dev->geo.blocksize;
finfo("Copy %d bytes into erase block=%d at offset=0\n",
nbytes, alignedblock);
finfo("Copy %d bytes into erase block=%jd at offset=0\n",
nbytes, (intmax_t)alignedblock);
memcpy(dev->eblock, buffer, nbytes);
/* And write the erase back to flash */
@ -414,8 +420,8 @@ static ssize_t ftl_flush(FAR void *priv, FAR const uint8_t *buffer,
nxfrd = MTD_BWRITE(dev->mtd, alignedblock, dev->blkper, dev->eblock);
if (nxfrd != dev->blkper)
{
ferr("ERROR: Write erase block %d failed: %d\n",
alignedblock, nxfrd);
ferr("ERROR: Write erase block %jd failed: %zu\n",
(intmax_t)alignedblock, nxfrd);
return -EIO;
}
}