mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err()
This commit is contained in:
@@ -86,7 +86,7 @@ int bchdev_register(FAR const char *blkdev, FAR const char *chardev,
|
||||
ret = bchlib_setup(blkdev, readonly, &handle);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("bchlib_setup failed: %d\n", -ret);
|
||||
ferr("bchlib_setup failed: %d\n", -ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ int bchdev_register(FAR const char *blkdev, FAR const char *chardev,
|
||||
ret = register_driver(chardev, &bch_fops, 0666, handle);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("register_driver failed: %d\n", -ret);
|
||||
ferr("register_driver failed: %d\n", -ret);
|
||||
bchlib_teardown(handle);
|
||||
handle = NULL;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ int bchdev_unregister(FAR const char *chardev)
|
||||
fd = open(chardev, O_RDONLY);
|
||||
if (fd < 0)
|
||||
{
|
||||
dbg("Failed to open %s: %d\n", chardev, errno);
|
||||
err("Failed to open %s: %d\n", chardev, errno);
|
||||
return -errno;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ int bchdev_unregister(FAR const char *chardev)
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
dbg("ioctl failed: %d\n", errno);
|
||||
err("ioctl failed: %d\n", errno);
|
||||
return -errno;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ int bchlib_flushsector(FAR struct bchlib_s *bch)
|
||||
ret = inode->u.i_bops->write(inode, bch->buffer, bch->sector, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("Write failed: %d\n");
|
||||
ferr("Write failed: %d\n");
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BCH_ENCRYPTION)
|
||||
@@ -201,7 +201,7 @@ int bchlib_readsector(FAR struct bchlib_s *bch, size_t sector)
|
||||
ret = inode->u.i_bops->read(inode, bch->buffer, sector, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("Read failed: %d\n");
|
||||
ferr("Read failed: %d\n");
|
||||
}
|
||||
bch->sector = sector;
|
||||
#if defined(CONFIG_BCH_ENCRYPTION)
|
||||
|
||||
@@ -160,7 +160,7 @@ ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset, size_t le
|
||||
sector, nsectors);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("Read failed: %d\n");
|
||||
ferr("Read failed: %d\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle)
|
||||
bch = (FAR struct bchlib_s *)kmm_zalloc(sizeof(struct bchlib_s));
|
||||
if (!bch)
|
||||
{
|
||||
fdbg("Failed to allocate BCH structure\n");
|
||||
ferr("Failed to allocate BCH structure\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle)
|
||||
ret = open_blockdriver(blkdev, readonly ? MS_RDONLY : 0, &bch->inode);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("Failed to open driver %s: %d\n", blkdev, -ret);
|
||||
ferr("Failed to open driver %s: %d\n", blkdev, -ret);
|
||||
goto errout_with_bch;
|
||||
}
|
||||
|
||||
@@ -114,20 +114,20 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle)
|
||||
ret = bch->inode->u.i_bops->geometry(bch->inode, &geo);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("geometry failed: %d\n", -ret);
|
||||
ferr("geometry failed: %d\n", -ret);
|
||||
goto errout_with_bch;
|
||||
}
|
||||
|
||||
if (!geo.geo_available)
|
||||
{
|
||||
fdbg("geometry failed: %d\n", -ret);
|
||||
ferr("geometry failed: %d\n", -ret);
|
||||
ret = -ENODEV;
|
||||
goto errout_with_bch;
|
||||
}
|
||||
|
||||
if (!readonly && (!bch->inode->u.i_bops->write || !geo.geo_writeenabled))
|
||||
{
|
||||
fdbg("write access not supported\n");
|
||||
ferr("write access not supported\n");
|
||||
ret = -EACCES;
|
||||
goto errout_with_bch;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ int bchlib_setup(const char *blkdev, bool readonly, FAR void **handle)
|
||||
bch->buffer = (FAR uint8_t *)kmm_malloc(bch->sectsize);
|
||||
if (!bch->buffer)
|
||||
{
|
||||
fdbg("Failed to allocate sector buffer\n");
|
||||
ferr("Failed to allocate sector buffer\n");
|
||||
ret = -ENOMEM;
|
||||
goto errout_with_bch;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, si
|
||||
sector, nsectors);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("Write failed: %d\n", ret);
|
||||
ferr("Write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, si
|
||||
ret = bchlib_flushsector(bch);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("Flush failed: %d\n", ret);
|
||||
ferr("Flush failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user