Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err()

This commit is contained in:
Gregory Nutt
2016-06-11 15:50:49 -06:00
parent e99301d7c2
commit a1469a3e95
1091 changed files with 5971 additions and 5966 deletions
+19 -19
View File
@@ -473,7 +473,7 @@ mkfatfs_tryfat12(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
if (config->fc_nclusters + 2 > maxnclusters)
{
fdbg("Too many clusters for FAT12: %d > %d\n",
ferr("Too many clusters for FAT12: %d > %d\n",
config->fc_nclusters, maxnclusters - 2);
return -ENFILE;
@@ -550,7 +550,7 @@ mkfatfs_tryfat16(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
if ((config->fc_nclusters + 2 > maxnclusters) ||
(config->fc_nclusters < FAT_MINCLUST16))
{
fdbg("Too few or too many clusters for FAT16: %d < %d < %d\n",
ferr("Too few or too many clusters for FAT16: %d < %d < %d\n",
FAT_MINCLUST16, config->fc_nclusters, maxnclusters - 2);
return -ENFILE;
@@ -622,7 +622,7 @@ mkfatfs_tryfat32(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var,
if ((config->fc_nclusters + 3 > maxnclusters) ||
(config->fc_nclusters < FAT_MINCLUST32))
{
fdbg("Too few or too many clusters for FAT32: %d < %d < %d\n",
ferr("Too few or too many clusters for FAT32: %d < %d < %d\n",
FAT_MINCLUST32, config->fc_nclusters, maxnclusters - 3);
return -ENFILE;
@@ -696,7 +696,7 @@ mkfatfs_clustersearch(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var)
if (fmt->ff_rsvdseccount < 2)
{
fdbg("At least 2 reserved sectors needed by FAT32\n");
ferr("At least 2 reserved sectors needed by FAT32\n");
fatconfig32.fc_rsvdseccount = 2;
}
else
@@ -756,7 +756,7 @@ mkfatfs_clustersearch(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var)
if (mkfatfs_tryfat12(fmt, var, &fatconfig12) != 0)
{
fdbg("Cannot format FAT12 at %u sectors/cluster\n",
ferr("Cannot format FAT12 at %u sectors/cluster\n",
1 << fmt->ff_clustshift);
fatconfig12.fc_nfatsects = 0;
@@ -772,7 +772,7 @@ mkfatfs_clustersearch(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var)
if (mkfatfs_tryfat16(fmt, var, &fatconfig16) != 0)
{
fdbg("Cannot format FAT16 at %u sectors/cluster\n",
ferr("Cannot format FAT16 at %u sectors/cluster\n",
1 << fmt->ff_clustshift);
fatconfig16.fc_nfatsects = 0;
@@ -828,7 +828,7 @@ mkfatfs_clustersearch(FAR struct fat_format_s *fmt, FAR struct fat_var_s *var)
if (mkfatfs_tryfat32(fmt, var, &fatconfig32) != 0)
{
fdbg("Cannot format FAT32 at %u sectors/cluster\n",
ferr("Cannot format FAT32 at %u sectors/cluster\n",
1 << fmt->ff_clustshift);
fatconfig32.fc_nfatsects = 0;
@@ -897,7 +897,7 @@ int mkfatfs_configfatfs(FAR struct fat_format_s *fmt,
ret = mkfatfs_clustersearch(fmt, var);
if (ret < 0)
{
fdbg("ERROR: Failed to set cluster size\n");
ferr("ERROR: Failed to set cluster size\n");
return ret;
}
@@ -940,7 +940,7 @@ int mkfatfs_configfatfs(FAR struct fat_format_s *fmt,
if (fmt->ff_backupboot <= 1 || fmt->ff_backupboot >= fmt->ff_rsvdseccount)
{
fdbg("Invalid backup boot sector: %d\n", fmt->ff_backupboot);
ferr("Invalid backup boot sector: %d\n", fmt->ff_backupboot);
fmt->ff_backupboot = 0;
}
@@ -974,21 +974,21 @@ int mkfatfs_configfatfs(FAR struct fat_format_s *fmt,
/* Describe the configured filesystem */
#ifdef CONFIG_DEBUG_FEATURES
fdbg("Sector size: %d bytes\n", var->fv_sectorsize);
fdbg("Number of sectors: %d sectors\n", fmt->ff_nsectors);
fdbg("FAT size: %d bits\n", var->fv_fattype);
fdbg("Number FATs: %d\n", fmt->ff_nfats);
fdbg("Sectors per cluster: %d sectors\n", 1 << fmt->ff_clustshift);
fdbg("FS size: %d sectors\n", var->fv_nfatsects);
fdbg(" %d clusters\n", var->fv_nclusters);
ferr("Sector size: %d bytes\n", var->fv_sectorsize);
ferr("Number of sectors: %d sectors\n", fmt->ff_nsectors);
ferr("FAT size: %d bits\n", var->fv_fattype);
ferr("Number FATs: %d\n", fmt->ff_nfats);
ferr("Sectors per cluster: %d sectors\n", 1 << fmt->ff_clustshift);
ferr("FS size: %d sectors\n", var->fv_nfatsects);
ferr(" %d clusters\n", var->fv_nclusters);
if (var->fv_fattype != 32)
{
fdbg("Root directory slots: %d\n", fmt->ff_rootdirentries);
ferr("Root directory slots: %d\n", fmt->ff_rootdirentries);
}
fdbg("Volume ID: %08x\n", fmt->ff_volumeid);
fdbg("Volume Label: \"%c%c%c%c%c%c%c%c%c%c%c\"\n",
ferr("Volume ID: %08x\n", fmt->ff_volumeid);
ferr("Volume Label: \"%c%c%c%c%c%c%c%c%c%c%c\"\n",
fmt->ff_volumelabel[0], fmt->ff_volumelabel[1], fmt->ff_volumelabel[2],
fmt->ff_volumelabel[3], fmt->ff_volumelabel[4], fmt->ff_volumelabel[5],
fmt->ff_volumelabel[6], fmt->ff_volumelabel[7], fmt->ff_volumelabel[8],
+2 -2
View File
@@ -624,7 +624,7 @@ fat_read_restart:
if (ret == -EFAULT && !force_indirect)
{
fdbg("DMA: read alignment error, restarting indirect\n");
ferr("DMA: read alignment error, restarting indirect\n");
force_indirect = true;
goto fat_read_restart;
}
@@ -884,7 +884,7 @@ fat_write_restart:
if (ret == -EFAULT && !force_indirect)
{
fdbg("DMA: write alignment error, restarting indirect\n");
ferr("DMA: write alignment error, restarting indirect\n");
force_indirect = true;
goto fat_write_restart;
}
+25 -25
View File
@@ -121,7 +121,7 @@ static int fat_checkbootrecord(struct fat_mountpt_s *fs)
if (MBR_GETSIGNATURE(fs->fs_buffer) != BOOT_SIGNATURE16 ||
MBR_GETBYTESPERSEC(fs->fs_buffer) != fs->fs_hwsectorsize)
{
fdbg("ERROR: Signature: %04x FS sectorsize: %d HW sectorsize: %d\n",
ferr("ERROR: Signature: %04x FS sectorsize: %d HW sectorsize: %d\n",
MBR_GETSIGNATURE(fs->fs_buffer), MBR_GETBYTESPERSEC(fs->fs_buffer),
fs->fs_hwsectorsize);
@@ -159,7 +159,7 @@ static int fat_checkbootrecord(struct fat_mountpt_s *fs)
if (!fs->fs_nfatsects || fs->fs_nfatsects >= fs->fs_hwnsectors)
{
fdbg("ERROR: fs_nfatsects %d fs_hwnsectors: %d\n",
ferr("ERROR: fs_nfatsects %d fs_hwnsectors: %d\n",
fs->fs_nfatsects, fs->fs_hwnsectors);
return -EINVAL;
@@ -179,7 +179,7 @@ static int fat_checkbootrecord(struct fat_mountpt_s *fs)
if (!fs->fs_fattotsec || fs->fs_fattotsec > fs->fs_hwnsectors)
{
fdbg("ERROR: fs_fattotsec %d fs_hwnsectors: %d\n",
ferr("ERROR: fs_fattotsec %d fs_hwnsectors: %d\n",
fs->fs_fattotsec, fs->fs_hwnsectors);
return -EINVAL;
@@ -190,7 +190,7 @@ static int fat_checkbootrecord(struct fat_mountpt_s *fs)
fs->fs_fatresvdseccount = MBR_GETRESVDSECCOUNT(fs->fs_buffer);
if (fs->fs_fatresvdseccount > fs->fs_hwnsectors)
{
fdbg("ERROR: fs_fatresvdseccount %d fs_hwnsectors: %d\n",
ferr("ERROR: fs_fatresvdseccount %d fs_hwnsectors: %d\n",
fs->fs_fatresvdseccount, fs->fs_hwnsectors);
return -EINVAL;
@@ -206,7 +206,7 @@ static int fat_checkbootrecord(struct fat_mountpt_s *fs)
ndatasectors = fs->fs_fattotsec - fs->fs_fatresvdseccount - ntotalfatsects - rootdirsectors;
if (ndatasectors > fs->fs_hwnsectors)
{
fdbg("ERROR: ndatasectors %d fs_hwnsectors: %d\n",
ferr("ERROR: ndatasectors %d fs_hwnsectors: %d\n",
ndatasectors, fs->fs_hwnsectors);
return -EINVAL;
@@ -239,7 +239,7 @@ static int fat_checkbootrecord(struct fat_mountpt_s *fs)
}
else
{
fdbg("ERROR: notfat32: %d fs_nclusters: %d\n",
ferr("ERROR: notfat32: %d fs_nclusters: %d\n",
notfat32, fs->fs_nclusters);
return -EINVAL;
@@ -594,7 +594,7 @@ int fat_mount(struct fat_mountpt_s *fs, bool writeable)
{
/* Failed to read the sector */
fdbg("ERROR: Failed to read sector %ld: %d\n",
ferr("ERROR: Failed to read sector %ld: %d\n",
(long)fs->fs_fatbase, ret);
continue;
}
@@ -616,14 +616,14 @@ int fat_mount(struct fat_mountpt_s *fs, bool writeable)
ret = fat_hwread(fs, fs->fs_buffer, 0, 1);
if (ret < 0)
{
fdbg("ERROR: Failed to re-read sector 0: %d\n", ret);
ferr("ERROR: Failed to re-read sector 0: %d\n", ret);
goto errout_with_buffer;
}
}
if (i > 3)
{
fdbg("No valid MBR\n");
ferr("No valid MBR\n");
ret = -EINVAL;
goto errout_with_buffer;
}
@@ -644,22 +644,22 @@ int fat_mount(struct fat_mountpt_s *fs, bool writeable)
/* We did it! */
fdbg("FAT%d:\n", fs->fs_type == 0 ? 12 : fs->fs_type == 1 ? 16 : 32);
fdbg("\tHW sector size: %d\n", fs->fs_hwsectorsize);
fdbg("\t sectors: %d\n", fs->fs_hwnsectors);
fdbg("\tFAT reserved: %d\n", fs->fs_fatresvdseccount);
fdbg("\t sectors: %d\n", fs->fs_fattotsec);
fdbg("\t start sector: %d\n", fs->fs_fatbase);
fdbg("\t root sector: %d\n", fs->fs_rootbase);
fdbg("\t root entries: %d\n", fs->fs_rootentcnt);
fdbg("\t data sector: %d\n", fs->fs_database);
fdbg("\t FSINFO sector: %d\n", fs->fs_fsinfo);
fdbg("\t Num FATs: %d\n", fs->fs_fatnumfats);
fdbg("\t FAT sectors: %d\n", fs->fs_nfatsects);
fdbg("\t sectors/cluster: %d\n", fs->fs_fatsecperclus);
fdbg("\t max clusters: %d\n", fs->fs_nclusters);
fdbg("\tFSI free count %d\n", fs->fs_fsifreecount);
fdbg("\t next free %d\n", fs->fs_fsinextfree);
ferr("FAT%d:\n", fs->fs_type == 0 ? 12 : fs->fs_type == 1 ? 16 : 32);
ferr("\tHW sector size: %d\n", fs->fs_hwsectorsize);
ferr("\t sectors: %d\n", fs->fs_hwnsectors);
ferr("\tFAT reserved: %d\n", fs->fs_fatresvdseccount);
ferr("\t sectors: %d\n", fs->fs_fattotsec);
ferr("\t start sector: %d\n", fs->fs_fatbase);
ferr("\t root sector: %d\n", fs->fs_rootbase);
ferr("\t root entries: %d\n", fs->fs_rootentcnt);
ferr("\t data sector: %d\n", fs->fs_database);
ferr("\t FSINFO sector: %d\n", fs->fs_fsinfo);
ferr("\t Num FATs: %d\n", fs->fs_fatnumfats);
ferr("\t FAT sectors: %d\n", fs->fs_nfatsects);
ferr("\t sectors/cluster: %d\n", fs->fs_fatsecperclus);
ferr("\t max clusters: %d\n", fs->fs_nclusters);
ferr("\tFSI free count %d\n", fs->fs_fsifreecount);
ferr("\t next free %d\n", fs->fs_fsinextfree);
return OK;
+13 -13
View File
@@ -86,13 +86,13 @@ static inline int mkfatfs_getgeometry(FAR struct fat_format_s *fmt,
ret = DEV_GEOMETRY(geometry);
if (ret < 0)
{
fdbg("ERROR: geometry() returned %d\n", ret);
ferr("ERROR: geometry() returned %d\n", ret);
return ret;
}
if (!geometry.geo_available || !geometry.geo_writeenabled)
{
fdbg("ERROR: Media is not available\n", ret);
ferr("ERROR: Media is not available\n", ret);
return -ENODEV;
}
@@ -104,7 +104,7 @@ static inline int mkfatfs_getgeometry(FAR struct fat_format_s *fmt,
{
if (fmt->ff_nsectors > geometry.geo_nsectors)
{
fdbg("ERROR: User maxblocks (%d) exceeds blocks on device (%d)\n",
ferr("ERROR: User maxblocks (%d) exceeds blocks on device (%d)\n",
fmt->ff_nsectors, geometry.geo_nsectors);
return -EINVAL;
@@ -139,7 +139,7 @@ static inline int mkfatfs_getgeometry(FAR struct fat_format_s *fmt,
break;
default:
fdbg("ERROR: Unsupported sector size: %d\n", var->fv_sectorsize);
ferr("ERROR: Unsupported sector size: %d\n", var->fv_sectorsize);
return -EPERM;
}
@@ -196,14 +196,14 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)
#ifdef CONFIG_DEBUG_FEATURES
if (!pathname)
{
fdbg("ERROR: No block driver path\n");
ferr("ERROR: No block driver path\n");
ret = -EINVAL;
goto errout;
}
if (fmt->ff_nfats < 1 || fmt->ff_nfats > 4)
{
fdbg("ERROR: Invalid number of fats: %d\n", fmt->ff_nfats);
ferr("ERROR: Invalid number of fats: %d\n", fmt->ff_nfats);
ret = -EINVAL;
goto errout;
}
@@ -211,7 +211,7 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)
if (fmt->ff_fattype != 0 && fmt->ff_fattype != 12 &&
fmt->ff_fattype != 16 && fmt->ff_fattype != 32)
{
fdbg("ERROR: Invalid FAT size: %d\n", fmt->ff_fattype);
ferr("ERROR: Invalid FAT size: %d\n", fmt->ff_fattype);
ret = -EINVAL;
goto errout;
}
@@ -231,7 +231,7 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)
#ifdef CONFIG_DEBUG_FEATURES
if (fmt->ff_clustshift > 7 && fmt->ff_clustshift != 0xff)
{
fdbg("ERROR: Invalid cluster shift value: %d\n", fmt->ff_clustshift);
ferr("ERROR: Invalid cluster shift value: %d\n", fmt->ff_clustshift);
ret = -EINVAL;
goto errout;
@@ -240,7 +240,7 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)
if (fmt->ff_rootdirentries != 0 &&
(fmt->ff_rootdirentries < 16 || fmt->ff_rootdirentries > 32767))
{
fdbg("ERROR: Invalid number of root dir entries: %d\n",
ferr("ERROR: Invalid number of root dir entries: %d\n",
fmt->ff_rootdirentries);
ret = -EINVAL;
@@ -250,7 +250,7 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)
if (fmt->ff_rsvdseccount != 0 && (fmt->ff_rsvdseccount < 1 ||
fmt->ff_rsvdseccount > 32767))
{
fdbg("ERROR: Invalid number of reserved sectors: %d\n",
ferr("ERROR: Invalid number of reserved sectors: %d\n",
fmt->ff_rsvdseccount);
ret = -EINVAL;
@@ -263,7 +263,7 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)
ret = open_blockdriver(pathname, 0, &var.fv_inode);
if (ret < 0)
{
fdbg("ERROR: Failed to open %s\n", pathname);
ferr("ERROR: Failed to open %s\n", pathname);
goto errout;
}
@@ -271,7 +271,7 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)
if (!var.fv_inode->u.i_bops->write || !var.fv_inode->u.i_bops->geometry)
{
fdbg("ERROR: %s does not support write or geometry methods\n",
ferr("ERROR: %s does not support write or geometry methods\n",
pathname);
ret = -EACCES;
@@ -306,7 +306,7 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)
if (!var.fv_sect)
{
fdbg("ERROR: Failed to allocate working buffers\n");
ferr("ERROR: Failed to allocate working buffers\n");
goto errout_with_driver;
}