From: Joe Perches <realty@perches.com>
To: Roman Fietze <roman.fietze@telemotive.de>
Cc: Jason Baron <jbaron@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Proposal to add dynamic debug feature for print_hex_dump
Date: Fri, 14 Jan 2011 10:19:06 -0800 [thread overview]
Message-ID: <1295029146.4099.71.camel@Joe-Laptop> (raw)
In-Reply-To: <201101140943.53142.roman.fietze@telemotive.de>
On Fri, 2011-01-14 at 09:43 +0100, Roman Fietze wrote:
> Comments are again welcome.
> Add macros e.g. named pr_<level>_hex_dump calling print_hex_dump with
> the approriate level, with level being emerg, alert, ..., debug. This
> is similiar to the functions starting with "pr_".
Here's a count of the current print_hex_dump uses:
$ grep -rP --include=*.[ch] -oh "print_hex_dump\s*\(\s*KERN_[A-Z]+" * | \
grep -oh -P "KERN_[A-Z]+" | sort | uniq -c
1 KERN_ALERT
2 KERN_CONT
55 KERN_DEBUG
44 KERN_ERR
27 KERN_INFO
10 KERN_WARNING
A high percentage of these print_hex_dump() uses are
(,,, 16, 1, buf, len, true) so there's some value
in doing this.
Converting all of these uses to this new style will
not be possible.
I suggest simplifying naming to just hex_dump_<level>.
That mirrors the more common prefix_<level> style
(dev_<level>, netdev_<level>, etc) and a few more
uses of a single line of code would be possible.
Adding a hex_dump_printk function to hexdump.c
void hex_dump_printk(const char *level, const char *prefix_str, int prefix_type,
const void *buf, size_t len)
{
print_hex_dump(level, prefix_str, prefix_type, 16, 1,
buf, len, true);
}
Removing the print_hex_dump_bytes function and adding
#define print_hex_dump_bytes(prefix, type, buf, len) \
hex_dump_printk(KERN_DEBUG, prefix, type, buf, len)
Adding macros for the various levels:
#define hex_dump_emerg(prefix, type, buf, len) \
hex_dump_printk(KERN_EMERG, prefix, type, len)
#define hex_dump_alert(prefix, type, buf, len) \
hex_dump_printk(KERN_ALERT, prefix, type, len)
#define hex_dump_crit(prefix, type, buf, len) \
hex_dump_printk(KERN_CRIT, prefix, type, len)
#define hex_dump_err(prefix, type, buf, len) \
hex_dump_printk(KERN_ERR, prefix, type, len)
#define hex_dump_warn(prefix, type, buf, len) \
hex_dump_printk(KERN_WARNING, prefix, type, len)
#define hex_dump_notice(prefix, type, buf, len) \
hex_dump_printk(KERN_NOTICE, prefix, type, len)
#define hex_dump_info(prefix, type, buf, len) \
hex_dump_printk(KERN_INFO, prefix, type, len)
#define hex_dump_cont(prefix, type, buf, len) \
hex_dump_printk(KERN_CONT, prefix, type, len)
> Use dynamic printk wrapper to support turning pr_debug_hex_dump on and
> off similar to pr_debug using the dynamic debug sysfs control file.
And add and use a #define hex_dump_dbg with
with dynamic_hex_dump_dbg as appropriate.
Lastly, the 20 or so print_hex_dump_bytes
uses could be converted to hex_dump_dbg()
if desired.
cheers, Joe
next prev parent reply other threads:[~2011-01-14 18:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-03 14:17 [PATCH] Proposal to add dynamic debug feature for print_hex_dump [0/3] Roman Fietze
2010-12-03 14:19 ` [PATCH] Proposal to add dynamic debug feature for print_hex_dump [1/2] Roman Fietze
2010-12-03 20:35 ` Joe Perches
2010-12-03 14:21 ` [PATCH] Proposal to add dynamic debug feature for print_hex_dump [2/2] Roman Fietze
2010-12-03 20:37 ` Joe Perches
2010-12-06 5:58 ` Roman Fietze
2010-12-06 6:04 ` Joe Perches
[not found] ` <201012061113.01576.roman.fietze@telemotive.de>
[not found] ` <1291822758.1240.8.camel@Joe-Laptop>
2011-01-14 8:43 ` [PATCH] Proposal to add dynamic debug feature for print_hex_dump Roman Fietze
2011-01-14 18:19 ` Joe Perches [this message]
2011-02-01 12:45 ` [PATCH 0/2] Fixed proposal " Roman Fietze
2011-02-01 12:46 ` [PATCH 1/2] printk.h dynamic_debug.h: add hex_dump_<level> macros Roman Fietze
2011-02-01 12:48 ` [PATCH 2/2] hex_dump_dbg: replace all calls to print_hex_dump with level KERN_DEBUG Roman Fietze
2011-02-02 1:27 ` Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1295029146.4099.71.camel@Joe-Laptop \
--to=realty@perches.com \
--cc=jbaron@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roman.fietze@telemotive.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox