Message ID | 20240416091546.11622-4-fouad.hilly@cloud.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | x86/xen-ucode: Introduce --force option | expand |
On 16.04.2024 11:15, 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. I can't spot any use of stderr in the change here. > --- 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", > + name, name); > +} > + > static void show_curr_cpu(FILE *f) > { > int ret; Without a caller this is going to cause a compiler warning (unused static function) and, with -Werror, a build failure. Jan
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,
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", + name, name); +} + static void show_curr_cpu(FILE *f) { int ret;
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(+)