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

Re: [PATCH v2 4/5] xen/version: Fold build_id handling into xenver_varbuf_op()


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 16 Jan 2023 17:14:13 +0100
  • 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=Z7zYV21ojY15fFTvj1ZVQOWr87Qa26P2o9uzlTRqVDo=; b=N2Raiu0Fn+nNiI0hlOowWaign0rPbBJSUH7+2IsvxU7ayebPD5hnXYypUXtbEoCFFYzx7r7KgDretgcXyIWfENqWvXZtzWwFuq/Gl5rJ8rOft0w69tI1ZIZEOj3fmsb9aQXAdZPG6kKDRvZrJBYppq6+bR/kFuO3HoCZHsZycfXtW3T8p36Pu3F1yrkadr/3zYxliRpIJ8ofrTLyv19VSlMEOWpr5x+QC7eIR5aq3KqFpBXfixwzngQJ7o1bLuja9aPSWfUtWcmk6uwJMTn4mpX/1wzc6pfmAn6BhkEaX/WBkiBXfjTN+HinWQlEVpZe5XAkZTaggyWuozOrdI0m+Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i2noB8WQxL9a2dzbSDE8DSEXpqRUh4MDlNSf5bdbjYYFWJgiJxq8/QWffIbtJ4cnIVF3tWflyj8DHD9hFTQV/EmLOQMW+Dwh7PPyFTlM/YJmSyxqIjyDxLeJ/5N0crRMaRfD87b9HDYBjleVeiL4dgzLRWDLAvQRLopjx6EaE+rJX0nGrRaJqABBQyYNJqlyiyjfiNomQ4n/1crIj1fihZ32W+dvh7jR+MU79MpZd7h6VkyULUUVnx92M6CgMDGzxcdNxGHSec8uMf/wiqHLYV5Hx1XpXA+f7SyzAho/l+c/2ph+3i/NkJ8+BitvQ4hyT+j5mFKBqK9h8ZNNLj492g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 16 Jan 2023 16:14:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.01.2023 00:08, Andrew Cooper wrote:
> struct xen_build_id and struct xen_varbuf are identical from an ABI point of
> view, so XENVER_build_id can reuse xenver_varbuf_op() rather than having it's
> own almost identical copy of the logic.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
albeit with a style related question plus remark:

> --- a/xen/common/kernel.c
> +++ b/xen/common/kernel.c
> @@ -476,9 +476,22 @@ static long xenver_varbuf_op(int cmd, 
> XEN_GUEST_HANDLE_PARAM(void) arg)
>      struct xen_varbuf user_str;
>      const char *str = NULL;
>      size_t sz;
> +    int rc;

Why is this declared here, yet ...

>      switch ( cmd )
>      {
> +    case XENVER_build_id:
> +    {
> +        unsigned int local_sz;

... this declared here? Both could live in switch()'s scope, allowing
for re-use in other case blocks, but making clear that the values are
unavailable outside of the switch().

> +        rc = xen_build_id((const void **)&str, &local_sz);
> +        if ( rc )
> +            return rc;
> +
> +        sz = local_sz;
> +        goto have_len;

Personally I certainly dislike "goto" in general, and I thought the
common grounds were to permit its use in error handling (only).

Jan



 


Rackspace

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