From 666a3b525f13998c17c5937219d948d72ea9d5cf Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Thu, 11 Apr 2013 12:17:15 +0300 Subject: [PATCH] gpt_parser: add 'primary' dictionary key Add another key to the GPT header and parition record dictionaries to indicate whether it belongs to the primary or to the backup parition. Change-Id: I0292badb61cf279a0fd9ac8c1f5bad47c05c1537 Signed-off-by: Artem Bityutskiy --- mic/utils/gpt_parser.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mic/utils/gpt_parser.py b/mic/utils/gpt_parser.py index 03e3aa3..4f7efa3 100644 --- a/mic/utils/gpt_parser.py +++ b/mic/utils/gpt_parser.py @@ -135,6 +135,8 @@ class GptParser: 'parts_cnt' : number of partition entries 'entry_size' : size of a single partition entry 'ptable_crc' : CRC32 of the partition table + 'primary' : a boolean, if 'True', this is the primary GPT header, + if 'False' - the secondary This dictionary corresponds to the GPT header format. Please, see the UEFI standard for the description of these fields. @@ -164,7 +166,8 @@ class GptParser: 'ptable_lba' : raw_hdr[10], 'parts_cnt' : raw_hdr[11], 'entry_size' : raw_hdr[12], - 'ptable_crc' : raw_hdr[13] } + 'ptable_crc' : raw_hdr[13], + 'primary' : primary } def get_partitions(self, primary = True): """ This is a generator which parses the GPT partition table and @@ -177,6 +180,8 @@ class GptParser: 'last_lba' : the last LBA 'flags' : attribute flags 'name' : partition name + 'primary' : a boolean, if 'True', this is the primary partition + table, if 'False' - the secondary This dictionary corresponds to the GPT header format. Please, see the UEFI standard for the description of these fields. @@ -208,4 +213,5 @@ class GptParser: 'first_lba' : entry[2], 'last_lba' : entry[3], 'flags' : entry[4], - 'name' : part_name } + 'name' : part_name, + 'primary' : primary } -- 2.7.4