patch-2.1.116 linux/drivers/block/genhd.c

Next file: linux/drivers/block/ide-probe.c
Previous file: linux/drivers/block/Config.in
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.115/linux/drivers/block/genhd.c linux/drivers/block/genhd.c
@@ -414,7 +414,8 @@
 			 * This is necessary for drives for situations where
 			 * the translated geometry is unavailable from the BIOS.
 			 */
-			for (i = 0; i < 4 ; i++) {
+			int	xlate_done = 0;
+			for (i = 0; i < 4 && !xlate_done; i++) {
 				struct partition *q = &p[i];
 				if (NR_SECTS(q)
 				   && (q->sector & 63) == 1
@@ -423,10 +424,16 @@
 					if (heads == 32 || heads == 64 || heads == 128 || heads == 255) {
 
 						(void) ide_xlate_1024(dev, heads, " [PTBL]");
-						break;
+						xlate_done = 1;
 					}
 				}
 			}
+			if (!xlate_done) {
+				/*
+				 * Default translation is equivalent of "BIOS LBA":
+				 */
+				ide_xlate_1024(dev, -2, " [LBA]");
+			}
 		}
 	}
 #endif	/* CONFIG_BLK_DEV_IDE */
@@ -1101,7 +1108,6 @@
 	extern int soc_probe(void);
 #endif
 	struct gendisk *p;
-	int nr=0;
 
 #ifdef CONFIG_PARPORT
 	parport_init();
@@ -1123,10 +1129,9 @@
 	console_map_init();
 #endif
 
-	for (p = gendisk_head ; p ; p=p->next) {
+	for (p = gendisk_head ; p ; p=p->next)
 		setup_dev(p);
-		nr += p->nr_real;
-	}
+
 #ifdef CONFIG_BLK_DEV_RAM
 #ifdef CONFIG_BLK_DEV_INITRD
 	if (initrd_start && mount_initrd) initrd_load();
@@ -1138,3 +1143,25 @@
         md_setup_drive();
 #endif
 }
+
+#ifdef CONFIG_PROC_FS
+int get_partition_list(char * page)
+{
+	struct gendisk *p;
+	char buf[8];
+	int n, len;
+
+	len = sprintf(page, "major minor  #blocks  name\n\n");
+	for (p = gendisk_head; p; p = p->next) {
+		for (n=0; n < (p->nr_real << p->minor_shift); n++) {
+			if (p->part[n].nr_sects && len < PAGE_SIZE - 80) {
+				len += sprintf(page+len,
+					       "%4d  %4d %10d %s\n",
+					       p->major, n, p->sizes[n],
+					       disk_name(p, n, buf));
+			}
+		}
+	}
+	return len;
+}
+#endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov