summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@intel.com>2013-04-10 09:58:38 +0300
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2013-04-19 16:25:55 +0300
commit820afe7f0a0becd21c7355b5b4e55278ab06ec47 (patch)
tree5d5167aa9d0f444150dd0856920220c85baa2ef9
parentc7329ed7abb7754182c6fcd75ff81e73f61dc90d (diff)
downloadmic-820afe7f0a0becd21c7355b5b4e55278ab06ec47.tar.gz
mic-820afe7f0a0becd21c7355b5b4e55278ab06ec47.tar.bz2
mic-820afe7f0a0becd21c7355b5b4e55278ab06ec47.zip
gpt_parser: add backup partition table reading support
Change-Id: I6c1aeda0b54dc5f3e4b3c1bfe69b4d005231c1e0 Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
-rw-r--r--mic/utils/gpt_parser.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/mic/utils/gpt_parser.py b/mic/utils/gpt_parser.py
index 02bf24f..22fad54 100644
--- a/mic/utils/gpt_parser.py
+++ b/mic/utils/gpt_parser.py
@@ -150,7 +150,7 @@ class GptParser:
raw_hdr[12], # 11. Size of a single partition entry
raw_hdr[13]) # 12. CRC32 of partition array
- def get_partitions(self):
+ def get_partitions(self, primary = True):
""" This is a generator which parses teh GPT partition table and
generates the following tupes for each partition:
@@ -158,9 +158,13 @@ class GptParser:
Attribute flags, Partition name)
This tuple corresponds to the GPT partition record format. Please, see the
- UEFI standard for the description of these fields. """
+ UEFI standard for the description of these fields.
- header = self.read_header()
+ If the 'primary' parameter is 'True', partitions from the primary GPT
+ partition table are generated, otherwise partitions from the backup GPT
+ partition table are generated. """
+
+ header = self.read_header(primary)
entries_start = header[9] * self.sector_size
entries_count = header[10]