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

Re: [PATCH v3 12/14 RESEND] xenpm: Factor out a non-fatal cpuid_parse variant


  • To: Jason Andryuk <jandryuk@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 8 May 2023 14:01:37 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P7kDkVV1bON4Xwcn4ICUJBwyjXPzXnP6fiusd2Z9+aw=; b=nJ/361o3DZ4/3/6cvgrK5KxP5u8FdeInQcwIor1wsN9gbajlogh3XPN+UnUN6zQciqV5O+rt98EgY016UaKQ1lC5PeGPrqLm4YHSxf0dyYVnZZqZFi3RToId/hZAZKQozRKku/7ASV09IgCR+ra40M2yy5CUwcSpJBUfN6NPXYMiz6a2DxLE+p9O7jwtgUunWFkakhFcwAolqPaGQVL/ThuSwy3jCBnVjPVi+5jNYdVXYYpMMR6fCl/qQKIQEpNxqXBqMFR0QS/CpNAhUT45Sk5S8wM01q5cQ0LglfC5Ppfn6PMrrj0XcnB27/sBP+yqfqYnSmqWErT9WEzuPL8nQA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MToV/TB1E+2uBMoQPaO2FQBZJb76tbKhqNA3SdYF0HJtpLYPL4U9OyMilRtRBx39kMI/1F36YPrDuPmQpbZCOU9ql5ClF1CTnLbDhGvbIKZ3Cci2Nynv4Sofy/B85sZrRv6mxTHEDf+5EQ6LR6hlHn3jHSRMa54vdVY8QxKCKQlG8BR37udykFO+Gaw1SnVA4CGAqD11KaCVITa1xZVJQuSrrkcT0n9FVoJSg79DZAmlKSASvh/JvIdynmnxJRxO6PNQln8WjGcb33IIuGJs+kjVFxvxFEKe7Cb/4+ZJyoBwcCfAG2YlO2hDZM/MNUPd0nUhZvWr7v3z5047hBwQ8A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 08 May 2023 12:02:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 01.05.2023 21:30, Jason Andryuk wrote:
> Allow cpuid_parse to be re-used without terminating xenpm.  HWP will
> re-use it to optionally parse a cpuid.  Unlike other uses of
> cpuid_parse, parse_hwp_opts will take a variable number of arguments and
> cannot just check argc.
> 
> Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx>
> ---
> v2:
> Retained because cpuid_parse handles numeric cpu numbers and "all".

Assuming you can convince me of retaining this patch:

> --- a/tools/misc/xenpm.c
> +++ b/tools/misc/xenpm.c
> @@ -79,17 +79,26 @@ void help_func(int argc, char *argv[])
>      show_help();
>  }
>  
> -static void parse_cpuid(const char *arg, int *cpuid)
> +static int parse_cpuid_non_fatal(const char *arg, int *cpuid)
>  {
>      if ( sscanf(arg, "%d", cpuid) != 1 || *cpuid < 0 )
>      {
>          if ( strcasecmp(arg, "all") )
> -        {
> -            fprintf(stderr, "Invalid CPU identifier: '%s'\n", arg);
> -            exit(EINVAL);
> -        }
> +            return -1;
> +
>          *cpuid = -1;
>      }
> +
> +    return 0;
> +}

Looks like this function wants to return bool?

Jan



 


Rackspace

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