--- utils/pintos	2005-11-18 23:37:13.000000000 -0500
+++ /home/courses/cs5204/gnusoftware/bin/pintos	2006-01-01 19:35:16.119570400 -0500
@@ -428,7 +428,7 @@
     my ($device, $iface) = @_;
     my ($file) = $disks_by_iface[$iface]{FILENAME};
     if (defined $file) {
-	my (%geom) = disk_geometry ($file);
+	my (%geom) = disk_geometry ($disks_by_iface[$iface]);
 	print BOCHSRC "$device: type=disk, path=$file, mode=flat, ";
 	print BOCHSRC "cylinders=$geom{C}, heads=$geom{H}, spt=$geom{S}, ";
 	print BOCHSRC "translation=none\n";
@@ -503,7 +503,7 @@
 $device.fileName = "$pln"
 EOF
 
-	my (%geom) = disk_geometry ($dsk);
+	my (%geom) = disk_geometry ($disks_by_iface[$i]);
 	open (PLN, ">", $pln) or die "$pln: create: $!\n";
 	print PLN <<EOF;
 DRIVETYPE	ide
@@ -581,12 +581,13 @@
 # Examines $file and returns a valid IDE disk geometry for it, as a
 # hash.
 sub disk_geometry {
-    my ($file) = @_;
+    my ($file) = $_[0]->{FILENAME};
     my ($size) = -s $file;
     die "$file: stat: $!\n" if !defined $size;
     die "$file: size not a multiple of 512 bytes\n" if $size % 512;
     my ($cylinders) = int ($size / (512 * 16 * 63));
     $cylinders++ if $size % (512 * 16 * 63);
+    extend_disk(@_, ($cylinders * 512 * 16 * 63)) if ($size != ($cylinders * 512 * 16 * 63));
 
     return (CAPACITY => $size / 512,
 	    C => $cylinders,
