define(['DataSegment'], function(DataSegment) {
  
  'use strict';
  
  function getSegmentFromExtents(allocationSegment, chunkSize, type, byteLength, extents) {
    if (byteLength === 0) return new DataSegment.Empty(type);
    if (byteLength <= chunkSize * extents[0].length) {
      return allocationSegment.getSegment(type, chunkSize * extents[0].offset, chunkSize * extents[0].length);
    }
    var list = [], i = 0;
    do {
      if (i > extents.length) throw new Error('insufficient space in extents');
      var offset = chunkSize * extents[i].offset, len = Math.min(byteLength, chunkSize * extents[i].length);
      list.push(allocationSegment.getSegment(allocationSegment.type, offset, len));
      byteLength -= len;
      i++;
    } while (byteLength > 0);
    return DataSegment.from(list, type);
  }
  
  function split(segment, entries) {
    var mdbSegment = segment.getSegment('chunk/mac-hfs; which=master-directory-block', 512 * 2, 512);
    return mdbSegment.getStruct()
    .then(function(masterDirectoryBlock) {
      if (!masterDirectoryBlock.hasValidSignature) {
        return Promise.reject('not an HFS volume');
      }
      entries.add(mdbSegment);
      var allocationType = 'chunk/mac-hfs; which=allocation';
      var allocChunkSize = masterDirectoryBlock.allocationChunkByteLength;
      allocationType += '; chunk=' + allocChunkSize;
      var allocSegment = segment.getSegment(allocationType,
        masterDirectoryBlock.firstAllocationBlock,
        masterDirectoryBlock.allocationChunkCount * masterDirectoryBlock.allocationChunkByteLength);
      entries.add(allocSegment);
      entries.add(getSegmentFromExtents(
        allocSegment,
        allocChunkSize,
        'volume/mac-hfs; part=catalog',
        masterDirectoryBlock.catalogFileByteLength,
        masterDirectoryBlock.catalogFileExtentRecord));
      entries.add(getSegmentFromExtents(
        allocSegment,
        allocChunkSize,
        'volume/mac-hfs; part=overflow',
        masterDirectoryBlock.extentsOverflowFileByteLength,
        masterDirectoryBlock.extentsOverflowFileExtentRecord));
    });
  }
  
  function mount(segment, volume) {
    return segment.split().then(function(parts) {
      var allocation, catalog, overflow, chunkSize;
      for (var i = 0; i < parts.length; i++) {
        if (parts[i].typeName === 'chunk/mac-hfs' && parts[i].getTypeParameter('which') === 'allocation') {
          allocation = parts[i];
          chunkSize = +allocation.getTypeParameter('chunk');
          if (isNaN(chunkSize)) return Promise.reject('chunk parameter must be set on allocation table');
        }
        else if (parts[i].typeName === 'volume/mac-hfs') {
          switch(parts[i].getTypeParameter('part')) {
            case 'catalog': catalog = parts[i]; break;
            case 'overflow': overflow = parts[i]; break;
          }
        }
      }
      if (!(allocation && catalog && overflow)) {
        return Promise.reject('HFS split did not yield allocation, catalog and overflow');
      }
      console.log(allocation, catalog, overflow, chunkSize);
    });
  }
  
  return {
    split: split,
    mount: mount,
  };
  
});

@@ -1698,38 +1698,37 @@
 e,%0A        '
-volume
+chunk
 /mac-hfs
 ; part=catal
@@ -1715,22 +1715,29 @@
 /mac-hfs
-; part
+-btree; which
 =catalog
@@ -1961,14 +1961,21 @@
 -hfs
-; part
+-btree; which
 =ove
@@ -2664,30 +2664,29 @@
 me === '
-volume
+chunk
 /mac-hfs
 ') %7B%0A   
@@ -2677,16 +2677,22 @@
 /mac-hfs
+-btree
 ') %7B%0A   
@@ -2732,20 +2732,21 @@
 ameter('
-part
+which
 ')) %7B%0A  

Change type name to chunk/mac-hfs-btree