On Tue, Apr 16, 2024 at 10:15:44AM +0100, Fouad Hilly wrote:
> Refactor xen-ucode tool by adding usage() to handle usage\help messages
> As we add more command options this will keep help\usage messages in common block
>
> [v2]
> 1- Improved message description.
> 2- Fixed formatting and indentation.
> 3- Error message to print to stderr.
>
> Signed-off-by: Fouad Hilly <fouad.hilly@cloud.com>
> ---
> tools/misc/xen-ucode.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/tools/misc/xen-ucode.c b/tools/misc/xen-ucode.c
> index c6ae6498d659..0c0b2337b4ea 100644
> --- a/tools/misc/xen-ucode.c
> +++ b/tools/misc/xen-ucode.c
> @@ -17,6 +17,15 @@ static xc_interface *xch;
> static const char intel_id[] = "GenuineIntel";
> static const char amd_id[] = "AuthenticAMD";
>
> +static void usage(const char *name)
> +{
> + printf("%s: Xen microcode updating tool\n"
> + "Usage: %s [microcode file] [options]\n"
> + "Options:\n"
> + "show-cou-info show CPU information and exit\n",
Don't change the usage message just yet. It still is
"Usage: %s [<microcode file> | show-cpu-info]"
The current one mean we can run one of:
./xen-ucode ucode.bin
./xen-ucode show-cpu-info
The proposed help message in this patch mean we could have one of:
./xen-ucode ucode.bin
./xen-ucode show-cpu-info
./xen-ucode ucode.bin show-cpu-info
But that last one is an error.
Thanks,
--
Anthony PERARD