patch-2.0.34 linux/drivers/block/rd.c

Next file: linux/drivers/block/triton.c
Previous file: linux/drivers/block/raid0.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.33/linux/drivers/block/rd.c linux/drivers/block/rd.c
@@ -422,7 +422,7 @@
 /*
  * This routine loads in the ramdisk image.
  */
-static void rd_load_image(kdev_t device,int offset)
+static void rd_load_image(kdev_t device,int offset, int unit)
 {
 	struct inode inode, out_inode;
 	struct file infile, outfile;
@@ -433,7 +433,7 @@
 	unsigned short rotate = 0;
 	char rotator[4] = { '|' , '/' , '-' , '\\' };
 
-	ram_device = MKDEV(MAJOR_NR, 0);
+	ram_device = MKDEV(MAJOR_NR, unit);
 
 	memset(&infile, 0, sizeof(infile));
 	memset(&inode, 0, sizeof(inode));
@@ -500,7 +500,7 @@
 
 successful_load:
 	invalidate_buffers(device);
-	ROOT_DEV = MKDEV(MAJOR_NR,0);
+	ROOT_DEV = MKDEV(MAJOR_NR,unit);
 
 done:
 	if (infile.f_op->release)
@@ -509,12 +509,21 @@
 }
 
 
-void rd_load()
+static void rd_load_disk(int n)
 {
+#ifdef CONFIG_BLK_DEV_INITRD
+	extern kdev_t real_root_dev;
+#endif	
+	
 	if (rd_doload == 0)
 		return;
 	
-	if (MAJOR(ROOT_DEV) != FLOPPY_MAJOR) return;
+	if (MAJOR(ROOT_DEV) != FLOPPY_MAJOR
+#ifdef CONFIG_BLK_DEV_INITRD	
+		&& MAJOR(real_root_dev) != FLOPPY_MAJOR
+#endif		
+	)
+			return;
 
 	if (rd_prompt) {
 #ifdef CONFIG_BLK_DEV_FD
@@ -525,15 +534,24 @@
 		wait_for_keypress();
 	}
 
-	rd_load_image(ROOT_DEV,rd_image_start);
+	rd_load_image(ROOT_DEV,rd_image_start,n);
+
+}
 
+void rd_load(void)
+{
+	rd_load_disk(0);
 }
 
+void rd_load_secondary(void)
+{
+	rd_load_disk(1);
+}
 
 #ifdef CONFIG_BLK_DEV_INITRD
 void initrd_load(void)
 {
-	rd_load_image(MKDEV(MAJOR_NR, INITRD_MINOR),0);
+	rd_load_image(MKDEV(MAJOR_NR, INITRD_MINOR),0,0);
 }
 #endif
 
@@ -658,6 +676,13 @@
 crd_load(struct file * fp, struct file *outfp)
 {
 	int result;
+
+	insize = 0;  /* valid bytes in inbuf */
+	inptr = 0;   /* index of next byte to be processed in inbuf */
+	outcnt = 0;  /* bytes in output buffer */
+	exit_code = 0;
+	bytes_out = 0;
+	crc = 0xFFFFFFFF;
 	
 	crd_infp = fp;
 	crd_outfp = outfp;

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