LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCHSET] printk: implement printk_header() and merging printk, take #3
@ 2008-02-13  9:09 Tejun Heo
  2008-02-13  9:09 ` [PATCH 1/5] printk: keep log level on multiline messages Tejun Heo
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Tejun Heo @ 2008-02-13  9:09 UTC (permalink / raw)
  To: jeff, linux-ide, jengelh, matthew, randy.dunlap, daniel.ritz-ml,
	linux-kernel, akpm

Hello, all.

This is the third take of implement-printk_header-and-mprintk
patchset.

Changes from the last take[L] are...

* Now header is printed on every line of a multiline message.  If the
  header ends with ':' followed by spaces.  The colon is replaced with
  space from the second line.

* s/mprintk/mprintk_flush/ and s/mprintk_add/mprintk/ as suggested.

* mprintk_init_alloc() and mprintk_free() added to ease malloc'd
  buffer handling.  No need to specify buffer size.  Sizing is left to
  mprintk.

This patchset aims to make printing multiline messages and assembling
message piece-by-piece easier.

In a nutshell, printk_header() lets you do the following atomically
(against other messages).

 code:
  printk(KERN_INFO "ata1.00: ", "line0\nline1\nline2\n");

 output:
  <6>ata1.00: line0
  <6>ata1.00  line1
  <6>ata1.00  line2

And mprintk the following.

 code:
  DEFINE_MPRINTK(mp, 2 * 80);

  mprintk_set_header(&mp, KERN_INFO "ata%u.%2u: ", 1, 0);
  mprintk_push(&mp, "ATA %d", 7);
  mprintk_push(&mp, ", %u sectors\n", 1024);
  mprintk(&mp, "everything seems dandy\n");

 output:
  <6>ata1.00: ATA 7, 1024 sectors
  <6>ata1.00  everything seems dandy

For more info, please read Documentation/printk.txt which is created
by the fourth patch.

This patchset is on top of

  linux-2.6#master (96b5a46e2a72dc1829370c87053e0cd558d58bc0)
+ printk-fix-possible-printk-buffer-overrun [1]
+ printk-implement-printk_buf-overflow-warning [2]

and contains the following patches.

0001-printk-keep-log-level-on-multiline-messages.patch
0002-printk-implement-v-printk_header.patch
0003-printk-implement-merging-printk.patch
0004-printk-add-Documentation-printk.txt.patch
0005-libata-make-libata-use-printk_header-and-mprintk.patch

 Documentation/00-INDEX      |    2 
 Documentation/printk.txt    |  724 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/ata/libata-core.c   |  204 +++++++-----
 drivers/ata/libata-eh.c     |  182 +++++------
 drivers/ata/libata-pmp.c    |    5 
 drivers/ata/libata-scsi.c   |    6 
 drivers/ata/sata_inic162x.c |    2 
 drivers/ata/sata_nv.c       |    4 
 include/linux/kernel.h      |   85 +++++
 include/linux/libata.h      |   35 +-
 kernel/printk.c             |  435 ++++++++++++++++++++++++--
 11 files changed, 1453 insertions(+), 231 deletions(-)

If this gets acked, I think it's best to push it through libata-dev as
libata is the first user.

Thanks.

--
tejun

[L] http://thread.gmane.org/gmane.linux.ide/27317
[1] http://article.gmane.org/gmane.linux.kernel/639018
[2] http://article.gmane.org/gmane.linux.kernel/639029

^ permalink raw reply	[flat|nested] 18+ messages in thread
* [PATCHSET] printk: implement printk_header() and merging printk, take #2
@ 2008-01-21  5:13 Tejun Heo
  2008-01-21  5:13 ` [PATCH 4/5] printk: add Documentation/printk.txt Tejun Heo
  0 siblings, 1 reply; 18+ messages in thread
From: Tejun Heo @ 2008-01-21  5:13 UTC (permalink / raw)
  To: randy.dunlap, daniel.ritz-ml, matthew, jeff, linux-kernel, linux-ide

Hello, all.

This is the second take of implement-printk_header-and-mprintk
patchset.

  Changes from the last take[L] are...

  * s/mprintk_push/mprintk_add/ and other changes suggested by Randy
    Dunlap.

  * mp->buf instead of mp->header to ease freeing kmalloc'd buffer
    later.

  * mprintk multiline log level handling fixed and improved.  mp->prv is
    removed and mp->flags is used to track whether header log level
    exists and log level is overridden.  One critical bug was re-using
    va_list more than once resulting in dereferences of wrong addresses.
    Fixed by using va_copy().

This patchset aims to make printing multiline messages and assembling
message piece-by-piece easier.

In a nutshell, printk_header() lets you do the following atomically
(against other messages).

 code:
  printk(KERN_INFO "ata1.00: ", "line0\nline1\nline2\n");

 output:
  <6>ata1.00: line0
  <6>         line1
  <6>         line2

And mprintk the following.

 code:
  DEFINE_MPRINTK(mp, 2 * 80);

  mprintk_set_header(&mp, KERN_INFO "ata%u.%2u: ", 1, 0);
  mprintk_push(&mp, "ATA %d", 7);
  mprintk_push(&mp, ", %u sectors\n", 1024);
  mprintk(&mp, "everything seems dandy\n");

 output:
  <6>ata1.00: ATA 7, 1024 sectors
  <6>         everything seems dandy

For more info, please read Documentation/printk.txt which is created
by the fourth patch.

This patchset is against the current linux-2.6#master (a7da60f4) and
contains the following patches.

0001-printk-keep-log-level-on-multiline-messages.patch
0002-printk-implement-v-printk_header.patch
0003-printk-implement-merging-printk.patch
0004-printk-add-Documentation-printk.txt.patch
0005-libata-make-libata-use-printk_header-and-mprintk.patch

 Documentation/00-INDEX      |    2 
 Documentation/printk.txt    |  711 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/ata/libata-core.c   |  202 +++++++-----
 drivers/ata/libata-eh.c     |  150 ++++-----
 drivers/ata/libata-pmp.c    |    5 
 drivers/ata/libata-scsi.c   |    6 
 drivers/ata/sata_inic162x.c |    2 
 drivers/ata/sata_nv.c       |    4 
 include/linux/kernel.h      |   81 +++++
 include/linux/libata.h      |   35 +-
 kernel/printk.c             |  392 ++++++++++++++++++++++--
 11 files changed, 1379 insertions(+), 211 deletions(-)

Randy, Jeff, if this take gets acked, how about pushing this through
libata-dev as it's the first user and I have other libata changes
depending on mprintk?

Thanks.

--
tejun

[L] http://thread.gmane.org/gmane.linux.ide/27199

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2008-02-16 14:14 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-13  9:09 [PATCHSET] printk: implement printk_header() and merging printk, take #3 Tejun Heo
2008-02-13  9:09 ` [PATCH 1/5] printk: keep log level on multiline messages Tejun Heo
2008-02-13  9:09 ` [PATCH 2/5] printk: implement [v]printk_header() Tejun Heo
2008-02-13  9:09 ` [PATCH 3/5] printk: implement merging printk Tejun Heo
2008-02-13  9:09 ` [PATCH 4/5] printk: add Documentation/printk.txt Tejun Heo
2008-02-13  9:09 ` [PATCH 5/5] libata: make libata use printk_header() and mprintk Tejun Heo
2008-02-13 23:57 ` [PATCHSET] printk: implement printk_header() and merging printk, take #3 Andrew Morton
2008-02-14  0:40   ` Tejun Heo
2008-02-14  1:09     ` Andrew Morton
2008-02-14  1:26       ` Tejun Heo
2008-02-15  1:49         ` Tejun Heo
2008-02-15  2:27           ` Andrew Morton
2008-02-15  2:36             ` Tejun Heo
2008-02-15  2:50               ` Andrew Morton
2008-02-15  3:16                 ` Tejun Heo
2008-02-16 14:13                   ` Mark Lord
2008-02-14 16:29     ` Mark Lord
  -- strict thread matches above, loose matches on Subject: below --
2008-01-21  5:13 [PATCHSET] printk: implement printk_header() and merging printk, take #2 Tejun Heo
2008-01-21  5:13 ` [PATCH 4/5] printk: add Documentation/printk.txt Tejun Heo

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).