From patchwork Tue Nov 30 09:10:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hilliard X-Patchwork-Id: 1561464 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20210112 header.b=IQ/a5Lbi; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=oQDRoHB0; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::838; helo=mail-qt1-x838.google.com; envelope-from=swupdate+bncbcl4hcw73qcbbc6vs6gqmgqesfgfg4a@googlegroups.com; receiver=) Received: from mail-qt1-x838.google.com (mail-qt1-x838.google.com [IPv6:2607:f8b0:4864:20::838]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J3GfB50FBz9sVc for ; Tue, 30 Nov 2021 20:10:40 +1100 (AEDT) Received: by mail-qt1-x838.google.com with SMTP id s6-20020a05622a018600b002b2d93b9c73sf26553485qtw.9 for ; Tue, 30 Nov 2021 01:10:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1638263436; cv=pass; d=google.com; s=arc-20160816; b=l7yLYnarpua3kvctkutsrmWD8BWU+en9XpzDiLcJ/G077Q1gMOdDH6wO//eP4j/RRB lOHe4vcSm/YwsstErlxy4zJsIXaGJjEQyBj38aU2ZcFhJYvm/bNYiFWxGNIOVikzUDjw wL2JtF5IKOSLI2R2VQuOah/YACXFs3lCN0GIy87hp+KCMUaRo1DnMS4zdUXt76CMen34 x1g2Yap8RsrShZsRsr1oNz3aDHlwiwt/iTATGLODUQD5TqDqFee15qfKznWy5421HIc1 kGD69Xm3qBGN8WER8y+Nywk/ovcPYbRsWHUYc/CgKuEGGm9WIzzPMBKsrUkIUZvqjAaz T8RA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature:dkim-signature; bh=GjEc2+ezeqYtu6PtyXJtSqgUrJXl0TLbAaQ7CMFGRZw=; b=qGyV74oTQB2hyviXjCMaI+GyKbrJXCduv79BFu0hrfhuIe3N5hKNYiTrxJUztI+Ey2 qKiOPrIVPMjVabGIoR2lfsBMU6FW4+d1ez4k0QjAxHqppCi80m5yRchIMGJyz/aS+Xrn jLtfzutwv2EH31A3Cau6pM8qvKmB9jcs7Ylzcbxsl22zYvHj6wL6B5xp5QbFN/RfqVES jn1/nzykevLqFuVoyDyKL/etua1O/n0S7J3sfL8EJCxts/RCET7NIqqgIhwz6GXEmHe5 C60/FfCipsQY5fhtL/jUfSgHtoATyTdxrtERZMUmmMSEsA9bmOkwXLZERlSPq0dA+Ino RjlQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=e86LV5U4; spf=pass (google.com: domain of james.hilliard1@gmail.com designates 2607:f8b0:4864:20::130 as permitted sender) smtp.mailfrom=james.hilliard1@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=GjEc2+ezeqYtu6PtyXJtSqgUrJXl0TLbAaQ7CMFGRZw=; b=IQ/a5LbiFv+GZ59wFTiD1z2pYLSUA/X9zaTPnsYZdbUXNp1aSe3T9HuAncT5GqqVsZ PJ5AqJMyLx76EQuIu9sRXoLQN7fFHThItFrc1tO+HGPH9rdHPJ7GvO07VOEtkR3cTdxB Clq+M/laFprVBzje1eOOXM5Z+hX19bCV3RZ06Lz7rBrIrlLR98ioVkBAqfAWx4ZTmyGd tlRtzAL6xJAsc4P00VdaDZrvbN4vzueuEpi6UvA4vyPB8ifu9Okx7MJqzkwmMU9t65fY Ye0mmIE546Aw8iDsz46VUU4E1/UjoTdzDQFJvgUIjRprPs6omTf9kJJyJc3Tg6DwZEXB 1X5w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=GjEc2+ezeqYtu6PtyXJtSqgUrJXl0TLbAaQ7CMFGRZw=; b=oQDRoHB0TZz7ih04Vfcz7NAHmF2Zz8zUa4MGO9ifMTJzYoBcYPs9EezSztzR38Kr65 hluZazOC8tFisWXefOrro+DCwzxdEDK86Gd54TAzqLHgQ8q5bLAGEWLG60YuJKa1Zk6T 2xluesMjOj5rPP0v9Ty/cM3cnYsbrZF0pO/Vtf+aIQG4+zn4u5vVUqFSuQy1oKWABByz qjJyyqZdQx1Q9xT3QmSPPplYAmaxf39kk2A+Vbq3A5+TYe9tdAt4oXLBje8tm/BGVfJV 5zturDGD1HKa6W5CGqv/vy6ZYEItXAXG0g6uz8ybcpt/yqUPn6cJekxJnH45ZTjksRRP iZ1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=GjEc2+ezeqYtu6PtyXJtSqgUrJXl0TLbAaQ7CMFGRZw=; b=GBWa6T14CUwvye54VgyZe9FOZ/GjSGtWcUj4ruU01UQr23NmbkAyPuDf6mTZuON+Vm Ro11THs6QHiBBmoZTKsgX/73qw3o16TRkY5z6vzy5Cg+6Xw/vOp53QX3UMoAN+iUFCeU kiDYmks2eu2WtXEeBBMyqIyMXlvi5trVykZXDNDlGMSU5GxBS9zLeYgRW4YE/3+FhX4j UfWv6eCX+87WqklA6APzro4Wj8/1qxcysNaeP7ndp3YCL3IW3CJu75NzVDKxZ3B6jzIL wDa9ieTiFPFbpqj7c737iYcdLdMNNKR/WRfVV5c0C1MIRludrM59VGhIwP1jePpWIpLv N0Jw== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM533l2DL/gO8uySaE5THzoBNA22vOY/JiVIlCTLUbX1GN+PfKo06N 4InYEHUq55QKINOj/MWp2Ss= X-Google-Smtp-Source: ABdhPJwfVIGQtyXWzwNbcPZugln8m2PZtQJHQmLVX5OxKuoLZOVtGWhhEfajKamyK++dW3kBSzHZ+w== X-Received: by 2002:a05:620a:d95:: with SMTP id q21mr42589357qkl.178.1638263435941; Tue, 30 Nov 2021 01:10:35 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:620a:4728:: with SMTP id bs40ls10461771qkb.8.gmail; Tue, 30 Nov 2021 01:10:35 -0800 (PST) X-Received: by 2002:a05:620a:4301:: with SMTP id u1mr44578054qko.134.1638263435577; Tue, 30 Nov 2021 01:10:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1638263435; cv=none; d=google.com; s=arc-20160816; b=hWgo4aYOlB7mJ6j7YJGvFePSCidtcF5p+J7wcJ9nUIAtpCvEzTpmtgyU+EV15Y6yMG AwskO5xUKjhjD50Z7fOaa9P8DX4y/W5oM8zr1/UtazTmWPLSIqPU0DhuHD7x1+n5yvj8 qLx59iDCnZ5r/k8aQbLsRwlMWwfWwCHHH7lZWfR9zmV3OgIdtmhRC/6kK0sEDy+ip004 9DDivHC4Ux7qaqK+h6chXvopJGiqjwkA7DItDdN7gMH44cX1SvVHUkFSpJimRtZhUBD7 RwYuVXcmAJYUxzrMkF/yhpdHygJAugu0rYhzN3wHrwxzqo2EOoACabgzR72SSRp7U3B1 3WIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=P+9mibcSrwziqS63NYnNGnpr6//sp06UQkfnVhI8UrE=; b=JZ3gyoSqKzFRuIiLQi/kWDCMCrKm+IoKnBv4mb0Bfl4+nSPq8sWwmqYlPlMsOB65Vs AODKk3WxvLiZTxXaAkq9F7yJmz5o2n0v47nrwxuBytrgYLaaVn8QRarDsaUqWlk6WOpk 7AhKNk/tMz2k/yd6LBRmz0Xe4v7E56J6+01bdjgUixHah8JfBhVTLTUgCgt2AM5A4bHV LPssiOYIXSqL1XBoESgL/lRZ0e2x3fEJVf5eni6ifblE44KXU5PywRg3RJZjnU5/ECF1 ecltQxJyXnKfLgcNX2GYUAdNFnkkQl0LebDCmTN6iHcjzAB+RLHE8Ji5z6nlvMs2TmoS BdFQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=e86LV5U4; spf=pass (google.com: domain of james.hilliard1@gmail.com designates 2607:f8b0:4864:20::130 as permitted sender) smtp.mailfrom=james.hilliard1@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-il1-x130.google.com (mail-il1-x130.google.com. [2607:f8b0:4864:20::130]) by gmr-mx.google.com with ESMTPS id s4si1147143qtc.4.2021.11.30.01.10.35 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Nov 2021 01:10:35 -0800 (PST) Received-SPF: pass (google.com: domain of james.hilliard1@gmail.com designates 2607:f8b0:4864:20::130 as permitted sender) client-ip=2607:f8b0:4864:20::130; Received: by mail-il1-x130.google.com with SMTP id i9so20458357ilu.1 for ; Tue, 30 Nov 2021 01:10:35 -0800 (PST) X-Received: by 2002:a05:6e02:106c:: with SMTP id q12mr50691375ilj.125.1638263434924; Tue, 30 Nov 2021 01:10:34 -0800 (PST) Received: from MacBook-Pro-2.localdomain (71-33-128-47.hlrn.qwest.net. [71.33.128.47]) by smtp.gmail.com with ESMTPSA id s7sm10249553ilu.29.2021.11.30.01.10.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Nov 2021 01:10:34 -0800 (PST) From: James Hilliard To: swupdate@googlegroups.com Cc: Michael Adler , Christian Storm , James Hilliard Subject: [swupdate] [PATCH 1/1] diskpart_handler: use existing uuid if not explicitely set Date: Tue, 30 Nov 2021 02:10:25 -0700 Message-Id: <20211130091025.93495-1-james.hilliard1@gmail.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 X-Original-Sender: james.hilliard1@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=e86LV5U4; spf=pass (google.com: domain of james.hilliard1@gmail.com designates 2607:f8b0:4864:20::130 as permitted sender) smtp.mailfrom=james.hilliard1@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , When the ability to specifiy a partition UUID was added it also starting enforcing the uuid matches in is_diskpart_different, however in cases where the uuid is not set a new one will be randomly generated. To ensure this doesn't result in a comparison of the partition table being marked as changed due to a different random uuid getting generated, set the UUID based on the existing partition if it exists in cases where one is not specified in the sw-description. Signed-off-by: James Hilliard --- handlers/diskpart_handler.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c index a48f4d2..0e2affb 100644 --- a/handlers/diskpart_handler.c +++ b/handlers/diskpart_handler.c @@ -287,7 +287,8 @@ static int diskpart_get_partitions(struct fdisk_context *cxt, struct diskpart_ta static int diskpart_set_partition(struct fdisk_partition *pa, struct partition_data *part, unsigned long sector_size, - struct fdisk_parttype *parttype) + struct fdisk_parttype *parttype, + struct fdisk_table *oldtb) { int ret; @@ -312,8 +313,16 @@ static int diskpart_set_partition(struct fdisk_partition *pa, if (parttype) ret |= fdisk_partition_set_type(pa, parttype); - if (strlen(part->partuuid)) - ret |= fdisk_partition_set_uuid(pa, part->partuuid); + if (strlen(part->partuuid)) { + ret |= fdisk_partition_set_uuid(pa, part->partuuid); + } else { + struct fdisk_partition *oldpart = fdisk_table_get_partition_by_partno(oldtb, part->partno); + if (oldpart) { + const char *uuid = fdisk_partition_get_uuid(oldpart); + if (uuid) + ret |= fdisk_partition_set_uuid(pa, uuid); + } + } return ret; } @@ -496,7 +505,7 @@ static int diskpart_reload_table(struct fdisk_context *cxt, struct fdisk_table * } static int diskpart_fill_table(struct fdisk_context *cxt, struct diskpart_table *tb, - struct partition_data *part, struct hnd_priv priv) + struct diskpart_table *oldtb, struct partition_data *part, struct hnd_priv priv) { struct fdisk_parttype *parttype; struct fdisk_label *lb; @@ -527,7 +536,7 @@ static int diskpart_fill_table(struct fdisk_context *cxt, struct diskpart_table } else { parttype = fdisk_label_get_parttype_from_code(lb, ustrtoull(part->type, 16)); } - ret = diskpart_set_partition(newpa, part, sector_size, parttype); + ret = diskpart_set_partition(newpa, part, sector_size, parttype, oldtb->parent); if (ret) { WARN("I cannot set all partition's parameters"); } @@ -949,7 +958,7 @@ static int diskpart(struct img_type *img, /* * Fill the new in-memory partition table from the partition list. */ - ret = diskpart_fill_table(cxt, tb, part, priv); + ret = diskpart_fill_table(cxt, tb, oldtb, part, priv); if (ret) goto handler_exit;