示例#1
0
文件: MfsAdd.java 项目: krbaker/jmfs
  private void writeRoot(Mfs mfs) throws Exception {
    TivoDisk disk = mfs.getBootDisk();
    MfsHeader mfsHeader = (disk == null) ? null : disk.getMfsHeader();

    if (mfsHeader != null) {
      PartitionEntry pe = mfsHeader.getParent();
      //				Utils.printf( System.out, "Writing MFS header on %s: %s", disk.getName(), mfsHeader );
      Utils.write(Utils.seekBlock(disk, pe.getStartBlock()), mfsHeader);
      long roundedSize = Utils.roundDown(pe.getSizeBlocks(), MfsView.VOLUME_SIZE_ROUNDING);
      Utils.write(Utils.seekBlock(disk, pe.getStartBlock() + roundedSize - 1), mfsHeader);
    }
  }
示例#2
0
文件: MfsAdd.java 项目: krbaker/jmfs
  private AppleDisk findLargestFreeSpace(Mfs mfs) throws Exception {
    // find the disk with largest free space available
    Map<String, TivoDisk> disks = mfs.getDisks();
    TivoDisk largest = null;

    if ((disks == null) || disks.isEmpty())
      throw new Exception("No disks - MFS has not been initialized");

    for (TivoDisk disk : disks.values()) {
      if ((largest == null) || (largest.getAllocatableBlocks() < disk.getAllocatableBlocks()))
        largest = disk;
    }

    return largest;
  }