xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH 5/5] Test harness for new printk formatting
Date: Mon, 4 Nov 2013 10:55:39 +0000	[thread overview]
Message-ID: <1383562539-16085-6-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1383562539-16085-1-git-send-email-andrew.cooper3@citrix.com>

---
 xen/arch/x86/irq.c |   36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
index c2e5629..6a447ff 100644
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2485,3 +2485,39 @@ bool_t hvm_domain_use_pirq(const struct domain *d, const struct pirq *pirq)
     return is_hvm_domain(d) && pirq &&
            pirq->arch.hvm.emuirq != IRQ_UNBOUND; 
 }
+
+static void test_printk(unsigned char key)
+{
+    char buffer[8] = { 0 };
+    char buffer2[3] = { 0 };
+
+    printk("In %s()\n", __func__);
+    printk("Some symbols: '%ps' '%pS'\n", _p(printk), _p(printk));
+    printk("More symbols: '%ps' '%pS'\n", _p(test_printk), _p(test_printk));
+    printk("Invalid: '%ps' '%pS'\n", _p(NULL), _p(NULL));
+    printk("Partial: '%ps' '%pS'\n", _p(((unsigned long)test_printk + 0x20)),
+           _p(((unsigned long)test_printk + 0x20)));
+
+    snprintf(buffer, sizeof buffer, "%pS", _p(test_printk));
+    printk("Test printing into 8 byte buffer '%s'\n", buffer);
+
+    snprintf(buffer, sizeof buffer, "%ps", _p(test_printk));
+    printk("Test printing into 8 byte buffer '%s'\n", buffer);
+
+    snprintf(buffer2, sizeof buffer2, "%ps",
+             _p(((unsigned long)test_printk + 0x20)));
+    printk("Test printing into 3 byte buffer '%s'\n", buffer2);
+}
+
+static struct keyhandler test_printk_keyhandler = {
+    .diagnostic = 1,
+    .u.fn = test_printk,
+    .desc = "Test new printk formatting options"
+};
+
+static int __init setup_test_printk(void)
+{
+    register_keyhandler('6', &test_printk_keyhandler);
+    return 0;
+}
+__initcall(setup_test_printk);
-- 
1.7.10.4

      parent reply	other threads:[~2013-11-04 10:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04 10:55 [PATCH 0/5] Printk symbol specifier Andrew Cooper
2013-11-04 10:55 ` [PATCH 1/5] common/vsprintf: Add %ps and %pS format specifier support Andrew Cooper
2013-11-04 14:51   ` Jan Beulich
2013-11-04 14:54   ` Jan Beulich
2013-11-04 18:39   ` Tim Deegan
2013-11-04 10:55 ` [PATCH 2/5] x86: Replace print_symbol() with new %ps/%pS format Andrew Cooper
2013-11-04 10:55 ` [PATCH 3/5] arm: " Andrew Cooper
2013-11-04 15:20   ` Ian Campbell
2013-11-04 10:55 ` [PATCH 4/5] common/symbols: Remove print_symbol() and associated infrastructure Andrew Cooper
2013-11-04 10:55 ` Andrew Cooper [this message]

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=1383562539-16085-6-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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).