Skip to contentSkip to conversation

tools: updated "xl_info.c" to accept "--clear" as parameter following "xl dmesg"

PATCH In review Xiao Liang 2 participants 3 messages Aug 1, 2017

lore
Share & tools
lore

Xiao Liang

author
#0 lore raw

PATCH 1/1 tools: updated "xl_info.c" to accept "--clear" as parameter following "xl dmesg"

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 <[email protected]>
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.

tools/xl/xl_info.c +4 -1
index 94bd1fd9ab..d6f723b4ad 100644
@@ -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

Quoted 1 line

From 85c4bb378cb456fba96bbe6cdc8734f493daeb0c Mon Sep 17 00:00:00 2001

From: xiliang <[email protected]>
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.

---
 tools/xl/xl_info.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/xl/xl_info.c +4 -1
index 94bd1fd9ab..d6f723b4ad 100644
@@ -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;
Signature · 1 line
2.13.3

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#1 lore raw
Quoted 9 lines · Xiao Liang

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.

Yes we would accept a patch to add the long option.

Quoted 16 lines
Author: xiliang <[email protected]>
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.

tools/xl/xl_info.c +0 -0
index 94bd1fd9ab..d6f723b4ad 100644

tools/xl/xl_info.c int main_dmesg(int argc, char **argv) · line 888

Quoted 5 lines
tools/xl/xl_info.c +2 -0
@@ -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'}

Missing COMMON_LONG_OPTS

And please use git send-email in the future to send your patch directly.

See https://wiki.xenproject.org/wiki/Submitting_Xen_Project_Patches

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
In reply to Xiao Liang
Quoted 7 lines · Xiao Liang

From 85c4bb378cb456fba96bbe6cdc8734f493daeb0c Mon Sep 17 00:00:00 2001
From: xiliang <[email protected]>
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.

Also you might want to rework the commit message a bit.

When writing the commit message, the first line is going to be the subject line of the email, and the rest the body of the commit message.

The subject line can be:

xl: add --clear option to dmesg command

The body can be:

The manual of xl says --clear option is supported and that option worked for xm. Add that to xl now.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel