From a398d2c2b5fd6ab0545d8bb019f9a970b2309404 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 21:16:34 +0200 Subject: Adding upstream version 3.6. Signed-off-by: Daniel Baumann --- tests/gpt-attrs | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 tests/gpt-attrs (limited to 'tests/gpt-attrs') diff --git a/tests/gpt-attrs b/tests/gpt-attrs new file mode 100755 index 0000000..0a01447 --- /dev/null +++ b/tests/gpt-attrs @@ -0,0 +1,72 @@ +#!/usr/bin/python3 + +# Copyright (C) 2021 SUSE LLC + +# program to show gpt partition attributes or set attributes of +# partition 1 + +# only works with 512 sectors and standard GPT header layout (128 +# partition entires with 128 bytes each, secondary header at end of +# device) + + +from struct import unpack_from, pack_into +from zipfile import crc32 +import array +import sys + + +class Gpt: + + # Calculate and insert the CRCs of the partition entires and the + # header. + def calc_crcs(self, header, entries): + # compute crc of partition entries + crc2 = crc32(entries) & 0xFFFFFFFF + pack_into('