- self.signature, \
- self.revision, \
- self.size, \
- self.header_crc32, \
- self.current_lba, \
- self.backup_lba, \
- self.first_usable_lba, \
- self.last_usable_lba, \
- self.uuid, \
- self.part_entry_start, \
- self.part_count, \
- self.part_entry_size, \
- self.part_crc32
- )
-
- def show(self):
- print "Signature: %s" % self.signature
- print "Revision: %r" % self.revision
- print "Header Size: %d" % self.size
- print "CRC32: %d" % self.header_crc32
- print "Current LBA: %d" % self.current_lba
- print "Backup LBA: %d" % self.backup_lba
- print "First Usable LBA: %d" % self.first_usable_lba
- print "Last Usable LBA: %d" % self.last_usable_lba
- print "Disk GUID: %s" % uuid.UUID(bytes=self.uuid)
- print "Partition entries starting LBA: %d" % self.part_entry_start
- print "Number of Partition entries: %d" % self.part_count
- print "Size of a partition entry: %d" % self.part_entry_size
- print "CRC32 of partition array: %s" % self.part_crc32
+ self.signature,
+ self.revision,
+ self.hdr_size,
+ self.header_crc32,
+ self.current_lba,
+ self.backup_lba,
+ self.first_usable_lba,
+ self.last_usable_lba,
+ self.uuid,
+ self.part_entry_start,
+ self.part_count,
+ self.part_entry_size,
+ self.part_crc32)
+
+ @staticmethod
+ def size():
+ """Returns the size of a GPT Header."""
+ return struct.calcsize(GPTPartitionTable.GPTHeader.format)
+
+ def __str__(self):
+ return "Signature: %s\n" % self.signature + \
+ "Revision: %r\n" % self.revision + \
+ "Header Size: %d\n" % self.hdr_size + \
+ "CRC32: %d\n" % self.header_crc32 + \
+ "Current LBA: %d\n" % self.current_lba + \
+ "Backup LBA: %d\n" % self.backup_lba + \
+ "First Usable LBA: %d\n" % self.first_usable_lba + \
+ "Last Usable LBA: %d\n" % self.last_usable_lba + \
+ "Disk GUID: %s\n" % uuid.UUID(bytes=self.uuid) + \
+ "Partition entries starting LBA: %d\n" % \
+ self.part_entry_start + \
+ "Number of Partition entries: %d\n" % self.part_count + \
+ "Size of a partition entry: %d\n" % self.part_entry_size + \
+ "CRC32 of partition array: %s\n" % self.part_crc32