patch-1.3.81 linux/drivers/scsi/sr.c

Next file: linux/drivers/scsi/st.c
Previous file: linux/drivers/scsi/seagate.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.80/linux/drivers/scsi/sr.c linux/drivers/scsi/sr.c
@@ -1016,8 +1016,10 @@
 	scsi_CDs[i].sector_size = 2048;  /* A guess, just in case */
 	scsi_CDs[i].needs_sector_size = 1;
     } else {
-	scsi_CDs[i].capacity = (buffer[0] << 24) |
-	    (buffer[1] << 16) | (buffer[2] << 8) | buffer[3];
+	scsi_CDs[i].capacity = 1 + ((buffer[0] << 24) |
+				    (buffer[1] << 16) |
+				    (buffer[2] << 8) |
+				    buffer[3]);
 	scsi_CDs[i].sector_size = (buffer[4] << 24) |
 	    (buffer[5] << 16) | (buffer[6] << 8) | buffer[7];
 	switch (scsi_CDs[i].sector_size) {
@@ -1042,7 +1044,7 @@
 			scsi_CDs[i].needs_sector_size = 1;
 	}
 	scsi_CDs[i].needs_sector_size = 0;
-	sr_sizes[i] = scsi_CDs[i].capacity;
+	sr_sizes[i] = scsi_CDs[i].capacity >> (BLOCK_SIZE_BITS - 9);
     };
     scsi_free(buffer, 512);
 }
@@ -1103,7 +1105,7 @@
 	scsi_CDs[i].ten = 1;
 	scsi_CDs[i].remap = 1;
 	scsi_CDs[i].auto_eject = 0; /* Default is not to eject upon unmount. */
-	sr_sizes[i] = scsi_CDs[i].capacity;
+	sr_sizes[i] = scsi_CDs[i].capacity >> (BLOCK_SIZE_BITS - 9);
     }
     
     

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this