All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/libx: xl uptime doesn't require argument
@ 2013-12-19 16:45 Julien Grall
  2013-12-19 16:54 ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Julien Grall @ 2013-12-19 16:45 UTC (permalink / raw)
  To: xen-devel; +Cc: Julien Grall, ian.jackson, ian.campbell, patches

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.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 tools/libxl/xl_cmdimpl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 078f7a7..dce2699 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -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;
-- 
1.7.10.4

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

* Re: [PATCH] tools/libx: xl uptime doesn't require argument
  2013-12-19 16:45 [PATCH] tools/libx: xl uptime doesn't require argument Julien Grall
@ 2013-12-19 16:54 ` Ian Jackson
  2013-12-19 17:04   ` Julien Grall
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Jackson @ 2013-12-19 16:54 UTC (permalink / raw)
  To: Julien Grall; +Cc: xen-devel, ian.campbell, patches

Julien Grall writes ("[PATCH] 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.

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.

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

* Re: [PATCH] tools/libx: xl uptime doesn't require argument
  2013-12-19 16:54 ` Ian Jackson
@ 2013-12-19 17:04   ` Julien Grall
  2013-12-19 17:12     ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Julien Grall @ 2013-12-19 17:04 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel, ian.campbell, patches

On 12/19/2013 04:54 PM, Ian Jackson wrote:
> Julien Grall writes ("[PATCH] 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.
> 
> 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

-- 
Julien Grall

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

* Re: [PATCH] tools/libx: xl uptime doesn't require argument
  2013-12-19 17:04   ` Julien Grall
@ 2013-12-19 17:12     ` Ian Jackson
  2014-01-09 14:53       ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Jackson @ 2013-12-19 17:12 UTC (permalink / raw)
  To: Julien Grall; +Cc: xen-devel, ian.campbell, patches

Julien Grall writes ("Re: [PATCH] tools/libx: xl uptime doesn't require argument"):
> On 12/19/2013 04:54 PM, Ian Jackson wrote:
> > Julien Grall writes ("[PATCH] tools/libx: xl uptime doesn't require argument"):
> >> The normal behavior should list uptime for each domain when there is no
> >> parameters.
...
> 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

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 <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

And added to my backport list.

Ian.

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

* Re: [PATCH] tools/libx: xl uptime doesn't require argument
  2013-12-19 17:12     ` Ian Jackson
@ 2014-01-09 14:53       ` Ian Jackson
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Jackson @ 2014-01-09 14:53 UTC (permalink / raw)
  To: Julien Grall, xen-devel, patches, ian.campbell

Ian Jackson writes ("Re: [PATCH] tools/libx: xl uptime doesn't require argument"):
> Julien Grall writes ("Re: [PATCH] tools/libx: xl uptime doesn't require argument"):
> > 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
> 
> 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 <ian.jackson@eu.citrix.com>
> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
> 
> 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.

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

end of thread, other threads:[~2014-01-09 14:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-19 16:45 [PATCH] tools/libx: xl uptime doesn't require argument Julien Grall
2013-12-19 16:54 ` Ian Jackson
2013-12-19 17:04   ` Julien Grall
2013-12-19 17:12     ` Ian Jackson
2014-01-09 14:53       ` Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.