From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH 1/7] kvm tools: Print version when running 'kvm --version' Date: Fri, 12 Aug 2011 18:47:19 +0300 Message-ID: <1313164039.3651.5.camel@lappy> References: <1313162460-14397-1-git-send-email-levinsasha928@gmail.com> <20110812152240.GA20279@walimis-desktop> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: penberg@kernel.org, kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com To: walimis Return-path: Received: from mail-wy0-f174.google.com ([74.125.82.174]:64529 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753865Ab1HLPsV (ORCPT ); Fri, 12 Aug 2011 11:48:21 -0400 Received: by wyg24 with SMTP id 24so2239040wyg.19 for ; Fri, 12 Aug 2011 08:48:20 -0700 (PDT) In-Reply-To: <20110812152240.GA20279@walimis-desktop> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, 2011-08-12 at 23:22 +0800, walimis wrote: > On Fri, Aug 12, 2011 at 06:20:54PM +0300, Sasha Levin wrote: > >Signed-off-by: Sasha Levin > >--- > > tools/kvm/kvm-cmd.c | 1 + > > 1 files changed, 1 insertions(+), 0 deletions(-) > > > >diff --git a/tools/kvm/kvm-cmd.c b/tools/kvm/kvm-cmd.c > >index e85f22f..3a90d6d 100644 > >--- a/tools/kvm/kvm-cmd.c > >+++ b/tools/kvm/kvm-cmd.c > >@@ -24,6 +24,7 @@ struct cmd_struct kvm_commands[] = { > > { "balloon", kvm_cmd_balloon, NULL, 0 }, > > { "list", kvm_cmd_list, NULL, 0 }, > > { "version", kvm_cmd_version, NULL, 0 }, > >+ { "--version", kvm_cmd_version, NULL, 0 }, > Although it works, I think it's not good way to implement a option > as a command. Since kvm tools isn't going to support options to 'kvm' itself, I believe that even though it looks somewhat hacky, it's the simplest and most correct solution. If we were going to add more parameters besides '--version' then yes, let's write a better interface. Perf for example allow '--version' by doing a strcmp() before command parsing, which is equally not that nice :) -- Sasha.