update to new version, fixes bug #153
[openwrt.git] / target / linux / linux-2.6 / patches / generic / 000-reenable_devfs.patch
1 diff -ur linux-2.6.15-rc5/drivers/mtd/mtd_blkdevs.c linux-2.6.15-rc5-openwrt/drivers/mtd/mtd_blkdevs.c
2 --- linux-2.6.15-rc5/drivers/mtd/mtd_blkdevs.c 2005-12-04 06:10:42.000000000 +0100
3 +++ linux-2.6.15-rc5-openwrt/drivers/mtd/mtd_blkdevs.c 2005-12-15 07:53:20.000000000 +0100
4 @@ -21,6 +21,9 @@
5 #include <linux/init.h>
6 #include <asm/semaphore.h>
7 #include <asm/uaccess.h>
8 +#ifdef CONFIG_DEVFS_FS
9 +#include <linux/devfs_fs_kernel.h>
10 +#endif
11
12 static LIST_HEAD(blktrans_majors);
13
14 @@ -302,6 +305,11 @@
15 snprintf(gd->disk_name, sizeof(gd->disk_name),
16 "%s%d", tr->name, new->devnum);
17
18 +#ifdef CONFIG_DEVFS_FS
19 + snprintf(gd->devfs_name, sizeof(gd->devfs_name),
20 + "%s/%c", tr->name, (tr->part_bits?'a':'0') + new->devnum);
21 +#endif
22 +
23 /* 2.5 has capacity in units of 512 bytes while still
24 having BLOCK_SIZE_BITS set to 10. Just to keep us amused. */
25 set_capacity(gd, (new->size * new->blksize) >> 9);
26 @@ -418,6 +426,10 @@
27 return ret;
28 }
29
30 +#ifdef CONFIG_DEVFS_FS
31 + devfs_mk_dir(tr->name);
32 +#endif
33 +
34 INIT_LIST_HEAD(&tr->devs);
35 list_add(&tr->list, &blktrans_majors);
36
37 @@ -450,6 +462,10 @@
38 tr->remove_dev(dev);
39 }
40
41 +#ifdef CONFIG_DEVFS_FS
42 + devfs_remove(tr->name);
43 +#endif
44 +
45 blk_cleanup_queue(tr->blkcore_priv->rq);
46 unregister_blkdev(tr->major, tr->name);
47
48 diff -ur linux-2.6.15-rc5/drivers/mtd/mtdchar.c linux-2.6.15-rc5-openwrt/drivers/mtd/mtdchar.c
49 --- linux-2.6.15-rc5/drivers/mtd/mtdchar.c 2005-12-04 06:10:42.000000000 +0100
50 +++ linux-2.6.15-rc5-openwrt/drivers/mtd/mtdchar.c 2005-12-15 07:49:15.000000000 +0100
51 @@ -6,7 +6,6 @@
52 */
53
54 #include <linux/config.h>
55 -#include <linux/device.h>
56 #include <linux/fs.h>
57 #include <linux/init.h>
58 #include <linux/kernel.h>
59 @@ -19,19 +18,33 @@
60
61 #include <asm/uaccess.h>
62
63 +#ifdef CONFIG_DEVFS_FS
64 +#include <linux/devfs_fs_kernel.h>
65 +#else
66 +#include <linux/device.h>
67 +
68 static struct class *mtd_class;
69 +#endif
70
71 static void mtd_notify_add(struct mtd_info* mtd)
72 {
73 if (!mtd)
74 return;
75
76 +#ifdef CONFIG_DEVFS_FS
77 + devfs_mk_cdev(MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
78 + S_IFCHR | S_IRUGO | S_IWUGO, "mtd/%d", mtd->index);
79 +
80 + devfs_mk_cdev(MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
81 + S_IFCHR | S_IRUGO, "mtd/%dro", mtd->index);
82 +#else
83 class_device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
84 NULL, "mtd%d", mtd->index);
85
86 class_device_create(mtd_class, NULL,
87 MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
88 NULL, "mtd%dro", mtd->index);
89 +#endif
90 }
91
92 static void mtd_notify_remove(struct mtd_info* mtd)
93 @@ -39,8 +52,13 @@
94 if (!mtd)
95 return;
96
97 +#ifdef CONFIG_DEVFS_FS
98 + devfs_remove("mtd/%d", mtd->index);
99 + devfs_remove("mtd/%dro", mtd->index);
100 +#else
101 class_device_destroy(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2));
102 class_device_destroy(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1));
103 +#endif
104 }
105
106 static struct mtd_notifier notifier = {
107 @@ -48,6 +66,22 @@
108 .remove = mtd_notify_remove,
109 };
110
111 +#ifdef CONFIG_DEVFS_FS
112 + static inline void mtdchar_devfs_init(void)
113 + {
114 + devfs_mk_dir("mtd");
115 + register_mtd_user(&notifier);
116 + }
117 + static inline void mtdchar_devfs_exit(void)
118 + {
119 + unregister_mtd_user(&notifier);
120 + devfs_remove("mtd");
121 + }
122 + #else /* !DEVFS */
123 + #define mtdchar_devfs_init() do { } while(0)
124 + #define mtdchar_devfs_exit() do { } while(0)
125 +#endif
126 +
127 /*
128 * We use file->private_data to store a pointer to the MTDdevice.
129 * Since alighment is at least 32 bits, we have 2 bits free for OTP
130 @@ -643,6 +677,9 @@
131 return -EAGAIN;
132 }
133
134 +#ifdef CONFIG_DEVFS_FS
135 + mtdchar_devfs_init();
136 +#else
137 mtd_class = class_create(THIS_MODULE, "mtd");
138
139 if (IS_ERR(mtd_class)) {
140 @@ -652,13 +689,19 @@
141 }
142
143 register_mtd_user(&notifier);
144 +#endif
145 return 0;
146 }
147
148 static void __exit cleanup_mtdchar(void)
149 {
150 +
151 +#ifdef CONFIG_DEVFS_FS
152 + mtdchar_devfs_exit();
153 +#else
154 unregister_mtd_user(&notifier);
155 class_destroy(mtd_class);
156 +#endif
157 unregister_chrdev(MTD_CHAR_MAJOR, "mtd");
158 }
159
160 diff -ur linux-2.6.15-rc5/fs/Kconfig linux-2.6.15-rc5-openwrt/fs/Kconfig
161 --- linux-2.6.15-rc5/fs/Kconfig 2005-12-04 06:10:42.000000000 +0100
162 +++ linux-2.6.15-rc5-openwrt/fs/Kconfig 2005-12-15 07:44:01.000000000 +0100
163 @@ -772,6 +772,56 @@
164 help
165 Exports the dump image of crashed kernel in ELF format.
166
167 +config DEVFS_FS
168 + bool "/dev file system support (OBSOLETE)"
169 + depends on EXPERIMENTAL
170 + help
171 + This is support for devfs, a virtual file system (like /proc) which
172 + provides the file system interface to device drivers, normally found
173 + in /dev. Devfs does not depend on major and minor number
174 + allocations. Device drivers register entries in /dev which then
175 + appear automatically, which means that the system administrator does
176 + not have to create character and block special device files in the
177 + /dev directory using the mknod command (or MAKEDEV script) anymore.
178 +
179 + This is work in progress. If you want to use this, you *must* read
180 + the material in <file:Documentation/filesystems/devfs/>, especially
181 + the file README there.
182 +
183 + Note that devfs no longer manages /dev/pts! If you are using UNIX98
184 + ptys, you will also need to mount the /dev/pts filesystem (devpts).
185 +
186 + Note that devfs has been obsoleted by udev,
187 + <http://www.kernel.org/pub/linux/utils/kernel/hotplug/>.
188 + It has been stripped down to a bare minimum and is only provided for
189 + legacy installations that use its naming scheme which is
190 + unfortunately different from the names normal Linux installations
191 + use.
192 +
193 + If unsure, say N.
194 +
195 +config DEVFS_MOUNT
196 + bool "Automatically mount at boot"
197 + depends on DEVFS_FS
198 + help
199 + This option appears if you have CONFIG_DEVFS_FS enabled. Setting
200 + this to 'Y' will make the kernel automatically mount devfs onto /dev
201 + when the system is booted, before the init thread is started.
202 + You can override this with the "devfs=nomount" boot option.
203 +
204 + If unsure, say N.
205 +
206 +config DEVFS_DEBUG
207 + bool "Debug devfs"
208 + depends on DEVFS_FS
209 + help
210 + If you say Y here, then the /dev file system code will generate
211 + debugging messages. See the file
212 + <file:Documentation/filesystems/devfs/boot-options> for more
213 + details.
214 +
215 + If unsure, say N.
216 +
217 config SYSFS
218 bool "sysfs file system support" if EMBEDDED
219 default y
This page took 0.057074 seconds and 5 git commands to generate.