[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] tools/xl: Sort create command options


  • To: Elliott Mitchell <ehem+xen@xxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Fri, 29 Apr 2022 10:39:27 +0100
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 29 Apr 2022 09:39:52 +0000
  • Ironport-data: A9a23:MTDrL6qzqn5F3Vx/BHhkLg9e/ZxeBmJkZRIvgKrLsJaIsI4StFCzt garIBmFPayLY2D0KN5wbIjn8kIFuJWHn9EyHgJtqXg2QngX9JuZCYyVIHmrMnLJJKUvbq7GA +byyDXkBJppJpMJjk71atANlVEliefQAOCU5NfsYkidfyc9IMsaoU8lyrdRbrJA24DjWVvR4 4Kq+qUzBXf+s9JKGjNMg068gEsHUMTa4Fv0aXRnOJinFHeH/5UkJMp3yZOZdhMUcaENdgKOf M7RzanRw4/s10xF5uVJMFrMWhZirrb6ZWBig5fNMkSoqkAqSicais7XOBeAAKv+Zvrgc91Zk b1wWZKMpQgBHKncx+dGXkZhCiR5Pb9gxLiafnehiJnGp6HGWyOEL/RGCUg3OcsT+/ptAHEI/ vsdQNwPRknd3aTsmuv9E7QywJR4RCXoFNp3VnVIxDfFDfEgUNbbTr/D/9Nw1zYsnMFeW/3ZY qL1bBIwNEqaOEARZT/7DrocoNm2qF2ibwdGl1GbuvQK01X8/Cp+he2F3N39JYXRGJQ9clyjj n3C13T0BFcdLtP34SqI9Degi/HCmQv/WZkOD/uo+/hymlqRy2cPThoMWjOTrPm0jw2uVtR3L hEMvCEpqMAPGFeDF4enGUfi+Tjd40BaC4E4//AGBB+l6K7EvAXCCzc9VztGaM4AiMhrGjM07 wrc9z/2PgBHvLqQQHOb076bqzKuJCQYRVM/iT84oRgtuIe6/txq5v7bZpM6SfPu0IWpcd3l6 2rSxBXSkYn/miLiO0+T2VncywyhqZHSJuLezlWGBzn1hu+ViWPMWmBJ1bQ5xasYRGp6ZgPY1 JThpyR5xLpTZaxhbATXHI0w8EiBvp5pygH0j191BIUG/D+w4XOldo04yGggeR4wapxdIGSzO RK7VeZtCHl7ZSrCgUhfOd/ZNijX5fK4SYSNug78M7KinaSdhCfYpXozNCZ8LkjmkVQ2kLFXB HtoWZ3EMJruMow+lGDeb75EidcDn3lurUuOFcGT50n2itK2OS/KIYrpxXPTN4jVGovf+16Lm zueXuPXoyhivBrWP3eHrNZPfQxbRZX5bLivw/Fqmie4ClIOMAkc5zX5mOpJl1BN90iNqtr1w w==
  • Ironport-hdrordr: A9a23:EVz1BakhcloPqgbXspYuotM4LNzpDfIs3DAbv31ZSRFFG/Fxl6 iV8sjz8SWE7Ar5OUtQ/OxoV5PsfZqxz/JICMwqTNCftWrdyQmVxeNZjbcKqgeIc0aVygce79 YCT0EXMqyXMbEQt6fHCWeDfOod/A==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Apr 19, 2022 at 06:56:03PM -0700, Elliott Mitchell wrote:
> Hopefully simplify future changes by sorting options lists for
> `xl create`.

I'm not sure that sorting options make changes easier, as it would mean
one has to make sure the new option is sorted as well ;-). But sorting
the options in the help message is probably useful; I've looked at a few
linux utilities and they tend to have them sorted so doing this for xl
create sound fine.

> Signed-off-by: Elliott Mitchell <ehem+xen@xxxxxxx>
> ---
> diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
> index 435155a033..2ec4140258 100644
> --- a/tools/xl/xl_vmcontrol.c
> +++ b/tools/xl/xl_vmcontrol.c
> @@ -1169,13 +1169,13 @@ int main_create(int argc, char **argv)
>      int paused = 0, debug = 0, daemonize = 1, console_autoconnect = 0,
>          quiet = 0, monitor = 1, vnc = 0, vncautopass = 0, ignore_masks = 0;
>      int opt, rc;
> -    static struct option opts[] = {
> +    static const struct option opts[] = {

Could you add a note in the commit message that "opts" is now
const?

> +        {"defconfig", 1, 0, 'f'},
>          {"dryrun", 0, 0, 'n'},
> +        {"ignore-global-affinity-masks", 0, 0, 'i'},
>          {"quiet", 0, 0, 'q'},
> -        {"defconfig", 1, 0, 'f'},
>          {"vncviewer", 0, 0, 'V'},
>          {"vncviewer-autopass", 0, 0, 'A'},
> -        {"ignore-global-affinity-masks", 0, 0, 'i'},
>          COMMON_LONG_OPTS
>      };
>  
> @@ -1186,12 +1186,15 @@ int main_create(int argc, char **argv)
>          argc--; argv++;
>      }
>  
> -    SWITCH_FOREACH_OPT(opt, "Fnqf:pcdeVAi", opts, "create", 0) {
> -    case 'f':
> -        filename = optarg;
> +    SWITCH_FOREACH_OPT(opt, "Ffnq:AVcdeip", opts, "create", 0) {

The list of short options aren't really sorted here. Also -q doesn't
take an argument, but -f should keep requiring one.

Thanks,


-- 
Anthony PERARD



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.