IDEDeviceFactory factory;
try {
factory = IDEDriverUtils.getIDEDeviceFactory();
} catch (NamingException ex) {
throw new DriverException(ex);
}
log.debug("Creating partition table object on " + dev.getId());
this.pt = factory.createIBMPartitionTable(bs, dev);
log.debug("Created partition table object");
int partIndex = 0;
int i = 0;
for (IBMPartitionTableEntry pte : pt) {
log.debug("Processing partition " + i);
if (pte == null) {
BootLogInstance.get().warn("PartitionTableEntry #" + i + " is null");
} else if (pte.isValid()) {
log.debug("Partition " + i + " is valid");
registerPartition(devMan, dev, pte, partIndex);
}
partIndex++;
i++;
}
if (!pt.getExtendedPartitions().isEmpty()) {
// Create partition devices for the extended partition
log.debug("Extended");
partIndex = registerExtendedPartition(devMan, dev, partIndex);
}
} catch (DeviceAlreadyRegisteredException ex) {
log.error("Partition device is already known");
throw new DriverException("Partition device is already known???? Probably a bug", ex);
} catch (IOException ex) {
log.error("Cannot read partition table", ex);
throw new DriverException("Cannot read partition table", ex);
} catch (NameNotFoundException ex) {
log.error("Cannot find DeviceManager", ex);
throw new DriverException("Cannot find DeviceManager", ex);
} catch (Throwable ex) {
log.error("Unknown error", ex);
throw new DriverException("Unknown error", ex);
}
}