Skip to contentSkip to conversation

JFFS2 prints

DISCUSSION Artem B. Bityuckiy 2 participants 3 messages Nov 13, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hello,

I wonder, is there some reasons why JFFS2 doesn't use some macros to output information? My be in order to be eCos-compatable? Or may be it is just dirty work and nobody has time to do it?

I mean, why do not we introduce macros like:

/* JFFS2 message */

#define JFFS2MSG(fmt, args...) \
    printk(KERN_NOTICE fmt, args);

/* JFFS2 debug message */

#define JFFS2DMSG(level, fmt, args...) \
    do { \
        if (level <= JFFS2_DEBUG_LEVEL) \
            printk(KERN_DEBUG "(%d) %s(): " fmt, level, __FUNCTION__, 
args); \
    }while(0)

/* JFFS2 warning message */

#define JFFS2EMSG(fmt, args...) \
    do { \
        printk(KERN_ERR "JFFS2 Warning! %s(): " fmt, __FUNCTION__, args); \
    } while(0)

/* JFFS2 error message */

#define JFFS2EMSG(fmt, args...) \
    do { \
        printk(KERN_ERR "JFFS2 Error! %s(): " fmt, __FUNCTION__, args); \
    } while(0)

It is not very readable to use output like this:
D1(printk(KERN_DEBUG "bababa"));

But the main thing why I think it would be nice to introduce macros like these is that the messages will be a bit standard. I mean that all errors will have the same prefix. It is useful when you develop JFFS2 with debugging output on. In this case you will just s/JFFS2 Error and see all the error messages. But currently, it is hard to find all the error messages in JFFS2 because some of them use prefix "Error", some just contain the word "failed", etc.

Thanks.

Signature · 3 lines
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
#1 lore raw
Quoted 7 lines · Artem B. Bityuckiy

But the main thing why I think it would be nice to introduce macros like these is that the messages will be a bit standard. I mean that all errors will have the same prefix. It is useful when you develop JFFS2 with debugging output on. In this case you will just s/JFFS2 Error and see all the error messages. But currently, it is hard to find all the error messages in JFFS2 because some of them use prefix "Error", some just contain the word "failed", etc.

I'm not sure that just a standard prefix will really help with debugging. The trick is still to know what's important, and what's noise. And running it with full debugging is slow enough already over a 115200 baud serial line, without adding more stuff to each line :)

I'd much rather see an effort to weed out the unnecessary prints at debug level 1, moving them to level 2. I don't consider level 2 to be particularly useful in general; it's _too_ verbose.

Signature · 1 line
dwmw2
#2 lore raw
Quoted 9 lines · David Woodhouse
Quoted 1 line · Artem B. Bityuckiy

But the main thing why I think it would be nice to introduce macros like these is that the messages will be a bit standard. I mean that all errors will have the same prefix. It is useful when you develop JFFS2 with debugging output on. In this case you will just s/JFFS2 Error and see all the error messages. But currently, it is hard to find all the error messages in JFFS2 because some of them use prefix "Error", some just contain the word "failed", etc.

I'm not sure that just a standard prefix will really help with debugging. The trick is still to know what's important, and what's noise. And running it with full debugging is slow enough already over a 115200 baud serial line, without adding more stuff to each line :)

I'm debugging JFFS2 on the P4 host with the Flash simulator, so I do not restricted by the serial line speed. May be somebody use USB which is also faster.

The situation is that I have *lots* of debugging output and want to see all warnings/errors. May be not only I :-) Yes, some of the output is unneeded and too noisy, but many is very useful.

Moreover, we will not need to write the name of function in the debugging printk. I mean

D1(printk(KERN_DEBUG "some_long_function_name(): some important message"));

We will use shorter calls like
JFFS2DMSG(1, "some important message");

Quoted 5 lines

I'd much rather see an effort to weed out the unnecessary prints at debug level 1, moving them to level 2. I don't consider level 2 to be particularly useful in general; it's _too_ verbose.

Yes, I've mentioned this and I switch off the lists content output when developing JFFS2. I think these messages should be moved to the level 2.

So, do you think we should not introduce such output macros?

Signature · 3 lines
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.