summaryrefslogtreecommitdiffstats
path: root/Documentation/printk-formats.txt
Commit message (Collapse)AuthorAgeFilesLines
* lib/vsprintf: add %*pE[achnops] format specifierAndy Shevchenko2014-10-141-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | This allows user to print a given buffer as an escaped string. The rules are applied according to an optional mix of flags provided by additional format letters. For example, if the given buffer is: 1b 62 20 5c 43 07 22 90 0d 5d The result strings would be: %*pE "\eb \C\a"\220\r]" %*pEhp "\x1bb \C\x07"\x90\x0d]" %*pEa "\e\142\040\\\103\a\042\220\r\135" Please, read Documentation/printk-formats.txt and lib/string_helpers.c kernel documentation to get further information. [akpm@linux-foundation.org: tidy up comment layout, per Joe] Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Suggested-by: Joe Perches <joe@perches.com> Cc: "John W . Linville" <linville@tuxdriver.com> Cc: Johannes Berg <johannes@sipsolutions.net> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* doc: printk-formats: do not mention casts for u64/s64Ilya Dryomov2014-05-051-2/+2
| | | | | | | | | Do not mention casts for u64/s64. Complements commit 2a7930bd77fe ("Documentation/printk-formats.txt: No casts needed for u64/s64"). Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* vsprintf: add %pad extension for dma_addr_t useJoe Perches2014-01-231-2/+9
| | | | | | | | | | | | | | | | | | | dma_addr_t's can be either u32 or u64 depending on a CONFIG option. There are a few hundred dma_addr_t's printed via either cast to unsigned long long, unsigned long or no cast at all. Add %pad to be able to emit them without the cast. Update Documentation/printk-formats.txt too. Signed-off-by: Joe Perches <joe@perches.com> Cc: "Shevchenko, Andriy" <andriy.shevchenko@intel.com> Cc: Rob Landley <rob@landley.net> Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Cc: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Merge branch 'for-linus' of ↵Linus Torvalds2013-09-061-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial Pull trivial tree from Jiri Kosina: "The usual trivial updates all over the tree -- mostly typo fixes and documentation updates" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (52 commits) doc: Documentation/cputopology.txt fix typo treewide: Convert retrun typos to return Fix comment typo for init_cma_reserved_pageblock Documentation/trace: Correcting and extending tracepoint documentation mm/hotplug: fix a typo in Documentation/memory-hotplug.txt power: Documentation: Update s2ram link doc: fix a typo in Documentation/00-INDEX Documentation/printk-formats.txt: No casts needed for u64/s64 doc: Fix typo "is is" in Documentations treewide: Fix printks with 0x%# zram: doc fixes Documentation/kmemcheck: update kmemcheck documentation doc: documentation/hwspinlock.txt fix typo PM / Hibernate: add section for resume options doc: filesystems : Fix typo in Documentations/filesystems scsi/megaraid fixed several typos in comments ppc: init_32: Fix error typo "CONFIG_START_KERNEL" treewide: Add __GFP_NOWARN to k.alloc calls with v.alloc fallbacks page_isolation: Fix a comment typo in test_pages_isolated() doc: fix a typo about irq affinity ...
| * Documentation/printk-formats.txt: No casts needed for u64/s64Geert Uytterhoeven2013-08-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Now all 64-bit architectures have been converted to int-ll64.h in kernel space, casting to (unsigned) long long is no longer needed when formatting u64/s64. For backwards compatibility, alpha, ia64, mips64, and powerpc64 still use int-l64.h in userspace. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Acked-by: Rob Landley <rob@landley.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * Merge branch 'master' into for-nextJiri Kosina2013-07-251-0/+32
| |\ | | | | | | | | | | | | | | | | | | Sync with Linus' master to be able to apply trivial patche to newer code. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| * | doc: printk-formats: fix format specifier to %p[Ii]4[hnbl]Daniel Borkmann2013-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This might have been an oversight, as '4' is needed as %pI4/%pi4 are format specifiers and [hnbl] are extensions of it. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> CC: Joe Perches <joe@perches.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | | add formats for dentry/file pathnamesAl Viro2013-09-041-0/+9
| |/ |/| | | | | | | | | | | | | New formats: %p[dD][234]?. The next pointer is interpreted as struct dentry * or struct file * resp. ('d' => dentry, 'D' => file) and the last component(s) of pathname are printed (%pd => just the last one, %pd2 => the last two, etc.) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* | lib: vsprintf: add IPv4/v6 generic %p[Ii]S[pfs] format specifierDaniel Borkmann2013-07-011-0/+32
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to avoid making code that deals with printing both, IPv4 and IPv6 addresses, unnecessary complicated as for example ... if (sa.sa_family == AF_INET6) printk("... %pI6 ...", ..sin6_addr); else printk("... %pI4 ...", ..sin_addr.s_addr); ... it would be better to introduce a format specifier that can deal with those kind of situations internally; just as we have a "struct sockaddr" for generic mapping into "struct sockaddr_in" or "struct sockaddr_in6" as e.g. done in "union sctp_addr". Then, we could reduce the above statement into something like: printk("... %pIS ..", &sockaddr); In case our pointer is NULL, pointer() then deals with that already at an earlier point in time internally. While we're at it, support for both %piS/%pIS, where 'S' stands for sockaddr, comes (almost) for free. Additionally to that, postfix specifiers 'p', 'f' and 's' are supported as suggested and initially implemented in 2009 by Joe Perches [1]. Handling of those additional specifiers orientate on the initial RFC that was proposed. Also we support IPv6 compressed format specified by 'c' and various other IPv4 extensions as stated in the documentation part. Likely, there are many other areas than just SCTP in the kernel to make use of this extension as well. [1] http://patchwork.ozlabs.org/patch/31480/ Signed-off-by: Daniel Borkmann <dborkman@redhat.com> CC: Joe Perches <joe@perches.com> CC: linux-kernel@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
* Merge branch 'for-linus' of ↵Linus Torvalds2013-04-301-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial Pull fixup for trivial branch from Jiri Kosina: "Unfortunately I made a mistake when merging into for-linus branch, and omitted one pre-requisity patch for a few other patches (which have been Acked by the appropriate maintainers) in the series. Mea culpa maxima, sorry for that." The trivial branch added %pSR usage before actually teaching vsnprintf() about the 'R' part of %pSR. The 'R' causes the symbol translation to do a "__builtin_extract_return_addr()" before symbol lookup. That said, on most architectures __builtin_extract_return_addr() isn't likely to do anything special, so it probably is not normally noticeable. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: vsprintf: Add extension %pSR - print_symbol replacement
| * vsprintf: Add extension %pSR - print_symbol replacementJoe Perches2013-04-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | print_symbol takes a long and converts it to a function name and offset. %pS does something similar, but doesn't translate the address via __builtin_extract_return_addr. %pSR does the translation. This will enable replacing multiple calls like printk(...); printk_symbol(addr); printk("\n"); with a single non-interleavable in dmesg printk("... %pSR\n", (void *)addr); Update documentation too. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | Randy has movedRandy Dunlap2013-03-081-1/+1
|/ | | | | | | | | | Update email address and CREDITS info. xenotime.net is defunct. Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Harry Wei <harryxiyou@gmail.com> Cc: Keiichi KII <k-keiichi@bx.jp.nec.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* lib/vsprintf.c: add %pa format specifier for phys_addr_t typesStepan Moskovchenko2013-02-211-3/+11
| | | | | | | | | | | | | | | | | Add the %pa format specifier for printing a phys_addr_t type and its derivative types (such as resource_size_t), since the physical address size on some platforms can vary based on build options, regardless of the native integer type. Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org> Cc: Rob Landley <rob@landley.net> Cc: George Spelvin <linux@horizon.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* lib/vsprintf: update documentation to cover all of %p[Mm][FR]Andy Shevchenko2012-10-061-0/+1
| | | | | | | Acked-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* vsprintf: add support of '%*ph[CDN]'Andy Shevchenko2012-07-301-0/+10
| | | | | | | | | | | | | | | | | | | There are many places in the kernel where the drivers print small buffers as a hex string. This patch adds a support of the variable width buffer to print it as a hex string with a delimiter. The idea came from Pavel Roskin here: http://www.digipedia.pl/usenet/thread/18835/17449/ Sample output of pr_info("buf[%d:%d] %*phC\n", from, len, len, &buf[from]); could be look like this: [ 0.726130] buf[51:8] e8:16:b6:ef:e3:74:45:6e [ 0.750736] buf[59:15] 31:81:b8:3f:35:49:06:ae:df:32:06:05:4a:af:55 [ 0.757602] buf[17:5] ac:16:d5:2c:ef Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* vsprintf: add %pMR for Bluetooth MAC addressAndrei Emeltchenko2012-07-301-0/+5
| | | | | | | | | | | | | | Bluetooth uses mostly LE byte order which is reversed for visual interpretation. Currently in Bluetooth in use unsafe batostr function. This is a slightly modified version of Joe's patch (sent Sat, Dec 4, 2010). Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Cc: Joe Perches <joe@perches.com> Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Documentation: update printk-formats.txtAndrew Murray2011-06-151-2/+117
| | | | | | | | | This patch updates the incomplete documentation concerning the printk extended format specifiers. Signed-off-by: Andrew Murray <amurray@mpc-data.co.uk> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* DOC: add printk-formats.txtRandy Dunlap2008-11-121-0/+35
Add printk-formats.txt so that we don't have to keep fixing the same things over and over again. <wishful thinking> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>