patch-1.3.30 linux/drivers/char/mem.c
Next file: linux/drivers/char/random.c
Previous file: linux/drivers/char/keyboard.c
Back to the patch index
Back to the overall index
- Lines: 74
- Date:
Mon Sep 25 08:19:08 1995
- Orig file:
v1.3.29/linux/drivers/char/mem.c
- Orig date:
Sun Sep 3 12:26:52 1995
diff -u --recursive --new-file v1.3.29/linux/drivers/char/mem.c linux/drivers/char/mem.c
@@ -16,6 +16,7 @@
#include <linux/malloc.h>
#include <linux/mman.h>
#include <linux/mm.h>
+#include <linux/random.h>
#include <asm/segment.h>
#include <asm/io.h>
@@ -226,6 +227,7 @@
#define mmap_kmem mmap_mem
#define zero_lseek null_lseek
#define write_zero write_null
+#define write_random write_null
static struct file_operations ram_fops = {
memory_lseek,
@@ -316,6 +318,32 @@
NULL /* no special release code */
};
+#ifdef CONFIG_RANDOM
+static struct file_operations random_fops = {
+ memory_lseek,
+ read_random,
+ write_random,
+ NULL, /* full_readdir */
+ NULL, /* full_select */
+ NULL, /* full_ioctl */
+ NULL, /* full_mmap */
+ NULL, /* no special open code */
+ NULL /* no special release code */
+};
+
+static struct file_operations urandom_fops = {
+ memory_lseek,
+ read_random_unlimited,
+ write_random,
+ NULL, /* full_readdir */
+ NULL, /* full_select */
+ NULL, /* full_ioctl */
+ NULL, /* full_mmap */
+ NULL, /* no special open code */
+ NULL /* no special release code */
+};
+#endif
+
static int memory_open(struct inode * inode, struct file * filp)
{
switch (MINOR(inode->i_rdev)) {
@@ -340,6 +368,14 @@
case 7:
filp->f_op = &full_fops;
break;
+#ifdef CONFIG_RANDOM
+ case 8:
+ filp->f_op = &random_fops;
+ break;
+ case 9:
+ filp->f_op = &urandom_fops;
+ break;
+#endif
default:
return -ENODEV;
}
@@ -369,6 +405,9 @@
{
if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
printk("unable to get major %d for memory devs\n", MEM_MAJOR);
+#ifdef CONFIG_RANDOM
+ rand_initialize();
+#endif
mem_start = tty_init(mem_start);
#ifdef CONFIG_PRINTER
mem_start = lp_init(mem_start);
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