mem.c (1da177e4c3f41524e886b7f1b8a0c1fc7321cac2) mem.c (ca8eca6884861c1ce294b05aacfdf9045bba9aff)
1/*
2 * linux/drivers/char/mem.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 *
6 * Added devfs support.
7 * Jan-11-1998, C. Scott Ananian <cananian@alumni.princeton.edu>
8 * Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@sgi.com>

--- 842 unchanged lines hidden (view full) ---

851#endif
852 {5, "zero", S_IRUGO | S_IWUGO, &zero_fops},
853 {7, "full", S_IRUGO | S_IWUGO, &full_fops},
854 {8, "random", S_IRUGO | S_IWUSR, &random_fops},
855 {9, "urandom", S_IRUGO | S_IWUSR, &urandom_fops},
856 {11,"kmsg", S_IRUGO | S_IWUSR, &kmsg_fops},
857};
858
1/*
2 * linux/drivers/char/mem.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 *
6 * Added devfs support.
7 * Jan-11-1998, C. Scott Ananian <cananian@alumni.princeton.edu>
8 * Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@sgi.com>

--- 842 unchanged lines hidden (view full) ---

851#endif
852 {5, "zero", S_IRUGO | S_IWUGO, &zero_fops},
853 {7, "full", S_IRUGO | S_IWUGO, &full_fops},
854 {8, "random", S_IRUGO | S_IWUSR, &random_fops},
855 {9, "urandom", S_IRUGO | S_IWUSR, &urandom_fops},
856 {11,"kmsg", S_IRUGO | S_IWUSR, &kmsg_fops},
857};
858
859static struct class_simple *mem_class;
859static struct class *mem_class;
860
861static int __init chr_dev_init(void)
862{
863 int i;
864
865 if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
866 printk("unable to get major %d for memory devs\n", MEM_MAJOR);
867
860
861static int __init chr_dev_init(void)
862{
863 int i;
864
865 if (register_chrdev(MEM_MAJOR,"mem",&memory_fops))
866 printk("unable to get major %d for memory devs\n", MEM_MAJOR);
867
868 mem_class = class_simple_create(THIS_MODULE, "mem");
868 mem_class = class_create(THIS_MODULE, "mem");
869 for (i = 0; i < ARRAY_SIZE(devlist); i++) {
869 for (i = 0; i < ARRAY_SIZE(devlist); i++) {
870 class_simple_device_add(mem_class,
871 MKDEV(MEM_MAJOR, devlist[i].minor),
870 class_device_create(mem_class, MKDEV(MEM_MAJOR, devlist[i].minor),
872 NULL, devlist[i].name);
873 devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor),
874 S_IFCHR | devlist[i].mode, devlist[i].name);
875 }
876
877 return 0;
878}
879
880fs_initcall(chr_dev_init);
871 NULL, devlist[i].name);
872 devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor),
873 S_IFCHR | devlist[i].mode, devlist[i].name);
874 }
875
876 return 0;
877}
878
879fs_initcall(chr_dev_init);