From: Xiao Liang Subject: [PATCH]tools: updated "xl_info.c" to accept "--clear" as parameter following "xl dmesg" Date: Tue, 1 Aug 2017 22:19:35 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------F618BB8EBD6E2CD6547E2924" Return-path: Content-Language: en-US List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: ian.jackson@eu.citrix.com, wei.liu2@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------F618BB8EBD6E2CD6547E2924 Content-Type: multipart/alternative; boundary="------------81E8D3B7F0EA206014922974" --------------81E8D3B7F0EA206014922974 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hello, Today I found a minor problem that "xl dmesg --clear" failed to clear Xen's message buffer. From manual page, it should accept "-c" or "--clear". I proposed a fix and please help review. I also attached the path in the mail in case mail client format problem. Thanks Fail log: # xl dmesg --clear option `' not supported. Author: xiliang Date: Tue Aug 1 17:33:02 2017 +0800 tools: updated "xl_info.c" to accept "--clear" as parameter following "xl dmesg" In xl man page, adding "-c" or "--clear" following "xl dmesg" can clear Xen's message buffer. It works in old "xm", so added support to xl. Signed-off-by: xiliang diff --git a/tools/xl/xl_info.c b/tools/xl/xl_info.c index 94bd1fd9ab..d6f723b4ad 100644 --- a/tools/xl/xl_info.c +++ b/tools/xl/xl_info.c @@ -884,8 +884,11 @@ int main_dmesg(int argc, char **argv) libxl_xen_console_reader *cr; char *line; int opt, ret = 1; + static struct option opts[] = { + {"clear", 0, 0, 'c'} + }; - SWITCH_FOREACH_OPT(opt, "c", NULL, "dmesg", 0) { + SWITCH_FOREACH_OPT(opt, "c", opts, "dmesg", 0) { case 'c': clear = 1; break; Thanks, Xiao Liang --------------81E8D3B7F0EA206014922974 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Hello,

Today I found a minor problem that "xl dmesg --clear" failed to clear Xen's message buffer. From manual page, it should accept "-c" or "--clear".
I proposed a fix and please help review. I also attached the path in the mail in case mail client format problem. Thanks
Fail log:
# xl dmesg --clear
option `' not supported.

Author: xiliang <xiliang@redhat.com>
Date:   Tue Aug 1 17:33:02 2017 +0800

    tools: updated "xl_info.c" to accept "--clear" as parameter following "xl dmesg"
    In xl man page, adding "-c" or "--clear" following "xl dmesg" can clear Xen's message buffer. It works in old "xm", so added support to xl.
   
    Signed-off-by: xiliang <xiliang@redhat.com>

diff --git a/tools/xl/xl_info.c b/tools/xl/xl_info.c
index 94bd1fd9ab..d6f723b4ad 100644
--- a/tools/xl/xl_info.c
+++ b/tools/xl/xl_info.c
@@ -884,8 +884,11 @@ int main_dmesg(int argc, char **argv)
     libxl_xen_console_reader *cr;
     char *line;
     int opt, ret = 1;
+    static struct option opts[] = {
+        {"clear", 0, 0, 'c'}
+    };
 
-    SWITCH_FOREACH_OPT(opt, "c", NULL, "dmesg", 0) {
+    SWITCH_FOREACH_OPT(opt, "c", opts, "dmesg", 0) {
     case 'c':
         clear = 1;
         break;

Thanks,
Xiao Liang

--------------81E8D3B7F0EA206014922974-- --------------F618BB8EBD6E2CD6547E2924 Content-Type: text/x-patch; name="0001-tools-updated-xl_info.c-to-accept-clear-as-parameter.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-tools-updated-xl_info.c-to-accept-clear-as-parameter.pa"; filename*1="tch" >From 85c4bb378cb456fba96bbe6cdc8734f493daeb0c Mon Sep 17 00:00:00 2001 From: xiliang Date: Tue, 1 Aug 2017 17:33:02 +0800 Subject: [PATCH] tools: updated "xl_info.c" to accept "--clear" as parameter following "xl dmesg" In xl man page, adding "-c" or "--clear" following "xl dmesg" can clear Xen's message buffer. It works in old "xm", so added support to xl. Signed-off-by: xiliang --- tools/xl/xl_info.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/xl/xl_info.c b/tools/xl/xl_info.c index 94bd1fd9ab..d6f723b4ad 100644 --- a/tools/xl/xl_info.c +++ b/tools/xl/xl_info.c @@ -884,8 +884,11 @@ int main_dmesg(int argc, char **argv) libxl_xen_console_reader *cr; char *line; int opt, ret = 1; + static struct option opts[] = { + {"clear", 0, 0, 'c'} + }; - SWITCH_FOREACH_OPT(opt, "c", NULL, "dmesg", 0) { + SWITCH_FOREACH_OPT(opt, "c", opts, "dmesg", 0) { case 'c': clear = 1; break; -- 2.13.3 --------------F618BB8EBD6E2CD6547E2924 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --------------F618BB8EBD6E2CD6547E2924--