From 060414c9db42894bd2992bce0805649e44242767 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 24 Nov 2007 13:59:57 +0000 Subject: [PATCH] fs/ and lib/ debug can be selectively enabled git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@406 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- nuttx/ChangeLog | 3 +- nuttx/Documentation/NuttX.html | 3 +- nuttx/Documentation/NuttxPortingGuide.html | 10 +++++-- nuttx/TODO | 1 + nuttx/configs/README.txt | 4 +++ nuttx/fs/fs_fat32util.c | 32 +++++++++++----------- nuttx/include/debug.h | 20 ++++++++++++++ nuttx/lib/lib_getenv.c | 8 +++--- nuttx/lib/lib_sscanf.c | 24 ++++++++-------- 9 files changed, 69 insertions(+), 36 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 58a7d7881..75202c115 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -247,6 +247,7 @@ 0.3.3 2007-xx-xx Gregory Nutt * Removed unused uIP files - * sched/, mm/, net/ subystem debug can not be selectively enabled/disabled + * sched/, mm/, and net/ subystem debug can not be selectively enabled/disabled * Correct socket close logic -- needs to disconnect TCP socket on close * uIP webserver now seems to be fully functional + * fs/ and lib/ subystem debug can not be selectively enabled/disabled diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 969f78cd6..954ee19ee 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -727,9 +727,10 @@ Other memory: 0.3.3 2007-xx-xx Gregory Nutt * Removed unused uIP files - * sched/, mm/, net/ subystem debug can not be selectively enabled/disabled + * sched/, mm/, and net/ subystem debug can not be selectively enabled/disabled * Correct socket close logic -- needs to disconnect TCP socket on close * uIP webserver now seems to be fully functional + * fs/ and lib/ subystem debug can not be selectively enabled/disabled diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index 2aed8d106..fe18ecba8 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -1196,6 +1196,9 @@ The system can be re-made subsequently by just typing make.
  • CONFIG_DEBUG: enables built-in debug options
  • +
  • + CONFIG_DEBUG_VERBOSE: enables verbose debug output +
  • CONFIG_DEBUG_SCHED: enable OS debug output (disabled by default)
  • @@ -1203,10 +1206,13 @@ The system can be re-made subsequently by just typing make. CONFIG_DEBUG_MM: enable memory management debug output (disabld by default)
  • - CONFIG_DEBUG_NET: enable networkd debug output (disabled by default) + CONFIG_DEBUG_NET: enable network debug output (disabled by default)
  • - CONFIG_DEBUG_VERBOSE: enables verbose debug output + CONFIG_DEBUG_FS: enable filesystem debug output (disabled by default) +
  • +
  • + CONFIG_DEBUG_LIB: enable C library debug output (disabled by default)
  • CONFIG_HAVE_LOWPUTC: architecture supports low-level, boot diff --git a/nuttx/TODO b/nuttx/TODO index a9f96642c..197a966b0 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -49,6 +49,7 @@ o Network is in the subnet served by the driver. - uIP/Socket callback logic is not thread safe. This means that a socket cannot be used concurrently by two threads. Minimal fix: Add mutex to support exclusion. +- IPv6 support is incomplete o USB - Implement USB device support diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt index 42d5c9055..88f6291b6 100644 --- a/nuttx/configs/README.txt +++ b/nuttx/configs/README.txt @@ -132,6 +132,10 @@ defconfig -- This is a configuration file similar to the Linux (disabld by default) CONFIG_DEBUG_NET - enable network debug output (disabled by default) + CONFIG_DEBUG_FS - enable filesystem debug output (disabled + by default) + CONFIG_DEBUG_LIB - enable C library debug output (disabled + by default) CONFIG_HAVE_LOWPUTC - architecture supports low-level, boot time console output CONFIG_MM_REGIONS - If the architecture includes multiple diff --git a/nuttx/fs/fs_fat32util.c b/nuttx/fs/fs_fat32util.c index bf2df78f6..ed3097006 100644 --- a/nuttx/fs/fs_fat32util.c +++ b/nuttx/fs/fs_fat32util.c @@ -695,22 +695,22 @@ int fat_mount(struct fat_mountpt_s *fs, boolean writeable) /* We did it! */ - dbg("FAT%d:\n", fs->fs_type == 0 ? 12 : fs->fs_type == 1 ? 16 : 32); - dbg("\tHW sector size: %d\n", fs->fs_hwsectorsize); - dbg("\t sectors: %d\n", fs->fs_hwnsectors); - dbg("\tFAT reserved: %d\n", fs->fs_fatresvdseccount); - dbg("\t sectors: %d\n", fs->fs_fattotsec); - dbg("\t start sector: %d\n", fs->fs_fatbase); - dbg("\t root sector: %d\n", fs->fs_rootbase); - dbg("\t root entries: %d\n", fs->fs_rootentcnt); - dbg("\t data sector: %d\n", fs->fs_database); - dbg("\t FSINFO sector: %d\n", fs->fs_fsinfo); - dbg("\t Num FATs: %d\n", fs->fs_fatnumfats); - dbg("\t FAT size: %d\n", fs->fs_fatsize); - dbg("\t sectors/cluster: %d\n", fs->fs_fatsecperclus); - dbg("\t max clusters: %d\n", fs->fs_nclusters); - dbg("\tFSI free count %d\n", fs->fs_fsifreecount); - dbg("\t next free %d\n", fs->fs_fsinextfree); + 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 size: %d\n", fs->fs_fatsize); + 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); return OK; diff --git a/nuttx/include/debug.h b/nuttx/include/debug.h index 38ec57ba2..651b2cbe8 100644 --- a/nuttx/include/debug.h +++ b/nuttx/include/debug.h @@ -112,6 +112,26 @@ # define nvdbg(x...) #endif +#ifdef CONFIG_DEBUG_FS +# define fdbg(format, arg...) dbg(format, ##arg) +# define flldbg(format, arg...) lldbg(format, ##arg) +# define fvdbg(format, arg...) vdbg(format, ##arg) +#else +# define fdbg(x...) +# define flldbg(x...) +# define fvdbg(x...) +#endif + +#ifdef CONFIG_DEBUG_LIB +# define ldbg(format, arg...) dbg(format, ##arg) +# define llldbg(format, arg...) lldbg(format, ##arg) +# define lvdbg(format, arg...) vdbg(format, ##arg) +#else +# define ldbg(x...) +# define llldbg(x...) +# define lvdbg(x...) +#endif + /************************************************************ * Public Type Declarations ************************************************************/ diff --git a/nuttx/lib/lib_getenv.c b/nuttx/lib/lib_getenv.c index dd659393a..bddd2cb0a 100644 --- a/nuttx/lib/lib_getenv.c +++ b/nuttx/lib/lib_getenv.c @@ -103,7 +103,7 @@ char *getenv(const char *name) const char *pend = &environment[size-1]; const char *ptmp; - dbg("name=\"%s\"\n", name); + ldbg("name=\"%s\"\n", name); if (name) { @@ -111,7 +111,7 @@ char *getenv(const char *name) while (penv < pend) { - vdbg("Compare to=\"%s\"\n", penv); + lvdbg("Compare to=\"%s\"\n", penv); /* The logic below basically implements a version of * strcmp where the strings may be terminated with = signs. @@ -130,7 +130,7 @@ char *getenv(const char *name) { /* Yes.. return the pointer to the value. */ - dbg("Returning \"%s\"\n", penv+1); + ldbg("Returning \"%s\"\n", penv+1); return ((char*)penv+1); } else @@ -165,6 +165,6 @@ char *getenv(const char *name) /* If we got here, then no matching string was found. */ - dbg("Returning NULL\n"); + ldbg("Returning NULL\n"); return NULL; } diff --git a/nuttx/lib/lib_sscanf.c b/nuttx/lib/lib_sscanf.c index af3193e44..e06839f47 100644 --- a/nuttx/lib/lib_sscanf.c +++ b/nuttx/lib/lib_sscanf.c @@ -121,7 +121,7 @@ int vsscanf(char *buf, const char *s, va_list ap) const char *tc; char tmp[MAXLN]; - vdbg("vsscanf: buf=\"%s\" fmt=\"%s\"\n", buf, s); + lvdbg("vsscanf: buf=\"%s\" fmt=\"%s\"\n", buf, s); count = noassign = width = lflag = 0; while (*s && *buf) @@ -135,13 +135,13 @@ int vsscanf(char *buf, const char *s, va_list ap) if (*s == '%') { - vdbg("vsscanf: Specifier found\n"); + lvdbg("vsscanf: Specifier found\n"); /* Check for qualifiers on the conversion specifier */ s++; for (; *s; s++) { - vdbg("vsscanf: Processing %c\n", *s); + lvdbg("vsscanf: Processing %c\n", *s); if (strchr("dibouxcsefg%", *s)) break; @@ -163,7 +163,7 @@ int vsscanf(char *buf, const char *s, va_list ap) if (*s == 's') { - vdbg("vsscanf: Performing string conversion\n"); + lvdbg("vsscanf: Performing string conversion\n"); while (isspace(*buf)) buf++; @@ -184,7 +184,7 @@ int vsscanf(char *buf, const char *s, va_list ap) else if (*s == 'c') { - vdbg("vsscanf: Performing character conversion\n"); + lvdbg("vsscanf: Performing character conversion\n"); if (!width) width = 1; @@ -201,7 +201,7 @@ int vsscanf(char *buf, const char *s, va_list ap) else if (strchr("dobxu", *s)) { - vdbg("vsscanf: Performing integer conversion\n"); + lvdbg("vsscanf: Performing integer conversion\n"); /* Skip over any white space before the integer string */ @@ -237,7 +237,7 @@ int vsscanf(char *buf, const char *s, va_list ap) strncpy(tmp, buf, width); tmp[width] = '\0'; - vdbg("vsscanf: tmp[]=\"%s\"\n", tmp); + lvdbg("vsscanf: tmp[]=\"%s\"\n", tmp); /* Perform the integer conversion */ @@ -251,7 +251,7 @@ int vsscanf(char *buf, const char *s, va_list ap) #else int tmpint = strtol(tmp, NULL, base); #endif - vdbg("vsscanf: Return %d to 0x%p\n", tmpint, pint); + lvdbg("vsscanf: Return %d to 0x%p\n", tmpint, pint); *pint = tmpint; } } @@ -264,10 +264,10 @@ int vsscanf(char *buf, const char *s, va_list ap) # warning "No floating point conversions" void *pv = va_arg(ap, void*); - vdbg("vsscanf: Return 0.0 to %p\n", pv); + lvdbg("vsscanf: Return 0.0 to %p\n", pv); *((double_t*)pv) = 0.0; #else - vdbg("vsscanf: Performing floating point conversion\n"); + lvdbg("vsscanf: Performing floating point conversion\n"); /* Skip over any white space before the real string */ @@ -293,7 +293,7 @@ int vsscanf(char *buf, const char *s, va_list ap) tmp[width] = '\0'; buf += width; - vdbg("vsscanf: tmp[]=\"%s\"\n", tmp); + lvdbg("vsscanf: tmp[]=\"%s\"\n", tmp); /* Perform the floating point conversion */ @@ -308,7 +308,7 @@ int vsscanf(char *buf, const char *s, va_list ap) #endif void *pv = va_arg(ap, void*); - vdbg("vsscanf: Return %f to %p\n", dvalue, pv); + lvdbg("vsscanf: Return %f to %p\n", dvalue, pv); /* But we have to check whether we need to return a * float or a double.