From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0527CCDB471 for ; Fri, 19 Jun 2026 13:05:44 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1342198.1602409 (Exim 4.92) (envelope-from ) id 1waYuI-0000VO-V3; Fri, 19 Jun 2026 13:05:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1342198.1602409; Fri, 19 Jun 2026 13:05:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1waYuI-0000VE-PY; Fri, 19 Jun 2026 13:05:14 +0000 Received: by outflank-mailman (input) for mailman id 1342198; Fri, 19 Jun 2026 13:05:14 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1waYuI-0000SM-4c for xen-devel@lists.xenproject.org; Fri, 19 Jun 2026 13:05:14 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1waYuH-00D4ah-Hk for xen-devel@lists.xenproject.org; Fri, 19 Jun 2026 15:05:13 +0200 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a353e84-2eae-0a2a0a5409dd-0a2a4501e918-36 for ; Fri, 19 Jun 2026 15:05:13 +0200 Received: from [209.85.167.44] (helo=mail-lf1-f44.google.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.0) (envelope-from ) id 6a353e89-e031-0a2a45010019-d155a72cb5df-3 for ; Fri, 19 Jun 2026 15:05:13 +0200 Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-5aa7a7ad475so2320038e87.1 for ; Fri, 19 Jun 2026 06:05:13 -0700 (PDT) Received: from localhost.localdomain (8.17.6.51.dyn.plus.net. [51.6.17.8]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4650bc428d9sm7960088f8f.27.2026.06.19.06.05.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2026 06:05:11 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781874313; x=1782479113; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eks+QTXUKxWGNd1IHclIX8XrRU2no0CF3MdEPRLJw+0=; b=CUF82vpzrIRaM67u6h/5yG19LfjFrnadlta1l82k8XXooMzgV3Tyt4pGdZjwck2t0e 2lZCLPFSlAr2bz/wq3JqMWAYryFBx6oINnacAI0+Il+N/WruN9m8t5uIrmuf7sPU5gg8 YVLCY+AU5MkkqerwbgwF925MqeZQgmF7yUQsGibOcgfwgGG0OHjhvKXM7YJPiMvCzmnl WHh7sVrsCsqBpQktlAsv3CYKhwcb1ZrZ8qNU04zy1O2RfB+aKC76er34383ZQEkUJrv6 LeDtxQj4xeydGj40cy7nEtn+wniPPjCJkYQ+ogikbGG12ANsesbgiuQnQ0ZerUcaduOF SQuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781874313; x=1782479113; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eks+QTXUKxWGNd1IHclIX8XrRU2no0CF3MdEPRLJw+0=; b=a1ouH964rDB7CN1Gjt6QXsmPiuQcNFGnOS+3scoJWFvND3VbnJtlXu2zzmE7VyGZ06 jkBAe3oBnr6UyhAY/8R6BM+KUrMt/Pp39crwVSH7S6QCLalCdmyYRE6e/EZK8nvjlyXI 31wh398mjjS8zKsswc+qreyAosMsHUJjvW8+swNa52PTwqo/UxEfElALMxGmlouvHTla xUTFLIOEgW/bL2SQf9SorZQA5eKyEAP7lx2ImQnKqZrH5bfQmO070HZPD6IW0Ew5tvI8 QbUzLyyYRTNTih1MFhazx9XsDabk4RwPSA+EgonhQDboFv0Ke/BsqEAqgjn0zq/fMTXe /NMA== X-Gm-Message-State: AOJu0YzZ6JEbR8m7TILparin0QXlX3z7QpfoKqZemHsfMqqeGZMrMfgn mBVh4Dt9srwLbnYoYgF3lVa03dEdH79XYSq3RWGfxfp8SwW4dQNjMUnDLhraELMRLR4= X-Gm-Gg: AfdE7ckahCQg7bXZRvMvyYZCgCNrBbpezLBMD5iw2YDYD0g3XYrXuy2fVbtRNwgg1ex DKea+KNbKXFLTtldzNXoFnWdNCMCB02N+oilvpkx/cI3FQ6MbimxK9N6PvKgl11qGS9dGkXAX/L Mzmr/FKklwtpVj3MDM4LL7eE4VAW85JLC34lVapCwJK6uzlh9l5FHARp8aOygwg/bo/GnUZxAMf T+QVeCTyXTrvvXdngEefTrvJH0BuxZ6nj4rdXE/AQdabDe3nbawgHmn0aHb8lZ1e1m4mgjnn8IQ FQOMGpWQjJ+ioOJluEOZsCxwOj2hT7W/jI4DGsCiOISYxzFSfjaEqQZawrVp9YQrGZpYY/sOIQY tXGG46rxq2uaW5B+6lg9zY+sGTU7CrHvphiJO7m9i0USokghoe2kSYUr2v1md4yP4Nt5dWqB2OP vzEn91u9syntj5dWGQXeEyt0Dhl5Qq9/X51Gu9Eu0oADmEGWV+KI3r2Z2vM/kaWlsOBs0Kd8VxM Acq+eG0 X-Received: by 2002:a05:6512:3a93:b0:5ad:4cd2:9baa with SMTP id 2adb3069b0e04-5ad58f32ea5mr705257e87.27.1781874312427; Fri, 19 Jun 2026 06:05:12 -0700 (PDT) From: Frediano Ziglio X-Google-Original-From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Anthony PERARD , Juergen Gross Subject: [PATCH v6 01/16] libs/guest: Reduce number of parts in write_split_record Date: Fri, 19 Jun 2026 14:04:46 +0100 Message-ID: <20260619130501.272832-2-frediano.ziglio@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260619130501.272832-1-frediano.ziglio@citrix.com> References: <20260619130501.272832-1-frediano.ziglio@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-purgate-ID: tlsNG-d62444/1781874313-4B3A8E30-43106F80/0/0 X-purgate-type: clean X-purgate-size: 1825 Small optimization. There's no much sense to split the header in 2 pieces, it will just take more time and space to reassemble them in the final buffer. This also avoids truncating combined_length to 32 bit in case of 64 bit machines potentially avoiding following record_length check (it could still be truncated writing it in xc_sr_rhdr structure but the following check will catch it). The function become more coherent with following read_record function. Signed-off-by: Frediano Ziglio Reviewed-by: Roger Pau Monné -- Changes since v2: - change prefix in subject. Changes since v3: - clarify commit message. Changes since v4: - added Reviewed-by; - improved commit message. --- tools/libs/guest/xg_sr_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/libs/guest/xg_sr_common.c b/tools/libs/guest/xg_sr_common.c index c7b3c6f3bc..9b2782b5cf 100644 --- a/tools/libs/guest/xg_sr_common.c +++ b/tools/libs/guest/xg_sr_common.c @@ -59,11 +59,11 @@ int write_split_record(struct xc_sr_context *ctx, struct xc_sr_record *rec, static const char zeroes[REC_ALIGN] = {}; xc_interface *xch = ctx->xch; - typeof(rec->length) combined_length = rec->length + sz; + size_t combined_length = rec->length + sz; size_t record_length = ROUNDUP(combined_length, REC_ALIGN); + struct xc_sr_rhdr rhdr = { rec->type, combined_length }; struct iovec parts[] = { - { &rec->type, sizeof(rec->type) }, - { &combined_length, sizeof(combined_length) }, + { &rhdr, sizeof(rhdr) }, { rec->data, rec->length }, { buf, sz }, { (void *)zeroes, record_length - combined_length }, -- 2.43.0