tools/libx: xl uptime doesn't require argument
PATCH 1/1 tools/libx: xl uptime doesn't require argument
The current behavior is:
42sh> xl uptime
'xl uptime' requires at least 1 argument.
Usage: xl [-v] uptime [-s] [Domain]
The normal behavior should list uptime for each domain when there is no parameters.
--- tools/libxl/xl_cmdimpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxl/xl_cmdimpl.c +1 -1
@@ -6285,7 +6285,7 @@ int main_uptime(int argc, char **argv)int nb_doms =0 ;int opt; - SWITCH_FOREACH_OPT(opt, "s", NULL, "uptime", 1) { + SWITCH_FOREACH_OPT(opt, "s", NULL, "uptime", 0) {case 's' : short_mode =1 ;break ;
Signature · 1 line
1.7.10.4
Julien Grall writes ("[PATCH] tools/libx: xl uptime doesn't require argument"):
Quoted 9 lines
The current behavior is:
42sh> xl uptime
'xl uptime' requires at least 1 argument.Usage: xl [-v] uptime [-s] [Domain]
The normal behavior should list uptime for each domain when there is no parameters.
Maybe I'm confused, but the current code seems not to do that even if you change option parsing spec. Is there part of your patch missing ?
Thanks,
Ian.
Quoted 6 lines · Ian Jackson
Julien Grall writes ("[PATCH]
tools/libx: xl uptime doesn't require argument"):Quoted 5 lines
The current behavior is:
42sh> xl uptime
'xl uptime' requires at least 1 argument.
Quoted 7 lines
Quoted 4 lines
Usage: xl [-v] uptime [-s] [Domain]
The normal behavior should list uptime for each domain when there is no parameters.
Maybe I'm confused, but the current code seems not to do that even if you change option parsing spec. Is there part of your patch missing ?
No, the last argument of SWITCH_FOREACH_OPT indicates how many argument is required.
With this simple patch I can do:
42sh> xl uptime
Name ID Uptime
Domain-0 0 12:25:52
Signature · 1 line
Julien Grall
Ian Jackson
Acked-byJulien Grall writes ("Re: [PATCH] tools/libx: xl uptime doesn't require argument"):
Quoted 4 lines · Ian Jackson
Quoted 3 lines
Julien Grall writes ("[PATCH]
tools/libx: xl uptime doesn't require argument"):Quoted 2 lines
The normal behavior should list uptime for each domain when there is no parameters.
...
Quoted 7 lines
No, the last argument of
SWITCH_FOREACH_OPTindicates how many argument is required.With this simple patch I can do:
42sh> xl uptime
Name ID Uptime
Domain-0 0 12:25:52
Oh wait I see the "nb_domains==0" case in print_uptime. Foolish me for expecting xl's logic to have any kind of rationale.
And added to my backport list.
Ian.
Ian Jackson writes ("Re: [PATCH] tools/libx: xl uptime doesn't require argument"):
Quoted 9 lines
Julien Grall writes ("Re: [PATCH]
tools/libx: xl uptime doesn't require argument"):Quoted 7 lines
No, the last argument of
SWITCH_FOREACH_OPTindicates how many argument is required.With this simple patch I can do:
42sh> xl uptime
Name ID Uptime
Domain-0 0 12:25:52
Quoted 7 lines
Oh wait I see the "nb_domains==0" case in
print_uptime. Foolish me for expecting xl's logic to have any kind of rationale.Acked-by Ian Jackson <[email protected]>Committed-by Ian Jackson <[email protected]>And added to my backport list.
This applied cleanly to 4.3.
But it didn't apply cleanly to 4.2 and the code there is somewhat different so I wasn't sure just fixing up the textual changes would be sufficient. I would be inclined not to backport it to 4.2 unless someone thinks this fix is important and would like to prepare a tested backport.
Thanks,
Ian.