7871c4c3780f0c98823f65be188ec145e5384abd
[openwrt.git] / target / linux / generic-2.6 / patches / 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 @@ -19,19 +18,33 @@
52
53 #include <asm/uaccess.h>
54
55 +#ifdef CONFIG_DEVFS_FS
56 +#include <linux/devfs_fs_kernel.h>
57 +#else
58 +#include <linux/device.h>
59 +
60 static struct class *mtd_class;
61 +#endif
62
63 static void mtd_notify_add(struct mtd_info* mtd)
64 {
65 if (!mtd)
66 return;
67
68 +#ifdef CONFIG_DEVFS_FS
69 + devfs_mk_cdev(MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
70 + S_IFCHR | S_IRUGO | S_IWUGO, "mtd/%d", mtd->index);
71 +
72 + devfs_mk_cdev(MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
73 + S_IFCHR | S_IRUGO, "mtd/%dro", mtd->index);
74 +#else
75 class_device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
76 NULL, "mtd%d", mtd->index);
77
78 class_device_create(mtd_class, NULL,
79 MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
80 NULL, "mtd%dro", mtd->index);
81 +#endif
82 }
83
84 static void mtd_notify_remove(struct mtd_info* mtd)
85 @@ -39,8 +52,13 @@
86 if (!mtd)
87 return;
88
89 +#ifdef CONFIG_DEVFS_FS
90 + devfs_remove("mtd/%d", mtd->index);
91 + devfs_remove("mtd/%dro", mtd->index);
92 +#else
93 class_device_destroy(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2));
94 class_device_destroy(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1));
95 +#endif
96 }
97
98 static struct mtd_notifier notifier = {
99 @@ -48,6 +66,22 @@
100 .remove = mtd_notify_remove,
101 };
102
103 +#ifdef CONFIG_DEVFS_FS
104 + static inline void mtdchar_devfs_init(void)
105 + {
106 + devfs_mk_dir("mtd");
107 + register_mtd_user(&notifier);
108 + }
109 + static inline void mtdchar_devfs_exit(void)
110 + {
111 + unregister_mtd_user(&notifier);
112 + devfs_remove("mtd");
113 + }
114 + #else /* !DEVFS */
115 + #define mtdchar_devfs_init() do { } while(0)
116 + #define mtdchar_devfs_exit() do { } while(0)
117 +#endif
118 +
119 /*
120 * We use file->private_data to store a pointer to the MTDdevice.
121 * Since alighment is at least 32 bits, we have 2 bits free for OTP
122 @@ -643,6 +677,9 @@
123 return -EAGAIN;
124 }
125
126 +#ifdef CONFIG_DEVFS_FS
127 + mtdchar_devfs_init();
128 +#else
129 mtd_class = class_create(THIS_MODULE, "mtd");
130
131 if (IS_ERR(mtd_class)) {
132 @@ -652,13 +689,19 @@
133 }
134
135 register_mtd_user(&notifier);
136 +#endif
137 return 0;
138 }
139
140 static void __exit cleanup_mtdchar(void)
141 {
142 +
143 +#ifdef CONFIG_DEVFS_FS
144 + mtdchar_devfs_exit();
145 +#else
146 unregister_mtd_user(&notifier);
147 class_destroy(mtd_class);
148 +#endif
149 unregister_chrdev(MTD_CHAR_MAJOR, "mtd");
150 }
151
152 diff -ur linux-2.6.15-rc5/fs/Kconfig linux-2.6.15-rc5-openwrt/fs/Kconfig
153 --- linux-2.6.15-rc5/fs/Kconfig 2005-12-04 06:10:42.000000000 +0100
154 +++ linux-2.6.15-rc5-openwrt/fs/Kconfig 2005-12-15 07:44:01.000000000 +0100
155 @@ -772,6 +772,56 @@
156 help
157 Exports the dump image of crashed kernel in ELF format.
158
159 +config DEVFS_FS
160 + bool "/dev file system support (OBSOLETE)"
161 + depends on EXPERIMENTAL
162 + help
163 + This is support for devfs, a virtual file system (like /proc) which
164 + provides the file system interface to device drivers, normally found
165 + in /dev. Devfs does not depend on major and minor number
166 + allocations. Device drivers register entries in /dev which then
167 + appear automatically, which means that the system administrator does
168 + not have to create character and block special device files in the
169 + /dev directory using the mknod command (or MAKEDEV script) anymore.
170 +
171 + This is work in progress. If you want to use this, you *must* read
172 + the material in <file:Documentation/filesystems/devfs/>, especially
173 + the file README there.
174 +
175 + Note that devfs no longer manages /dev/pts! If you are using UNIX98
176 + ptys, you will also need to mount the /dev/pts filesystem (devpts).
177 +
178 + Note that devfs has been obsoleted by udev,
179 + <http://www.kernel.org/pub/linux/utils/kernel/hotplug/>.
180 + It has been stripped down to a bare minimum and is only provided for
181 + legacy installations that use its naming scheme which is
182 + unfortunately different from the names normal Linux installations
183 + use.
184 +
185 + If unsure, say N.
186 +
187 +config DEVFS_MOUNT
188 + bool "Automatically mount at boot"
189 + depends on DEVFS_FS
190 + help
191 + This option appears if you have CONFIG_DEVFS_FS enabled. Setting
192 + this to 'Y' will make the kernel automatically mount devfs onto /dev
193 + when the system is booted, before the init thread is started.
194 + You can override this with the "devfs=nomount" boot option.
195 +
196 + If unsure, say N.
197 +
198 +config DEVFS_DEBUG
199 + bool "Debug devfs"
200 + depends on DEVFS_FS
201 + help
202 + If you say Y here, then the /dev file system code will generate
203 + debugging messages. See the file
204 + <file:Documentation/filesystems/devfs/boot-options> for more
205 + details.
206 +
207 + If unsure, say N.
208 +
209 config SYSFS
210 bool "sysfs file system support" if EMBEDDED
211 default y
212 diff -ur linux-2.6.17/drivers/ieee1394/dv1394.c linux-2.6.17-devfs/drivers/ieee1394/dv1394.c
213 --- linux-2.6.17/drivers/ieee1394/dv1394.c 2006-06-17 18:49:35.000000000 -0700
214 +++ linux-2.6.17-devfs/drivers/ieee1394/dv1394.c 2006-08-25 11:06:18.000000000 -0700
215 @@ -73,7 +73,7 @@
216 - fix all XXX showstoppers
217 - disable IR/IT DMA interrupts on shutdown
218 - flush pci writes to the card by issuing a read
219 - - character device dispatching
220 + - devfs and character device dispatching (* needs testing with Linux 2.2.x)
221 - switch over to the new kernel DMA API (pci_map_*()) (* needs testing on platforms with IOMMU!)
222 - keep all video_cards in a list (for open() via chardev), set file->private_data = video
223 - dv1394_poll should indicate POLLIN when receiving buffers are available
224 @@ -1096,6 +1096,7 @@
225
226 init.api_version = DV1394_API_VERSION;
227 init.n_frames = DV1394_MAX_FRAMES / 4;
228 + /* the following are now set via devfs */
229 init.channel = video->channel;
230 init.format = video->pal_or_ntsc;
231 init.cip_n = video->cip_n;
232 @@ -1790,6 +1791,8 @@
233 {
234 struct video_card *video = NULL;
235
236 + /* if the device was opened through devfs, then file->private_data
237 + has already been set to video by devfs */
238 if (file->private_data) {
239 video = (struct video_card*) file->private_data;
240
241 @@ -2208,7 +2211,7 @@
242 video = kzalloc(sizeof(*video), GFP_KERNEL);
243 if (!video) {
244 printk(KERN_ERR "dv1394: cannot allocate video_card\n");
245 - return -1;
246 + goto err;
247 }
248
249 video->ohci = ohci;
250 @@ -2263,14 +2266,37 @@
251 list_add_tail(&video->list, &dv1394_cards);
252 spin_unlock_irqrestore(&dv1394_cards_lock, flags);
253
254 + if (devfs_mk_cdev(MKDEV(IEEE1394_MAJOR,
255 + IEEE1394_MINOR_BLOCK_DV1394*16 + video->id),
256 + S_IFCHR|S_IRUGO|S_IWUGO,
257 + "ieee1394/dv/host%d/%s/%s",
258 + (video->id>>2),
259 + (video->pal_or_ntsc == DV1394_NTSC ? "NTSC" : "PAL"),
260 + (video->mode == MODE_RECEIVE ? "in" : "out")) < 0)
261 + goto err_free;
262 +
263 debug_printk("dv1394: dv1394_init() OK on ID %d\n", video->id);
264 +
265 return 0;
266 +
267 + err_free:
268 + kfree(video);
269 + err:
270 + return -1;
271 }
272
273 static void dv1394_un_init(struct video_card *video)
274 {
275 + char buf[32];
276 +
277 /* obviously nobody has the driver open at this point */
278 do_dv1394_shutdown(video, 1);
279 + snprintf(buf, sizeof(buf), "dv/host%d/%s/%s", (video->id >> 2),
280 + (video->pal_or_ntsc == DV1394_NTSC ? "NTSC" : "PAL"),
281 + (video->mode == MODE_RECEIVE ? "in" : "out")
282 + );
283 +
284 + devfs_remove("ieee1394/%s", buf);
285 kfree(video);
286 }
287
288 @@ -2307,6 +2333,9 @@
289
290 class_device_destroy(hpsb_protocol_class,
291 MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)));
292 + devfs_remove("ieee1394/dv/host%d/NTSC", id);
293 + devfs_remove("ieee1394/dv/host%d/PAL", id);
294 + devfs_remove("ieee1394/dv/host%d", id);
295 }
296
297 static void dv1394_add_host (struct hpsb_host *host)
298 @@ -2323,6 +2352,9 @@
299 class_device_create(hpsb_protocol_class, NULL, MKDEV(
300 IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)),
301 NULL, "dv1394-%d", id);
302 + devfs_mk_dir("ieee1394/dv/host%d", id);
303 + devfs_mk_dir("ieee1394/dv/host%d/NTSC", id);
304 + devfs_mk_dir("ieee1394/dv/host%d/PAL", id);
305
306 dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE);
307 dv1394_init(ohci, DV1394_NTSC, MODE_TRANSMIT);
308 @@ -2579,8 +2611,10 @@
309 static void __exit dv1394_exit_module(void)
310 {
311 hpsb_unregister_protocol(&dv1394_driver);
312 +
313 hpsb_unregister_highlevel(&dv1394_highlevel);
314 cdev_del(&dv1394_cdev);
315 + devfs_remove("ieee1394/dv");
316 }
317
318 static int __init dv1394_init_module(void)
319 @@ -2596,12 +2630,15 @@
320 return ret;
321 }
322
323 + devfs_mk_dir("ieee1394/dv");
324 +
325 hpsb_register_highlevel(&dv1394_highlevel);
326
327 ret = hpsb_register_protocol(&dv1394_driver);
328 if (ret) {
329 printk(KERN_ERR "dv1394: failed to register protocol\n");
330 hpsb_unregister_highlevel(&dv1394_highlevel);
331 + devfs_remove("ieee1394/dv");
332 cdev_del(&dv1394_cdev);
333 return ret;
334 }
335 diff -ur linux-2.6.17/drivers/ieee1394/ieee1394_core.c linux-2.6.17-devfs/drivers/ieee1394/ieee1394_core.c
336 --- linux-2.6.17/drivers/ieee1394/ieee1394_core.c 2006-06-17 18:49:35.000000000 -0700
337 +++ linux-2.6.17-devfs/drivers/ieee1394/ieee1394_core.c 2006-08-25 11:06:18.000000000 -0700
338 @@ -1078,10 +1078,17 @@
339 goto exit_release_kernel_thread;
340 }
341
342 + /* actually this is a non-fatal error */
343 + ret = devfs_mk_dir("ieee1394");
344 + if (ret < 0) {
345 + HPSB_ERR("unable to make devfs dir for device major %d!\n", IEEE1394_MAJOR);
346 + goto release_chrdev;
347 + }
348 +
349 ret = bus_register(&ieee1394_bus_type);
350 if (ret < 0) {
351 HPSB_INFO("bus register failed");
352 - goto release_chrdev;
353 + goto release_devfs;
354 }
355
356 for (i = 0; fw_bus_attrs[i]; i++) {
357 @@ -1092,7 +1099,7 @@
358 fw_bus_attrs[i--]);
359 }
360 bus_unregister(&ieee1394_bus_type);
361 - goto release_chrdev;
362 + goto release_devfs;
363 }
364 }
365
366 @@ -1145,6 +1152,8 @@
367 for (i = 0; fw_bus_attrs[i]; i++)
368 bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]);
369 bus_unregister(&ieee1394_bus_type);
370 +release_devfs:
371 + devfs_remove("ieee1394");
372 release_chrdev:
373 unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
374 exit_release_kernel_thread:
375 @@ -1182,6 +1191,7 @@
376 hpsb_cleanup_config_roms();
377
378 unregister_chrdev_region(IEEE1394_CORE_DEV, 256);
379 + devfs_remove("ieee1394");
380 }
381
382 module_init(ieee1394_init);
383 diff -ur linux-2.6.17/drivers/ieee1394/ieee1394_core.h linux-2.6.17-devfs/drivers/ieee1394/ieee1394_core.h
384 --- linux-2.6.17/drivers/ieee1394/ieee1394_core.h 2006-06-17 18:49:35.000000000 -0700
385 +++ linux-2.6.17-devfs/drivers/ieee1394/ieee1394_core.h 2006-08-25 11:06:18.000000000 -0700
386 @@ -3,6 +3,7 @@
387 #define _IEEE1394_CORE_H
388
389 #include <linux/slab.h>
390 +#include <linux/devfs_fs_kernel.h>
391 #include <asm/atomic.h>
392 #include <asm/semaphore.h>
393 #include "hosts.h"
394 diff -ur linux-2.6.17/drivers/ieee1394/raw1394.c linux-2.6.17-devfs/drivers/ieee1394/raw1394.c
395 --- linux-2.6.17/drivers/ieee1394/raw1394.c 2006-06-17 18:49:35.000000000 -0700
396 +++ linux-2.6.17-devfs/drivers/ieee1394/raw1394.c 2006-08-25 11:06:18.000000000 -0700
397 @@ -41,6 +41,7 @@
398 #include <linux/cdev.h>
399 #include <asm/uaccess.h>
400 #include <asm/atomic.h>
401 +#include <linux/devfs_fs_kernel.h>
402 #include <linux/compat.h>
403
404 #include "csr1212.h"
405 @@ -2998,6 +2999,9 @@
406 goto out_unreg;
407 }
408
409 + devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16),
410 + S_IFCHR | S_IRUSR | S_IWUSR, RAW1394_DEVICE_NAME);
411 +
412 cdev_init(&raw1394_cdev, &raw1394_fops);
413 raw1394_cdev.owner = THIS_MODULE;
414 kobject_set_name(&raw1394_cdev.kobj, RAW1394_DEVICE_NAME);
415 @@ -3019,6 +3023,7 @@
416 goto out;
417
418 out_dev:
419 + devfs_remove(RAW1394_DEVICE_NAME);
420 class_device_destroy(hpsb_protocol_class,
421 MKDEV(IEEE1394_MAJOR,
422 IEEE1394_MINOR_BLOCK_RAW1394 * 16));
423 @@ -3034,6 +3039,7 @@
424 MKDEV(IEEE1394_MAJOR,
425 IEEE1394_MINOR_BLOCK_RAW1394 * 16));
426 cdev_del(&raw1394_cdev);
427 + devfs_remove(RAW1394_DEVICE_NAME);
428 hpsb_unregister_highlevel(&raw1394_highlevel);
429 hpsb_unregister_protocol(&raw1394_driver);
430 }
431 diff -ur linux-2.6.17/drivers/ieee1394/video1394.c linux-2.6.17-devfs/drivers/ieee1394/video1394.c
432 --- linux-2.6.17/drivers/ieee1394/video1394.c 2006-06-17 18:49:35.000000000 -0700
433 +++ linux-2.6.17-devfs/drivers/ieee1394/video1394.c 2006-08-25 11:06:18.000000000 -0700
434 @@ -42,6 +42,7 @@
435 #include <linux/poll.h>
436 #include <linux/smp_lock.h>
437 #include <linux/delay.h>
438 +#include <linux/devfs_fs_kernel.h>
439 #include <linux/bitops.h>
440 #include <linux/types.h>
441 #include <linux/vmalloc.h>
442 @@ -1321,6 +1322,9 @@
443 class_device_create(hpsb_protocol_class, NULL, MKDEV(
444 IEEE1394_MAJOR, minor),
445 NULL, "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
446 + devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, minor),
447 + S_IFCHR | S_IRUSR | S_IWUSR,
448 + "%s/%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
449 }
450
451
452 @@ -1328,9 +1332,12 @@
453 {
454 struct ti_ohci *ohci = hpsb_get_hostinfo(&video1394_highlevel, host);
455
456 - if (ohci)
457 + if (ohci) {
458 class_device_destroy(hpsb_protocol_class, MKDEV(IEEE1394_MAJOR,
459 IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id));
460 + devfs_remove("%s/%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
461 + }
462 +
463 return;
464 }
465
466 @@ -1471,8 +1478,12 @@
467 static void __exit video1394_exit_module (void)
468 {
469 hpsb_unregister_protocol(&video1394_driver);
470 +
471 hpsb_unregister_highlevel(&video1394_highlevel);
472 +
473 + devfs_remove(VIDEO1394_DRIVER_NAME);
474 cdev_del(&video1394_cdev);
475 +
476 PRINT_G(KERN_INFO, "Removed " VIDEO1394_DRIVER_NAME " module");
477 }
478
479 @@ -1489,12 +1500,15 @@
480 return ret;
481 }
482
483 + devfs_mk_dir(VIDEO1394_DRIVER_NAME);
484 +
485 hpsb_register_highlevel(&video1394_highlevel);
486
487 ret = hpsb_register_protocol(&video1394_driver);
488 if (ret) {
489 PRINT_G(KERN_ERR, "video1394: failed to register protocol");
490 hpsb_unregister_highlevel(&video1394_highlevel);
491 + devfs_remove(VIDEO1394_DRIVER_NAME);
492 cdev_del(&video1394_cdev);
493 return ret;
494 }
495 diff -ur linux-2.6.17/drivers/scsi/osst.c linux-2.6.17-devfs/drivers/scsi/osst.c
496 --- linux-2.6.17/drivers/scsi/osst.c 2006-06-17 18:49:35.000000000 -0700
497 +++ linux-2.6.17-devfs/drivers/scsi/osst.c 2006-08-25 11:06:18.000000000 -0700
498 @@ -48,6 +48,7 @@
499 #include <linux/vmalloc.h>
500 #include <linux/blkdev.h>
501 #include <linux/moduleparam.h>
502 +#include <linux/devfs_fs_kernel.h>
503 #include <linux/delay.h>
504 #include <linux/jiffies.h>
505 #include <asm/uaccess.h>
506 @@ -5721,7 +5722,7 @@
507 struct st_partstat * STps;
508 struct osst_buffer * buffer;
509 struct gendisk * drive;
510 - int i, dev_num;
511 + int i, mode, dev_num;
512
513 if (SDp->type != TYPE_TAPE || !osst_supports(SDp))
514 return -ENODEV;
515 @@ -5857,6 +5858,18 @@
516 snprintf(name, 8, "%s%s", "n", tape_name(tpnt));
517 osst_sysfs_add(MKDEV(OSST_MAJOR, dev_num + 128), dev, tpnt, name);
518 }
519 + for (mode = 0; mode < ST_NBR_MODES; ++mode) {
520 + /* Rewind entry */
521 + devfs_mk_cdev(MKDEV(OSST_MAJOR, dev_num + (mode << 5)),
522 + S_IFCHR | S_IRUGO | S_IWUGO,
523 + "%s/ot%s", SDp->devfs_name, osst_formats[mode]);
524 +
525 + /* No-rewind entry */
526 + devfs_mk_cdev(MKDEV(OSST_MAJOR, dev_num + (mode << 5) + 128),
527 + S_IFCHR | S_IRUGO | S_IWUGO,
528 + "%s/ot%sn", SDp->devfs_name, osst_formats[mode]);
529 + }
530 + drive->number = devfs_register_tape(SDp->devfs_name);
531
532 sdev_printk(KERN_INFO, SDp,
533 "osst :I: Attached OnStream %.5s tape as %s\n",
534 @@ -5873,7 +5886,7 @@
535 {
536 struct scsi_device * SDp = to_scsi_device(dev);
537 struct osst_tape * tpnt;
538 - int i;
539 + int i, mode;
540
541 if ((SDp->type != TYPE_TAPE) || (osst_nr_dev <= 0))
542 return 0;
543 @@ -5884,6 +5897,11 @@
544 osst_sysfs_destroy(MKDEV(OSST_MAJOR, i));
545 osst_sysfs_destroy(MKDEV(OSST_MAJOR, i+128));
546 tpnt->device = NULL;
547 + for (mode = 0; mode < ST_NBR_MODES; ++mode) {
548 + devfs_remove("%s/ot%s", SDp->devfs_name, osst_formats[mode]);
549 + devfs_remove("%s/ot%sn", SDp->devfs_name, osst_formats[mode]);
550 + }
551 + devfs_unregister_tape(tpnt->drive->number);
552 put_disk(tpnt->drive);
553 os_scsi_tapes[i] = NULL;
554 osst_nr_dev--;
555 diff -ur linux-2.6.17/drivers/scsi/scsi.c linux-2.6.17-devfs/drivers/scsi/scsi.c
556 --- linux-2.6.17/drivers/scsi/scsi.c 2006-06-17 18:49:35.000000000 -0700
557 +++ linux-2.6.17-devfs/drivers/scsi/scsi.c 2006-08-25 11:07:42.000000000 -0700
558 @@ -48,6 +48,7 @@
559 #include <linux/delay.h>
560 #include <linux/init.h>
561 #include <linux/completion.h>
562 +#include <linux/devfs_fs_kernel.h>
563 #include <linux/unistd.h>
564 #include <linux/spinlock.h>
565 #include <linux/kmod.h>
566 @@ -1247,6 +1248,7 @@
567 for_each_possible_cpu(i)
568 INIT_LIST_HEAD(&per_cpu(scsi_done_q, i));
569
570 + devfs_mk_dir("scsi");
571 printk(KERN_NOTICE "SCSI subsystem initialized\n");
572 return 0;
573
574 @@ -1271,6 +1273,7 @@
575 scsi_exit_sysctl();
576 scsi_exit_hosts();
577 scsi_exit_devinfo();
578 + devfs_remove("scsi");
579 scsi_exit_procfs();
580 scsi_exit_queue();
581 }
582 diff -ur linux-2.6.17/drivers/scsi/scsi_scan.c linux-2.6.17-devfs/drivers/scsi/scsi_scan.c
583 --- linux-2.6.17/drivers/scsi/scsi_scan.c 2006-06-17 18:49:35.000000000 -0700
584 +++ linux-2.6.17-devfs/drivers/scsi/scsi_scan.c 2006-08-25 11:06:18.000000000 -0700
585 @@ -716,8 +716,12 @@
586 if (inq_result[7] & 0x10)
587 sdev->sdtr = 1;
588
589 + sprintf(sdev->devfs_name, "scsi/host%d/bus%d/target%d/lun%d",
590 + sdev->host->host_no, sdev->channel,
591 + sdev->id, sdev->lun);
592 +
593 /*
594 - * End sysfs code.
595 + * End driverfs/devfs code.
596 */
597
598 if ((sdev->scsi_level >= SCSI_2) && (inq_result[7] & 2) &&
599 diff -ur linux-2.6.17/drivers/scsi/sd.c linux-2.6.17-devfs/drivers/scsi/sd.c
600 --- linux-2.6.17/drivers/scsi/sd.c 2006-06-17 18:49:35.000000000 -0700
601 +++ linux-2.6.17-devfs/drivers/scsi/sd.c 2006-08-25 11:06:18.000000000 -0700
602 @@ -1683,6 +1683,8 @@
603 'a' + m1, 'a' + m2, 'a' + m3);
604 }
605
606 + strcpy(gd->devfs_name, sdp->devfs_name);
607 +
608 gd->private_data = &sdkp->driver;
609 gd->queue = sdkp->device->request_queue;
610
611 diff -ur linux-2.6.17/drivers/scsi/sg.c linux-2.6.17-devfs/drivers/scsi/sg.c
612 --- linux-2.6.17/drivers/scsi/sg.c 2006-06-17 18:49:35.000000000 -0700
613 +++ linux-2.6.17-devfs/drivers/scsi/sg.c 2006-08-25 11:06:18.000000000 -0700
614 @@ -44,6 +44,7 @@
615 #include <linux/poll.h>
616 #include <linux/smp_lock.h>
617 #include <linux/moduleparam.h>
618 +#include <linux/devfs_fs_kernel.h>
619 #include <linux/cdev.h>
620 #include <linux/seq_file.h>
621 #include <linux/blkdev.h>
622 @@ -1427,10 +1428,14 @@
623 k = error;
624 sdp = sg_dev_arr[k];
625
626 + devfs_mk_cdev(MKDEV(SCSI_GENERIC_MAJOR, k),
627 + S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP,
628 + "%s/generic", scsidp->devfs_name);
629 error = cdev_add(cdev, MKDEV(SCSI_GENERIC_MAJOR, k), 1);
630 - if (error)
631 + if (error) {
632 + devfs_remove("%s/generic", scsidp->devfs_name);
633 goto out;
634 -
635 + }
636 sdp->cdev = cdev;
637 if (sg_sysfs_valid) {
638 struct class_device * sg_class_member;
639 @@ -1520,6 +1525,7 @@
640 class_device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, k));
641 cdev_del(sdp->cdev);
642 sdp->cdev = NULL;
643 + devfs_remove("%s/generic", scsidp->devfs_name);
644 put_disk(sdp->disk);
645 sdp->disk = NULL;
646 if (NULL == sdp->headfp)
647 diff -ur linux-2.6.17/drivers/scsi/sr.c linux-2.6.17-devfs/drivers/scsi/sr.c
648 --- linux-2.6.17/drivers/scsi/sr.c 2006-06-17 18:49:35.000000000 -0700
649 +++ linux-2.6.17-devfs/drivers/scsi/sr.c 2006-08-25 11:06:18.000000000 -0700
650 @@ -592,6 +592,8 @@
651 get_capabilities(cd);
652 sr_vendor_init(cd);
653
654 + snprintf(disk->devfs_name, sizeof(disk->devfs_name),
655 + "%s/cd", sdev->devfs_name);
656 disk->driverfs_dev = &sdev->sdev_gendev;
657 set_capacity(disk, cd->capacity);
658 disk->private_data = &cd->driver;
659 diff -ur linux-2.6.17/drivers/scsi/st.c linux-2.6.17-devfs/drivers/scsi/st.c
660 --- linux-2.6.17/drivers/scsi/st.c 2006-06-17 18:49:35.000000000 -0700
661 +++ linux-2.6.17-devfs/drivers/scsi/st.c 2006-08-25 11:06:18.000000000 -0700
662 @@ -35,6 +35,7 @@
663 #include <linux/spinlock.h>
664 #include <linux/blkdev.h>
665 #include <linux/moduleparam.h>
666 +#include <linux/devfs_fs_kernel.h>
667 #include <linux/cdev.h>
668 #include <linux/delay.h>
669 #include <linux/mutex.h>
670 @@ -4053,8 +4054,23 @@
671 do_create_class_files(tpnt, dev_num, mode);
672 }
673
674 + for (mode = 0; mode < ST_NBR_MODES; ++mode) {
675 + /* Make sure that the minor numbers corresponding to the four
676 + first modes always get the same names */
677 + i = mode << (4 - ST_NBR_MODE_BITS);
678 + /* Rewind entry */
679 + devfs_mk_cdev(MKDEV(SCSI_TAPE_MAJOR, TAPE_MINOR(dev_num, mode, 0)),
680 + S_IFCHR | S_IRUGO | S_IWUGO,
681 + "%s/mt%s", SDp->devfs_name, st_formats[i]);
682 + /* No-rewind entry */
683 + devfs_mk_cdev(MKDEV(SCSI_TAPE_MAJOR, TAPE_MINOR(dev_num, mode, 1)),
684 + S_IFCHR | S_IRUGO | S_IWUGO,
685 + "%s/mt%sn", SDp->devfs_name, st_formats[i]);
686 + }
687 + disk->number = devfs_register_tape(SDp->devfs_name);
688 +
689 sdev_printk(KERN_WARNING, SDp,
690 "Attached scsi tape %s\n", tape_name(tpnt));
691 printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B)\n",
692 tape_name(tpnt), tpnt->try_dio ? "yes" : "no",
693 queue_dma_alignment(SDp->request_queue) + 1);
694 @@ -4106,9 +4122,13 @@
695 scsi_tapes[i] = NULL;
696 st_nr_dev--;
697 write_unlock(&st_dev_arr_lock);
698 + devfs_unregister_tape(tpnt->disk->number);
699 sysfs_remove_link(&tpnt->device->sdev_gendev.kobj,
700 "tape");
701 for (mode = 0; mode < ST_NBR_MODES; ++mode) {
702 + j = mode << (4 - ST_NBR_MODE_BITS);
703 + devfs_remove("%s/mt%s", SDp->devfs_name, st_formats[j]);
704 + devfs_remove("%s/mt%sn", SDp->devfs_name, st_formats[j]);
705 for (j=0; j < 2; j++) {
706 class_device_destroy(st_sysfs_class,
707 MKDEV(SCSI_TAPE_MAJOR,
708 diff -ur linux-2.6.17/include/scsi/scsi_device.h linux-2.6.17-devfs/include/scsi/scsi_device.h
709 --- linux-2.6.17/include/scsi/scsi_device.h 2006-06-17 18:49:35.000000000 -0700
710 +++ linux-2.6.17-devfs/include/scsi/scsi_device.h 2006-08-25 11:06:18.000000000 -0700
711 @@ -74,6 +74,7 @@
712 unsigned sector_size; /* size in bytes */
713
714 void *hostdata; /* available to low-level driver */
715 + char devfs_name[256]; /* devfs junk */
716 char type;
717 char scsi_level;
718 char inq_periph_qual; /* PQ from INQUIRY data */
This page took 0.07018 seconds and 3 git commands to generate.