From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 6633D1FF56B for ; Mon, 22 Apr 2024 13:39:07 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 47809F4B2; Mon, 22 Apr 2024 13:39:12 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Mon, 22 Apr 2024 13:38:34 +0200 Message-Id: <20240422113834.842169-5-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240422113834.842169-1-f.gruenbichler@proxmox.com> References: <20240422110505.2052480-1-d.csapak@proxmox.com> <20240422113834.842169-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.055 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 4/4] GC status: reduce code duplication X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" dGhlIHNjaGVkdWxlIGhhbmRsaW5nIGlzIHRoZSBzYW1lIHdoZXRoZXIgdGhlcmUgd2FzIGEgbGFz dCBydW4gb3Igbm90LCBzbyBsZXQncwpkbyBpdCBvbmNlIGFuZCBub3Qgd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5vbmU7Ci0gICAg ICAgICAgICBpZiBsZXQgU29tZShzdGF0ZSkgPSBzdGF0ZV9maWxlIHsKLSAgICAgICAgICAgICAg ICBpZiBsZXQgT2soY3MpID0gY29tcHV0ZV9zY2hlZHVsZV9zdGF0dXMoJnN0YXRlLCBTb21lKCZ1 cGlkKSkgewotICAgICAgICAgICAgICAgICAgICBjb21wdXRlZF9zY2hlZHVsZSA9IGNzOwotICAg ICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0KLQotICAgICAgICAgICAgaWYgbGV0IFNvbWUo ZW5kdGltZSkgPSBjb21wdXRlZF9zY2hlZHVsZS5sYXN0X3J1bl9lbmR0aW1lIHsKLSAgICAgICAg ICAgICAgICBjb21wdXRlZF9zY2hlZHVsZS5uZXh0X3J1biA9IGluZm8KLSAgICAgICAgICAgICAg ICAgICAgLnNjaGVkdWxlCi0gICAgICAgICAgICAgICAgICAgIC5hc19yZWYoKQotICAgICAgICAg ICAgICAgICAgICAuYW5kX3RoZW4ofHN8IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIHMucGFy c2U6OjxDYWxlbmRhckV2ZW50PigpCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgLm1hcF9l cnIofGVycnwgbG9nOjplcnJvciEoIntlcnJ9IikpCi0gICAgICAgICAgICAgICAgICAgICAgICAg ICAgLm9rKCkKLSAgICAgICAgICAgICAgICAgICAgfSkKLSAgICAgICAgICAgICAgICAgICAgLmFu ZF90aGVuKHxlfCB7Ci0gICAgICAgICAgICAgICAgICAgICAgICBlLmNvbXB1dGVfbmV4dF9ldmVu dChlbmR0aW1lKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5tYXBfZXJyKHxlcnJ8IGxv Zzo6ZXJyb3IhKCJ7ZXJyfSIpKQotICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5vaygpCi0g ICAgICAgICAgICAgICAgICAgIH0pCi0gICAgICAgICAgICAgICAgICAgIC5hbmRfdGhlbih8bmV8 IG5lKTs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UgPT4gewotICAgICAgICAgICAgaWYg bGV0IFNvbWUoc2NoZWR1bGUpID0gJmluZm8uc2NoZWR1bGUgewotICAgICAgICAgICAgICAgIGlu Zm8ubmV4dF9ydW4gPSBzY2hlZHVsZQotICAgICAgICAgICAgICAgICAgICAucGFyc2U6OjxDYWxl bmRhckV2ZW50PigpCi0gICAgICAgICAgICAgICAgICAgIC5tYXBfZXJyKHxlcnJ8IGxvZzo6ZXJy b3IhKCJ7ZXJyfSIpKQotICAgICAgICAgICAgICAgICAgICAub2soKQotICAgICAgICAgICAgICAg ICAgICAuYW5kX3RoZW4ofGV8IHsKLSAgICAgICAgICAgICAgICAgICAgICAgIGUuY29tcHV0ZV9u ZXh0X2V2ZW50KHByb3htb3hfdGltZTo6ZXBvY2hfaTY0KCkpCi0gICAgICAgICAgICAgICAgICAg ICAgICAgICAgLm1hcF9lcnIofGVycnwgbG9nOjplcnJvciEoIntlcnJ9IikpCi0gICAgICAgICAg ICAgICAgICAgICAgICAgICAgLm9rKCkKLSAgICAgICAgICAgICAgICAgICAgfSkKLSAgICAgICAg ICAgICAgICAgICAgLmFuZF90aGVuKHxuZXwgbmUpOwogCi0gICAgICAgICAgICAgICAgaWYgbGV0 IE9rKGV2ZW50KSA9IHNjaGVkdWxlLnBhcnNlOjo8Q2FsZW5kYXJFdmVudD4oKSB7Ci0gICAgICAg ICAgICAgICAgICAgIGlmIGxldCBPayhuZXh0X2V2ZW50KSA9IGV2ZW50LmNvbXB1dGVfbmV4dF9l dmVudChwcm94bW94X3RpbWU6OmVwb2NoX2k2NCgpKSB7Ci0gICAgICAgICAgICAgICAgICAgICAg ICBpbmZvLm5leHRfcnVuID0gbmV4dF9ldmVudDsKLSAgICAgICAgICAgICAgICAgICAgfQotICAg ICAgICAgICAgICAgIH0KLSAgICAgICAgICAgIH0gZWxzZSB7Ci0gICAgICAgICAgICAgICAgcmV0 dXJuIE9rKGluZm8pOworICAgICAgICBpZiBsZXQgU29tZShlbmR0aW1lKSA9IGNvbXB1dGVkX3Nj aGVkdWxlLmxhc3RfcnVuX2VuZHRpbWUgeworICAgICAgICAgICAgbGFzdCA9IGVuZHRpbWU7Cisg ICAgICAgICAgICBpZiBsZXQgT2socGFyc2VkX3VwaWQpID0gdXBpZC5wYXJzZTo6PFVQSUQ+KCkg eworICAgICAgICAgICAgICAgIGluZm8uZHVyYXRpb24gPSBTb21lKGVuZHRpbWUgLSBwYXJzZWRf dXBpZC5zdGFydHRpbWUpOwogICAgICAgICAgICAgfQogICAgICAgICB9CisKKyAgICAgICAgaW5m by5uZXh0X3J1biA9IGNvbXB1dGVkX3NjaGVkdWxlLm5leHRfcnVuOworICAgICAgICBpbmZvLmxh c3RfcnVuX2VuZHRpbWUgPSBjb21wdXRlZF9zY2hlZHVsZS5sYXN0X3J1bl9lbmR0aW1lOworICAg ICAgICBpbmZvLmxhc3RfcnVuX3N0YXRlID0gY29tcHV0ZWRfc2NoZWR1bGUubGFzdF9ydW5fc3Rh dGU7CiAgICAgfQogCisgICAgaW5mby5uZXh0X3J1biA9IGluZm8KKyAgICAgICAgLnNjaGVkdWxl CisgICAgICAgIC5hc19yZWYoKQorICAgICAgICAuYW5kX3RoZW4ofHN8IHsKKyAgICAgICAgICAg IHMucGFyc2U6OjxDYWxlbmRhckV2ZW50PigpCisgICAgICAgICAgICAgICAgLm1hcF9lcnIofGVy cnwgbG9nOjplcnJvciEoIntlcnJ9IikpCisgICAgICAgICAgICAgICAgLm9rKCkKKyAgICAgICAg fSkKKyAgICAgICAgLmFuZF90aGVuKHxlfCB7CisgICAgICAgICAgICBlLmNvbXB1dGVfbmV4dF9l dmVudChsYXN0KQorICAgICAgICAgICAgICAgIC5tYXBfZXJyKHxlcnJ8IGxvZzo6ZXJyb3IhKCJ7 ZXJyfSIpKQorICAgICAgICAgICAgICAgIC5vaygpCisgICAgICAgIH0pCisgICAgICAgIC5hbmRf dGhlbih8bmV8IG5lKTsKKworICAgIGluZm8uc3RhdHVzID0gc3RhdHVzX2luX21lbW9yeTsKKwog ICAgIE9rKGluZm8pCiB9CiAKLS0gCjIuMzkuMgoKCgpfX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fXwpwYnMtZGV2ZWwgbWFpbGluZyBsaXN0CnBicy1kZXZlbEBs aXN0cy5wcm94bW94LmNvbQpodHRwczovL2xpc3RzLnByb3htb3guY29tL2NnaS1iaW4vbWFpbG1h bi9saXN0aW5mby9wYnMtZGV2ZWwK