This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] Re: [PATCH] xl: refactor common parts of command line parsin

To: Andre Przywara <andre.przywara@xxxxxxx>
Subject: [Xen-devel] Re: [PATCH] xl: refactor common parts of command line parsing
From: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Date: Fri, 15 Apr 2011 10:36:35 +0100
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Delivery-date: Fri, 15 Apr 2011 02:37:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4DA7F4CE.40009@xxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <4DA7F4CE.40009@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Fri, 2011-04-15 at 08:33 +0100, Andre Przywara wrote:
> Hi,
> xl command options are currently handled in each command's sub function, 
> leading to a lot of duplicate code.
> This patch moves the common part of it into a separate function,
> which handles the help switch, unknown options and an insufficient
> number of parameters. This removes a lot of redundant code.
> Due to the high number of commands this patch is rather large. If that 
> would help reviewers, I could split it up, though this would be rather 
> artificial. Just tell me.
> Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>

Thanks, I bet the diffstat looks awesome!

One thing I noticed is that the def_getopt function doesn't add 'h' to
the optstring, which confused me at first but I see now that you handle
that by handling it in the case where getopt returns '?', clever.

Looks like you also found a few unused options along they way ("n:"
seems to have been cut-and-pasted into a bunch of incorrect places).

Due to the length I've not reviewed in great detail but I think we
should just take this and fix up any fallout as it is discovered.


Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>