Beispiel #1
0
 def dump(self):
   print "BootBlock(%d):" % self.blk_num
   print " dos_type:  0x%08x %s (valid: %s) is_ffs=%s is_intl=%s is_dircache=%s" \
     % (self.dos_type, DosType.num_to_tag_str(self.dos_type), 
        self.valid_dos_type, 
        DosType.is_ffs(self.dos_type), 
        DosType.is_intl(self.dos_type),
        DosType.is_dircache(self.dos_type))
   print " root_blk:  %d (got %d)" % (self.calc_root_blk, self.got_root_blk)
   print " chksum:    0x%08x (got) 0x%08x (calc) -> bootable: %s" % (self.got_chksum, self.calc_chksum, self.valid_chksum)
   print " valid:     %s" % self.valid
   if self.boot_code != None:
       print " boot_code: %d bytes" % len(self.boot_code)
Beispiel #2
0
 def get_info(self, total_blks=0):
     """return a string line with typical info about this partition"""
     p = self.part_blk
     de = p.dos_env
     name = "'%s'" % p.drv_name
     part_blks = self.get_num_blocks()
     part_bytes = self.get_num_bytes()
     extra = ""
     if total_blks != 0:
         ratio = 100.0 * part_blks / total_blks
         extra += "%6.2f%%  " % ratio
     # add dos type
     dos_type = de.dos_type
     extra += DosType.num_to_tag_str(dos_type)
     extra += "/0x%04x" % dos_type
     # max transfer
     extra += " max_transfer=0x%x" % de.max_transfer
     extra += " mask=0x%x" % de.mask
     extra += " num_buffer=%d" % de.num_buffer
     # add flags
     flags = p.flags
     if flags & PartitionBlock.FLAG_BOOTABLE == PartitionBlock.FLAG_BOOTABLE:
         extra += " bootable pri=%d" % de.boot_pri
     if flags & PartitionBlock.FLAG_NO_AUTOMOUNT == PartitionBlock.FLAG_NO_AUTOMOUNT:
         extra += " no_automount"
     return "Partition: #%d %-06s %8d %8d  %10d  %s  %s" \
       % (self.num, name, de.low_cyl, de.high_cyl, part_blks, ByteSize.to_byte_size_str(part_bytes), extra)
Beispiel #3
0
 def dump(self):
     print("DosEnv")
     print(" size:           %d" % self.size)
     print(" block_size:     %d" % self.block_size)
     print(" sec_org:        %d" % self.sec_org)
     print(" surfaces:       %d" % self.surfaces)
     print(" sec_per_blk:    %d" % self.sec_per_blk)
     print(" blk_per_trk:    %d" % self.blk_per_trk)
     print(" reserved:       %d" % self.reserved)
     print(" pre_alloc:      %d" % self.pre_alloc)
     print(" interleave:     %d" % self.interleave)
     print(" low_cyl:        %d" % self.low_cyl)
     print(" high_cyl:       %d" % self.high_cyl)
     print(" num_buffer:     %d" % self.num_buffer)
     print(" buf_mem_type:   0x%08x" % self.buf_mem_type)
     print(" max_transfer:   0x%08x" % self.max_transfer)
     print(" mask:           0x%08x" % self.mask)
     print(" boot_pri:       %d" % self.boot_pri)
     print(
         " dos_type:       0x%08x = %s"
         % (self.dos_type, DosType.num_to_tag_str(self.dos_type))
     )
     print(" baud:           %d" % self.baud)
     print(" control:        %d" % self.control)
     print(" boot_blocks:    %d" % self.boot_blocks)
Beispiel #4
0
 def __init__(self, block_scan, log):
     self.log = log
     self.block_scan = block_scan
     self.root_di = None
     self.intl = DosType.is_intl(block_scan.dos_type)
     self.files = []
     self.dirs = []
Beispiel #5
0
 def __init__(self, block_scan, log):
     self.log = log
     self.block_scan = block_scan
     self.root_di = None
     self.intl = DosType.is_intl(block_scan.dos_type)
     self.files = []
     self.dirs = []
 def get_info(self, total_blks=0):
   """return a string line with typical info about this partition"""
   p = self.part_blk
   de = p.dos_env
   name = "'%s'" % p.drv_name
   part_blks = self.get_num_blocks()
   part_bytes = self.get_num_bytes()
   extra = ""
   if total_blks != 0:
     ratio = 100.0 * part_blks / total_blks
     extra += "%6.2f%%  " % ratio
   # add dos type
   dos_type = de.dos_type
   extra += DosType.num_to_tag_str(dos_type)
   extra += "/0x%04x" % dos_type
   # max transfer
   extra += " max_transfer=0x%x" % de.max_transfer
   extra += " mask=0x%x" % de.mask
   extra += " num_buffer=%d" % de.num_buffer
   # add flags
   flags = p.flags
   if flags & PartitionBlock.FLAG_BOOTABLE == PartitionBlock.FLAG_BOOTABLE:
     extra += " bootable pri=%d" % de.boot_pri
   if flags & PartitionBlock.FLAG_NO_AUTOMOUNT == PartitionBlock.FLAG_NO_AUTOMOUNT:
     extra += " no_automount"
   return "Partition: #%d %-06s %8d %8d  %10d  %s  %s" \
     % (self.num, name, de.low_cyl, de.high_cyl, part_blks, ByteSize.to_byte_size_str(part_bytes), extra)
Beispiel #7
0
 def get_info(self):
     flags = self.get_flags_info()
     dt = self.fshd.dos_type
     dt_str = DosType.num_to_tag_str(dt)
     return "FileSystem #%d %s/0x%04x version=%s size=%d %s" % (
         self.num, dt_str, dt, self.fshd.get_version_string(), len(
             self.data), flags)
Beispiel #8
0
  def dump(self):
    Block.dump(self, "FSHeader")

    print(" size:           %d" % self.size)
    print(" host_id:        %d" % self.host_id)
    print(" next:           %s" % self._dump_ptr(self.next))
    print(" flags:          0x%08x" % self.flags)
    print(" dos_type:       0x%08x = %s" % (self.dos_type, DosType.num_to_tag_str(self.dos_type)))
    print(" version:        0x%08x = %s" % (self.version, self.get_version_string()))
    print(" patch_flags:    0x%08x" % self.patch_flags)

    self.dev_node.dump()
  def dump(self):
    Block.dump(self, "FSHeader")

    print " size:           %d" % self.size
    print " host_id:        %d" % self.host_id
    print " next:           %s" % self._dump_ptr(self.next)
    print " flags:          0x%08x" % self.flags
    print " dos_type:       0x%08x = %s" % (self.dos_type, DosType.num_to_tag_str(self.dos_type))
    print " version:        0x%08x = %s" % (self.version, self.get_version_string())
    print " patch_flags:    0x%08x" % self.patch_flags

    self.dev_node.dump()
Beispiel #10
0
 def get_info(self, total_blks=0):
     """return a string line with typical info about this partition"""
     p = self.part_blk
     de = p.dos_env
     name = "'%s'" % p.drv_name
     part_blks = self.get_num_blocks()
     part_bytes = self.get_num_bytes()
     extra = ""
     if total_blks != 0:
         ratio = 100.0 * part_blks / total_blks
         extra += "%6.2f%%  " % ratio
     # add dos type
     dos_type = de.dos_type
     extra += DosType.num_to_tag_str(dos_type)
     extra += "/0x%04x" % dos_type
     return "Partition: #%d %-06s %8d %8d  %10d  %s  %s" \
       % (self.num, name, de.low_cyl, de.high_cyl, part_blks, ByteSize.to_byte_size_str(part_bytes), extra)
Beispiel #11
0
 def get_info(self, total_blks=0):
   """return a string line with typical info about this partition"""
   p = self.part_blk
   de = p.dos_env
   name = "'%s'" % p.drv_name
   part_blks = self.get_num_blocks()
   part_bytes = self.get_num_bytes()
   extra = ""
   if total_blks != 0:
     ratio = 100.0 * part_blks / total_blks
     extra += "%6.2f%%  " % ratio
   # add dos type
   dos_type = de.dos_type
   extra += DosType.num_to_tag_str(dos_type)
   extra += "/0x%04x" % dos_type
   return "Partition: #%d %-06s %8d %8d  %10d  %s  %s" \
     % (self.num, name, de.low_cyl, de.high_cyl, part_blks, ByteSize.to_byte_size_str(part_bytes), extra)
Beispiel #12
0
 def init_vol(self, blkdev):
     vol = ADFSVolume(blkdev)
     n = len(self.opts)
     if n < 1 or n > 2:
         print "Usage: format <volume_name> [dos_type]"
         return None
     else:
         if n > 1:
             dos_str = self.opts[1]
             dos_type = DosType.parse_dos_type_str(dos_str)
             if dos_type is None:
                 print "ERROR invalid dos_tpye:", dos_str
                 return None
         else:
             dos_type = None
         vol_name = make_fsstr(self.opts[0])
         vol.create(vol_name, dos_type=dos_type)
         return vol
Beispiel #13
0
 def init_vol(self, blkdev):
   vol = ADFSVolume(blkdev)
   n = len(self.opts)
   if n < 1 or n > 2:
     print("Usage: format <volume_name> [dos_type]")
     return None
   else:
     if n > 1:
       dos_str = self.opts[1]
       dos_type = DosType.parse_dos_type_str(dos_str)
       if dos_type is None:
         print("ERROR invalid dos_tpye:", dos_str)
         return None
     else:
       dos_type = None
     vol_name = make_fsstr(self.opts[0])
     vol.create(vol_name, dos_type=dos_type)
     return vol
Beispiel #14
0
 def scan_boot(self):
   """Step 1: scan boot block.
      Returns (True, x) if boot block has a valid dos type.
      Returns (x, True) if boot block is bootable
      Invalid checksum of the block is tolerated but remarked.
   """
   # check boot block
   boot = BootBlock(self.blkdev)
   boot.read()
   if boot.valid:
     # dos type is valid
     self.boot = boot
     self.dos_type = boot.dos_type
     # give a warning if checksum is not correct
     if not boot.valid_chksum:
       self.log.msg(Log.INFO,"invalid boot block checksum",0)
     self.log.msg(Log.INFO,"dos type is '%s'" % DosType.get_dos_type_str(self.dos_type))
     return (True, boot.valid_chksum)
   else:
     self.log.msg(Log.ERROR,"invalid boot block dos type",0)
     return (False, False)
 def scan_boot(self):
   """Step 1: scan boot block.
      Returns (True, x) if boot block has a valid dos type.
      Returns (x, True) if boot block is bootable
      Invalid checksum of the block is tolerated but remarked.
   """
   # check boot block
   boot = BootBlock(self.blkdev)
   boot.read()
   if boot.valid:
     # dos type is valid
     self.boot = boot
     self.dos_type = boot.dos_type
     # give a warning if checksum is not correct
     if not boot.valid_chksum:
       self.log.msg(Log.INFO,"invalid boot block checksum",0)
     self.log.msg(Log.INFO,"dos type is '%s'" % DosType.get_dos_type_str(self.dos_type))
     return (True, boot.valid_chksum)
   else:
     self.log.msg(Log.ERROR,"invalid boot block dos type",0)
     return (False, False)
 def dump(self):
   print "DosEnv"
   print " size:           %d" % self.size
   print " block_size:     %d" % self.block_size
   print " sec_org:        %d" % self.sec_org
   print " surfaces:       %d" % self.surfaces
   print " sec_per_blk:    %d" % self.sec_per_blk
   print " blk_per_trk:    %d" % self.blk_per_trk
   print " reserved:       %d" % self.reserved
   print " pre_alloc:      %d" % self.pre_alloc
   print " interleave:     %d" % self.interleave
   print " low_cyl:        %d" % self.low_cyl
   print " high_cyl:       %d" % self.high_cyl
   print " num_buffer:     %d" % self.num_buffer
   print " buf_mem_type:   0x%08x" % self.buf_mem_type
   print " max_transfer:   0x%08x" % self.max_transfer
   print " mask:           0x%08x" % self.mask
   print " boot_pri:       %d" % self.boot_pri
   print " dos_type:       0x%08x = %s" % (self.dos_type, DosType.num_to_tag_str(self.dos_type))
   print " baud:           %d" % self.baud
   print " control:        %d" % self.control
   print " boot_blocks:    %d" % self.boot_blocks
 def dump(self):
   print("DosEnv")
   print(" size:           %d" % self.size)
   print(" block_size:     %d" % self.block_size)
   print(" sec_org:        %d" % self.sec_org)
   print(" surfaces:       %d" % self.surfaces)
   print(" sec_per_blk:    %d" % self.sec_per_blk)
   print(" blk_per_trk:    %d" % self.blk_per_trk)
   print(" reserved:       %d" % self.reserved)
   print(" pre_alloc:      %d" % self.pre_alloc)
   print(" interleave:     %d" % self.interleave)
   print(" low_cyl:        %d" % self.low_cyl)
   print(" high_cyl:       %d" % self.high_cyl)
   print(" num_buffer:     %d" % self.num_buffer)
   print(" buf_mem_type:   0x%08x" % self.buf_mem_type)
   print(" max_transfer:   0x%08x" % self.max_transfer)
   print(" mask:           0x%08x" % self.mask)
   print(" boot_pri:       %d" % self.boot_pri)
   print(" dos_type:       0x%08x = %s" % (self.dos_type, DosType.num_to_tag_str(self.dos_type)))
   print(" baud:           %d" % self.baud)
   print(" control:        %d" % self.control)
   print(" boot_blocks:    %d" % self.boot_blocks)
Beispiel #18
0
 def dump(self):
     print "DosEnv"
     print " size:           %d" % self.size
     print " block_size:     %d" % self.block_size
     print " sec_org:        %d" % self.sec_org
     print " surfaces:       %d" % self.surfaces
     print " sec_per_blk:    %d" % self.sec_per_blk
     print " blk_per_trk:    %d" % self.blk_per_trk
     print " reserved:       %d" % self.reserved
     print " pre_alloc:      %d" % self.pre_alloc
     print " interleave:     %d" % self.interleave
     print " low_cyl:        %d" % self.low_cyl
     print " high_cyl:       %d" % self.high_cyl
     print " num_buffer:     %d" % self.num_buffer
     print " buf_mem_type:   0x%08x" % self.buf_mem_type
     print " max_tramsfer:   0x%08x" % self.max_transfer
     print " mask:           0x%08x" % self.mask
     print " boot_pri:       %d" % self.boot_pri
     print " dos_type:       0x%08x = %s" % (
         self.dos_type, DosType.num_to_tag_str(self.dos_type))
     print " baud:           %d" % self.baud
     print " control:        %d" % self.control
     print " boot_blocks:    %d" % self.boot_blocks
Beispiel #19
0
 def __init__(self, args, opts):
     Command.__init__(self, args, opts, edit=True)
     self.imager = Imager()
     n = len(self.opts)
     if n == 0:
         print "Usage: pack <in_path> [dos_type] [out_size]"
         self.exit_code = 1
     else:
         self.in_path = self.opts[0]
         blkdev_opts = None
         dos_type = None
         if n > 1:
             # is a dostype given?
             dos_str = opts[1]
             dos_type = DosType.parse_dos_type_str(dos_str)
             if dos_type is not None:
                 begin = 2
             else:
                 begin = 1
             # take remainder as blkdev opts
             blkdev_opts = KeyValue.parse_key_value_strings(opts[begin:])
         self.blkdev_opts = blkdev_opts
         self.dos_type = dos_type
         self.imager.pack_begin(self.in_path)
Beispiel #20
0
  def read(self):
    self._read_data()
    # read extra boot blocks
    self.extra_blks = []
    for i in xrange(self.num_extra):
      b = Block(self.blkdev, self.blk_num + 1 + i)
      b._read_data()
      self.extra_blks.append(b)
      
    self.dos_type = self._get_long(0)
    self.got_chksum = self._get_long(1)
    self.got_root_blk = self._get_long(2)
    self.calc_chksum = self._calc_chksum()
    # calc position of root block
    self.calc_root_blk = int(self.blkdev.num_blocks / 2)
    # check validity
    self.valid_chksum = self.got_chksum == self.calc_chksum
    self.valid_dos_type = DosType.is_valid(self.dos_type)
    self.valid = self.valid_dos_type

    # look for boot_code
    if self.valid:
      self.read_boot_code()
    return self.valid
Beispiel #21
0
 def __init__(self, args, opts):
   Command.__init__(self, args, opts, edit=True)
   self.imager = Imager()
   n = len(self.opts)
   if n == 0:
     print("Usage: pack <in_path> [dos_type] [out_size]")
     self.exit_code = 1
   else:
     self.in_path = self.opts[0]
     blkdev_opts = None
     dos_type = None
     if n > 1:
       # is a dostype given?
       dos_str = opts[1]
       dos_type = DosType.parse_dos_type_str(dos_str)
       if dos_type is not None:
         begin = 2
       else:
         begin = 1
       # take remainder as blkdev opts
       blkdev_opts = KeyValue.parse_key_value_strings(opts[begin:])
     self.blkdev_opts = blkdev_opts
     self.dos_type = dos_type
     self.imager.pack_begin(self.in_path)
Beispiel #22
0
 def get_info(self):
   flags = self.get_flags_info()
   dt = self.fshd.dos_type
   dt_str = DosType.num_to_tag_str(dt)
   return "FileSystem #%d %s/0x%04x version=%s size=%d %s" % (self.num, dt_str, dt, self.fshd.get_version_string(), len(self.data), flags)
Beispiel #23
0
 def get_info(self):
   flags = self.get_flags_info()
   return "FileSystem #%d %s version=%s size=%d %s" % (self.num, DosType.num_to_tag_str(self.fshd.dos_type), self.fshd.get_version_string(), len(self.data), flags)
Beispiel #24
0
 def get_info(self):
     flags = self.get_flags_info()
     return "FileSystem #%d %s version=%s size=%d %s" % (
         self.num, DosType.num_to_tag_str(self.fshd.dos_type),
         self.fshd.get_version_string(), len(self.data), flags)
 def __init__(self, block_scan, log, dos_type):
   self.block_scan = block_scan
   self.log = log
   self.dos_type = dos_type
   self.ffs = DosType.is_ffs(self.dos_type)
   self.infos = []
 def read_block(self, blk_num, is_bm=False, is_bm_ext=False):
   """read block from device, decode it, and return block info instance"""
   try:
     # read block from device
     if is_bm:
       blk = BitmapBlock(self.blkdev, blk_num)
     elif is_bm_ext:
       blk = BitmapExtBlock(self.blkdev, blk_num)
     else:
       blk = Block(self.blkdev, blk_num)
     blk.read()
     data = blk.data
     # create block info
     bi = BlockInfo(blk_num)
     # --- classify block ---
     if blk.valid:
       # block is valid AmigaDOS
       bi.blk_status = self.BS_VALID
       # --- bitmap block ---
       if is_bm:
         bi.blk_type = self.BT_BITMAP
         bi.blk_status = self.BS_TYPE
         bi.bitmap = blk.get_bitmap_data()
       # --- bitmap ext block ---
       elif is_bm_ext:
         bi.blk_type = self.BT_BITMAP_EXT
         bi.blk_status = self.BS_TYPE
         bi.bitmap_ptrs = blk.bitmap_ptrs
         bi.next_blk = blk.bitmap_ext_blk
       # --- root block ---
       elif blk.is_root_block():
         bi.blk_type = self.BT_ROOT
         bi.blk_status = self.BS_TYPE
         root = RootBlock(self.blkdev, blk_num)
         root.set(data)
         bi.name = FSString(root.name)
         bi.hash_table = root.hash_table
         bi.parent_blk = 0
         self.log.msg(Log.DEBUG, "Found Root: '%s'" % bi.name, blk_num)
         # chech hash size
         nht = len(root.hash_table)
         if root.hash_size != nht:
           self.log.msg(Log.ERROR, "Root block hash table size mismatch", blk_num)
         eht = self.blkdev.block_longs - 56
         if nht != eht:
           self.log.msg(Log.WARN, "Root block does not have normal hash size: %d != %d" % (nht, eht), blk_num)
       # --- user dir block ---
       elif blk.is_user_dir_block():
         bi.blk_type = self.BT_DIR
         bi.blk_status = self.BS_TYPE
         user = UserDirBlock(self.blkdev, blk_num, DosType.is_longname(self.dos_type))
         user.set(data)
         bi.name = FSString(user.name)
         bi.parent_blk = user.parent
         bi.next_blk = user.hash_chain
         bi.hash_table = user.hash_table
         bi.own_key = user.own_key
         self.log.msg(Log.DEBUG, "Found Dir : '%s'" % bi.name, blk_num)
       # --- filter header block ---
       elif blk.is_file_header_block():
         bi.blk_type = self.BT_FILE_HDR
         bi.blk_status = self.BS_TYPE
         fh = FileHeaderBlock(self.blkdev, blk_num, DosType.is_longname(self.dos_type))
         fh.set(data)
         bi.name = FSString(fh.name)
         bi.parent_blk = fh.parent
         bi.next_blk = fh.hash_chain
         bi.own_key = fh.own_key
         bi.byte_size = fh.byte_size
         bi.data_blocks = fh.data_blocks
         bi.extension = fh.extension
         self.log.msg(Log.DEBUG, "Found File: '%s'" % bi.name, blk_num)
       # --- file list block ---
       elif blk.is_file_list_block():
         bi.blk_type = self.BT_FILE_LIST
         fl = FileListBlock(self.blkdev, blk_num)
         fl.set(data)
         bi.blk_status = self.BS_TYPE
         bi.ext_blk = fl.extension
         bi.blk_list = fl.data_blocks
         bi.own_key = fl.own_key
         bi.data_blocks = fl.data_blocks
         bi.extension = fl.extension
         bi.parent_blk = fl.parent
       # --- file data block (OFS) ---
       elif blk.is_file_data_block():
         bi.blk_type = self.BT_FILE_DATA
         bi.blk_status = self.BS_TYPE
         fd = FileDataBlock(self.blkdev, blk_num)
         fd.set(data)
         bi.data_size = fd.data_size
         bi.hdr_key = fd.hdr_key
         bi.seq_num = fd.seq_num
       elif blk.is_comment_block():
         bi.blk_type = self.BT_COMMENT
         bi.blk_status = self.BS_TYPE
         cblk = CommentBlock(self.blkdev, blk_num)
         bi.hdr_key = cblk.hdr_key
         bi.own_key = cblk.own_key
             
   except IOError as e:
     self.log.msg(Log.ERROR, "Can't read block", blk_num)
     bi = BlockInfo(blk_num)
     bi.blk_status = BS_READ_ERROR
     
   # sort block info into map and arrays assigned by status/type
   self.block_map[blk_num] = bi
   self.map_status[bi.blk_status].append(bi)
   self.map_type[bi.blk_type].append(bi)
   return bi
Beispiel #27
0
 def __init__(self, block_scan, log, dos_type):
   self.block_scan = block_scan
   self.log = log
   self.dos_type = dos_type
   self.ffs = DosType.is_ffs(self.dos_type)
   self.infos = []
Beispiel #28
0
    def read_block(self, blk_num, is_bm=False, is_bm_ext=False):
        """read block from device, decode it, and return block info instance"""
        try:
            # read block from device
            if is_bm:
                blk = BitmapBlock(self.blkdev, blk_num)
            elif is_bm_ext:
                blk = BitmapExtBlock(self.blkdev, blk_num)
            else:
                blk = Block(self.blkdev, blk_num)
            blk.read()
            data = blk.data
            # create block info
            bi = BlockInfo(blk_num)
            # --- classify block ---
            if blk.valid:
                # block is valid AmigaDOS
                bi.blk_status = self.BS_VALID
                # --- bitmap block ---
                if is_bm:
                    bi.blk_type = self.BT_BITMAP
                    bi.blk_status = self.BS_TYPE
                    bi.bitmap = blk.get_bitmap_data()
                # --- bitmap ext block ---
                elif is_bm_ext:
                    bi.blk_type = self.BT_BITMAP_EXT
                    bi.blk_status = self.BS_TYPE
                    bi.bitmap_ptrs = blk.bitmap_ptrs
                    bi.next_blk = blk.bitmap_ext_blk
                # --- root block ---
                elif blk.is_root_block():
                    bi.blk_type = self.BT_ROOT
                    bi.blk_status = self.BS_TYPE
                    root = RootBlock(self.blkdev, blk_num)
                    root.set(data)
                    bi.name = root.name
                    bi.hash_table = root.hash_table
                    bi.parent_blk = 0
                    self.log.msg(Log.DEBUG, "Found Root: '%s'" % bi.name,
                                 blk_num)
                    # chech hash size
                    nht = len(root.hash_table)
                    if root.hash_size != nht:
                        self.log.msg(Log.ERROR,
                                     "Root block hash table size mismatch",
                                     blk_num)
                    eht = self.blkdev.block_longs - 56
                    if nht != eht:
                        self.log.msg(
                            Log.WARN,
                            "Root block does not have normal hash size: %d != %d"
                            % (nht, eht),
                            blk_num,
                        )
                # --- user dir block ---
                elif blk.is_user_dir_block():
                    bi.blk_type = self.BT_DIR
                    bi.blk_status = self.BS_TYPE
                    user = UserDirBlock(self.blkdev, blk_num,
                                        DosType.is_longname(self.dos_type))
                    user.set(data)
                    bi.name = user.name
                    bi.parent_blk = user.parent
                    bi.next_blk = user.hash_chain
                    bi.hash_table = user.hash_table
                    bi.own_key = user.own_key
                    self.log.msg(Log.DEBUG, "Found Dir : '%s'" % bi.name,
                                 blk_num)
                # --- filter header block ---
                elif blk.is_file_header_block():
                    bi.blk_type = self.BT_FILE_HDR
                    bi.blk_status = self.BS_TYPE
                    fh = FileHeaderBlock(self.blkdev, blk_num,
                                         DosType.is_longname(self.dos_type))
                    fh.set(data)
                    bi.name = fh.name
                    bi.parent_blk = fh.parent
                    bi.next_blk = fh.hash_chain
                    bi.own_key = fh.own_key
                    bi.byte_size = fh.byte_size
                    bi.data_blocks = fh.data_blocks
                    bi.extension = fh.extension
                    self.log.msg(Log.DEBUG, "Found File: '%s'" % bi.name,
                                 blk_num)
                # --- file list block ---
                elif blk.is_file_list_block():
                    bi.blk_type = self.BT_FILE_LIST
                    fl = FileListBlock(self.blkdev, blk_num)
                    fl.set(data)
                    bi.blk_status = self.BS_TYPE
                    bi.ext_blk = fl.extension
                    bi.blk_list = fl.data_blocks
                    bi.own_key = fl.own_key
                    bi.data_blocks = fl.data_blocks
                    bi.extension = fl.extension
                    bi.parent_blk = fl.parent
                # --- file data block (OFS) ---
                elif blk.is_file_data_block():
                    bi.blk_type = self.BT_FILE_DATA
                    bi.blk_status = self.BS_TYPE
                    fd = FileDataBlock(self.blkdev, blk_num)
                    fd.set(data)
                    bi.data_size = fd.data_size
                    bi.hdr_key = fd.hdr_key
                    bi.seq_num = fd.seq_num
                elif blk.is_comment_block():
                    bi.blk_type = self.BT_COMMENT
                    bi.blk_status = self.BS_TYPE
                    cblk = CommentBlock(self.blkdev, blk_num)
                    bi.hdr_key = cblk.hdr_key
                    bi.own_key = cblk.own_key

        except IOError as e:
            self.log.msg(Log.ERROR, "Can't read block", blk_num)
            bi = BlockInfo(blk_num)
            bi.blk_status = BS_READ_ERROR

        # sort block info into map and arrays assigned by status/type
        self.block_map[blk_num] = bi
        self.map_status[bi.blk_status].append(bi)
        self.map_type[bi.blk_type].append(bi)
        return bi