All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Andrew Jones <drjones@redhat.com>, kvm@vger.kernel.org
Cc: lvivier@redhat.com, rkrcmar@redhat.com
Subject: Re: [kvm-unit-tests PATCH v2 2/4] powerpc/ppc64: reserve argv[0] for prognam
Date: Fri, 22 Apr 2016 19:24:58 +0200	[thread overview]
Message-ID: <571A5E6A.7020801@redhat.com> (raw)
In-Reply-To: <1461336889-27472-3-git-send-email-drjones@redhat.com>

On 22.04.2016 16:54, Andrew Jones wrote:
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  lib/argv.c            |  4 ----
>  powerpc/emulator.c    |  2 +-
>  powerpc/rtas.c        | 12 ++++++------
>  powerpc/selftest.c    |  8 ++++----
>  powerpc/spapr_hcall.c |  6 +++---
>  5 files changed, 14 insertions(+), 18 deletions(-)
> 
> diff --git a/lib/argv.c b/lib/argv.c
> index 1c6c6a44c836d..c6ad5fcbc8cf4 100644
> --- a/lib/argv.c
> +++ b/lib/argv.c
> @@ -38,13 +38,9 @@ void setup_args(char *args)
>          __args = args;
>          __setup_args();
>  
> -#if defined(__arm__) || defined(__aarch64__)
>          for (int i = __argc; i > 0; --i)
>              __argv[i] = __argv[i-1];
> -#endif
>      }
> -#if defined(__arm__) || defined(__aarch64__)
>      __argv[0] = NULL; //HACK: just reserve argv[0] for now
>      ++__argc;
> -#endif
>  }
> diff --git a/powerpc/emulator.c b/powerpc/emulator.c
> index 3696d839b2f6f..25018a57463b7 100644
> --- a/powerpc/emulator.c
> +++ b/powerpc/emulator.c
> @@ -224,7 +224,7 @@ int main(int argc, char **argv)
>  	handle_exception(0x700, program_check_handler, (void *)&is_invalid);
>  	handle_exception(0x600, alignment_handler, (void *)&alignment);
>  
> -	for (i = 0; i < argc; i++) {
> +	for (i = 1; i < argc; i++) {
>  		if (strcmp(argv[i], "-v") == 0) {
>  			verbose = 1;
>  		}
> diff --git a/powerpc/rtas.c b/powerpc/rtas.c
> index 9d673f0ce8d93..1b1e9c753ef1b 100644
> --- a/powerpc/rtas.c
> +++ b/powerpc/rtas.c
> @@ -115,23 +115,23 @@ int main(int argc, char **argv)
>  
>  	report_prefix_push("rtas");
>  
> -	if (!argc)
> +	if (argc < 2)
>  		report_abort("no test specified");
>  
> -	report_prefix_push(argv[0]);
> +	report_prefix_push(argv[1]);
>  
> -	if (strcmp(argv[0], "get-time-of-day") == 0) {
> +	if (strcmp(argv[1], "get-time-of-day") == 0) {
>  
> -		len = parse_keyval(argv[1], &val);
> +		len = parse_keyval(argv[2], &val);
>  		if (len == -1) {
>  			printf("Missing parameter \"date\"\n");
>  			abort();
>  		}
> -		argv[1][len] = '\0';
> +		argv[2][len] = '\0';
>  
>  		check_get_time_of_day(val);
>  
> -	} else if (strcmp(argv[0], "set-time-of-day") == 0) {
> +	} else if (strcmp(argv[1], "set-time-of-day") == 0) {
>  
>  		check_set_time_of_day();
>  
> diff --git a/powerpc/selftest.c b/powerpc/selftest.c
> index 84867e482d2a2..8c5ff0ac889d4 100644
> --- a/powerpc/selftest.c
> +++ b/powerpc/selftest.c
> @@ -49,14 +49,14 @@ int main(int argc, char **argv)
>  {
>  	report_prefix_push("selftest");
>  
> -	if (!argc)
> +	if (argc < 2)
>  		report_abort("no test specified");
>  
> -	report_prefix_push(argv[0]);
> +	report_prefix_push(argv[1]);
>  
> -	if (strcmp(argv[0], "setup") == 0) {
> +	if (strcmp(argv[1], "setup") == 0) {
>  
> -		check_setup(argc-1, &argv[1]);
> +		check_setup(argc-2, &argv[2]);
>  
>  	}
>  
> diff --git a/powerpc/spapr_hcall.c b/powerpc/spapr_hcall.c
> index dbff63013297b..656aaff61405b 100644
> --- a/powerpc/spapr_hcall.c
> +++ b/powerpc/spapr_hcall.c
> @@ -154,13 +154,13 @@ int main(int argc, char **argv)
>  
>  	report_prefix_push("hypercall");
>  
> -	if (!argc || (argc == 1 && !strcmp(argv[0], "all")))
> +	if (argc < 2 || (argc == 2 && !strcmp(argv[1], "all")))
>  		all = 1;
>  
>  	for (i = 0; hctests[i].name != NULL; i++) {
>  		report_prefix_push(hctests[i].name);
> -		if (all || strcmp(argv[0], hctests[i].name) == 0) {
> -			hctests[i].func(argc, argv);
> +		if (all || strcmp(argv[1], hctests[i].name) == 0) {
> +			hctests[i].func(argc-1, &argv[1]);
>  		}
>  		report_prefix_pop();
>  	}

Reviewed-by: Thomas Huth <thuth@redhat.com>


  reply	other threads:[~2016-04-22 17:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22 14:54 [kvm-unit-tests PATCH v2 0/4] arm/powerpc: make argv[0] the program name Andrew Jones
2016-04-22 14:54 ` [kvm-unit-tests PATCH v2 1/4] arm/arm64: reserve argv[0] for prognam Andrew Jones
2016-04-22 17:23   ` Thomas Huth
2016-04-22 17:36     ` Andrew Jones
2016-04-22 14:54 ` [kvm-unit-tests PATCH v2 2/4] powerpc/ppc64: " Andrew Jones
2016-04-22 17:24   ` Thomas Huth [this message]
2016-04-22 14:54 ` [kvm-unit-tests PATCH v2 3/4] arm/arm64: populate argv[0] with prognam Andrew Jones
2016-04-22 17:48   ` Thomas Huth
2016-04-22 18:05     ` Andrew Jones
2016-04-22 14:54 ` [kvm-unit-tests PATCH v2 4/4] powerpc/ppc64: " Andrew Jones
2016-04-22 17:50   ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=571A5E6A.7020801@redhat.com \
    --to=thuth@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.