Skip to content
  1. Dec 17, 2009
    • Uwe Kleine-König's avatar
      lib/vsprintf.c: document more vsnprintf extensions · 8a79503a
      Uwe Kleine-König authored
      These were added in
      
      9ac6e44 (lib/vsprintf.c: add %pU to print UUID/GUIDs)
      c7dabef (vsprintf: use %pR, %pr instead of %pRt, %pRf)
      8a27f7c (lib/vsprintf.c: Add "%pI6c" - print pointer as compressed ipv6 address)
      4aa9960 (printk: add %I4, %I6, %i4, %i6 format specifiers)
      dd45c9c (printk: add %pM format specifier for MAC addresses)
      
      but only added comments to pointer() not vsnprintf() that is refered to by
      printk's comments.
      
      Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Cc: Harvey Harrison <harvey.harrison@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Joe Perches <joe@perches.com>
      Cc: Jens Rosenboom <jens@mcbone.net>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
      8a79503a
  2. Dec 15, 2009
  3. Nov 04, 2009
  4. Oct 01, 2009
  5. Sep 22, 2009
  6. Sep 17, 2009
    • Steven Rostedt's avatar
      vsnprintf: remove duplicate comment of vsnprintf · 0efb4d20
      Steven Rostedt authored
      
      
      Remove the duplicate comment of bstr_printf that is the same as the
      vsnprintf.
      
      Add the 's' option to the comment for the pointer function. This is
      more of an internal function so the little duplication of the comment
      here is OK.
      
      Reported-by: default avatarZhaolei <zhaolei@cn.fujitsu.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      0efb4d20
    • Steven Rostedt's avatar
      vsprintf: add %ps that is the same as %pS but is like %pf · 91adcd2c
      Steven Rostedt authored
      
      
      On PowerPC64 function pointers do not point directly at the functions,
      but instead point to pointers to the functions. The output of %pF expects
      to point to a pointer to the function, whereas %pS will show the function
      itself.
      
      mcount returns the direct pointer to the function and not the pointer to
      the pointer. Thus %pS must be used to show this. The function tracer
      requires printing of the functions without offsets and uses the %pf
      instead.
      
       %pF produces run_local_timers+0x4/0x1f
       %pf produces just run_local_timers
      
      For PowerPC64, we need to use the direct pointer, and we only have
      %pS which will produce .run_local_timers+0x4/0x1f
      
      This patch creates a %ps that matches the %pf as %pS matches %pF.
      
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Zhao Lei <zhaolei@cn.fujitsu.com>
      Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      91adcd2c
  7. Aug 29, 2009
  8. Apr 29, 2009
    • Frederic Weisbecker's avatar
      vsprintf: introduce %pf format specifier · 0c8b946e
      Frederic Weisbecker authored
      
      
      A printf format specifier which would allow us to print a pure
      function name has been suggested by Andrew Morton a couple of
      months ago.
      
      The current %pF is very convenient to print a function symbol,
      but often we only want to print the name of the function, without
      its asm offset.
      
      That's what  %pf does in this patch.  The lowecase f has been chosen
      for its intuitive meaning of a 'weak kind of %pF'.
      
      The support for this new format would be welcome by the tracing code
      where the need to print pure function names is often needed. This is
      also true for other parts of the kernel:
      
      $ git-grep -E "kallsyms_lookup\(.+?\)"
      arch/blackfin/kernel/traps.c:   symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf);
      arch/powerpc/xmon/xmon.c:               name = kallsyms_lookup(pc, &size, &offset, NULL, tmpstr);
      arch/sh/kernel/cpu/sh5/unwind.c:        sym = kallsyms_lookup(pc, NULL, &offset, NULL, namebuf);
      arch/x86/kernel/ftrace.c:       kallsyms_lookup((unsigned long) syscall, NULL, NULL, NULL, str);
      kernel/kprobes.c:               sym = kallsyms_lookup((unsigned long)p->addr, NULL,
      kernel/lockdep.c:       return kallsyms_lookup((unsigned long)key, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup((unsigned long)rec->ops->func, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(rec->ip, NULL, NULL, &modname, str);
      kernel/trace/ftrace.c:  kallsyms_lookup(*ptr, NULL, NULL, NULL, str);
      kernel/trace/trace_functions.c: kallsyms_lookup(ip, NULL, NULL, NULL, str);
      kernel/trace/trace_output.c:    kallsyms_lookup(address, NULL, NULL, NULL, str);
      
      Changes in v2:
      
      - Add the explanation of the %pf role for vsnprintf() and bstr_printf()
      
      - Change the comments by dropping the "asm offset" notion and only
        define the %pf against the actual function offset notion.
      
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarMike Frysinger <vapier@gentoo.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Zhaolei <zhaolei@cn.fujitsu.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090415154817.GC5989@nowhere>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0c8b946e
  9. Apr 08, 2009
  10. Mar 14, 2009
  11. Mar 10, 2009
    • Frederic Weisbecker's avatar
      vsprintf: fix bug in negative value printing · 39e874f8
      Frederic Weisbecker authored
      
      
      Sitsofe Wheeler found and bisected that while unifying the
      vsprintf format decoding in:
      
        fef20d9c: vsprintf: unify the format decoding layer for its 3 users
      
      The sign flag has been dropped out in favour of
      precise types (ie: LONG/ULONG).
      
      But the format helper number() still needs this flag to keep track of
      the signedness unless it will consider all numbers as unsigned.
      
      Also add an explicit cast to int (for %d) while parsing with va_arg()
      to ensure the highest bit is well extended on the 64 bits number that
      hosts the value in case of negative values.
      
      Reported-Bisected-Tested-by: default avatarSitsofe Wheeler <sitsofe@yahoo.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <20090309201503.GA5010@nowhere>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      39e874f8
  12. Mar 06, 2009
    • Frederic Weisbecker's avatar
      vsprintf: unify the format decoding layer for its 3 users · fef20d9c
      Frederic Weisbecker authored
      
      
      An new optimization is making its way to ftrace. Its purpose is to
      make trace_printk() consuming less memory and be faster.
      
      Written by Lai Jiangshan, the approach is to delay the formatting
      job from tracing time to output time.
      
      Currently, a call to trace_printk() will format the whole string and
      insert it into the ring buffer. Then you can read it on /debug/tracing/trace
      file.
      
      The new implementation stores the address of the format string and
      the binary parameters into the ring buffer, making the packet more compact
      and faster to insert.
      Later, when the user exports the traces, the format string is retrieved
      with the binary parameters and the formatting job is eventually done.
      
      The new implementation rewrites a lot of format decoding bits from
      vsnprintf() function, making now 3 differents functions to maintain
      in their duplicated parts of printf format decoding bits.
      
      Suggested by Ingo Molnar, this patch tries to factorize the most
      possible common bits from these functions.
      The real common part between them is the format decoding. Although
      they do somewhat similar jobs, their way to export or import the parameters
      is very different. Thus, only the decoding layer is extracted, unless you see
      other parts that could be worth factorized.
      
      Changes in V2:
      
      - Address a suggestion from Linus to group the format_decode() parameters inside
        a structure.
      
      Changes in v3:
      
      - Address other cleanups suggested by Ingo and Linus such as passing the
        printf_spec struct to the format helpers: pointer()/number()/string()
        Note that this struct is passed by copy and not by address. This is to
        avoid side effects because these functions often change these values and the
        changes shoudn't be persistant when a callee helper returns.
        It would be too risky.
      
      - Various cleanups (code alignement, switch/case instead of if/else fountains).
      
      - Fix a bug that printed the first format specifier following a %p
      
      Changes in v4:
      
      - drop unapropriate const qualifier loss while casting fmt to a char *
        (thanks to Vegard Nossum for having pointed this out).
      
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1236356510-8381-6-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      fef20d9c
    • Lai Jiangshan's avatar
      vsprintf: add binary printf · 4370aa4a
      Lai Jiangshan authored
      
      
      Impact: add new APIs for binary trace printk infrastructure
      
      vbin_printf(): write args to binary buffer, string is copied
      when "%s" is occurred.
      
      bstr_printf(): read from binary buffer for args and format a string
      
      [fweisbec@gmail.com: rebase]
      
      Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <1236356510-8381-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4370aa4a
  13. Jan 06, 2009
  14. Jan 03, 2009
  15. Nov 25, 2008
  16. Nov 04, 2008
  17. Oct 29, 2008
  18. Oct 28, 2008
  19. Oct 20, 2008
  20. Oct 16, 2008
    • Harvey Harrison's avatar
      lib: remove defining macros for strict_strto?? · 9d85db22
      Harvey Harrison authored
      
      
      Open-code them rather than using defining macros.  The function bodies are now
      next to their kerneldoc comments as a bonus.
      
      Add casts to the signed cases as they call into the unsigned versions.
      
      Avoids the sparse warnings:
      lib/vsprintf.c:249:1: warning: incorrect type in argument 3 (different signedness)
      lib/vsprintf.c:249:1:    expected unsigned long *res
      lib/vsprintf.c:249:1:    got long *res
      lib/vsprintf.c:249:1: warning: incorrect type in argument 3 (different signedness)
      lib/vsprintf.c:249:1:    expected unsigned long *res
      lib/vsprintf.c:249:1:    got long *res
      lib/vsprintf.c:251:1: warning: incorrect type in argument 3 (different signedness)
      lib/vsprintf.c:251:1:    expected unsigned long long *res
      lib/vsprintf.c:251:1:    got long long *res
      lib/vsprintf.c:251:1: warning: incorrect type in argument 3 (different signedness)
      lib/vsprintf.c:251:1:    expected unsigned long long *res
      lib/vsprintf.c:251:1:    got long long *res
      
      Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9d85db22
    • Harvey Harrison's avatar
      lib: trivial whitespace tidy · 22d27051
      Harvey Harrison authored
      
      
      Remove extra lines before the EXPORT_SYMBOL()s
      
      Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      22d27051
Loading