Source code for rawdisk.plugins.filesystems.hfs_plus.hfs_plus_volume
# -*- coding: utf-8 -*-
from rawdisk.filesystems.volume import Volume
from rawdisk.util.rawstruct import RawStruct
VOLUME_HEADER_OFFSET = 1024
[docs]class HfsPlusVolume(Volume):
"""Structure for HFS+ volume.
Attributes:
fd (fd): file descriptor used to read volume information
vol_header (VolumeHeader): Initialized :class:`VolumeHeader` object
See Also:
https://developer.apple.com/legacy/library/technotes/tn/tn1150.html
"""
def __init__(self):
self.fd = None
self.vol_header = None
[docs] def load(self, filename, offset):
"""Loads HFS+ volume information"""
try:
self.offset = offset
self.fd = open(filename, 'rb')
# 1024 - temporary, need to find out actual volume header size
self.fd.seek(self.offset + VOLUME_HEADER_OFFSET)
data = self.fd.read(1024)
self.vol_header = VolumeHeader(data)
self.fd.close()
except IOError, e:
print e
def __str__(self):
return "Type: HFS+, Offset: 0x%X" % (
self.offset
)