RTEMS | JFFS2 debug and prints cannot be enabled or disabled properly (#5349)

Aaron Nyholm (@eagleirony) gitlab at rtems.org
Tue Sep 23 03:18:36 UTC 2025



Aaron Nyholm created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5349



## Summary
JFFS2 has two pathways to print. Through `pr_xxx` (e.g. `pr_warn`) and enabling `CONFIG_JFFS2_FS_DEBUG` in `jffs2/src/debug.h`. `CONFIG_JFFS2_FS_DEBUG` is off by default while all `pr_xxx` but `pr_debug` are enabled and cannot be disabled. 

This results in some messages being printed without a method to disable them. The easiest method to reproduce this by mounting a corrupted JFFS2 filesystem. 
```
<4>JFFS2: Empty flash at 0x0076b824 ends at 0x0076b828
<5>JFFS2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0077000c: 0x0400 instead
<5>JFFS2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00770014: 0x0008 instead
<5>JFFS2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0077001c: 0x172a instead
...
```
Alternatively, when debug messages are enabled multiple compile errors are produced
```
../../../cpukit/libfs/src/jffs2/src/debug.c:162:6: error: no previous prototype for '__jffs2_dbg_superblock_counts' [-Werror=missing-prototypes]
  162 | void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

In file included from ../../../cpukit/libfs/src/jffs2/src/nodelist.h:484,
                 from ../../../cpukit/libfs/src/jffs2/src/fs-rtems.c:23:
../../../cpukit/libfs/src/jffs2/src/fs-rtems.c: In function 'icache_evict':
../../../cpukit/libfs/src/jffs2/src/fs-rtems.c:76:12: error: implicit declaration of function 'printf' [-Werror=implicit-function-declaration]
   76 |         D2(printf("icache_evict\n"));
      |            ^~~~~~
../../../cpukit/libfs/src/jffs2/src/debug.h:62:15: note: in definition of macro 'D2'
   62 | #define D2(x) x
      |               ^
../../../cpukit/libfs/src/jffs2/src/fs-rtems.c:34:1: note: include '<stdio.h>' or provide a declaration of 'printf'
   33 | #include <rtems/sysinit.h>
  +++ |+#include <stdio.h>
   34 |
...
```
These are largely due to the outdated port from Linux and improper handling of translating debug from Linux to RTEMS.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5349
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20250923/34adccbe/attachment-0001.htm>


More information about the bugs mailing list