diff options
author | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2013-04-11 12:17:15 +0300 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2013-04-19 16:27:40 +0300 |
commit | 666a3b525f13998c17c5937219d948d72ea9d5cf (patch) | |
tree | e51564dba1215360f9f40f896b76b06c2f32d307 | |
parent | 3a2d3b3783032dfeded216653e55cda2237b23fd (diff) | |
download | mic-666a3b525f13998c17c5937219d948d72ea9d5cf.tar.gz mic-666a3b525f13998c17c5937219d948d72ea9d5cf.tar.bz2 mic-666a3b525f13998c17c5937219d948d72ea9d5cf.zip |
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 <artem.bityutskiy@intel.com>
-rw-r--r-- | mic/utils/gpt_parser.py | 10 |
1 files 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 } |