PATCH: Ramdisk version 2.0.1 (minor fix)

Chad Page (page0588@sundance.sjsu.edu)
Sun, 30 Jun 1996 19:31:54 -0700 (PDT)


The following patch fixes this one little thing :

Some people have had problems with their lilo.conf containing
'ramdisk=0' which practically nullifies the ramdisk code, setting the
ramdisk size to 0. The driver now checks for this and sets the size to
4MB, the standard default.

- Chad,
who realizes he's been lurking for a *long* time...

--- ramdisk.txt.orig Sun Jun 30 19:18:58 1996
+++ ramdisk.txt Sun Jun 30 19:21:21 1996
@@ -34,9 +34,13 @@
(to change it's permissions) it to your liking. The default /dev/ram(disk)
uses minor #1, so start with ram2 and go from there.

-The old "ramdisk=<ram_size>" has been changed to "ramdisk_size=<ram_size>"
+(The old "ramdisk=<ram_size>" has been changed to "ramdisk_size=<ram_size>"
to make it clearer. The original "ramdisk=<ram_size>" has been kept around
for compatibility reasons, but it will probably be removed in 2.1.x.
+
+Some now broken lilo.confs have ramdisk=0, which nullifies the ramdisk driver
+in kernels between 1.3.9? and 2.0.0 inclusive. The ramdisk driver has been
+fixed to reset the ramdisk size if ramdisk=0 is passed to it.)

The new ramdisk also has the ability to load compressed ramdisk images,
allowing one to squeeze more programs onto an average installation or
--- rd.c.orig Fri Jun 14 17:15:32 1996
+++ rd.c Sun Jun 30 19:24:28 1996
@@ -1,14 +1,15 @@
/*
- * ramdisk.c - Multiple ramdisk driver - gzip-loading version - v. 0.8 beta.
+ * ramdisk.c - Multiple ramdisk driver with gunzipping load for kernel v2.0.1
*
- * (C) Chad Page, Theodore Ts'o, et. al, 1995.
+ * (C) Chad Page, Theodore Ts'o, et. al, 1995-1996.
*
* This ramdisk is designed to have filesystems created on it and mounted
* just like a regular floppy disk.
*
* It also does something suggested by Linus: use the buffer cache as the
* ramdisk data. This makes it possible to dynamically allocate the ramdisk
- * buffer - with some consequences I have to deal with as I write this.
+ * buffer - with some modifications to the buffer cache code to prevent
+ * buffers from being freed.
*
* This code is based on the original ramdisk.c, written mostly by
* Theodore Ts'o (TYT) in 1991. The code was largely rewritten by
@@ -22,7 +23,8 @@
* kernel decompressor uses the same inflate.c codebase. The ramdisk
* loader now also loads into a dynamic (buffer cache based) ramdisk,
* not the old static ramdisk. Support for the old static ramdisk has
- * been completely removed.
+ * been completely removed except for initrd, which will hopefully change
+ * in 2.1.x.
*
* Loadable module support added by Tom Dyas.
*
@@ -34,6 +36,8 @@
* Added initrd: Werner Almesberger & Hans Lermen, Feb '96
*
* 4/25/96 : Made ramdisk size a parameter (default is now 4MB)
+ * 6/30/96 : Fixed rd_size for now-broken `ramdisk=0' kernel configurations
+ *
* - Chad Page
*/

@@ -65,7 +69,7 @@
#include <linux/blk.h>

/* The ramdisk size is now a parameter */
-#define NUM_RAMDISKS 16 /* This cannot be overridden (yet) */
+#define NUM_RAMDISKS 12 /* This cannot be overridden (yet) */

#ifndef MODULE
/* We don't have to load ramdisks or gunzip them in a module... */
@@ -275,6 +279,12 @@
}

blk_dev[MAJOR_NR].request_fn = &rd_request;
+
+ /* Fix for broken lilo.confs */
+ if (rd_size == 0) {
+ printk("Ramdisk size has been reset to 4096K - please fix your ramsize parameter.");
+ rd_size = 4096;
+ }

for (i = 0; i < NUM_RAMDISKS; i++) {
rd_length[i] = (rd_size * 1024);