From: Artem Bityutskiy <dedekind@infradead.org>
To: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
lkml <linux-kernel@vger.kernel.org>,
ericvh@gmail.com, mfasheh@suse.com
Subject: Re: How do I printk <type> correctly?
Date: Wed, 29 Oct 2008 10:00:04 +0200 [thread overview]
Message-ID: <1225267204.4350.10.camel@sauron> (raw)
In-Reply-To: <20081028161136.c652b9fd.randy.dunlap@oracle.com>
On Tue, 2008-10-28 at 16:11 -0700, Randy Dunlap wrote:
> On Thu, 23 Oct 2008 15:41:33 +0400 Alexey Dobriyan wrote:
>
> > If variable is of Type use printk format specifier.
> > ---------------------------------------------------------
> > int %d or %x
> > unsigned int %u or %x
> > long %ld ot %lx
> > unsigned long %lu or %lx
> > long long %lld or %llx
> > unsigned long long %llu or %llx
> > size_t %zu or %zx
> > ssize_t %zd or %zx
> >
> > Raw pointer value SHOULD be printed with %p.
> >
> > u64 SHOULD be printed with %llu/%llx, (unsigned long long):
> >
> > printk("%llu", (unsigned long long)u64_var);
> >
> > s64 SHOULD be printed with %lld/%llx, (long long):
> >
> > printk("%lld", (long long)s64_var);
> >
> > If type is dependent on config option (sector_t), use format specifier
> > of biggest type and explicitly cast to it.
> >
> > Reminder: sizeof() result is of type size_t.
Do we have this somewhere in Documentation? Would be nice to have it.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
next prev parent reply other threads:[~2008-10-29 8:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-23 11:41 How do I printk <type> correctly? Alexey Dobriyan
2008-10-23 11:51 ` David John
2008-10-23 12:06 ` Alexey Dobriyan
2008-10-23 15:13 ` Johannes Berg
2008-10-23 20:40 ` David Miller
2008-10-24 8:41 ` Johannes Berg
2008-10-28 23:11 ` Randy Dunlap
2008-10-29 6:15 ` Artem Bityutskiy
2008-10-29 8:00 ` Artem Bityutskiy [this message]
2008-10-29 15:34 ` Randy Dunlap
2008-10-29 15:36 ` Artem Bityutskiy
2008-10-29 15:43 ` Randy Dunlap
2008-11-05 18:23 ` Randy Dunlap
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=1225267204.4350.10.camel@sauron \
--to=dedekind@infradead.org \
--cc=adobriyan@gmail.com \
--cc=ericvh@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mfasheh@suse.com \
--cc=randy.dunlap@oracle.com \
/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;
as well as URLs for NNTP newsgroup(s).