aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-06-29 17:19:21 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-29 17:19:21 -0400
commit602cada851b28c5792339786efe872fbdc1f5d41 (patch)
tree233d474b74d6038b5bb54a07ad91dd1bb10b0218
parent82991c6f2c361acc17279b8124d9bf1878973435 (diff)
parentfee68d1cc0d9bd863e51c16cdcd707737b16bb38 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/devfs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/devfs-2.6: (22 commits) [PATCH] devfs: Remove it from the feature_removal.txt file [PATCH] devfs: Last little devfs cleanups throughout the kernel tree. [PATCH] devfs: Rename TTY_DRIVER_NO_DEVFS to TTY_DRIVER_DYNAMIC_DEV [PATCH] devfs: Remove the tty_driver devfs_name field as it's no longer needed [PATCH] devfs: Remove the line_driver devfs_name field as it's no longer needed [PATCH] devfs: Remove the videodevice devfs_name field as it's no longer needed [PATCH] devfs: Remove the gendisk devfs_name field as it's no longer needed [PATCH] devfs: Remove the miscdevice devfs_name field as it's no longer needed [PATCH] devfs: Remove the devfs_fs_kernel.h file from the tree [PATCH] devfs: Remove devfs_remove() function from the kernel tree [PATCH] devfs: Remove devfs_mk_cdev() function from the kernel tree [PATCH] devfs: Remove devfs_mk_bdev() function from the kernel tree [PATCH] devfs: Remove devfs_mk_symlink() function from the kernel tree [PATCH] devfs: Remove devfs_mk_dir() function from the kernel tree [PATCH] devfs: Remove devfs_*_tape() functions from the kernel tree [PATCH] devfs: Remove devfs support from the sound subsystem [PATCH] devfs: Remove devfs support from the ide subsystem. [PATCH] devfs: Remove devfs support from the serial subsystem [PATCH] devfs: Remove devfs from the init code [PATCH] devfs: Remove devfs from the partition code ...
-rw-r--r--Documentation/Changes15
-rw-r--r--Documentation/DocBook/kernel-api.tmpl5
-rw-r--r--Documentation/README.DAC9606
-rw-r--r--Documentation/feature-removal-schedule.txt11
-rw-r--r--Documentation/filesystems/devfs/ChangeLog1977
-rw-r--r--Documentation/filesystems/devfs/README1959
-rw-r--r--Documentation/filesystems/devfs/ToDo40
-rw-r--r--Documentation/filesystems/devfs/boot-options65
-rw-r--r--Documentation/initrd.txt24
-rw-r--r--Documentation/ioctl-number.txt1
-rw-r--r--Documentation/kernel-parameters.txt4
-rw-r--r--arch/cris/arch-v10/kernel/debugport.c2
-rw-r--r--arch/cris/arch-v32/kernel/debugport.c2
-rw-r--r--arch/i386/kernel/microcode.c1
-rw-r--r--arch/ppc/4xx_io/serial_sicc.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/sq.c1
-rw-r--r--arch/sparc64/solaris/socksys.c4
-rw-r--r--arch/um/drivers/line.c2
-rw-r--r--arch/um/drivers/ssl.c1
-rw-r--r--arch/um/drivers/stdio_console.c1
-rw-r--r--arch/um/drivers/ubd_kern.c18
-rw-r--r--arch/um/include/line.h1
-rw-r--r--drivers/block/DAC960.c1
-rw-r--r--drivers/block/acsi.c5
-rw-r--r--drivers/block/acsi_slm.c10
-rw-r--r--drivers/block/cciss.c1
-rw-r--r--drivers/block/cpqarray.c5
-rw-r--r--drivers/block/floppy.c55
-rw-r--r--drivers/block/loop.c6
-rw-r--r--drivers/block/nbd.c5
-rw-r--r--drivers/block/paride/pg.c18
-rw-r--r--drivers/block/paride/pt.c21
-rw-r--r--drivers/block/pktcdvd.c1
-rw-r--r--drivers/block/ps2esdi.c1
-rw-r--r--drivers/block/rd.c5
-rw-r--r--drivers/block/swim3.c4
-rw-r--r--drivers/block/sx8.c5
-rw-r--r--drivers/block/ub.c6
-rw-r--r--drivers/block/umem.c1
-rw-r--r--drivers/block/viodasd.c3
-rw-r--r--drivers/block/xd.c1
-rw-r--r--drivers/block/z2ram.c1
-rw-r--r--drivers/cdrom/aztcd.c1
-rw-r--r--drivers/cdrom/cdu31a.c1
-rw-r--r--drivers/cdrom/cm206.c1
-rw-r--r--drivers/cdrom/gscd.c1
-rw-r--r--drivers/cdrom/mcdx.c1
-rw-r--r--drivers/cdrom/optcd.c1
-rw-r--r--drivers/cdrom/sbpcd.c6
-rw-r--r--drivers/cdrom/sjcd.c1
-rw-r--r--drivers/cdrom/sonycd535.c1
-rw-r--r--drivers/cdrom/viocd.c3
-rw-r--r--drivers/char/cyclades.c1
-rw-r--r--drivers/char/dsp56k.c10
-rw-r--r--drivers/char/dtlk.c5
-rw-r--r--drivers/char/epca.c1
-rw-r--r--drivers/char/esp.c1
-rw-r--r--drivers/char/ftape/zftape/zftape-init.c25
-rw-r--r--drivers/char/hvc_console.c1
-rw-r--r--drivers/char/hvcs.c1
-rw-r--r--drivers/char/hvsi.c1
-rw-r--r--drivers/char/ip2/ip2main.c24
-rw-r--r--drivers/char/ipmi/ipmi_devintf.c8
-rw-r--r--drivers/char/isicom.c1
-rw-r--r--drivers/char/istallion.c13
-rw-r--r--drivers/char/lp.c7
-rw-r--r--drivers/char/mem.c6
-rw-r--r--drivers/char/misc.c15
-rw-r--r--drivers/char/mmtimer.c2
-rw-r--r--drivers/char/moxa.c1
-rw-r--r--drivers/char/ppdev.c15
-rw-r--r--drivers/char/pty.c8
-rw-r--r--drivers/char/raw.c15
-rw-r--r--drivers/char/riscom8.c1
-rw-r--r--drivers/char/rocket.c5
-rw-r--r--drivers/char/serial167.c1
-rw-r--r--drivers/char/stallion.c14
-rw-r--r--drivers/char/tipar.c17
-rw-r--r--drivers/char/tty_io.c17
-rw-r--r--drivers/char/vc_screen.c11
-rw-r--r--drivers/char/viocons.c1
-rw-r--r--drivers/char/viotape.c10
-rw-r--r--drivers/char/vme_scc.c1
-rw-r--r--drivers/char/vt.c2
-rw-r--r--drivers/ide/ide-cd.c2
-rw-r--r--drivers/ide/ide-disk.c2
-rw-r--r--drivers/ide/ide-floppy.c1
-rw-r--r--drivers/ide/ide-probe.c11
-rw-r--r--drivers/ide/ide-tape.c12
-rw-r--r--drivers/ide/ide.c10
-rw-r--r--drivers/input/serio/serio_raw.c1
-rw-r--r--drivers/isdn/capi/capi.c5
-rw-r--r--drivers/isdn/gigaset/bas-gigaset.c4
-rw-r--r--drivers/isdn/gigaset/common.c4
-rw-r--r--drivers/isdn/gigaset/gigaset.h3
-rw-r--r--drivers/isdn/gigaset/interface.c6
-rw-r--r--drivers/isdn/gigaset/usb-gigaset.c4
-rw-r--r--drivers/isdn/hardware/eicon/divamnt.c3
-rw-r--r--drivers/isdn/hardware/eicon/divasi.c3
-rw-r--r--drivers/isdn/hardware/eicon/divasmain.c3
-rw-r--r--drivers/isdn/i4l/isdn_tty.c3
-rw-r--r--drivers/macintosh/adb.c3
-rw-r--r--drivers/md/dm-ioctl.c30
-rw-r--r--drivers/md/dm.c2
-rw-r--r--drivers/md/md.c30
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.c13
-rw-r--r--drivers/media/dvb/dvb-core/dvbdev.h1
-rw-r--r--drivers/media/dvb/ttpci/av7110.h4
-rw-r--r--drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c11
-rw-r--r--drivers/media/radio/miropcm20-rds.c1
-rw-r--r--drivers/media/video/arv.c1
-rw-r--r--drivers/media/video/videodev.c8
-rw-r--r--drivers/message/i2o/i2o_block.c1
-rw-r--r--drivers/mmc/mmc_block.c4
-rw-r--r--drivers/net/ppp_generic.c9
-rw-r--r--drivers/net/tun.c1
-rw-r--r--drivers/net/wan/cosa.c14
-rw-r--r--drivers/s390/block/dasd.c4
-rw-r--r--drivers/s390/block/dasd_genhd.c2
-rw-r--r--drivers/s390/block/dasd_int.h1
-rw-r--r--drivers/s390/block/xpram.c6
-rw-r--r--drivers/s390/char/monreader.c1
-rw-r--r--drivers/s390/char/tty3270.c3
-rw-r--r--drivers/s390/crypto/z90main.c1
-rw-r--r--drivers/sbus/char/bpp.c9
-rw-r--r--drivers/sbus/char/vfc.h2
-rw-r--r--drivers/sbus/char/vfc_dev.c7
-rw-r--r--drivers/serial/21285.c1
-rw-r--r--drivers/serial/8250.c1
-rw-r--r--drivers/serial/at91_serial.c1
-rw-r--r--drivers/serial/crisv10.c2
-rw-r--r--drivers/serial/dz.c4
-rw-r--r--drivers/serial/imx.c1
-rw-r--r--drivers/serial/ip22zilog.c1
-rw-r--r--drivers/serial/m32r_sio.c1
-rw-r--r--drivers/serial/mcfserial.c1
-rw-r--r--drivers/serial/mpc52xx_uart.c1
-rw-r--r--drivers/serial/mpsc.c2
-rw-r--r--drivers/serial/pmac_zilog.c1
-rw-r--r--drivers/serial/pxa.c1
-rw-r--r--drivers/serial/s3c2410.c2
-rw-r--r--drivers/serial/sa1100.c1
-rw-r--r--drivers/serial/serial_core.c5
-rw-r--r--drivers/serial/serial_txx9.c3
-rw-r--r--drivers/serial/sh-sci.c3
-rw-r--r--drivers/serial/sunhv.c1
-rw-r--r--drivers/serial/sunsab.c1
-rw-r--r--drivers/serial/sunsu.c1
-rw-r--r--drivers/serial/sunzilog.c1
-rw-r--r--drivers/serial/v850e_uart.c1
-rw-r--r--drivers/serial/vr41xx_siu.c1
-rw-r--r--drivers/tc/zs.c3
-rw-r--r--drivers/telephony/phonedev.c4
-rw-r--r--drivers/usb/class/cdc-acm.c3
-rw-r--r--drivers/usb/gadget/serial.c3
-rw-r--r--drivers/usb/serial/usb-serial.c3
-rw-r--r--drivers/video/fbmem.c5
-rw-r--r--fs/Makefile1
-rw-r--r--fs/block_dev.c1
-rw-r--r--fs/char_dev.c1
-rw-r--r--fs/coda/psdev.c23
-rw-r--r--fs/compat_ioctl.c1
-rw-r--r--fs/devfs/Makefile8
-rw-r--r--fs/devfs/base.c2836
-rw-r--r--fs/devfs/util.c97
-rw-r--r--fs/partitions/Makefile1
-rw-r--r--fs/partitions/check.c32
-rw-r--r--fs/partitions/devfs.c130
-rw-r--r--fs/partitions/devfs.h10
-rw-r--r--include/asm-ppc/ocp.h1
-rw-r--r--include/linux/compat_ioctl.h5
-rw-r--r--include/linux/devfs_fs.h41
-rw-r--r--include/linux/devfs_fs_kernel.h57
-rw-r--r--include/linux/fb.h1
-rw-r--r--include/linux/genhd.h2
-rw-r--r--include/linux/ide.h1
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/tty_driver.h14
-rw-r--r--include/media/v4l2-dev.h1
-rw-r--r--init/Makefile1
-rw-r--r--init/do_mounts.c8
-rw-r--r--init/do_mounts.h16
-rw-r--r--init/do_mounts_devfs.c137
-rw-r--r--init/do_mounts_initrd.c6
-rw-r--r--init/do_mounts_md.c7
-rw-r--r--init/do_mounts_rd.c4
-rw-r--r--init/main.c1
-rw-r--r--mm/shmem.c5
-rw-r--r--mm/tiny-shmem.c4
-rw-r--r--net/bluetooth/rfcomm/tty.c3
-rw-r--r--net/irda/ircomm/ircomm_tty.c1
-rw-r--r--net/irda/irnet/irnet.h1
-rw-r--r--sound/core/info.c1
-rw-r--r--sound/core/sound.c24
-rw-r--r--sound/oss/soundcard.c16
-rw-r--r--sound/sound_core.c6
197 files changed, 96 insertions, 8271 deletions
diff --git a/Documentation/Changes b/Documentation/Changes
index b02f476c2973..488272074c36 100644
--- a/Documentation/Changes
+++ b/Documentation/Changes
@@ -181,8 +181,8 @@ Intel IA32 microcode
181-------------------- 181--------------------
182 182
183A driver has been added to allow updating of Intel IA32 microcode, 183A driver has been added to allow updating of Intel IA32 microcode,
184accessible as both a devfs regular file and as a normal (misc) 184accessible as a normal (misc) character device. If you are not using
185character device. If you are not using devfs you may need to: 185udev you may need to:
186 186
187mkdir /dev/cpu 187mkdir /dev/cpu
188mknod /dev/cpu/microcode c 10 184 188mknod /dev/cpu/microcode c 10 184
@@ -201,7 +201,9 @@ with programs using shared memory.
201udev 201udev
202---- 202----
203udev is a userspace application for populating /dev dynamically with 203udev is a userspace application for populating /dev dynamically with
204only entries for devices actually present. udev replaces devfs. 204only entries for devices actually present. udev replaces the basic
205functionality of devfs, while allowing persistant device naming for
206devices.
205 207
206FUSE 208FUSE
207---- 209----
@@ -231,18 +233,13 @@ The PPP driver has been restructured to support multilink and to
231enable it to operate over diverse media layers. If you use PPP, 233enable it to operate over diverse media layers. If you use PPP,
232upgrade pppd to at least 2.4.0. 234upgrade pppd to at least 2.4.0.
233 235
234If you are not using devfs, you must have the device file /dev/ppp 236If you are not using udev, you must have the device file /dev/ppp
235which can be made by: 237which can be made by:
236 238
237mknod /dev/ppp c 108 0 239mknod /dev/ppp c 108 0
238 240
239as root. 241as root.
240 242
241If you use devfsd and build ppp support as modules, you will need
242the following in your /etc/devfsd.conf file:
243
244LOOKUP PPP MODLOAD
245
246Isdn4k-utils 243Isdn4k-utils
247------------ 244------------
248 245
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index 3630a0d7695f..1ae4dc0fd856 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -348,11 +348,6 @@ X!Earch/i386/kernel/mca.c
348 </sect1> 348 </sect1>
349 </chapter> 349 </chapter>
350 350
351 <chapter id="devfs">
352 <title>The Device File System</title>
353!Efs/devfs/base.c
354 </chapter>
355
356 <chapter id="sysfs"> 351 <chapter id="sysfs">
357 <title>The Filesystem for Exporting Kernel Objects</title> 352 <title>The Filesystem for Exporting Kernel Objects</title>
358!Efs/sysfs/file.c 353!Efs/sysfs/file.c
diff --git a/Documentation/README.DAC960 b/Documentation/README.DAC960
index 98ea617a0dd6..0e8f618ab534 100644
--- a/Documentation/README.DAC960
+++ b/Documentation/README.DAC960
@@ -78,9 +78,9 @@ also known as "System Drives", and Drive Groups are also called "Packs". Both
78terms are in use in the Mylex documentation; I have chosen to standardize on 78terms are in use in the Mylex documentation; I have chosen to standardize on
79the more generic "Logical Drive" and "Drive Group". 79the more generic "Logical Drive" and "Drive Group".
80 80
81DAC960 RAID disk devices are named in the style of the Device File System 81DAC960 RAID disk devices are named in the style of the obsolete Device File
82(DEVFS). The device corresponding to Logical Drive D on Controller C is 82System (DEVFS). The device corresponding to Logical Drive D on Controller C
83referred to as /dev/rd/cCdD, and the partitions are called /dev/rd/cCdDp1 83is referred to as /dev/rd/cCdD, and the partitions are called /dev/rd/cCdDp1
84through /dev/rd/cCdDp7. For example, partition 3 of Logical Drive 5 on 84through /dev/rd/cCdDp7. For example, partition 3 of Logical Drive 5 on
85Controller 2 is referred to as /dev/rd/c2d5p3. Note that unlike with SCSI 85Controller 2 is referred to as /dev/rd/c2d5p3. Note that unlike with SCSI
86disks the device names will not change in the event of a disk drive failure. 86disks the device names will not change in the event of a disk drive failure.
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index b1c6c7036c1c..1cbbb8e28999 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -6,17 +6,6 @@ be removed from this file.
6 6
7--------------------------- 7---------------------------
8 8
9What: devfs
10When: July 2005
11Files: fs/devfs/*, include/linux/devfs_fs*.h and assorted devfs
12 function calls throughout the kernel tree
13Why: It has been unmaintained for a number of years, has unfixable
14 races, contains a naming policy within the kernel that is
15 against the LSB, and can be replaced by using udev.
16Who: Greg Kroah-Hartman <greg@kroah.com>
17
18---------------------------
19
20What: RAW driver (CONFIG_RAW_DRIVER) 9What: RAW driver (CONFIG_RAW_DRIVER)
21When: December 2005 10When: December 2005
22Why: declared obsolete since kernel 2.6.3 11Why: declared obsolete since kernel 2.6.3
diff --git a/Documentation/filesystems/devfs/ChangeLog b/Documentation/filesystems/devfs/ChangeLog
deleted file mode 100644
index e5aba5246d7c..000000000000
--- a/Documentation/filesystems/devfs/ChangeLog
+++ /dev/null
@@ -1,1977 +0,0 @@
1/* -*- auto-fill -*- */
2===============================================================================
3Changes for patch v1
4
5- creation of devfs
6
7- modified miscellaneous character devices to support devfs
8===============================================================================
9Changes for patch v2
10
11- bug fix with manual inode creation
12===============================================================================
13Changes for patch v3
14
15- bugfixes
16
17- documentation improvements
18
19- created a couple of scripts (one to save&restore a devfs and the
20 other to set up compatibility symlinks)
21
22- devfs support for SCSI discs. New name format is: sd_hHcCiIlL
23===============================================================================
24Changes for patch v4
25
26- bugfix for the directory reading code
27
28- bugfix for compilation with kerneld
29
30- devfs support for generic hard discs
31
32- rationalisation of the various watchdog drivers
33===============================================================================
34Changes for patch v5
35
36- support for mounting directly from entries in the devfs (it doesn't
37 need to be mounted to do this), including the root filesystem.
38 Mounting of swap partitions also works. Hence, now if you set
39 CONFIG_DEVFS_ONLY to 'Y' then you won't be able to access your discs
40 via ordinary device nodes. Naturally, the default is 'N' so that you
41 can still use your old device nodes. If you want to mount from devfs
42 entries, make sure you use: append = "root=/dev/sd_..." in your
43 lilo.conf. It seems LILO looks for the device number (major&minor)
44 and writes that into the kernel image :-(
45
46- support for character memory devices (/dev/null, /dev/zero, /dev/full
47 and so on). Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
48===============================================================================
49Changes for patch v6
50
51- support for subdirectories
52
53- support for symbolic links (created by devfs_mk_symlink(), no
54 support yet for creation via symlink(2))
55
56- SCSI disc naming now cast in stone, with the format:
57 /dev/sd/c0b1t2u3 controller=0, bus=1, ID=2, LUN=3, whole disc
58 /dev/sd/c0b1t2u3p4 controller=0, bus=1, ID=2, LUN=3, 4th partition
59
60- loop devices now appear in devfs
61
62- tty devices, console, serial ports, etc. now appear in devfs
63 Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
64
65- bugs with mounting devfs-only devices now fixed
66===============================================================================
67Changes for patch v7
68
69- SCSI CD-ROMS, tapes and generic devices now appear in devfs
70===============================================================================
71Changes for patch v8
72
73- bugfix with no-rewind SCSI tapes
74
75- RAMDISCs now appear in devfs
76
77- better cleaning up of devfs entries created by various modules
78
79- interface change to <devfs_register>
80===============================================================================
81Changes for patch v9
82
83- the v8 patch was corrupted somehow, which would affect the patch for
84 linux/fs/filesystems.c
85 I've also fixed the v8 patch file on the WWW
86
87- MetaDevices (/dev/md*) should now appear in devfs
88===============================================================================
89Changes for patch v10
90
91- bugfix in meta device support for devfs
92
93- created this ChangeLog file
94
95- added devfs support to the floppy driver
96
97- added support for creating sockets in a devfs
98===============================================================================
99Changes for patch v11
100
101- added DEVFS_FL_HIDE_UNREG flag
102
103- incorporated better patch for ttyname() in libc 5.4.43 from H.J. Lu.
104
105- interface change to <devfs_mk_symlink>
106
107- support for creating symlinks with symlink(2)
108
109- parallel port printer (/dev/lp*) now appears in devfs
110===============================================================================
111Changes for patch v12
112
113- added inode check to <devfs_fill_file> function
114
115- improved devfs support when mounting from devfs
116
117- added call to <<release>> operation when removing swap areas on
118 devfs devices
119
120- increased NR_SUPER to 128 to support large numbers of devfs mounts
121 (for chroot(2) gaols)
122
123- fixed bug in SCSI disc support: was generating incorrect minors if
124 SCSI ID's did not start at 0 and increase by 1
125
126- support symlink traversal when mounting root
127===============================================================================
128Changes for patch v13
129
130- added devfs support to soundcard driver
131 Thanks to Eric Dumas <dumas@linux.eu.org> and
132 C. Scott Ananian <cananian@alumni.princeton.edu>
133
134- added devfs support to the joystick driver
135
136- loop driver now has it's own subdirectory "/dev/loop/"
137
138- created <devfs_get_flags> and <devfs_set_flags> functions
139
140- fix problem with SCSI disc compatibility names (sd{a,b,c,d,e,f})
141 which assumes ID's start at 0 and increase by 1. Also only create
142 devfs entries for SCSI disc partitions which actually exist
143 Show new names in partition check
144 Thanks to Jakub Jelinek <jj@sunsite.ms.mff.cuni.cz>
145===============================================================================
146Changes for patch v14
147
148- bug fix in floppy driver: would not compile without
149 CONFIG_DEVFS_FS='Y'
150 Thanks to Jurgen Botz <jbotz@nova.botz.org>
151
152- bug fix in loop driver
153 Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
154
155- do not create devfs entries for printers not configured
156 Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
157
158- do not create devfs entries for serial ports not present
159 Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
160
161- ensure <tty_register_devfs> is exported from tty_io.c
162 Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
163
164- allow unregistering of devfs symlink entries
165
166- fixed bug in SCSI disc naming introduced in last patch version
167===============================================================================
168Changes for patch v15
169
170- ported to kernel 2.1.81
171===============================================================================
172Changes for patch v16
173
174- created <devfs_set_symlink_destination> function
175
176- moved DEVFS_SUPER_MAGIC into header file
177
178- added DEVFS_FL_HIDE flag
179
180- created <devfs_get_maj_min>
181
182- created <devfs_get_handle_from_inode>
183
184- fixed bugs in searching by major&minor
185
186- changed interface to <devfs_unregister>, <devfs_fill_file> and
187 <devfs_find_handle>
188
189- fixed inode times when symlink created with symlink(2)
190
191- change tty driver to do auto-creation of devfs entries
192 Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
193
194- fixed bug in genhd.c: whole disc (non-SCSI) was not registered to
195 devfs
196
197- updated libc 5.4.43 patch for ttyname()
198===============================================================================
199Changes for patch v17
200
201- added CONFIG_DEVFS_TTY_COMPAT
202 Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
203
204- bugfix in devfs support for drivers/char/lp.c
205 Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
206
207- clean up serial driver so that PCMCIA devices unregister correctly
208 Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
209
210- fixed bug in genhd.c: whole disc (non-SCSI) was not registered to
211 devfs [was missing in patch v16]
212
213- updated libc 5.4.43 patch for ttyname() [was missing in patch v16]
214
215- all SCSI devices now registered in /dev/sg
216
217- support removal of devfs entries via unlink(2)
218===============================================================================
219Changes for patch v18
220
221- added floppy/?u720 floppy entry
222
223- fixed kerneld support for entries in devfs subdirectories
224
225- incorporated latest patch for ttyname() in libc 5.4.43 from H.J. Lu.
226===============================================================================
227Changes for patch v19
228
229- bug fix when looking up unregistered entries: kerneld was not called
230
231- fixes for kernel 2.1.86 (now requires 2.1.86)
232===============================================================================
233Changes for patch v20
234
235- only create available floppy entries
236 Thanks to Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>
237
238- new IDE naming scheme following SCSI format (i.e. /dev/id/c0b0t0u0p1
239 instead of /dev/hda1)
240 Thanks to Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>
241
242- new XT disc naming scheme following SCSI format (i.e. /dev/xd/c0t0p1
243 instead of /dev/xda1)
244 Thanks to Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>
245
246- new non-standard CD-ROM names (i.e. /dev/sbp/c#t#)
247 Thanks to Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>
248
249- allow symlink traversal when mounting the root filesystem
250
251- Create entries for MD devices at MD init
252 Thanks to Christophe Leroy <christophe.leroy5@capway.com>
253===============================================================================
254Changes for patch v21
255
256- ported to kernel 2.1.91
257===============================================================================
258Changes for patch v22
259
260- SCSI host number patch ("scsihosts=" kernel option)
261 Thanks to Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>
262===============================================================================
263Changes for patch v23
264
265- Fixed persistence bug with device numbers for manually created
266 device files
267
268- Fixed problem with recreating symlinks with different content
269
270- Added CONFIG_DEVFS_MOUNT (mount devfs on /dev at boot time)
271===============================================================================
272Changes for patch v24
273
274- Switched from CONFIG_KERNELD to CONFIG_KMOD: module autoloading
275 should now work again
276
277- Hide entries which are manually unlinked
278
279- Always invalidate devfs dentry cache when registering entries
280
281- Support removal of devfs directories via rmdir(2)
282
283- Ensure directories created by <devfs_mk_dir> are visible
284
285- Default no access for "other" for floppy device
286===============================================================================
287Changes for patch v25
288
289- Updates to CREDITS file and minor IDE numbering change
290 Thanks to Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>
291
292- Invalidate devfs dentry cache when making directories
293
294- Invalidate devfs dentry cache when removing entries
295
296- More informative message if root FS mount fails when devfs
297 configured
298
299- Fixed persistence bug with fifos
300===============================================================================
301Changes for patch v26
302
303- ported to kernel 2.1.97
304
305- Changed serial directory from "/dev/serial" to "/dev/tts" and
306 "/dev/consoles" to "/dev/vc" to be more friendly to new procps
307===============================================================================
308Changes for patch v27
309
310- Added support for IDE4 and IDE5
311 Thanks to Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>
312
313- Documented "scsihosts=" boot parameter
314
315- Print process command when debugging kerneld/kmod
316
317- Added debugging for register/unregister/change operations
318
319- Added "devfs=" boot options
320
321- Hide unregistered entries by default
322===============================================================================
323Changes for patch v28
324
325- No longer lock/unlock superblock in <devfs_put_super> (cope with
326 recent VFS interface change)
327
328- Do not automatically change ownership/protection of /dev/tty
329
330- Drop negative dentries when they are released
331
332- Manage dcache more efficiently
333===============================================================================
334Changes for patch v29
335
336- Added DEVFS_FL_AUTO_DEVNUM flag
337===============================================================================
338Changes for patch v30
339
340- No longer set unnecessary methods
341
342- Ported to kernel 2.1.99-pre3
343===============================================================================
344Changes for patch v31
345
346- Added PID display to <call_kerneld> debugging message
347
348- Added "diread" and "diwrite" options
349
350- Ported to kernel 2.1.102
351
352- Fixed persistence problem with permissions
353===============================================================================
354Changes for patch v32
355
356- Fixed devfs support in drivers/block/md.c
357===============================================================================
358Changes for patch v33
359
360- Support legacy device nodes
361
362- Fixed bug where recreated inodes were hidden
363
364- New IDE naming scheme: everything is under /dev/ide
365===============================================================================
366Changes for patch v34
367
368- Improved debugging in <get_vfs_inode>
369
370- Prevent duplicate calls to <devfs_mk_dir> in SCSI layer
371
372- No longer free old dentries in <devfs_mk_dir>
373
374- Free all dentries for a given entry when deleting inodes
375===============================================================================
376Changes for patch v35
377
378- Ported to kernel 2.1.105 (sound driver changes)
379===============================================================================
380Changes for patch v36
381
382- Fixed sound driver port
383===============================================================================
384Changes for patch v37
385
386- Minor documentation tweaks
387===============================================================================
388Changes for patch v38
389
390- More documentation tweaks
391
392- Fix for sound driver port
393
394- Removed ttyname-patch (grab libc 5.4.44 instead)
395
396- Ported to kernel 2.1.107-pre2 (loop driver fix)
397===============================================================================
398Changes for patch v39
399
400- Ported to kernel 2.1.107 (hd.c hunk broke due to spelling "fixes"). Sigh
401
402- Removed many #ifdef's, replaced with trickery in include/devfs_fs.h
403===============================================================================
404Changes for patch v40
405
406- Fix for sound driver port
407
408- Limit auto-device numbering to majors 128 to 239
409===============================================================================
410Changes for patch v41
411
412- Fixed inode times persistence problem
413===============================================================================
414Changes for patch v42
415
416- Ported to kernel 2.1.108 (drivers/scsi/hosts.c hunk broke)
417===============================================================================
418Changes for patch v43
419
420- Fixed spelling in <devfs_readlink> debug
421
422- Fixed bug in <devfs_setup> parsing "dilookup"
423
424- More #ifdef's removed
425
426- Supported Sparc keyboard (/dev/kbd)
427
428- Supported DSP56001 digital signal processor (/dev/dsp56k)
429
430- Supported Apple Desktop Bus (/dev/adb)
431
432- Supported Coda network file system (/dev/cfs*)
433===============================================================================
434Changes for patch v44
435
436- Fixed devfs inode leak when manually recreating inodes
437
438- Fixed permission persistence problem when recreating inodes
439===============================================================================
440Changes for patch v45
441
442- Ported to kernel 2.1.110
443===============================================================================
444Changes for patch v46
445
446- Ported to kernel 2.1.112-pre1
447
448- Removed harmless "unused variable" compiler warning
449
450- Fixed modes for manually recreated device nodes
451===============================================================================
452Changes for patch v47
453
454- Added NULL devfs inode warning in <devfs_read_inode>
455
456- Force all inode nlink values to 1
457===============================================================================
458Changes for patch v48
459
460- Added "dimknod" option
461
462- Set inode nlink to 0 when freeing dentries
463
464- Added support for virtual console capture devices (/dev/vcs*)
465 Thanks to Dennis Hou <smilax@mindmeld.yi.org>
466
467- Fixed modes for manually recreated symlinks
468===============================================================================
469Changes for patch v49
470
471- Ported to kernel 2.1.113
472===============================================================================
473Changes for patch v50
474
475- Fixed bugs in recreated directories and symlinks
476===============================================================================
477Changes for patch v51
478
479- Improved robustness of rc.devfs script
480 Thanks to Roderich Schupp <rsch@experteam.de>
481
482- Fixed bugs in recreated device nodes
483
484- Fixed bug in currently unused <devfs_get_handle_from_inode>
485
486- Defined new <devfs_handle_t> type
487
488- Improved debugging when getting entries
489
490- Fixed bug where directories could be emptied
491
492- Ported to kernel 2.1.115
493===============================================================================
494Changes for patch v52
495
496- Replaced dummy .epoch inode with .devfsd character device
497
498- Modified rc.devfs to take account of above change
499
500- Removed spurious driver warning messages when CONFIG_DEVFS_FS=n
501
502- Implemented devfsd protocol revision 0
503===============================================================================
504Changes for patch v53
505
506- Ported to kernel 2.1.116 (kmod change broke hunk)
507
508- Updated Documentation/Configure.help
509
510- Test and tty pattern patch for rc.devfs script
511 Thanks to Roderich Schupp <rsch@experteam.de>
512
513- Added soothing message to warning in <devfs_d_iput>
514===============================================================================
515Changes for patch v54
516
517- Ported to kernel 2.1.117
518
519- Fixed default permissions in sound driver
520
521- Added support for frame buffer devices (/dev/fb*)
522===============================================================================
523Changes for patch v55
524
525- Ported to kernel 2.1.119
526
527- Use GCC extensions for structure initialisations
528
529- Implemented async open notification
530
531- Incremented devfsd protocol revision to 1
532===============================================================================
533Changes for patch v56
534
535- Ported to kernel 2.1.120-pre3
536
537- Moved async open notification to end of <devfs_open>
538===============================================================================
539Changes for patch v57
540
541- Ported to kernel 2.1.121
542
543- Prepended "/dev/" to module load request
544
545- Renamed <call_kerneld> to <call_kmod>
546
547- Created sample modules.conf file
548===============================================================================
549Changes for patch v58
550
551- Fixed typo "AYSNC" -> "ASYNC"
552===============================================================================
553Changes for patch v59
554
555- Added open flag for files
556===============================================================================
557Changes for patch v60
558
559- Ported to kernel 2.1.123-pre2
560===============================================================================
561Changes for patch v61
562
563- Set i_blocks=0 and i_blksize=1024 in <devfs_read_inode>
564===============================================================================
565Changes for patch v62
566
567- Ported to kernel 2.1.123
568===============================================================================
569Changes for patch v63
570
571- Ported to kernel 2.1.124-pre2
572===============================================================================
573Changes for patch v64
574
575- Fixed Unix98 pty support
576
577- Increased buffer size in <get_partition_list> to avoid crash and
578 burn
579===============================================================================
580Changes for patch v65
581
582- More Unix98 pty support fixes
583
584- Added test for empty <<name>> in <devfs_find_handle>
585
586- Renamed <generate_path> to <devfs_generate_path> and published
587
588- Created /dev/root symlink
589 Thanks to Roderich Schupp <rsch@ExperTeam.de>
590 with further modifications by me
591===============================================================================
592Changes for patch v66
593
594- Yet more Unix98 pty support fixes (now tested)
595
596- Created <devfs_get_fops>
597
598- Support media change checks when CONFIG_DEVFS_ONLY=y
599
600- Abolished Unix98-style PTY names for old PTY devices
601===============================================================================
602Changes for patch v67
603
604- Added inline declaration for dummy <devfs_generate_path>
605
606- Removed spurious "unable to register... in devfs" messages when
607 CONFIG_DEVFS_FS=n
608
609- Fixed misc. devices when CONFIG_DEVFS_FS=n
610
611- Limit auto-device numbering to majors 144 to 239
612===============================================================================
613Changes for patch v68
614
615- Hide unopened virtual consoles from directory listings
616
617- Added support for video capture devices
618
619- Ported to kernel 2.1.125
620===============================================================================
621Changes for patch v69
622
623- Fix for CONFIG_VT=n
624===============================================================================
625Changes for patch v70
626
627- Added support for non-OSS/Free sound cards
628===============================================================================
629Changes for patch v71
630
631- Ported to kernel 2.1.126-pre2
632===============================================================================
633Changes for patch v72
634
635- #ifdef's for CONFIG_DEVFS_DISABLE_OLD_NAMES removed
636===============================================================================
637Changes for patch v73
638
639- CONFIG_DEVFS_DISABLE_OLD_NAMES replaced with "nocompat" boot option
640
641- CONFIG_DEVFS_BOOT_OPTIONS removed: boot options always available
642===============================================================================
643Changes for patch v74
644
645- Removed CONFIG_DEVFS_MOUNT and "mount" boot option and replaced with
646 "nomount" boot option
647
648- Documentation updates
649
650- Updated sample modules.conf
651===============================================================================
652Changes for patch v75
653
654- Updated sample modules.conf
655
656- Remount devfs after initrd finishes
657
658- Ported to kernel 2.1.127
659
660- Added support for ISDN
661 Thanks to Christophe Leroy <christophe.leroy5@capway.com>
662===============================================================================
663Changes for patch v76
664
665- Updated an email address in ChangeLog
666
667- CONFIG_DEVFS_ONLY replaced with "only" boot option
668===============================================================================
669Changes for patch v77
670
671- Added DEVFS_FL_REMOVABLE flag
672
673- Check for disc change when listing directories with removable media
674 devices
675
676- Use DEVFS_FL_REMOVABLE in sd.c
677
678- Ported to kernel 2.1.128
679===============================================================================
680Changes for patch v78
681
682- Only call <scan_dir_for_removable> on first call to <devfs_readdir>
683
684- Ported to kernel 2.1.129-pre5
685
686- ISDN support improvements
687 Thanks to Christophe Leroy <christophe.leroy5@capway.com>
688===============================================================================
689Changes for patch v79
690
691- Ported to kernel 2.1.130
692
693- Renamed miscdevice "apm" to "apm_bios" to be consistent with
694 devices.txt
695===============================================================================
696Changes for patch v80
697
698- Ported to kernel 2.1.131
699
700- Updated <devfs_rmdir> for VFS change in 2.1.131
701===============================================================================
702Changes for patch v81
703
704- Fixed permissions on /dev/ptmx
705===============================================================================
706Changes for patch v82
707
708- Ported to kernel 2.1.132-pre4
709
710- Changed initial permissions on /dev/pts/*
711
712- Created <devfs_mk_compat>
713
714- Added "symlinks" boot option
715
716- Changed devfs_register_blkdev() back to register_blkdev() for IDE
717
718- Check for partitions on removable media in <devfs_lookup>
719===============================================================================
720Changes for patch v83
721
722- Fixed support for ramdisc when using string-based root FS name
723
724- Ported to kernel 2.2.0-pre1
725===============================================================================
726Changes for patch v84
727
728- Ported to kernel 2.2.0-pre7
729===============================================================================
730Changes for patch v85
731
732- Compile fixes for driver/sound/sound_common.c (non-module) and
733 drivers/isdn/isdn_common.c
734 Thanks to Christophe Leroy <christophe.leroy5@capway.com>
735
736- Added support for registering regular files
737
738- Created <devfs_set_file_size>
739
740- Added /dev/cpu/mtrr as an alternative interface to /proc/mtrr
741
742- Update devfs inodes from entries if not changed through FS
743===============================================================================
744Changes for patch v86
745
746- Ported to kernel 2.2.0-pre9
747===============================================================================
748Changes for patch v87
749
750- Fixed bug when mounting non-devfs devices in a devfs
751===============================================================================
752Changes for patch v88
753
754- Fixed <devfs_fill_file> to only initialise temporary inodes
755
756- Trap for NULL fops in <devfs_register>
757
758- Return -ENODEV in <devfs_fill_file> for non-driver inodes
759
760- Fixed bug when unswapping non-devfs devices in a devfs
761===============================================================================
762Changes for patch v89
763
764- Switched to C data types in include/linux/devfs_fs.h
765
766- Switched from PATH_MAX to DEVFS_PATHLEN
767
768- Updated Documentation/filesystems/devfs/modules.conf to take account
769 of reverse scanning (!) by modprobe
770
771- Ported to kernel 2.2.0
772===============================================================================
773Changes for patch v90
774
775- CONFIG_DEVFS_DISABLE_OLD_TTY_NAMES replaced with "nottycompat" boot
776 option
777
778- CONFIG_DEVFS_TTY_COMPAT removed: existing "symlinks" boot option now
779 controls this. This means you must have libc 5.4.44 or later, or a
780 recent version of libc 6 if you use the "symlinks" option
781===============================================================================
782Changes for patch v91
783
784- Switch from <devfs_mk_symlink> to <devfs_mk_compat> in
785 drivers/char/vc_screen.c to fix problems with Midnight Commander
786===============================================================================
787Changes for patch v92
788
789- Ported to kernel 2.2.2-pre5
790===============================================================================
791Changes for patch v93
792
793- Modified <sd_name> in drivers/scsi/sd.c to cope with devices that
794 don't exist (which happens with new RAID autostart code printk()s)
795===============================================================================
796Changes for patch v94
797
798- Fixed bug in joystick driver: only first joystick was registered
799===============================================================================
800Changes for patch v95
801
802- Fixed another bug in joystick driver
803
804- Fixed <devfsd_read> to not overrun event buffer
805===============================================================================
806Changes for patch v96
807
808- Ported to kernel 2.2.5-2
809
810- Created <devfs_auto_unregister>
811
812- Fixed bugs: compatibility entries were not unregistered for:
813 loop driver
814 floppy driver
815 RAMDISC driver
816 IDE tape driver
817 SCSI CD-ROM driver
818 SCSI HDD driver
819===============================================================================
820Changes for patch v97
821
822- Fixed bugs: compatibility entries were not unregistered for:
823 ALSA sound driver
824 partitions in generic disc driver
825
826- Don't return unregistred entries in <devfs_find_handle>
827
828- Panic in <devfs_unregister> if entry unregistered
829
830- Don't panic in <devfs_auto_unregister> for duplicates
831===============================================================================
832Changes for patch v98
833
834- Don't unregister already unregistered entries in <unregister>
835
836- Register entry in <sd_detect>
837
838- Unregister entry in <sd_detach>
839
840- Changed to <devfs_*register_chrdev> in drivers/char/tty_io.c
841
842- Ported to kernel 2.2.7
843===============================================================================
844Changes for patch v99
845
846- Ported to kernel 2.2.8
847
848- Fixed bug in drivers/scsi/sd.c when >16 SCSI discs
849
850- Disable warning messages when unable to read partition table for
851 removable media
852===============================================================================
853Changes for patch v100
854
855- Ported to kernel 2.3.1-pre5
856
857- Added "oops-on-panic" boot option
858
859- Improved debugging in <devfs_register> and <devfs_unregister>
860
861- Register entry in <sr_detect>
862
863- Unregister entry in <sr_detach>
864
865- Register entry in <sg_detect>
866
867- Unregister entry in <sg_detach>
868
869- Added support for ALSA drivers
870===============================================================================
871Changes for patch v101
872
873- Ported to kernel 2.3.2
874===============================================================================
875Changes for patch v102
876
877- Update serial driver to register PCMCIA entries
878 Thanks to Roch-Alexandre Nomine-Beguin <roch@samarkand.infini.fr>
879
880- Updated an email address in ChangeLog
881
882- Hide virtual console capture entries from directory listings when
883 corresponding console device is not open
884===============================================================================
885Changes for patch v103
886
887- Ported to kernel 2.3.3
888===============================================================================
889Changes for patch v104
890
891- Added documentation for some functions
892
893- Added "doc" target to fs/devfs/Makefile
894
895- Added "v4l" directory for video4linux devices
896
897- Replaced call to <devfs_unregister> in <sd_detach> with call to
898 <devfs_register_partitions>
899
900- Moved registration for sr and sg drivers from detect() to attach()
901 methods
902
903- Register entries in <st_attach> and unregister in <st_detach>
904
905- Work around IDE driver treating CD-ROM as gendisk
906
907- Use <sed> instead of <tr> in rc.devfs
908
909- Updated ToDo list
910
911- Removed "oops-on-panic" boot option: now always Oops
912===============================================================================
913Changes for patch v105
914
915- Unregister SCSI host from <scsi_host_no_list> in <scsi_unregister>
916 Thanks to Zolt�n B�sz�rm�nyi <zboszor@mail.externet.hu>
917
918- Don't save /dev/log in rc.devfs
919
920- Ported to kernel 2.3.4-pre1
921===============================================================================
922Changes for patch v106
923
924- Fixed silly typo in drivers/scsi/st.c
925
926- Improved debugging in <devfs_register>
927===============================================================================
928Changes for patch v107
929
930- Added "diunlink" and "nokmod" boot options
931
932- Removed superfluous warning message in <devfs_d_iput>
933===============================================================================
934Changes for patch v108
935
936- Remove entries when unloading sound module
937===============================================================================
938Changes for patch v109
939
940- Ported to kernel 2.3.6-pre2
941===============================================================================
942Changes for patch v110
943
944- Took account of change to <d_alloc_root>
945===============================================================================
946Changes for patch v111
947
948- Created separate event queue for each mounted devfs
949
950- Removed <devfs_invalidate_dcache>
951
952- Created new ioctl()s for devfsd
953
954- Incremented devfsd protocol revision to 3
955
956- Fixed bug when re-creating directories: contents were lost
957
958- Block access to inodes until devfsd updates permissions
959===============================================================================
960Changes for patch v112
961
962- Modified patch so it applies against 2.3.5 and 2.3.6
963
964- Updated an email address in ChangeLog
965
966- Do not automatically change ownership/protection of /dev/tty<n>
967
968- Updated sample modules.conf
969
970- Switched to sending process uid/gid to devfsd
971
972- Renamed <call_kmod> to <try_modload>
973
974- Added DEVFSD_NOTIFY_LOOKUP event
975
976- Added DEVFSD_NOTIFY_CHANGE event
977
978- Added DEVFSD_NOTIFY_CREATE event
979
980- Incremented devfsd protocol revision to 4
981
982- Moved kernel-specific stuff to include/linux/devfs_fs_kernel.h
983===============================================================================
984Changes for patch v113
985
986- Ported to kernel 2.3.9
987
988- Restricted permissions on some block devices
989===============================================================================
990Changes for patch v114
991
992- Added support for /dev/netlink
993 Thanks to Dennis Hou <smilax@mindmeld.yi.org>
994
995- Return EISDIR rather than EINVAL for read(2) on directories
996
997- Ported to kernel 2.3.10
998===============================================================================
999Changes for patch v115
1000
1001- Added support for all remaining character devices
1002 Thanks to Dennis Hou <smilax@mindmeld.yi.org>
1003
1004- Cleaned up netlink support
1005===============================================================================
1006Changes for patch v116
1007
1008- Added support for /dev/parport%d
1009 Thanks to Tim Waugh <tim@cyberelk.demon.co.uk>
1010
1011- Fixed parallel port ATAPI tape driver
1012
1013- Fixed Atari SLM laser printer driver
1014===============================================================================
1015Changes for patch v117
1016
1017- Added support for COSA card
1018 Thanks to Dennis Hou <smilax@mindmeld.yi.org>
1019
1020- Fixed drivers/char/ppdev.c: missing #include <linux/init.h>
1021
1022- Fixed drivers/char/ftape/zftape/zftape-init.c
1023 Thanks to Vladimir Popov <mashgrad@usa.net>
1024===============================================================================
1025Changes for patch v118
1026
1027- Ported to kernel 2.3.15-pre3
1028
1029- Fixed bug in loop driver
1030
1031- Unregister /dev/lp%d entries in drivers/char/lp.c
1032 Thanks to Maciej W. Rozycki <macro@ds2.pg.gda.pl>
1033===============================================================================
1034Changes for patch v119
1035
1036- Ported to kernel 2.3.16
1037===============================================================================
1038Changes for patch v120
1039
1040- Fixed bug in drivers/scsi/scsi.c
1041
1042- Added /dev/ppp
1043 Thanks to Dennis Hou <smilax@mindmeld.yi.org>
1044
1045- Ported to kernel 2.3.17
1046===============================================================================
1047Changes for patch v121
1048
1049- Fixed bug in drivers/block/loop.c
1050
1051- Ported to kernel 2.3.18
1052===============================================================================
1053Changes for patch v122
1054
1055- Ported to kernel 2.3.19
1056===============================================================================
1057Changes for patch v123
1058
1059- Ported to kernel 2.3.20
1060===============================================================================
1061Changes for patch v124
1062
1063- Ported to kernel 2.3.21
1064===============================================================================
1065Changes for patch v125
1066
1067- Created <devfs_get_info>, <devfs_set_info>,
1068 <devfs_get_first_child> and <devfs_get_next_sibling>
1069 Added <<dir>> parameter to <devfs_register>, <devfs_mk_compat>,
1070 <devfs_mk_dir> and <devfs_find_handle>
1071 Work sponsored by SGI
1072
1073- Fixed apparent bug in COSA driver
1074
1075- Re-instated "scsihosts=" boot option
1076===============================================================================
1077Changes for patch v126
1078
1079- Always create /dev/pts if CONFIG_UNIX98_PTYS=y
1080
1081- Fixed call to <devfs_mk_dir> in drivers/block/ide-disk.c
1082 Thanks to Dennis Hou <smilax@mindmeld.yi.org>
1083
1084- Allow multiple unregistrations
1085
1086- Created /dev/scsi hierarchy
1087 Work sponsored by SGI
1088===============================================================================
1089Changes for patch v127
1090
1091Work sponsored by SGI
1092
1093- No longer disable devpts if devfs enabled (caveat emptor)
1094
1095- Added flags array to struct gendisk and removed code from
1096 drivers/scsi/sd.c
1097
1098- Created /dev/discs hierarchy
1099===============================================================================
1100Changes for patch v128
1101
1102Work sponsored by SGI
1103
1104- Created /dev/cdroms hierarchy
1105===============================================================================
1106Changes for patch v129
1107
1108Work sponsored by SGI
1109
1110- Removed compatibility entries for sound devices
1111
1112- Removed compatibility entries for printer devices
1113
1114- Removed compatibility entries for video4linux devices
1115
1116- Removed compatibility entries for parallel port devices
1117
1118- Removed compatibility entries for frame buffer devices
1119===============================================================================
1120Changes for patch v130
1121
1122Work sponsored by SGI
1123
1124- Added major and minor number to devfsd protocol
1125
1126- Incremented devfsd protocol revision to 5
1127
1128- Removed compatibility entries for SoundBlaster CD-ROMs
1129
1130- Removed compatibility entries for netlink devices
1131
1132- Removed compatibility entries for SCSI generic devices
1133
1134- Removed compatibility entries for SCSI tape devices
1135===============================================================================
1136Changes for patch v131
1137
1138Work sponsored by SGI
1139
1140- Support info pointer for all devfs entry types
1141
1142- Added <<info>> parameter to <devfs_mk_dir> and <devfs_mk_symlink>
1143
1144- Removed /dev/st hierarchy
1145
1146- Removed /dev/sg hierarchy
1147
1148- Removed compatibility entries for loop devices
1149
1150- Removed compatibility entries for IDE tape devices
1151
1152- Removed compatibility entries for SCSI CD-ROMs
1153
1154- Removed /dev/sr hierarchy
1155===============================================================================
1156Changes for patch v132
1157
1158Work sponsored by SGI
1159
1160- Removed compatibility entries for floppy devices
1161
1162- Removed compatibility entries for RAMDISCs
1163
1164- Removed compatibility entries for meta-devices
1165
1166- Removed compatibility entries for SCSI discs
1167
1168- Created <devfs_make_root>
1169
1170- Removed /dev/sd hierarchy
1171
1172- Support "../" when searching devfs namespace
1173
1174- Created /dev/ide/host* hierarchy
1175
1176- Supported IDE hard discs in /dev/ide/host* hierarchy
1177
1178- Removed compatibility entries for IDE discs
1179
1180- Removed /dev/ide/hd hierarchy
1181
1182- Supported IDE CD-ROMs in /dev/ide/host* hierarchy
1183
1184- Removed compatibility entries for IDE CD-ROMs
1185
1186- Removed /dev/ide/cd hierarchy
1187===============================================================================
1188Changes for patch v133
1189
1190Work sponsored by SGI
1191
1192- Created <devfs_get_unregister_slave>
1193
1194- Fixed bug in fs/partitions/check.c when rescanning
1195===============================================================================
1196Changes for patch v134
1197
1198Work sponsored by SGI
1199
1200- Removed /dev/sd, /dev/sr, /dev/st and /dev/sg directories
1201
1202- Removed /dev/ide/hd directory
1203
1204- Exported <devfs_get_parent>
1205
1206- Created <devfs_register_tape> and /dev/tapes hierarchy
1207
1208- Removed /dev/ide/mt hierarchy
1209
1210- Removed /dev/ide/fd hierarchy
1211
1212- Ported to kernel 2.3.25
1213===============================================================================
1214Changes for patch v135
1215
1216Work sponsored by SGI
1217
1218- Removed compatibility entries for virtual console capture devices
1219
1220- Removed unused <devfs_set_symlink_destination>
1221
1222- Removed compatibility entries for serial devices
1223
1224- Removed compatibility entries for console devices
1225
1226- Do not hide entries from devfsd or children
1227
1228- Removed DEVFS_FL_TTY_COMPAT flag
1229
1230- Removed "nottycompat" boot option
1231
1232- Removed <devfs_mk_compat>
1233===============================================================================
1234Changes for patch v136
1235
1236Work sponsored by SGI
1237
1238- Moved BSD pty devices to /dev/pty
1239
1240- Added DEVFS_FL_WAIT flag
1241===============================================================================
1242Changes for patch v137
1243
1244Work sponsored by SGI
1245
1246- Really fixed bug in fs/partitions/check.c when rescanning
1247
1248- Support new "disc" naming scheme in <get_removable_partition>
1249
1250- Allow NULL fops in <devfs_register>
1251
1252- Removed redundant name functions in SCSI disc and IDE drivers
1253===============================================================================
1254Changes for patch v138
1255
1256Work sponsored by SGI
1257
1258- Fixed old bugs in drivers/block/paride/pt.c, drivers/char/tpqic02.c,
1259 drivers/net/wan/cosa.c and drivers/scsi/scsi.c
1260 Thanks to Sergey Kubushin <ksi@ksi-linux.com>
1261
1262- Fall back to major table if NULL fops given to <devfs_register>
1263===============================================================================
1264Changes for patch v139
1265
1266Work sponsored by SGI
1267
1268- Corrected and moved <get_blkfops> and <get_chrfops> declarations
1269 from arch/alpha/kernel/osf_sys.c to include/linux/fs.h
1270
1271- Removed name function from struct gendisk
1272
1273- Updated devfs FAQ
1274===============================================================================
1275Changes for patch v140
1276
1277Work sponsored by SGI
1278
1279- Ported to kernel 2.3.27
1280===============================================================================
1281Changes for patch v141
1282
1283Work sponsored by SGI
1284
1285- Bug fix in arch/m68k/atari/joystick.c
1286
1287- Moved ISDN and capi devices to /dev/isdn
1288===============================================================================
1289Changes for patch v142
1290
1291Work sponsored by SGI
1292
1293- Bug fix in drivers/block/ide-probe.c (patch confusion)
1294===============================================================================
1295Changes for patch v143
1296
1297Work sponsored by SGI
1298
1299- Bug fix in drivers/block/blkpg.c:partition_name()
1300===============================================================================
1301Changes for patch v144
1302
1303Work sponsored by SGI
1304
1305- Ported to kernel 2.3.29
1306
1307- Removed calls to <devfs_register> from cdu31a, cm206, mcd and mcdx
1308 CD-ROM drivers: generic driver handles this now
1309
1310- Moved joystick devices to /dev/joysticks
1311===============================================================================
1312Changes for patch v145
1313
1314Work sponsored by SGI
1315
1316- Ported to kernel 2.3.30-pre3
1317
1318- Register whole-disc entry even for invalid partition tables
1319
1320- Fixed bug in mounting root FS when initrd enabled
1321
1322- Fixed device entry leak with IDE CD-ROMs
1323
1324- Fixed compile problem with drivers/isdn/isdn_common.c
1325
1326- Moved COSA devices to /dev/cosa
1327
1328- Support fifos when unregistering
1329
1330- Created <devfs_register_series> and used in many drivers
1331
1332- Moved Coda devices to /dev/coda
1333
1334- Moved parallel port IDE tapes to /dev/pt
1335
1336- Moved parallel port IDE generic devices to /dev/pg
1337===============================================================================
1338Changes for patch v146
1339
1340Work sponsored by SGI
1341
1342- Removed obsolete DEVFS_FL_COMPAT and DEVFS_FL_TOLERANT flags
1343
1344- Fixed compile problem with fs/coda/psdev.c
1345
1346- Reinstate change to <devfs_register_blkdev> in
1347 drivers/block/ide-probe.c now that fs/isofs/inode.c is fixed
1348
1349- Switched to <devfs_register_blkdev> in drivers/block/floppy.c,
1350 drivers/scsi/sr.c and drivers/block/md.c
1351
1352- Moved DAC960 devices to /dev/dac960
1353===============================================================================
1354Changes for patch v147
1355
1356Work sponsored by SGI
1357
1358- Ported to kernel 2.3.32-pre4
1359===============================================================================
1360Changes for patch v148
1361
1362Work sponsored by SGI
1363
1364- Removed kmod support: use devfsd instead
1365
1366- Moved miscellaneous character devices to /dev/misc
1367===============================================================================
1368Changes for patch v149
1369
1370Work sponsored by SGI
1371
1372- Ensure include/linux/joystick.h is OK for user-space
1373
1374- Improved debugging in <get_vfs_inode>
1375
1376- Ensure dentries created by devfsd will be cleaned up
1377===============================================================================
1378Changes for patch v150
1379
1380Work sponsored by SGI
1381
1382- Ported to kernel 2.3.34
1383===============================================================================
1384Changes for patch v151
1385
1386Work sponsored by SGI
1387
1388- Ported to kernel 2.3.35-pre1
1389
1390- Created <devfs_get_name>
1391===============================================================================
1392Changes for patch v152
1393
1394Work sponsored by SGI
1395
1396- Updated sample modules.conf
1397
1398- Ported to kernel 2.3.36-pre1
1399===============================================================================
1400Changes for patch v153
1401
1402Work sponsored by SGI
1403
1404- Ported to kernel 2.3.42
1405
1406- Removed <devfs_fill_file>
1407===============================================================================
1408Changes for patch v154
1409
1410Work sponsored by SGI
1411
1412- Took account of device number changes for /dev/fb*
1413===============================================================================
1414Changes for patch v155
1415
1416Work sponsored by SGI
1417
1418- Ported to kernel 2.3.43-pre8
1419
1420- Moved /dev/tty0 to /dev/vc/0
1421
1422- Moved sequence number formatting from <_tty_make_name> to drivers
1423===============================================================================
1424Changes for patch v156
1425
1426Work sponsored by SGI
1427
1428- Fixed breakage in drivers/scsi/sd.c due to recent SCSI changes
1429===============================================================================
1430Changes for patch v157
1431
1432Work sponsored by SGI
1433
1434- Ported to kernel 2.3.45
1435===============================================================================
1436Changes for patch v158
1437
1438Work sponsored by SGI
1439
1440- Ported to kernel 2.3.46-pre2
1441===============================================================================
1442Changes for patch v159
1443
1444Work sponsored by SGI
1445
1446- Fixed drivers/block/md.c
1447 Thanks to Mike Galbraith <mikeg@weiden.de>
1448
1449- Documentation fixes
1450
1451- Moved device registration from <lp_init> to <lp_register>
1452 Thanks to Tim Waugh <twaugh@redhat.com>
1453===============================================================================
1454Changes for patch v160
1455
1456Work sponsored by SGI
1457
1458- Fixed drivers/char/joystick/joystick.c
1459 Thanks to Vojtech Pavlik <vojtech@suse.cz>
1460
1461- Documentation updates
1462
1463- Fixed arch/i386/kernel/mtrr.c if procfs and devfs not enabled
1464
1465- Fixed drivers/char/stallion.c
1466===============================================================================
1467Changes for patch v161
1468
1469Work sponsored by SGI
1470
1471- Remove /dev/ide when ide-mod is unloaded
1472
1473- Fixed bug in drivers/block/ide-probe.c when secondary but no primary
1474
1475- Added DEVFS_FL_NO_PERSISTENCE flag
1476
1477- Used new DEVFS_FL_NO_PERSISTENCE flag for Unix98 pty slaves
1478
1479- Removed unnecessary call to <update_devfs_inode_from_entry> in
1480 <devfs_readdir>
1481
1482- Only set auto-ownership for /dev/pty/s*
1483===============================================================================
1484Changes for patch v162
1485
1486Work sponsored by SGI
1487
1488- Set inode->i_size to correct size for symlinks
1489 Thanks to Jeremy Fitzhardinge <jeremy@goop.org>
1490
1491- Only give lookup() method to directories to comply with new VFS
1492 assumptions
1493
1494- Remove unnecessary tests in symlink methods
1495
1496- Don't kill existing block ops in <devfs_read_inode>
1497
1498- Restore auto-ownership for /dev/pty/m*
1499===============================================================================
1500Changes for patch v163
1501
1502Work sponsored by SGI
1503
1504- Don't create missing directories in <devfs_find_handle>
1505
1506- Removed Documentation/filesystems/devfs/mk-devlinks
1507
1508- Updated Documentation/filesystems/devfs/README
1509===============================================================================
1510Changes for patch v164
1511
1512Work sponsored by SGI
1513
1514- Fixed CONFIG_DEVFS breakage in drivers/char/serial.c introduced in
1515 linux-2.3.99-pre6-7
1516===============================================================================
1517Changes for patch v165
1518
1519Work sponsored by SGI
1520
1521- Ported to kernel 2.3.99-pre6
1522===============================================================================
1523Changes for patch v166
1524
1525Work sponsored by SGI
1526
1527- Added CONFIG_DEVFS_MOUNT
1528===============================================================================
1529Changes for patch v167
1530
1531Work sponsored by SGI
1532
1533- Updated Documentation/filesystems/devfs/README
1534
1535- Updated sample modules.conf
1536===============================================================================
1537Changes for patch v168
1538
1539Work sponsored by SGI
1540
1541- Disabled multi-mount capability (use VFS bindings instead)
1542
1543- Updated README from master HTML file
1544===============================================================================
1545Changes for patch v169
1546
1547Work sponsored by SGI
1548
1549- Removed multi-mount code
1550
1551- Removed compatibility macros: VFS has changed too much
1552===============================================================================
1553Changes for patch v170
1554
1555Work sponsored by SGI
1556
1557- Updated README from master HTML file
1558
1559- Merged devfs inode into devfs entry
1560===============================================================================
1561Changes for patch v171
1562
1563Work sponsored by SGI
1564
1565- Updated sample modules.conf
1566
1567- Removed dead code in <devfs_register> which used to call
1568 <free_dentries>
1569
1570- Ported to kernel 2.4.0-test2-pre3
1571===============================================================================
1572Changes for patch v172
1573
1574Work sponsored by SGI
1575
1576- Changed interface to <devfs_register>
1577
1578- Changed interface to <devfs_register_series>
1579===============================================================================
1580Changes for patch v173
1581
1582Work sponsored by SGI
1583
1584- Simplified interface to <devfs_mk_symlink>
1585
1586- Simplified interface to <devfs_mk_dir>
1587
1588- Simplified interface to <devfs_find_handle>
1589===============================================================================
1590Changes for patch v174
1591
1592Work sponsored by SGI
1593
1594- Updated README from master HTML file
1595===============================================================================
1596Changes for patch v175
1597
1598Work sponsored by SGI
1599
1600- DocBook update for fs/devfs/base.c
1601 Thanks to Tim Waugh <twaugh@redhat.com>
1602
1603- Removed stale fs/tunnel.c (was never used or completed)
1604===============================================================================
1605Changes for patch v176
1606
1607Work sponsored by SGI
1608
1609- Updated ToDo list
1610
1611- Removed sample modules.conf: now distributed with devfsd
1612
1613- Updated README from master HTML file
1614
1615- Ported to kernel 2.4.0-test3-pre4 (which had devfs-patch-v174)
1616===============================================================================
1617Changes for patch v177
1618
1619- Updated README from master HTML file
1620
1621- Documentation cleanups
1622
1623- Ensure <devfs_generate_path> terminates string for root entry
1624 Thanks to Tim Jansen <tim@tjansen.de>
1625
1626- Exported <devfs_get_name> to modules
1627
1628- Make <devfs_mk_symlink> send events to devfsd
1629
1630- Cleaned up option processing in <devfs_setup>
1631
1632- Fixed bugs in handling symlinks: could leak or cause Oops
1633
1634- Cleaned up directory handling by separating fops
1635 Thanks to Alexander Viro <viro@parcelfarce.linux.theplanet.co.uk>
1636===============================================================================
1637Changes for patch v178
1638
1639- Fixed handling of inverted options in <devfs_setup>
1640===============================================================================
1641Changes for patch v179
1642
1643- Adjusted <try_modload> to account for <devfs_generate_path> fix
1644===============================================================================
1645Changes for patch v180
1646
1647- Fixed !CONFIG_DEVFS_FS stub declaration of <devfs_get_info>
1648===============================================================================
1649Changes for patch v181
1650
1651- Answered question posed by Al Viro and removed his comments from <devfs_open>
1652
1653- Moved setting of registered flag after other fields are changed
1654
1655- Fixed race between <devfsd_close> and <devfsd_notify_one>
1656
1657- Global VFS changes added bogus BKL to devfsd_close(): removed
1658
1659- Widened locking in <devfs_readlink> and <devfs_follow_link>
1660
1661- Replaced <devfsd_read> stack usage with <devfsd_ioctl> kmalloc
1662
1663- Simplified locking in <devfsd_ioctl> and fixed memory leak
1664===============================================================================
1665Changes for patch v182
1666
1667- Created <devfs_*alloc_major> and <devfs_*alloc_devnum>
1668
1669- Removed broken devnum allocation and use <devfs_alloc_devnum>
1670
1671- Fixed old devnum leak by calling new <devfs_dealloc_devnum>
1672
1673- Created <devfs_*alloc_unique_number>
1674
1675- Fixed number leak for /dev/cdroms/cdrom%d
1676
1677- Fixed number leak for /dev/discs/disc%d
1678===============================================================================
1679Changes for patch v183
1680
1681- Fixed bug in <devfs_setup> which could hang boot process
1682===============================================================================
1683Changes for patch v184
1684
1685- Documentation typo fix for fs/devfs/util.c
1686
1687- Fixed drivers/char/stallion.c for devfs
1688
1689- Added DEVFSD_NOTIFY_DELETE event
1690
1691- Updated README from master HTML file
1692
1693- Removed #include <asm/segment.h> from fs/devfs/base.c
1694===============================================================================
1695Changes for patch v185
1696
1697- Made <block_semaphore> and <char_semaphore> in fs/devfs/util.c
1698 private
1699
1700- Fixed inode table races by removing it and using inode->u.generic_ip
1701 instead
1702
1703- Moved <devfs_read_inode> into <get_vfs_inode>
1704
1705- Moved <devfs_write_inode> into <devfs_notify_change>
1706===============================================================================
1707Changes for patch v186
1708
1709- Fixed race in <devfs_do_symlink> for uni-processor
1710
1711- Updated README from master HTML file
1712===============================================================================
1713Changes for patch v187
1714
1715- Fixed drivers/char/stallion.c for devfs
1716
1717- Fixed drivers/char/rocket.c for devfs
1718
1719- Fixed bug in <devfs_alloc_unique_number>: limited to 128 numbers
1720===============================================================================
1721Changes for patch v188
1722
1723- Updated major masks in fs/devfs/util.c up to Linus' "no new majors"
1724 proclamation. Block: were 126 now 122 free, char: were 26 now 19 free
1725
1726- Updated README from master HTML file
1727
1728- Removed remnant of multi-mount support in <devfs_mknod>
1729
1730- Removed unused DEVFS_FL_SHOW_UNREG flag
1731===============================================================================
1732Changes for patch v189
1733
1734- Removed nlink field from struct devfs_inode
1735
1736- Removed auto-ownership for /dev/pty/* (BSD ptys) and used
1737 DEVFS_FL_CURRENT_OWNER|DEVFS_FL_NO_PERSISTENCE for /dev/pty/s* (just
1738 like Unix98 pty slaves) and made /dev/pty/m* rw-rw-rw- access
1739===============================================================================
1740Changes for patch v190
1741
1742- Updated README from master HTML file
1743
1744- Replaced BKL with global rwsem to protect symlink data (quick and
1745 dirty hack)
1746===============================================================================
1747Changes for patch v191
1748
1749- Replaced global rwsem for symlink with per-link refcount
1750===============================================================================
1751Changes for patch v192
1752
1753- Removed unnecessary #ifdef CONFIG_DEVFS_FS from arch/i386/kernel/mtrr.c
1754
1755- Ported to kernel 2.4.10-pre11
1756
1757- Set inode->i_mapping->a_ops for block nodes in <get_vfs_inode>
1758===============================================================================
1759Changes for patch v193
1760
1761- Went back to global rwsem for symlinks (refcount scheme no good)
1762===============================================================================
1763Changes for patch v194
1764
1765- Fixed overrun in <devfs_link> by removing function (not needed)
1766
1767- Updated README from master HTML file
1768===============================================================================
1769Changes for patch v195
1770
1771- Fixed buffer underrun in <try_modload>
1772
1773- Moved down_read() from <search_for_entry_in_dir> to <find_entry>
1774===============================================================================
1775Changes for patch v196
1776
1777- Fixed race in <devfsd_ioctl> when setting event mask
1778 Thanks to Kari Hurtta <hurtta@leija.mh.fmi.fi>
1779
1780- Avoid deadlock in <devfs_follow_link> by using temporary buffer
1781===============================================================================
1782Changes for patch v197
1783
1784- First release of new locking code for devfs core (v1.0)
1785
1786- Fixed bug in drivers/cdrom/cdrom.c
1787===============================================================================
1788Changes for patch v198
1789
1790- Discard temporary buffer, now use "%s" for dentry names
1791
1792- Don't generate path in <try_modload>: use fake entry instead
1793
1794- Use "existing" directory in <_devfs_make_parent_for_leaf>
1795
1796- Use slab cache rather than fixed buffer for devfsd events
1797===============================================================================
1798Changes for patch v199
1799
1800- Removed obsolete usage of DEVFS_FL_NO_PERSISTENCE
1801
1802- Send DEVFSD_NOTIFY_REGISTERED events in <devfs_mk_dir>
1803
1804- Fixed locking bug in <devfs_d_revalidate_wait> due to typo
1805
1806- Do not send CREATE, CHANGE, ASYNC_OPEN or DELETE events from devfsd
1807 or children
1808===============================================================================
1809Changes for patch v200
1810
1811- Ported to kernel 2.5.1-pre2
1812===============================================================================
1813Changes for patch v201
1814
1815- Fixed bug in <devfsd_read>: was dereferencing freed pointer
1816===============================================================================
1817Changes for patch v202
1818
1819- Fixed bug in <devfsd_close>: was dereferencing freed pointer
1820
1821- Added process group check for devfsd privileges
1822===============================================================================
1823Changes for patch v203
1824
1825- Use SLAB_ATOMIC in <devfsd_notify_de> from <devfs_d_delete>
1826===============================================================================
1827Changes for patch v204
1828
1829- Removed long obsolete rc.devfs
1830
1831- Return old entry in <devfs_mk_dir> for 2.4.x kernels
1832
1833- Updated README from master HTML file
1834
1835- Increment refcount on module in <check_disc_changed>
1836
1837- Created <devfs_get_handle> and exported <devfs_put>
1838
1839- Increment refcount on module in <devfs_get_ops>
1840
1841- Created <devfs_put_ops> and used where needed to fix races
1842
1843- Added clarifying comments in response to preliminary EMC code review
1844
1845- Added poisoning to <devfs_put>
1846
1847- Improved debugging messages
1848
1849- Fixed unregister bugs in drivers/md/lvm-fs.c
1850===============================================================================
1851Changes for patch v205
1852
1853- Corrected (made useful) debugging message in <unregister>
1854
1855- Moved <kmem_cache_create> in <mount_devfs_fs> to <init_devfs_fs>
1856
1857- Fixed drivers/md/lvm-fs.c to create "lvm" entry
1858
1859- Added magic number to guard against scribbling drivers
1860
1861- Only return old entry in <devfs_mk_dir> if a directory
1862
1863- Defined macros for error and debug messages
1864
1865- Updated README from master HTML file
1866===============================================================================
1867Changes for patch v206
1868
1869- Added support for multiple Compaq cpqarray controllers
1870
1871- Fixed (rare, old) race in <devfs_lookup>
1872===============================================================================
1873Changes for patch v207
1874
1875- Fixed deadlock bug in <devfs_d_revalidate_wait>
1876
1877- Tag VFS deletable in <devfs_mk_symlink> if handle ignored
1878
1879- Updated README from master HTML file
1880===============================================================================
1881Changes for patch v208
1882
1883- Added KERN_* to remaining messages
1884
1885- Cleaned up declaration of <stat_read>
1886
1887- Updated README from master HTML file
1888===============================================================================
1889Changes for patch v209
1890
1891- Updated README from master HTML file
1892
1893- Removed silently introduced calls to lock_kernel() and
1894 unlock_kernel() due to recent VFS locking changes. BKL isn't
1895 required in devfs
1896
1897- Changed <devfs_rmdir> to allow later additions if not yet empty
1898
1899- Added calls to <devfs_register_partitions> in drivers/block/blkpc.c
1900 <add_partition> and <del_partition>
1901
1902- Fixed bug in <devfs_alloc_unique_number>: was clearing beyond
1903 bitfield
1904
1905- Fixed bitfield data type for <devfs_*alloc_devnum>
1906
1907- Made major bitfield type and initialiser 64 bit safe
1908===============================================================================
1909Changes for patch v210
1910
1911- Updated fs/devfs/util.c to fix shift warning on 64 bit machines
1912 Thanks to Anton Blanchard <anton@samba.org>
1913
1914- Updated README from master HTML file
1915===============================================================================
1916Changes for patch v211
1917
1918- Do not put miscellaneous character devices in /dev/misc if they
1919 specify their own directory (i.e. contain a '/' character)
1920
1921- Copied macro for error messages from fs/devfs/base.c to
1922 fs/devfs/util.c and made use of this macro
1923
1924- Removed 2.4.x compatibility code from fs/devfs/base.c
1925===============================================================================
1926Changes for patch v212
1927
1928- Added BKL to <devfs_open> because drivers still need it
1929===============================================================================
1930Changes for patch v213
1931
1932- Protected <scan_dir_for_removable> and <get_removable_partition>
1933 from changing directory contents
1934===============================================================================
1935Changes for patch v214
1936
1937- Switched to ISO C structure field initialisers
1938
1939- Switch to set_current_state() and move before add_wait_queue()
1940
1941- Updated README from master HTML file
1942
1943- Fixed devfs entry leak in <devfs_readdir> when *readdir fails
1944===============================================================================
1945Changes for patch v215
1946
1947- Created <devfs_find_and_unregister>
1948
1949- Switched many functions from <devfs_find_handle> to
1950 <devfs_find_and_unregister>
1951
1952- Switched many functions from <devfs_find_handle> to <devfs_get_handle>
1953===============================================================================
1954Changes for patch v216
1955
1956- Switched arch/ia64/sn/io/hcl.c from <devfs_find_handle> to
1957 <devfs_get_handle>
1958
1959- Removed deprecated <devfs_find_handle>
1960===============================================================================
1961Changes for patch v217
1962
1963- Exported <devfs_find_and_unregister> and <devfs_only> to modules
1964
1965- Updated README from master HTML file
1966
1967- Fixed module unload race in <devfs_open>
1968===============================================================================
1969Changes for patch v218
1970
1971- Removed DEVFS_FL_AUTO_OWNER flag
1972
1973- Switched lingering structure field initialiser to ISO C
1974
1975- Added locking when setting/clearing flags
1976
1977- Documentation fix in fs/devfs/util.c
diff --git a/Documentation/filesystems/devfs/README b/Documentation/filesystems/devfs/README
deleted file mode 100644
index aabfba24bc2e..000000000000
--- a/Documentation/filesystems/devfs/README
+++ /dev/null
@@ -1,1959 +0,0 @@
1Devfs (Device File System) FAQ
2
3
4Linux Devfs (Device File System) FAQ
5Richard Gooch
620-AUG-2002
7
8
9Document languages:
10
11
12
13
14
15
16
17-----------------------------------------------------------------------------
18
19NOTE: the master copy of this document is available online at:
20
21http://www.atnf.csiro.au/~rgooch/linux/docs/devfs.html
22and looks much better than the text version distributed with the
23kernel sources. A mirror site is available at:
24
25http://www.ras.ucalgary.ca/~rgooch/linux/docs/devfs.html
26
27There is also an optional daemon that may be used with devfs. You can
28find out more about it at:
29
30http://www.atnf.csiro.au/~rgooch/linux/
31
32A mailing list is available which you may subscribe to. Send
33email
34to majordomo@oss.sgi.com with the following line in the
35body of the message:
36subscribe devfs
37To unsubscribe, send the message body:
38unsubscribe devfs
39instead. The list is archived at
40
41http://oss.sgi.com/projects/devfs/archive/.
42
43-----------------------------------------------------------------------------
44
45Contents
46
47
48What is it?
49
50Why do it?
51
52Who else does it?
53
54How it works
55
56Operational issues (essential reading)
57
58Instructions for the impatient
59Permissions persistence across reboots
60Dealing with drivers without devfs support
61All the way with Devfs
62Other Issues
63Kernel Naming Scheme
64Devfsd Naming Scheme
65Old Compatibility Names
66SCSI Host Probing Issues
67
68
69
70Device drivers currently ported
71
72Allocation of Device Numbers
73
74Questions and Answers
75
76Making things work
77Alternatives to devfs
78What I don't like about devfs
79How to report bugs
80Strange kernel messages
81Compilation problems with devfsd
82
83
84Other resources
85
86Translations of this document
87
88
89-----------------------------------------------------------------------------
90
91
92What is it?
93
94Devfs is an alternative to "real" character and block special devices
95on your root filesystem. Kernel device drivers can register devices by
96name rather than major and minor numbers. These devices will appear in
97devfs automatically, with whatever default ownership and
98protection the driver specified. A daemon (devfsd) can be used to
99override these defaults. Devfs has been in the kernel since 2.3.46.
100
101NOTE that devfs is entirely optional. If you prefer the old
102disc-based device nodes, then simply leave CONFIG_DEVFS_FS=n (the
103default). In this case, nothing will change. ALSO NOTE that if you do
104enable devfs, the defaults are such that full compatibility is
105maintained with the old devices names.
106
107There are two aspects to devfs: one is the underlying device
108namespace, which is a namespace just like any mounted filesystem. The
109other aspect is the filesystem code which provides a view of the
110device namespace. The reason I make a distinction is because devfs
111can be mounted many times, with each mount showing the same device
112namespace. Changes made are global to all mounted devfs filesystems.
113Also, because the devfs namespace exists without any devfs mounts, you
114can easily mount the root filesystem by referring to an entry in the
115devfs namespace.
116
117
118The cost of devfs is a small increase in kernel code size and memory
119usage. About 7 pages of code (some of that in __init sections) and 72
120bytes for each entry in the namespace. A modest system has only a
121couple of hundred device entries, so this costs a few more
122pages. Compare this with the suggestion to put /dev on a <a
123href="#why-faq-ramdisc">ramdisc.
124
125On a typical machine, the cost is under 0.2 percent. On a modest
126system with 64 MBytes of RAM, the cost is under 0.1 percent. The
127accusations of "bloatware" levelled at devfs are not justified.
128
129-----------------------------------------------------------------------------
130
131
132Why do it?
133
134There are several problems that devfs addresses. Some of these
135problems are more serious than others (depending on your point of
136view), and some can be solved without devfs. However, the totality of
137these problems really calls out for devfs.
138
139The choice is a patchwork of inefficient user space solutions, which
140are complex and likely to be fragile, or to use a simple and efficient
141devfs which is robust.
142
143There have been many counter-proposals to devfs, all seeking to
144provide some of the benefits without actually implementing devfs. So
145far there has been an absence of code and no proposed alternative has
146been able to provide all the features that devfs does. Further,
147alternative proposals require far more complexity in user-space (and
148still deliver less functionality than devfs). Some people have the
149mantra of reducing "kernel bloat", but don't consider the effects on
150user-space.
151
152A good solution limits the total complexity of kernel-space and
153user-space.
154
155
156Major&minor allocation
157
158The existing scheme requires the allocation of major and minor device
159numbers for each and every device. This means that a central
160co-ordinating authority is required to issue these device numbers
161(unless you're developing a "private" device driver), in order to
162preserve uniqueness. Devfs shifts the burden to a namespace. This may
163not seem like a huge benefit, but actually it is. Since driver authors
164will naturally choose a device name which reflects the functionality
165of the device, there is far less potential for namespace conflict.
166Solving this requires a kernel change.
167
168/dev management
169
170Because you currently access devices through device nodes, these must
171be created by the system administrator. For standard devices you can
172usually find a MAKEDEV programme which creates all these (hundreds!)
173of nodes. This means that changes in the kernel must be reflected by
174changes in the MAKEDEV programme, or else the system administrator
175creates device nodes by hand.
176
177The basic problem is that there are two separate databases of
178major and minor numbers. One is in the kernel and one is in /dev (or
179in a MAKEDEV programme, if you want to look at it that way). This is
180duplication of information, which is not good practice.
181Solving this requires a kernel change.
182
183/dev growth
184
185A typical /dev has over 1200 nodes! Most of these devices simply don't
186exist because the hardware is not available. A huge /dev increases the
187time to access devices (I'm just referring to the dentry lookup times
188and the time taken to read inodes off disc: the next subsection shows
189some more horrors).
190
191An example of how big /dev can grow is if we consider SCSI devices:
192
193host 6 bits (say up to 64 hosts on a really big machine)
194channel 4 bits (say up to 16 SCSI buses per host)
195id 4 bits
196lun 3 bits
197partition 6 bits
198TOTAL 23 bits
199
200
201This requires 8 Mega (1024*1024) inodes if we want to store all
202possible device nodes. Even if we scrap everything but id,partition
203and assume a single host adapter with a single SCSI bus and only one
204logical unit per SCSI target (id), that's still 10 bits or 1024
205inodes. Each VFS inode takes around 256 bytes (kernel 2.1.78), so
206that's 256 kBytes of inode storage on disc (assuming real inodes take
207a similar amount of space as VFS inodes). This is actually not so bad,
208because disc is cheap these days. Embedded systems would care about
209256 kBytes of /dev inodes, but you could argue that embedded systems
210would have hand-tuned /dev directories. I've had to do just that on my
211embedded systems, but I would rather just leave it to devfs.
212
213Another issue is the time taken to lookup an inode when first
214referenced. Not only does this take time in scanning through a list in
215memory, but also the seek times to read the inodes off disc.
216This could be solved in user-space using a clever programme which
217scanned the kernel logs and deleted /dev entries which are not
218available and created them when they were available. This programme
219would need to be run every time a new module was loaded, which would
220slow things down a lot.
221
222There is an existing programme called scsidev which will automatically
223create device nodes for SCSI devices. It can do this by scanning files
224in /proc/scsi. Unfortunately, to extend this idea to other device
225nodes would require significant modifications to existing drivers (so
226they too would provide information in /proc). This is a non-trivial
227change (I should know: devfs has had to do something similar). Once
228you go to this much effort, you may as well use devfs itself (which
229also provides this information). Furthermore, such a system would
230likely be implemented in an ad-hoc fashion, as different drivers will
231provide their information in different ways.
232
233Devfs is much cleaner, because it (naturally) has a uniform mechanism
234to provide this information: the device nodes themselves!
235
236
237Node to driver file_operations translation
238
239There is an important difference between the way disc-based character
240and block nodes and devfs entries make the connection between an entry
241in /dev and the actual device driver.
242
243With the current 8 bit major and minor numbers the connection between
244disc-based c&b nodes and per-major drivers is done through a
245fixed-length table of 128 entries. The various filesystem types set
246the inode operations for c&b nodes to {chr,blk}dev_inode_operations,
247so when a device is opened a few quick levels of indirection bring us
248to the driver file_operations.
249
250For miscellaneous character devices a second step is required: there
251is a scan for the driver entry with the same minor number as the file
252that was opened, and the appropriate minor open method is called. This
253scanning is done *every time* you open a device node. Potentially, you
254may be searching through dozens of misc. entries before you find your
255open method. While not an enormous performance overhead, this does
256seem pointless.
257
258Linux *must* move beyond the 8 bit major and minor barrier,
259somehow. If we simply increase each to 16 bits, then the indexing
260scheme used for major driver lookup becomes untenable, because the
261major tables (one each for character and block devices) would need to
262be 64 k entries long (512 kBytes on x86, 1 MByte for 64 bit
263systems). So we would have to use a scheme like that used for
264miscellaneous character devices, which means the search time goes up
265linearly with the average number of major device drivers on your
266system. Not all "devices" are hardware, some are higher-level drivers
267like KGI, so you can get more "devices" without adding hardware
268You can improve this by creating an ordered (balanced:-)
269binary tree, in which case your search time becomes log(N).
270Alternatively, you can use hashing to speed up the search.
271But why do that search at all if you don't have to? Once again, it
272seems pointless.
273
274Note that devfs doesn't use the major&minor system. For devfs
275entries, the connection is done when you lookup the /dev entry. When
276devfs_register() is called, an internal table is appended which has
277the entry name and the file_operations. If the dentry cache doesn't
278have the /dev entry already, this internal table is scanned to get the
279file_operations, and an inode is created. If the dentry cache already
280has the entry, there is *no lookup time* (other than the dentry scan
281itself, but we can't avoid that anyway, and besides Linux dentries
282cream other OS's which don't have them:-). Furthermore, the number of
283node entries in a devfs is only the number of available device
284entries, not the number of *conceivable* entries. Even if you remove
285unnecessary entries in a disc-based /dev, the number of conceivable
286entries remains the same: you just limit yourself in order to save
287space.
288
289Devfs provides a fast connection between a VFS node and the device
290driver, in a scalable way.
291
292/dev as a system administration tool
293
294Right now /dev contains a list of conceivable devices, most of which I
295don't have. Devfs only shows those devices available on my
296system. This means that listing /dev is a handy way of checking what
297devices are available.
298
299Major&minor size
300
301Existing major and minor numbers are limited to 8 bits each. This is
302now a limiting factor for some drivers, particularly the SCSI disc
303driver, which consumes a single major number. Only 16 discs are
304supported, and each disc may have only 15 partitions. Maybe this isn't
305a problem for you, but some of us are building huge Linux systems with
306disc arrays. With devfs an arbitrary pointer can be associated with
307each device entry, which can be used to give an effective 32 bit
308device identifier (i.e. that's like having a 32 bit minor
309number). Since this is private to the kernel, there are no C library
310compatibility issues which you would have with increasing major and
311minor number sizes. See the section on "Allocation of Device Numbers"
312for details on maintaining compatibility with userspace.
313
314Solving this requires a kernel change.
315
316Since writing this, the kernel has been modified so that the SCSI disc
317driver has more major numbers allocated to it and now supports up to
318128 discs. Since these major numbers are non-contiguous (a result of
319unplanned expansion), the implementation is a little more cumbersome
320than originally.
321
322Just like the changes to IPv4 to fix impending limitations in the
323address space, people find ways around the limitations. In the long
324run, however, solutions like IPv6 or devfs can't be put off forever.
325
326Read-only root filesystem
327
328Having your device nodes on the root filesystem means that you can't
329operate properly with a read-only root filesystem. This is because you
330want to change ownerships and protections of tty devices. Existing
331practice prevents you using a CD-ROM as your root filesystem for a
332*real* system. Sure, you can boot off a CD-ROM, but you can't change
333tty ownerships, so it's only good for installing.
334
335Also, you can't use a shared NFS root filesystem for a cluster of
336discless Linux machines (having tty ownerships changed on a common
337/dev is not good). Nor can you embed your root filesystem in a
338ROM-FS.
339
340You can get around this by creating a RAMDISC at boot time, making
341an ext2 filesystem in it, mounting it somewhere and copying the
342contents of /dev into it, then unmounting it and mounting it over
343/dev.
344
345A devfs is a cleaner way of solving this.
346
347Non-Unix root filesystem
348
349Non-Unix filesystems (such as NTFS) can't be used for a root
350filesystem because they variously don't support character and block
351special files or symbolic links. You can't have a separate disc-based
352or RAMDISC-based filesystem mounted on /dev because you need device
353nodes before you can mount these. Devfs can be mounted without any
354device nodes. Devlinks won't work because symlinks aren't supported.
355An alternative solution is to use initrd to mount a RAMDISC initial
356root filesystem (which is populated with a minimal set of device
357nodes), and then construct a new /dev in another RAMDISC, and finally
358switch to your non-Unix root filesystem. This requires clever boot
359scripts and a fragile and conceptually complex boot procedure.
360
361Devfs solves this in a robust and conceptually simple way.
362
363PTY security
364
365Current pseudo-tty (pty) devices are owned by root and read-writable
366by everyone. The user of a pty-pair cannot change
367ownership/protections without being suid-root.
368
369This could be solved with a secure user-space daemon which runs as
370root and does the actual creation of pty-pairs. Such a daemon would
371require modification to *every* programme that wants to use this new
372mechanism. It also slows down creation of pty-pairs.
373
374An alternative is to create a new open_pty() syscall which does much
375the same thing as the user-space daemon. Once again, this requires
376modifications to pty-handling programmes.
377
378The devfs solution allows a device driver to "tag" certain device
379files so that when an unopened device is opened, the ownerships are
380changed to the current euid and egid of the opening process, and the
381protections are changed to the default registered by the driver. When
382the device is closed ownership is set back to root and protections are
383set back to read-write for everybody. No programme need be changed.
384The devpts filesystem provides this auto-ownership feature for Unix98
385ptys. It doesn't support old-style pty devices, nor does it have all
386the other features of devfs.
387
388Intelligent device management
389
390Devfs implements a simple yet powerful protocol for communication with
391a device management daemon (devfsd) which runs in user space. It is
392possible to send a message (either synchronously or asynchronously) to
393devfsd on any event, such as registration/unregistration of device
394entries, opening and closing devices, looking up inodes, scanning
395directories and more. This has many possibilities. Some of these are
396already implemented. See:
397
398
399http://www.atnf.csiro.au/~rgooch/linux/
400
401Device entry registration events can be used by devfsd to change
402permissions of newly-created device nodes. This is one mechanism to
403control device permissions.
404
405Device entry registration/unregistration events can be used to run
406programmes or scripts. This can be used to provide automatic mounting
407of filesystems when a new block device media is inserted into the
408drive.
409
410Asynchronous device open and close events can be used to implement
411clever permissions management. For example, the default permissions on
412/dev/dsp do not allow everybody to read from the device. This is
413sensible, as you don't want some remote user recording what you say at
414your console. However, the console user is also prevented from
415recording. This behaviour is not desirable. With asynchronous device
416open and close events, you can have devfsd run a programme or script
417when console devices are opened to change the ownerships for *other*
418device nodes (such as /dev/dsp). On closure, you can run a different
419script to restore permissions. An advantage of this scheme over
420modifying the C library tty handling is that this works even if your
421programme crashes (how many times have you seen the utmp database with
422lingering entries for non-existent logins?).
423
424Synchronous device open events can be used to perform intelligent
425device access protections. Before the device driver open() method is
426called, the daemon must first validate the open attempt, by running an
427external programme or script. This is far more flexible than access
428control lists, as access can be determined on the basis of other
429system conditions instead of just the UID and GID.
430
431Inode lookup events can be used to authenticate module autoload
432requests. Instead of using kmod directly, the event is sent to
433devfsd which can implement an arbitrary authentication before loading
434the module itself.
435
436Inode lookup events can also be used to construct arbitrary
437namespaces, without having to resort to populating devfs with symlinks
438to devices that don't exist.
439
440Speculative Device Scanning
441
442Consider an application (like cdparanoia) that wants to find all
443CD-ROM devices on the system (SCSI, IDE and other types), whether or
444not their respective modules are loaded. The application must
445speculatively open certain device nodes (such as /dev/sr0 for the SCSI
446CD-ROMs) in order to make sure the module is loaded. This requires
447that all Linux distributions follow the standard device naming scheme
448(last time I looked RedHat did things differently). Devfs solves the
449naming problem.
450
451The same application also wants to see which devices are actually
452available on the system. With the existing system it needs to read the
453/dev directory and speculatively open each /dev/sr* device to
454determine if the device exists or not. With a large /dev this is an
455inefficient operation, especially if there are many /dev/sr* nodes. A
456solution like scsidev could reduce the number of /dev/sr* entries (but
457of course that also requires all that inefficient directory scanning).
458
459With devfs, the application can open the /dev/sr directory
460(which triggers the module autoloading if required), and proceed to
461read /dev/sr. Since only the available devices will have
462entries, there are no inefficencies in directory scanning or device
463openings.
464
465-----------------------------------------------------------------------------
466
467Who else does it?
468
469FreeBSD has a devfs implementation. Solaris and AIX each have a
470pseudo-devfs (something akin to scsidev but for all devices, with some
471unspecified kernel support). BeOS, Plan9 and QNX also have it. SGI's
472IRIX 6.4 and above also have a device filesystem.
473
474While we shouldn't just automatically do something because others do
475it, we should not ignore the work of others either. FreeBSD has a lot
476of competent people working on it, so their opinion should not be
477blithely ignored.
478
479-----------------------------------------------------------------------------
480
481
482How it works
483
484Registering device entries
485
486For every entry (device node) in a devfs-based /dev a driver must call
487devfs_register(). This adds the name of the device entry, the
488file_operations structure pointer and a few other things to an
489internal table. Device entries may be added and removed at any
490time. When a device entry is registered, it automagically appears in
491any mounted devfs'.
492
493Inode lookup
494
495When a lookup operation on an entry is performed and if there is no
496driver information for that entry devfs will attempt to call
497devfsd. If still no driver information can be found then a negative
498dentry is yielded and the next stage operation will be called by the
499VFS (such as create() or mknod() inode methods). If driver information
500can be found, an inode is created (if one does not exist already) and
501all is well.
502
503Manually creating device nodes
504
505The mknod() method allows you to create an ordinary named pipe in the
506devfs, or you can create a character or block special inode if one
507does not already exist. You may wish to create a character or block
508special inode so that you can set permissions and ownership. Later, if
509a device driver registers an entry with the same name, the
510permissions, ownership and times are retained. This is how you can set
511the protections on a device even before the driver is loaded. Once you
512create an inode it appears in the directory listing.
513
514Unregistering device entries
515
516A device driver calls devfs_unregister() to unregister an entry.
517
518Chroot() gaols
519
5202.2.x kernels
521
522The semantics of inode creation are different when devfs is mounted
523with the "explicit" option. Now, when a device entry is registered, it
524will not appear until you use mknod() to create the device. It doesn't
525matter if you mknod() before or after the device is registered with
526devfs_register(). The purpose of this behaviour is to support
527chroot(2) gaols, where you want to mount a minimal devfs inside the
528gaol. Only the devices you specifically want to be available (through
529your mknod() setup) will be accessible.
530
5312.4.x kernels
532
533As of kernel 2.3.99, the VFS has had the ability to rebind parts of
534the global filesystem namespace into another part of the namespace.
535This now works even at the leaf-node level, which means that
536individual files and device nodes may be bound into other parts of the
537namespace. This is like making links, but better, because it works
538across filesystems (unlike hard links) and works through chroot()
539gaols (unlike symbolic links).
540
541Because of these improvements to the VFS, the multi-mount capability
542in devfs is no longer needed. The administrator may create a minimal
543device tree inside a chroot(2) gaol by using VFS bindings. As this
544provides most of the features of the devfs multi-mount capability, I
545removed the multi-mount support code (after issuing an RFC). This
546yielded code size reductions and simplifications.
547
548If you want to construct a minimal chroot() gaol, the following
549command should suffice:
550
551mount --bind /dev/null /gaol/dev/null
552
553
554Repeat for other device nodes you want to expose. Simple!
555
556-----------------------------------------------------------------------------
557
558
559Operational issues
560
561
562Instructions for the impatient
563
564Nobody likes reading documentation. People just want to get in there
565and play. So this section tells you quickly the steps you need to take
566to run with devfs mounted over /dev. Skip these steps and you will end
567up with a nearly unbootable system. Subsequent sections describe the
568issues in more detail, and discuss non-essential configuration
569options.
570
571Devfsd
572OK, if you're reading this, I assume you want to play with
573devfs. First you should ensure that /usr/src/linux contains a
574recent kernel source tree. Then you need to compile devfsd, the device
575management daemon, available at
576
577http://www.atnf.csiro.au/~rgooch/linux/.
578Because the kernel has a naming scheme
579which is quite different from the old naming scheme, you need to
580install devfsd so that software and configuration files that use the
581old naming scheme will not break.
582
583Compile and install devfsd. You will be provided with a default
584configuration file /etc/devfsd.conf which will provide
585compatibility symlinks for the old naming scheme. Don't change this
586config file unless you know what you're doing. Even if you think you
587do know what you're doing, don't change it until you've followed all
588the steps below and booted a devfs-enabled system and verified that it
589works.
590
591Now edit your main system boot script so that devfsd is started at the
592very beginning (before any filesystem
593checks). /etc/rc.d/rc.sysinit is often the main boot script
594on systems with SysV-style boot scripts. On systems with BSD-style
595boot scripts it is often /etc/rc. Also check
596/sbin/rc.
597
598NOTE that the line you put into the boot
599script should be exactly:
600
601/sbin/devfsd /dev
602
603DO NOT use some special daemon-launching
604programme, otherwise the boot script may not wait for devfsd to finish
605initialising.
606
607System Libraries
608There may still be some problems because of broken software making
609assumptions about device names. In particular, some software does not
610handle devices which are symbolic links. If you are running a libc 5
611based system, install libc 5.4.44 (if you have libc 5.4.46, go back to
612libc 5.4.44, which is actually correct). If you are running a glibc
613based system, make sure you have glibc 2.1.3 or later.
614
615/etc/securetty
616PAM (Pluggable Authentication Modules) is supposed to be a flexible
617mechanism for providing better user authentication and access to
618services. Unfortunately, it's also fragile, complex and undocumented
619(check out RedHat 6.1, and probably other distributions as well). PAM
620has problems with symbolic links. Append the following lines to your
621/etc/securetty file:
622
623vc/1
624vc/2
625vc/3
626vc/4
627vc/5
628vc/6
629vc/7
630vc/8
631
632This will not weaken security. If you have a version of util-linux
633earlier than 2.10.h, please upgrade to 2.10.h or later. If you
634absolutely cannot upgrade, then also append the following lines to
635your /etc/securetty file:
636
6371
6382
6393
6404
6415
6426
6437
6448
645
646This may potentially weaken security by allowing root logins over the
647network (a password is still required, though). However, since there
648are problems with dealing with symlinks, I'm suspicious of the level
649of security offered in any case.
650
651XFree86
652While not essential, it's probably a good idea to upgrade to XFree86
6534.0, as patches went in to make it more devfs-friendly. If you don't,
654you'll probably need to apply the following patch to
655/etc/security/console.perms so that ordinary users can run
656startx. Note that not all distributions have this file (e.g. Debian),
657so if it's not present, don't worry about it.
658
659--- /etc/security/console.perms.orig Sat Apr 17 16:26:47 1999
660+++ /etc/security/console.perms Fri Feb 25 23:53:55 2000
661@@ -14,7 +14,7 @@
662 # man 5 console.perms
663
664 # file classes -- these are regular expressions
665-<console>=tty[0-9][0-9]* :[0-9]\.[0-9] :[0-9]
666+<console>=tty[0-9][0-9]* vc/[0-9][0-9]* :[0-9]\.[0-9] :[0-9]
667
668 # device classes -- these are shell-style globs
669 <floppy>=/dev/fd[0-1]*
670
671If the patch does not apply, then change the line:
672
673<console>=tty[0-9][0-9]* :[0-9]\.[0-9] :[0-9]
674
675with:
676
677<console>=tty[0-9][0-9]* vc/[0-9][0-9]* :[0-9]\.[0-9] :[0-9]
678
679
680Disable devpts
681I've had a report of devpts mounted on /dev/pts not working
682correctly. Since devfs will also manage /dev/pts, there is no
683need to mount devpts as well. You should either edit your
684/etc/fstab so devpts is not mounted, or disable devpts from
685your kernel configuration.
686
687Unsupported drivers
688Not all drivers have devfs support. If you depend on one of these
689drivers, you will need to create a script or tarfile that you can use
690at boot time to create device nodes as appropriate. There is a
691section which describes this. Another
692section lists the drivers which have
693devfs support.
694
695/dev/mouse
696
697Many disributions configure /dev/mouse to be the mouse device
698for XFree86 and GPM. I actually think this is a bad idea, because it
699adds another level of indirection. When looking at a config file, if
700you see /dev/mouse you're left wondering which mouse
701is being referred to. Hence I recommend putting the actual mouse
702device (for example /dev/psaux) into your
703/etc/X11/XF86Config file (and similarly for the GPM
704configuration file).
705
706Alternatively, use the same technique used for unsupported drivers
707described above.
708
709The Kernel
710Finally, you need to make sure devfs is compiled into your kernel. Set
711CONFIG_EXPERIMENTAL=y, CONFIG_DEVFS_FS=y and CONFIG_DEVFS_MOUNT=y by
712using favourite configuration tool (i.e. make config or
713make xconfig) and then make clean and then recompile your kernel and
714modules. At boot, devfs will be mounted onto /dev.
715
716If you encounter problems booting (for example if you forgot a
717configuration step), you can pass devfs=nomount at the kernel
718boot command line. This will prevent the kernel from mounting devfs at
719boot time onto /dev.
720
721In general, a kernel built with CONFIG_DEVFS_FS=y but without mounting
722devfs onto /dev is completely safe, and requires no
723configuration changes. One exception to take note of is when
724LABEL= directives are used in /etc/fstab. In this
725case you will be unable to boot properly. This is because the
726mount(8) programme uses /proc/partitions as part of
727the volume label search process, and the device names it finds are not
728available, because setting CONFIG_DEVFS_FS=y changes the names in
729/proc/partitions, irrespective of whether devfs is mounted.
730
731Now you've finished all the steps required. You're now ready to boot
732your shiny new kernel. Enjoy.
733
734Changing the configuration
735
736OK, you've now booted a devfs-enabled system, and everything works.
737Now you may feel like changing the configuration (common targets are
738/etc/fstab and /etc/devfsd.conf). Since you have a
739system that works, if you make any changes and it doesn't work, you
740now know that you only have to restore your configuration files to the
741default and it will work again.
742
743
744Permissions persistence across reboots
745
746If you don't use mknod(2) to create a device file, nor use chmod(2) or
747chown(2) to change the ownerships/permissions, the inode ctime will
748remain at 0 (the epoch, 12 am, 1-JAN-1970, GMT). Anything with a ctime
749later than this has had it's ownership/permissions changed. Hence, a
750simple script or programme may be used to tar up all changed inodes,
751prior to shutdown. Although effective, many consider this approach a
752kludge.
753
754A much better approach is to use devfsd to save and restore
755permissions. It may be configured to record changes in permissions and
756will save them in a database (in fact a directory tree), and restore
757these upon boot. This is an efficient method and results in immediate
758saving of current permissions (unlike the tar approach, which saves
759permissions at some unspecified future time).
760
761The default configuration file supplied with devfsd has config entries
762which you may uncomment to enable persistence management.
763
764If you decide to use the tar approach anyway, be aware that tar will
765first unlink(2) an inode before creating a new device node. The
766unlink(2) has the effect of breaking the connection between a devfs
767entry and the device driver. If you use the "devfs=only" boot option,
768you lose access to the device driver, requiring you to reload the
769module. I consider this a bug in tar (there is no real need to
770unlink(2) the inode first).
771
772Alternatively, you can use devfsd to provide more sophisticated
773management of device permissions. You can use devfsd to store
774permissions for whole groups of devices with a single configuration
775entry, rather than the conventional single entry per device entry.
776
777Permissions database stored in mounted-over /dev
778
779If you wish to save and restore your device permissions into the
780disc-based /dev while still mounting devfs onto /dev
781you may do so. This requires a 2.4.x kernel (in fact, 2.3.99 or
782later), which has the VFS binding facility. You need to do the
783following to set this up:
784
785
786
787make sure the kernel does not mount devfs at boot time
788
789
790make sure you have a correct /dev/console entry in your
791root file-system (where your disc-based /dev lives)
792
793create the /dev-state directory
794
795
796add the following lines near the very beginning of your boot
797scripts:
798
799mount --bind /dev /dev-state
800mount -t devfs none /dev
801devfsd /dev
802
803
804
805
806add the following lines to your /etc/devfsd.conf file:
807
808REGISTER ^pt[sy] IGNORE
809CREATE ^pt[sy] IGNORE
810CHANGE ^pt[sy] IGNORE
811DELETE ^pt[sy] IGNORE
812REGISTER .* COPY /dev-state/$devname $devpath
813CREATE .* COPY $devpath /dev-state/$devname
814CHANGE .* COPY $devpath /dev-state/$devname
815DELETE .* CFUNCTION GLOBAL unlink /dev-state/$devname
816RESTORE /dev-state
817
818Note that the sample devfsd.conf file contains these lines,
819as well as other sample configurations you may find useful. See the
820devfsd distribution
821
822
823reboot.
824
825
826
827
828Permissions database stored in normal directory
829
830If you are using an older kernel which doesn't support VFS binding,
831then you won't be able to have the permissions database in a
832mounted-over /dev. However, you can still use a regular
833directory to store the database. The sample /etc/devfsd.conf
834file above may still be used. You will need to create the
835/dev-state directory prior to installing devfsd. If you have
836old permissions in /dev, then just copy (or move) the device
837nodes over to the new directory.
838
839Which method is better?
840
841The best method is to have the permissions database stored in the
842mounted-over /dev. This is because you will not need to copy
843device nodes over to /dev-state, and because it allows you to
844switch between devfs and non-devfs kernels, without requiring you to
845copy permissions between /dev-state (for devfs) and
846/dev (for non-devfs).
847
848
849Dealing with drivers without devfs support
850
851Currently, not all device drivers in the kernel have been modified to
852use devfs. Device drivers which do not yet have devfs support will not
853automagically appear in devfs. The simplest way to create device nodes
854for these drivers is to unpack a tarfile containing the required
855device nodes. You can do this in your boot scripts. All your drivers
856will now work as before.
857
858Hopefully for most people devfs will have enough support so that they
859can mount devfs directly over /dev without losing most functionality
860(i.e. losing access to various devices). As of 22-JAN-1998 (devfs
861patch version 10) I am now running this way. All the devices I have
862are available in devfs, so I don't lose anything.
863
864WARNING: if your configuration requires the old-style device names
865(i.e. /dev/hda1 or /dev/sda1), you must install devfsd and configure
866it to maintain compatibility entries. It is almost certain that you
867will require this. Note that the kernel creates a compatibility entry
868for the root device, so you don't need initrd.
869
870Note that you no longer need to mount devpts if you use Unix98 PTYs,
871as devfs can manage /dev/pts itself. This saves you some RAM, as you
872don't need to compile and install devpts. Note that some versions of
873glibc have a bug with Unix98 pty handling on devfs systems. Contact
874the glibc maintainers for a fix. Glibc 2.1.3 has the fix.
875
876Note also that apart from editing /etc/fstab, other things will need
877to be changed if you *don't* install devfsd. Some software (like the X
878server) hard-wire device names in their source. It really is much
879easier to install devfsd so that compatibility entries are created.
880You can then slowly migrate your system to using the new device names
881(for example, by starting with /etc/fstab), and then limiting the
882compatibility entries that devfsd creates.
883
884IF YOU CONFIGURE TO MOUNT DEVFS AT BOOT, MAKE SURE YOU INSTALL DEVFSD
885BEFORE YOU BOOT A DEVFS-ENABLED KERNEL!
886
887Now that devfs has gone into the 2.3.46 kernel, I'm getting a lot of
888reports back. Many of these are because people are trying to run
889without devfsd, and hence some things break. Please just run devfsd if
890things break. I want to concentrate on real bugs rather than
891misconfiguration problems at the moment. If people are willing to fix
892bugs/false assumptions in other code (i.e. glibc, X server) and submit
893that to the respective maintainers, that would be great.
894
895
896All the way with Devfs
897
898The devfs kernel patch creates a rationalised device tree. As stated
899above, if you want to keep using the old /dev naming scheme,
900you just need to configure devfsd appopriately (see the man
901page). People who prefer the old names can ignore this section. For
902those of us who like the rationalised names and an uncluttered
903/dev, read on.
904
905If you don't run devfsd, or don't enable compatibility entry
906management, then you will have to configure your system to use the new
907names. For example, you will then need to edit your
908/etc/fstab to use the new disc naming scheme. If you want to
909be able to boot non-devfs kernels, you will need compatibility
910symlinks in the underlying disc-based /dev pointing back to
911the old-style names for when you boot a kernel without devfs.
912
913You can selectively decide which devices you want compatibility
914entries for. For example, you may only want compatibility entries for
915BSD pseudo-terminal devices (otherwise you'll have to patch you C
916library or use Unix98 ptys instead). It's just a matter of putting in
917the correct regular expression into /dev/devfsd.conf.
918
919There are other choices of naming schemes that you may prefer. For
920example, I don't use the kernel-supplied
921names, because they are too verbose. A common misconception is
922that the kernel-supplied names are meant to be used directly in
923configuration files. This is not the case. They are designed to
924reflect the layout of the devices attached and to provide easy
925classification.
926
927If you like the kernel-supplied names, that's fine. If you don't then
928you should be using devfsd to construct a namespace more to your
929liking. Devfsd has built-in code to construct a
930namespace that is both logical and easy to
931manage. In essence, it creates a convenient abbreviation of the
932kernel-supplied namespace.
933
934You are of course free to build your own namespace. Devfsd has all the
935infrastructure required to make this easy for you. All you need do is
936write a script. You can even write some C code and devfsd can load the
937shared object as a callable extension.
938
939
940Other Issues
941
942The init programme
943Another thing to take note of is whether your init programme
944creates a Unix socket /dev/telinit. Some versions of init
945create /dev/telinit so that the telinit programme can
946communicate with the init process. If you have such a system you need
947to make sure that devfs is mounted over /dev *before* init
948starts. In other words, you can't leave the mounting of devfs to
949/etc/rc, since this is executed after init. Other
950versions of init require a named pipe /dev/initctl
951which must exist *before* init starts. Once again, you need to
952mount devfs and then create the named pipe *before* init
953starts.
954
955The default behaviour now is not to mount devfs onto /dev at
956boot time for 2.3.x and later kernels. You can correct this with the
957"devfs=mount" boot option. This solves any problems with init,
958and also prevents the dreaded:
959
960Cannot open initial console
961
962message. For 2.2.x kernels where you need to apply the devfs patch,
963the default is to mount.
964
965If you have automatic mounting of devfs onto /dev then you
966may need to create /dev/initctl in your boot scripts. The
967following lines should suffice:
968
969mknod /dev/initctl p
970kill -SIGUSR1 1 # tell init that /dev/initctl now exists
971
972Alternatively, if you don't want the kernel to mount devfs onto
973/dev then you could use the following procedure is a
974guideline for how to get around /dev/initctl problems:
975
976# cd /sbin
977# mv init init.real
978# cat > init
979#! /bin/sh
980mount -n -t devfs none /dev
981mknod /dev/initctl p
982exec /sbin/init.real $*
983[control-D]
984# chmod a+x init
985
986Note that newer versions of init create /dev/initctl
987automatically, so you don't have to worry about this.
988
989Module autoloading
990You will need to configure devfsd to enable module
991autoloading. The following lines should be placed in your
992/etc/devfsd.conf file:
993
994LOOKUP .* MODLOAD
995
996
997As of devfsd-v1.3.10, a generic /etc/modules.devfs
998configuration file is installed, which is used by the MODLOAD
999action. This should be sufficient for most configurations. If you
1000require further configuration, edit your /etc/modules.conf
1001file. The way module autoloading work with devfs is:
1002
1003
1004a process attempts to lookup a device node (e.g. /dev/fred)
1005
1006
1007if that device node does not exist, the full pathname is passed to
1008devfsd as a string
1009
1010
1011devfsd will pass the string to the modprobe programme (provided the
1012configuration line shown above is present), and specifies that
1013/etc/modules.devfs is the configuration file
1014
1015
1016/etc/modules.devfs includes /etc/modules.conf to
1017access local configurations
1018
1019modprobe will search it's configuration files, looking for an alias
1020that translates the pathname into a module name
1021
1022
1023the translated pathname is then used to load the module.
1024
1025
1026If you wanted a lookup of /dev/fred to load the
1027mymod module, you would require the following configuration
1028line in /etc/modules.conf:
1029
1030alias /dev/fred mymod
1031
1032The /etc/modules.devfs configuration file provides many such
1033aliases for standard device names. If you look closely at this file,
1034you will note that some modules require multiple alias configuration
1035lines. This is required to support module autoloading for old and new
1036device names.
1037
1038Mounting root off a devfs device
1039If you wish to mount root off a devfs device when you pass the
1040"devfs=only" boot option, then you need to pass in the
1041"root=<device>" option to the kernel when booting. If you use
1042LILO, then you must have this in lilo.conf:
1043
1044append = "root=<device>"
1045
1046Surprised? Yep, so was I. It turns out if you have (as most people
1047do):
1048
1049root = <device>
1050
1051
1052then LILO will determine the device number of <device> and will
1053write that device number into a special place in the kernel image
1054before starting the kernel, and the kernel will use that device number
1055to mount the root filesystem. So, using the "append" variety ensures
1056that LILO passes the root filesystem device as a string, which devfs
1057can then use.
1058
1059Note that this isn't an issue if you don't pass "devfs=only".
1060
1061TTY issues
1062The ttyname(3) function in some versions of the C library makes
1063false assumptions about device entries which are symbolic links. The
1064tty(1) programme is one that depends on this function. I've
1065written a patch to libc 5.4.43 which fixes this. This has been
1066included in libc 5.4.44 and a similar fix is in glibc 2.1.3.
1067
1068
1069Kernel Naming Scheme
1070
1071The kernel provides a default naming scheme. This scheme is designed
1072to make it easy to search for specific devices or device types, and to
1073view the available devices. Some device types (such as hard discs),
1074have a directory of entries, making it easy to see what devices of
1075that class are available. Often, the entries are symbolic links into a
1076directory tree that reflects the topology of available devices. The
1077topological tree is useful for finding how your devices are arranged.
1078
1079Below is a list of the naming schemes for the most common drivers. A
1080list of reserved device names is
1081available for reference. Please send email to
1082rgooch@atnf.csiro.au to obtain an allocation. Please be
1083patient (the maintainer is busy). An alternative name may be allocated
1084instead of the requested name, at the discretion of the maintainer.
1085
1086Disc Devices
1087
1088All discs, whether SCSI, IDE or whatever, are placed under the
1089/dev/discs hierarchy:
1090
1091 /dev/discs/disc0 first disc
1092 /dev/discs/disc1 second disc
1093
1094
1095Each of these entries is a symbolic link to the directory for that
1096device. The device directory contains:
1097
1098 disc for the whole disc
1099 part* for individual partitions
1100
1101
1102CD-ROM Devices
1103
1104All CD-ROMs, whether SCSI, IDE or whatever, are placed under the
1105/dev/cdroms hierarchy:
1106
1107 /dev/cdroms/cdrom0 first CD-ROM
1108 /dev/cdroms/cdrom1 second CD-ROM
1109
1110
1111Each of these entries is a symbolic link to the real device entry for
1112that device.
1113
1114Tape Devices
1115
1116All tapes, whether SCSI, IDE or whatever, are placed under the
1117/dev/tapes hierarchy:
1118
1119 /dev/tapes/tape0 first tape
1120 /dev/tapes/tape1 second tape
1121
1122
1123Each of these entries is a symbolic link to the directory for that
1124device. The device directory contains:
1125
1126 mt for mode 0
1127 mtl for mode 1
1128 mtm for mode 2
1129 mta for mode 3
1130 mtn for mode 0, no rewind
1131 mtln for mode 1, no rewind
1132 mtmn for mode 2, no rewind
1133 mtan for mode 3, no rewind
1134
1135
1136SCSI Devices
1137
1138To uniquely identify any SCSI device requires the following
1139information:
1140
1141 controller (host adapter)
1142 bus (SCSI channel)
1143 target (SCSI ID)
1144 unit (Logical Unit Number)
1145
1146
1147All SCSI devices are placed under /dev/scsi (assuming devfs
1148is mounted on /dev). Hence, a SCSI device with the following
1149parameters: c=1,b=2,t=3,u=4 would appear as:
1150
1151 /dev/scsi/host1/bus2/target3/lun4 device directory
1152
1153
1154Inside this directory, a number of device entries may be created,
1155depending on which SCSI device-type drivers were installed.
1156
1157See the section on the disc naming scheme to see what entries the SCSI
1158disc driver creates.
1159
1160See the section on the tape naming scheme to see what entries the SCSI
1161tape driver creates.
1162
1163The SCSI CD-ROM driver creates:
1164
1165 cd
1166
1167
1168The SCSI generic driver creates:
1169
1170 generic
1171
1172
1173IDE Devices
1174
1175To uniquely identify any IDE device requires the following
1176information:
1177
1178 controller
1179 bus (aka. primary/secondary)
1180 target (aka. master/slave)
1181 unit
1182
1183
1184All IDE devices are placed under /dev/ide, and uses a similar
1185naming scheme to the SCSI subsystem.
1186
1187XT Hard Discs
1188
1189All XT discs are placed under /dev/xd. The first XT disc has
1190the directory /dev/xd/disc0.
1191
1192TTY devices
1193
1194The tty devices now appear as:
1195
1196 New name Old-name Device Type
1197 -------- -------- -----------
1198 /dev/tts/{0,1,...} /dev/ttyS{0,1,...} Serial ports
1199 /dev/cua/{0,1,...} /dev/cua{0,1,...} Call out devices
1200 /dev/vc/0 /dev/tty Current virtual console
1201 /dev/vc/{1,2,...} /dev/tty{1...63} Virtual consoles
1202 /dev/vcc/{0,1,...} /dev/vcs{1...63} Virtual consoles
1203 /dev/pty/m{0,1,...} /dev/ptyp?? PTY masters
1204 /dev/pty/s{0,1,...} /dev/ttyp?? PTY slaves
1205
1206
1207RAMDISCS
1208
1209The RAMDISCS are placed in their own directory, and are named thus:
1210
1211 /dev/rd/{0,1,2,...}
1212
1213
1214Meta Devices
1215
1216The meta devices are placed in their own directory, and are named
1217thus:
1218
1219 /dev/md/{0,1,2,...}
1220
1221
1222Floppy discs
1223
1224Floppy discs are placed in the /dev/floppy directory.
1225
1226Loop devices
1227
1228Loop devices are placed in the /dev/loop directory.
1229
1230Sound devices
1231
1232Sound devices are placed in the /dev/sound directory
1233(audio, sequencer, ...).
1234
1235
1236Devfsd Naming Scheme
1237
1238Devfsd provides a naming scheme which is a convenient abbreviation of
1239the kernel-supplied namespace. In some
1240cases, the kernel-supplied naming scheme is quite convenient, so
1241devfsd does not provide another naming scheme. The convenience names
1242that devfsd creates are in fact the same names as the original devfs
1243kernel patch created (before Linus mandated the Big Name
1244Change). These are referred to as "new compatibility entries".
1245
1246In order to configure devfsd to create these convenience names, the
1247following lines should be placed in your /etc/devfsd.conf:
1248
1249REGISTER .* MKNEWCOMPAT
1250UNREGISTER .* RMNEWCOMPAT
1251
1252This will cause devfsd to create (and destroy) symbolic links which
1253point to the kernel-supplied names.
1254
1255SCSI Hard Discs
1256
1257All SCSI discs are placed under /dev/sd (assuming devfs is
1258mounted on /dev). Hence, a SCSI disc with the following
1259parameters: c=1,b=2,t=3,u=4 would appear as:
1260
1261 /dev/sd/c1b2t3u4 for the whole disc
1262 /dev/sd/c1b2t3u4p5 for the 5th partition
1263 /dev/sd/c1b2t3u4p5s6 for the 6th slice in the 5th partition
1264
1265
1266SCSI Tapes
1267
1268All SCSI tapes are placed under /dev/st. A similar naming
1269scheme is used as for SCSI discs. A SCSI tape with the
1270parameters:c=1,b=2,t=3,u=4 would appear as:
1271
1272 /dev/st/c1b2t3u4m0 for mode 0
1273 /dev/st/c1b2t3u4m1 for mode 1
1274 /dev/st/c1b2t3u4m2 for mode 2
1275 /dev/st/c1b2t3u4m3 for mode 3
1276 /dev/st/c1b2t3u4m0n for mode 0, no rewind
1277 /dev/st/c1b2t3u4m1n for mode 1, no rewind
1278 /dev/st/c1b2t3u4m2n for mode 2, no rewind
1279 /dev/st/c1b2t3u4m3n for mode 3, no rewind
1280
1281
1282SCSI CD-ROMs
1283
1284All SCSI CD-ROMs are placed under /dev/sr. A similar naming
1285scheme is used as for SCSI discs. A SCSI CD-ROM with the
1286parameters:c=1,b=2,t=3,u=4 would appear as:
1287
1288 /dev/sr/c1b2t3u4
1289
1290
1291SCSI Generic Devices
1292
1293The generic (aka. raw) interface for all SCSI devices are placed under
1294/dev/sg. A similar naming scheme is used as for SCSI discs. A
1295SCSI generic device with the parameters:c=1,b=2,t=3,u=4 would appear
1296as:
1297
1298 /dev/sg/c1b2t3u4
1299
1300
1301IDE Hard Discs
1302
1303All IDE discs are placed under /dev/ide/hd, using a similar
1304convention to SCSI discs. The following mappings exist between the new
1305and the old names:
1306
1307 /dev/hda /dev/ide/hd/c0b0t0u0
1308 /dev/hdb /dev/ide/hd/c0b0t1u0
1309 /dev/hdc /dev/ide/hd/c0b1t0u0
1310 /dev/hdd /dev/ide/hd/c0b1t1u0
1311
1312
1313IDE Tapes
1314
1315A similar naming scheme is used as for IDE discs. The entries will
1316appear in the /dev/ide/mt directory.
1317
1318IDE CD-ROM
1319
1320A similar naming scheme is used as for IDE discs. The entries will
1321appear in the /dev/ide/cd directory.
1322
1323IDE Floppies
1324
1325A similar naming scheme is used as for IDE discs. The entries will
1326appear in the /dev/ide/fd directory.
1327
1328XT Hard Discs
1329
1330All XT discs are placed under /dev/xd. The first XT disc
1331would appear as /dev/xd/c0t0.
1332
1333
1334Old Compatibility Names
1335
1336The old compatibility names are the legacy device names, such as
1337/dev/hda, /dev/sda, /dev/rtc and so on.
1338Devfsd can be configured to create compatibility symlinks so that you
1339may continue to use the old names in your configuration files and so
1340that old applications will continue to function correctly.
1341
1342In order to configure devfsd to create these legacy names, the
1343following lines should be placed in your /etc/devfsd.conf:
1344
1345REGISTER .* MKOLDCOMPAT
1346UNREGISTER .* RMOLDCOMPAT
1347
1348This will cause devfsd to create (and destroy) symbolic links which
1349point to the kernel-supplied names.
1350
1351
1352-----------------------------------------------------------------------------
1353
1354
1355Device drivers currently ported
1356
1357- All miscellaneous character devices support devfs (this is done
1358 transparently through misc_register())
1359
1360- SCSI discs and generic hard discs
1361
1362- Character memory devices (null, zero, full and so on)
1363 Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
1364
1365- Loop devices (/dev/loop?)
1366
1367- TTY devices (console, serial ports, terminals and pseudo-terminals)
1368 Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
1369
1370- SCSI tapes (/dev/scsi and /dev/tapes)
1371
1372- SCSI CD-ROMs (/dev/scsi and /dev/cdroms)
1373
1374- SCSI generic devices (/dev/scsi)
1375
1376- RAMDISCS (/dev/ram?)
1377
1378- Meta Devices (/dev/md*)
1379
1380- Floppy discs (/dev/floppy)
1381
1382- Parallel port printers (/dev/printers)
1383
1384- Sound devices (/dev/sound)
1385 Thanks to Eric Dumas <dumas@linux.eu.org> and
1386 C. Scott Ananian <cananian@alumni.princeton.edu>
1387
1388- Joysticks (/dev/joysticks)
1389
1390- Sparc keyboard (/dev/kbd)
1391
1392- DSP56001 digital signal processor (/dev/dsp56k)
1393
1394- Apple Desktop Bus (/dev/adb)
1395
1396- Coda network file system (/dev/cfs*)
1397
1398- Virtual console capture devices (/dev/vcc)
1399 Thanks to Dennis Hou <smilax@mindmeld.yi.org>
1400
1401- Frame buffer devices (/dev/fb)
1402
1403- Video capture devices (/dev/v4l)
1404
1405
1406-----------------------------------------------------------------------------
1407
1408
1409Allocation of Device Numbers
1410
1411Devfs allows you to write a driver which doesn't need to allocate a
1412device number (major&minor numbers) for the internal operation of the
1413kernel. However, there are a number of userspace programmes that use
1414the device number as a unique handle for a device. An example is the
1415find programme, which uses device numbers to determine whether
1416an inode is on a different filesystem than another inode. The device
1417number used is the one for the block device which a filesystem is
1418using. To preserve compatibility with userspace programmes, block
1419devices using devfs need to have unique device numbers allocated to
1420them. Furthermore, POSIX specifies device numbers, so some kind of
1421device number needs to be presented to userspace.
1422
1423The simplest option (especially when porting drivers to devfs) is to
1424keep using the old major and minor numbers. Devfs will take whatever
1425values are given for major&minor and pass them onto userspace.
1426
1427This device number is a 16 bit number, so this leaves plenty of space
1428for large numbers of discs and partitions. This scheme can also be
1429used for character devices, in particular the tty devices, which are
1430currently limited to 256 pseudo-ttys (this limits the total number of
1431simultaneous xterms and remote logins). Note that the device number
1432is limited to the range 36864-61439 (majors 144-239), in order to
1433avoid any possible conflicts with existing official allocations.
1434
1435Please note that using dynamically allocated block device numbers may
1436break the NFS daemons (both user and kernel mode), which expect dev_t
1437for a given device to be constant over the lifetime of remote mounts.
1438
1439A final note on this scheme: since it doesn't increase the size of
1440device numbers, there are no compatibility issues with userspace.
1441
1442-----------------------------------------------------------------------------
1443
1444
1445Questions and Answers
1446
1447
1448Making things work
1449Alternatives to devfs
1450What I don't like about devfs
1451How to report bugs
1452Strange kernel messages
1453Compilation problems with devfsd
1454
1455
1456
1457Making things work
1458
1459Here are some common questions and answers.
1460
1461
1462
1463Devfsd doesn't start
1464
1465Make sure you have compiled and installed devfsd
1466Make sure devfsd is being started from your boot
1467scripts
1468Make sure you have configured your kernel to enable devfs (see
1469below)
1470Make sure devfs is mounted (see below)
1471
1472
1473Devfsd is not managing all my permissions
1474
1475Make sure you are capturing the appropriate events. For example,
1476device entries created by the kernel generate REGISTER events,
1477but those created by devfsd generate CREATE events.
1478
1479
1480Devfsd is not capturing all REGISTER events
1481
1482See the previous entry: you may need to capture CREATE events.
1483
1484
1485X will not start
1486
1487Make sure you followed the steps
1488outlined above.
1489
1490
1491Why don't my network devices appear in devfs?
1492
1493This is not a bug. Network devices have their own, completely separate
1494namespace. They are accessed via socket(2) and
1495setsockopt(2) calls, and thus require no device nodes. I have
1496raised the possibilty of moving network devices into the device
1497namespace, but have had no response.
1498
1499
1500How can I test if I have devfs compiled into my kernel?
1501
1502All filesystems built-in or currently loaded are listed in
1503/proc/filesystems. If you see a devfs entry, then
1504you know that devfs was compiled into your kernel. If you have
1505correctly configured and rebuilt your kernel, then devfs will be
1506built-in. If you think you've configured it in, but
1507/proc/filesystems doesn't show it, you've made a mistake.
1508Common mistakes include:
1509
1510Using a 2.2.x kernel without applying the devfs patch (if you
1511don't know how to patch your kernel, use 2.4.x instead, don't bother
1512asking me how to patch)
1513Forgetting to set CONFIG_EXPERIMENTAL=y
1514Forgetting to set CONFIG_DEVFS_FS=y
1515Forgetting to set CONFIG_DEVFS_MOUNT=y (if you want devfs
1516to be automatically mounted at boot)
1517Editing your .config manually, instead of using make
1518config or make xconfig
1519Forgetting to run make dep; make clean after changing the
1520configuration and before compiling
1521Forgetting to compile your kernel and modules
1522Forgetting to install your kernel
1523Forgetting to install your modules
1524
1525Please check twice that you've done all these steps before sending in
1526a bug report.
1527
1528
1529
1530How can I test if devfs is mounted on /dev?
1531
1532The device filesystem will always create an entry called
1533".devfsd", which is used to communicate with the daemon. Even
1534if the daemon is not running, this entry will exist. Testing for the
1535existence of this entry is the approved method of determining if devfs
1536is mounted or not. Note that the type of entry (i.e. regular file,
1537character device, named pipe, etc.) may change without notice. Only
1538the existence of the entry should be relied upon.
1539
1540
1541When I start devfsd, I see the error:
1542Error opening file: ".devfsd" No such file or directory?
1543
1544This means that devfs is not mounted. Make sure you have devfs mounted.
1545
1546
1547How do I mount devfs?
1548
1549First make sure you have devfs compiled into your kernel (see
1550above). Then you will either need to:
1551
1552set CONFIG_DEVFS_MOUNT=y in your kernel config
1553pass devfs=mount to your boot loader
1554mount devfs manually in your boot scripts with:
1555mount -t none devfs /dev
1556
1557
1558
1559Mount by volume LABEL=<label> doesn't work with
1560devfs
1561
1562Most probably you are not mounting devfs onto /dev. What
1563happens is that if your kernel config has CONFIG_DEVFS_FS=y
1564then the contents of /proc/partitions will have the devfs
1565names (such as scsi/host0/bus0/target0/lun0/part1). The
1566contents of /proc/partitions are used by mount(8) when
1567mounting by volume label. If devfs is not mounted on /dev,
1568then mount(8) will fail to find devices. The solution is to
1569make sure that devfs is mounted on /dev. See above for how to
1570do that.
1571
1572
1573I have extra or incorrect entries in /dev
1574
1575You may have stale entries in your dev-state area. Check for a
1576RESTORE configuration line in your devfsd configuration
1577(typically /etc/devfsd.conf). If you have this line, check
1578the contents of the specified directory for stale entries. Remove
1579any entries which are incorrect, then reboot.
1580
1581
1582I get "Unable to open initial console" messages at boot
1583
1584This usually happens when you don't have devfs automounted onto
1585/dev at boot time, and there is no valid
1586/dev/console entry on your root file-system. Create a valid
1587/dev/console device node.
1588
1589
1590
1591
1592
1593Alternatives to devfs
1594
1595I've attempted to collate all the anti-devfs proposals and explain
1596their limitations. Under construction.
1597
1598
1599Why not just pass device create/remove events to a daemon?
1600
1601Here the suggestion is to develop an API in the kernel so that devices
1602can register create and remove events, and a daemon listens for those
1603events. The daemon would then populate/depopulate /dev (which
1604resides on disc).
1605
1606This has several limitations:
1607
1608
1609it only works for modules loaded and unloaded (or devices inserted
1610and removed) after the kernel has finished booting. Without a database
1611of events, there is no way the daemon could fully populate
1612/dev
1613
1614
1615if you add a database to this scheme, the question is then how to
1616present that database to user-space. If you make it a list of strings
1617with embedded event codes which are passed through a pipe to the
1618daemon, then this is only of use to the daemon. I would argue that the
1619natural way to present this data is via a filesystem (since many of
1620the events will be of a hierarchical nature), such as devfs.
1621Presenting the data as a filesystem makes it easy for the user to see
1622what is available and also makes it easy to write scripts to scan the
1623"database"
1624
1625
1626the tight binding between device nodes and drivers is no longer
1627possible (requiring the otherwise perfectly avoidable
1628table lookups)
1629
1630
1631you cannot catch inode lookup events on /dev which means
1632that module autoloading requires device nodes to be created. This is a
1633problem, particularly for drivers where only a few inodes are created
1634from a potentially large set
1635
1636
1637this technique can't be used when the root FS is mounted
1638read-only
1639
1640
1641
1642
1643Just implement a better scsidev
1644
1645This suggestion involves taking the scsidev programme and
1646extending it to scan for all devices, not just SCSI devices. The
1647scsidev programme works by scanning /proc/scsi
1648
1649Problems:
1650
1651
1652the kernel does not currently provide a list of all devices
1653available. Not all drivers register entries in /proc or
1654generate kernel messages
1655
1656
1657there is no uniform mechanism to register devices other than the
1658devfs API
1659
1660
1661implementing such an API is then the same as the
1662proposal above
1663
1664
1665
1666
1667Put /dev on a ramdisc
1668
1669This suggestion involves creating a ramdisc and populating it with
1670device nodes and then mounting it over /dev.
1671
1672Problems:
1673
1674
1675
1676this doesn't help when mounting the root filesystem, since you
1677still need a device node to do that
1678
1679
1680if you want to use this technique for the root device node as
1681well, you need to use initrd. This complicates the booting sequence
1682and makes it significantly harder to administer and configure. The
1683initrd is essentially opaque, robbing the system administrator of easy
1684configuration
1685
1686
1687insufficient information is available to correctly populate the
1688ramdisc. So we come back to the
1689proposal above to "solve" this
1690
1691
1692a ramdisc-based solution would take more kernel memory, since the
1693backing store would be (at best) normal VFS inodes and dentries, which
1694take 284 bytes and 112 bytes, respectively, for each entry. Compare
1695that to 72 bytes for devfs
1696
1697
1698
1699
1700Do nothing: there's no problem
1701
1702Sometimes people can be heard to claim that the existing scheme is
1703fine. This is what they're ignoring:
1704
1705
1706device number size (8 bits each for major and minor) is a real
1707limitation, and must be fixed somehow. Systems with large numbers of
1708SCSI devices, for example, will continue to consume the remaining
1709unallocated major numbers. USB will also need to push beyond the 8 bit
1710minor limitation
1711
1712
1713simply increasing the device number size is insufficient. Apart
1714from causing a lot of pain, it doesn't solve the management issues
1715of a /dev with thousands or more device nodes
1716
1717
1718ignoring the problem of a huge /dev will not make it go
1719away, and dismisses the legitimacy of a large number of people who
1720want a dynamic /dev
1721
1722
1723the standard response then becomes: "write a device management
1724daemon", which brings us back to the
1725proposal above
1726
1727
1728
1729
1730What I don't like about devfs
1731
1732Here are some common complaints about devfs, and some suggestions and
1733solutions that may make it more palatable for you. I can't please
1734everybody, but I do try :-)
1735
1736I hate the naming scheme
1737
1738First, remember that no naming scheme will please everybody. You hate
1739the scheme, others love it. Who's to say who's right and who's wrong?
1740Ultimately, the person who writes the code gets to choose, and what
1741exists now is a combination of the choices made by the
1742devfs author and the
1743kernel maintainer (Linus).
1744
1745However, not all is lost. If you want to create your own naming
1746scheme, it is a simple matter to write a standalone script, hack
1747devfsd, or write a script called by devfsd. You can create whatever
1748naming scheme you like.
1749
1750Further, if you want to remove all traces of the devfs naming scheme
1751from /dev, you can mount devfs elsewhere (say
1752/devfs) and populate /dev with links into
1753/devfs. This population can be automated using devfsd if you
1754wish.
1755
1756You can even use the VFS binding facility to make the links, rather
1757than using symbolic links. This way, you don't even have to see the
1758"destination" of these symbolic links.
1759
1760Devfs puts policy into the kernel
1761
1762There's already policy in the kernel. Device numbers are in fact
1763policy (why should the kernel dictate what device numbers I use?).
1764Face it, some policy has to be in the kernel. The real difference
1765between device names as policy and device numbers as policy is that
1766no one will use device numbers directly, because device
1767numbers are devoid of meaning to humans and are ugly. At least with
1768the devfs device names, (even though you can add your own naming
1769scheme) some people will use the devfs-supplied names directly. This
1770offends some people :-)
1771
1772Devfs is bloatware
1773
1774This is not even remotely true. As shown above,
1775both code and data size are quite modest.
1776
1777
1778How to report bugs
1779
1780If you have (or think you have) a bug with devfs, please follow the
1781steps below:
1782
1783
1784
1785make sure you have enabled debugging output when configuring your
1786kernel. You will need to set (at least) the following config options:
1787
1788CONFIG_DEVFS_DEBUG=y
1789CONFIG_DEBUG_KERNEL=y
1790CONFIG_DEBUG_SLAB=y
1791
1792
1793
1794please make sure you have the latest devfs patches applied. The
1795latest kernel version might not have the latest devfs patches applied
1796yet (Linus is very busy)
1797
1798
1799save a copy of your complete kernel logs (preferably by
1800using the dmesg programme) for later inclusion in your bug
1801report. You may need to use the -s switch to increase the
1802internal buffer size so you can capture all the boot messages.
1803Don't edit or trim the dmesg output
1804
1805
1806
1807
1808try booting with devfs=dall passed to the kernel boot
1809command line (read the documentation on your bootloader on how to do
1810this), and save the result to a file. This may be quite verbose, and
1811it may overflow the messages buffer, but try to get as much of it as
1812you can
1813
1814
1815send a copy of your devfsd configuration file(s)
1816
1817send the bug report to me first.
1818Don't expect that I will see it if you post it to the linux-kernel
1819mailing list. Include all the information listed above, plus
1820anything else that you think might be relevant. Put the string
1821devfs somewhere in the subject line, so my mail filters mark
1822it as urgent
1823
1824
1825
1826
1827Here is a general guide on how to ask questions in a way that greatly
1828improves your chances of getting a reply:
1829
1830http://www.tuxedo.org/~esr/faqs/smart-questions.html. If you have
1831a bug to report, you should also read
1832
1833http://www.chiark.greenend.org.uk/~sgtatham/bugs.html.
1834
1835
1836Strange kernel messages
1837
1838You may see devfs-related messages in your kernel logs. Below are some
1839messages and what they mean (and what you should do about them, if
1840anything).
1841
1842
1843
1844devfs_register(fred): could not append to parent, err: -17
1845
1846You need to check what the error code means, but usually 17 means
1847EEXIST. This means that a driver attempted to create an entry
1848fred in a directory, but there already was an entry with that
1849name. This is often caused by flawed boot scripts which untar a bunch
1850of inodes into /dev, as a way to restore permissions. This
1851message is harmless, as the device nodes will still
1852provide access to the driver (unless you use the devfs=only
1853boot option, which is only for dedicated souls:-). If you want to get
1854rid of these annoying messages, upgrade to devfsd-v1.3.20 and use the
1855recommended RESTORE directive to restore permissions.
1856
1857
1858devfs_mk_dir(bill): using old entry in dir: c1808724 ""
1859
1860This is similar to the message above, except that a driver attempted
1861to create a directory named bill, and the parent directory
1862has an entry with the same name. In this case, to ensure that drivers
1863continue to work properly, the old entry is re-used and given to the
1864driver. In 2.5 kernels, the driver is given a NULL entry, and thus,
1865under rare circumstances, may not create the require device nodes.
1866The solution is the same as above.
1867
1868
1869
1870
1871
1872Compilation problems with devfsd
1873
1874Usually, you can compile devfsd just by typing in
1875make in the source directory, followed by a make
1876install (as root). Sometimes, you may have problems, particularly
1877on broken configurations.
1878
1879
1880
1881error messages relating to DEVFSD_NOTIFY_DELETE
1882
1883This happened because you have an ancient set of kernel headers
1884installed in /usr/include/linux or /usr/src/linux.
1885Install kernel 2.4.10 or later. You may need to pass the
1886KERNEL_DIR variable to make (if you did not install
1887the new kernel sources as /usr/src/linux), or you may copy
1888the devfs_fs.h file in the kernel source tree into
1889/usr/include/linux.
1890
1891
1892
1893
1894-----------------------------------------------------------------------------
1895
1896
1897Other resources
1898
1899
1900
1901Douglas Gilbert has written a useful document at
1902
1903http://www.torque.net/sg/devfs_scsi.html which
1904explores the SCSI subsystem and how it interacts with devfs
1905
1906
1907Douglas Gilbert has written another useful document at
1908
1909http://www.torque.net/scsi/SCSI-2.4-HOWTO/ which
1910discusses the Linux SCSI subsystem in 2.4.
1911
1912
1913Johannes Erdfelt has started a discussion paper on Linux and
1914hot-swap devices, describing what the requirements are for a scalable
1915solution and how and why he's used devfs+devfsd. Note that this is an
1916early draft only, available in plain text form at:
1917
1918http://johannes.erdfelt.com/hotswap.txt.
1919Johannes has promised a HTML version will follow.
1920
1921
1922I presented an invited
1923paper
1924at the
1925
19262nd Annual Storage Management Workshop held in Miamia, Florida,
1927U.S.A. in October 2000.
1928
1929
1930
1931
1932-----------------------------------------------------------------------------
1933
1934
1935Translations of this document
1936
1937This document has been translated into other languages.
1938
1939
1940
1941
1942The document master (in English) by rgooch@atnf.csiro.au is
1943available at
1944
1945http://www.atnf.csiro.au/~rgooch/linux/docs/devfs.html
1946
1947
1948
1949A Korean translation by viatoris@nownuri.net is available at
1950
1951http://your.destiny.pe.kr/devfs/devfs.html
1952
1953
1954
1955
1956-----------------------------------------------------------------------------
1957Most flags courtesy of ITA's
1958Flags of All Countries
1959used with permission.
diff --git a/Documentation/filesystems/devfs/ToDo b/Documentation/filesystems/devfs/ToDo
deleted file mode 100644
index afd5a8f2c19b..000000000000
--- a/Documentation/filesystems/devfs/ToDo
+++ /dev/null
@@ -1,40 +0,0 @@
1 Device File System (devfs) ToDo List
2
3 Richard Gooch <rgooch@atnf.csiro.au>
4
5 3-JUL-2000
6
7This is a list of things to be done for better devfs support in the
8Linux kernel. If you'd like to contribute to the devfs, please have a
9look at this list for anything that is unallocated. Also, if there are
10items missing (surely), please contact me so I can add them to the
11list (preferably with your name attached to them:-).
12
13
14- >256 ptys
15 Thanks to C. Scott Ananian <cananian@alumni.princeton.edu>
16
17- Amiga floppy driver (drivers/block/amiflop.c)
18
19- Atari floppy driver (drivers/block/ataflop.c)
20
21- SWIM3 (Super Woz Integrated Machine 3) floppy driver (drivers/block/swim3.c)
22
23- Amiga ZorroII ramdisc driver (drivers/block/z2ram.c)
24
25- Parallel port ATAPI CD-ROM (drivers/block/paride/pcd.c)
26
27- Parallel port ATAPI floppy (drivers/block/paride/pf.c)
28
29- AP1000 block driver (drivers/ap1000/ap.c, drivers/ap1000/ddv.c)
30
31- Archimedes floppy (drivers/acorn/block/fd1772.c)
32
33- MFM hard drive (drivers/acorn/block/mfmhd.c)
34
35- I2O block device (drivers/message/i2o/i2o_block.c)
36
37- ST-RAM device (arch/m68k/atari/stram.c)
38
39- Raw devices
40
diff --git a/Documentation/filesystems/devfs/boot-options b/Documentation/filesystems/devfs/boot-options
deleted file mode 100644
index df3d33b03e0a..000000000000
--- a/Documentation/filesystems/devfs/boot-options
+++ /dev/null
@@ -1,65 +0,0 @@
1/* -*- auto-fill -*- */
2
3 Device File System (devfs) Boot Options
4
5 Richard Gooch <rgooch@atnf.csiro.au>
6
7 18-AUG-2001
8
9
10When CONFIG_DEVFS_DEBUG is enabled, you can pass several boot options
11to the kernel to debug devfs. The boot options are prefixed by
12"devfs=", and are separated by commas. Spaces are not allowed. The
13syntax looks like this:
14
15devfs=<option1>,<option2>,<option3>
16
17and so on. For example, if you wanted to turn on debugging for module
18load requests and device registration, you would do:
19
20devfs=dmod,dreg
21
22You may prefix "no" to any option. This will invert the option.
23
24
25Debugging Options
26=================
27
28These requires CONFIG_DEVFS_DEBUG to be enabled.
29Note that all debugging options have 'd' as the first character. By
30default all options are off. All debugging output is sent to the
31kernel logs. The debugging options do not take effect until the devfs
32version message appears (just prior to the root filesystem being
33mounted).
34
35These are the options:
36
37dmod print module load requests to <request_module>
38
39dreg print device register requests to <devfs_register>
40
41dunreg print device unregister requests to <devfs_unregister>
42
43dchange print device change requests to <devfs_set_flags>
44
45dilookup print inode lookup requests
46
47diget print VFS inode allocations
48
49diunlink print inode unlinks
50
51dichange print inode changes
52
53dimknod print calls to mknod(2)
54
55dall some debugging turned on
56
57
58Other Options
59=============
60
61These control the default behaviour of devfs. The options are:
62
63mount mount devfs onto /dev at boot time
64
65only disable non-devfs device nodes for devfs-capable drivers
diff --git a/Documentation/initrd.txt b/Documentation/initrd.txt
index 7de1c80cd719..b1b6440237a6 100644
--- a/Documentation/initrd.txt
+++ b/Documentation/initrd.txt
@@ -67,8 +67,7 @@ initrd adds the following new options:
67 as the last process has closed it, all data is freed and /dev/initrd 67 as the last process has closed it, all data is freed and /dev/initrd
68 can't be opened anymore. 68 can't be opened anymore.
69 69
70 root=/dev/ram0 (without devfs) 70 root=/dev/ram0
71 root=/dev/rd/0 (with devfs)
72 71
73 initrd is mounted as root, and the normal boot procedure is followed, 72 initrd is mounted as root, and the normal boot procedure is followed,
74 with the RAM disk still mounted as root. 73 with the RAM disk still mounted as root.
@@ -90,8 +89,7 @@ you're building an install floppy), the root file system creation
90procedure should create the /initrd directory. 89procedure should create the /initrd directory.
91 90
92If initrd will not be mounted in some cases, its content is still 91If initrd will not be mounted in some cases, its content is still
93accessible if the following device has been created (note that this 92accessible if the following device has been created:
94does not work if using devfs):
95 93
96# mknod /dev/initrd b 1 250 94# mknod /dev/initrd b 1 250
97# chmod 400 /dev/initrd 95# chmod 400 /dev/initrd
@@ -119,8 +117,7 @@ We'll describe the loopback device method:
119 (if space is critical, you may want to use the Minix FS instead of Ext2) 117 (if space is critical, you may want to use the Minix FS instead of Ext2)
120 3) mount the file system, e.g. 118 3) mount the file system, e.g.
121 # mount -t ext2 -o loop initrd /mnt 119 # mount -t ext2 -o loop initrd /mnt
122 4) create the console device (not necessary if using devfs, but it can't 120 4) create the console device:
123 hurt to do it anyway):
124 # mkdir /mnt/dev 121 # mkdir /mnt/dev
125 # mknod /mnt/dev/console c 5 1 122 # mknod /mnt/dev/console c 5 1
126 5) copy all the files that are needed to properly use the initrd 123 5) copy all the files that are needed to properly use the initrd
@@ -152,12 +149,7 @@ have to be given:
152 149
153 root=/dev/ram0 init=/linuxrc rw 150 root=/dev/ram0 init=/linuxrc rw
154 151
155if not using devfs, or 152(rw is only necessary if writing to the initrd file system.)
156
157 root=/dev/rd/0 init=/linuxrc rw
158
159if using devfs. (rw is only necessary if writing to the initrd file
160system.)
161 153
162With LOADLIN, you simply execute 154With LOADLIN, you simply execute
163 155
@@ -217,9 +209,9 @@ following command:
217# exec chroot . what-follows <dev/console >dev/console 2>&1 209# exec chroot . what-follows <dev/console >dev/console 2>&1
218 210
219Where what-follows is a program under the new root, e.g. /sbin/init 211Where what-follows is a program under the new root, e.g. /sbin/init
220If the new root file system will be used with devfs and has no valid 212If the new root file system will be used with udev and has no valid
221/dev directory, devfs must be mounted before invoking chroot in order to 213/dev directory, udev must be initialized before invoking chroot in order
222provide /dev/console. 214to provide /dev/console.
223 215
224Note: implementation details of pivot_root may change with time. In order 216Note: implementation details of pivot_root may change with time. In order
225to ensure compatibility, the following points should be observed: 217to ensure compatibility, the following points should be observed:
@@ -236,7 +228,7 @@ Now, the initrd can be unmounted and the memory allocated by the RAM
236disk can be freed: 228disk can be freed:
237 229
238# umount /initrd 230# umount /initrd
239# blockdev --flushbufs /dev/ram0 # /dev/rd/0 if using devfs 231# blockdev --flushbufs /dev/ram0
240 232
241It is also possible to use initrd with an NFS-mounted root, see the 233It is also possible to use initrd with an NFS-mounted root, see the
242pivot_root(8) man page for details. 234pivot_root(8) man page for details.
diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt
index 1543802ef53e..edc04d74ae23 100644
--- a/Documentation/ioctl-number.txt
+++ b/Documentation/ioctl-number.txt
@@ -119,7 +119,6 @@ Code Seq# Include File Comments
119'c' 00-7F linux/comstats.h conflict! 119'c' 00-7F linux/comstats.h conflict!
120'c' 00-7F linux/coda.h conflict! 120'c' 00-7F linux/coda.h conflict!
121'd' 00-FF linux/char/drm/drm/h conflict! 121'd' 00-FF linux/char/drm/drm/h conflict!
122'd' 00-1F linux/devfs_fs.h conflict!
123'd' 00-DF linux/video_decoder.h conflict! 122'd' 00-DF linux/video_decoder.h conflict!
124'd' F0-FF linux/digi1.h 123'd' F0-FF linux/digi1.h
125'e' all linux/digi1.h conflict! 124'e' all linux/digi1.h conflict!
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 25f8d20dac53..86e9282d1c20 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -35,7 +35,6 @@ parameter is applicable:
35 APM Advanced Power Management support is enabled. 35 APM Advanced Power Management support is enabled.
36 AX25 Appropriate AX.25 support is enabled. 36 AX25 Appropriate AX.25 support is enabled.
37 CD Appropriate CD support is enabled. 37 CD Appropriate CD support is enabled.
38 DEVFS devfs support is enabled.
39 DRM Direct Rendering Management support is enabled. 38 DRM Direct Rendering Management support is enabled.
40 EDD BIOS Enhanced Disk Drive Services (EDD) is enabled 39 EDD BIOS Enhanced Disk Drive Services (EDD) is enabled
41 EFI EFI Partitioning (GPT) is enabled 40 EFI EFI Partitioning (GPT) is enabled
@@ -440,9 +439,6 @@ running once the system is up.
440 Format: <area>[,<node>] 439 Format: <area>[,<node>]
441 See also Documentation/networking/decnet.txt. 440 See also Documentation/networking/decnet.txt.
442 441
443 devfs= [DEVFS]
444 See Documentation/filesystems/devfs/boot-options.
445
446 dhash_entries= [KNL] 442 dhash_entries= [KNL]
447 Set number of hash buckets for dentry cache. 443 Set number of hash buckets for dentry cache.
448 444
diff --git a/arch/cris/arch-v10/kernel/debugport.c b/arch/cris/arch-v10/kernel/debugport.c
index f3a85b77c17e..dde813e16294 100644
--- a/arch/cris/arch-v10/kernel/debugport.c
+++ b/arch/cris/arch-v10/kernel/debugport.c
@@ -541,7 +541,7 @@ init_dummy_console(void)
541 dummy_driver.init_termios = tty_std_termios; 541 dummy_driver.init_termios = tty_std_termios;
542 dummy_driver.init_termios.c_cflag = 542 dummy_driver.init_termios.c_cflag =
543 B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */ 543 B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */
544 dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; 544 dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
545 545
546 dummy_driver.open = dummy_open; 546 dummy_driver.open = dummy_open;
547 dummy_driver.close = dummy_close; 547 dummy_driver.close = dummy_close;
diff --git a/arch/cris/arch-v32/kernel/debugport.c b/arch/cris/arch-v32/kernel/debugport.c
index ffc1ebf2dfee..3dc587e6201a 100644
--- a/arch/cris/arch-v32/kernel/debugport.c
+++ b/arch/cris/arch-v32/kernel/debugport.c
@@ -353,7 +353,7 @@ init_dummy_console(void)
353 dummy_driver.init_termios = tty_std_termios; 353 dummy_driver.init_termios = tty_std_termios;
354 dummy_driver.init_termios.c_cflag = 354 dummy_driver.init_termios.c_cflag =
355 B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */ 355 B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */
356 dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; 356 dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
357 357
358 dummy_driver.open = dummy_open; 358 dummy_driver.open = dummy_open;
359 dummy_driver.close = dummy_close; 359 dummy_driver.close = dummy_close;
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index 0a865889b2a9..40b44cc0d14b 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -493,7 +493,6 @@ static struct file_operations microcode_fops = {
493static struct miscdevice microcode_dev = { 493static struct miscdevice microcode_dev = {
494 .minor = MICROCODE_MINOR, 494 .minor = MICROCODE_MINOR,
495 .name = "microcode", 495 .name = "microcode",
496 .devfs_name = "cpu/microcode",
497 .fops = &microcode_fops, 496 .fops = &microcode_fops,
498}; 497};
499 498
diff --git a/arch/ppc/4xx_io/serial_sicc.c b/arch/ppc/4xx_io/serial_sicc.c
index 98b25fa0049a..1e113d0f59b8 100644
--- a/arch/ppc/4xx_io/serial_sicc.c
+++ b/arch/ppc/4xx_io/serial_sicc.c
@@ -1758,7 +1758,7 @@ int __init siccuart_init(void)
1758 siccnormal_driver->subtype = SERIAL_TYPE_NORMAL; 1758 siccnormal_driver->subtype = SERIAL_TYPE_NORMAL;
1759 siccnormal_driver->init_termios = tty_std_termios; 1759 siccnormal_driver->init_termios = tty_std_termios;
1760 siccnormal_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; 1760 siccnormal_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
1761 siccnormal_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; 1761 siccnormal_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
1762 tty_set_operations(siccnormal_driver, &sicc_ops); 1762 tty_set_operations(siccnormal_driver, &sicc_ops);
1763 1763
1764 if (tty_register_driver(siccnormal_driver)) 1764 if (tty_register_driver(siccnormal_driver))
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c
index 8437ea7430fe..83a4f91bce5a 100644
--- a/arch/sh/kernel/cpu/sh4/sq.c
+++ b/arch/sh/kernel/cpu/sh4/sq.c
@@ -417,7 +417,6 @@ static struct file_operations sq_fops = {
417static struct miscdevice sq_dev = { 417static struct miscdevice sq_dev = {
418 .minor = STORE_QUEUE_MINOR, 418 .minor = STORE_QUEUE_MINOR,
419 .name = "sq", 419 .name = "sq",
420 .devfs_name = "cpu/sq",
421 .fops = &sq_fops, 420 .fops = &sq_fops,
422}; 421};
423 422
diff --git a/arch/sparc64/solaris/socksys.c b/arch/sparc64/solaris/socksys.c
index fc6669e8dde1..bc3df95bc057 100644
--- a/arch/sparc64/solaris/socksys.c
+++ b/arch/sparc64/solaris/socksys.c
@@ -26,7 +26,6 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/syscalls.h> 27#include <linux/syscalls.h>
28#include <linux/in.h> 28#include <linux/in.h>
29#include <linux/devfs_fs_kernel.h>
30 29
31#include <net/sock.h> 30#include <net/sock.h>
32 31
@@ -190,8 +189,6 @@ init_socksys(void)
190 return ret; 189 return ret;
191 } 190 }
192 191
193 devfs_mk_cdev(MKDEV(30, 0), S_IFCHR|S_IRUSR|S_IWUSR, "socksys");
194
195 file = fcheck(ret); 192 file = fcheck(ret);
196 /* N.B. Is this valid? Suppose the f_ops are in a module ... */ 193 /* N.B. Is this valid? Suppose the f_ops are in a module ... */
197 socksys_file_ops = *file->f_op; 194 socksys_file_ops = *file->f_op;
@@ -207,5 +204,4 @@ cleanup_socksys(void)
207{ 204{
208 if (unregister_chrdev(30, "socksys")) 205 if (unregister_chrdev(30, "socksys"))
209 printk ("Couldn't unregister socksys character device\n"); 206 printk ("Couldn't unregister socksys character device\n");
210 devfs_remove ("socksys");
211} 207}
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 6c2d4ccaf20f..5ca57ca33713 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -8,7 +8,6 @@
8#include "linux/list.h" 8#include "linux/list.h"
9#include "linux/kd.h" 9#include "linux/kd.h"
10#include "linux/interrupt.h" 10#include "linux/interrupt.h"
11#include "linux/devfs_fs_kernel.h"
12#include "asm/uaccess.h" 11#include "asm/uaccess.h"
13#include "chan_kern.h" 12#include "chan_kern.h"
14#include "irq_user.h" 13#include "irq_user.h"
@@ -655,7 +654,6 @@ struct tty_driver *line_register_devfs(struct lines *set,
655 654
656 driver->driver_name = line_driver->name; 655 driver->driver_name = line_driver->name;
657 driver->name = line_driver->device_name; 656 driver->name = line_driver->device_name;
658 driver->devfs_name = line_driver->devfs_name;
659 driver->major = line_driver->major; 657 driver->major = line_driver->major;
660 driver->minor_start = line_driver->minor_start; 658 driver->minor_start = line_driver->minor_start;
661 driver->type = line_driver->type; 659 driver->type = line_driver->type;
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index a4d6415bc8c4..6dafd6fbfdae 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -54,7 +54,6 @@ static int ssl_remove(int n);
54static struct line_driver driver = { 54static struct line_driver driver = {
55 .name = "UML serial line", 55 .name = "UML serial line",
56 .device_name = "ttyS", 56 .device_name = "ttyS",
57 .devfs_name = "tts/",
58 .major = TTY_MAJOR, 57 .major = TTY_MAJOR,
59 .minor_start = 64, 58 .minor_start = 64,
60 .type = TTY_DRIVER_TYPE_SERIAL, 59 .type = TTY_DRIVER_TYPE_SERIAL,
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 61db8b2fc83f..856f568c2687 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -60,7 +60,6 @@ static int con_remove(int n);
60static struct line_driver driver = { 60static struct line_driver driver = {
61 .name = "UML console", 61 .name = "UML console",
62 .device_name = "tty", 62 .device_name = "tty",
63 .devfs_name = "vc/",
64 .major = TTY_MAJOR, 63 .major = TTY_MAJOR,
65 .minor_start = 0, 64 .minor_start = 0,
66 .type = TTY_DRIVER_TYPE_CONSOLE, 65 .type = TTY_DRIVER_TYPE_CONSOLE,
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 290cec6d69e2..0345e2551247 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -25,7 +25,6 @@
25#include "linux/blkdev.h" 25#include "linux/blkdev.h"
26#include "linux/hdreg.h" 26#include "linux/hdreg.h"
27#include "linux/init.h" 27#include "linux/init.h"
28#include "linux/devfs_fs_kernel.h"
29#include "linux/cdrom.h" 28#include "linux/cdrom.h"
30#include "linux/proc_fs.h" 29#include "linux/proc_fs.h"
31#include "linux/ctype.h" 30#include "linux/ctype.h"
@@ -628,7 +627,6 @@ static int ubd_new_disk(int major, u64 size, int unit,
628 627
629{ 628{
630 struct gendisk *disk; 629 struct gendisk *disk;
631 char from[sizeof("ubd/nnnnn\0")], to[sizeof("discnnnnn/disc\0")];
632 int err; 630 int err;
633 631
634 disk = alloc_disk(1 << UBD_SHIFT); 632 disk = alloc_disk(1 << UBD_SHIFT);
@@ -639,20 +637,10 @@ static int ubd_new_disk(int major, u64 size, int unit,
639 disk->first_minor = unit << UBD_SHIFT; 637 disk->first_minor = unit << UBD_SHIFT;
640 disk->fops = &ubd_blops; 638 disk->fops = &ubd_blops;
641 set_capacity(disk, size / 512); 639 set_capacity(disk, size / 512);
642 if(major == MAJOR_NR){ 640 if(major == MAJOR_NR)
643 sprintf(disk->disk_name, "ubd%c", 'a' + unit); 641 sprintf(disk->disk_name, "ubd%c", 'a' + unit);
644 sprintf(disk->devfs_name, "ubd/disc%d", unit); 642 else
645 sprintf(from, "ubd/%d", unit);
646 sprintf(to, "disc%d/disc", unit);
647 err = devfs_mk_symlink(from, to);
648 if(err)
649 printk("ubd_new_disk failed to make link from %s to "
650 "%s, error = %d\n", from, to, err);
651 }
652 else {
653 sprintf(disk->disk_name, "ubd_fake%d", unit); 643 sprintf(disk->disk_name, "ubd_fake%d", unit);
654 sprintf(disk->devfs_name, "ubd_fake/disc%d", unit);
655 }
656 644
657 /* sysfs register (not for ide fake devices) */ 645 /* sysfs register (not for ide fake devices) */
658 if (major == MAJOR_NR) { 646 if (major == MAJOR_NR) {
@@ -841,7 +829,6 @@ int ubd_init(void)
841{ 829{
842 int i; 830 int i;
843 831
844 devfs_mk_dir("ubd");
845 if (register_blkdev(MAJOR_NR, "ubd")) 832 if (register_blkdev(MAJOR_NR, "ubd"))
846 return -1; 833 return -1;
847 834
@@ -855,7 +842,6 @@ int ubd_init(void)
855 char name[sizeof("ubd_nnn\0")]; 842 char name[sizeof("ubd_nnn\0")];
856 843
857 snprintf(name, sizeof(name), "ubd_%d", fake_major); 844 snprintf(name, sizeof(name), "ubd_%d", fake_major);
858 devfs_mk_dir(name);
859 if (register_blkdev(fake_major, "ubd")) 845 if (register_blkdev(fake_major, "ubd"))
860 return -1; 846 return -1;
861 } 847 }
diff --git a/arch/um/include/line.h b/arch/um/include/line.h
index 6ac0f8252e21..27bf2f6fbc05 100644
--- a/arch/um/include/line.h
+++ b/arch/um/include/line.h
@@ -17,7 +17,6 @@
17struct line_driver { 17struct line_driver {
18 char *name; 18 char *name;
19 char *device_name; 19 char *device_name;
20 char *devfs_name;
21 short major; 20 short major;
22 short minor_start; 21 short minor_start;
23 short type; 22 short type;
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index dd8a1501142f..50ca1aa4ee3b 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -2530,7 +2530,6 @@ static boolean DAC960_RegisterBlockDevice(DAC960_Controller_T *Controller)
2530 blk_queue_max_sectors(RequestQueue, Controller->MaxBlocksPerCommand); 2530 blk_queue_max_sectors(RequestQueue, Controller->MaxBlocksPerCommand);
2531 disk->queue = RequestQueue; 2531 disk->queue = RequestQueue;
2532 sprintf(disk->disk_name, "rd/c%dd%d", Controller->ControllerNumber, n); 2532 sprintf(disk->disk_name, "rd/c%dd%d", Controller->ControllerNumber, n);
2533 sprintf(disk->devfs_name, "rd/host%d/target%d", Controller->ControllerNumber, n);
2534 disk->major = MajorNumber; 2533 disk->major = MajorNumber;
2535 disk->first_minor = n << DAC960_MaxPartitionsBits; 2534 disk->first_minor = n << DAC960_MaxPartitionsBits;
2536 disk->fops = &DAC960_BlockDeviceOperations; 2535 disk->fops = &DAC960_BlockDeviceOperations;
diff --git a/drivers/block/acsi.c b/drivers/block/acsi.c
index 196c0ec9cd54..a317e4303952 100644
--- a/drivers/block/acsi.c
+++ b/drivers/block/acsi.c
@@ -1732,13 +1732,10 @@ int acsi_init( void )
1732 struct gendisk *disk = acsi_gendisk[i]; 1732 struct gendisk *disk = acsi_gendisk[i];
1733 sprintf(disk->disk_name, "ad%c", 'a'+i); 1733 sprintf(disk->disk_name, "ad%c", 'a'+i);
1734 aip = &acsi_info[NDevices]; 1734 aip = &acsi_info[NDevices];
1735 sprintf(disk->devfs_name, "ad/target%d/lun%d", aip->target, aip->lun);
1736 disk->major = ACSI_MAJOR; 1735 disk->major = ACSI_MAJOR;
1737 disk->first_minor = i << 4; 1736 disk->first_minor = i << 4;
1738 if (acsi_info[i].type != HARDDISK) { 1737 if (acsi_info[i].type != HARDDISK)
1739 disk->minors = 1; 1738 disk->minors = 1;
1740 strcat(disk->devfs_name, "/disc");
1741 }
1742 disk->fops = &acsi_fops; 1739 disk->fops = &acsi_fops;
1743 disk->private_data = &acsi_info[i]; 1740 disk->private_data = &acsi_info[i];
1744 set_capacity(disk, acsi_info[i].size); 1741 set_capacity(disk, acsi_info[i].size);
diff --git a/drivers/block/acsi_slm.c b/drivers/block/acsi_slm.c
index 4cb9c1336287..4030a8fd1187 100644
--- a/drivers/block/acsi_slm.c
+++ b/drivers/block/acsi_slm.c
@@ -65,7 +65,6 @@ not be guaranteed. There are several ways to assure this:
65#include <linux/time.h> 65#include <linux/time.h>
66#include <linux/mm.h> 66#include <linux/mm.h>
67#include <linux/slab.h> 67#include <linux/slab.h>
68#include <linux/devfs_fs_kernel.h>
69#include <linux/smp_lock.h> 68#include <linux/smp_lock.h>
70 69
71#include <asm/pgtable.h> 70#include <asm/pgtable.h>
@@ -1005,11 +1004,6 @@ int slm_init( void )
1005 BufferP = SLMBuffer; 1004 BufferP = SLMBuffer;
1006 SLMState = IDLE; 1005 SLMState = IDLE;
1007 1006
1008 devfs_mk_dir("slm");
1009 for (i = 0; i < MAX_SLM; i++) {
1010 devfs_mk_cdev(MKDEV(ACSI_MAJOR, i),
1011 S_IFCHR|S_IRUSR|S_IWUSR, "slm/%d", i);
1012 }
1013 return 0; 1007 return 0;
1014} 1008}
1015 1009
@@ -1032,10 +1026,6 @@ int init_module(void)
1032 1026
1033void cleanup_module(void) 1027void cleanup_module(void)
1034{ 1028{
1035 int i;
1036 for (i = 0; i < MAX_SLM; i++)
1037 devfs_remove("slm/%d", i);
1038 devfs_remove("slm");
1039 if (unregister_chrdev( ACSI_MAJOR, "slm" ) != 0) 1029 if (unregister_chrdev( ACSI_MAJOR, "slm" ) != 0)
1040 printk( KERN_ERR "acsi_slm: cleanup_module failed\n"); 1030 printk( KERN_ERR "acsi_slm: cleanup_module failed\n");
1041 atari_stram_free( SLMBuffer ); 1031 atari_stram_free( SLMBuffer );
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 39b0f53186e8..05fb08312c01 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3248,7 +3248,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3248 3248
3249 q->queuedata = hba[i]; 3249 q->queuedata = hba[i];
3250 sprintf(disk->disk_name, "cciss/c%dd%d", i, j); 3250 sprintf(disk->disk_name, "cciss/c%dd%d", i, j);
3251 sprintf(disk->devfs_name, "cciss/host%d/target%d", i, j);
3252 disk->major = hba[i]->major; 3251 disk->major = hba[i]->major;
3253 disk->first_minor = j << NWD_SHIFT; 3252 disk->first_minor = j << NWD_SHIFT;
3254 disk->fops = &cciss_fops; 3253 disk->fops = &cciss_fops;
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 5eb6fb7b5cfa..bfd245df0a8c 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -33,7 +33,6 @@
33#include <linux/blkpg.h> 33#include <linux/blkpg.h>
34#include <linux/timer.h> 34#include <linux/timer.h>
35#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
36#include <linux/devfs_fs_kernel.h>
37#include <linux/init.h> 36#include <linux/init.h>
38#include <linux/hdreg.h> 37#include <linux/hdreg.h>
39#include <linux/spinlock.h> 38#include <linux/spinlock.h>
@@ -348,7 +347,6 @@ static void __devexit cpqarray_remove_one(int i)
348 for(j = 0; j < NWD; j++) { 347 for(j = 0; j < NWD; j++) {
349 if (ida_gendisk[i][j]->flags & GENHD_FL_UP) 348 if (ida_gendisk[i][j]->flags & GENHD_FL_UP)
350 del_gendisk(ida_gendisk[i][j]); 349 del_gendisk(ida_gendisk[i][j]);
351 devfs_remove("ida/c%dd%d",i,j);
352 put_disk(ida_gendisk[i][j]); 350 put_disk(ida_gendisk[i][j]);
353 } 351 }
354 blk_cleanup_queue(hba[i]->queue); 352 blk_cleanup_queue(hba[i]->queue);
@@ -1807,8 +1805,6 @@ static void getgeometry(int ctlr)
1807 1805
1808 } 1806 }
1809 1807
1810 sprintf(disk->devfs_name, "ida/c%dd%d", ctlr, log_unit);
1811
1812 info_p->phys_drives = 1808 info_p->phys_drives =
1813 sense_config_buf->ctlr_phys_drv; 1809 sense_config_buf->ctlr_phys_drv;
1814 info_p->drv_assign_map 1810 info_p->drv_assign_map
@@ -1844,7 +1840,6 @@ static void __exit cpqarray_exit(void)
1844 } 1840 }
1845 } 1841 }
1846 1842
1847 devfs_remove("ida");
1848 remove_proc_entry("cpqarray", proc_root_driver); 1843 remove_proc_entry("cpqarray", proc_root_driver);
1849} 1844}
1850 1845
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index dff1e67b1dd4..0242cbb86a87 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -177,7 +177,6 @@ static int print_unex = 1;
177#include <linux/ioport.h> 177#include <linux/ioport.h>
178#include <linux/interrupt.h> 178#include <linux/interrupt.h>
179#include <linux/init.h> 179#include <linux/init.h>
180#include <linux/devfs_fs_kernel.h>
181#include <linux/platform_device.h> 180#include <linux/platform_device.h>
182#include <linux/buffer_head.h> /* for invalidate_buffers() */ 181#include <linux/buffer_head.h> /* for invalidate_buffers() */
183#include <linux/mutex.h> 182#include <linux/mutex.h>
@@ -224,7 +223,6 @@ static struct completion device_release;
224static unsigned short virtual_dma_port = 0x3f0; 223static unsigned short virtual_dma_port = 0x3f0;
225irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs); 224irqreturn_t floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs);
226static int set_dor(int fdc, char mask, char data); 225static int set_dor(int fdc, char mask, char data);
227static void register_devfs_entries(int drive) __init;
228 226
229#define K_64 0x10000 /* 64KB */ 227#define K_64 0x10000 /* 64KB */
230 228
@@ -3676,7 +3674,6 @@ static void __init config_types(void)
3676 first = 0; 3674 first = 0;
3677 } 3675 }
3678 printk("%s fd%d is %s", prepend, drive, name); 3676 printk("%s fd%d is %s", prepend, drive, name);
3679 register_devfs_entries(drive);
3680 } 3677 }
3681 *UDP = *params; 3678 *UDP = *params;
3682 } 3679 }
@@ -3954,37 +3951,6 @@ static struct block_device_operations floppy_fops = {
3954 .media_changed = check_floppy_change, 3951 .media_changed = check_floppy_change,
3955 .revalidate_disk = floppy_revalidate, 3952 .revalidate_disk = floppy_revalidate,
3956}; 3953};
3957static char *table[] = {
3958 "", "d360", "h1200", "u360", "u720", "h360", "h720",
3959 "u1440", "u2880", "CompaQ", "h1440", "u1680", "h410",
3960 "u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743",
3961 "h880", "u1040", "u1120", "h1600", "u1760", "u1920",
3962 "u3200", "u3520", "u3840", "u1840", "u800", "u1600",
3963 NULL
3964};
3965static int t360[] = { 1, 0 },
3966 t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 },
3967 t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13,
3968 17, 21, 22, 30, 0 };
3969static int *table_sup[] =
3970 { NULL, t360, t1200, t3in + 5 + 8, t3in + 5, t3in, t3in };
3971
3972static void __init register_devfs_entries(int drive)
3973{
3974 int base_minor = (drive < 4) ? drive : (124 + drive);
3975
3976 if (UDP->cmos < ARRAY_SIZE(default_drive_params)) {
3977 int i = 0;
3978 do {
3979 int minor = base_minor + (table_sup[UDP->cmos][i] << 2);
3980
3981 devfs_mk_bdev(MKDEV(FLOPPY_MAJOR, minor),
3982 S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |
3983 S_IWGRP, "floppy/%d%s", drive,
3984 table[table_sup[UDP->cmos][i]]);
3985 } while (table_sup[UDP->cmos][i++]);
3986 }
3987}
3988 3954
3989/* 3955/*
3990 * Floppy Driver initialization 3956 * Floppy Driver initialization
@@ -4261,11 +4227,9 @@ static int __init floppy_init(void)
4261 motor_off_timer[dr].function = motor_off_callback; 4227 motor_off_timer[dr].function = motor_off_callback;
4262 } 4228 }
4263 4229
4264 devfs_mk_dir("floppy");
4265
4266 err = register_blkdev(FLOPPY_MAJOR, "fd"); 4230 err = register_blkdev(FLOPPY_MAJOR, "fd");
4267 if (err) 4231 if (err)
4268 goto out_devfs_remove; 4232 goto out_put_disk;
4269 4233
4270 floppy_queue = blk_init_queue(do_fd_request, &floppy_lock); 4234 floppy_queue = blk_init_queue(do_fd_request, &floppy_lock);
4271 if (!floppy_queue) { 4235 if (!floppy_queue) {
@@ -4424,8 +4388,6 @@ out_unreg_region:
4424 blk_cleanup_queue(floppy_queue); 4388 blk_cleanup_queue(floppy_queue);
4425out_unreg_blkdev: 4389out_unreg_blkdev:
4426 unregister_blkdev(FLOPPY_MAJOR, "fd"); 4390 unregister_blkdev(FLOPPY_MAJOR, "fd");
4427out_devfs_remove:
4428 devfs_remove("floppy");
4429out_put_disk: 4391out_put_disk:
4430 while (dr--) { 4392 while (dr--) {
4431 del_timer(&motor_off_timer[dr]); 4393 del_timer(&motor_off_timer[dr]);
@@ -4586,19 +4548,6 @@ static void floppy_release_irq_and_dma(void)
4586 4548
4587static char *floppy; 4549static char *floppy;
4588 4550
4589static void unregister_devfs_entries(int drive)
4590{
4591 int i;
4592
4593 if (UDP->cmos < ARRAY_SIZE(default_drive_params)) {
4594 i = 0;
4595 do {
4596 devfs_remove("floppy/%d%s", drive,
4597 table[table_sup[UDP->cmos][i]]);
4598 } while (table_sup[UDP->cmos][i++]);
4599 }
4600}
4601
4602static void __init parse_floppy_cfg_string(char *cfg) 4551static void __init parse_floppy_cfg_string(char *cfg)
4603{ 4552{
4604 char *ptr; 4553 char *ptr;
@@ -4635,13 +4584,11 @@ void cleanup_module(void)
4635 if ((allowed_drive_mask & (1 << drive)) && 4584 if ((allowed_drive_mask & (1 << drive)) &&
4636 fdc_state[FDC(drive)].version != FDC_NONE) { 4585 fdc_state[FDC(drive)].version != FDC_NONE) {
4637 del_gendisk(disks[drive]); 4586 del_gendisk(disks[drive]);
4638 unregister_devfs_entries(drive);
4639 device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); 4587 device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
4640 platform_device_unregister(&floppy_device[drive]); 4588 platform_device_unregister(&floppy_device[drive]);
4641 } 4589 }
4642 put_disk(disks[drive]); 4590 put_disk(disks[drive]);
4643 } 4591 }
4644 devfs_remove("floppy");
4645 4592
4646 del_timer_sync(&fd_timeout); 4593 del_timer_sync(&fd_timeout);
4647 del_timer_sync(&fd_timer); 4594 del_timer_sync(&fd_timer);
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 18dd026f470d..013c5daddb0b 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -63,7 +63,6 @@
63#include <linux/blkdev.h> 63#include <linux/blkdev.h>
64#include <linux/blkpg.h> 64#include <linux/blkpg.h>
65#include <linux/init.h> 65#include <linux/init.h>
66#include <linux/devfs_fs_kernel.h>
67#include <linux/smp_lock.h> 66#include <linux/smp_lock.h>
68#include <linux/swap.h> 67#include <linux/swap.h>
69#include <linux/slab.h> 68#include <linux/slab.h>
@@ -1277,8 +1276,6 @@ static int __init loop_init(void)
1277 goto out_mem3; 1276 goto out_mem3;
1278 } 1277 }
1279 1278
1280 devfs_mk_dir("loop");
1281
1282 for (i = 0; i < max_loop; i++) { 1279 for (i = 0; i < max_loop; i++) {
1283 struct loop_device *lo = &loop_dev[i]; 1280 struct loop_device *lo = &loop_dev[i];
1284 struct gendisk *disk = disks[i]; 1281 struct gendisk *disk = disks[i];
@@ -1296,7 +1293,6 @@ static int __init loop_init(void)
1296 disk->first_minor = i; 1293 disk->first_minor = i;
1297 disk->fops = &lo_fops; 1294 disk->fops = &lo_fops;
1298 sprintf(disk->disk_name, "loop%d", i); 1295 sprintf(disk->disk_name, "loop%d", i);
1299 sprintf(disk->devfs_name, "loop/%d", i);
1300 disk->private_data = lo; 1296 disk->private_data = lo;
1301 disk->queue = lo->lo_queue; 1297 disk->queue = lo->lo_queue;
1302 } 1298 }
@@ -1310,7 +1306,6 @@ static int __init loop_init(void)
1310out_mem4: 1306out_mem4:
1311 while (i--) 1307 while (i--)
1312 blk_cleanup_queue(loop_dev[i].lo_queue); 1308 blk_cleanup_queue(loop_dev[i].lo_queue);
1313 devfs_remove("loop");
1314 i = max_loop; 1309 i = max_loop;
1315out_mem3: 1310out_mem3:
1316 while (i--) 1311 while (i--)
@@ -1333,7 +1328,6 @@ static void loop_exit(void)
1333 blk_cleanup_queue(loop_dev[i].lo_queue); 1328 blk_cleanup_queue(loop_dev[i].lo_queue);
1334 put_disk(disks[i]); 1329 put_disk(disks[i]);
1335 } 1330 }
1336 devfs_remove("loop");
1337 if (unregister_blkdev(LOOP_MAJOR, "loop")) 1331 if (unregister_blkdev(LOOP_MAJOR, "loop"))
1338 printk(KERN_WARNING "loop: cannot unregister blkdev\n"); 1332 printk(KERN_WARNING "loop: cannot unregister blkdev\n");
1339 1333
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 7f554f2ed079..39662f0c9cce 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -29,8 +29,6 @@
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <net/sock.h> 30#include <net/sock.h>
31 31
32#include <linux/devfs_fs_kernel.h>
33
34#include <asm/uaccess.h> 32#include <asm/uaccess.h>
35#include <asm/system.h> 33#include <asm/system.h>
36#include <asm/types.h> 34#include <asm/types.h>
@@ -642,7 +640,6 @@ static int __init nbd_init(void)
642 printk(KERN_INFO "nbd: registered device at major %d\n", NBD_MAJOR); 640 printk(KERN_INFO "nbd: registered device at major %d\n", NBD_MAJOR);
643 dprintk(DBG_INIT, "nbd: debugflags=0x%x\n", debugflags); 641 dprintk(DBG_INIT, "nbd: debugflags=0x%x\n", debugflags);
644 642
645 devfs_mk_dir("nbd");
646 for (i = 0; i < nbds_max; i++) { 643 for (i = 0; i < nbds_max; i++) {
647 struct gendisk *disk = nbd_dev[i].disk; 644 struct gendisk *disk = nbd_dev[i].disk;
648 nbd_dev[i].file = NULL; 645 nbd_dev[i].file = NULL;
@@ -660,7 +657,6 @@ static int __init nbd_init(void)
660 disk->private_data = &nbd_dev[i]; 657 disk->private_data = &nbd_dev[i];
661 disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; 658 disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
662 sprintf(disk->disk_name, "nbd%d", i); 659 sprintf(disk->disk_name, "nbd%d", i);
663 sprintf(disk->devfs_name, "nbd/%d", i);
664 set_capacity(disk, 0x7ffffc00ULL << 1); /* 2 TB */ 660 set_capacity(disk, 0x7ffffc00ULL << 1); /* 2 TB */
665 add_disk(disk); 661 add_disk(disk);
666 } 662 }
@@ -686,7 +682,6 @@ static void __exit nbd_cleanup(void)
686 put_disk(disk); 682 put_disk(disk);
687 } 683 }
688 } 684 }
689 devfs_remove("nbd");
690 unregister_blkdev(NBD_MAJOR, "nbd"); 685 unregister_blkdev(NBD_MAJOR, "nbd");
691 printk(KERN_INFO "nbd: unregistered device at major %d\n", NBD_MAJOR); 686 printk(KERN_INFO "nbd: unregistered device at major %d\n", NBD_MAJOR);
692} 687}
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 79b868254032..13f998aa1cd3 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -156,7 +156,6 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
156#include <linux/module.h> 156#include <linux/module.h>
157#include <linux/init.h> 157#include <linux/init.h>
158#include <linux/fs.h> 158#include <linux/fs.h>
159#include <linux/devfs_fs_kernel.h>
160#include <linux/delay.h> 159#include <linux/delay.h>
161#include <linux/slab.h> 160#include <linux/slab.h>
162#include <linux/mtio.h> 161#include <linux/mtio.h>
@@ -674,25 +673,15 @@ static int __init pg_init(void)
674 err = PTR_ERR(pg_class); 673 err = PTR_ERR(pg_class);
675 goto out_chrdev; 674 goto out_chrdev;
676 } 675 }
677 devfs_mk_dir("pg");
678 for (unit = 0; unit < PG_UNITS; unit++) { 676 for (unit = 0; unit < PG_UNITS; unit++) {
679 struct pg *dev = &devices[unit]; 677 struct pg *dev = &devices[unit];
680 if (dev->present) { 678 if (dev->present)
681 class_device_create(pg_class, NULL, MKDEV(major, unit), 679 class_device_create(pg_class, NULL, MKDEV(major, unit),
682 NULL, "pg%u", unit); 680 NULL, "pg%u", unit);
683 err = devfs_mk_cdev(MKDEV(major, unit),
684 S_IFCHR | S_IRUSR | S_IWUSR, "pg/%u",
685 unit);
686 if (err)
687 goto out_class;
688 }
689 } 681 }
690 err = 0; 682 err = 0;
691 goto out; 683 goto out;
692 684
693out_class:
694 class_device_destroy(pg_class, MKDEV(major, unit));
695 class_destroy(pg_class);
696out_chrdev: 685out_chrdev:
697 unregister_chrdev(major, "pg"); 686 unregister_chrdev(major, "pg");
698out: 687out:
@@ -705,13 +694,10 @@ static void __exit pg_exit(void)
705 694
706 for (unit = 0; unit < PG_UNITS; unit++) { 695 for (unit = 0; unit < PG_UNITS; unit++) {
707 struct pg *dev = &devices[unit]; 696 struct pg *dev = &devices[unit];
708 if (dev->present) { 697 if (dev->present)
709 class_device_destroy(pg_class, MKDEV(major, unit)); 698 class_device_destroy(pg_class, MKDEV(major, unit));
710 devfs_remove("pg/%u", unit);
711 }
712 } 699 }
713 class_destroy(pg_class); 700 class_destroy(pg_class);
714 devfs_remove("pg");
715 unregister_chrdev(major, name); 701 unregister_chrdev(major, name);
716 702
717 for (unit = 0; unit < PG_UNITS; unit++) { 703 for (unit = 0; unit < PG_UNITS; unit++) {
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index d2013d362403..35fb26636721 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -141,7 +141,6 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3};
141#include <linux/module.h> 141#include <linux/module.h>
142#include <linux/init.h> 142#include <linux/init.h>
143#include <linux/fs.h> 143#include <linux/fs.h>
144#include <linux/devfs_fs_kernel.h>
145#include <linux/delay.h> 144#include <linux/delay.h>
146#include <linux/slab.h> 145#include <linux/slab.h>
147#include <linux/mtio.h> 146#include <linux/mtio.h>
@@ -971,32 +970,15 @@ static int __init pt_init(void)
971 goto out_chrdev; 970 goto out_chrdev;
972 } 971 }
973 972
974 devfs_mk_dir("pt");
975 for (unit = 0; unit < PT_UNITS; unit++) 973 for (unit = 0; unit < PT_UNITS; unit++)
976 if (pt[unit].present) { 974 if (pt[unit].present) {
977 class_device_create(pt_class, NULL, MKDEV(major, unit), 975 class_device_create(pt_class, NULL, MKDEV(major, unit),
978 NULL, "pt%d", unit); 976 NULL, "pt%d", unit);
979 err = devfs_mk_cdev(MKDEV(major, unit),
980 S_IFCHR | S_IRUSR | S_IWUSR,
981 "pt/%d", unit);
982 if (err) {
983 class_device_destroy(pt_class, MKDEV(major, unit));
984 goto out_class;
985 }
986 class_device_create(pt_class, NULL, MKDEV(major, unit + 128), 977 class_device_create(pt_class, NULL, MKDEV(major, unit + 128),
987 NULL, "pt%dn", unit); 978 NULL, "pt%dn", unit);
988 err = devfs_mk_cdev(MKDEV(major, unit + 128),
989 S_IFCHR | S_IRUSR | S_IWUSR,
990 "pt/%dn", unit);
991 if (err) {
992 class_device_destroy(pt_class, MKDEV(major, unit + 128));
993 goto out_class;
994 }
995 } 979 }
996 goto out; 980 goto out;
997 981
998out_class:
999 class_destroy(pt_class);
1000out_chrdev: 982out_chrdev:
1001 unregister_chrdev(major, "pt"); 983 unregister_chrdev(major, "pt");
1002out: 984out:
@@ -1009,12 +991,9 @@ static void __exit pt_exit(void)
1009 for (unit = 0; unit < PT_UNITS; unit++) 991 for (unit = 0; unit < PT_UNITS; unit++)
1010 if (pt[unit].present) { 992 if (pt[unit].present) {
1011 class_device_destroy(pt_class, MKDEV(major, unit)); 993 class_device_destroy(pt_class, MKDEV(major, unit));
1012 devfs_remove("pt/%d", unit);
1013 class_device_destroy(pt_class, MKDEV(major, unit + 128)); 994 class_device_destroy(pt_class, MKDEV(major, unit + 128));
1014 devfs_remove("pt/%dn", unit);
1015 } 995 }
1016 class_destroy(pt_class); 996 class_destroy(pt_class);
1017 devfs_remove("pt");
1018 unregister_chrdev(major, name); 997 unregister_chrdev(major, name);
1019 for (unit = 0; unit < PT_UNITS; unit++) 998 for (unit = 0; unit < PT_UNITS; unit++)
1020 if (pt[unit].present) 999 if (pt[unit].present)
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index a04f60693c39..3e4cce5e4736 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2612,7 +2612,6 @@ static struct file_operations pkt_ctl_fops = {
2612static struct miscdevice pkt_misc = { 2612static struct miscdevice pkt_misc = {
2613 .minor = MISC_DYNAMIC_MINOR, 2613 .minor = MISC_DYNAMIC_MINOR,
2614 .name = "pktcdvd", 2614 .name = "pktcdvd",
2615 .devfs_name = "pktcdvd/control",
2616 .fops = &pkt_ctl_fops 2615 .fops = &pkt_ctl_fops
2617}; 2616};
2618 2617
diff --git a/drivers/block/ps2esdi.c b/drivers/block/ps2esdi.c
index bea75f2cb211..a729013a3973 100644
--- a/drivers/block/ps2esdi.c
+++ b/drivers/block/ps2esdi.c
@@ -421,7 +421,6 @@ static int __init ps2esdi_geninit(void)
421 disk->major = PS2ESDI_MAJOR; 421 disk->major = PS2ESDI_MAJOR;
422 disk->first_minor = i<<6; 422 disk->first_minor = i<<6;
423 sprintf(disk->disk_name, "ed%c", 'a'+i); 423 sprintf(disk->disk_name, "ed%c", 'a'+i);
424 sprintf(disk->devfs_name, "ed/target%d", i);
425 disk->fops = &ps2esdi_fops; 424 disk->fops = &ps2esdi_fops;
426 ps2esdi_gendisk[i] = disk; 425 ps2esdi_gendisk[i] = disk;
427 } 426 }
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index 0378da04cfa2..a9e1c2524c2a 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -50,7 +50,6 @@
50#include <linux/module.h> 50#include <linux/module.h>
51#include <linux/moduleparam.h> 51#include <linux/moduleparam.h>
52#include <linux/init.h> 52#include <linux/init.h>
53#include <linux/devfs_fs_kernel.h>
54#include <linux/pagemap.h> 53#include <linux/pagemap.h>
55#include <linux/blkdev.h> 54#include <linux/blkdev.h>
56#include <linux/genhd.h> 55#include <linux/genhd.h>
@@ -412,7 +411,6 @@ static void __exit rd_cleanup(void)
412 put_disk(rd_disks[i]); 411 put_disk(rd_disks[i]);
413 blk_cleanup_queue(rd_queue[i]); 412 blk_cleanup_queue(rd_queue[i]);
414 } 413 }
415 devfs_remove("rd");
416 unregister_blkdev(RAMDISK_MAJOR, "ramdisk"); 414 unregister_blkdev(RAMDISK_MAJOR, "ramdisk");
417} 415}
418 416
@@ -442,8 +440,6 @@ static int __init rd_init(void)
442 goto out; 440 goto out;
443 } 441 }
444 442
445 devfs_mk_dir("rd");
446
447 for (i = 0; i < CONFIG_BLK_DEV_RAM_COUNT; i++) { 443 for (i = 0; i < CONFIG_BLK_DEV_RAM_COUNT; i++) {
448 struct gendisk *disk = rd_disks[i]; 444 struct gendisk *disk = rd_disks[i];
449 445
@@ -461,7 +457,6 @@ static int __init rd_init(void)
461 disk->queue = rd_queue[i]; 457 disk->queue = rd_queue[i];
462 disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; 458 disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
463 sprintf(disk->disk_name, "ram%d", i); 459 sprintf(disk->disk_name, "ram%d", i);
464 sprintf(disk->devfs_name, "rd/%d", i);
465 set_capacity(disk, rd_size * 2); 460 set_capacity(disk, rd_size * 2);
466 add_disk(rd_disks[i]); 461 add_disk(rd_disks[i]);
467 } 462 }
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 01f042f6f1c4..628877945f9b 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -25,7 +25,6 @@
25#include <linux/fd.h> 25#include <linux/fd.h>
26#include <linux/ioctl.h> 26#include <linux/ioctl.h>
27#include <linux/blkdev.h> 27#include <linux/blkdev.h>
28#include <linux/devfs_fs_kernel.h>
29#include <linux/interrupt.h> 28#include <linux/interrupt.h>
30#include <linux/module.h> 29#include <linux/module.h>
31#include <linux/spinlock.h> 30#include <linux/spinlock.h>
@@ -1019,8 +1018,6 @@ int swim3_init(void)
1019 int err = -ENOMEM; 1018 int err = -ENOMEM;
1020 int i; 1019 int i;
1021 1020
1022 devfs_mk_dir("floppy");
1023
1024 swim = find_devices("floppy"); 1021 swim = find_devices("floppy");
1025 while (swim && (floppy_count < MAX_FLOPPIES)) 1022 while (swim && (floppy_count < MAX_FLOPPIES))
1026 { 1023 {
@@ -1064,7 +1061,6 @@ int swim3_init(void)
1064 disk->queue = swim3_queue; 1061 disk->queue = swim3_queue;
1065 disk->flags |= GENHD_FL_REMOVABLE; 1062 disk->flags |= GENHD_FL_REMOVABLE;
1066 sprintf(disk->disk_name, "fd%d", i); 1063 sprintf(disk->disk_name, "fd%d", i);
1067 sprintf(disk->devfs_name, "floppy/%d", i);
1068 set_capacity(disk, 2880); 1064 set_capacity(disk, 2880);
1069 add_disk(disk); 1065 add_disk(disk);
1070 } 1066 }
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index 8144ce9f4df0..10a4aa5fb54d 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -18,7 +18,6 @@
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/blkdev.h> 19#include <linux/blkdev.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/devfs_fs_kernel.h>
22#include <linux/interrupt.h> 21#include <linux/interrupt.h>
23#include <linux/compiler.h> 22#include <linux/compiler.h>
24#include <linux/workqueue.h> 23#include <linux/workqueue.h>
@@ -1510,7 +1509,6 @@ static int carm_init_disks(struct carm_host *host)
1510 port->disk = disk; 1509 port->disk = disk;
1511 sprintf(disk->disk_name, DRV_NAME "/%u", 1510 sprintf(disk->disk_name, DRV_NAME "/%u",
1512 (unsigned int) (host->id * CARM_MAX_PORTS) + i); 1511 (unsigned int) (host->id * CARM_MAX_PORTS) + i);
1513 sprintf(disk->devfs_name, DRV_NAME "/%u_%u", host->id, i);
1514 disk->major = host->major; 1512 disk->major = host->major;
1515 disk->first_minor = i * CARM_MINORS_PER_MAJOR; 1513 disk->first_minor = i * CARM_MINORS_PER_MAJOR;
1516 disk->fops = &carm_bd_ops; 1514 disk->fops = &carm_bd_ops;
@@ -1672,8 +1670,6 @@ static int carm_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
1672 if (host->flags & FL_DYN_MAJOR) 1670 if (host->flags & FL_DYN_MAJOR)
1673 host->major = rc; 1671 host->major = rc;
1674 1672
1675 devfs_mk_dir(DRV_NAME);
1676
1677 rc = carm_init_disks(host); 1673 rc = carm_init_disks(host);
1678 if (rc) 1674 if (rc)
1679 goto err_out_blkdev_disks; 1675 goto err_out_blkdev_disks;
@@ -1739,7 +1735,6 @@ static void carm_remove_one (struct pci_dev *pdev)
1739 1735
1740 free_irq(pdev->irq, host); 1736 free_irq(pdev->irq, host);
1741 carm_free_disks(host); 1737 carm_free_disks(host);
1742 devfs_remove(DRV_NAME);
1743 unregister_blkdev(host->major, host->name); 1738 unregister_blkdev(host->major, host->name);
1744 if (host->major == 160) 1739 if (host->major == 160)
1745 clear_bit(0, &carm_major_alloc); 1740 clear_bit(0, &carm_major_alloc);
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 60e9a9457c6b..d62b49fbf10c 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -24,12 +24,10 @@
24#include <linux/usb.h> 24#include <linux/usb.h>
25#include <linux/usb_usual.h> 25#include <linux/usb_usual.h>
26#include <linux/blkdev.h> 26#include <linux/blkdev.h>
27#include <linux/devfs_fs_kernel.h>
28#include <linux/timer.h> 27#include <linux/timer.h>
29#include <scsi/scsi.h> 28#include <scsi/scsi.h>
30 29
31#define DRV_NAME "ub" 30#define DRV_NAME "ub"
32#define DEVFS_NAME DRV_NAME
33 31
34#define UB_MAJOR 180 32#define UB_MAJOR 180
35 33
@@ -2291,7 +2289,6 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum)
2291 goto err_diskalloc; 2289 goto err_diskalloc;
2292 2290
2293 sprintf(disk->disk_name, DRV_NAME "%c", lun->id + 'a'); 2291 sprintf(disk->disk_name, DRV_NAME "%c", lun->id + 'a');
2294 sprintf(disk->devfs_name, DEVFS_NAME "/%c", lun->id + 'a');
2295 disk->major = UB_MAJOR; 2292 disk->major = UB_MAJOR;
2296 disk->first_minor = lun->id * UB_PARTS_PER_LUN; 2293 disk->first_minor = lun->id * UB_PARTS_PER_LUN;
2297 disk->fops = &ub_bd_fops; 2294 disk->fops = &ub_bd_fops;
@@ -2445,7 +2442,6 @@ static int __init ub_init(void)
2445 2442
2446 if ((rc = register_blkdev(UB_MAJOR, DRV_NAME)) != 0) 2443 if ((rc = register_blkdev(UB_MAJOR, DRV_NAME)) != 0)
2447 goto err_regblkdev; 2444 goto err_regblkdev;
2448 devfs_mk_dir(DEVFS_NAME);
2449 2445
2450 if ((rc = usb_register(&ub_driver)) != 0) 2446 if ((rc = usb_register(&ub_driver)) != 0)
2451 goto err_register; 2447 goto err_register;
@@ -2454,7 +2450,6 @@ static int __init ub_init(void)
2454 return 0; 2450 return 0;
2455 2451
2456err_register: 2452err_register:
2457 devfs_remove(DEVFS_NAME);
2458 unregister_blkdev(UB_MAJOR, DRV_NAME); 2453 unregister_blkdev(UB_MAJOR, DRV_NAME);
2459err_regblkdev: 2454err_regblkdev:
2460 return rc; 2455 return rc;
@@ -2464,7 +2459,6 @@ static void __exit ub_exit(void)
2464{ 2459{
2465 usb_deregister(&ub_driver); 2460 usb_deregister(&ub_driver);
2466 2461
2467 devfs_remove(DEVFS_NAME);
2468 unregister_blkdev(UB_MAJOR, DRV_NAME); 2462 unregister_blkdev(UB_MAJOR, DRV_NAME);
2469 usb_usual_clear_present(USB_US_TYPE_UB); 2463 usb_usual_clear_present(USB_US_TYPE_UB);
2470} 2464}
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index f7d4c65a7b8c..585197b95af7 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -1192,7 +1192,6 @@ static int __init mm_init(void)
1192 for (i = 0; i < num_cards; i++) { 1192 for (i = 0; i < num_cards; i++) {
1193 struct gendisk *disk = mm_gendisk[i]; 1193 struct gendisk *disk = mm_gendisk[i];
1194 sprintf(disk->disk_name, "umem%c", 'a'+i); 1194 sprintf(disk->disk_name, "umem%c", 'a'+i);
1195 sprintf(disk->devfs_name, "umem/card%d", i);
1196 spin_lock_init(&cards[i].lock); 1195 spin_lock_init(&cards[i].lock);
1197 disk->major = major_nr; 1196 disk->major = major_nr;
1198 disk->first_minor = i << MM_SHIFT; 1197 disk->first_minor = i << MM_SHIFT;
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index b0df4f5ab97a..ec5a1b90a0a2 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -59,7 +59,6 @@ MODULE_LICENSE("GPL");
59 * numbers 0-255 we get a maximum of 32 disks. 59 * numbers 0-255 we get a maximum of 32 disks.
60 */ 60 */
61#define VIOD_GENHD_NAME "iseries/vd" 61#define VIOD_GENHD_NAME "iseries/vd"
62#define VIOD_GENHD_DEVFS_NAME "iseries/disc"
63 62
64#define VIOD_VERS "1.64" 63#define VIOD_VERS "1.64"
65 64
@@ -523,8 +522,6 @@ retry:
523 else 522 else
524 snprintf(g->disk_name, sizeof(g->disk_name), 523 snprintf(g->disk_name, sizeof(g->disk_name),
525 VIOD_GENHD_NAME "%c", 'a' + (dev_no % 26)); 524 VIOD_GENHD_NAME "%c", 'a' + (dev_no % 26));
526 snprintf(g->devfs_name, sizeof(g->devfs_name),
527 "%s%d", VIOD_GENHD_DEVFS_NAME, dev_no);
528 g->fops = &viodasd_fops; 525 g->fops = &viodasd_fops;
529 g->queue = q; 526 g->queue = q;
530 g->private_data = d; 527 g->private_data = d;
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index cbce7c5e9445..e828e4cbd3e1 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -215,7 +215,6 @@ static int __init xd_init(void)
215 disk->major = XT_DISK_MAJOR; 215 disk->major = XT_DISK_MAJOR;
216 disk->first_minor = i<<6; 216 disk->first_minor = i<<6;
217 sprintf(disk->disk_name, "xd%c", i+'a'); 217 sprintf(disk->disk_name, "xd%c", i+'a');
218 sprintf(disk->devfs_name, "xd/target%d", i);
219 disk->fops = &xd_fops; 218 disk->fops = &xd_fops;
220 disk->private_data = p; 219 disk->private_data = p;
221 disk->queue = xd_queue; 220 disk->queue = xd_queue;
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index bb5e8d665a2a..82ddbdd7bd4b 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -354,7 +354,6 @@ z2_init(void)
354 z2ram_gendisk->first_minor = 0; 354 z2ram_gendisk->first_minor = 0;
355 z2ram_gendisk->fops = &z2_fops; 355 z2ram_gendisk->fops = &z2_fops;
356 sprintf(z2ram_gendisk->disk_name, "z2ram"); 356 sprintf(z2ram_gendisk->disk_name, "z2ram");
357 strcpy(z2ram_gendisk->devfs_name, z2ram_gendisk->disk_name);
358 357
359 z2ram_gendisk->queue = z2_queue; 358 z2ram_gendisk->queue = z2_queue;
360 add_disk(z2ram_gendisk); 359 add_disk(z2ram_gendisk);
diff --git a/drivers/cdrom/aztcd.c b/drivers/cdrom/aztcd.c
index ec004897b634..ec469497c10f 100644
--- a/drivers/cdrom/aztcd.c
+++ b/drivers/cdrom/aztcd.c
@@ -1918,7 +1918,6 @@ static int __init aztcd_init(void)
1918 azt_disk->first_minor = 0; 1918 azt_disk->first_minor = 0;
1919 azt_disk->fops = &azt_fops; 1919 azt_disk->fops = &azt_fops;
1920 sprintf(azt_disk->disk_name, "aztcd"); 1920 sprintf(azt_disk->disk_name, "aztcd");
1921 sprintf(azt_disk->devfs_name, "aztcd");
1922 azt_disk->queue = azt_queue; 1921 azt_disk->queue = azt_queue;
1923 add_disk(azt_disk); 1922 add_disk(azt_disk);
1924 azt_invalidate_buffers(); 1923 azt_invalidate_buffers();
diff --git a/drivers/cdrom/cdu31a.c b/drivers/cdrom/cdu31a.c
index 72ffd64e8b1e..5f0f2027f29e 100644
--- a/drivers/cdrom/cdu31a.c
+++ b/drivers/cdrom/cdu31a.c
@@ -161,7 +161,6 @@
161#include <linux/hdreg.h> 161#include <linux/hdreg.h>
162#include <linux/genhd.h> 162#include <linux/genhd.h>
163#include <linux/ioport.h> 163#include <linux/ioport.h>
164#include <linux/devfs_fs_kernel.h>
165#include <linux/string.h> 164#include <linux/string.h>
166#include <linux/slab.h> 165#include <linux/slab.h>
167#include <linux/init.h> 166#include <linux/init.h>
diff --git a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c
index f43a988dd413..4ee288688fed 100644
--- a/drivers/cdrom/cm206.c
+++ b/drivers/cdrom/cm206.c
@@ -187,7 +187,6 @@ History:
187#include <linux/interrupt.h> 187#include <linux/interrupt.h>
188#include <linux/timer.h> 188#include <linux/timer.h>
189#include <linux/cdrom.h> 189#include <linux/cdrom.h>
190#include <linux/devfs_fs_kernel.h>
191#include <linux/ioport.h> 190#include <linux/ioport.h>
192#include <linux/mm.h> 191#include <linux/mm.h>
193#include <linux/slab.h> 192#include <linux/slab.h>
diff --git a/drivers/cdrom/gscd.c b/drivers/cdrom/gscd.c
index ad5464ab99bc..b6ee50a2916d 100644
--- a/drivers/cdrom/gscd.c
+++ b/drivers/cdrom/gscd.c
@@ -955,7 +955,6 @@ static int __init gscd_init(void)
955 gscd_disk->first_minor = 0; 955 gscd_disk->first_minor = 0;
956 gscd_disk->fops = &gscd_fops; 956 gscd_disk->fops = &gscd_fops;
957 sprintf(gscd_disk->disk_name, "gscd"); 957 sprintf(gscd_disk->disk_name, "gscd");
958 sprintf(gscd_disk->devfs_name, "gscd");
959 958
960 if (register_blkdev(MAJOR_NR, "gscd")) { 959 if (register_blkdev(MAJOR_NR, "gscd")) {
961 ret = -EIO; 960 ret = -EIO;
diff --git a/drivers/cdrom/mcdx.c b/drivers/cdrom/mcdx.c
index 0f6e7aab8d2c..788c7a0b2fe3 100644
--- a/drivers/cdrom/mcdx.c
+++ b/drivers/cdrom/mcdx.c
@@ -74,7 +74,6 @@ static const char *mcdx_c_version
74#include <linux/major.h> 74#include <linux/major.h>
75#define MAJOR_NR MITSUMI_X_CDROM_MAJOR 75#define MAJOR_NR MITSUMI_X_CDROM_MAJOR
76#include <linux/blkdev.h> 76#include <linux/blkdev.h>
77#include <linux/devfs_fs_kernel.h>
78 77
79#include "mcdx.h" 78#include "mcdx.h"
80 79
diff --git a/drivers/cdrom/optcd.c b/drivers/cdrom/optcd.c
index 0b0eab4f40fa..25032d7edc55 100644
--- a/drivers/cdrom/optcd.c
+++ b/drivers/cdrom/optcd.c
@@ -2033,7 +2033,6 @@ static int __init optcd_init(void)
2033 optcd_disk->first_minor = 0; 2033 optcd_disk->first_minor = 0;
2034 optcd_disk->fops = &opt_fops; 2034 optcd_disk->fops = &opt_fops;
2035 sprintf(optcd_disk->disk_name, "optcd"); 2035 sprintf(optcd_disk->disk_name, "optcd");
2036 sprintf(optcd_disk->devfs_name, "optcd");
2037 2036
2038 if (!request_region(optcd_port, 4, "optcd")) { 2037 if (!request_region(optcd_port, 4, "optcd")) {
2039 printk(KERN_ERR "optcd: conflict, I/O port 0x%x already used\n", 2038 printk(KERN_ERR "optcd: conflict, I/O port 0x%x already used\n",
diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c
index 05c9e865ecaf..2fc966c65a0e 100644
--- a/drivers/cdrom/sbpcd.c
+++ b/drivers/cdrom/sbpcd.c
@@ -371,7 +371,6 @@
371#include <linux/kernel.h> 371#include <linux/kernel.h>
372#include <linux/cdrom.h> 372#include <linux/cdrom.h>
373#include <linux/ioport.h> 373#include <linux/ioport.h>
374#include <linux/devfs_fs_kernel.h>
375#include <linux/major.h> 374#include <linux/major.h>
376#include <linux/string.h> 375#include <linux/string.h>
377#include <linux/vmalloc.h> 376#include <linux/vmalloc.h>
@@ -5808,8 +5807,6 @@ int __init sbpcd_init(void)
5808 return -ENOMEM; 5807 return -ENOMEM;
5809 } 5808 }
5810 5809
5811 devfs_mk_dir("sbp");
5812
5813 for (j=0;j<NR_SBPCD;j++) 5810 for (j=0;j<NR_SBPCD;j++)
5814 { 5811 {
5815 struct cdrom_device_info * sbpcd_infop; 5812 struct cdrom_device_info * sbpcd_infop;
@@ -5871,7 +5868,6 @@ int __init sbpcd_init(void)
5871 disk->fops = &sbpcd_bdops; 5868 disk->fops = &sbpcd_bdops;
5872 strcpy(disk->disk_name, sbpcd_infop->name); 5869 strcpy(disk->disk_name, sbpcd_infop->name);
5873 disk->flags = GENHD_FL_CD; 5870 disk->flags = GENHD_FL_CD;
5874 sprintf(disk->devfs_name, "sbp/c0t%d", p->drv_id);
5875 p->disk = disk; 5871 p->disk = disk;
5876 if (register_cdrom(sbpcd_infop)) 5872 if (register_cdrom(sbpcd_infop))
5877 { 5873 {
@@ -5906,7 +5902,6 @@ static void sbpcd_exit(void)
5906 if (D_S[j].drv_id==-1) continue; 5902 if (D_S[j].drv_id==-1) continue;
5907 del_gendisk(D_S[j].disk); 5903 del_gendisk(D_S[j].disk);
5908 put_disk(D_S[j].disk); 5904 put_disk(D_S[j].disk);
5909 devfs_remove("sbp/c0t%d", j);
5910 vfree(D_S[j].sbp_buf); 5905 vfree(D_S[j].sbp_buf);
5911 if (D_S[j].sbp_audsiz>0) 5906 if (D_S[j].sbp_audsiz>0)
5912 vfree(D_S[j].aud_buf); 5907 vfree(D_S[j].aud_buf);
@@ -5917,7 +5912,6 @@ static void sbpcd_exit(void)
5917 } 5912 }
5918 vfree(D_S[j].sbpcd_infop); 5913 vfree(D_S[j].sbpcd_infop);
5919 } 5914 }
5920 devfs_remove("sbp");
5921 msg(DBG_INF, "%s module released.\n", major_name); 5915 msg(DBG_INF, "%s module released.\n", major_name);
5922} 5916}
5923 5917
diff --git a/drivers/cdrom/sjcd.c b/drivers/cdrom/sjcd.c
index 74b1cadbf161..bf5aef4e555b 100644
--- a/drivers/cdrom/sjcd.c
+++ b/drivers/cdrom/sjcd.c
@@ -1695,7 +1695,6 @@ static int __init sjcd_init(void)
1695 sjcd_disk->first_minor = 0, 1695 sjcd_disk->first_minor = 0,
1696 sjcd_disk->fops = &sjcd_fops, 1696 sjcd_disk->fops = &sjcd_fops,
1697 sprintf(sjcd_disk->disk_name, "sjcd"); 1697 sprintf(sjcd_disk->disk_name, "sjcd");
1698 sprintf(sjcd_disk->devfs_name, "sjcd");
1699 1698
1700 if (!request_region(sjcd_base, 4,"sjcd")) { 1699 if (!request_region(sjcd_base, 4,"sjcd")) {
1701 printk 1700 printk
diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c
index e65659926432..8f7cc452af8d 100644
--- a/drivers/cdrom/sonycd535.c
+++ b/drivers/cdrom/sonycd535.c
@@ -1589,7 +1589,6 @@ static int __init sony535_init(void)
1589 cdu_disk->first_minor = 0; 1589 cdu_disk->first_minor = 0;
1590 cdu_disk->fops = &cdu_fops; 1590 cdu_disk->fops = &cdu_fops;
1591 sprintf(cdu_disk->disk_name, "cdu"); 1591 sprintf(cdu_disk->disk_name, "cdu");
1592 sprintf(cdu_disk->devfs_name, "cdu535");
1593 1592
1594 if (!request_region(sony535_cd_base_io, 4, CDU535_HANDLE)) { 1593 if (!request_region(sony535_cd_base_io, 4, CDU535_HANDLE)) {
1595 printk(KERN_WARNING"sonycd535: Unable to request region 0x%x\n", 1594 printk(KERN_WARNING"sonycd535: Unable to request region 0x%x\n",
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c
index af6b3bfd169b..54ca931e19ea 100644
--- a/drivers/cdrom/viocd.c
+++ b/drivers/cdrom/viocd.c
@@ -49,7 +49,6 @@
49#include <asm/iseries/vio.h> 49#include <asm/iseries/vio.h>
50 50
51#define VIOCD_DEVICE "iseries/vcd" 51#define VIOCD_DEVICE "iseries/vcd"
52#define VIOCD_DEVICE_DEVFS "iseries/vcd"
53 52
54#define VIOCD_VERS "1.06" 53#define VIOCD_VERS "1.06"
55 54
@@ -688,8 +687,6 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id)
688 gendisk->first_minor = deviceno; 687 gendisk->first_minor = deviceno;
689 strncpy(gendisk->disk_name, c->name, 688 strncpy(gendisk->disk_name, c->name,
690 sizeof(gendisk->disk_name)); 689 sizeof(gendisk->disk_name));
691 snprintf(gendisk->devfs_name, sizeof(gendisk->devfs_name),
692 VIOCD_DEVICE_DEVFS "%d", deviceno);
693 blk_queue_max_hw_segments(q, 1); 690 blk_queue_max_hw_segments(q, 1);
694 blk_queue_max_phys_segments(q, 1); 691 blk_queue_max_phys_segments(q, 1);
695 blk_queue_max_sectors(q, 4096 / 512); 692 blk_queue_max_sectors(q, 4096 / 512);
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 122e7a72a4e1..2657eeba7da6 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -5250,7 +5250,6 @@ cy_init(void)
5250 cy_serial_driver->owner = THIS_MODULE; 5250 cy_serial_driver->owner = THIS_MODULE;
5251 cy_serial_driver->driver_name = "cyclades"; 5251 cy_serial_driver->driver_name = "cyclades";
5252 cy_serial_driver->name = "ttyC"; 5252 cy_serial_driver->name = "ttyC";
5253 cy_serial_driver->devfs_name = "tts/C";
5254 cy_serial_driver->major = CYCLADES_MAJOR; 5253 cy_serial_driver->major = CYCLADES_MAJOR;
5255 cy_serial_driver->minor_start = 0; 5254 cy_serial_driver->minor_start = 0;
5256 cy_serial_driver->type = TTY_DRIVER_TYPE_SERIAL; 5255 cy_serial_driver->type = TTY_DRIVER_TYPE_SERIAL;
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
index e233cf280bc0..09b413618b57 100644
--- a/drivers/char/dsp56k.c
+++ b/drivers/char/dsp56k.c
@@ -33,7 +33,6 @@
33#include <linux/fs.h> 33#include <linux/fs.h>
34#include <linux/mm.h> 34#include <linux/mm.h>
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/devfs_fs_kernel.h>
37#include <linux/smp_lock.h> 36#include <linux/smp_lock.h>
38#include <linux/device.h> 37#include <linux/device.h>
39 38
@@ -518,17 +517,9 @@ static int __init dsp56k_init_driver(void)
518 } 517 }
519 class_device_create(dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), NULL, "dsp56k"); 518 class_device_create(dsp56k_class, NULL, MKDEV(DSP56K_MAJOR, 0), NULL, "dsp56k");
520 519
521 err = devfs_mk_cdev(MKDEV(DSP56K_MAJOR, 0),
522 S_IFCHR | S_IRUSR | S_IWUSR, "dsp56k");
523 if(err)
524 goto out_class;
525
526 printk(banner); 520 printk(banner);
527 goto out; 521 goto out;
528 522
529out_class:
530 class_device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0));
531 class_destroy(dsp56k_class);
532out_chrdev: 523out_chrdev:
533 unregister_chrdev(DSP56K_MAJOR, "dsp56k"); 524 unregister_chrdev(DSP56K_MAJOR, "dsp56k");
534out: 525out:
@@ -541,7 +532,6 @@ static void __exit dsp56k_cleanup_driver(void)
541 class_device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0)); 532 class_device_destroy(dsp56k_class, MKDEV(DSP56K_MAJOR, 0));
542 class_destroy(dsp56k_class); 533 class_destroy(dsp56k_class);
543 unregister_chrdev(DSP56K_MAJOR, "dsp56k"); 534 unregister_chrdev(DSP56K_MAJOR, "dsp56k");
544 devfs_remove("dsp56k");
545} 535}
546module_exit(dsp56k_cleanup_driver); 536module_exit(dsp56k_cleanup_driver);
547 537
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
index 87dcaa237f07..da2c89f1b8bc 100644
--- a/drivers/char/dtlk.c
+++ b/drivers/char/dtlk.c
@@ -62,7 +62,6 @@
62#include <linux/init.h> /* for __init, module_{init,exit} */ 62#include <linux/init.h> /* for __init, module_{init,exit} */
63#include <linux/poll.h> /* for POLLIN, etc. */ 63#include <linux/poll.h> /* for POLLIN, etc. */
64#include <linux/dtlk.h> /* local header file for DoubleTalk values */ 64#include <linux/dtlk.h> /* local header file for DoubleTalk values */
65#include <linux/devfs_fs_kernel.h>
66#include <linux/smp_lock.h> 65#include <linux/smp_lock.h>
67 66
68#ifdef TRACING 67#ifdef TRACING
@@ -337,9 +336,6 @@ static int __init dtlk_init(void)
337 if (dtlk_dev_probe() == 0) 336 if (dtlk_dev_probe() == 0)
338 printk(", MAJOR %d\n", dtlk_major); 337 printk(", MAJOR %d\n", dtlk_major);
339 338
340 devfs_mk_cdev(MKDEV(dtlk_major, DTLK_MINOR),
341 S_IFCHR | S_IRUSR | S_IWUSR, "dtlk");
342
343 init_timer(&dtlk_timer); 339 init_timer(&dtlk_timer);
344 dtlk_timer.function = dtlk_timer_tick; 340 dtlk_timer.function = dtlk_timer_tick;
345 init_waitqueue_head(&dtlk_process_list); 341 init_waitqueue_head(&dtlk_process_list);
@@ -357,7 +353,6 @@ static void __exit dtlk_cleanup (void)
357 353
358 dtlk_write_tts(DTLK_CLEAR); 354 dtlk_write_tts(DTLK_CLEAR);
359 unregister_chrdev(dtlk_major, "dtlk"); 355 unregister_chrdev(dtlk_major, "dtlk");
360 devfs_remove("dtlk");
361 release_region(dtlk_port_lpc, DTLK_IO_EXTENT); 356 release_region(dtlk_port_lpc, DTLK_IO_EXTENT);
362} 357}
363 358
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index dc0602ae8503..d0b3890d9302 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -1232,7 +1232,6 @@ static int __init pc_init(void)
1232 1232
1233 pc_driver->owner = THIS_MODULE; 1233 pc_driver->owner = THIS_MODULE;
1234 pc_driver->name = "ttyD"; 1234 pc_driver->name = "ttyD";
1235 pc_driver->devfs_name = "tts/D";
1236 pc_driver->major = DIGI_MAJOR; 1235 pc_driver->major = DIGI_MAJOR;
1237 pc_driver->minor_start = 0; 1236 pc_driver->minor_start = 0;
1238 pc_driver->type = TTY_DRIVER_TYPE_SERIAL; 1237 pc_driver->type = TTY_DRIVER_TYPE_SERIAL;
diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index 922174d527ae..9827d170ca17 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -2449,7 +2449,6 @@ static int __init espserial_init(void)
2449 2449
2450 esp_driver->owner = THIS_MODULE; 2450 esp_driver->owner = THIS_MODULE;
2451 esp_driver->name = "ttyP"; 2451 esp_driver->name = "ttyP";
2452 esp_driver->devfs_name = "tts/P";
2453 esp_driver->major = ESP_IN_MAJOR; 2452 esp_driver->major = ESP_IN_MAJOR;
2454 esp_driver->minor_start = 0; 2453 esp_driver->minor_start = 0;
2455 esp_driver->type = TTY_DRIVER_TYPE_SERIAL; 2454 esp_driver->type = TTY_DRIVER_TYPE_SERIAL;
diff --git a/drivers/char/ftape/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c
index 821357ce7e0e..3eeb869a9a11 100644
--- a/drivers/char/ftape/zftape/zftape-init.c
+++ b/drivers/char/ftape/zftape/zftape-init.c
@@ -33,7 +33,6 @@
33#endif 33#endif
34#include <linux/fcntl.h> 34#include <linux/fcntl.h>
35#include <linux/smp_lock.h> 35#include <linux/smp_lock.h>
36#include <linux/devfs_fs_kernel.h>
37 36
38#include <linux/zftape.h> 37#include <linux/zftape.h>
39#include <linux/init.h> 38#include <linux/init.h>
@@ -332,29 +331,11 @@ KERN_INFO
332 zft_class = class_create(THIS_MODULE, "zft"); 331 zft_class = class_create(THIS_MODULE, "zft");
333 for (i = 0; i < 4; i++) { 332 for (i = 0; i < 4; i++) {
334 class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i), NULL, "qft%i", i); 333 class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i), NULL, "qft%i", i);
335 devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i),
336 S_IFCHR | S_IRUSR | S_IWUSR,
337 "qft%i", i);
338 class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 4), NULL, "nqft%i", i); 334 class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 4), NULL, "nqft%i", i);
339 devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 4),
340 S_IFCHR | S_IRUSR | S_IWUSR,
341 "nqft%i", i);
342 class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 16), NULL, "zqft%i", i); 335 class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 16), NULL, "zqft%i", i);
343 devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 16),
344 S_IFCHR | S_IRUSR | S_IWUSR,
345 "zqft%i", i);
346 class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 20), NULL, "nzqft%i", i); 336 class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 20), NULL, "nzqft%i", i);
347 devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 20),
348 S_IFCHR | S_IRUSR | S_IWUSR,
349 "nzqft%i", i);
350 class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 32), NULL, "rawqft%i", i); 337 class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 32), NULL, "rawqft%i", i);
351 devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 32),
352 S_IFCHR | S_IRUSR | S_IWUSR,
353 "rawqft%i", i);
354 class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 36), NULL, "nrawrawqft%i", i); 338 class_device_create(zft_class, NULL, MKDEV(QIC117_TAPE_MAJOR, i + 36), NULL, "nrawrawqft%i", i);
355 devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 36),
356 S_IFCHR | S_IRUSR | S_IWUSR,
357 "nrawqft%i", i);
358 } 339 }
359 340
360#ifdef CONFIG_ZFT_COMPRESSOR 341#ifdef CONFIG_ZFT_COMPRESSOR
@@ -380,17 +361,11 @@ static void zft_exit(void)
380 TRACE(ft_t_info, "successful"); 361 TRACE(ft_t_info, "successful");
381 } 362 }
382 for (i = 0; i < 4; i++) { 363 for (i = 0; i < 4; i++) {
383 devfs_remove("qft%i", i);
384 class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i)); 364 class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i));
385 devfs_remove("nqft%i", i);
386 class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4)); 365 class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4));
387 devfs_remove("zqft%i", i);
388 class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16)); 366 class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16));
389 devfs_remove("nzqft%i", i);
390 class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20)); 367 class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20));
391 devfs_remove("rawqft%i", i);
392 class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32)); 368 class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32));
393 devfs_remove("nrawqft%i", i);
394 class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36)); 369 class_device_destroy(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36));
395 } 370 }
396 class_destroy(zft_class); 371 class_destroy(zft_class);
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index a5c6a9d7ff08..6e380aecea6a 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -820,7 +820,6 @@ int __init hvc_init(void)
820 return -ENOMEM; 820 return -ENOMEM;
821 821
822 drv->owner = THIS_MODULE; 822 drv->owner = THIS_MODULE;
823 drv->devfs_name = "hvc/";
824 drv->driver_name = "hvc"; 823 drv->driver_name = "hvc";
825 drv->name = "hvc"; 824 drv->name = "hvc";
826 drv->major = HVC_MAJOR; 825 drv->major = HVC_MAJOR;
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c
index afa26b65dac3..130dedc37568 100644
--- a/drivers/char/hvcs.c
+++ b/drivers/char/hvcs.c
@@ -1363,7 +1363,6 @@ static int __init hvcs_module_init(void)
1363 1363
1364 hvcs_tty_driver->driver_name = hvcs_driver_name; 1364 hvcs_tty_driver->driver_name = hvcs_driver_name;
1365 hvcs_tty_driver->name = hvcs_device_node; 1365 hvcs_tty_driver->name = hvcs_device_node;
1366 hvcs_tty_driver->devfs_name = hvcs_device_node;
1367 1366
1368 /* 1367 /*
1369 * We'll let the system assign us a major number, indicated by leaving 1368 * We'll let the system assign us a major number, indicated by leaving
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c
index a0370ed752ce..7b04eb153205 100644
--- a/drivers/char/hvsi.c
+++ b/drivers/char/hvsi.c
@@ -1154,7 +1154,6 @@ static int __init hvsi_init(void)
1154 return -ENOMEM; 1154 return -ENOMEM;
1155 1155
1156 hvsi_driver->owner = THIS_MODULE; 1156 hvsi_driver->owner = THIS_MODULE;
1157 hvsi_driver->devfs_name = "hvsi/";
1158 hvsi_driver->driver_name = "hvsi"; 1157 hvsi_driver->driver_name = "hvsi";
1159 hvsi_driver->name = "hvsi"; 1158 hvsi_driver->name = "hvsi";
1160 hvsi_driver->major = HVSI_MAJOR; 1159 hvsi_driver->major = HVSI_MAJOR;
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
index 9ab33c3d359f..8619542766cb 100644
--- a/drivers/char/ip2/ip2main.c
+++ b/drivers/char/ip2/ip2main.c
@@ -91,7 +91,6 @@
91#include <linux/module.h> 91#include <linux/module.h>
92#include <linux/signal.h> 92#include <linux/signal.h>
93#include <linux/sched.h> 93#include <linux/sched.h>
94#include <linux/devfs_fs_kernel.h>
95#include <linux/timer.h> 94#include <linux/timer.h>
96#include <linux/interrupt.h> 95#include <linux/interrupt.h>
97#include <linux/pci.h> 96#include <linux/pci.h>
@@ -414,9 +413,7 @@ cleanup_module(void)
414 /* free io addresses and Tibet */ 413 /* free io addresses and Tibet */
415 release_region( ip2config.addr[i], 8 ); 414 release_region( ip2config.addr[i], 8 );
416 class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i)); 415 class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i));
417 devfs_remove("ip2/ipl%d", i);
418 class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i + 1)); 416 class_device_destroy(ip2_class, MKDEV(IP2_IPL_MAJOR, 4 * i + 1));
419 devfs_remove("ip2/stat%d", i);
420 } 417 }
421 /* Disable and remove interrupt handler. */ 418 /* Disable and remove interrupt handler. */
422 if ( (ip2config.irq[i] > 0) && have_requested_irq(ip2config.irq[i]) ) { 419 if ( (ip2config.irq[i] > 0) && have_requested_irq(ip2config.irq[i]) ) {
@@ -425,7 +422,6 @@ cleanup_module(void)
425 } 422 }
426 } 423 }
427 class_destroy(ip2_class); 424 class_destroy(ip2_class);
428 devfs_remove("ip2");
429 if ( ( err = tty_unregister_driver ( ip2_tty_driver ) ) ) { 425 if ( ( err = tty_unregister_driver ( ip2_tty_driver ) ) ) {
430 printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n", err); 426 printk(KERN_ERR "IP2: failed to unregister tty driver (%d)\n", err);
431 } 427 }
@@ -675,7 +671,6 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
675 671
676 ip2_tty_driver->owner = THIS_MODULE; 672 ip2_tty_driver->owner = THIS_MODULE;
677 ip2_tty_driver->name = "ttyF"; 673 ip2_tty_driver->name = "ttyF";
678 ip2_tty_driver->devfs_name = "tts/F";
679 ip2_tty_driver->driver_name = pcDriver_name; 674 ip2_tty_driver->driver_name = pcDriver_name;
680 ip2_tty_driver->major = IP2_TTY_MAJOR; 675 ip2_tty_driver->major = IP2_TTY_MAJOR;
681 ip2_tty_driver->minor_start = 0; 676 ip2_tty_driver->minor_start = 0;
@@ -683,7 +678,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
683 ip2_tty_driver->subtype = SERIAL_TYPE_NORMAL; 678 ip2_tty_driver->subtype = SERIAL_TYPE_NORMAL;
684 ip2_tty_driver->init_termios = tty_std_termios; 679 ip2_tty_driver->init_termios = tty_std_termios;
685 ip2_tty_driver->init_termios.c_cflag = B9600|CS8|CREAD|HUPCL|CLOCAL; 680 ip2_tty_driver->init_termios.c_cflag = B9600|CS8|CREAD|HUPCL|CLOCAL;
686 ip2_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; 681 ip2_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
687 tty_set_operations(ip2_tty_driver, &ip2_ops); 682 tty_set_operations(ip2_tty_driver, &ip2_ops);
688 683
689 ip2trace (ITRC_NO_PORT, ITRC_INIT, 3, 0 ); 684 ip2trace (ITRC_NO_PORT, ITRC_INIT, 3, 0 );
@@ -724,26 +719,9 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
724 class_device_create(ip2_class, NULL, 719 class_device_create(ip2_class, NULL,
725 MKDEV(IP2_IPL_MAJOR, 4 * i), 720 MKDEV(IP2_IPL_MAJOR, 4 * i),
726 NULL, "ipl%d", i); 721 NULL, "ipl%d", i);
727 err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i),
728 S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR,
729 "ip2/ipl%d", i);
730 if (err) {
731 class_device_destroy(ip2_class,
732 MKDEV(IP2_IPL_MAJOR, 4 * i));
733 goto out_class;
734 }
735
736 class_device_create(ip2_class, NULL, 722 class_device_create(ip2_class, NULL,
737 MKDEV(IP2_IPL_MAJOR, 4 * i + 1), 723 MKDEV(IP2_IPL_MAJOR, 4 * i + 1),
738 NULL, "stat%d", i); 724 NULL, "stat%d", i);
739 err = devfs_mk_cdev(MKDEV(IP2_IPL_MAJOR, 4 * i + 1),
740 S_IRUSR | S_IWUSR | S_IRGRP | S_IFCHR,
741 "ip2/stat%d", i);
742 if (err) {
743 class_device_destroy(ip2_class,
744 MKDEV(IP2_IPL_MAJOR, 4 * i + 1));
745 goto out_class;
746 }
747 725
748 for ( box = 0; box < ABS_MAX_BOXES; ++box ) 726 for ( box = 0; box < ABS_MAX_BOXES; ++box )
749 { 727 {
diff --git a/drivers/char/ipmi/ipmi_devintf.c b/drivers/char/ipmi/ipmi_devintf.c
index e1c95374984c..da637adbbfaa 100644
--- a/drivers/char/ipmi/ipmi_devintf.c
+++ b/drivers/char/ipmi/ipmi_devintf.c
@@ -40,7 +40,6 @@
40#include <linux/poll.h> 40#include <linux/poll.h>
41#include <linux/spinlock.h> 41#include <linux/spinlock.h>
42#include <linux/slab.h> 42#include <linux/slab.h>
43#include <linux/devfs_fs_kernel.h>
44#include <linux/ipmi.h> 43#include <linux/ipmi.h>
45#include <linux/mutex.h> 44#include <linux/mutex.h>
46#include <linux/init.h> 45#include <linux/init.h>
@@ -804,9 +803,6 @@ static void ipmi_new_smi(int if_num, struct device *device)
804 dev_t dev = MKDEV(ipmi_major, if_num); 803 dev_t dev = MKDEV(ipmi_major, if_num);
805 struct ipmi_reg_list *entry; 804 struct ipmi_reg_list *entry;
806 805
807 devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR,
808 "ipmidev/%d", if_num);
809
810 entry = kmalloc(sizeof(*entry), GFP_KERNEL); 806 entry = kmalloc(sizeof(*entry), GFP_KERNEL);
811 if (!entry) { 807 if (!entry) {
812 printk(KERN_ERR "ipmi_devintf: Unable to create the" 808 printk(KERN_ERR "ipmi_devintf: Unable to create the"
@@ -836,7 +832,6 @@ static void ipmi_smi_gone(int if_num)
836 } 832 }
837 class_device_destroy(ipmi_class, dev); 833 class_device_destroy(ipmi_class, dev);
838 mutex_unlock(&reg_list_mutex); 834 mutex_unlock(&reg_list_mutex);
839 devfs_remove("ipmidev/%d", if_num);
840} 835}
841 836
842static struct ipmi_smi_watcher smi_watcher = 837static struct ipmi_smi_watcher smi_watcher =
@@ -872,8 +867,6 @@ static __init int init_ipmi_devintf(void)
872 ipmi_major = rv; 867 ipmi_major = rv;
873 } 868 }
874 869
875 devfs_mk_dir(DEVICE_NAME);
876
877 rv = ipmi_smi_watcher_register(&smi_watcher); 870 rv = ipmi_smi_watcher_register(&smi_watcher);
878 if (rv) { 871 if (rv) {
879 unregister_chrdev(ipmi_major, DEVICE_NAME); 872 unregister_chrdev(ipmi_major, DEVICE_NAME);
@@ -898,7 +891,6 @@ static __exit void cleanup_ipmi(void)
898 mutex_unlock(&reg_list_mutex); 891 mutex_unlock(&reg_list_mutex);
899 class_destroy(ipmi_class); 892 class_destroy(ipmi_class);
900 ipmi_smi_watcher_unregister(&smi_watcher); 893 ipmi_smi_watcher_unregister(&smi_watcher);
901 devfs_remove(DEVICE_NAME);
902 unregister_chrdev(ipmi_major, DEVICE_NAME); 894 unregister_chrdev(ipmi_major, DEVICE_NAME);
903} 895}
904module_exit(cleanup_ipmi); 896module_exit(cleanup_ipmi);
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index efaaa1937ab6..478bf4d7d065 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -1581,7 +1581,6 @@ static int __devinit isicom_register_tty_driver(void)
1581 1581
1582 isicom_normal->owner = THIS_MODULE; 1582 isicom_normal->owner = THIS_MODULE;
1583 isicom_normal->name = "ttyM"; 1583 isicom_normal->name = "ttyM";
1584 isicom_normal->devfs_name = "isicom/";
1585 isicom_normal->major = ISICOM_NMAJOR; 1584 isicom_normal->major = ISICOM_NMAJOR;
1586 isicom_normal->minor_start = 0; 1585 isicom_normal->minor_start = 0;
1587 isicom_normal->type = TTY_DRIVER_TYPE_SERIAL; 1586 isicom_normal->type = TTY_DRIVER_TYPE_SERIAL;
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c
index 216c79256de3..c74e5660a9b7 100644
--- a/drivers/char/istallion.c
+++ b/drivers/char/istallion.c
@@ -39,7 +39,6 @@
39#include <linux/ioport.h> 39#include <linux/ioport.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <linux/init.h> 41#include <linux/init.h>
42#include <linux/devfs_fs_kernel.h>
43#include <linux/device.h> 42#include <linux/device.h>
44#include <linux/wait.h> 43#include <linux/wait.h>
45#include <linux/eisa.h> 44#include <linux/eisa.h>
@@ -826,11 +825,8 @@ static void __exit istallion_module_exit(void)
826 return; 825 return;
827 } 826 }
828 put_tty_driver(stli_serial); 827 put_tty_driver(stli_serial);
829 for (i = 0; i < 4; i++) { 828 for (i = 0; i < 4; i++)
830 devfs_remove("staliomem/%d", i);
831 class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i)); 829 class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i));
832 }
833 devfs_remove("staliomem");
834 class_destroy(istallion_class); 830 class_destroy(istallion_class);
835 if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) 831 if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
836 printk("STALLION: failed to un-register serial memory device, " 832 printk("STALLION: failed to un-register serial memory device, "
@@ -4728,16 +4724,11 @@ int __init stli_init(void)
4728 printk(KERN_ERR "STALLION: failed to register serial memory " 4724 printk(KERN_ERR "STALLION: failed to register serial memory "
4729 "device\n"); 4725 "device\n");
4730 4726
4731 devfs_mk_dir("staliomem");
4732 istallion_class = class_create(THIS_MODULE, "staliomem"); 4727 istallion_class = class_create(THIS_MODULE, "staliomem");
4733 for (i = 0; i < 4; i++) { 4728 for (i = 0; i < 4; i++)
4734 devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i),
4735 S_IFCHR | S_IRUSR | S_IWUSR,
4736 "staliomem/%d", i);
4737 class_device_create(istallion_class, NULL, 4729 class_device_create(istallion_class, NULL,
4738 MKDEV(STL_SIOMEMMAJOR, i), 4730 MKDEV(STL_SIOMEMMAJOR, i),
4739 NULL, "staliomem%d", i); 4731 NULL, "staliomem%d", i);
4740 }
4741 4732
4742/* 4733/*
4743 * Set up the tty driver structure and register us as a driver. 4734 * Set up the tty driver structure and register us as a driver.
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index e57260525293..b11a390581ba 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -120,7 +120,6 @@
120#include <linux/major.h> 120#include <linux/major.h>
121#include <linux/sched.h> 121#include <linux/sched.h>
122#include <linux/smp_lock.h> 122#include <linux/smp_lock.h>
123#include <linux/devfs_fs_kernel.h>
124#include <linux/slab.h> 123#include <linux/slab.h>
125#include <linux/fcntl.h> 124#include <linux/fcntl.h>
126#include <linux/delay.h> 125#include <linux/delay.h>
@@ -807,8 +806,6 @@ static int lp_register(int nr, struct parport *port)
807 806
808 class_device_create(lp_class, NULL, MKDEV(LP_MAJOR, nr), NULL, 807 class_device_create(lp_class, NULL, MKDEV(LP_MAJOR, nr), NULL,
809 "lp%d", nr); 808 "lp%d", nr);
810 devfs_mk_cdev(MKDEV(LP_MAJOR, nr), S_IFCHR | S_IRUGO | S_IWUGO,
811 "printers/%d", nr);
812 809
813 printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name, 810 printk(KERN_INFO "lp%d: using %s (%s).\n", nr, port->name,
814 (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven"); 811 (port->irq == PARPORT_IRQ_NONE)?"polling":"interrupt-driven");
@@ -907,7 +904,6 @@ static int __init lp_init (void)
907 return -EIO; 904 return -EIO;
908 } 905 }
909 906
910 devfs_mk_dir("printers");
911 lp_class = class_create(THIS_MODULE, "printer"); 907 lp_class = class_create(THIS_MODULE, "printer");
912 if (IS_ERR(lp_class)) { 908 if (IS_ERR(lp_class)) {
913 err = PTR_ERR(lp_class); 909 err = PTR_ERR(lp_class);
@@ -933,7 +929,6 @@ static int __init lp_init (void)
933out_class: 929out_class:
934 class_destroy(lp_class); 930 class_destroy(lp_class);
935out_devfs: 931out_devfs:
936 devfs_remove("printers");
937 unregister_chrdev(LP_MAJOR, "lp"); 932 unregister_chrdev(LP_MAJOR, "lp");
938 return err; 933 return err;
939} 934}
@@ -981,10 +976,8 @@ static void lp_cleanup_module (void)
981 if (lp_table[offset].dev == NULL) 976 if (lp_table[offset].dev == NULL)
982 continue; 977 continue;
983 parport_unregister_device(lp_table[offset].dev); 978 parport_unregister_device(lp_table[offset].dev);
984 devfs_remove("printers/%d", offset);
985 class_device_destroy(lp_class, MKDEV(LP_MAJOR, offset)); 979 class_device_destroy(lp_class, MKDEV(LP_MAJOR, offset));
986 } 980 }
987 devfs_remove("printers");
988 class_destroy(lp_class); 981 class_destroy(lp_class);
989} 982}
990 983
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 1fa9fa157c12..6fe7b6c6c462 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -20,7 +20,6 @@
20#include <linux/tty.h> 20#include <linux/tty.h>
21#include <linux/capability.h> 21#include <linux/capability.h>
22#include <linux/smp_lock.h> 22#include <linux/smp_lock.h>
23#include <linux/devfs_fs_kernel.h>
24#include <linux/ptrace.h> 23#include <linux/ptrace.h>
25#include <linux/device.h> 24#include <linux/device.h>
26#include <linux/highmem.h> 25#include <linux/highmem.h>
@@ -941,13 +940,10 @@ static int __init chr_dev_init(void)
941 printk("unable to get major %d for memory devs\n", MEM_MAJOR); 940 printk("unable to get major %d for memory devs\n", MEM_MAJOR);
942 941
943 mem_class = class_create(THIS_MODULE, "mem"); 942 mem_class = class_create(THIS_MODULE, "mem");
944 for (i = 0; i < ARRAY_SIZE(devlist); i++) { 943 for (i = 0; i < ARRAY_SIZE(devlist); i++)
945 class_device_create(mem_class, NULL, 944 class_device_create(mem_class, NULL,
946 MKDEV(MEM_MAJOR, devlist[i].minor), 945 MKDEV(MEM_MAJOR, devlist[i].minor),
947 NULL, devlist[i].name); 946 NULL, devlist[i].name);
948 devfs_mk_cdev(MKDEV(MEM_MAJOR, devlist[i].minor),
949 S_IFCHR | devlist[i].mode, devlist[i].name);
950 }
951 947
952 return 0; 948 return 0;
953} 949}
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index 96eb2a709e21..dfe1cede3916 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -44,7 +44,6 @@
44#include <linux/slab.h> 44#include <linux/slab.h>
45#include <linux/proc_fs.h> 45#include <linux/proc_fs.h>
46#include <linux/seq_file.h> 46#include <linux/seq_file.h>
47#include <linux/devfs_fs_kernel.h>
48#include <linux/stat.h> 47#include <linux/stat.h>
49#include <linux/init.h> 48#include <linux/init.h>
50#include <linux/device.h> 49#include <linux/device.h>
@@ -204,7 +203,7 @@ int misc_register(struct miscdevice * misc)
204{ 203{
205 struct miscdevice *c; 204 struct miscdevice *c;
206 dev_t dev; 205 dev_t dev;
207 int err; 206 int err = 0;
208 207
209 down(&misc_sem); 208 down(&misc_sem);
210 list_for_each_entry(c, &misc_list, list) { 209 list_for_each_entry(c, &misc_list, list) {
@@ -228,10 +227,6 @@ int misc_register(struct miscdevice * misc)
228 227
229 if (misc->minor < DYNAMIC_MINORS) 228 if (misc->minor < DYNAMIC_MINORS)
230 misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); 229 misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7);
231 if (misc->devfs_name[0] == '\0') {
232 snprintf(misc->devfs_name, sizeof(misc->devfs_name),
233 "misc/%s", misc->name);
234 }
235 dev = MKDEV(MISC_MAJOR, misc->minor); 230 dev = MKDEV(MISC_MAJOR, misc->minor);
236 231
237 misc->class = class_device_create(misc_class, NULL, dev, misc->dev, 232 misc->class = class_device_create(misc_class, NULL, dev, misc->dev,
@@ -241,13 +236,6 @@ int misc_register(struct miscdevice * misc)
241 goto out; 236 goto out;
242 } 237 }
243 238
244 err = devfs_mk_cdev(dev, S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP,
245 misc->devfs_name);
246 if (err) {
247 class_device_destroy(misc_class, dev);
248 goto out;
249 }
250
251 /* 239 /*
252 * Add it to the front, so that later devices can "override" 240 * Add it to the front, so that later devices can "override"
253 * earlier defaults 241 * earlier defaults
@@ -278,7 +266,6 @@ int misc_deregister(struct miscdevice * misc)
278 down(&misc_sem); 266 down(&misc_sem);
279 list_del(&misc->list); 267 list_del(&misc->list);
280 class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); 268 class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor));
281 devfs_remove(misc->devfs_name);
282 if (i < DYNAMIC_MINORS && i>0) { 269 if (i < DYNAMIC_MINORS && i>0) {
283 misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); 270 misc_minors[i>>3] &= ~(1 << (misc->minor & 7));
284 } 271 }
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index d65b3109318a..95e8122b8068 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -25,7 +25,6 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/errno.h> 26#include <linux/errno.h>
27#include <linux/mm.h> 27#include <linux/mm.h>
28#include <linux/devfs_fs_kernel.h>
29#include <linux/mmtimer.h> 28#include <linux/mmtimer.h>
30#include <linux/miscdevice.h> 29#include <linux/miscdevice.h>
31#include <linux/posix-timers.h> 30#include <linux/posix-timers.h>
@@ -694,7 +693,6 @@ static int __init mmtimer_init(void)
694 return -1; 693 return -1;
695 } 694 }
696 695
697 strcpy(mmtimer_miscdev.devfs_name, MMTIMER_NAME);
698 if (misc_register(&mmtimer_miscdev)) { 696 if (misc_register(&mmtimer_miscdev)) {
699 printk(KERN_ERR "%s: failed to register device\n", 697 printk(KERN_ERR "%s: failed to register device\n",
700 MMTIMER_NAME); 698 MMTIMER_NAME);
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 01247cccb89f..52ef61f54ba0 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -342,7 +342,6 @@ static int __init moxa_init(void)
342 init_MUTEX(&moxaBuffSem); 342 init_MUTEX(&moxaBuffSem);
343 moxaDriver->owner = THIS_MODULE; 343 moxaDriver->owner = THIS_MODULE;
344 moxaDriver->name = "ttyMX"; 344 moxaDriver->name = "ttyMX";
345 moxaDriver->devfs_name = "tts/a";
346 moxaDriver->major = ttymajor; 345 moxaDriver->major = ttymajor;
347 moxaDriver->minor_start = 0; 346 moxaDriver->minor_start = 0;
348 moxaDriver->type = TTY_DRIVER_TYPE_SERIAL; 347 moxaDriver->type = TTY_DRIVER_TYPE_SERIAL;
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index bee6c47b45bd..24231d9743dc 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -60,7 +60,6 @@
60#include <linux/init.h> 60#include <linux/init.h>
61#include <linux/sched.h> 61#include <linux/sched.h>
62#include <linux/device.h> 62#include <linux/device.h>
63#include <linux/devfs_fs_kernel.h>
64#include <linux/ioctl.h> 63#include <linux/ioctl.h>
65#include <linux/parport.h> 64#include <linux/parport.h>
66#include <linux/ctype.h> 65#include <linux/ctype.h>
@@ -770,7 +769,7 @@ static struct parport_driver pp_driver = {
770 769
771static int __init ppdev_init (void) 770static int __init ppdev_init (void)
772{ 771{
773 int i, err = 0; 772 int err = 0;
774 773
775 if (register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) { 774 if (register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) {
776 printk (KERN_WARNING CHRDEV ": unable to get major %d\n", 775 printk (KERN_WARNING CHRDEV ": unable to get major %d\n",
@@ -782,11 +781,6 @@ static int __init ppdev_init (void)
782 err = PTR_ERR(ppdev_class); 781 err = PTR_ERR(ppdev_class);
783 goto out_chrdev; 782 goto out_chrdev;
784 } 783 }
785 devfs_mk_dir("parports");
786 for (i = 0; i < PARPORT_MAX; i++) {
787 devfs_mk_cdev(MKDEV(PP_MAJOR, i),
788 S_IFCHR | S_IRUGO | S_IWUGO, "parports/%d", i);
789 }
790 if (parport_register_driver(&pp_driver)) { 784 if (parport_register_driver(&pp_driver)) {
791 printk (KERN_WARNING CHRDEV ": unable to register with parport\n"); 785 printk (KERN_WARNING CHRDEV ": unable to register with parport\n");
792 goto out_class; 786 goto out_class;
@@ -796,9 +790,6 @@ static int __init ppdev_init (void)
796 goto out; 790 goto out;
797 791
798out_class: 792out_class:
799 for (i = 0; i < PARPORT_MAX; i++)
800 devfs_remove("parports/%d", i);
801 devfs_remove("parports");
802 class_destroy(ppdev_class); 793 class_destroy(ppdev_class);
803out_chrdev: 794out_chrdev:
804 unregister_chrdev(PP_MAJOR, CHRDEV); 795 unregister_chrdev(PP_MAJOR, CHRDEV);
@@ -808,12 +799,8 @@ out:
808 799
809static void __exit ppdev_cleanup (void) 800static void __exit ppdev_cleanup (void)
810{ 801{
811 int i;
812 /* Clean up all parport stuff */ 802 /* Clean up all parport stuff */
813 for (i = 0; i < PARPORT_MAX; i++)
814 devfs_remove("parports/%d", i);
815 parport_unregister_driver(&pp_driver); 803 parport_unregister_driver(&pp_driver);
816 devfs_remove("parports");
817 class_destroy(ppdev_class); 804 class_destroy(ppdev_class);
818 unregister_chrdev (PP_MAJOR, CHRDEV); 805 unregister_chrdev (PP_MAJOR, CHRDEV);
819} 806}
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 0c17f61549b4..9491e4307566 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -24,7 +24,6 @@
24#include <linux/major.h> 24#include <linux/major.h>
25#include <linux/mm.h> 25#include <linux/mm.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/devfs_fs_kernel.h>
28#include <linux/sysctl.h> 27#include <linux/sysctl.h>
29 28
30#include <asm/uaccess.h> 29#include <asm/uaccess.h>
@@ -265,7 +264,6 @@ static void __init legacy_pty_init(void)
265 pty_driver->owner = THIS_MODULE; 264 pty_driver->owner = THIS_MODULE;
266 pty_driver->driver_name = "pty_master"; 265 pty_driver->driver_name = "pty_master";
267 pty_driver->name = "pty"; 266 pty_driver->name = "pty";
268 pty_driver->devfs_name = "pty/m";
269 pty_driver->major = PTY_MASTER_MAJOR; 267 pty_driver->major = PTY_MASTER_MAJOR;
270 pty_driver->minor_start = 0; 268 pty_driver->minor_start = 0;
271 pty_driver->type = TTY_DRIVER_TYPE_PTY; 269 pty_driver->type = TTY_DRIVER_TYPE_PTY;
@@ -283,7 +281,6 @@ static void __init legacy_pty_init(void)
283 pty_slave_driver->owner = THIS_MODULE; 281 pty_slave_driver->owner = THIS_MODULE;
284 pty_slave_driver->driver_name = "pty_slave"; 282 pty_slave_driver->driver_name = "pty_slave";
285 pty_slave_driver->name = "ttyp"; 283 pty_slave_driver->name = "ttyp";
286 pty_slave_driver->devfs_name = "pty/s";
287 pty_slave_driver->major = PTY_SLAVE_MAJOR; 284 pty_slave_driver->major = PTY_SLAVE_MAJOR;
288 pty_slave_driver->minor_start = 0; 285 pty_slave_driver->minor_start = 0;
289 pty_slave_driver->type = TTY_DRIVER_TYPE_PTY; 286 pty_slave_driver->type = TTY_DRIVER_TYPE_PTY;
@@ -351,7 +348,6 @@ static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file,
351 348
352static void __init unix98_pty_init(void) 349static void __init unix98_pty_init(void)
353{ 350{
354 devfs_mk_dir("pts");
355 ptm_driver = alloc_tty_driver(NR_UNIX98_PTY_MAX); 351 ptm_driver = alloc_tty_driver(NR_UNIX98_PTY_MAX);
356 if (!ptm_driver) 352 if (!ptm_driver)
357 panic("Couldn't allocate Unix98 ptm driver"); 353 panic("Couldn't allocate Unix98 ptm driver");
@@ -372,7 +368,7 @@ static void __init unix98_pty_init(void)
372 ptm_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; 368 ptm_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
373 ptm_driver->init_termios.c_lflag = 0; 369 ptm_driver->init_termios.c_lflag = 0;
374 ptm_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | 370 ptm_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW |
375 TTY_DRIVER_NO_DEVFS | TTY_DRIVER_DEVPTS_MEM; 371 TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM;
376 ptm_driver->other = pts_driver; 372 ptm_driver->other = pts_driver;
377 tty_set_operations(ptm_driver, &pty_ops); 373 tty_set_operations(ptm_driver, &pty_ops);
378 ptm_driver->ioctl = pty_unix98_ioctl; 374 ptm_driver->ioctl = pty_unix98_ioctl;
@@ -387,7 +383,7 @@ static void __init unix98_pty_init(void)
387 pts_driver->init_termios = tty_std_termios; 383 pts_driver->init_termios = tty_std_termios;
388 pts_driver->init_termios.c_cflag = B38400 | CS8 | CREAD; 384 pts_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
389 pts_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW | 385 pts_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW |
390 TTY_DRIVER_NO_DEVFS | TTY_DRIVER_DEVPTS_MEM; 386 TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_DEVPTS_MEM;
391 pts_driver->other = ptm_driver; 387 pts_driver->other = ptm_driver;
392 tty_set_operations(pts_driver, &pty_ops); 388 tty_set_operations(pts_driver, &pty_ops);
393 389
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index 15a7b4086524..9bf97c5e38c0 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -10,7 +10,6 @@
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/devfs_fs_kernel.h>
14#include <linux/major.h> 13#include <linux/major.h>
15#include <linux/blkdev.h> 14#include <linux/blkdev.h>
16#include <linux/module.h> 15#include <linux/module.h>
@@ -288,7 +287,6 @@ static struct cdev raw_cdev = {
288 287
289static int __init raw_init(void) 288static int __init raw_init(void)
290{ 289{
291 int i;
292 dev_t dev = MKDEV(RAW_MAJOR, 0); 290 dev_t dev = MKDEV(RAW_MAJOR, 0);
293 291
294 if (register_chrdev_region(dev, MAX_RAW_MINORS, "raw")) 292 if (register_chrdev_region(dev, MAX_RAW_MINORS, "raw"))
@@ -310,13 +308,6 @@ static int __init raw_init(void)
310 } 308 }
311 class_device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl"); 309 class_device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl");
312 310
313 devfs_mk_cdev(MKDEV(RAW_MAJOR, 0),
314 S_IFCHR | S_IRUGO | S_IWUGO,
315 "raw/rawctl");
316 for (i = 1; i < MAX_RAW_MINORS; i++)
317 devfs_mk_cdev(MKDEV(RAW_MAJOR, i),
318 S_IFCHR | S_IRUGO | S_IWUGO,
319 "raw/raw%d", i);
320 return 0; 311 return 0;
321 312
322error: 313error:
@@ -326,12 +317,6 @@ error:
326 317
327static void __exit raw_exit(void) 318static void __exit raw_exit(void)
328{ 319{
329 int i;
330
331 for (i = 1; i < MAX_RAW_MINORS; i++)
332 devfs_remove("raw/raw%d", i);
333 devfs_remove("raw/rawctl");
334 devfs_remove("raw");
335 class_device_destroy(raw_class, MKDEV(RAW_MAJOR, 0)); 320 class_device_destroy(raw_class, MKDEV(RAW_MAJOR, 0));
336 class_destroy(raw_class); 321 class_destroy(raw_class);
337 cdev_del(&raw_cdev); 322 cdev_del(&raw_cdev);
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c
index 657c0d88f48c..c84c3c3f10c3 100644
--- a/drivers/char/riscom8.c
+++ b/drivers/char/riscom8.c
@@ -1634,7 +1634,6 @@ static inline int rc_init_drivers(void)
1634 memset(IRQ_to_board, 0, sizeof(IRQ_to_board)); 1634 memset(IRQ_to_board, 0, sizeof(IRQ_to_board));
1635 riscom_driver->owner = THIS_MODULE; 1635 riscom_driver->owner = THIS_MODULE;
1636 riscom_driver->name = "ttyL"; 1636 riscom_driver->name = "ttyL";
1637 riscom_driver->devfs_name = "tts/L";
1638 riscom_driver->major = RISCOM8_NORMAL_MAJOR; 1637 riscom_driver->major = RISCOM8_NORMAL_MAJOR;
1639 riscom_driver->type = TTY_DRIVER_TYPE_SERIAL; 1638 riscom_driver->type = TTY_DRIVER_TYPE_SERIAL;
1640 riscom_driver->subtype = SERIAL_TYPE_NORMAL; 1639 riscom_driver->subtype = SERIAL_TYPE_NORMAL;
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 0708c5164c83..0ac131881322 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -2426,8 +2426,7 @@ static int __init rp_init(void)
2426 */ 2426 */
2427 2427
2428 rocket_driver->owner = THIS_MODULE; 2428 rocket_driver->owner = THIS_MODULE;
2429 rocket_driver->flags = TTY_DRIVER_NO_DEVFS; 2429 rocket_driver->flags = TTY_DRIVER_DYNAMIC_DEV;
2430 rocket_driver->devfs_name = "tts/R";
2431 rocket_driver->name = "ttyR"; 2430 rocket_driver->name = "ttyR";
2432 rocket_driver->driver_name = "Comtrol RocketPort"; 2431 rocket_driver->driver_name = "Comtrol RocketPort";
2433 rocket_driver->major = TTY_ROCKET_MAJOR; 2432 rocket_driver->major = TTY_ROCKET_MAJOR;
@@ -2438,7 +2437,7 @@ static int __init rp_init(void)
2438 rocket_driver->init_termios.c_cflag = 2437 rocket_driver->init_termios.c_cflag =
2439 B9600 | CS8 | CREAD | HUPCL | CLOCAL; 2438 B9600 | CS8 | CREAD | HUPCL | CLOCAL;
2440#ifdef ROCKET_SOFT_FLOW 2439#ifdef ROCKET_SOFT_FLOW
2441 rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; 2440 rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
2442#endif 2441#endif
2443 tty_set_operations(rocket_driver, &rocket_ops); 2442 tty_set_operations(rocket_driver, &rocket_ops);
2444 2443
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c
index 037c940ac71b..c851eeaa4069 100644
--- a/drivers/char/serial167.c
+++ b/drivers/char/serial167.c
@@ -2235,7 +2235,6 @@ scrn[1] = '\0';
2235 /* Initialize the tty_driver structure */ 2235 /* Initialize the tty_driver structure */
2236 2236
2237 cy_serial_driver->owner = THIS_MODULE; 2237 cy_serial_driver->owner = THIS_MODULE;
2238 cy_serial_driver->devfs_name = "tts/";
2239 cy_serial_driver->name = "ttyS"; 2238 cy_serial_driver->name = "ttyS";
2240 cy_serial_driver->major = TTY_MAJOR; 2239 cy_serial_driver->major = TTY_MAJOR;
2241 cy_serial_driver->minor_start = 64; 2240 cy_serial_driver->minor_start = 64;
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c
index 00b4a2187164..0f7a542d9041 100644
--- a/drivers/char/stallion.c
+++ b/drivers/char/stallion.c
@@ -40,7 +40,6 @@
40#include <linux/ioport.h> 40#include <linux/ioport.h>
41#include <linux/init.h> 41#include <linux/init.h>
42#include <linux/smp_lock.h> 42#include <linux/smp_lock.h>
43#include <linux/devfs_fs_kernel.h>
44#include <linux/device.h> 43#include <linux/device.h>
45#include <linux/delay.h> 44#include <linux/delay.h>
46 45
@@ -757,11 +756,8 @@ static void __exit stallion_module_exit(void)
757 "errno=%d\n", -i); 756 "errno=%d\n", -i);
758 return; 757 return;
759 } 758 }
760 for (i = 0; i < 4; i++) { 759 for (i = 0; i < 4; i++)
761 devfs_remove("staliomem/%d", i);
762 class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i)); 760 class_device_destroy(stallion_class, MKDEV(STL_SIOMEMMAJOR, i));
763 }
764 devfs_remove("staliomem");
765 if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) 761 if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
766 printk("STALLION: failed to un-register serial memory device, " 762 printk("STALLION: failed to un-register serial memory device, "
767 "errno=%d\n", -i); 763 "errno=%d\n", -i);
@@ -3044,22 +3040,16 @@ static int __init stl_init(void)
3044 */ 3040 */
3045 if (register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stl_fsiomem)) 3041 if (register_chrdev(STL_SIOMEMMAJOR, "staliomem", &stl_fsiomem))
3046 printk("STALLION: failed to register serial board device\n"); 3042 printk("STALLION: failed to register serial board device\n");
3047 devfs_mk_dir("staliomem");
3048 3043
3049 stallion_class = class_create(THIS_MODULE, "staliomem"); 3044 stallion_class = class_create(THIS_MODULE, "staliomem");
3050 for (i = 0; i < 4; i++) { 3045 for (i = 0; i < 4; i++)
3051 devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i),
3052 S_IFCHR|S_IRUSR|S_IWUSR,
3053 "staliomem/%d", i);
3054 class_device_create(stallion_class, NULL, 3046 class_device_create(stallion_class, NULL,
3055 MKDEV(STL_SIOMEMMAJOR, i), NULL, 3047 MKDEV(STL_SIOMEMMAJOR, i), NULL,
3056 "staliomem%d", i); 3048 "staliomem%d", i);
3057 }
3058 3049
3059 stl_serial->owner = THIS_MODULE; 3050 stl_serial->owner = THIS_MODULE;
3060 stl_serial->driver_name = stl_drvname; 3051 stl_serial->driver_name = stl_drvname;
3061 stl_serial->name = "ttyE"; 3052 stl_serial->name = "ttyE";
3062 stl_serial->devfs_name = "tts/E";
3063 stl_serial->major = STL_SERIALMAJOR; 3053 stl_serial->major = STL_SERIALMAJOR;
3064 stl_serial->minor_start = 0; 3054 stl_serial->minor_start = 0;
3065 stl_serial->type = TTY_DRIVER_TYPE_SERIAL; 3055 stl_serial->type = TTY_DRIVER_TYPE_SERIAL;
diff --git a/drivers/char/tipar.c b/drivers/char/tipar.c
index 079db5a935a1..f7802e5bd7ca 100644
--- a/drivers/char/tipar.c
+++ b/drivers/char/tipar.c
@@ -56,7 +56,6 @@
56#include <linux/ioport.h> 56#include <linux/ioport.h>
57#include <asm/io.h> 57#include <asm/io.h>
58#include <linux/bitops.h> 58#include <linux/bitops.h>
59#include <linux/devfs_fs_kernel.h> /* DevFs support */
60#include <linux/parport.h> /* Our code depend on parport */ 59#include <linux/parport.h> /* Our code depend on parport */
61#include <linux/device.h> 60#include <linux/device.h>
62 61
@@ -443,12 +442,6 @@ tipar_register(int nr, struct parport *port)
443 442
444 class_device_create(tipar_class, NULL, MKDEV(TIPAR_MAJOR, 443 class_device_create(tipar_class, NULL, MKDEV(TIPAR_MAJOR,
445 TIPAR_MINOR + nr), NULL, "par%d", nr); 444 TIPAR_MINOR + nr), NULL, "par%d", nr);
446 /* Use devfs, tree: /dev/ticables/par/[0..2] */
447 err = devfs_mk_cdev(MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr),
448 S_IFCHR | S_IRUGO | S_IWUGO,
449 "ticables/par/%d", nr);
450 if (err)
451 goto out_class;
452 445
453 /* Display informations */ 446 /* Display informations */
454 pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq == 447 pr_info("tipar%d: using %s (%s)\n", nr, port->name, (port->irq ==
@@ -460,11 +453,7 @@ tipar_register(int nr, struct parport *port)
460 pr_info("tipar%d: link cable not found\n", nr); 453 pr_info("tipar%d: link cable not found\n", nr);
461 454
462 err = 0; 455 err = 0;
463 goto out;
464 456
465out_class:
466 class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, TIPAR_MINOR + nr));
467 class_destroy(tipar_class);
468out: 457out:
469 return err; 458 return err;
470} 459}
@@ -507,9 +496,6 @@ tipar_init_module(void)
507 goto out; 496 goto out;
508 } 497 }
509 498
510 /* Use devfs with tree: /dev/ticables/par/[0..2] */
511 devfs_mk_dir("ticables/par");
512
513 tipar_class = class_create(THIS_MODULE, "ticables"); 499 tipar_class = class_create(THIS_MODULE, "ticables");
514 if (IS_ERR(tipar_class)) { 500 if (IS_ERR(tipar_class)) {
515 err = PTR_ERR(tipar_class); 501 err = PTR_ERR(tipar_class);
@@ -528,7 +514,6 @@ out_class:
528 class_destroy(tipar_class); 514 class_destroy(tipar_class);
529 515
530out_chrdev: 516out_chrdev:
531 devfs_remove("ticables/par");
532 unregister_chrdev(TIPAR_MAJOR, "tipar"); 517 unregister_chrdev(TIPAR_MAJOR, "tipar");
533out: 518out:
534 return err; 519 return err;
@@ -549,10 +534,8 @@ tipar_cleanup_module(void)
549 continue; 534 continue;
550 parport_unregister_device(table[i].dev); 535 parport_unregister_device(table[i].dev);
551 class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, i)); 536 class_device_destroy(tipar_class, MKDEV(TIPAR_MAJOR, i));
552 devfs_remove("ticables/par/%d", i);
553 } 537 }
554 class_destroy(tipar_class); 538 class_destroy(tipar_class);
555 devfs_remove("ticables/par");
556 539
557 pr_info("tipar: module unloaded\n"); 540 pr_info("tipar: module unloaded\n");
558} 541}
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 8d19f7281f0b..a1143238feca 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -102,7 +102,6 @@
102#include <linux/kbd_kern.h> 102#include <linux/kbd_kern.h>
103#include <linux/vt_kern.h> 103#include <linux/vt_kern.h>
104#include <linux/selection.h> 104#include <linux/selection.h>
105#include <linux/devfs_fs_kernel.h>
106 105
107#include <linux/kmod.h> 106#include <linux/kmod.h>
108 107
@@ -2955,8 +2954,8 @@ static struct class *tty_class;
2955 * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error). 2954 * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error).
2956 * 2955 *
2957 * This call is required to be made to register an individual tty device if 2956 * This call is required to be made to register an individual tty device if
2958 * the tty driver's flags have the TTY_DRIVER_NO_DEVFS bit set. If that 2957 * the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If that
2959 * bit is not set, this function should not be called. 2958 * bit is not set, this function should not be called by a tty driver.
2960 */ 2959 */
2961struct class_device *tty_register_device(struct tty_driver *driver, 2960struct class_device *tty_register_device(struct tty_driver *driver,
2962 unsigned index, struct device *device) 2961 unsigned index, struct device *device)
@@ -2970,9 +2969,6 @@ struct class_device *tty_register_device(struct tty_driver *driver,
2970 return ERR_PTR(-EINVAL); 2969 return ERR_PTR(-EINVAL);
2971 } 2970 }
2972 2971
2973 devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR,
2974 "%s%d", driver->devfs_name, index + driver->name_base);
2975
2976 if (driver->type == TTY_DRIVER_TYPE_PTY) 2972 if (driver->type == TTY_DRIVER_TYPE_PTY)
2977 pty_line_name(driver, index, name); 2973 pty_line_name(driver, index, name);
2978 else 2974 else
@@ -2991,7 +2987,6 @@ struct class_device *tty_register_device(struct tty_driver *driver,
2991 */ 2987 */
2992void tty_unregister_device(struct tty_driver *driver, unsigned index) 2988void tty_unregister_device(struct tty_driver *driver, unsigned index)
2993{ 2989{
2994 devfs_remove("%s%d", driver->devfs_name, index + driver->name_base);
2995 class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); 2990 class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index);
2996} 2991}
2997 2992
@@ -3113,7 +3108,7 @@ int tty_register_driver(struct tty_driver *driver)
3113 3108
3114 list_add(&driver->tty_drivers, &tty_drivers); 3109 list_add(&driver->tty_drivers, &tty_drivers);
3115 3110
3116 if ( !(driver->flags & TTY_DRIVER_NO_DEVFS) ) { 3111 if ( !(driver->flags & TTY_DRIVER_DYNAMIC_DEV) ) {
3117 for(i = 0; i < driver->num; i++) 3112 for(i = 0; i < driver->num; i++)
3118 tty_register_device(driver, i, NULL); 3113 tty_register_device(driver, i, NULL);
3119 } 3114 }
@@ -3156,7 +3151,7 @@ int tty_unregister_driver(struct tty_driver *driver)
3156 driver->termios_locked[i] = NULL; 3151 driver->termios_locked[i] = NULL;
3157 kfree(tp); 3152 kfree(tp);
3158 } 3153 }
3159 if (!(driver->flags & TTY_DRIVER_NO_DEVFS)) 3154 if (!(driver->flags & TTY_DRIVER_DYNAMIC_DEV))
3160 tty_unregister_device(driver, i); 3155 tty_unregister_device(driver, i);
3161 } 3156 }
3162 p = driver->ttys; 3157 p = driver->ttys;
@@ -3232,14 +3227,12 @@ static int __init tty_init(void)
3232 if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || 3227 if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
3233 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) 3228 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
3234 panic("Couldn't register /dev/tty driver\n"); 3229 panic("Couldn't register /dev/tty driver\n");
3235 devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 0), S_IFCHR|S_IRUGO|S_IWUGO, "tty");
3236 class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty"); 3230 class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty");
3237 3231
3238 cdev_init(&console_cdev, &console_fops); 3232 cdev_init(&console_cdev, &console_fops);
3239 if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || 3233 if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) ||
3240 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) 3234 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0)
3241 panic("Couldn't register /dev/console driver\n"); 3235 panic("Couldn't register /dev/console driver\n");
3242 devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 1), S_IFCHR|S_IRUSR|S_IWUSR, "console");
3243 class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, "console"); 3236 class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, "console");
3244 3237
3245#ifdef CONFIG_UNIX98_PTYS 3238#ifdef CONFIG_UNIX98_PTYS
@@ -3247,7 +3240,6 @@ static int __init tty_init(void)
3247 if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || 3240 if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) ||
3248 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) 3241 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0)
3249 panic("Couldn't register /dev/ptmx driver\n"); 3242 panic("Couldn't register /dev/ptmx driver\n");
3250 devfs_mk_cdev(MKDEV(TTYAUX_MAJOR, 2), S_IFCHR|S_IRUGO|S_IWUGO, "ptmx");
3251 class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); 3243 class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx");
3252#endif 3244#endif
3253 3245
@@ -3256,7 +3248,6 @@ static int __init tty_init(void)
3256 if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || 3248 if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
3257 register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) 3249 register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
3258 panic("Couldn't register /dev/tty0 driver\n"); 3250 panic("Couldn't register /dev/tty0 driver\n");
3259 devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vc/0");
3260 class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); 3251 class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
3261 3252
3262 vty_init(); 3253 vty_init();
diff --git a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
index 3c1dafaa3441..234d7f3fb114 100644
--- a/drivers/char/vc_screen.c
+++ b/drivers/char/vc_screen.c
@@ -26,7 +26,6 @@
26#include <linux/major.h> 26#include <linux/major.h>
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/tty.h> 28#include <linux/tty.h>
29#include <linux/devfs_fs_kernel.h>
30#include <linux/sched.h> 29#include <linux/sched.h>
31#include <linux/interrupt.h> 30#include <linux/interrupt.h>
32#include <linux/mm.h> 31#include <linux/mm.h>
@@ -478,12 +477,6 @@ static struct class *vc_class;
478 477
479void vcs_make_devfs(struct tty_struct *tty) 478void vcs_make_devfs(struct tty_struct *tty)
480{ 479{
481 devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 1),
482 S_IFCHR|S_IRUSR|S_IWUSR,
483 "vcc/%u", tty->index + 1);
484 devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 129),
485 S_IFCHR|S_IRUSR|S_IWUSR,
486 "vcc/a%u", tty->index + 1);
487 class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1), 480 class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 1),
488 NULL, "vcs%u", tty->index + 1); 481 NULL, "vcs%u", tty->index + 1);
489 class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129), 482 class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, tty->index + 129),
@@ -491,8 +484,6 @@ void vcs_make_devfs(struct tty_struct *tty)
491} 484}
492void vcs_remove_devfs(struct tty_struct *tty) 485void vcs_remove_devfs(struct tty_struct *tty)
493{ 486{
494 devfs_remove("vcc/%u", tty->index + 1);
495 devfs_remove("vcc/a%u", tty->index + 1);
496 class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1)); 487 class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 1));
497 class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129)); 488 class_device_destroy(vc_class, MKDEV(VCS_MAJOR, tty->index + 129));
498} 489}
@@ -503,8 +494,6 @@ int __init vcs_init(void)
503 panic("unable to get major %d for vcs device", VCS_MAJOR); 494 panic("unable to get major %d for vcs device", VCS_MAJOR);
504 vc_class = class_create(THIS_MODULE, "vc"); 495 vc_class = class_create(THIS_MODULE, "vc");
505 496
506 devfs_mk_cdev(MKDEV(VCS_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/0");
507 devfs_mk_cdev(MKDEV(VCS_MAJOR, 128), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/a0");
508 class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs"); 497 class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs");
509 class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa"); 498 class_device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa");
510 return 0; 499 return 0;
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c
index 4e5360388748..07f5ce4b28e3 100644
--- a/drivers/char/viocons.c
+++ b/drivers/char/viocons.c
@@ -1152,7 +1152,6 @@ static int __init viocons_init2(void)
1152 viotty_driver = alloc_tty_driver(VTTY_PORTS); 1152 viotty_driver = alloc_tty_driver(VTTY_PORTS);
1153 viotty_driver->owner = THIS_MODULE; 1153 viotty_driver->owner = THIS_MODULE;
1154 viotty_driver->driver_name = "vioconsole"; 1154 viotty_driver->driver_name = "vioconsole";
1155 viotty_driver->devfs_name = "vcs/";
1156 viotty_driver->name = "tty"; 1155 viotty_driver->name = "tty";
1157 viotty_driver->name_base = 1; 1156 viotty_driver->name_base = 1;
1158 viotty_driver->major = TTY_MAJOR; 1157 viotty_driver->major = TTY_MAJOR;
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c
index 11c7e9de5958..198f1505ae23 100644
--- a/drivers/char/viotape.c
+++ b/drivers/char/viotape.c
@@ -43,7 +43,6 @@
43#include <linux/dma-mapping.h> 43#include <linux/dma-mapping.h>
44#include <linux/fs.h> 44#include <linux/fs.h>
45#include <linux/cdev.h> 45#include <linux/cdev.h>
46#include <linux/devfs_fs_kernel.h>
47#include <linux/major.h> 46#include <linux/major.h>
48#include <linux/completion.h> 47#include <linux/completion.h>
49#include <linux/proc_fs.h> 48#include <linux/proc_fs.h>
@@ -246,7 +245,6 @@ static struct device *tape_device[VIOTAPE_MAX_TAPE];
246 */ 245 */
247static struct { 246static struct {
248 unsigned char cur_part; 247 unsigned char cur_part;
249 int dev_handle;
250 unsigned char part_stat_rwi[MAX_PARTITIONS]; 248 unsigned char part_stat_rwi[MAX_PARTITIONS];
251} state[VIOTAPE_MAX_TAPE]; 249} state[VIOTAPE_MAX_TAPE];
252 250
@@ -959,12 +957,7 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id)
959 "iseries!vt%d", i); 957 "iseries!vt%d", i);
960 class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), 958 class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80),
961 NULL, "iseries!nvt%d", i); 959 NULL, "iseries!nvt%d", i);
962 devfs_mk_cdev(MKDEV(VIOTAPE_MAJOR, i), S_IFCHR | S_IRUSR | S_IWUSR,
963 "iseries/vt%d", i);
964 devfs_mk_cdev(MKDEV(VIOTAPE_MAJOR, i | 0x80),
965 S_IFCHR | S_IRUSR | S_IWUSR, "iseries/nvt%d", i);
966 sprintf(tapename, "iseries/vt%d", i); 960 sprintf(tapename, "iseries/vt%d", i);
967 state[i].dev_handle = devfs_register_tape(tapename);
968 printk(VIOTAPE_KERN_INFO "tape %s is iSeries " 961 printk(VIOTAPE_KERN_INFO "tape %s is iSeries "
969 "resource %10.10s type %4.4s, model %3.3s\n", 962 "resource %10.10s type %4.4s, model %3.3s\n",
970 tapename, viotape_unitinfo[i].rsrcname, 963 tapename, viotape_unitinfo[i].rsrcname,
@@ -976,9 +969,6 @@ static int viotape_remove(struct vio_dev *vdev)
976{ 969{
977 int i = vdev->unit_address; 970 int i = vdev->unit_address;
978 971
979 devfs_remove("iseries/nvt%d", i);
980 devfs_remove("iseries/vt%d", i);
981 devfs_unregister_tape(state[i].dev_handle);
982 class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i | 0x80)); 972 class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i | 0x80));
983 class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i)); 973 class_device_destroy(tape_class, MKDEV(VIOTAPE_MAJOR, i));
984 return 0; 974 return 0;
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c
index fd00822ac145..fe99fc1aba45 100644
--- a/drivers/char/vme_scc.c
+++ b/drivers/char/vme_scc.c
@@ -147,7 +147,6 @@ static int scc_init_drivers(void)
147 scc_driver->owner = THIS_MODULE; 147 scc_driver->owner = THIS_MODULE;
148 scc_driver->driver_name = "scc"; 148 scc_driver->driver_name = "scc";
149 scc_driver->name = "ttyS"; 149 scc_driver->name = "ttyS";
150 scc_driver->devfs_name = "tts/";
151 scc_driver->major = TTY_MAJOR; 150 scc_driver->major = TTY_MAJOR;
152 scc_driver->minor_start = SCC_MINOR_BASE; 151 scc_driver->minor_start = SCC_MINOR_BASE;
153 scc_driver->type = TTY_DRIVER_TYPE_SERIAL; 152 scc_driver->type = TTY_DRIVER_TYPE_SERIAL;
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 714d95ff2f1e..d6f65032649a 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -79,7 +79,6 @@
79#include <linux/mm.h> 79#include <linux/mm.h>
80#include <linux/console.h> 80#include <linux/console.h>
81#include <linux/init.h> 81#include <linux/init.h>
82#include <linux/devfs_fs_kernel.h>
83#include <linux/vt_kern.h> 82#include <linux/vt_kern.h>
84#include <linux/selection.h> 83#include <linux/selection.h>
85#include <linux/tiocl.h> 84#include <linux/tiocl.h>
@@ -2663,7 +2662,6 @@ int __init vty_init(void)
2663 if (!console_driver) 2662 if (!console_driver)
2664 panic("Couldn't allocate console driver\n"); 2663 panic("Couldn't allocate console driver\n");
2665 console_driver->owner = THIS_MODULE; 2664 console_driver->owner = THIS_MODULE;
2666 console_driver->devfs_name = "vc/";
2667 console_driver->name = "tty"; 2665 console_driver->name = "tty";
2668 console_driver->name_base = 1; 2666 console_driver->name_base = 1;
2669 console_driver->major = TTY_MAJOR; 2667 console_driver->major = TTY_MAJOR;
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 99fa42402e71..bfafd4846a08 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -3527,8 +3527,6 @@ static int ide_cd_probe(ide_drive_t *drive)
3527 drive->driver_data = info; 3527 drive->driver_data = info;
3528 3528
3529 g->minors = 1; 3529 g->minors = 1;
3530 snprintf(g->devfs_name, sizeof(g->devfs_name),
3531 "%s/cd", drive->devfs_name);
3532 g->driverfs_dev = &drive->gendev; 3530 g->driverfs_dev = &drive->gendev;
3533 g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; 3531 g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE;
3534 if (ide_cdrom_setup(drive)) { 3532 if (ide_cdrom_setup(drive)) {
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index f033d732f387..d0227c39ced1 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -1018,7 +1018,6 @@ static void ide_disk_release(struct kref *kref)
1018 struct gendisk *g = idkp->disk; 1018 struct gendisk *g = idkp->disk;
1019 1019
1020 drive->driver_data = NULL; 1020 drive->driver_data = NULL;
1021 drive->devfs_name[0] = '\0';
1022 g->private_data = NULL; 1021 g->private_data = NULL;
1023 put_disk(g); 1022 put_disk(g);
1024 kfree(idkp); 1023 kfree(idkp);
@@ -1222,7 +1221,6 @@ static int ide_disk_probe(ide_drive_t *drive)
1222 drive->attach = 1; 1221 drive->attach = 1;
1223 1222
1224 g->minors = 1 << PARTN_BITS; 1223 g->minors = 1 << PARTN_BITS;
1225 strcpy(g->devfs_name, drive->devfs_name);
1226 g->driverfs_dev = &drive->gendev; 1224 g->driverfs_dev = &drive->gendev;
1227 g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0; 1225 g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0;
1228 set_capacity(g, idedisk_capacity(drive)); 1226 set_capacity(g, idedisk_capacity(drive));
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 4656587aa2f7..68628327c0f5 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -2176,7 +2176,6 @@ static int ide_floppy_probe(ide_drive_t *drive)
2176 2176
2177 g->minors = 1 << PARTN_BITS; 2177 g->minors = 1 << PARTN_BITS;
2178 g->driverfs_dev = &drive->gendev; 2178 g->driverfs_dev = &drive->gendev;
2179 strcpy(g->devfs_name, drive->devfs_name);
2180 g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0; 2179 g->flags = drive->removable ? GENHD_FL_REMOVABLE : 0;
2181 g->fops = &idefloppy_ops; 2180 g->fops = &idefloppy_ops;
2182 drive->attach = 1; 2181 drive->attach = 1;
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 9ebf8ae2a5e3..0d5038a28560 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -47,7 +47,6 @@
47#include <linux/slab.h> 47#include <linux/slab.h>
48#include <linux/delay.h> 48#include <linux/delay.h>
49#include <linux/ide.h> 49#include <linux/ide.h>
50#include <linux/devfs_fs_kernel.h>
51#include <linux/spinlock.h> 50#include <linux/spinlock.h>
52#include <linux/kmod.h> 51#include <linux/kmod.h>
53#include <linux/pci.h> 52#include <linux/pci.h>
@@ -1279,10 +1278,6 @@ static void drive_release_dev (struct device *dev)
1279 ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); 1278 ide_drive_t *drive = container_of(dev, ide_drive_t, gendev);
1280 1279
1281 spin_lock_irq(&ide_lock); 1280 spin_lock_irq(&ide_lock);
1282 if (drive->devfs_name[0] != '\0') {
1283 devfs_remove(drive->devfs_name);
1284 drive->devfs_name[0] = '\0';
1285 }
1286 ide_remove_drive_from_hwgroup(drive); 1281 ide_remove_drive_from_hwgroup(drive);
1287 kfree(drive->id); 1282 kfree(drive->id);
1288 drive->id = NULL; 1283 drive->id = NULL;
@@ -1316,12 +1311,6 @@ static void init_gendisk (ide_hwif_t *hwif)
1316 drive->gendev.bus = &ide_bus_type; 1311 drive->gendev.bus = &ide_bus_type;
1317 drive->gendev.driver_data = drive; 1312 drive->gendev.driver_data = drive;
1318 drive->gendev.release = drive_release_dev; 1313 drive->gendev.release = drive_release_dev;
1319 if (drive->present) {
1320 sprintf(drive->devfs_name, "ide/host%d/bus%d/target%d/lun%d",
1321 (hwif->channel && hwif->mate) ?
1322 hwif->mate->index : hwif->index,
1323 hwif->channel, unit, drive->lun);
1324 }
1325 } 1314 }
1326 blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS, 1315 blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS,
1327 THIS_MODULE, ata_probe, ata_lock, hwif); 1316 THIS_MODULE, ata_probe, ata_lock, hwif);
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 09f3a7dab28a..4b91101e12b7 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -435,7 +435,6 @@
435#include <linux/interrupt.h> 435#include <linux/interrupt.h>
436#include <linux/jiffies.h> 436#include <linux/jiffies.h>
437#include <linux/major.h> 437#include <linux/major.h>
438#include <linux/devfs_fs_kernel.h>
439#include <linux/errno.h> 438#include <linux/errno.h>
440#include <linux/genhd.h> 439#include <linux/genhd.h>
441#include <linux/slab.h> 440#include <linux/slab.h>
@@ -4726,9 +4725,6 @@ static void ide_tape_release(struct kref *kref)
4726 MKDEV(IDETAPE_MAJOR, tape->minor)); 4725 MKDEV(IDETAPE_MAJOR, tape->minor));
4727 class_device_destroy(idetape_sysfs_class, 4726 class_device_destroy(idetape_sysfs_class,
4728 MKDEV(IDETAPE_MAJOR, tape->minor + 128)); 4727 MKDEV(IDETAPE_MAJOR, tape->minor + 128));
4729 devfs_remove("%s/mt", drive->devfs_name);
4730 devfs_remove("%s/mtn", drive->devfs_name);
4731 devfs_unregister_tape(g->number);
4732 idetape_devs[tape->minor] = NULL; 4728 idetape_devs[tape->minor] = NULL;
4733 g->private_data = NULL; 4729 g->private_data = NULL;
4734 put_disk(g); 4730 put_disk(g);
@@ -4902,14 +4898,6 @@ static int ide_tape_probe(ide_drive_t *drive)
4902 class_device_create(idetape_sysfs_class, NULL, 4898 class_device_create(idetape_sysfs_class, NULL,
4903 MKDEV(IDETAPE_MAJOR, minor + 128), &drive->gendev, "n%s", tape->name); 4899 MKDEV(IDETAPE_MAJOR, minor + 128), &drive->gendev, "n%s", tape->name);
4904 4900
4905 devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor),
4906 S_IFCHR | S_IRUGO | S_IWUGO,
4907 "%s/mt", drive->devfs_name);
4908 devfs_mk_cdev(MKDEV(HWIF(drive)->major, minor + 128),
4909 S_IFCHR | S_IRUGO | S_IWUGO,
4910 "%s/mtn", drive->devfs_name);
4911
4912 g->number = devfs_register_tape(drive->devfs_name);
4913 g->fops = &idetape_block_ops; 4901 g->fops = &idetape_block_ops;
4914 ide_register_region(g); 4902 ide_register_region(g);
4915 4903
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 59fe358048b3..1cdf44205162 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -147,7 +147,6 @@
147#include <linux/pci.h> 147#include <linux/pci.h>
148#include <linux/delay.h> 148#include <linux/delay.h>
149#include <linux/ide.h> 149#include <linux/ide.h>
150#include <linux/devfs_fs_kernel.h>
151#include <linux/completion.h> 150#include <linux/completion.h>
152#include <linux/reboot.h> 151#include <linux/reboot.h>
153#include <linux/cdrom.h> 152#include <linux/cdrom.h>
@@ -592,13 +591,8 @@ void ide_unregister(unsigned int index)
592 goto abort; 591 goto abort;
593 for (unit = 0; unit < MAX_DRIVES; ++unit) { 592 for (unit = 0; unit < MAX_DRIVES; ++unit) {
594 drive = &hwif->drives[unit]; 593 drive = &hwif->drives[unit];
595 if (!drive->present) { 594 if (!drive->present)
596 if (drive->devfs_name[0] != '\0') {
597 devfs_remove(drive->devfs_name);
598 drive->devfs_name[0] = '\0';
599 }
600 continue; 595 continue;
601 }
602 spin_unlock_irq(&ide_lock); 596 spin_unlock_irq(&ide_lock);
603 device_unregister(&drive->gendev); 597 device_unregister(&drive->gendev);
604 wait_for_completion(&drive->gendev_rel_comp); 598 wait_for_completion(&drive->gendev_rel_comp);
@@ -1996,7 +1990,6 @@ EXPORT_SYMBOL_GPL(ide_bus_type);
1996static int __init ide_init(void) 1990static int __init ide_init(void)
1997{ 1991{
1998 printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n"); 1992 printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n");
1999 devfs_mk_dir("ide");
2000 system_bus_speed = ide_system_bus_speed(); 1993 system_bus_speed = ide_system_bus_speed();
2001 1994
2002 bus_register(&ide_bus_type); 1995 bus_register(&ide_bus_type);
@@ -2074,7 +2067,6 @@ void cleanup_module (void)
2074#ifdef CONFIG_PROC_FS 2067#ifdef CONFIG_PROC_FS
2075 proc_ide_destroy(); 2068 proc_ide_destroy();
2076#endif 2069#endif
2077 devfs_remove("ide");
2078 2070
2079 bus_unregister(&ide_bus_type); 2071 bus_unregister(&ide_bus_type);
2080} 2072}
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
index 5a2703b536dc..71a8eea816cb 100644
--- a/drivers/input/serio/serio_raw.c
+++ b/drivers/input/serio/serio_raw.c
@@ -16,7 +16,6 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/major.h> 17#include <linux/major.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/devfs_fs_kernel.h>
20#include <linux/miscdevice.h> 19#include <linux/miscdevice.h>
21#include <linux/wait.h> 20#include <linux/wait.h>
22#include <linux/mutex.h> 21#include <linux/mutex.h>
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 2e541fa02024..a518ec531021 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -39,7 +39,6 @@
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/device.h> 40#include <linux/device.h>
41#include <linux/moduleparam.h> 41#include <linux/moduleparam.h>
42#include <linux/devfs_fs_kernel.h>
43#include <linux/isdn/capiutil.h> 42#include <linux/isdn/capiutil.h>
44#include <linux/isdn/capicmd.h> 43#include <linux/isdn/capicmd.h>
45#if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE) 44#if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
@@ -1337,7 +1336,6 @@ static int capinc_tty_init(void)
1337 1336
1338 drv->owner = THIS_MODULE; 1337 drv->owner = THIS_MODULE;
1339 drv->driver_name = "capi_nc"; 1338 drv->driver_name = "capi_nc";
1340 drv->devfs_name = "capi/";
1341 drv->name = "capi"; 1339 drv->name = "capi";
1342 drv->major = capi_ttymajor; 1340 drv->major = capi_ttymajor;
1343 drv->minor_start = 0; 1341 drv->minor_start = 0;
@@ -1516,8 +1514,6 @@ static int __init capi_init(void)
1516 } 1514 }
1517 1515
1518 class_device_create(capi_class, NULL, MKDEV(capi_major, 0), NULL, "capi"); 1516 class_device_create(capi_class, NULL, MKDEV(capi_major, 0), NULL, "capi");
1519 devfs_mk_cdev(MKDEV(capi_major, 0), S_IFCHR | S_IRUSR | S_IWUSR,
1520 "isdn/capi20");
1521 1517
1522#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE 1518#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1523 if (capinc_tty_init() < 0) { 1519 if (capinc_tty_init() < 0) {
@@ -1552,7 +1548,6 @@ static void __exit capi_exit(void)
1552 class_device_destroy(capi_class, MKDEV(capi_major, 0)); 1548 class_device_destroy(capi_class, MKDEV(capi_major, 0));
1553 class_destroy(capi_class); 1549 class_destroy(capi_class);
1554 unregister_chrdev(capi_major, "capi20"); 1550 unregister_chrdev(capi_major, "capi20");
1555 devfs_remove("isdn/capi20");
1556 1551
1557#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE 1552#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
1558 capinc_tty_exit(); 1553 capinc_tty_exit();
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index 8a45715dd4c1..3845defd4901 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -41,7 +41,6 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode");
41#define GIGASET_MINORS 1 41#define GIGASET_MINORS 1
42#define GIGASET_MINOR 16 42#define GIGASET_MINOR 16
43#define GIGASET_MODULENAME "bas_gigaset" 43#define GIGASET_MODULENAME "bas_gigaset"
44#define GIGASET_DEVFSNAME "gig/bas/"
45#define GIGASET_DEVNAME "ttyGB" 44#define GIGASET_DEVNAME "ttyGB"
46 45
47/* length limit according to Siemens 3070usb-protokoll.doc ch. 2.1 */ 46/* length limit according to Siemens 3070usb-protokoll.doc ch. 2.1 */
@@ -2349,8 +2348,7 @@ static int __init bas_gigaset_init(void)
2349 /* allocate memory for our driver state and intialize it */ 2348 /* allocate memory for our driver state and intialize it */
2350 if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, 2349 if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
2351 GIGASET_MODULENAME, GIGASET_DEVNAME, 2350 GIGASET_MODULENAME, GIGASET_DEVNAME,
2352 GIGASET_DEVFSNAME, &gigops, 2351 &gigops, THIS_MODULE)) == NULL)
2353 THIS_MODULE)) == NULL)
2354 goto error; 2352 goto error;
2355 2353
2356 /* allocate memory for our device state and intialize it */ 2354 /* allocate memory for our device state and intialize it */
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 2a56bf33a673..aca165d43aa0 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -1092,14 +1092,12 @@ EXPORT_SYMBOL_GPL(gigaset_freedriver);
1092 * minors Number of minors this driver can handle 1092 * minors Number of minors this driver can handle
1093 * procname Name of the driver 1093 * procname Name of the driver
1094 * devname Name of the device files (prefix without minor number) 1094 * devname Name of the device files (prefix without minor number)
1095 * devfsname Devfs name of the device files without %d
1096 * return value: 1095 * return value:
1097 * Pointer to the gigaset_driver structure on success, NULL on failure. 1096 * Pointer to the gigaset_driver structure on success, NULL on failure.
1098 */ 1097 */
1099struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, 1098struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
1100 const char *procname, 1099 const char *procname,
1101 const char *devname, 1100 const char *devname,
1102 const char *devfsname,
1103 const struct gigaset_ops *ops, 1101 const struct gigaset_ops *ops,
1104 struct module *owner) 1102 struct module *owner)
1105{ 1103{
@@ -1139,7 +1137,7 @@ struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
1139 drv->cs[i].minor_index = i; 1137 drv->cs[i].minor_index = i;
1140 } 1138 }
1141 1139
1142 gigaset_if_initdriver(drv, procname, devname, devfsname); 1140 gigaset_if_initdriver(drv, procname, devname);
1143 1141
1144 spin_lock_irqsave(&driver_lock, flags); 1142 spin_lock_irqsave(&driver_lock, flags);
1145 list_add(&drv->list, &drivers); 1143 list_add(&drv->list, &drivers);
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
index 8d63d822104f..1ca3bfdef51d 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -769,7 +769,6 @@ void gigaset_block_channels(struct cardstate *cs);
769struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors, 769struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
770 const char *procname, 770 const char *procname,
771 const char *devname, 771 const char *devname,
772 const char *devfsname,
773 const struct gigaset_ops *ops, 772 const struct gigaset_ops *ops,
774 struct module *owner); 773 struct module *owner);
775 774
@@ -892,7 +891,7 @@ int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src,
892 891
893/* initialize interface */ 892/* initialize interface */
894void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, 893void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
895 const char *devname, const char *devfsname); 894 const char *devname);
896/* release interface */ 895/* release interface */
897void gigaset_if_freedriver(struct gigaset_driver *drv); 896void gigaset_if_freedriver(struct gigaset_driver *drv);
898/* add minor */ 897/* add minor */
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index 74fd234956c8..bd2e4267528e 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -673,10 +673,9 @@ EXPORT_SYMBOL_GPL(gigaset_if_receive);
673 * drv Driver 673 * drv Driver
674 * procname Name of the driver (e.g. for /proc/tty/drivers) 674 * procname Name of the driver (e.g. for /proc/tty/drivers)
675 * devname Name of the device files (prefix without minor number) 675 * devname Name of the device files (prefix without minor number)
676 * devfsname Devfs name of the device files without %d
677 */ 676 */
678void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, 677void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
679 const char *devname, const char *devfsname) 678 const char *devname)
680{ 679{
681 unsigned minors = drv->minors; 680 unsigned minors = drv->minors;
682 int ret; 681 int ret;
@@ -692,7 +691,7 @@ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
692 tty->major = GIG_MAJOR, 691 tty->major = GIG_MAJOR,
693 tty->type = TTY_DRIVER_TYPE_SERIAL, 692 tty->type = TTY_DRIVER_TYPE_SERIAL,
694 tty->subtype = SERIAL_TYPE_NORMAL, 693 tty->subtype = SERIAL_TYPE_NORMAL,
695 tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS, 694 tty->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
696 695
697 tty->driver_name = procname; 696 tty->driver_name = procname;
698 tty->name = devname; 697 tty->name = devname;
@@ -700,7 +699,6 @@ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
700 tty->num = drv->minors; 699 tty->num = drv->minors;
701 700
702 tty->owner = THIS_MODULE; 701 tty->owner = THIS_MODULE;
703 tty->devfs_name = devfsname;
704 702
705 tty->init_termios = tty_std_termios; //FIXME 703 tty->init_termios = tty_std_termios; //FIXME
706 tty->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; //FIXME 704 tty->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; //FIXME
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index d86ab68114b0..6e05d9d4a51a 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -41,7 +41,6 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode");
41#define GIGASET_MINORS 1 41#define GIGASET_MINORS 1
42#define GIGASET_MINOR 8 42#define GIGASET_MINOR 8
43#define GIGASET_MODULENAME "usb_gigaset" 43#define GIGASET_MODULENAME "usb_gigaset"
44#define GIGASET_DEVFSNAME "gig/usb/"
45#define GIGASET_DEVNAME "ttyGU" 44#define GIGASET_DEVNAME "ttyGU"
46 45
47#define IF_WRITEBUF 2000 //FIXME // WAKEUP_CHARS: 256 46#define IF_WRITEBUF 2000 //FIXME // WAKEUP_CHARS: 256
@@ -896,8 +895,7 @@ static int __init usb_gigaset_init(void)
896 /* allocate memory for our driver state and intialize it */ 895 /* allocate memory for our driver state and intialize it */
897 if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, 896 if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS,
898 GIGASET_MODULENAME, GIGASET_DEVNAME, 897 GIGASET_MODULENAME, GIGASET_DEVNAME,
899 GIGASET_DEVFSNAME, &ops, 898 &ops, THIS_MODULE)) == NULL)
900 THIS_MODULE)) == NULL)
901 goto error; 899 goto error;
902 900
903 /* allocate memory for our device state and intialize it */ 901 /* allocate memory for our device state and intialize it */
diff --git a/drivers/isdn/hardware/eicon/divamnt.c b/drivers/isdn/hardware/eicon/divamnt.c
index 6146f7633be5..b163c5909182 100644
--- a/drivers/isdn/hardware/eicon/divamnt.c
+++ b/drivers/isdn/hardware/eicon/divamnt.c
@@ -17,7 +17,6 @@
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/smp_lock.h> 18#include <linux/smp_lock.h>
19#include <linux/poll.h> 19#include <linux/poll.h>
20#include <linux/devfs_fs_kernel.h>
21#include <asm/uaccess.h> 20#include <asm/uaccess.h>
22 21
23#include "platform.h" 22#include "platform.h"
@@ -178,7 +177,6 @@ static struct file_operations divas_maint_fops = {
178 177
179static void divas_maint_unregister_chrdev(void) 178static void divas_maint_unregister_chrdev(void)
180{ 179{
181 devfs_remove(DEVNAME);
182 unregister_chrdev(major, DEVNAME); 180 unregister_chrdev(major, DEVNAME);
183} 181}
184 182
@@ -190,7 +188,6 @@ static int DIVA_INIT_FUNCTION divas_maint_register_chrdev(void)
190 DRIVERLNAME); 188 DRIVERLNAME);
191 return (0); 189 return (0);
192 } 190 }
193 devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVNAME);
194 191
195 return (1); 192 return (1);
196} 193}
diff --git a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c
index df715b47e2b4..6e7d89a31c1d 100644
--- a/drivers/isdn/hardware/eicon/divasi.c
+++ b/drivers/isdn/hardware/eicon/divasi.c
@@ -19,7 +19,6 @@
19#include <linux/poll.h> 19#include <linux/poll.h>
20#include <linux/proc_fs.h> 20#include <linux/proc_fs.h>
21#include <linux/skbuff.h> 21#include <linux/skbuff.h>
22#include <linux/devfs_fs_kernel.h>
23#include <asm/uaccess.h> 22#include <asm/uaccess.h>
24 23
25#include "platform.h" 24#include "platform.h"
@@ -145,7 +144,6 @@ static struct file_operations divas_idi_fops = {
145 144
146static void divas_idi_unregister_chrdev(void) 145static void divas_idi_unregister_chrdev(void)
147{ 146{
148 devfs_remove(DEVNAME);
149 unregister_chrdev(major, DEVNAME); 147 unregister_chrdev(major, DEVNAME);
150} 148}
151 149
@@ -157,7 +155,6 @@ static int DIVA_INIT_FUNCTION divas_idi_register_chrdev(void)
157 DRIVERLNAME); 155 DRIVERLNAME);
158 return (0); 156 return (0);
159 } 157 }
160 devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVNAME);
161 158
162 return (1); 159 return (1);
163} 160}
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
index c9b26e86d183..9dee6a39104c 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -14,7 +14,6 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/devfs_fs_kernel.h>
18#include <asm/uaccess.h> 17#include <asm/uaccess.h>
19#include <asm/io.h> 18#include <asm/io.h>
20#include <linux/ioport.h> 19#include <linux/ioport.h>
@@ -678,7 +677,6 @@ static struct file_operations divas_fops = {
678 677
679static void divas_unregister_chrdev(void) 678static void divas_unregister_chrdev(void)
680{ 679{
681 devfs_remove(DEVNAME);
682 unregister_chrdev(major, DEVNAME); 680 unregister_chrdev(major, DEVNAME);
683} 681}
684 682
@@ -690,7 +688,6 @@ static int DIVA_INIT_FUNCTION divas_register_chrdev(void)
690 DRIVERLNAME); 688 DRIVERLNAME);
691 return (0); 689 return (0);
692 } 690 }
693 devfs_mk_cdev(MKDEV(major, 0), S_IFCHR|S_IRUSR|S_IWUSR, DEVNAME);
694 691
695 return (1); 692 return (1);
696} 693}
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index 433389daedb2..0a53a990c100 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -1890,14 +1890,13 @@ isdn_tty_modem_init(void)
1890 if (!m->tty_modem) 1890 if (!m->tty_modem)
1891 return -ENOMEM; 1891 return -ENOMEM;
1892 m->tty_modem->name = "ttyI"; 1892 m->tty_modem->name = "ttyI";
1893 m->tty_modem->devfs_name = "isdn/ttyI";
1894 m->tty_modem->major = ISDN_TTY_MAJOR; 1893 m->tty_modem->major = ISDN_TTY_MAJOR;
1895 m->tty_modem->minor_start = 0; 1894 m->tty_modem->minor_start = 0;
1896 m->tty_modem->type = TTY_DRIVER_TYPE_SERIAL; 1895 m->tty_modem->type = TTY_DRIVER_TYPE_SERIAL;
1897 m->tty_modem->subtype = SERIAL_TYPE_NORMAL; 1896 m->tty_modem->subtype = SERIAL_TYPE_NORMAL;
1898 m->tty_modem->init_termios = tty_std_termios; 1897 m->tty_modem->init_termios = tty_std_termios;
1899 m->tty_modem->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; 1898 m->tty_modem->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
1900 m->tty_modem->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; 1899 m->tty_modem->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
1901 m->tty_modem->driver_name = "isdn_tty"; 1900 m->tty_modem->driver_name = "isdn_tty";
1902 tty_set_operations(m->tty_modem, &modem_ops); 1901 tty_set_operations(m->tty_modem, &modem_ops);
1903 retval = tty_register_driver(m->tty_modem); 1902 retval = tty_register_driver(m->tty_modem);
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 259fd8973ce9..9f1a049dc226 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -36,7 +36,6 @@
36#include <linux/spinlock.h> 36#include <linux/spinlock.h>
37#include <linux/completion.h> 37#include <linux/completion.h>
38#include <linux/device.h> 38#include <linux/device.h>
39#include <linux/devfs_fs_kernel.h>
40 39
41#include <asm/uaccess.h> 40#include <asm/uaccess.h>
42#include <asm/semaphore.h> 41#include <asm/semaphore.h>
@@ -904,8 +903,6 @@ adbdev_init(void)
904 return; 903 return;
905 } 904 }
906 905
907 devfs_mk_cdev(MKDEV(ADB_MAJOR, 0), S_IFCHR | S_IRUSR | S_IWUSR, "adb");
908
909 adb_dev_class = class_create(THIS_MODULE, "adb"); 906 adb_dev_class = class_create(THIS_MODULE, "adb");
910 if (IS_ERR(adb_dev_class)) 907 if (IS_ERR(adb_dev_class))
911 return; 908 return;
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 3edb3477f987..d13bb15a8a02 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/wait.h> 14#include <linux/wait.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/devfs_fs_kernel.h>
17#include <linux/dm-ioctl.h> 16#include <linux/dm-ioctl.h>
18#include <linux/hdreg.h> 17#include <linux/hdreg.h>
19 18
@@ -68,14 +67,12 @@ static int dm_hash_init(void)
68{ 67{
69 init_buckets(_name_buckets); 68 init_buckets(_name_buckets);
70 init_buckets(_uuid_buckets); 69 init_buckets(_uuid_buckets);
71 devfs_mk_dir(DM_DIR);
72 return 0; 70 return 0;
73} 71}
74 72
75static void dm_hash_exit(void) 73static void dm_hash_exit(void)
76{ 74{
77 dm_hash_remove_all(0); 75 dm_hash_remove_all(0);
78 devfs_remove(DM_DIR);
79} 76}
80 77
81/*----------------------------------------------------------------- 78/*-----------------------------------------------------------------
@@ -172,25 +169,6 @@ static void free_cell(struct hash_cell *hc)
172} 169}
173 170
174/* 171/*
175 * devfs stuff.
176 */
177static int register_with_devfs(struct hash_cell *hc)
178{
179 struct gendisk *disk = dm_disk(hc->md);
180
181 devfs_mk_bdev(MKDEV(disk->major, disk->first_minor),
182 S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP,
183 DM_DIR "/%s", hc->name);
184 return 0;
185}
186
187static int unregister_with_devfs(struct hash_cell *hc)
188{
189 devfs_remove(DM_DIR"/%s", hc->name);
190 return 0;
191}
192
193/*
194 * The kdev_t and uuid of a device can never change once it is 172 * The kdev_t and uuid of a device can never change once it is
195 * initially inserted. 173 * initially inserted.
196 */ 174 */
@@ -226,7 +204,6 @@ static int dm_hash_insert(const char *name, const char *uuid, struct mapped_devi
226 } 204 }
227 list_add(&cell->uuid_list, _uuid_buckets + hash_str(uuid)); 205 list_add(&cell->uuid_list, _uuid_buckets + hash_str(uuid));
228 } 206 }
229 register_with_devfs(cell);
230 dm_get(md); 207 dm_get(md);
231 dm_set_mdptr(md, cell); 208 dm_set_mdptr(md, cell);
232 up_write(&_hash_lock); 209 up_write(&_hash_lock);
@@ -246,7 +223,6 @@ static void __hash_remove(struct hash_cell *hc)
246 /* remove from the dev hash */ 223 /* remove from the dev hash */
247 list_del(&hc->uuid_list); 224 list_del(&hc->uuid_list);
248 list_del(&hc->name_list); 225 list_del(&hc->name_list);
249 unregister_with_devfs(hc);
250 dm_set_mdptr(hc->md, NULL); 226 dm_set_mdptr(hc->md, NULL);
251 227
252 table = dm_get_table(hc->md); 228 table = dm_get_table(hc->md);
@@ -342,16 +318,11 @@ static int dm_hash_rename(const char *old, const char *new)
342 /* 318 /*
343 * rename and move the name cell. 319 * rename and move the name cell.
344 */ 320 */
345 unregister_with_devfs(hc);
346
347 list_del(&hc->name_list); 321 list_del(&hc->name_list);
348 old_name = hc->name; 322 old_name = hc->name;
349 hc->name = new_name; 323 hc->name = new_name;
350 list_add(&hc->name_list, _name_buckets + hash_str(new_name)); 324 list_add(&hc->name_list, _name_buckets + hash_str(new_name));
351 325
352 /* rename the device node in devfs */
353 register_with_devfs(hc);
354
355 /* 326 /*
356 * Wake up any dm event waiters. 327 * Wake up any dm event waiters.
357 */ 328 */
@@ -1501,7 +1472,6 @@ static struct file_operations _ctl_fops = {
1501static struct miscdevice _dm_misc = { 1472static struct miscdevice _dm_misc = {
1502 .minor = MISC_DYNAMIC_MINOR, 1473 .minor = MISC_DYNAMIC_MINOR,
1503 .name = DM_NAME, 1474 .name = DM_NAME,
1504 .devfs_name = "mapper/control",
1505 .fops = &_ctl_fops 1475 .fops = &_ctl_fops
1506}; 1476};
1507 1477
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 3ed2e53b9eb6..c99bf9f01759 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -167,7 +167,7 @@ static void local_exit(void)
167 bioset_free(dm_set); 167 bioset_free(dm_set);
168 168
169 if (unregister_blkdev(_major, _name) < 0) 169 if (unregister_blkdev(_major, _name) < 0)
170 DMERR("devfs_unregister_blkdev failed"); 170 DMERR("unregister_blkdev failed");
171 171
172 _major = 0; 172 _major = 0;
173 173
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 306268ec99ff..2ec1b3520a0b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -39,7 +39,6 @@
39#include <linux/raid/md.h> 39#include <linux/raid/md.h>
40#include <linux/raid/bitmap.h> 40#include <linux/raid/bitmap.h>
41#include <linux/sysctl.h> 41#include <linux/sysctl.h>
42#include <linux/devfs_fs_kernel.h>
43#include <linux/buffer_head.h> /* for invalidate_bdev */ 42#include <linux/buffer_head.h> /* for invalidate_bdev */
44#include <linux/suspend.h> 43#include <linux/suspend.h>
45#include <linux/poll.h> 44#include <linux/poll.h>
@@ -2911,13 +2910,10 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
2911 } 2910 }
2912 disk->major = MAJOR(dev); 2911 disk->major = MAJOR(dev);
2913 disk->first_minor = unit << shift; 2912 disk->first_minor = unit << shift;
2914 if (partitioned) { 2913 if (partitioned)
2915 sprintf(disk->disk_name, "md_d%d", unit); 2914 sprintf(disk->disk_name, "md_d%d", unit);
2916 sprintf(disk->devfs_name, "md/d%d", unit); 2915 else
2917 } else {
2918 sprintf(disk->disk_name, "md%d", unit); 2916 sprintf(disk->disk_name, "md%d", unit);
2919 sprintf(disk->devfs_name, "md/%d", unit);
2920 }
2921 disk->fops = &md_fops; 2917 disk->fops = &md_fops;
2922 disk->private_data = mddev; 2918 disk->private_data = mddev;
2923 disk->queue = mddev->queue; 2919 disk->queue = mddev->queue;
@@ -5538,8 +5534,6 @@ static void md_geninit(void)
5538 5534
5539static int __init md_init(void) 5535static int __init md_init(void)
5540{ 5536{
5541 int minor;
5542
5543 printk(KERN_INFO "md: md driver %d.%d.%d MAX_MD_DEVS=%d," 5537 printk(KERN_INFO "md: md driver %d.%d.%d MAX_MD_DEVS=%d,"
5544 " MD_SB_DISKS=%d\n", 5538 " MD_SB_DISKS=%d\n",
5545 MD_MAJOR_VERSION, MD_MINOR_VERSION, 5539 MD_MAJOR_VERSION, MD_MINOR_VERSION,
@@ -5553,23 +5547,11 @@ static int __init md_init(void)
5553 unregister_blkdev(MAJOR_NR, "md"); 5547 unregister_blkdev(MAJOR_NR, "md");
5554 return -1; 5548 return -1;
5555 } 5549 }
5556 devfs_mk_dir("md");
5557 blk_register_region(MKDEV(MAJOR_NR, 0), MAX_MD_DEVS, THIS_MODULE, 5550 blk_register_region(MKDEV(MAJOR_NR, 0), MAX_MD_DEVS, THIS_MODULE,
5558 md_probe, NULL, NULL); 5551 md_probe, NULL, NULL);
5559 blk_register_region(MKDEV(mdp_major, 0), MAX_MD_DEVS<<MdpMinorShift, THIS_MODULE, 5552 blk_register_region(MKDEV(mdp_major, 0), MAX_MD_DEVS<<MdpMinorShift, THIS_MODULE,
5560 md_probe, NULL, NULL); 5553 md_probe, NULL, NULL);
5561 5554
5562 for (minor=0; minor < MAX_MD_DEVS; ++minor)
5563 devfs_mk_bdev(MKDEV(MAJOR_NR, minor),
5564 S_IFBLK|S_IRUSR|S_IWUSR,
5565 "md/%d", minor);
5566
5567 for (minor=0; minor < MAX_MD_DEVS; ++minor)
5568 devfs_mk_bdev(MKDEV(mdp_major, minor<<MdpMinorShift),
5569 S_IFBLK|S_IRUSR|S_IWUSR,
5570 "md/mdp%d", minor);
5571
5572
5573 register_reboot_notifier(&md_notifier); 5555 register_reboot_notifier(&md_notifier);
5574 raid_table_header = register_sysctl_table(raid_root_table, 1); 5556 raid_table_header = register_sysctl_table(raid_root_table, 1);
5575 5557
@@ -5625,15 +5607,9 @@ static __exit void md_exit(void)
5625{ 5607{
5626 mddev_t *mddev; 5608 mddev_t *mddev;
5627 struct list_head *tmp; 5609 struct list_head *tmp;
5628 int i; 5610
5629 blk_unregister_region(MKDEV(MAJOR_NR,0), MAX_MD_DEVS); 5611 blk_unregister_region(MKDEV(MAJOR_NR,0), MAX_MD_DEVS);
5630 blk_unregister_region(MKDEV(mdp_major,0), MAX_MD_DEVS << MdpMinorShift); 5612 blk_unregister_region(MKDEV(mdp_major,0), MAX_MD_DEVS << MdpMinorShift);
5631 for (i=0; i < MAX_MD_DEVS; i++)
5632 devfs_remove("md/%d", i);
5633 for (i=0; i < MAX_MD_DEVS; i++)
5634 devfs_remove("md/d%d", i);
5635
5636 devfs_remove("md");
5637 5613
5638 unregister_blkdev(MAJOR_NR,"md"); 5614 unregister_blkdev(MAJOR_NR,"md");
5639 unregister_blkdev(mdp_major, "mdp"); 5615 unregister_blkdev(mdp_major, "mdp");
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c
index 134c2bbbeeb5..40774feb8953 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -231,10 +231,6 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
231 231
232 mutex_unlock(&dvbdev_register_lock); 232 mutex_unlock(&dvbdev_register_lock);
233 233
234 devfs_mk_cdev(MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)),
235 S_IFCHR | S_IRUSR | S_IWUSR,
236 "dvb/adapter%d/%s%d", adap->num, dnames[type], id);
237
238 class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), 234 class_device_create(dvb_class, NULL, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)),
239 adap->device, "dvb%d.%s%d", adap->num, dnames[type], id); 235 adap->device, "dvb%d.%s%d", adap->num, dnames[type], id);
240 236
@@ -252,9 +248,6 @@ void dvb_unregister_device(struct dvb_device *dvbdev)
252 if (!dvbdev) 248 if (!dvbdev)
253 return; 249 return;
254 250
255 devfs_remove("dvb/adapter%d/%s%d", dvbdev->adapter->num,
256 dnames[dvbdev->type], dvbdev->id);
257
258 class_device_destroy(dvb_class, MKDEV(DVB_MAJOR, nums2minor(dvbdev->adapter->num, 251 class_device_destroy(dvb_class, MKDEV(DVB_MAJOR, nums2minor(dvbdev->adapter->num,
259 dvbdev->type, dvbdev->id))); 252 dvbdev->type, dvbdev->id)));
260 253
@@ -302,7 +295,6 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu
302 295
303 printk ("DVB: registering new adapter (%s).\n", name); 296 printk ("DVB: registering new adapter (%s).\n", name);
304 297
305 devfs_mk_dir("dvb/adapter%d", num);
306 adap->num = num; 298 adap->num = num;
307 adap->name = name; 299 adap->name = name;
308 adap->module = module; 300 adap->module = module;
@@ -319,8 +311,6 @@ EXPORT_SYMBOL(dvb_register_adapter);
319 311
320int dvb_unregister_adapter(struct dvb_adapter *adap) 312int dvb_unregister_adapter(struct dvb_adapter *adap)
321{ 313{
322 devfs_remove("dvb/adapter%d", adap->num);
323
324 if (mutex_lock_interruptible(&dvbdev_register_lock)) 314 if (mutex_lock_interruptible(&dvbdev_register_lock))
325 return -ERESTARTSYS; 315 return -ERESTARTSYS;
326 list_del (&adap->list_head); 316 list_del (&adap->list_head);
@@ -410,8 +400,6 @@ static int __init init_dvbdev(void)
410 goto error; 400 goto error;
411 } 401 }
412 402
413 devfs_mk_dir("dvb");
414
415 dvb_class = class_create(THIS_MODULE, "dvb"); 403 dvb_class = class_create(THIS_MODULE, "dvb");
416 if (IS_ERR(dvb_class)) { 404 if (IS_ERR(dvb_class)) {
417 retval = PTR_ERR(dvb_class); 405 retval = PTR_ERR(dvb_class);
@@ -428,7 +416,6 @@ error:
428 416
429static void __exit exit_dvbdev(void) 417static void __exit exit_dvbdev(void)
430{ 418{
431 devfs_remove("dvb");
432 class_destroy(dvb_class); 419 class_destroy(dvb_class);
433 cdev_del(&dvb_device_cdev); 420 cdev_del(&dvb_device_cdev);
434 unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS); 421 unregister_chrdev_region(MKDEV(DVB_MAJOR, 0), MAX_DVB_MINORS);
diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h
index d7a976d040d7..7a7f75fd168c 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.h
+++ b/drivers/media/dvb/dvb-core/dvbdev.h
@@ -27,7 +27,6 @@
27#include <linux/poll.h> 27#include <linux/poll.h>
28#include <linux/fs.h> 28#include <linux/fs.h>
29#include <linux/list.h> 29#include <linux/list.h>
30#include <linux/devfs_fs_kernel.h>
31#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
32 31
33#define DVB_MAJOR 212 32#define DVB_MAJOR 212
diff --git a/drivers/media/dvb/ttpci/av7110.h b/drivers/media/dvb/ttpci/av7110.h
index 3e2e12124bae..9c79696da08a 100644
--- a/drivers/media/dvb/ttpci/av7110.h
+++ b/drivers/media/dvb/ttpci/av7110.h
@@ -6,10 +6,6 @@
6#include <linux/netdevice.h> 6#include <linux/netdevice.h>
7#include <linux/i2c.h> 7#include <linux/i2c.h>
8 8
9#ifdef CONFIG_DEVFS_FS
10#include <linux/devfs_fs_kernel.h>
11#endif
12
13#include <linux/dvb/video.h> 9#include <linux/dvb/video.h>
14#include <linux/dvb/audio.h> 10#include <linux/dvb/audio.h>
15#include <linux/dvb/dmx.h> 11#include <linux/dvb/dmx.h>
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
index 14559ef6153c..336b2fe1a5f2 100644
--- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -126,10 +126,6 @@ struct ttusb {
126 126
127 int revision; 127 int revision;
128 128
129#if 0
130 devfs_handle_t stc_devfs_handle;
131#endif
132
133 struct dvb_frontend* fe; 129 struct dvb_frontend* fe;
134}; 130};
135 131
@@ -1746,13 +1742,6 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i
1746 return -ENODEV; 1742 return -ENODEV;
1747 } 1743 }
1748 1744
1749#if 0
1750 ttusb->stc_devfs_handle =
1751 devfs_register(ttusb->adapter->devfs_handle, TTUSB_BUDGET_NAME,
1752 DEVFS_FL_DEFAULT, 0, 192,
1753 S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
1754 | S_IROTH | S_IWOTH, &stc_fops, ttusb);
1755#endif
1756 usb_set_intfdata(intf, (void *) ttusb); 1745 usb_set_intfdata(intf, (void *) ttusb);
1757 1746
1758 frontend_init(ttusb); 1747 frontend_init(ttusb);
diff --git a/drivers/media/radio/miropcm20-rds.c b/drivers/media/radio/miropcm20-rds.c
index 87b37b7691da..c1b1db65e668 100644
--- a/drivers/media/radio/miropcm20-rds.c
+++ b/drivers/media/radio/miropcm20-rds.c
@@ -115,7 +115,6 @@ static struct file_operations rds_fops = {
115static struct miscdevice rds_miscdev = { 115static struct miscdevice rds_miscdev = {
116 .minor = MISC_DYNAMIC_MINOR, 116 .minor = MISC_DYNAMIC_MINOR,
117 .name = "radiotext", 117 .name = "radiotext",
118 .devfs_name = "v4l/rds/radiotext",
119 .fops = &rds_fops, 118 .fops = &rds_fops,
120}; 119};
121 120
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c
index 6e08e32346eb..ae14f5f32039 100644
--- a/drivers/media/video/arv.c
+++ b/drivers/media/video/arv.c
@@ -20,7 +20,6 @@
20 20
21#include <linux/config.h> 21#include <linux/config.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/devfs_fs_kernel.h>
24#include <linux/module.h> 23#include <linux/module.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
26#include <linux/errno.h> 25#include <linux/errno.h>
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index 2dfa7f23d0ca..b26ebaff226f 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -37,7 +37,6 @@
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/kmod.h> 38#include <linux/kmod.h>
39#include <linux/slab.h> 39#include <linux/slab.h>
40#include <linux/devfs_fs_kernel.h>
41#include <asm/uaccess.h> 40#include <asm/uaccess.h>
42#include <asm/system.h> 41#include <asm/system.h>
43 42
@@ -1563,10 +1562,6 @@ int video_register_device(struct video_device *vfd, int type, int nr)
1563 video_device[i]=vfd; 1562 video_device[i]=vfd;
1564 vfd->minor=i; 1563 vfd->minor=i;
1565 mutex_unlock(&videodev_lock); 1564 mutex_unlock(&videodev_lock);
1566
1567 sprintf(vfd->devfs_name, "v4l/%s%d", name_base, i - base);
1568 devfs_mk_cdev(MKDEV(VIDEO_MAJOR, vfd->minor),
1569 S_IFCHR | S_IRUSR | S_IWUSR, vfd->devfs_name);
1570 mutex_init(&vfd->lock); 1565 mutex_init(&vfd->lock);
1571 1566
1572 /* sysfs class */ 1567 /* sysfs class */
@@ -1575,7 +1570,7 @@ int video_register_device(struct video_device *vfd, int type, int nr)
1575 vfd->class_dev.dev = vfd->dev; 1570 vfd->class_dev.dev = vfd->dev;
1576 vfd->class_dev.class = &video_class; 1571 vfd->class_dev.class = &video_class;
1577 vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); 1572 vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
1578 strlcpy(vfd->class_dev.class_id, vfd->devfs_name + 4, BUS_ID_SIZE); 1573 sprintf(vfd->class_dev.class_id, "%s%d", name_base, i - base);
1579 class_device_register(&vfd->class_dev); 1574 class_device_register(&vfd->class_dev);
1580 class_device_create_file(&vfd->class_dev, 1575 class_device_create_file(&vfd->class_dev,
1581 &class_device_attr_name); 1576 &class_device_attr_name);
@@ -1604,7 +1599,6 @@ void video_unregister_device(struct video_device *vfd)
1604 if(video_device[vfd->minor]!=vfd) 1599 if(video_device[vfd->minor]!=vfd)
1605 panic("videodev: bad unregister"); 1600 panic("videodev: bad unregister");
1606 1601
1607 devfs_remove(vfd->devfs_name);
1608 video_device[vfd->minor]=NULL; 1602 video_device[vfd->minor]=NULL;
1609 class_device_unregister(&vfd->class_dev); 1603 class_device_unregister(&vfd->class_dev);
1610 mutex_unlock(&videodev_lock); 1604 mutex_unlock(&videodev_lock);
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c
index 7d4c5497785b..1ddc2fb429d5 100644
--- a/drivers/message/i2o/i2o_block.c
+++ b/drivers/message/i2o/i2o_block.c
@@ -1089,7 +1089,6 @@ static int i2o_block_probe(struct device *dev)
1089 gd = i2o_blk_dev->gd; 1089 gd = i2o_blk_dev->gd;
1090 gd->first_minor = unit << 4; 1090 gd->first_minor = unit << 4;
1091 sprintf(gd->disk_name, "i2o/hd%c", 'a' + unit); 1091 sprintf(gd->disk_name, "i2o/hd%c", 'a' + unit);
1092 sprintf(gd->devfs_name, "i2o/hd%c", 'a' + unit);
1093 gd->driverfs_dev = &i2o_dev->device; 1092 gd->driverfs_dev = &i2o_dev->device;
1094 1093
1095 /* setup request queue */ 1094 /* setup request queue */
diff --git a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c
index 587458b370b9..115cc21094b9 100644
--- a/drivers/mmc/mmc_block.c
+++ b/drivers/mmc/mmc_block.c
@@ -27,7 +27,6 @@
27#include <linux/hdreg.h> 27#include <linux/hdreg.h>
28#include <linux/kdev_t.h> 28#include <linux/kdev_t.h>
29#include <linux/blkdev.h> 29#include <linux/blkdev.h>
30#include <linux/devfs_fs_kernel.h>
31#include <linux/mutex.h> 30#include <linux/mutex.h>
32 31
33#include <linux/mmc/card.h> 32#include <linux/mmc/card.h>
@@ -409,7 +408,6 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
409 */ 408 */
410 409
411 sprintf(md->disk->disk_name, "mmcblk%d", devidx); 410 sprintf(md->disk->disk_name, "mmcblk%d", devidx);
412 sprintf(md->disk->devfs_name, "mmc/blk%d", devidx);
413 411
414 blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits); 412 blk_queue_hardsect_size(md->queue.queue, 1 << md->block_bits);
415 413
@@ -555,7 +553,6 @@ static int __init mmc_blk_init(void)
555 if (major == 0) 553 if (major == 0)
556 major = res; 554 major = res;
557 555
558 devfs_mk_dir("mmc");
559 return mmc_register_driver(&mmc_driver); 556 return mmc_register_driver(&mmc_driver);
560 557
561 out: 558 out:
@@ -565,7 +562,6 @@ static int __init mmc_blk_init(void)
565static void __exit mmc_blk_exit(void) 562static void __exit mmc_blk_exit(void)
566{ 563{
567 mmc_unregister_driver(&mmc_driver); 564 mmc_unregister_driver(&mmc_driver);
568 devfs_remove("mmc");
569 unregister_blkdev(major, "mmc"); 565 unregister_blkdev(major, "mmc");
570} 566}
571 567
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index d643a097faa5..425ff5b117f1 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -28,7 +28,6 @@
28#include <linux/kmod.h> 28#include <linux/kmod.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/list.h> 30#include <linux/list.h>
31#include <linux/devfs_fs_kernel.h>
32#include <linux/netdevice.h> 31#include <linux/netdevice.h>
33#include <linux/poll.h> 32#include <linux/poll.h>
34#include <linux/ppp_defs.h> 33#include <linux/ppp_defs.h>
@@ -863,10 +862,6 @@ static int __init ppp_init(void)
863 goto out_chrdev; 862 goto out_chrdev;
864 } 863 }
865 class_device_create(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), NULL, "ppp"); 864 class_device_create(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), NULL, "ppp");
866 err = devfs_mk_cdev(MKDEV(PPP_MAJOR, 0),
867 S_IFCHR|S_IRUSR|S_IWUSR, "ppp");
868 if (err)
869 goto out_class;
870 } 865 }
871 866
872out: 867out:
@@ -874,9 +869,6 @@ out:
874 printk(KERN_ERR "failed to register PPP device (%d)\n", err); 869 printk(KERN_ERR "failed to register PPP device (%d)\n", err);
875 return err; 870 return err;
876 871
877out_class:
878 class_device_destroy(ppp_class, MKDEV(PPP_MAJOR,0));
879 class_destroy(ppp_class);
880out_chrdev: 872out_chrdev:
881 unregister_chrdev(PPP_MAJOR, "ppp"); 873 unregister_chrdev(PPP_MAJOR, "ppp");
882 goto out; 874 goto out;
@@ -2681,7 +2673,6 @@ static void __exit ppp_cleanup(void)
2681 cardmap_destroy(&all_ppp_units); 2673 cardmap_destroy(&all_ppp_units);
2682 if (unregister_chrdev(PPP_MAJOR, "ppp") != 0) 2674 if (unregister_chrdev(PPP_MAJOR, "ppp") != 0)
2683 printk(KERN_ERR "PPP: failed to unregister PPP device\n"); 2675 printk(KERN_ERR "PPP: failed to unregister PPP device\n");
2684 devfs_remove("ppp");
2685 class_device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0)); 2676 class_device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0));
2686 class_destroy(ppp_class); 2677 class_destroy(ppp_class);
2687} 2678}
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 6c62d5c88268..732c5edec2e5 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -780,7 +780,6 @@ static struct miscdevice tun_miscdev = {
780 .minor = TUN_MINOR, 780 .minor = TUN_MINOR,
781 .name = "tun", 781 .name = "tun",
782 .fops = &tun_fops, 782 .fops = &tun_fops,
783 .devfs_name = "net/tun",
784}; 783};
785 784
786/* ethtool interface */ 785/* ethtool interface */
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index e392ee8b37a1..be5e33814cb1 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -85,7 +85,6 @@
85#include <linux/slab.h> 85#include <linux/slab.h>
86#include <linux/poll.h> 86#include <linux/poll.h>
87#include <linux/fs.h> 87#include <linux/fs.h>
88#include <linux/devfs_fs_kernel.h>
89#include <linux/interrupt.h> 88#include <linux/interrupt.h>
90#include <linux/delay.h> 89#include <linux/delay.h>
91#include <linux/errno.h> 90#include <linux/errno.h>
@@ -393,7 +392,6 @@ static int __init cosa_init(void)
393 err = -ENODEV; 392 err = -ENODEV;
394 goto out; 393 goto out;
395 } 394 }
396 devfs_mk_dir("cosa");
397 cosa_class = class_create(THIS_MODULE, "cosa"); 395 cosa_class = class_create(THIS_MODULE, "cosa");
398 if (IS_ERR(cosa_class)) { 396 if (IS_ERR(cosa_class)) {
399 err = PTR_ERR(cosa_class); 397 err = PTR_ERR(cosa_class);
@@ -402,13 +400,6 @@ static int __init cosa_init(void)
402 for (i=0; i<nr_cards; i++) { 400 for (i=0; i<nr_cards; i++) {
403 class_device_create(cosa_class, NULL, MKDEV(cosa_major, i), 401 class_device_create(cosa_class, NULL, MKDEV(cosa_major, i),
404 NULL, "cosa%d", i); 402 NULL, "cosa%d", i);
405 err = devfs_mk_cdev(MKDEV(cosa_major, i),
406 S_IFCHR|S_IRUSR|S_IWUSR,
407 "cosa/%d", i);
408 if (err) {
409 class_device_destroy(cosa_class, MKDEV(cosa_major, i));
410 goto out_chrdev;
411 }
412 } 403 }
413 err = 0; 404 err = 0;
414 goto out; 405 goto out;
@@ -426,12 +417,9 @@ static void __exit cosa_exit(void)
426 int i; 417 int i;
427 printk(KERN_INFO "Unloading the cosa module\n"); 418 printk(KERN_INFO "Unloading the cosa module\n");
428 419
429 for (i=0; i<nr_cards; i++) { 420 for (i=0; i<nr_cards; i++)
430 class_device_destroy(cosa_class, MKDEV(cosa_major, i)); 421 class_device_destroy(cosa_class, MKDEV(cosa_major, i));
431 devfs_remove("cosa/%d", i);
432 }
433 class_destroy(cosa_class); 422 class_destroy(cosa_class);
434 devfs_remove("cosa");
435 for (cosa=cosa_cards; nr_cards--; cosa++) { 423 for (cosa=cosa_cards; nr_cards--; cosa++) {
436 /* Clean up the per-channel data */ 424 /* Clean up the per-channel data */
437 for (i=0; i<cosa->nchannels; i++) { 425 for (i=0; i<cosa->nchannels; i++) {
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index bafcd2f20ae2..2dc179b14ce6 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1834,7 +1834,6 @@ dasd_exit(void)
1834 } 1834 }
1835 dasd_gendisk_exit(); 1835 dasd_gendisk_exit();
1836 dasd_devmap_exit(); 1836 dasd_devmap_exit();
1837 devfs_remove("dasd");
1838 if (dasd_debug_area != NULL) { 1837 if (dasd_debug_area != NULL) {
1839 debug_unregister(dasd_debug_area); 1838 debug_unregister(dasd_debug_area);
1840 dasd_debug_area = NULL; 1839 dasd_debug_area = NULL;
@@ -2107,9 +2106,6 @@ dasd_init(void)
2107 2106
2108 dasd_diag_discipline_pointer = NULL; 2107 dasd_diag_discipline_pointer = NULL;
2109 2108
2110 rc = devfs_mk_dir("dasd");
2111 if (rc)
2112 goto failed;
2113 rc = dasd_devmap_init(); 2109 rc = dasd_devmap_init();
2114 if (rc) 2110 if (rc)
2115 goto failed; 2111 goto failed;
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c
index fce2835e7d19..61ffde718a7a 100644
--- a/drivers/s390/block/dasd_genhd.c
+++ b/drivers/s390/block/dasd_genhd.c
@@ -68,8 +68,6 @@ dasd_gendisk_alloc(struct dasd_device *device)
68 } 68 }
69 len += sprintf(gdp->disk_name + len, "%c", 'a'+(device->devindex%26)); 69 len += sprintf(gdp->disk_name + len, "%c", 'a'+(device->devindex%26));
70 70
71 sprintf(gdp->devfs_name, "dasd/%s", device->cdev->dev.bus_id);
72
73 if (device->features & DASD_FEATURE_READONLY) 71 if (device->features & DASD_FEATURE_READONLY)
74 set_disk_ro(gdp, 1); 72 set_disk_ro(gdp, 1);
75 gdp->private_data = device; 73 gdp->private_data = device;
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h
index 03a83efc34c4..3ccf06d28ba1 100644
--- a/drivers/s390/block/dasd_int.h
+++ b/drivers/s390/block/dasd_int.h
@@ -54,7 +54,6 @@
54#include <linux/module.h> 54#include <linux/module.h>
55#include <linux/wait.h> 55#include <linux/wait.h>
56#include <linux/blkdev.h> 56#include <linux/blkdev.h>
57#include <linux/devfs_fs_kernel.h>
58#include <linux/genhd.h> 57#include <linux/genhd.h>
59#include <linux/hdreg.h> 58#include <linux/hdreg.h>
60#include <linux/interrupt.h> 59#include <linux/interrupt.h>
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index 54ecd548c318..4c1e56b9b98d 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -36,7 +36,6 @@
36#include <linux/hdreg.h> /* HDIO_GETGEO */ 36#include <linux/hdreg.h> /* HDIO_GETGEO */
37#include <linux/sysdev.h> 37#include <linux/sysdev.h>
38#include <linux/bio.h> 38#include <linux/bio.h>
39#include <linux/devfs_fs_kernel.h>
40#include <asm/uaccess.h> 39#include <asm/uaccess.h>
41 40
42#define XPRAM_NAME "xpram" 41#define XPRAM_NAME "xpram"
@@ -439,8 +438,6 @@ static int __init xpram_setup_blkdev(void)
439 if (rc < 0) 438 if (rc < 0)
440 goto out; 439 goto out;
441 440
442 devfs_mk_dir("slram");
443
444 /* 441 /*
445 * Assign the other needed values: make request function, sizes and 442 * Assign the other needed values: make request function, sizes and
446 * hardsect size. All the minor devices feature the same value. 443 * hardsect size. All the minor devices feature the same value.
@@ -469,14 +466,12 @@ static int __init xpram_setup_blkdev(void)
469 disk->private_data = &xpram_devices[i]; 466 disk->private_data = &xpram_devices[i];
470 disk->queue = xpram_queue; 467 disk->queue = xpram_queue;
471 sprintf(disk->disk_name, "slram%d", i); 468 sprintf(disk->disk_name, "slram%d", i);
472 sprintf(disk->devfs_name, "slram/%d", i);
473 set_capacity(disk, xpram_sizes[i] << 1); 469 set_capacity(disk, xpram_sizes[i] << 1);
474 add_disk(disk); 470 add_disk(disk);
475 } 471 }
476 472
477 return 0; 473 return 0;
478out_unreg: 474out_unreg:
479 devfs_remove("slram");
480 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME); 475 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME);
481out: 476out:
482 while (i--) 477 while (i--)
@@ -495,7 +490,6 @@ static void __exit xpram_exit(void)
495 put_disk(xpram_disks[i]); 490 put_disk(xpram_disks[i]);
496 } 491 }
497 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME); 492 unregister_blkdev(XPRAM_MAJOR, XPRAM_NAME);
498 devfs_remove("slram");
499 blk_cleanup_queue(xpram_queue); 493 blk_cleanup_queue(xpram_queue);
500 sysdev_unregister(&xpram_sys_device); 494 sysdev_unregister(&xpram_sys_device);
501 sysdev_class_unregister(&xpram_sysclass); 495 sysdev_class_unregister(&xpram_sysclass);
diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c
index fb7bc9e5eebc..a138b1510093 100644
--- a/drivers/s390/char/monreader.c
+++ b/drivers/s390/char/monreader.c
@@ -586,7 +586,6 @@ static struct file_operations mon_fops = {
586 586
587static struct miscdevice mon_dev = { 587static struct miscdevice mon_dev = {
588 .name = "monreader", 588 .name = "monreader",
589 .devfs_name = "monreader",
590 .fops = &mon_fops, 589 .fops = &mon_fops,
591 .minor = MISC_DYNAMIC_MINOR, 590 .minor = MISC_DYNAMIC_MINOR,
592}; 591};
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c
index 9a141776873f..7d26a3e4cb80 100644
--- a/drivers/s390/char/tty3270.c
+++ b/drivers/s390/char/tty3270.c
@@ -1785,7 +1785,6 @@ tty3270_init(void)
1785 * proc_entry, set_termios, flush_buffer, set_ldisc, write_proc 1785 * proc_entry, set_termios, flush_buffer, set_ldisc, write_proc
1786 */ 1786 */
1787 driver->owner = THIS_MODULE; 1787 driver->owner = THIS_MODULE;
1788 driver->devfs_name = "ttyTUB/";
1789 driver->driver_name = "ttyTUB"; 1788 driver->driver_name = "ttyTUB";
1790 driver->name = "ttyTUB"; 1789 driver->name = "ttyTUB";
1791 driver->major = IBM_TTY3270_MAJOR; 1790 driver->major = IBM_TTY3270_MAJOR;
@@ -1793,7 +1792,7 @@ tty3270_init(void)
1793 driver->type = TTY_DRIVER_TYPE_SYSTEM; 1792 driver->type = TTY_DRIVER_TYPE_SYSTEM;
1794 driver->subtype = SYSTEM_TYPE_TTY; 1793 driver->subtype = SYSTEM_TYPE_TTY;
1795 driver->init_termios = tty_std_termios; 1794 driver->init_termios = tty_std_termios;
1796 driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_NO_DEVFS; 1795 driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_DYNAMIC_DEV;
1797 tty_set_operations(driver, &tty3270_ops); 1796 tty_set_operations(driver, &tty3270_ops);
1798 ret = tty_register_driver(driver); 1797 ret = tty_register_driver(driver);
1799 if (ret) { 1798 if (ret) {
diff --git a/drivers/s390/crypto/z90main.c b/drivers/s390/crypto/z90main.c
index 982acc7303ea..b2f20ab8431a 100644
--- a/drivers/s390/crypto/z90main.c
+++ b/drivers/s390/crypto/z90main.c
@@ -411,7 +411,6 @@ static struct miscdevice z90crypt_misc_device = {
411 .minor = Z90CRYPT_MINOR, 411 .minor = Z90CRYPT_MINOR,
412 .name = DEV_NAME, 412 .name = DEV_NAME,
413 .fops = &z90crypt_fops, 413 .fops = &z90crypt_fops,
414 .devfs_name = DEV_NAME
415}; 414};
416 415
417/** 416/**
diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c
index ccb20a6f5f36..385f4f768311 100644
--- a/drivers/sbus/char/bpp.c
+++ b/drivers/sbus/char/bpp.c
@@ -20,7 +20,6 @@
20#include <linux/timer.h> 20#include <linux/timer.h>
21#include <linux/ioport.h> 21#include <linux/ioport.h>
22#include <linux/major.h> 22#include <linux/major.h>
23#include <linux/devfs_fs_kernel.h>
24 23
25#include <asm/uaccess.h> 24#include <asm/uaccess.h>
26#include <asm/io.h> 25#include <asm/io.h>
@@ -1031,11 +1030,6 @@ static int __init bpp_init(void)
1031 instances[idx].opened = 0; 1030 instances[idx].opened = 0;
1032 probeLptPort(idx); 1031 probeLptPort(idx);
1033 } 1032 }
1034 devfs_mk_dir("bpp");
1035 for (idx = 0; idx < BPP_NO; idx++) {
1036 devfs_mk_cdev(MKDEV(BPP_MAJOR, idx),
1037 S_IFCHR | S_IRUSR | S_IWUSR, "bpp/%d", idx);
1038 }
1039 1033
1040 return 0; 1034 return 0;
1041} 1035}
@@ -1044,9 +1038,6 @@ static void __exit bpp_cleanup(void)
1044{ 1038{
1045 unsigned idx; 1039 unsigned idx;
1046 1040
1047 for (idx = 0; idx < BPP_NO; idx++)
1048 devfs_remove("bpp/%d", idx);
1049 devfs_remove("bpp");
1050 unregister_chrdev(BPP_MAJOR, dev_name); 1041 unregister_chrdev(BPP_MAJOR, dev_name);
1051 1042
1052 for (idx = 0; idx < BPP_NO; idx++) { 1043 for (idx = 0; idx < BPP_NO; idx++) {
diff --git a/drivers/sbus/char/vfc.h b/drivers/sbus/char/vfc.h
index 8045cd5e7cb3..63941a259b92 100644
--- a/drivers/sbus/char/vfc.h
+++ b/drivers/sbus/char/vfc.h
@@ -1,8 +1,6 @@
1#ifndef _LINUX_VFC_H_ 1#ifndef _LINUX_VFC_H_
2#define _LINUX_VFC_H_ 2#define _LINUX_VFC_H_
3 3
4#include <linux/devfs_fs_kernel.h>
5
6/* 4/*
7 * The control register for the vfc is at offset 0x4000 5 * The control register for the vfc is at offset 0x4000
8 * The first field ram bank is located at offset 0x5000 6 * The first field ram bank is located at offset 0x5000
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
index ddcd330b9e89..55b2b31bd7ab 100644
--- a/drivers/sbus/char/vfc_dev.c
+++ b/drivers/sbus/char/vfc_dev.c
@@ -164,10 +164,6 @@ int init_vfc_device(struct sbus_dev *sdev,struct vfc_dev *dev, int instance)
164 return -EINVAL; 164 return -EINVAL;
165 if (init_vfc_hw(dev)) 165 if (init_vfc_hw(dev))
166 return -EIO; 166 return -EIO;
167
168 devfs_mk_cdev(MKDEV(VFC_MAJOR, instance),
169 S_IFCHR | S_IRUSR | S_IWUSR,
170 "vfc/%d", instance);
171 return 0; 167 return 0;
172} 168}
173 169
@@ -677,7 +673,6 @@ static int vfc_probe(void)
677 kfree(vfc_dev_lst); 673 kfree(vfc_dev_lst);
678 return -EIO; 674 return -EIO;
679 } 675 }
680 devfs_mk_dir("vfc");
681 instance = 0; 676 instance = 0;
682 for_all_sbusdev(sdev, sbus) { 677 for_all_sbusdev(sdev, sbus) {
683 if (strcmp(sdev->prom_name, "vfc") == 0) { 678 if (strcmp(sdev->prom_name, "vfc") == 0) {
@@ -717,7 +712,6 @@ static void deinit_vfc_device(struct vfc_dev *dev)
717{ 712{
718 if(dev == NULL) 713 if(dev == NULL)
719 return; 714 return;
720 devfs_remove("vfc/%d", dev->instance);
721 sbus_iounmap(dev->regs, sizeof(struct vfc_regs)); 715 sbus_iounmap(dev->regs, sizeof(struct vfc_regs));
722 kfree(dev); 716 kfree(dev);
723} 717}
@@ -731,7 +725,6 @@ void cleanup_module(void)
731 for (devp = vfc_dev_lst; *devp; devp++) 725 for (devp = vfc_dev_lst; *devp; devp++)
732 deinit_vfc_device(*devp); 726 deinit_vfc_device(*devp);
733 727
734 devfs_remove("vfc");
735 kfree(vfc_dev_lst); 728 kfree(vfc_dev_lst);
736 return; 729 return;
737} 730}
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c
index 7572665a8855..9fd0de4b7afd 100644
--- a/drivers/serial/21285.c
+++ b/drivers/serial/21285.c
@@ -479,7 +479,6 @@ static struct uart_driver serial21285_reg = {
479 .owner = THIS_MODULE, 479 .owner = THIS_MODULE,
480 .driver_name = "ttyFB", 480 .driver_name = "ttyFB",
481 .dev_name = "ttyFB", 481 .dev_name = "ttyFB",
482 .devfs_name = "ttyFB",
483 .major = SERIAL_21285_MAJOR, 482 .major = SERIAL_21285_MAJOR,
484 .minor = SERIAL_21285_MINOR, 483 .minor = SERIAL_21285_MINOR,
485 .nr = 1, 484 .nr = 1,
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index bbf78aaf9e01..f361b356bd1d 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2354,7 +2354,6 @@ int __init serial8250_start_console(struct uart_port *port, char *options)
2354static struct uart_driver serial8250_reg = { 2354static struct uart_driver serial8250_reg = {
2355 .owner = THIS_MODULE, 2355 .owner = THIS_MODULE,
2356 .driver_name = "serial", 2356 .driver_name = "serial",
2357 .devfs_name = "tts/",
2358 .dev_name = "ttyS", 2357 .dev_name = "ttyS",
2359 .major = TTY_MAJOR, 2358 .major = TTY_MAJOR,
2360 .minor = 64, 2359 .minor = 64,
diff --git a/drivers/serial/at91_serial.c b/drivers/serial/at91_serial.c
index db5b25fafed4..df9500bdaded 100644
--- a/drivers/serial/at91_serial.c
+++ b/drivers/serial/at91_serial.c
@@ -863,7 +863,6 @@ static struct uart_driver at91_uart = {
863 .owner = THIS_MODULE, 863 .owner = THIS_MODULE,
864 .driver_name = "at91_serial", 864 .driver_name = "at91_serial",
865 .dev_name = AT91_DEVICENAME, 865 .dev_name = AT91_DEVICENAME,
866 .devfs_name = AT91_DEVICENAME,
867 .major = SERIAL_AT91_MAJOR, 866 .major = SERIAL_AT91_MAJOR,
868 .minor = MINOR_START, 867 .minor = MINOR_START,
869 .nr = AT91_NR_UART, 868 .nr = AT91_NR_UART,
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index 5cacc5e74a92..b84137cdeb2b 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -4878,7 +4878,7 @@ rs_init(void)
4878 driver->init_termios = tty_std_termios; 4878 driver->init_termios = tty_std_termios;
4879 driver->init_termios.c_cflag = 4879 driver->init_termios.c_cflag =
4880 B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */ 4880 B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */
4881 driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; 4881 driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
4882 driver->termios = serial_termios; 4882 driver->termios = serial_termios;
4883 driver->termios_locked = serial_termios_locked; 4883 driver->termios_locked = serial_termios_locked;
4884 4884
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c
index bf71bad5c34f..466d06cc7d37 100644
--- a/drivers/serial/dz.c
+++ b/drivers/serial/dz.c
@@ -768,11 +768,7 @@ void __init dz_serial_console_init(void)
768static struct uart_driver dz_reg = { 768static struct uart_driver dz_reg = {
769 .owner = THIS_MODULE, 769 .owner = THIS_MODULE,
770 .driver_name = "serial", 770 .driver_name = "serial",
771#ifdef CONFIG_DEVFS
772 .dev_name = "tts/%d",
773#else
774 .dev_name = "ttyS%d", 771 .dev_name = "ttyS%d",
775#endif
776 .major = TTY_MAJOR, 772 .major = TTY_MAJOR,
777 .minor = 64, 773 .minor = 64,
778 .nr = DZ_NB_PORT, 774 .nr = DZ_NB_PORT,
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index d202eb4f3848..da85bafa0942 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -888,7 +888,6 @@ static struct uart_driver imx_reg = {
888 .owner = THIS_MODULE, 888 .owner = THIS_MODULE,
889 .driver_name = DRIVER_NAME, 889 .driver_name = DRIVER_NAME,
890 .dev_name = "ttySMX", 890 .dev_name = "ttySMX",
891 .devfs_name = "ttsmx/",
892 .major = SERIAL_IMX_MAJOR, 891 .major = SERIAL_IMX_MAJOR,
893 .minor = MINOR_START, 892 .minor = MINOR_START,
894 .nr = ARRAY_SIZE(imx_ports), 893 .nr = ARRAY_SIZE(imx_ports),
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c
index 651772474ac1..56b093ecd779 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/serial/ip22zilog.c
@@ -1085,7 +1085,6 @@ static struct console ip22zilog_console = {
1085static struct uart_driver ip22zilog_reg = { 1085static struct uart_driver ip22zilog_reg = {
1086 .owner = THIS_MODULE, 1086 .owner = THIS_MODULE,
1087 .driver_name = "serial", 1087 .driver_name = "serial",
1088 .devfs_name = "tts/",
1089 .dev_name = "ttyS", 1088 .dev_name = "ttyS",
1090 .major = TTY_MAJOR, 1089 .major = TTY_MAJOR,
1091 .minor = 64, 1090 .minor = 64,
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
index 321a40f33b50..6a2a25d9b596 100644
--- a/drivers/serial/m32r_sio.c
+++ b/drivers/serial/m32r_sio.c
@@ -1131,7 +1131,6 @@ console_initcall(m32r_sio_console_init);
1131static struct uart_driver m32r_sio_reg = { 1131static struct uart_driver m32r_sio_reg = {
1132 .owner = THIS_MODULE, 1132 .owner = THIS_MODULE,
1133 .driver_name = "sio", 1133 .driver_name = "sio",
1134 .devfs_name = "tts/",
1135 .dev_name = "ttyS", 1134 .dev_name = "ttyS",
1136 .major = TTY_MAJOR, 1135 .major = TTY_MAJOR,
1137 .minor = 64, 1136 .minor = 64,
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c
index 8ad242934368..29c0630e3e64 100644
--- a/drivers/serial/mcfserial.c
+++ b/drivers/serial/mcfserial.c
@@ -1713,7 +1713,6 @@ mcfrs_init(void)
1713 /* Initialize the tty_driver structure */ 1713 /* Initialize the tty_driver structure */
1714 mcfrs_serial_driver->owner = THIS_MODULE; 1714 mcfrs_serial_driver->owner = THIS_MODULE;
1715 mcfrs_serial_driver->name = "ttyS"; 1715 mcfrs_serial_driver->name = "ttyS";
1716 mcfrs_serial_driver->devfs_name = "ttys/";
1717 mcfrs_serial_driver->driver_name = "serial"; 1716 mcfrs_serial_driver->driver_name = "serial";
1718 mcfrs_serial_driver->major = TTY_MAJOR; 1717 mcfrs_serial_driver->major = TTY_MAJOR;
1719 mcfrs_serial_driver->minor_start = 64; 1718 mcfrs_serial_driver->minor_start = 64;
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 6459edc7f5c5..1aa34844218c 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -693,7 +693,6 @@ static struct uart_driver mpc52xx_uart_driver = {
693 .owner = THIS_MODULE, 693 .owner = THIS_MODULE,
694 .driver_name = "mpc52xx_psc_uart", 694 .driver_name = "mpc52xx_psc_uart",
695 .dev_name = "ttyPSC", 695 .dev_name = "ttyPSC",
696 .devfs_name = "ttyPSC",
697 .major = SERIAL_PSC_MAJOR, 696 .major = SERIAL_PSC_MAJOR,
698 .minor = SERIAL_PSC_MINOR, 697 .minor = SERIAL_PSC_MINOR,
699 .nr = MPC52xx_PSC_MAXNUM, 698 .nr = MPC52xx_PSC_MAXNUM,
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index 94681922ea0a..1cd102f84bfa 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -315,7 +315,6 @@ struct mpsc_port_info *mpsc_device_remove(int index);
315#define MPSC_MAJOR 204 315#define MPSC_MAJOR 204
316#define MPSC_MINOR_START 44 316#define MPSC_MINOR_START 44
317#define MPSC_DRIVER_NAME "MPSC" 317#define MPSC_DRIVER_NAME "MPSC"
318#define MPSC_DEVFS_NAME "ttymm/"
319#define MPSC_DEV_NAME "ttyMM" 318#define MPSC_DEV_NAME "ttyMM"
320#define MPSC_VERSION "1.00" 319#define MPSC_VERSION "1.00"
321 320
@@ -1863,7 +1862,6 @@ static struct platform_driver mpsc_shared_driver = {
1863static struct uart_driver mpsc_reg = { 1862static struct uart_driver mpsc_reg = {
1864 .owner = THIS_MODULE, 1863 .owner = THIS_MODULE,
1865 .driver_name = MPSC_DRIVER_NAME, 1864 .driver_name = MPSC_DRIVER_NAME,
1866 .devfs_name = MPSC_DEVFS_NAME,
1867 .dev_name = MPSC_DEV_NAME, 1865 .dev_name = MPSC_DEV_NAME,
1868 .major = MPSC_MAJOR, 1866 .major = MPSC_MAJOR,
1869 .minor = MPSC_MINOR_START, 1867 .minor = MPSC_MINOR_START,
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 513ff8597707..e3ba7e17a240 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -101,7 +101,6 @@ static DEFINE_MUTEX(pmz_irq_mutex);
101static struct uart_driver pmz_uart_reg = { 101static struct uart_driver pmz_uart_reg = {
102 .owner = THIS_MODULE, 102 .owner = THIS_MODULE,
103 .driver_name = "ttyS", 103 .driver_name = "ttyS",
104 .devfs_name = "tts/",
105 .dev_name = "ttyS", 104 .dev_name = "ttyS",
106 .major = TTY_MAJOR, 105 .major = TTY_MAJOR,
107}; 106};
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index ae3649568541..0fa0ccc9ed27 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -780,7 +780,6 @@ static struct uart_pxa_port serial_pxa_ports[] = {
780static struct uart_driver serial_pxa_reg = { 780static struct uart_driver serial_pxa_reg = {
781 .owner = THIS_MODULE, 781 .owner = THIS_MODULE,
782 .driver_name = "PXA serial", 782 .driver_name = "PXA serial",
783 .devfs_name = "tts/",
784 .dev_name = "ttyS", 783 .dev_name = "ttyS",
785 .major = TTY_MAJOR, 784 .major = TTY_MAJOR,
786 .minor = 64, 785 .minor = 64,
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 837b6da520b3..4c62ab949ecc 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -149,7 +149,6 @@ s3c24xx_serial_dbg(const char *fmt, ...)
149/* UART name and device definitions */ 149/* UART name and device definitions */
150 150
151#define S3C24XX_SERIAL_NAME "ttySAC" 151#define S3C24XX_SERIAL_NAME "ttySAC"
152#define S3C24XX_SERIAL_DEVFS "tts/"
153#define S3C24XX_SERIAL_MAJOR 204 152#define S3C24XX_SERIAL_MAJOR 204
154#define S3C24XX_SERIAL_MINOR 64 153#define S3C24XX_SERIAL_MINOR 64
155 154
@@ -952,7 +951,6 @@ static struct uart_driver s3c24xx_uart_drv = {
952 .nr = 3, 951 .nr = 3,
953 .cons = S3C24XX_SERIAL_CONSOLE, 952 .cons = S3C24XX_SERIAL_CONSOLE,
954 .driver_name = S3C24XX_SERIAL_NAME, 953 .driver_name = S3C24XX_SERIAL_NAME,
955 .devfs_name = S3C24XX_SERIAL_DEVFS,
956 .major = S3C24XX_SERIAL_MAJOR, 954 .major = S3C24XX_SERIAL_MAJOR,
957 .minor = S3C24XX_SERIAL_MINOR, 955 .minor = S3C24XX_SERIAL_MINOR,
958}; 956};
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index c2d9068b491d..8bbd8567669c 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -816,7 +816,6 @@ static struct uart_driver sa1100_reg = {
816 .owner = THIS_MODULE, 816 .owner = THIS_MODULE,
817 .driver_name = "ttySA", 817 .driver_name = "ttySA",
818 .dev_name = "ttySA", 818 .dev_name = "ttySA",
819 .devfs_name = "ttySA",
820 .major = SERIAL_SA1100_MAJOR, 819 .major = SERIAL_SA1100_MAJOR,
821 .minor = MINOR_START, 820 .minor = MINOR_START,
822 .nr = NR_PORTS, 821 .nr = NR_PORTS,
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 17839e753e4c..7dc1e67b6851 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -2153,7 +2153,6 @@ int uart_register_driver(struct uart_driver *drv)
2153 2153
2154 normal->owner = drv->owner; 2154 normal->owner = drv->owner;
2155 normal->driver_name = drv->driver_name; 2155 normal->driver_name = drv->driver_name;
2156 normal->devfs_name = drv->devfs_name;
2157 normal->name = drv->dev_name; 2156 normal->name = drv->dev_name;
2158 normal->major = drv->major; 2157 normal->major = drv->major;
2159 normal->minor_start = drv->minor; 2158 normal->minor_start = drv->minor;
@@ -2161,7 +2160,7 @@ int uart_register_driver(struct uart_driver *drv)
2161 normal->subtype = SERIAL_TYPE_NORMAL; 2160 normal->subtype = SERIAL_TYPE_NORMAL;
2162 normal->init_termios = tty_std_termios; 2161 normal->init_termios = tty_std_termios;
2163 normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; 2162 normal->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
2164 normal->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; 2163 normal->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
2165 normal->driver_state = drv; 2164 normal->driver_state = drv;
2166 tty_set_operations(normal, &uart_ops); 2165 tty_set_operations(normal, &uart_ops);
2167 2166
@@ -2312,7 +2311,7 @@ int uart_remove_one_port(struct uart_driver *drv, struct uart_port *port)
2312 mutex_unlock(&state->mutex); 2311 mutex_unlock(&state->mutex);
2313 2312
2314 /* 2313 /*
2315 * Remove the devices from devfs 2314 * Remove the devices from the tty layer
2316 */ 2315 */
2317 tty_unregister_device(drv->tty_driver, port->line); 2316 tty_unregister_device(drv->tty_driver, port->line);
2318 2317
diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c
index 3bdee64d1a99..a901a7e446f3 100644
--- a/drivers/serial/serial_txx9.c
+++ b/drivers/serial/serial_txx9.c
@@ -69,12 +69,10 @@ static char *serial_name = "TX39/49 Serial driver";
69#if !defined(CONFIG_SERIAL_TXX9_STDSERIAL) 69#if !defined(CONFIG_SERIAL_TXX9_STDSERIAL)
70/* "ttyS" is used for standard serial driver */ 70/* "ttyS" is used for standard serial driver */
71#define TXX9_TTY_NAME "ttyTX" 71#define TXX9_TTY_NAME "ttyTX"
72#define TXX9_TTY_DEVFS_NAME "tttx/"
73#define TXX9_TTY_MINOR_START (64 + 64) /* ttyTX0(128), ttyTX1(129) */ 72#define TXX9_TTY_MINOR_START (64 + 64) /* ttyTX0(128), ttyTX1(129) */
74#else 73#else
75/* acts like standard serial driver */ 74/* acts like standard serial driver */
76#define TXX9_TTY_NAME "ttyS" 75#define TXX9_TTY_NAME "ttyS"
77#define TXX9_TTY_DEVFS_NAME "tts/"
78#define TXX9_TTY_MINOR_START 64 76#define TXX9_TTY_MINOR_START 64
79#endif 77#endif
80#define TXX9_TTY_MAJOR TTY_MAJOR 78#define TXX9_TTY_MAJOR TTY_MAJOR
@@ -971,7 +969,6 @@ console_initcall(serial_txx9_console_init);
971static struct uart_driver serial_txx9_reg = { 969static struct uart_driver serial_txx9_reg = {
972 .owner = THIS_MODULE, 970 .owner = THIS_MODULE,
973 .driver_name = "serial_txx9", 971 .driver_name = "serial_txx9",
974 .devfs_name = TXX9_TTY_DEVFS_NAME,
975 .dev_name = TXX9_TTY_NAME, 972 .dev_name = TXX9_TTY_NAME,
976 .major = TXX9_TTY_MAJOR, 973 .major = TXX9_TTY_MAJOR,
977 .minor = TXX9_TTY_MINOR_START, 974 .minor = TXX9_TTY_MINOR_START,
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 44f6bf79bbe1..d97f3ca6cc29 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -1699,9 +1699,6 @@ static char banner[] __initdata =
1699static struct uart_driver sci_uart_driver = { 1699static struct uart_driver sci_uart_driver = {
1700 .owner = THIS_MODULE, 1700 .owner = THIS_MODULE,
1701 .driver_name = "sci", 1701 .driver_name = "sci",
1702#ifdef CONFIG_DEVFS_FS
1703 .devfs_name = "ttsc/",
1704#endif
1705 .dev_name = "ttySC", 1702 .dev_name = "ttySC",
1706 .major = SCI_MAJOR, 1703 .major = SCI_MAJOR,
1707 .minor = SCI_MINOR_START, 1704 .minor = SCI_MINOR_START,
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c
index ba22e256c6f7..d36bc4003399 100644
--- a/drivers/serial/sunhv.c
+++ b/drivers/serial/sunhv.c
@@ -353,7 +353,6 @@ static struct uart_ops sunhv_pops = {
353static struct uart_driver sunhv_reg = { 353static struct uart_driver sunhv_reg = {
354 .owner = THIS_MODULE, 354 .owner = THIS_MODULE,
355 .driver_name = "serial", 355 .driver_name = "serial",
356 .devfs_name = "tts/",
357 .dev_name = "ttyS", 356 .dev_name = "ttyS",
358 .major = TTY_MAJOR, 357 .major = TTY_MAJOR,
359}; 358};
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index e4c0fd2d6a9d..7da02d11c364 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -851,7 +851,6 @@ static struct uart_ops sunsab_pops = {
851static struct uart_driver sunsab_reg = { 851static struct uart_driver sunsab_reg = {
852 .owner = THIS_MODULE, 852 .owner = THIS_MODULE,
853 .driver_name = "serial", 853 .driver_name = "serial",
854 .devfs_name = "tts/",
855 .dev_name = "ttyS", 854 .dev_name = "ttyS",
856 .major = TTY_MAJOR, 855 .major = TTY_MAJOR,
857}; 856};
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 0268b307c01e..6e28c25138cf 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1265,7 +1265,6 @@ out:
1265static struct uart_driver sunsu_reg = { 1265static struct uart_driver sunsu_reg = {
1266 .owner = THIS_MODULE, 1266 .owner = THIS_MODULE,
1267 .driver_name = "serial", 1267 .driver_name = "serial",
1268 .devfs_name = "tts/",
1269 .dev_name = "ttyS", 1268 .dev_name = "ttyS",
1270 .major = TTY_MAJOR, 1269 .major = TTY_MAJOR,
1271}; 1270};
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 76c9bac9271f..9f42677287ad 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -1017,7 +1017,6 @@ static int zilog_irq = -1;
1017static struct uart_driver sunzilog_reg = { 1017static struct uart_driver sunzilog_reg = {
1018 .owner = THIS_MODULE, 1018 .owner = THIS_MODULE,
1019 .driver_name = "ttyS", 1019 .driver_name = "ttyS",
1020 .devfs_name = "tts/",
1021 .dev_name = "ttyS", 1020 .dev_name = "ttyS",
1022 .major = TTY_MAJOR, 1021 .major = TTY_MAJOR,
1023}; 1022};
diff --git a/drivers/serial/v850e_uart.c b/drivers/serial/v850e_uart.c
index df705fda4243..a0da2aaf71c4 100644
--- a/drivers/serial/v850e_uart.c
+++ b/drivers/serial/v850e_uart.c
@@ -468,7 +468,6 @@ static struct uart_ops v850e_uart_ops = {
468static struct uart_driver v850e_uart_driver = { 468static struct uart_driver v850e_uart_driver = {
469 .owner = THIS_MODULE, 469 .owner = THIS_MODULE,
470 .driver_name = "v850e_uart", 470 .driver_name = "v850e_uart",
471 .devfs_name = "tts/",
472 .dev_name = "ttyS", 471 .dev_name = "ttyS",
473 .major = TTY_MAJOR, 472 .major = TTY_MAJOR,
474 .minor = V850E_UART_MINOR_BASE, 473 .minor = V850E_UART_MINOR_BASE,
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
index df5e8713fa31..017571ffa19c 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/serial/vr41xx_siu.c
@@ -911,7 +911,6 @@ static struct uart_driver siu_uart_driver = {
911 .owner = THIS_MODULE, 911 .owner = THIS_MODULE,
912 .driver_name = "SIU", 912 .driver_name = "SIU",
913 .dev_name = "ttyVR", 913 .dev_name = "ttyVR",
914 .devfs_name = "ttvr/",
915 .major = SIU_MAJOR, 914 .major = SIU_MAJOR,
916 .minor = SIU_MINOR_BASE, 915 .minor = SIU_MINOR_BASE,
917 .cons = SERIAL_VR41XX_CONSOLE, 916 .cons = SERIAL_VR41XX_CONSOLE,
diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c
index 2dffa8e303b2..7f27b356eaf7 100644
--- a/drivers/tc/zs.c
+++ b/drivers/tc/zs.c
@@ -1745,7 +1745,6 @@ int __init zs_init(void)
1745 /* Not all of this is exactly right for us. */ 1745 /* Not all of this is exactly right for us. */
1746 1746
1747 serial_driver->owner = THIS_MODULE; 1747 serial_driver->owner = THIS_MODULE;
1748 serial_driver->devfs_name = "tts/";
1749 serial_driver->name = "ttyS"; 1748 serial_driver->name = "ttyS";
1750 serial_driver->major = TTY_MAJOR; 1749 serial_driver->major = TTY_MAJOR;
1751 serial_driver->minor_start = 64; 1750 serial_driver->minor_start = 64;
@@ -1754,7 +1753,7 @@ int __init zs_init(void)
1754 serial_driver->init_termios = tty_std_termios; 1753 serial_driver->init_termios = tty_std_termios;
1755 serial_driver->init_termios.c_cflag = 1754 serial_driver->init_termios.c_cflag =
1756 B9600 | CS8 | CREAD | HUPCL | CLOCAL; 1755 B9600 | CS8 | CREAD | HUPCL | CLOCAL;
1757 serial_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; 1756 serial_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
1758 tty_set_operations(serial_driver, &serial_ops); 1757 tty_set_operations(serial_driver, &serial_ops);
1759 1758
1760 if (tty_register_driver(serial_driver)) 1759 if (tty_register_driver(serial_driver))
diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c
index e166fffea86b..e41f49afd0f4 100644
--- a/drivers/telephony/phonedev.c
+++ b/drivers/telephony/phonedev.c
@@ -28,7 +28,6 @@
28 28
29#include <linux/kmod.h> 29#include <linux/kmod.h>
30#include <linux/sem.h> 30#include <linux/sem.h>
31#include <linux/devfs_fs_kernel.h>
32#include <linux/mutex.h> 31#include <linux/mutex.h>
33 32
34#define PHONE_NUM_DEVICES 256 33#define PHONE_NUM_DEVICES 256
@@ -106,8 +105,6 @@ int phone_register_device(struct phone_device *p, int unit)
106 if (phone_device[i] == NULL) { 105 if (phone_device[i] == NULL) {
107 phone_device[i] = p; 106 phone_device[i] = p;
108 p->minor = i; 107 p->minor = i;
109 devfs_mk_cdev(MKDEV(PHONE_MAJOR,i),
110 S_IFCHR|S_IRUSR|S_IWUSR, "phone/%d", i);
111 mutex_unlock(&phone_lock); 108 mutex_unlock(&phone_lock);
112 return 0; 109 return 0;
113 } 110 }
@@ -125,7 +122,6 @@ void phone_unregister_device(struct phone_device *pfd)
125 mutex_lock(&phone_lock); 122 mutex_lock(&phone_lock);
126 if (phone_device[pfd->minor] != pfd) 123 if (phone_device[pfd->minor] != pfd)
127 panic("phone: bad unregister"); 124 panic("phone: bad unregister");
128 devfs_remove("phone/%d", pfd->minor);
129 phone_device[pfd->minor] = NULL; 125 phone_device[pfd->minor] = NULL;
130 mutex_unlock(&phone_lock); 126 mutex_unlock(&phone_lock);
131} 127}
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index d41dc67ba4cc..3670d77e912c 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1145,12 +1145,11 @@ static int __init acm_init(void)
1145 acm_tty_driver->owner = THIS_MODULE, 1145 acm_tty_driver->owner = THIS_MODULE,
1146 acm_tty_driver->driver_name = "acm", 1146 acm_tty_driver->driver_name = "acm",
1147 acm_tty_driver->name = "ttyACM", 1147 acm_tty_driver->name = "ttyACM",
1148 acm_tty_driver->devfs_name = "usb/acm/",
1149 acm_tty_driver->major = ACM_TTY_MAJOR, 1148 acm_tty_driver->major = ACM_TTY_MAJOR,
1150 acm_tty_driver->minor_start = 0, 1149 acm_tty_driver->minor_start = 0,
1151 acm_tty_driver->type = TTY_DRIVER_TYPE_SERIAL, 1150 acm_tty_driver->type = TTY_DRIVER_TYPE_SERIAL,
1152 acm_tty_driver->subtype = SERIAL_TYPE_NORMAL, 1151 acm_tty_driver->subtype = SERIAL_TYPE_NORMAL,
1153 acm_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS, 1152 acm_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
1154 acm_tty_driver->init_termios = tty_std_termios; 1153 acm_tty_driver->init_termios = tty_std_termios;
1155 acm_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; 1154 acm_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
1156 tty_set_operations(acm_tty_driver, &acm_ops); 1155 tty_set_operations(acm_tty_driver, &acm_ops);
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index 9d6e1d295528..416acac879df 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -588,12 +588,11 @@ static int __init gs_module_init(void)
588 gs_tty_driver->owner = THIS_MODULE; 588 gs_tty_driver->owner = THIS_MODULE;
589 gs_tty_driver->driver_name = GS_SHORT_NAME; 589 gs_tty_driver->driver_name = GS_SHORT_NAME;
590 gs_tty_driver->name = "ttygs"; 590 gs_tty_driver->name = "ttygs";
591 gs_tty_driver->devfs_name = "usb/ttygs/";
592 gs_tty_driver->major = GS_MAJOR; 591 gs_tty_driver->major = GS_MAJOR;
593 gs_tty_driver->minor_start = GS_MINOR_START; 592 gs_tty_driver->minor_start = GS_MINOR_START;
594 gs_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; 593 gs_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
595 gs_tty_driver->subtype = SERIAL_TYPE_NORMAL; 594 gs_tty_driver->subtype = SERIAL_TYPE_NORMAL;
596 gs_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; 595 gs_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
597 gs_tty_driver->init_termios = tty_std_termios; 596 gs_tty_driver->init_termios = tty_std_termios;
598 gs_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; 597 gs_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
599 tty_set_operations(gs_tty_driver, &gs_tty_ops); 598 tty_set_operations(gs_tty_driver, &gs_tty_ops);
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index a30135c7cfe6..f466f89eeb6d 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -1059,13 +1059,12 @@ static int __init usb_serial_init(void)
1059 1059
1060 usb_serial_tty_driver->owner = THIS_MODULE; 1060 usb_serial_tty_driver->owner = THIS_MODULE;
1061 usb_serial_tty_driver->driver_name = "usbserial"; 1061 usb_serial_tty_driver->driver_name = "usbserial";
1062 usb_serial_tty_driver->devfs_name = "usb/tts/";
1063 usb_serial_tty_driver->name = "ttyUSB"; 1062 usb_serial_tty_driver->name = "ttyUSB";
1064 usb_serial_tty_driver->major = SERIAL_TTY_MAJOR; 1063 usb_serial_tty_driver->major = SERIAL_TTY_MAJOR;
1065 usb_serial_tty_driver->minor_start = 0; 1064 usb_serial_tty_driver->minor_start = 0;
1066 usb_serial_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; 1065 usb_serial_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
1067 usb_serial_tty_driver->subtype = SERIAL_TYPE_NORMAL; 1066 usb_serial_tty_driver->subtype = SERIAL_TYPE_NORMAL;
1068 usb_serial_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; 1067 usb_serial_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
1069 usb_serial_tty_driver->init_termios = tty_std_termios; 1068 usb_serial_tty_driver->init_termios = tty_std_termios;
1070 usb_serial_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; 1069 usb_serial_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
1071 tty_set_operations(usb_serial_tty_driver, &serial_ops); 1070 tty_set_operations(usb_serial_tty_driver, &serial_ops);
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 31143afe7c95..a171daab0ad0 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -32,7 +32,6 @@
32#ifdef CONFIG_KMOD 32#ifdef CONFIG_KMOD
33#include <linux/kmod.h> 33#include <linux/kmod.h>
34#endif 34#endif
35#include <linux/devfs_fs_kernel.h>
36#include <linux/err.h> 35#include <linux/err.h>
37#include <linux/device.h> 36#include <linux/device.h>
38#include <linux/efi.h> 37#include <linux/efi.h>
@@ -1331,8 +1330,6 @@ register_framebuffer(struct fb_info *fb_info)
1331 fb_add_videomode(&mode, &fb_info->modelist); 1330 fb_add_videomode(&mode, &fb_info->modelist);
1332 registered_fb[i] = fb_info; 1331 registered_fb[i] = fb_info;
1333 1332
1334 devfs_mk_cdev(MKDEV(FB_MAJOR, i),
1335 S_IFCHR | S_IRUGO | S_IWUGO, "fb/%d", i);
1336 event.info = fb_info; 1333 event.info = fb_info;
1337 blocking_notifier_call_chain(&fb_notifier_list, 1334 blocking_notifier_call_chain(&fb_notifier_list,
1338 FB_EVENT_FB_REGISTERED, &event); 1335 FB_EVENT_FB_REGISTERED, &event);
@@ -1359,7 +1356,6 @@ unregister_framebuffer(struct fb_info *fb_info)
1359 i = fb_info->node; 1356 i = fb_info->node;
1360 if (!registered_fb[i]) 1357 if (!registered_fb[i])
1361 return -EINVAL; 1358 return -EINVAL;
1362 devfs_remove("fb/%d", i);
1363 1359
1364 if (fb_info->pixmap.addr && 1360 if (fb_info->pixmap.addr &&
1365 (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) 1361 (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT))
@@ -1432,7 +1428,6 @@ fbmem_init(void)
1432{ 1428{
1433 create_proc_read_entry("fb", 0, NULL, fbmem_read_proc, NULL); 1429 create_proc_read_entry("fb", 0, NULL, fbmem_read_proc, NULL);
1434 1430
1435 devfs_mk_dir("fb");
1436 if (register_chrdev(FB_MAJOR,"fb",&fb_fops)) 1431 if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
1437 printk("unable to get major %d for fb devs\n", FB_MAJOR); 1432 printk("unable to get major %d for fb devs\n", FB_MAJOR);
1438 1433
diff --git a/fs/Makefile b/fs/Makefile
index d0ea6bfccf29..89135428a539 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -66,7 +66,6 @@ obj-$(CONFIG_MSDOS_FS) += msdos/
66obj-$(CONFIG_VFAT_FS) += vfat/ 66obj-$(CONFIG_VFAT_FS) += vfat/
67obj-$(CONFIG_BFS_FS) += bfs/ 67obj-$(CONFIG_BFS_FS) += bfs/
68obj-$(CONFIG_ISO9660_FS) += isofs/ 68obj-$(CONFIG_ISO9660_FS) += isofs/
69obj-$(CONFIG_DEVFS_FS) += devfs/
70obj-$(CONFIG_HFSPLUS_FS) += hfsplus/ # Before hfs to find wrapped HFS+ 69obj-$(CONFIG_HFSPLUS_FS) += hfsplus/ # Before hfs to find wrapped HFS+
71obj-$(CONFIG_HFS_FS) += hfs/ 70obj-$(CONFIG_HFS_FS) += hfs/
72obj-$(CONFIG_VXFS_FS) += freevxfs/ 71obj-$(CONFIG_VXFS_FS) += freevxfs/
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 7f7600e2381c..909cb0595b4e 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -12,7 +12,6 @@
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/kmod.h> 13#include <linux/kmod.h>
14#include <linux/major.h> 14#include <linux/major.h>
15#include <linux/devfs_fs_kernel.h>
16#include <linux/smp_lock.h> 15#include <linux/smp_lock.h>
17#include <linux/highmem.h> 16#include <linux/highmem.h>
18#include <linux/blkdev.h> 17#include <linux/blkdev.h>
diff --git a/fs/char_dev.c b/fs/char_dev.c
index f3418f7a6e9d..97986635b641 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -14,7 +14,6 @@
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/smp_lock.h> 16#include <linux/smp_lock.h>
17#include <linux/devfs_fs_kernel.h>
18#include <linux/seq_file.h> 17#include <linux/seq_file.h>
19 18
20#include <linux/kobject.h> 19#include <linux/kobject.h>
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index 7caee8d8ea3b..803aacf0d49c 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -28,7 +28,6 @@
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30#include <linux/proc_fs.h> 30#include <linux/proc_fs.h>
31#include <linux/devfs_fs_kernel.h>
32#include <linux/vmalloc.h> 31#include <linux/vmalloc.h>
33#include <linux/fs.h> 32#include <linux/fs.h>
34#include <linux/file.h> 33#include <linux/file.h>
@@ -365,22 +364,12 @@ static int init_coda_psdev(void)
365 err = PTR_ERR(coda_psdev_class); 364 err = PTR_ERR(coda_psdev_class);
366 goto out_chrdev; 365 goto out_chrdev;
367 } 366 }
368 devfs_mk_dir ("coda"); 367 for (i = 0; i < MAX_CODADEVS; i++)
369 for (i = 0; i < MAX_CODADEVS; i++) {
370 class_device_create(coda_psdev_class, NULL, 368 class_device_create(coda_psdev_class, NULL,
371 MKDEV(CODA_PSDEV_MAJOR,i), NULL, "cfs%d", i); 369 MKDEV(CODA_PSDEV_MAJOR,i), NULL, "cfs%d", i);
372 err = devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i),
373 S_IFCHR|S_IRUSR|S_IWUSR, "coda/%d", i);
374 if (err)
375 goto out_class;
376 }
377 coda_sysctl_init(); 370 coda_sysctl_init();
378 goto out; 371 goto out;
379 372
380out_class:
381 for (i = 0; i < MAX_CODADEVS; i++)
382 class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i));
383 class_destroy(coda_psdev_class);
384out_chrdev: 373out_chrdev:
385 unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); 374 unregister_chrdev(CODA_PSDEV_MAJOR, "coda");
386out: 375out:
@@ -419,12 +408,9 @@ static int __init init_coda(void)
419 } 408 }
420 return 0; 409 return 0;
421out: 410out:
422 for (i = 0; i < MAX_CODADEVS; i++) { 411 for (i = 0; i < MAX_CODADEVS; i++)
423 class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); 412 class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i));
424 devfs_remove("coda/%d", i);
425 }
426 class_destroy(coda_psdev_class); 413 class_destroy(coda_psdev_class);
427 devfs_remove("coda");
428 unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); 414 unregister_chrdev(CODA_PSDEV_MAJOR, "coda");
429 coda_sysctl_clean(); 415 coda_sysctl_clean();
430out1: 416out1:
@@ -441,12 +427,9 @@ static void __exit exit_coda(void)
441 if ( err != 0 ) { 427 if ( err != 0 ) {
442 printk("coda: failed to unregister filesystem\n"); 428 printk("coda: failed to unregister filesystem\n");
443 } 429 }
444 for (i = 0; i < MAX_CODADEVS; i++) { 430 for (i = 0; i < MAX_CODADEVS; i++)
445 class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i)); 431 class_device_destroy(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR, i));
446 devfs_remove("coda/%d", i);
447 }
448 class_destroy(coda_psdev_class); 432 class_destroy(coda_psdev_class);
449 devfs_remove("coda");
450 unregister_chrdev(CODA_PSDEV_MAJOR, "coda"); 433 unregister_chrdev(CODA_PSDEV_MAJOR, "coda");
451 coda_sysctl_clean(); 434 coda_sysctl_clean();
452 coda_destroy_inodecache(); 435 coda_destroy_inodecache();
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index d8ecfedef189..d8d50a70c58d 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -44,7 +44,6 @@
44#include <linux/loop.h> 44#include <linux/loop.h>
45#include <linux/auto_fs.h> 45#include <linux/auto_fs.h>
46#include <linux/auto_fs4.h> 46#include <linux/auto_fs4.h>
47#include <linux/devfs_fs.h>
48#include <linux/tty.h> 47#include <linux/tty.h>
49#include <linux/vt_kern.h> 48#include <linux/vt_kern.h>
50#include <linux/fb.h> 49#include <linux/fb.h>
diff --git a/fs/devfs/Makefile b/fs/devfs/Makefile
deleted file mode 100644
index 6dd8d1245e2c..000000000000
--- a/fs/devfs/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
1#
2# Makefile for the linux devfs-filesystem routines.
3#
4
5obj-$(CONFIG_DEVFS_FS) += devfs.o
6
7devfs-objs := base.o util.o
8
diff --git a/fs/devfs/base.c b/fs/devfs/base.c
deleted file mode 100644
index 51a97f132745..000000000000
--- a/fs/devfs/base.c
+++ /dev/null
@@ -1,2836 +0,0 @@
1/* devfs (Device FileSystem) driver.
2
3 Copyright (C) 1998-2002 Richard Gooch
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 Richard Gooch may be reached by email at rgooch@atnf.csiro.au
20 The postal address is:
21 Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.
22
23 ChangeLog
24
25 19980110 Richard Gooch <rgooch@atnf.csiro.au>
26 Original version.
27 v0.1
28 19980111 Richard Gooch <rgooch@atnf.csiro.au>
29 Created per-fs inode table rather than using inode->u.generic_ip
30 v0.2
31 19980111 Richard Gooch <rgooch@atnf.csiro.au>
32 Created .epoch inode which has a ctime of 0.
33 Fixed loss of named pipes when dentries lost.
34 Fixed loss of inode data when devfs_register() follows mknod().
35 v0.3
36 19980111 Richard Gooch <rgooch@atnf.csiro.au>
37 Fix for when compiling with CONFIG_KERNELD.
38 19980112 Richard Gooch <rgooch@atnf.csiro.au>
39 Fix for readdir() which sometimes didn't show entries.
40 Added <<tolerant>> option to <devfs_register>.
41 v0.4
42 19980113 Richard Gooch <rgooch@atnf.csiro.au>
43 Created <devfs_fill_file> function.
44 v0.5
45 19980115 Richard Gooch <rgooch@atnf.csiro.au>
46 Added subdirectory support. Major restructuring.
47 19980116 Richard Gooch <rgooch@atnf.csiro.au>
48 Fixed <find_by_dev> to not search major=0,minor=0.
49 Added symlink support.
50 v0.6
51 19980120 Richard Gooch <rgooch@atnf.csiro.au>
52 Created <devfs_mk_dir> function and support directory unregister
53 19980120 Richard Gooch <rgooch@atnf.csiro.au>
54 Auto-ownership uses real uid/gid rather than effective uid/gid.
55 v0.7
56 19980121 Richard Gooch <rgooch@atnf.csiro.au>
57 Supported creation of sockets.
58 v0.8
59 19980122 Richard Gooch <rgooch@atnf.csiro.au>
60 Added DEVFS_FL_HIDE_UNREG flag.
61 Interface change to <devfs_mk_symlink>.
62 Created <devfs_symlink> to support symlink(2).
63 v0.9
64 19980123 Richard Gooch <rgooch@atnf.csiro.au>
65 Added check to <devfs_fill_file> to check inode is in devfs.
66 Added optional traversal of symlinks.
67 v0.10
68 19980124 Richard Gooch <rgooch@atnf.csiro.au>
69 Created <devfs_get_flags> and <devfs_set_flags>.
70 v0.11
71 19980125 C. Scott Ananian <cananian@alumni.princeton.edu>
72 Created <devfs_find_handle>.
73 19980125 Richard Gooch <rgooch@atnf.csiro.au>
74 Allow removal of symlinks.
75 v0.12
76 19980125 Richard Gooch <rgooch@atnf.csiro.au>
77 Created <devfs_set_symlink_destination>.
78 19980126 Richard Gooch <rgooch@atnf.csiro.au>
79 Moved DEVFS_SUPER_MAGIC into header file.
80 Added DEVFS_FL_HIDE flag.
81 Created <devfs_get_maj_min>.
82 Created <devfs_get_handle_from_inode>.
83 Fixed minor bug in <find_by_dev>.
84 19980127 Richard Gooch <rgooch@atnf.csiro.au>
85 Changed interface to <find_by_dev>, <find_entry>,
86 <devfs_unregister>, <devfs_fill_file> and <devfs_find_handle>.
87 Fixed inode times when symlink created with symlink(2).
88 v0.13
89 19980129 C. Scott Ananian <cananian@alumni.princeton.edu>
90 Exported <devfs_set_symlink_destination>, <devfs_get_maj_min>
91 and <devfs_get_handle_from_inode>.
92 19980129 Richard Gooch <rgooch@atnf.csiro.au>
93 Created <devfs_unlink> to support unlink(2).
94 v0.14
95 19980129 Richard Gooch <rgooch@atnf.csiro.au>
96 Fixed kerneld support for entries in devfs subdirectories.
97 19980130 Richard Gooch <rgooch@atnf.csiro.au>
98 Bugfixes in <call_kerneld>.
99 v0.15
100 19980207 Richard Gooch <rgooch@atnf.csiro.au>
101 Call kerneld when looking up unregistered entries.
102 v0.16
103 19980326 Richard Gooch <rgooch@atnf.csiro.au>
104 Modified interface to <devfs_find_handle> for symlink traversal.
105 v0.17
106 19980331 Richard Gooch <rgooch@atnf.csiro.au>
107 Fixed persistence bug with device numbers for manually created
108 device files.
109 Fixed problem with recreating symlinks with different content.
110 v0.18
111 19980401 Richard Gooch <rgooch@atnf.csiro.au>
112 Changed to CONFIG_KMOD.
113 Hide entries which are manually unlinked.
114 Always invalidate devfs dentry cache when registering entries.
115 Created <devfs_rmdir> to support rmdir(2).
116 Ensure directories created by <devfs_mk_dir> are visible.
117 v0.19
118 19980402 Richard Gooch <rgooch@atnf.csiro.au>
119 Invalidate devfs dentry cache when making directories.
120 Invalidate devfs dentry cache when removing entries.
121 Fixed persistence bug with fifos.
122 v0.20
123 19980421 Richard Gooch <rgooch@atnf.csiro.au>
124 Print process command when debugging kerneld/kmod.
125 Added debugging for register/unregister/change operations.
126 19980422 Richard Gooch <rgooch@atnf.csiro.au>
127 Added "devfs=" boot options.
128 v0.21
129 19980426 Richard Gooch <rgooch@atnf.csiro.au>
130 No longer lock/unlock superblock in <devfs_put_super>.
131 Drop negative dentries when they are released.
132 Manage dcache more efficiently.
133 v0.22
134 19980427 Richard Gooch <rgooch@atnf.csiro.au>
135 Added DEVFS_FL_AUTO_DEVNUM flag.
136 v0.23
137 19980430 Richard Gooch <rgooch@atnf.csiro.au>
138 No longer set unnecessary methods.
139 v0.24
140 19980504 Richard Gooch <rgooch@atnf.csiro.au>
141 Added PID display to <call_kerneld> debugging message.
142 Added "after" debugging message to <call_kerneld>.
143 19980519 Richard Gooch <rgooch@atnf.csiro.au>
144 Added "diread" and "diwrite" boot options.
145 19980520 Richard Gooch <rgooch@atnf.csiro.au>
146 Fixed persistence problem with permissions.
147 v0.25
148 19980602 Richard Gooch <rgooch@atnf.csiro.au>
149 Support legacy device nodes.
150 Fixed bug where recreated inodes were hidden.
151 v0.26
152 19980602 Richard Gooch <rgooch@atnf.csiro.au>
153 Improved debugging in <get_vfs_inode>.
154 19980607 Richard Gooch <rgooch@atnf.csiro.au>
155 No longer free old dentries in <devfs_mk_dir>.
156 Free all dentries for a given entry when deleting inodes.
157 v0.27
158 19980627 Richard Gooch <rgooch@atnf.csiro.au>
159 Limit auto-device numbering to majors 128 to 239.
160 v0.28
161 19980629 Richard Gooch <rgooch@atnf.csiro.au>
162 Fixed inode times persistence problem.
163 v0.29
164 19980704 Richard Gooch <rgooch@atnf.csiro.au>
165 Fixed spelling in <devfs_readlink> debug.
166 Fixed bug in <devfs_setup> parsing "dilookup".
167 v0.30
168 19980705 Richard Gooch <rgooch@atnf.csiro.au>
169 Fixed devfs inode leak when manually recreating inodes.
170 Fixed permission persistence problem when recreating inodes.
171 v0.31
172 19980727 Richard Gooch <rgooch@atnf.csiro.au>
173 Removed harmless "unused variable" compiler warning.
174 Fixed modes for manually recreated device nodes.
175 v0.32
176 19980728 Richard Gooch <rgooch@atnf.csiro.au>
177 Added NULL devfs inode warning in <devfs_read_inode>.
178 Force all inode nlink values to 1.
179 v0.33
180 19980730 Richard Gooch <rgooch@atnf.csiro.au>
181 Added "dimknod" boot option.
182 Set inode nlink to 0 when freeing dentries.
183 Fixed modes for manually recreated symlinks.
184 v0.34
185 19980802 Richard Gooch <rgooch@atnf.csiro.au>
186 Fixed bugs in recreated directories and symlinks.
187 v0.35
188 19980806 Richard Gooch <rgooch@atnf.csiro.au>
189 Fixed bugs in recreated device nodes.
190 19980807 Richard Gooch <rgooch@atnf.csiro.au>
191 Fixed bug in currently unused <devfs_get_handle_from_inode>.
192 Defined new <devfs_handle_t> type.
193 Improved debugging when getting entries.
194 Fixed bug where directories could be emptied.
195 v0.36
196 19980809 Richard Gooch <rgooch@atnf.csiro.au>
197 Replaced dummy .epoch inode with .devfsd character device.
198 19980810 Richard Gooch <rgooch@atnf.csiro.au>
199 Implemented devfsd protocol revision 0.
200 v0.37
201 19980819 Richard Gooch <rgooch@atnf.csiro.au>
202 Added soothing message to warning in <devfs_d_iput>.
203 v0.38
204 19980829 Richard Gooch <rgooch@atnf.csiro.au>
205 Use GCC extensions for structure initialisations.
206 Implemented async open notification.
207 Incremented devfsd protocol revision to 1.
208 v0.39
209 19980908 Richard Gooch <rgooch@atnf.csiro.au>
210 Moved async open notification to end of <devfs_open>.
211 v0.40
212 19980910 Richard Gooch <rgooch@atnf.csiro.au>
213 Prepended "/dev/" to module load request.
214 Renamed <call_kerneld> to <call_kmod>.
215 v0.41
216 19980910 Richard Gooch <rgooch@atnf.csiro.au>
217 Fixed typo "AYSNC" -> "ASYNC".
218 v0.42
219 19980910 Richard Gooch <rgooch@atnf.csiro.au>
220 Added open flag for files.
221 v0.43
222 19980927 Richard Gooch <rgooch@atnf.csiro.au>
223 Set i_blocks=0 and i_blksize=1024 in <devfs_read_inode>.
224 v0.44
225 19981005 Richard Gooch <rgooch@atnf.csiro.au>
226 Added test for empty <<name>> in <devfs_find_handle>.
227 Renamed <generate_path> to <devfs_generate_path> and published.
228 v0.45
229 19981006 Richard Gooch <rgooch@atnf.csiro.au>
230 Created <devfs_get_fops>.
231 v0.46
232 19981007 Richard Gooch <rgooch@atnf.csiro.au>
233 Limit auto-device numbering to majors 144 to 239.
234 v0.47
235 19981010 Richard Gooch <rgooch@atnf.csiro.au>
236 Updated <devfs_follow_link> for VFS change in 2.1.125.
237 v0.48
238 19981022 Richard Gooch <rgooch@atnf.csiro.au>
239 Created DEVFS_ FL_COMPAT flag.
240 v0.49
241 19981023 Richard Gooch <rgooch@atnf.csiro.au>
242 Created "nocompat" boot option.
243 v0.50
244 19981025 Richard Gooch <rgooch@atnf.csiro.au>
245 Replaced "mount" boot option with "nomount".
246 v0.51
247 19981110 Richard Gooch <rgooch@atnf.csiro.au>
248 Created "only" boot option.
249 v0.52
250 19981112 Richard Gooch <rgooch@atnf.csiro.au>
251 Added DEVFS_FL_REMOVABLE flag.
252 v0.53
253 19981114 Richard Gooch <rgooch@atnf.csiro.au>
254 Only call <scan_dir_for_removable> on first call to
255 <devfs_readdir>.
256 v0.54
257 19981205 Richard Gooch <rgooch@atnf.csiro.au>
258 Updated <devfs_rmdir> for VFS change in 2.1.131.
259 v0.55
260 19981218 Richard Gooch <rgooch@atnf.csiro.au>
261 Created <devfs_mk_compat>.
262 19981220 Richard Gooch <rgooch@atnf.csiro.au>
263 Check for partitions on removable media in <devfs_lookup>.
264 v0.56
265 19990118 Richard Gooch <rgooch@atnf.csiro.au>
266 Added support for registering regular files.
267 Created <devfs_set_file_size>.
268 Update devfs inodes from entries if not changed through FS.
269 v0.57
270 19990124 Richard Gooch <rgooch@atnf.csiro.au>
271 Fixed <devfs_fill_file> to only initialise temporary inodes.
272 Trap for NULL fops in <devfs_register>.
273 Return -ENODEV in <devfs_fill_file> for non-driver inodes.
274 v0.58
275 19990126 Richard Gooch <rgooch@atnf.csiro.au>
276 Switched from PATH_MAX to DEVFS_PATHLEN.
277 v0.59
278 19990127 Richard Gooch <rgooch@atnf.csiro.au>
279 Created "nottycompat" boot option.
280 v0.60
281 19990318 Richard Gooch <rgooch@atnf.csiro.au>
282 Fixed <devfsd_read> to not overrun event buffer.
283 v0.61
284 19990329 Richard Gooch <rgooch@atnf.csiro.au>
285 Created <devfs_auto_unregister>.
286 v0.62
287 19990330 Richard Gooch <rgooch@atnf.csiro.au>
288 Don't return unregistred entries in <devfs_find_handle>.
289 Panic in <devfs_unregister> if entry unregistered.
290 19990401 Richard Gooch <rgooch@atnf.csiro.au>
291 Don't panic in <devfs_auto_unregister> for duplicates.
292 v0.63
293 19990402 Richard Gooch <rgooch@atnf.csiro.au>
294 Don't unregister already unregistered entries in <unregister>.
295 v0.64
296 19990510 Richard Gooch <rgooch@atnf.csiro.au>
297 Disable warning messages when unable to read partition table for
298 removable media.
299 v0.65
300 19990512 Richard Gooch <rgooch@atnf.csiro.au>
301 Updated <devfs_lookup> for VFS change in 2.3.1-pre1.
302 Created "oops-on-panic" boot option.
303 Improved debugging in <devfs_register> and <devfs_unregister>.
304 v0.66
305 19990519 Richard Gooch <rgooch@atnf.csiro.au>
306 Added documentation for some functions.
307 19990525 Richard Gooch <rgooch@atnf.csiro.au>
308 Removed "oops-on-panic" boot option: now always Oops.
309 v0.67
310 19990531 Richard Gooch <rgooch@atnf.csiro.au>
311 Improved debugging in <devfs_register>.
312 v0.68
313 19990604 Richard Gooch <rgooch@atnf.csiro.au>
314 Added "diunlink" and "nokmod" boot options.
315 Removed superfluous warning message in <devfs_d_iput>.
316 v0.69
317 19990611 Richard Gooch <rgooch@atnf.csiro.au>
318 Took account of change to <d_alloc_root>.
319 v0.70
320 19990614 Richard Gooch <rgooch@atnf.csiro.au>
321 Created separate event queue for each mounted devfs.
322 Removed <devfs_invalidate_dcache>.
323 Created new ioctl()s.
324 Incremented devfsd protocol revision to 3.
325 Fixed bug when re-creating directories: contents were lost.
326 Block access to inodes until devfsd updates permissions.
327 19990615 Richard Gooch <rgooch@atnf.csiro.au>
328 Support 2.2.x kernels.
329 v0.71
330 19990623 Richard Gooch <rgooch@atnf.csiro.au>
331 Switched to sending process uid/gid to devfsd.
332 Renamed <call_kmod> to <try_modload>.
333 Added DEVFSD_NOTIFY_LOOKUP event.
334 19990624 Richard Gooch <rgooch@atnf.csiro.au>
335 Added DEVFSD_NOTIFY_CHANGE event.
336 Incremented devfsd protocol revision to 4.
337 v0.72
338 19990713 Richard Gooch <rgooch@atnf.csiro.au>
339 Return EISDIR rather than EINVAL for read(2) on directories.
340 v0.73
341 19990809 Richard Gooch <rgooch@atnf.csiro.au>
342 Changed <devfs_setup> to new __init scheme.
343 v0.74
344 19990901 Richard Gooch <rgooch@atnf.csiro.au>
345 Changed remaining function declarations to new __init scheme.
346 v0.75
347 19991013 Richard Gooch <rgooch@atnf.csiro.au>
348 Created <devfs_get_info>, <devfs_set_info>,
349 <devfs_get_first_child> and <devfs_get_next_sibling>.
350 Added <<dir>> parameter to <devfs_register>, <devfs_mk_compat>,
351 <devfs_mk_dir> and <devfs_find_handle>.
352 Work sponsored by SGI.
353 v0.76
354 19991017 Richard Gooch <rgooch@atnf.csiro.au>
355 Allow multiple unregistrations.
356 Work sponsored by SGI.
357 v0.77
358 19991026 Richard Gooch <rgooch@atnf.csiro.au>
359 Added major and minor number to devfsd protocol.
360 Incremented devfsd protocol revision to 5.
361 Work sponsored by SGI.
362 v0.78
363 19991030 Richard Gooch <rgooch@atnf.csiro.au>
364 Support info pointer for all devfs entry types.
365 Added <<info>> parameter to <devfs_mk_dir> and
366 <devfs_mk_symlink>.
367 Work sponsored by SGI.
368 v0.79
369 19991031 Richard Gooch <rgooch@atnf.csiro.au>
370 Support "../" when searching devfs namespace.
371 Work sponsored by SGI.
372 v0.80
373 19991101 Richard Gooch <rgooch@atnf.csiro.au>
374 Created <devfs_get_unregister_slave>.
375 Work sponsored by SGI.
376 v0.81
377 19991103 Richard Gooch <rgooch@atnf.csiro.au>
378 Exported <devfs_get_parent>.
379 Work sponsored by SGI.
380 v0.82
381 19991104 Richard Gooch <rgooch@atnf.csiro.au>
382 Removed unused <devfs_set_symlink_destination>.
383 19991105 Richard Gooch <rgooch@atnf.csiro.au>
384 Do not hide entries from devfsd or children.
385 Removed DEVFS_ FL_TTY_COMPAT flag.
386 Removed "nottycompat" boot option.
387 Removed <devfs_mk_compat>.
388 Work sponsored by SGI.
389 v0.83
390 19991107 Richard Gooch <rgooch@atnf.csiro.au>
391 Added DEVFS_FL_WAIT flag.
392 Work sponsored by SGI.
393 v0.84
394 19991107 Richard Gooch <rgooch@atnf.csiro.au>
395 Support new "disc" naming scheme in <get_removable_partition>.
396 Allow NULL fops in <devfs_register>.
397 Work sponsored by SGI.
398 v0.85
399 19991110 Richard Gooch <rgooch@atnf.csiro.au>
400 Fall back to major table if NULL fops given to <devfs_register>.
401 Work sponsored by SGI.
402 v0.86
403 19991204 Richard Gooch <rgooch@atnf.csiro.au>
404 Support fifos when unregistering.
405 Work sponsored by SGI.
406 v0.87
407 19991209 Richard Gooch <rgooch@atnf.csiro.au>
408 Removed obsolete DEVFS_ FL_COMPAT and DEVFS_ FL_TOLERANT flags.
409 Work sponsored by SGI.
410 v0.88
411 19991214 Richard Gooch <rgooch@atnf.csiro.au>
412 Removed kmod support.
413 Work sponsored by SGI.
414 v0.89
415 19991216 Richard Gooch <rgooch@atnf.csiro.au>
416 Improved debugging in <get_vfs_inode>.
417 Ensure dentries created by devfsd will be cleaned up.
418 Work sponsored by SGI.
419 v0.90
420 19991223 Richard Gooch <rgooch@atnf.csiro.au>
421 Created <devfs_get_name>.
422 Work sponsored by SGI.
423 v0.91
424 20000203 Richard Gooch <rgooch@atnf.csiro.au>
425 Ported to kernel 2.3.42.
426 Removed <devfs_fill_file>.
427 Work sponsored by SGI.
428 v0.92
429 20000306 Richard Gooch <rgooch@atnf.csiro.au>
430 Added DEVFS_ FL_NO_PERSISTENCE flag.
431 Removed unnecessary call to <update_devfs_inode_from_entry> in
432 <devfs_readdir>.
433 Work sponsored by SGI.
434 v0.93
435 20000413 Richard Gooch <rgooch@atnf.csiro.au>
436 Set inode->i_size to correct size for symlinks.
437 20000414 Richard Gooch <rgooch@atnf.csiro.au>
438 Only give lookup() method to directories to comply with new VFS
439 assumptions.
440 Work sponsored by SGI.
441 20000415 Richard Gooch <rgooch@atnf.csiro.au>
442 Remove unnecessary tests in symlink methods.
443 Don't kill existing block ops in <devfs_read_inode>.
444 Work sponsored by SGI.
445 v0.94
446 20000424 Richard Gooch <rgooch@atnf.csiro.au>
447 Don't create missing directories in <devfs_find_handle>.
448 Work sponsored by SGI.
449 v0.95
450 20000430 Richard Gooch <rgooch@atnf.csiro.au>
451 Added CONFIG_DEVFS_MOUNT.
452 Work sponsored by SGI.
453 v0.96
454 20000608 Richard Gooch <rgooch@atnf.csiro.au>
455 Disabled multi-mount capability (use VFS bindings instead).
456 Work sponsored by SGI.
457 v0.97
458 20000610 Richard Gooch <rgooch@atnf.csiro.au>
459 Switched to FS_SINGLE to disable multi-mounts.
460 20000612 Richard Gooch <rgooch@atnf.csiro.au>
461 Removed module support.
462 Removed multi-mount code.
463 Removed compatibility macros: VFS has changed too much.
464 Work sponsored by SGI.
465 v0.98
466 20000614 Richard Gooch <rgooch@atnf.csiro.au>
467 Merged devfs inode into devfs entry.
468 Work sponsored by SGI.
469 v0.99
470 20000619 Richard Gooch <rgooch@atnf.csiro.au>
471 Removed dead code in <devfs_register> which used to call
472 <free_dentries>.
473 Work sponsored by SGI.
474 v0.100
475 20000621 Richard Gooch <rgooch@atnf.csiro.au>
476 Changed interface to <devfs_register>.
477 Work sponsored by SGI.
478 v0.101
479 20000622 Richard Gooch <rgooch@atnf.csiro.au>
480 Simplified interface to <devfs_mk_symlink> and <devfs_mk_dir>.
481 Simplified interface to <devfs_find_handle>.
482 Work sponsored by SGI.
483 v0.102
484 20010519 Richard Gooch <rgooch@atnf.csiro.au>
485 Ensure <devfs_generate_path> terminates string for root entry.
486 Exported <devfs_get_name> to modules.
487 20010520 Richard Gooch <rgooch@atnf.csiro.au>
488 Make <devfs_mk_symlink> send events to devfsd.
489 Cleaned up option processing in <devfs_setup>.
490 20010521 Richard Gooch <rgooch@atnf.csiro.au>
491 Fixed bugs in handling symlinks: could leak or cause Oops.
492 20010522 Richard Gooch <rgooch@atnf.csiro.au>
493 Cleaned up directory handling by separating fops.
494 v0.103
495 20010601 Richard Gooch <rgooch@atnf.csiro.au>
496 Fixed handling of inverted options in <devfs_setup>.
497 v0.104
498 20010604 Richard Gooch <rgooch@atnf.csiro.au>
499 Adjusted <try_modload> to account for <devfs_generate_path> fix.
500 v0.105
501 20010617 Richard Gooch <rgooch@atnf.csiro.au>
502 Answered question posed by Al Viro and removed his comments.
503 Moved setting of registered flag after other fields are changed.
504 Fixed race between <devfsd_close> and <devfsd_notify_one>.
505 Global VFS changes added bogus BKL to <devfsd_close>: removed.
506 Widened locking in <devfs_readlink> and <devfs_follow_link>.
507 Replaced <devfsd_read> stack usage with <devfsd_ioctl> kmalloc.
508 Simplified locking in <devfsd_ioctl> and fixed memory leak.
509 v0.106
510 20010709 Richard Gooch <rgooch@atnf.csiro.au>
511 Removed broken devnum allocation and use <devfs_alloc_devnum>.
512 Fixed old devnum leak by calling new <devfs_dealloc_devnum>.
513 v0.107
514 20010712 Richard Gooch <rgooch@atnf.csiro.au>
515 Fixed bug in <devfs_setup> which could hang boot process.
516 v0.108
517 20010730 Richard Gooch <rgooch@atnf.csiro.au>
518 Added DEVFSD_NOTIFY_DELETE event.
519 20010801 Richard Gooch <rgooch@atnf.csiro.au>
520 Removed #include <asm/segment.h>.
521 v0.109
522 20010807 Richard Gooch <rgooch@atnf.csiro.au>
523 Fixed inode table races by removing it and using
524 inode->u.generic_ip instead.
525 Moved <devfs_read_inode> into <get_vfs_inode>.
526 Moved <devfs_write_inode> into <devfs_notify_change>.
527 v0.110
528 20010808 Richard Gooch <rgooch@atnf.csiro.au>
529 Fixed race in <devfs_do_symlink> for uni-processor.
530 v0.111
531 20010818 Richard Gooch <rgooch@atnf.csiro.au>
532 Removed remnant of multi-mount support in <devfs_mknod>.
533 Removed unused DEVFS_FL_SHOW_UNREG flag.
534 v0.112
535 20010820 Richard Gooch <rgooch@atnf.csiro.au>
536 Removed nlink field from struct devfs_inode.
537 v0.113
538 20010823 Richard Gooch <rgooch@atnf.csiro.au>
539 Replaced BKL with global rwsem to protect symlink data (quick
540 and dirty hack).
541 v0.114
542 20010827 Richard Gooch <rgooch@atnf.csiro.au>
543 Replaced global rwsem for symlink with per-link refcount.
544 v0.115
545 20010919 Richard Gooch <rgooch@atnf.csiro.au>
546 Set inode->i_mapping->a_ops for block nodes in <get_vfs_inode>.
547 v0.116
548 20011008 Richard Gooch <rgooch@atnf.csiro.au>
549 Fixed overrun in <devfs_link> by removing function (not needed).
550 20011009 Richard Gooch <rgooch@atnf.csiro.au>
551 Fixed buffer underrun in <try_modload>.
552 20011029 Richard Gooch <rgooch@atnf.csiro.au>
553 Fixed race in <devfsd_ioctl> when setting event mask.
554 20011114 Richard Gooch <rgooch@atnf.csiro.au>
555 First release of new locking code.
556 v1.0
557 20011117 Richard Gooch <rgooch@atnf.csiro.au>
558 Discard temporary buffer, now use "%s" for dentry names.
559 20011118 Richard Gooch <rgooch@atnf.csiro.au>
560 Don't generate path in <try_modload>: use fake entry instead.
561 Use "existing" directory in <_devfs_make_parent_for_leaf>.
562 20011122 Richard Gooch <rgooch@atnf.csiro.au>
563 Use slab cache rather than fixed buffer for devfsd events.
564 v1.1
565 20011125 Richard Gooch <rgooch@atnf.csiro.au>
566 Send DEVFSD_NOTIFY_REGISTERED events in <devfs_mk_dir>.
567 20011127 Richard Gooch <rgooch@atnf.csiro.au>
568 Fixed locking bug in <devfs_d_revalidate_wait> due to typo.
569 Do not send CREATE, CHANGE, ASYNC_OPEN or DELETE events from
570 devfsd or children.
571 v1.2
572 20011202 Richard Gooch <rgooch@atnf.csiro.au>
573 Fixed bug in <devfsd_read>: was dereferencing freed pointer.
574 v1.3
575 20011203 Richard Gooch <rgooch@atnf.csiro.au>
576 Fixed bug in <devfsd_close>: was dereferencing freed pointer.
577 Added process group check for devfsd privileges.
578 v1.4
579 20011204 Richard Gooch <rgooch@atnf.csiro.au>
580 Use SLAB_ATOMIC in <devfsd_notify_de> from <devfs_d_delete>.
581 v1.5
582 20011211 Richard Gooch <rgooch@atnf.csiro.au>
583 Return old entry in <devfs_mk_dir> for 2.4.x kernels.
584 20011212 Richard Gooch <rgooch@atnf.csiro.au>
585 Increment refcount on module in <check_disc_changed>.
586 20011215 Richard Gooch <rgooch@atnf.csiro.au>
587 Created <devfs_get_handle> and exported <devfs_put>.
588 Increment refcount on module in <devfs_get_ops>.
589 Created <devfs_put_ops>.
590 v1.6
591 20011216 Richard Gooch <rgooch@atnf.csiro.au>
592 Added poisoning to <devfs_put>.
593 Improved debugging messages.
594 v1.7
595 20011221 Richard Gooch <rgooch@atnf.csiro.au>
596 Corrected (made useful) debugging message in <unregister>.
597 Moved <kmem_cache_create> in <mount_devfs_fs> to <init_devfs_fs>
598 20011224 Richard Gooch <rgooch@atnf.csiro.au>
599 Added magic number to guard against scribbling drivers.
600 20011226 Richard Gooch <rgooch@atnf.csiro.au>
601 Only return old entry in <devfs_mk_dir> if a directory.
602 Defined macros for error and debug messages.
603 v1.8
604 20020113 Richard Gooch <rgooch@atnf.csiro.au>
605 Fixed (rare, old) race in <devfs_lookup>.
606 v1.9
607 20020120 Richard Gooch <rgooch@atnf.csiro.au>
608 Fixed deadlock bug in <devfs_d_revalidate_wait>.
609 Tag VFS deletable in <devfs_mk_symlink> if handle ignored.
610 v1.10
611 20020129 Richard Gooch <rgooch@atnf.csiro.au>
612 Added KERN_* to remaining messages.
613 Cleaned up declaration of <stat_read>.
614 v1.11
615 20020219 Richard Gooch <rgooch@atnf.csiro.au>
616 Changed <devfs_rmdir> to allow later additions if not yet empty.
617 v1.12
618 20020406 Richard Gooch <rgooch@atnf.csiro.au>
619 Removed silently introduced calls to lock_kernel() and
620 unlock_kernel() due to recent VFS locking changes. BKL isn't
621 required in devfs.
622 v1.13
623 20020428 Richard Gooch <rgooch@atnf.csiro.au>
624 Removed 2.4.x compatibility code.
625 v1.14
626 20020510 Richard Gooch <rgooch@atnf.csiro.au>
627 Added BKL to <devfs_open> because drivers still need it.
628 v1.15
629 20020512 Richard Gooch <rgooch@atnf.csiro.au>
630 Protected <scan_dir_for_removable> and <get_removable_partition>
631 from changing directory contents.
632 v1.16
633 20020514 Richard Gooch <rgooch@atnf.csiro.au>
634 Minor cleanup of <scan_dir_for_removable>.
635 v1.17
636 20020721 Richard Gooch <rgooch@atnf.csiro.au>
637 Switched to ISO C structure field initialisers.
638 Switch to set_current_state() and move before add_wait_queue().
639 20020722 Richard Gooch <rgooch@atnf.csiro.au>
640 Fixed devfs entry leak in <devfs_readdir> when *readdir fails.
641 v1.18
642 20020725 Richard Gooch <rgooch@atnf.csiro.au>
643 Created <devfs_find_and_unregister>.
644 v1.19
645 20020728 Richard Gooch <rgooch@atnf.csiro.au>
646 Removed deprecated <devfs_find_handle>.
647 v1.20
648 20020820 Richard Gooch <rgooch@atnf.csiro.au>
649 Fixed module unload race in <devfs_open>.
650 v1.21
651 20021013 Richard Gooch <rgooch@atnf.csiro.au>
652 Removed DEVFS_ FL_AUTO_OWNER.
653 Switched lingering structure field initialiser to ISO C.
654 Added locking when updating FCB flags.
655 v1.22
656*/
657#include <linux/types.h>
658#include <linux/errno.h>
659#include <linux/time.h>
660#include <linux/tty.h>
661#include <linux/timer.h>
662#include <linux/config.h>
663#include <linux/kernel.h>
664#include <linux/wait.h>
665#include <linux/string.h>
666#include <linux/slab.h>
667#include <linux/ioport.h>
668#include <linux/delay.h>
669#include <linux/ctype.h>
670#include <linux/mm.h>
671#include <linux/module.h>
672#include <linux/init.h>
673#include <linux/devfs_fs.h>
674#include <linux/devfs_fs_kernel.h>
675#include <linux/smp_lock.h>
676#include <linux/smp.h>
677#include <linux/rwsem.h>
678#include <linux/sched.h>
679#include <linux/namei.h>
680#include <linux/bitops.h>
681
682#include <asm/uaccess.h>
683#include <asm/io.h>
684#include <asm/processor.h>
685#include <asm/system.h>
686#include <asm/pgtable.h>
687#include <asm/atomic.h>
688
689#define DEVFS_VERSION "2004-01-31"
690
691#define DEVFS_NAME "devfs"
692
693#define FIRST_INODE 1
694
695#define STRING_LENGTH 256
696#define FAKE_BLOCK_SIZE 1024
697#define POISON_PTR ( *(void **) poison_array )
698#define MAGIC_VALUE 0x327db823
699
700#ifndef TRUE
701# define TRUE 1
702# define FALSE 0
703#endif
704
705#define MODE_DIR (S_IFDIR | S_IWUSR | S_IRUGO | S_IXUGO)
706
707#define DEBUG_NONE 0x0000000
708#define DEBUG_MODULE_LOAD 0x0000001
709#define DEBUG_REGISTER 0x0000002
710#define DEBUG_UNREGISTER 0x0000004
711#define DEBUG_FREE 0x0000008
712#define DEBUG_SET_FLAGS 0x0000010
713#define DEBUG_S_READ 0x0000100 /* Break */
714#define DEBUG_I_LOOKUP 0x0001000 /* Break */
715#define DEBUG_I_CREATE 0x0002000
716#define DEBUG_I_GET 0x0004000
717#define DEBUG_I_CHANGE 0x0008000
718#define DEBUG_I_UNLINK 0x0010000
719#define DEBUG_I_RLINK 0x0020000
720#define DEBUG_I_FLINK 0x0040000
721#define DEBUG_I_MKNOD 0x0080000
722#define DEBUG_F_READDIR 0x0100000 /* Break */
723#define DEBUG_D_DELETE 0x1000000 /* Break */
724#define DEBUG_D_RELEASE 0x2000000
725#define DEBUG_D_IPUT 0x4000000
726#define DEBUG_ALL 0xfffffff
727#define DEBUG_DISABLED DEBUG_NONE
728
729#define OPTION_NONE 0x00
730#define OPTION_MOUNT 0x01
731
732#define PRINTK(format, args...) \
733 {printk (KERN_ERR "%s" format, __FUNCTION__ , ## args);}
734
735#define OOPS(format, args...) \
736 {printk (KERN_CRIT "%s" format, __FUNCTION__ , ## args); \
737 printk ("Forcing Oops\n"); \
738 BUG();}
739
740#ifdef CONFIG_DEVFS_DEBUG
741# define VERIFY_ENTRY(de) \
742 {if ((de) && (de)->magic_number != MAGIC_VALUE) \
743 OOPS ("(%p): bad magic value: %x\n", (de), (de)->magic_number);}
744# define WRITE_ENTRY_MAGIC(de,magic) (de)->magic_number = (magic)
745# define DPRINTK(flag, format, args...) \
746 {if (devfs_debug & flag) \
747 printk (KERN_INFO "%s" format, __FUNCTION__ , ## args);}
748#else
749# define VERIFY_ENTRY(de)
750# define WRITE_ENTRY_MAGIC(de,magic)
751# define DPRINTK(flag, format, args...)
752#endif
753
754typedef struct devfs_entry *devfs_handle_t;
755
756struct directory_type {
757 rwlock_t lock; /* Lock for searching(R)/updating(W) */
758 struct devfs_entry *first;
759 struct devfs_entry *last;
760 unsigned char no_more_additions:1;
761};
762
763struct symlink_type {
764 unsigned int length; /* Not including the NULL-termimator */
765 char *linkname; /* This is NULL-terminated */
766};
767
768struct devfs_inode { /* This structure is for "persistent" inode storage */
769 struct dentry *dentry;
770 struct timespec atime;
771 struct timespec mtime;
772 struct timespec ctime;
773 unsigned int ino; /* Inode number as seen in the VFS */
774 uid_t uid;
775 gid_t gid;
776};
777
778struct devfs_entry {
779#ifdef CONFIG_DEVFS_DEBUG
780 unsigned int magic_number;
781#endif
782 void *info;
783 atomic_t refcount; /* When this drops to zero, it's unused */
784 union {
785 struct directory_type dir;
786 dev_t dev;
787 struct symlink_type symlink;
788 const char *name; /* Only used for (mode == 0) */
789 } u;
790 struct devfs_entry *prev; /* Previous entry in the parent directory */
791 struct devfs_entry *next; /* Next entry in the parent directory */
792 struct devfs_entry *parent; /* The parent directory */
793 struct devfs_inode inode;
794 umode_t mode;
795 unsigned short namelen; /* I think 64k+ filenames are a way off... */
796 unsigned char vfs:1; /* Whether the VFS may delete the entry */
797 char name[1]; /* This is just a dummy: the allocated array
798 is bigger. This is NULL-terminated */
799};
800
801/* The root of the device tree */
802static struct devfs_entry *root_entry;
803
804struct devfsd_buf_entry {
805 struct devfs_entry *de; /* The name is generated with this */
806 unsigned short type; /* The type of event */
807 umode_t mode;
808 uid_t uid;
809 gid_t gid;
810 struct devfsd_buf_entry *next;
811};
812
813struct fs_info { /* This structure is for the mounted devfs */
814 struct super_block *sb;
815 spinlock_t devfsd_buffer_lock; /* Lock when inserting/deleting events */
816 struct devfsd_buf_entry *devfsd_first_event;
817 struct devfsd_buf_entry *devfsd_last_event;
818 volatile int devfsd_sleeping;
819 volatile struct task_struct *devfsd_task;
820 volatile pid_t devfsd_pgrp;
821 volatile struct file *devfsd_file;
822 struct devfsd_notify_struct *devfsd_info;
823 volatile unsigned long devfsd_event_mask;
824 atomic_t devfsd_overrun_count;
825 wait_queue_head_t devfsd_wait_queue; /* Wake devfsd on input */
826 wait_queue_head_t revalidate_wait_queue; /* Wake when devfsd sleeps */
827};
828
829static struct fs_info fs_info = {.devfsd_buffer_lock = SPIN_LOCK_UNLOCKED };
830static kmem_cache_t *devfsd_buf_cache;
831#ifdef CONFIG_DEVFS_DEBUG
832static unsigned int devfs_debug_init __initdata = DEBUG_NONE;
833static unsigned int devfs_debug = DEBUG_NONE;
834static DEFINE_SPINLOCK(stat_lock);
835static unsigned int stat_num_entries;
836static unsigned int stat_num_bytes;
837#endif
838static unsigned char poison_array[8] =
839 { 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a };
840
841#ifdef CONFIG_DEVFS_MOUNT
842static unsigned int boot_options = OPTION_MOUNT;
843#else
844static unsigned int boot_options = OPTION_NONE;
845#endif
846
847/* Forward function declarations */
848static devfs_handle_t _devfs_walk_path(struct devfs_entry *dir,
849 const char *name, int namelen,
850 int traverse_symlink);
851static ssize_t devfsd_read(struct file *file, char __user *buf, size_t len,
852 loff_t * ppos);
853static int devfsd_ioctl(struct inode *inode, struct file *file,
854 unsigned int cmd, unsigned long arg);
855static int devfsd_close(struct inode *inode, struct file *file);
856#ifdef CONFIG_DEVFS_DEBUG
857static ssize_t stat_read(struct file *file, char __user *buf, size_t len,
858 loff_t * ppos);
859static const struct file_operations stat_fops = {
860 .open = nonseekable_open,
861 .read = stat_read,
862};
863#endif
864
865/* Devfs daemon file operations */
866static const struct file_operations devfsd_fops = {
867 .open = nonseekable_open,
868 .read = devfsd_read,
869 .ioctl = devfsd_ioctl,
870 .release = devfsd_close,
871};
872
873/* Support functions follow */
874
875/**
876 * devfs_get - Get a reference to a devfs entry.
877 * @de: The devfs entry.
878 */
879
880static struct devfs_entry *devfs_get(struct devfs_entry *de)
881{
882 VERIFY_ENTRY(de);
883 if (de)
884 atomic_inc(&de->refcount);
885 return de;
886} /* End Function devfs_get */
887
888/**
889 * devfs_put - Put (release) a reference to a devfs entry.
890 * @de: The handle to the devfs entry.
891 */
892
893static void devfs_put(devfs_handle_t de)
894{
895 if (!de)
896 return;
897 VERIFY_ENTRY(de);
898 if (de->info == POISON_PTR)
899 OOPS("(%p): poisoned pointer\n", de);
900 if (!atomic_dec_and_test(&de->refcount))
901 return;
902 if (de == root_entry)
903 OOPS("(%p): root entry being freed\n", de);
904 DPRINTK(DEBUG_FREE, "(%s): de: %p, parent: %p \"%s\"\n",
905 de->name, de, de->parent,
906 de->parent ? de->parent->name : "no parent");
907 if (S_ISLNK(de->mode))
908 kfree(de->u.symlink.linkname);
909 WRITE_ENTRY_MAGIC(de, 0);
910#ifdef CONFIG_DEVFS_DEBUG
911 spin_lock(&stat_lock);
912 --stat_num_entries;
913 stat_num_bytes -= sizeof *de + de->namelen;
914 if (S_ISLNK(de->mode))
915 stat_num_bytes -= de->u.symlink.length + 1;
916 spin_unlock(&stat_lock);
917#endif
918 de->info = POISON_PTR;
919 kfree(de);
920} /* End Function devfs_put */
921
922/**
923 * _devfs_search_dir - Search for a devfs entry in a directory.
924 * @dir: The directory to search.
925 * @name: The name of the entry to search for.
926 * @namelen: The number of characters in @name.
927 *
928 * Search for a devfs entry in a directory and returns a pointer to the entry
929 * on success, else %NULL. The directory must be locked already.
930 * An implicit devfs_get() is performed on the returned entry.
931 */
932
933static struct devfs_entry *_devfs_search_dir(struct devfs_entry *dir,
934 const char *name,
935 unsigned int namelen)
936{
937 struct devfs_entry *curr;
938
939 if (!S_ISDIR(dir->mode)) {
940 PRINTK("(%s): not a directory\n", dir->name);
941 return NULL;
942 }
943 for (curr = dir->u.dir.first; curr != NULL; curr = curr->next) {
944 if (curr->namelen != namelen)
945 continue;
946 if (memcmp(curr->name, name, namelen) == 0)
947 break;
948 /* Not found: try the next one */
949 }
950 return devfs_get(curr);
951} /* End Function _devfs_search_dir */
952
953/**
954 * _devfs_alloc_entry - Allocate a devfs entry.
955 * @name: the name of the entry
956 * @namelen: the number of characters in @name
957 * @mode: the mode for the entry
958 *
959 * Allocate a devfs entry and returns a pointer to the entry on success, else
960 * %NULL.
961 */
962
963static struct devfs_entry *_devfs_alloc_entry(const char *name,
964 unsigned int namelen,
965 umode_t mode)
966{
967 struct devfs_entry *new;
968 static unsigned long inode_counter = FIRST_INODE;
969 static DEFINE_SPINLOCK(counter_lock);
970
971 if (name && (namelen < 1))
972 namelen = strlen(name);
973 if ((new = kmalloc(sizeof *new + namelen, GFP_KERNEL)) == NULL)
974 return NULL;
975 memset(new, 0, sizeof *new + namelen); /* Will set '\0' on name */
976 new->mode = mode;
977 if (S_ISDIR(mode))
978 rwlock_init(&new->u.dir.lock);
979 atomic_set(&new->refcount, 1);
980 spin_lock(&counter_lock);
981 new->inode.ino = inode_counter++;
982 spin_unlock(&counter_lock);
983 if (name)
984 memcpy(new->name, name, namelen);
985 new->namelen = namelen;
986 WRITE_ENTRY_MAGIC(new, MAGIC_VALUE);
987#ifdef CONFIG_DEVFS_DEBUG
988 spin_lock(&stat_lock);
989 ++stat_num_entries;
990 stat_num_bytes += sizeof *new + namelen;
991 spin_unlock(&stat_lock);
992#endif
993 return new;
994} /* End Function _devfs_alloc_entry */
995
996/**
997 * _devfs_append_entry - Append a devfs entry to a directory's child list.
998 * @dir: The directory to add to.
999 * @de: The devfs entry to append.
1000 * @old_de: If an existing entry exists, it will be written here. This may
1001 * be %NULL. An implicit devfs_get() is performed on this entry.
1002 *
1003 * Append a devfs entry to a directory's list of children, checking first to
1004 * see if an entry of the same name exists. The directory will be locked.
1005 * The value 0 is returned on success, else a negative error code.
1006 * On failure, an implicit devfs_put() is performed on %de.
1007 */
1008
1009static int _devfs_append_entry(devfs_handle_t dir, devfs_handle_t de,
1010 devfs_handle_t * old_de)
1011{
1012 int retval;
1013
1014 if (old_de)
1015 *old_de = NULL;
1016 if (!S_ISDIR(dir->mode)) {
1017 PRINTK("(%s): dir: \"%s\" is not a directory\n", de->name,
1018 dir->name);
1019 devfs_put(de);
1020 return -ENOTDIR;
1021 }
1022 write_lock(&dir->u.dir.lock);
1023 if (dir->u.dir.no_more_additions)
1024 retval = -ENOENT;
1025 else {
1026 struct devfs_entry *old;
1027
1028 old = _devfs_search_dir(dir, de->name, de->namelen);
1029 if (old_de)
1030 *old_de = old;
1031 else
1032 devfs_put(old);
1033 if (old == NULL) {
1034 de->parent = dir;
1035 de->prev = dir->u.dir.last;
1036 /* Append to the directory's list of children */
1037 if (dir->u.dir.first == NULL)
1038 dir->u.dir.first = de;
1039 else
1040 dir->u.dir.last->next = de;
1041 dir->u.dir.last = de;
1042 retval = 0;
1043 } else
1044 retval = -EEXIST;
1045 }
1046 write_unlock(&dir->u.dir.lock);
1047 if (retval)
1048 devfs_put(de);
1049 return retval;
1050} /* End Function _devfs_append_entry */
1051
1052/**
1053 * _devfs_get_root_entry - Get the root devfs entry.
1054 *
1055 * Returns the root devfs entry on success, else %NULL.
1056 *
1057 * TODO it must be called asynchronously due to the fact
1058 * that devfs is initialized relatively late. Proper way
1059 * is to remove module_init from init_devfs_fs and manually
1060 * call it early enough during system init
1061 */
1062
1063static struct devfs_entry *_devfs_get_root_entry(void)
1064{
1065 struct devfs_entry *new;
1066 static DEFINE_SPINLOCK(root_lock);
1067
1068 if (root_entry)
1069 return root_entry;
1070
1071 new = _devfs_alloc_entry(NULL, 0, MODE_DIR);
1072 if (new == NULL)
1073 return NULL;
1074
1075 spin_lock(&root_lock);
1076 if (root_entry) {
1077 spin_unlock(&root_lock);
1078 devfs_put(new);
1079 return root_entry;
1080 }
1081 root_entry = new;
1082 spin_unlock(&root_lock);
1083
1084 return root_entry;
1085} /* End Function _devfs_get_root_entry */
1086
1087/**
1088 * _devfs_descend - Descend down a tree using the next component name.
1089 * @dir: The directory to search.
1090 * @name: The component name to search for.
1091 * @namelen: The length of %name.
1092 * @next_pos: The position of the next '/' or '\0' is written here.
1093 *
1094 * Descend into a directory, searching for a component. This function forms
1095 * the core of a tree-walking algorithm. The directory will be locked.
1096 * The devfs entry corresponding to the component is returned. If there is
1097 * no matching entry, %NULL is returned.
1098 * An implicit devfs_get() is performed on the returned entry.
1099 */
1100
1101static struct devfs_entry *_devfs_descend(struct devfs_entry *dir,
1102 const char *name, int namelen,
1103 int *next_pos)
1104{
1105 const char *stop, *ptr;
1106 struct devfs_entry *entry;
1107
1108 if ((namelen >= 3) && (strncmp(name, "../", 3) == 0)) { /* Special-case going to parent directory */
1109 *next_pos = 3;
1110 return devfs_get(dir->parent);
1111 }
1112 stop = name + namelen;
1113 /* Search for a possible '/' */
1114 for (ptr = name; (ptr < stop) && (*ptr != '/'); ++ptr) ;
1115 *next_pos = ptr - name;
1116 read_lock(&dir->u.dir.lock);
1117 entry = _devfs_search_dir(dir, name, *next_pos);
1118 read_unlock(&dir->u.dir.lock);
1119 return entry;
1120} /* End Function _devfs_descend */
1121
1122static devfs_handle_t _devfs_make_parent_for_leaf(struct devfs_entry *dir,
1123 const char *name,
1124 int namelen, int *leaf_pos)
1125{
1126 int next_pos = 0;
1127
1128 if (dir == NULL)
1129 dir = _devfs_get_root_entry();
1130 if (dir == NULL)
1131 return NULL;
1132 devfs_get(dir);
1133 /* Search for possible trailing component and ignore it */
1134 for (--namelen; (namelen > 0) && (name[namelen] != '/'); --namelen) ;
1135 *leaf_pos = (name[namelen] == '/') ? (namelen + 1) : 0;
1136 for (; namelen > 0; name += next_pos, namelen -= next_pos) {
1137 struct devfs_entry *de, *old = NULL;
1138
1139 if ((de =
1140 _devfs_descend(dir, name, namelen, &next_pos)) == NULL) {
1141 de = _devfs_alloc_entry(name, next_pos, MODE_DIR);
1142 devfs_get(de);
1143 if (!de || _devfs_append_entry(dir, de, &old)) {
1144 devfs_put(de);
1145 if (!old || !S_ISDIR(old->mode)) {
1146 devfs_put(old);
1147 devfs_put(dir);
1148 return NULL;
1149 }
1150 de = old; /* Use the existing directory */
1151 }
1152 }
1153 if (de == dir->parent) {
1154 devfs_put(dir);
1155 devfs_put(de);
1156 return NULL;
1157 }
1158 devfs_put(dir);
1159 dir = de;
1160 if (name[next_pos] == '/')
1161 ++next_pos;
1162 }
1163 return dir;
1164} /* End Function _devfs_make_parent_for_leaf */
1165
1166static devfs_handle_t _devfs_prepare_leaf(devfs_handle_t * dir,
1167 const char *name, umode_t mode)
1168{
1169 int namelen, leaf_pos;
1170 struct devfs_entry *de;
1171
1172 namelen = strlen(name);
1173 if ((*dir = _devfs_make_parent_for_leaf(*dir, name, namelen,
1174 &leaf_pos)) == NULL) {
1175 PRINTK("(%s): could not create parent path\n", name);
1176 return NULL;
1177 }
1178 if ((de = _devfs_alloc_entry(name + leaf_pos, namelen - leaf_pos, mode))
1179 == NULL) {
1180 PRINTK("(%s): could not allocate entry\n", name);
1181 devfs_put(*dir);
1182 return NULL;
1183 }
1184 return de;
1185} /* End Function _devfs_prepare_leaf */
1186
1187static devfs_handle_t _devfs_walk_path(struct devfs_entry *dir,
1188 const char *name, int namelen,
1189 int traverse_symlink)
1190{
1191 int next_pos = 0;
1192
1193 if (dir == NULL)
1194 dir = _devfs_get_root_entry();
1195 if (dir == NULL)
1196 return NULL;
1197 devfs_get(dir);
1198 for (; namelen > 0; name += next_pos, namelen -= next_pos) {
1199 struct devfs_entry *de, *link;
1200
1201 if (!S_ISDIR(dir->mode)) {
1202 devfs_put(dir);
1203 return NULL;
1204 }
1205
1206 if ((de =
1207 _devfs_descend(dir, name, namelen, &next_pos)) == NULL) {
1208 devfs_put(dir);
1209 return NULL;
1210 }
1211 if (S_ISLNK(de->mode) && traverse_symlink) { /* Need to follow the link: this is a stack chomper */
1212 /* FIXME what if it puts outside of mounted tree? */
1213 link = _devfs_walk_path(dir, de->u.symlink.linkname,
1214 de->u.symlink.length, TRUE);
1215 devfs_put(de);
1216 if (!link) {
1217 devfs_put(dir);
1218 return NULL;
1219 }
1220 de = link;
1221 }
1222 devfs_put(dir);
1223 dir = de;
1224 if (name[next_pos] == '/')
1225 ++next_pos;
1226 }
1227 return dir;
1228} /* End Function _devfs_walk_path */
1229
1230/**
1231 * _devfs_find_entry - Find a devfs entry.
1232 * @dir: The handle to the parent devfs directory entry. If this is %NULL the
1233 * name is relative to the root of the devfs.
1234 * @name: The name of the entry. This may be %NULL.
1235 * @traverse_symlink: If %TRUE then symbolic links are traversed.
1236 *
1237 * Returns the devfs_entry pointer on success, else %NULL. An implicit
1238 * devfs_get() is performed.
1239 */
1240
1241static struct devfs_entry *_devfs_find_entry(devfs_handle_t dir,
1242 const char *name,
1243 int traverse_symlink)
1244{
1245 unsigned int namelen = strlen(name);
1246
1247 if (name[0] == '/') {
1248 /* Skip leading pathname component */
1249 if (namelen < 2) {
1250 PRINTK("(%s): too short\n", name);
1251 return NULL;
1252 }
1253 for (++name, --namelen; (*name != '/') && (namelen > 0);
1254 ++name, --namelen) ;
1255 if (namelen < 2) {
1256 PRINTK("(%s): too short\n", name);
1257 return NULL;
1258 }
1259 ++name;
1260 --namelen;
1261 }
1262 return _devfs_walk_path(dir, name, namelen, traverse_symlink);
1263} /* End Function _devfs_find_entry */
1264
1265static struct devfs_entry *get_devfs_entry_from_vfs_inode(struct inode *inode)
1266{
1267 if (inode == NULL)
1268 return NULL;
1269 VERIFY_ENTRY((struct devfs_entry *)inode->u.generic_ip);
1270 return inode->u.generic_ip;
1271} /* End Function get_devfs_entry_from_vfs_inode */
1272
1273/**
1274 * free_dentry - Free the dentry for a device entry and invalidate inode.
1275 * @de: The entry.
1276 *
1277 * This must only be called after the entry has been unhooked from its
1278 * parent directory.
1279 */
1280
1281static void free_dentry(struct devfs_entry *de)
1282{
1283 struct dentry *dentry = de->inode.dentry;
1284
1285 if (!dentry)
1286 return;
1287 spin_lock(&dcache_lock);
1288 dget_locked(dentry);
1289 spin_unlock(&dcache_lock);
1290 /* Forcefully remove the inode */
1291 if (dentry->d_inode != NULL)
1292 dentry->d_inode->i_nlink = 0;
1293 d_drop(dentry);
1294 dput(dentry);
1295} /* End Function free_dentry */
1296
1297/**
1298 * is_devfsd_or_child - Test if the current process is devfsd or one of its children.
1299 * @fs_info: The filesystem information.
1300 *
1301 * Returns %TRUE if devfsd or child, else %FALSE.
1302 */
1303
1304static int is_devfsd_or_child(struct fs_info *fs_info)
1305{
1306 struct task_struct *p = current;
1307
1308 if (p == fs_info->devfsd_task)
1309 return (TRUE);
1310 if (process_group(p) == fs_info->devfsd_pgrp)
1311 return (TRUE);
1312 read_lock(&tasklist_lock);
1313 for (; p != &init_task; p = p->real_parent) {
1314 if (p == fs_info->devfsd_task) {
1315 read_unlock(&tasklist_lock);
1316 return (TRUE);
1317 }
1318 }
1319 read_unlock(&tasklist_lock);
1320 return (FALSE);
1321} /* End Function is_devfsd_or_child */
1322
1323/**
1324 * devfsd_queue_empty - Test if devfsd has work pending in its event queue.
1325 * @fs_info: The filesystem information.
1326 *
1327 * Returns %TRUE if the queue is empty, else %FALSE.
1328 */
1329
1330static inline int devfsd_queue_empty(struct fs_info *fs_info)
1331{
1332 return (fs_info->devfsd_last_event) ? FALSE : TRUE;
1333} /* End Function devfsd_queue_empty */
1334
1335/**
1336 * wait_for_devfsd_finished - Wait for devfsd to finish processing its event queue.
1337 * @fs_info: The filesystem information.
1338 *
1339 * Returns %TRUE if no more waiting will be required, else %FALSE.
1340 */
1341
1342static int wait_for_devfsd_finished(struct fs_info *fs_info)
1343{
1344 DECLARE_WAITQUEUE(wait, current);
1345
1346 if (fs_info->devfsd_task == NULL)
1347 return (TRUE);
1348 if (devfsd_queue_empty(fs_info) && fs_info->devfsd_sleeping)
1349 return TRUE;
1350 if (is_devfsd_or_child(fs_info))
1351 return (FALSE);
1352 set_current_state(TASK_UNINTERRUPTIBLE);
1353 add_wait_queue(&fs_info->revalidate_wait_queue, &wait);
1354 if (!devfsd_queue_empty(fs_info) || !fs_info->devfsd_sleeping)
1355 if (fs_info->devfsd_task)
1356 schedule();
1357 remove_wait_queue(&fs_info->revalidate_wait_queue, &wait);
1358 __set_current_state(TASK_RUNNING);
1359 return (TRUE);
1360} /* End Function wait_for_devfsd_finished */
1361
1362/**
1363 * devfsd_notify_de - Notify the devfsd daemon of a change.
1364 * @de: The devfs entry that has changed. This and all parent entries will
1365 * have their reference counts incremented if the event was queued.
1366 * @type: The type of change.
1367 * @mode: The mode of the entry.
1368 * @uid: The user ID.
1369 * @gid: The group ID.
1370 * @fs_info: The filesystem info.
1371 *
1372 * Returns %TRUE if an event was queued and devfsd woken up, else %FALSE.
1373 */
1374
1375static int devfsd_notify_de(struct devfs_entry *de,
1376 unsigned short type, umode_t mode,
1377 uid_t uid, gid_t gid, struct fs_info *fs_info)
1378{
1379 struct devfsd_buf_entry *entry;
1380 struct devfs_entry *curr;
1381
1382 if (!(fs_info->devfsd_event_mask & (1 << type)))
1383 return (FALSE);
1384 if ((entry = kmem_cache_alloc(devfsd_buf_cache, SLAB_KERNEL)) == NULL) {
1385 atomic_inc(&fs_info->devfsd_overrun_count);
1386 return (FALSE);
1387 }
1388 for (curr = de; curr != NULL; curr = curr->parent)
1389 devfs_get(curr);
1390 entry->de = de;
1391 entry->type = type;
1392 entry->mode = mode;
1393 entry->uid = uid;
1394 entry->gid = gid;
1395 entry->next = NULL;
1396 spin_lock(&fs_info->devfsd_buffer_lock);
1397 if (!fs_info->devfsd_first_event)
1398 fs_info->devfsd_first_event = entry;
1399 if (fs_info->devfsd_last_event)
1400 fs_info->devfsd_last_event->next = entry;
1401 fs_info->devfsd_last_event = entry;
1402 spin_unlock(&fs_info->devfsd_buffer_lock);
1403 wake_up_interruptible(&fs_info->devfsd_wait_queue);
1404 return (TRUE);
1405} /* End Function devfsd_notify_de */
1406
1407/**
1408 * devfsd_notify - Notify the devfsd daemon of a change.
1409 * @de: The devfs entry that has changed.
1410 * @type: The type of change event.
1411 * @wait: If TRUE, the function waits for the daemon to finish processing
1412 * the event.
1413 */
1414
1415static void devfsd_notify(struct devfs_entry *de, unsigned short type)
1416{
1417 devfsd_notify_de(de, type, de->mode, current->euid,
1418 current->egid, &fs_info);
1419}
1420
1421static int devfs_mk_dev(dev_t dev, umode_t mode, const char *fmt, va_list args)
1422{
1423 struct devfs_entry *dir = NULL, *de;
1424 char buf[64];
1425 int error, n;
1426
1427 n = vsnprintf(buf, sizeof(buf), fmt, args);
1428 if (n >= sizeof(buf) || !buf[0]) {
1429 printk(KERN_WARNING "%s: invalid format string %s\n",
1430 __FUNCTION__, fmt);
1431 return -EINVAL;
1432 }
1433
1434 de = _devfs_prepare_leaf(&dir, buf, mode);
1435 if (!de) {
1436 printk(KERN_WARNING "%s: could not prepare leaf for %s\n",
1437 __FUNCTION__, buf);
1438 return -ENOMEM; /* could be more accurate... */
1439 }
1440
1441 de->u.dev = dev;
1442
1443 error = _devfs_append_entry(dir, de, NULL);
1444 if (error) {
1445 printk(KERN_WARNING "%s: could not append to parent for %s\n",
1446 __FUNCTION__, buf);
1447 goto out;
1448 }
1449
1450 devfsd_notify(de, DEVFSD_NOTIFY_REGISTERED);
1451 out:
1452 devfs_put(dir);
1453 return error;
1454}
1455
1456int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...)
1457{
1458 va_list args;
1459
1460 if (!S_ISBLK(mode)) {
1461 printk(KERN_WARNING "%s: invalide mode (%u) for %s\n",
1462 __FUNCTION__, mode, fmt);
1463 return -EINVAL;
1464 }
1465
1466 va_start(args, fmt);
1467 return devfs_mk_dev(dev, mode, fmt, args);
1468}
1469
1470EXPORT_SYMBOL(devfs_mk_bdev);
1471
1472int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...)
1473{
1474 va_list args;
1475
1476 if (!S_ISCHR(mode)) {
1477 printk(KERN_WARNING "%s: invalide mode (%u) for %s\n",
1478 __FUNCTION__, mode, fmt);
1479 return -EINVAL;
1480 }
1481
1482 va_start(args, fmt);
1483 return devfs_mk_dev(dev, mode, fmt, args);
1484}
1485
1486EXPORT_SYMBOL(devfs_mk_cdev);
1487
1488/**
1489 * _devfs_unhook - Unhook a device entry from its parents list
1490 * @de: The entry to unhook.
1491 *
1492 * Returns %TRUE if the entry was unhooked, else %FALSE if it was
1493 * previously unhooked.
1494 * The caller must have a write lock on the parent directory.
1495 */
1496
1497static int _devfs_unhook(struct devfs_entry *de)
1498{
1499 struct devfs_entry *parent;
1500
1501 if (!de || (de->prev == de))
1502 return FALSE;
1503 parent = de->parent;
1504 if (de->prev == NULL)
1505 parent->u.dir.first = de->next;
1506 else
1507 de->prev->next = de->next;
1508 if (de->next == NULL)
1509 parent->u.dir.last = de->prev;
1510 else
1511 de->next->prev = de->prev;
1512 de->prev = de; /* Indicate we're unhooked */
1513 de->next = NULL; /* Force early termination for <devfs_readdir> */
1514 return TRUE;
1515} /* End Function _devfs_unhook */
1516
1517/**
1518 * _devfs_unregister - Unregister a device entry from its parent.
1519 * @dir: The parent directory.
1520 * @de: The entry to unregister.
1521 *
1522 * The caller must have a write lock on the parent directory, which is
1523 * unlocked by this function.
1524 */
1525
1526static void _devfs_unregister(struct devfs_entry *dir, struct devfs_entry *de)
1527{
1528 int unhooked = _devfs_unhook(de);
1529
1530 write_unlock(&dir->u.dir.lock);
1531 if (!unhooked)
1532 return;
1533 devfs_get(dir);
1534 devfsd_notify(de, DEVFSD_NOTIFY_UNREGISTERED);
1535 free_dentry(de);
1536 devfs_put(dir);
1537 if (!S_ISDIR(de->mode))
1538 return;
1539 while (TRUE) { /* Recursively unregister: this is a stack chomper */
1540 struct devfs_entry *child;
1541
1542 write_lock(&de->u.dir.lock);
1543 de->u.dir.no_more_additions = TRUE;
1544 child = de->u.dir.first;
1545 VERIFY_ENTRY(child);
1546 _devfs_unregister(de, child);
1547 if (!child)
1548 break;
1549 DPRINTK(DEBUG_UNREGISTER, "(%s): child: %p refcount: %d\n",
1550 child->name, child, atomic_read(&child->refcount));
1551 devfs_put(child);
1552 }
1553} /* End Function _devfs_unregister */
1554
1555static int devfs_do_symlink(devfs_handle_t dir, const char *name,
1556 const char *link, devfs_handle_t * handle)
1557{
1558 int err;
1559 unsigned int linklength;
1560 char *newlink;
1561 struct devfs_entry *de;
1562
1563 if (handle != NULL)
1564 *handle = NULL;
1565 if (name == NULL) {
1566 PRINTK("(): NULL name pointer\n");
1567 return -EINVAL;
1568 }
1569 if (link == NULL) {
1570 PRINTK("(%s): NULL link pointer\n", name);
1571 return -EINVAL;
1572 }
1573 linklength = strlen(link);
1574 if ((newlink = kmalloc(linklength + 1, GFP_KERNEL)) == NULL)
1575 return -ENOMEM;
1576 memcpy(newlink, link, linklength);
1577 newlink[linklength] = '\0';
1578 if ((de = _devfs_prepare_leaf(&dir, name, S_IFLNK | S_IRUGO | S_IXUGO))
1579 == NULL) {
1580 PRINTK("(%s): could not prepare leaf\n", name);
1581 kfree(newlink);
1582 return -ENOTDIR;
1583 }
1584 de->info = NULL;
1585 de->u.symlink.linkname = newlink;
1586 de->u.symlink.length = linklength;
1587 if ((err = _devfs_append_entry(dir, de, NULL)) != 0) {
1588 PRINTK("(%s): could not append to parent, err: %d\n", name,
1589 err);
1590 devfs_put(dir);
1591 return err;
1592 }
1593 devfs_put(dir);
1594#ifdef CONFIG_DEVFS_DEBUG
1595 spin_lock(&stat_lock);
1596 stat_num_bytes += linklength + 1;
1597 spin_unlock(&stat_lock);
1598#endif
1599 if (handle != NULL)
1600 *handle = de;
1601 return 0;
1602} /* End Function devfs_do_symlink */
1603
1604/**
1605 * devfs_mk_symlink Create a symbolic link in the devfs namespace.
1606 * @from: The name of the entry.
1607 * @to: Name of the destination
1608 *
1609 * Returns 0 on success, else a negative error code is returned.
1610 */
1611
1612int devfs_mk_symlink(const char *from, const char *to)
1613{
1614 devfs_handle_t de;
1615 int err;
1616
1617 err = devfs_do_symlink(NULL, from, to, &de);
1618 if (!err) {
1619 de->vfs = TRUE;
1620 devfsd_notify(de, DEVFSD_NOTIFY_REGISTERED);
1621 }
1622
1623 return err;
1624}
1625
1626/**
1627 * devfs_mk_dir - Create a directory in the devfs namespace.
1628 * new name is relative to the root of the devfs.
1629 * @fmt: The name of the entry.
1630 *
1631 * Use of this function is optional. The devfs_register() function
1632 * will automatically create intermediate directories as needed. This function
1633 * is provided for efficiency reasons, as it provides a handle to a directory.
1634 * On failure %NULL is returned.
1635 */
1636
1637int devfs_mk_dir(const char *fmt, ...)
1638{
1639 struct devfs_entry *dir = NULL, *de = NULL, *old;
1640 char buf[64];
1641 va_list args;
1642 int error, n;
1643
1644 va_start(args, fmt);
1645 n = vsnprintf(buf, 64, fmt, args);
1646 if (n >= 64 || !buf[0]) {
1647 printk(KERN_WARNING "%s: invalid argument.", __FUNCTION__);
1648 return -EINVAL;
1649 }
1650
1651 de = _devfs_prepare_leaf(&dir, buf, MODE_DIR);
1652 if (!de) {
1653 PRINTK("(%s): could not prepare leaf\n", buf);
1654 return -EINVAL;
1655 }
1656
1657 error = _devfs_append_entry(dir, de, &old);
1658 if (error == -EEXIST && S_ISDIR(old->mode)) {
1659 /*
1660 * devfs_mk_dir() of an already-existing directory will
1661 * return success.
1662 */
1663 error = 0;
1664 goto out_put;
1665 } else if (error) {
1666 PRINTK("(%s): could not append to dir: %p \"%s\"\n",
1667 buf, dir, dir->name);
1668 devfs_put(old);
1669 goto out_put;
1670 }
1671
1672 devfsd_notify(de, DEVFSD_NOTIFY_REGISTERED);
1673
1674 out_put:
1675 devfs_put(dir);
1676 return error;
1677}
1678
1679void devfs_remove(const char *fmt, ...)
1680{
1681 char buf[64];
1682 va_list args;
1683 int n;
1684
1685 va_start(args, fmt);
1686 n = vsnprintf(buf, sizeof(buf), fmt, args);
1687 if (n < sizeof(buf) && buf[0]) {
1688 devfs_handle_t de = _devfs_find_entry(NULL, buf, 0);
1689
1690 if (!de) {
1691 printk(KERN_ERR "%s: %s not found, cannot remove\n",
1692 __FUNCTION__, buf);
1693 dump_stack();
1694 return;
1695 }
1696
1697 write_lock(&de->parent->u.dir.lock);
1698 _devfs_unregister(de->parent, de);
1699 devfs_put(de);
1700 devfs_put(de);
1701 }
1702}
1703
1704/**
1705 * devfs_generate_path - Generate a pathname for an entry, relative to the devfs root.
1706 * @de: The devfs entry.
1707 * @path: The buffer to write the pathname to. The pathname and '\0'
1708 * terminator will be written at the end of the buffer.
1709 * @buflen: The length of the buffer.
1710 *
1711 * Returns the offset in the buffer where the pathname starts on success,
1712 * else a negative error code.
1713 */
1714
1715static int devfs_generate_path(devfs_handle_t de, char *path, int buflen)
1716{
1717 int pos;
1718#define NAMEOF(de) ( (de)->mode ? (de)->name : (de)->u.name )
1719
1720 if (de == NULL)
1721 return -EINVAL;
1722 VERIFY_ENTRY(de);
1723 if (de->namelen >= buflen)
1724 return -ENAMETOOLONG; /* Must be first */
1725 path[buflen - 1] = '\0';
1726 if (de->parent == NULL)
1727 return buflen - 1; /* Don't prepend root */
1728 pos = buflen - de->namelen - 1;
1729 memcpy(path + pos, NAMEOF(de), de->namelen);
1730 for (de = de->parent; de->parent != NULL; de = de->parent) {
1731 if (pos - de->namelen - 1 < 0)
1732 return -ENAMETOOLONG;
1733 path[--pos] = '/';
1734 pos -= de->namelen;
1735 memcpy(path + pos, NAMEOF(de), de->namelen);
1736 }
1737 return pos;
1738} /* End Function devfs_generate_path */
1739
1740/**
1741 * devfs_setup - Process kernel boot options.
1742 * @str: The boot options after the "devfs=".
1743 */
1744
1745static int __init devfs_setup(char *str)
1746{
1747 static struct {
1748 char *name;
1749 unsigned int mask;
1750 unsigned int *opt;
1751 } devfs_options_tab[] __initdata = {
1752#ifdef CONFIG_DEVFS_DEBUG
1753 {
1754 "dall", DEBUG_ALL, &devfs_debug_init}, {
1755 "dmod", DEBUG_MODULE_LOAD, &devfs_debug_init}, {
1756 "dreg", DEBUG_REGISTER, &devfs_debug_init}, {
1757 "dunreg", DEBUG_UNREGISTER, &devfs_debug_init}, {
1758 "dfree", DEBUG_FREE, &devfs_debug_init}, {
1759 "diget", DEBUG_I_GET, &devfs_debug_init}, {
1760 "dchange", DEBUG_SET_FLAGS, &devfs_debug_init}, {
1761 "dsread", DEBUG_S_READ, &devfs_debug_init}, {
1762 "dichange", DEBUG_I_CHANGE, &devfs_debug_init}, {
1763 "dimknod", DEBUG_I_MKNOD, &devfs_debug_init}, {
1764 "dilookup", DEBUG_I_LOOKUP, &devfs_debug_init}, {
1765 "diunlink", DEBUG_I_UNLINK, &devfs_debug_init},
1766#endif /* CONFIG_DEVFS_DEBUG */
1767 {
1768 "mount", OPTION_MOUNT, &boot_options}, {
1769 NULL, 0, NULL}
1770 };
1771
1772 while ((*str != '\0') && !isspace(*str)) {
1773 int i, found = 0, invert = 0;
1774
1775 if (strncmp(str, "no", 2) == 0) {
1776 invert = 1;
1777 str += 2;
1778 }
1779 for (i = 0; devfs_options_tab[i].name != NULL; i++) {
1780 int len = strlen(devfs_options_tab[i].name);
1781
1782 if (strncmp(str, devfs_options_tab[i].name, len) == 0) {
1783 if (invert)
1784 *devfs_options_tab[i].opt &=
1785 ~devfs_options_tab[i].mask;
1786 else
1787 *devfs_options_tab[i].opt |=
1788 devfs_options_tab[i].mask;
1789 str += len;
1790 found = 1;
1791 break;
1792 }
1793 }
1794 if (!found)
1795 return 0; /* No match */
1796 if (*str != ',')
1797 return 0; /* No more options */
1798 ++str;
1799 }
1800 return 1;
1801} /* End Function devfs_setup */
1802
1803__setup("devfs=", devfs_setup);
1804
1805EXPORT_SYMBOL(devfs_mk_dir);
1806EXPORT_SYMBOL(devfs_remove);
1807
1808/**
1809 * try_modload - Notify devfsd of an inode lookup by a non-devfsd process.
1810 * @parent: The parent devfs entry.
1811 * @fs_info: The filesystem info.
1812 * @name: The device name.
1813 * @namelen: The number of characters in @name.
1814 * @buf: A working area that will be used. This must not go out of scope
1815 * until devfsd is idle again.
1816 *
1817 * Returns 0 on success (event was queued), else a negative error code.
1818 */
1819
1820static int try_modload(struct devfs_entry *parent, struct fs_info *fs_info,
1821 const char *name, unsigned namelen,
1822 struct devfs_entry *buf)
1823{
1824 if (!(fs_info->devfsd_event_mask & (1 << DEVFSD_NOTIFY_LOOKUP)))
1825 return -ENOENT;
1826 if (is_devfsd_or_child(fs_info))
1827 return -ENOENT;
1828 memset(buf, 0, sizeof *buf);
1829 atomic_set(&buf->refcount, 1);
1830 buf->parent = parent;
1831 buf->namelen = namelen;
1832 buf->u.name = name;
1833 WRITE_ENTRY_MAGIC(buf, MAGIC_VALUE);
1834 if (!devfsd_notify_de(buf, DEVFSD_NOTIFY_LOOKUP, 0,
1835 current->euid, current->egid, fs_info))
1836 return -ENOENT;
1837 /* Possible success: event has been queued */
1838 return 0;
1839} /* End Function try_modload */
1840
1841/* Superblock operations follow */
1842
1843static struct inode_operations devfs_iops;
1844static struct inode_operations devfs_dir_iops;
1845static const struct file_operations devfs_fops;
1846static const struct file_operations devfs_dir_fops;
1847static struct inode_operations devfs_symlink_iops;
1848
1849static int devfs_notify_change(struct dentry *dentry, struct iattr *iattr)
1850{
1851 int retval;
1852 struct devfs_entry *de;
1853 struct inode *inode = dentry->d_inode;
1854 struct fs_info *fs_info = inode->i_sb->s_fs_info;
1855
1856 de = get_devfs_entry_from_vfs_inode(inode);
1857 if (de == NULL)
1858 return -ENODEV;
1859 retval = inode_change_ok(inode, iattr);
1860 if (retval != 0)
1861 return retval;
1862 retval = inode_setattr(inode, iattr);
1863 if (retval != 0)
1864 return retval;
1865 DPRINTK(DEBUG_I_CHANGE, "(%d): VFS inode: %p devfs_entry: %p\n",
1866 (int)inode->i_ino, inode, de);
1867 DPRINTK(DEBUG_I_CHANGE, "(): mode: 0%o uid: %d gid: %d\n",
1868 (int)inode->i_mode, (int)inode->i_uid, (int)inode->i_gid);
1869 /* Inode is not on hash chains, thus must save permissions here rather
1870 than in a write_inode() method */
1871 de->mode = inode->i_mode;
1872 de->inode.uid = inode->i_uid;
1873 de->inode.gid = inode->i_gid;
1874 de->inode.atime = inode->i_atime;
1875 de->inode.mtime = inode->i_mtime;
1876 de->inode.ctime = inode->i_ctime;
1877 if ((iattr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) &&
1878 !is_devfsd_or_child(fs_info))
1879 devfsd_notify_de(de, DEVFSD_NOTIFY_CHANGE, inode->i_mode,
1880 inode->i_uid, inode->i_gid, fs_info);
1881 return 0;
1882} /* End Function devfs_notify_change */
1883
1884static struct super_operations devfs_sops = {
1885 .drop_inode = generic_delete_inode,
1886 .statfs = simple_statfs,
1887};
1888
1889/**
1890 * _devfs_get_vfs_inode - Get a VFS inode.
1891 * @sb: The super block.
1892 * @de: The devfs inode.
1893 * @dentry: The dentry to register with the devfs inode.
1894 *
1895 * Returns the inode on success, else %NULL. An implicit devfs_get() is
1896 * performed if the inode is created.
1897 */
1898
1899static struct inode *_devfs_get_vfs_inode(struct super_block *sb,
1900 struct devfs_entry *de,
1901 struct dentry *dentry)
1902{
1903 struct inode *inode;
1904
1905 if (de->prev == de)
1906 return NULL; /* Quick check to see if unhooked */
1907 if ((inode = new_inode(sb)) == NULL) {
1908 PRINTK("(%s): new_inode() failed, de: %p\n", de->name, de);
1909 return NULL;
1910 }
1911 if (de->parent) {
1912 read_lock(&de->parent->u.dir.lock);
1913 if (de->prev != de)
1914 de->inode.dentry = dentry; /* Not unhooked */
1915 read_unlock(&de->parent->u.dir.lock);
1916 } else
1917 de->inode.dentry = dentry; /* Root: no locking needed */
1918 if (de->inode.dentry != dentry) { /* Must have been unhooked */
1919 iput(inode);
1920 return NULL;
1921 }
1922 /* FIXME where is devfs_put? */
1923 inode->u.generic_ip = devfs_get(de);
1924 inode->i_ino = de->inode.ino;
1925 DPRINTK(DEBUG_I_GET, "(%d): VFS inode: %p devfs_entry: %p\n",
1926 (int)inode->i_ino, inode, de);
1927 inode->i_blocks = 0;
1928 inode->i_blksize = FAKE_BLOCK_SIZE;
1929 inode->i_op = &devfs_iops;
1930 inode->i_mode = de->mode;
1931 if (S_ISDIR(de->mode)) {
1932 inode->i_op = &devfs_dir_iops;
1933 inode->i_fop = &devfs_dir_fops;
1934 } else if (S_ISLNK(de->mode)) {
1935 inode->i_op = &devfs_symlink_iops;
1936 inode->i_size = de->u.symlink.length;
1937 } else if (S_ISCHR(de->mode) || S_ISBLK(de->mode)) {
1938 init_special_inode(inode, de->mode, de->u.dev);
1939 } else if (S_ISFIFO(de->mode) || S_ISSOCK(de->mode)) {
1940 init_special_inode(inode, de->mode, 0);
1941 } else {
1942 PRINTK("(%s): unknown mode %o de: %p\n",
1943 de->name, de->mode, de);
1944 iput(inode);
1945 devfs_put(de);
1946 return NULL;
1947 }
1948
1949 inode->i_uid = de->inode.uid;
1950 inode->i_gid = de->inode.gid;
1951 inode->i_atime = de->inode.atime;
1952 inode->i_mtime = de->inode.mtime;
1953 inode->i_ctime = de->inode.ctime;
1954 DPRINTK(DEBUG_I_GET, "(): mode: 0%o uid: %d gid: %d\n",
1955 (int)inode->i_mode, (int)inode->i_uid, (int)inode->i_gid);
1956 return inode;
1957} /* End Function _devfs_get_vfs_inode */
1958
1959/* File operations for device entries follow */
1960
1961static int devfs_readdir(struct file *file, void *dirent, filldir_t filldir)
1962{
1963 int err, count;
1964 int stored = 0;
1965 struct fs_info *fs_info;
1966 struct devfs_entry *parent, *de, *next = NULL;
1967 struct inode *inode = file->f_dentry->d_inode;
1968
1969 fs_info = inode->i_sb->s_fs_info;
1970 parent = get_devfs_entry_from_vfs_inode(file->f_dentry->d_inode);
1971 if ((long)file->f_pos < 0)
1972 return -EINVAL;
1973 DPRINTK(DEBUG_F_READDIR, "(%s): fs_info: %p pos: %ld\n",
1974 parent->name, fs_info, (long)file->f_pos);
1975 switch ((long)file->f_pos) {
1976 case 0:
1977 err = (*filldir) (dirent, "..", 2, file->f_pos,
1978 parent_ino(file->f_dentry), DT_DIR);
1979 if (err == -EINVAL)
1980 break;
1981 if (err < 0)
1982 return err;
1983 file->f_pos++;
1984 ++stored;
1985 /* Fall through */
1986 case 1:
1987 err =
1988 (*filldir) (dirent, ".", 1, file->f_pos, inode->i_ino,
1989 DT_DIR);
1990 if (err == -EINVAL)
1991 break;
1992 if (err < 0)
1993 return err;
1994 file->f_pos++;
1995 ++stored;
1996 /* Fall through */
1997 default:
1998 /* Skip entries */
1999 count = file->f_pos - 2;
2000 read_lock(&parent->u.dir.lock);
2001 for (de = parent->u.dir.first; de && (count > 0); de = de->next)
2002 --count;
2003 devfs_get(de);
2004 read_unlock(&parent->u.dir.lock);
2005 /* Now add all remaining entries */
2006 while (de) {
2007 err = (*filldir) (dirent, de->name, de->namelen,
2008 file->f_pos, de->inode.ino,
2009 de->mode >> 12);
2010 if (err < 0)
2011 devfs_put(de);
2012 else {
2013 file->f_pos++;
2014 ++stored;
2015 }
2016 if (err == -EINVAL)
2017 break;
2018 if (err < 0)
2019 return err;
2020 read_lock(&parent->u.dir.lock);
2021 next = devfs_get(de->next);
2022 read_unlock(&parent->u.dir.lock);
2023 devfs_put(de);
2024 de = next;
2025 }
2026 break;
2027 }
2028 return stored;
2029} /* End Function devfs_readdir */
2030
2031/* Open devfs specific special files */
2032static int devfs_open(struct inode *inode, struct file *file)
2033{
2034 int err;
2035 int minor = MINOR(inode->i_rdev);
2036 struct file_operations *old_fops, *new_fops;
2037
2038 switch (minor) {
2039 case 0: /* /dev/.devfsd */
2040 new_fops = fops_get(&devfsd_fops);
2041 break;
2042#ifdef CONFIG_DEVFS_DEBUG
2043 case 1: /* /dev/.stat */
2044 new_fops = fops_get(&stat_fops);
2045 break;
2046#endif
2047 default:
2048 return -ENODEV;
2049 }
2050
2051 if (new_fops == NULL)
2052 return -ENODEV;
2053 old_fops = file->f_op;
2054 file->f_op = new_fops;
2055 err = new_fops->open ? new_fops->open(inode, file) : 0;
2056 if (err) {
2057 file->f_op = old_fops;
2058 fops_put(new_fops);
2059 } else
2060 fops_put(old_fops);
2061 return err;
2062} /* End Function devfs_open */
2063
2064static const struct file_operations devfs_fops = {
2065 .open = devfs_open,
2066};
2067
2068static const struct file_operations devfs_dir_fops = {
2069 .read = generic_read_dir,
2070 .readdir = devfs_readdir,
2071};
2072
2073/* Dentry operations for device entries follow */
2074
2075/**
2076 * devfs_d_release - Callback for when a dentry is freed.
2077 * @dentry: The dentry.
2078 */
2079
2080static void devfs_d_release(struct dentry *dentry)
2081{
2082 DPRINTK(DEBUG_D_RELEASE, "(%p): inode: %p\n", dentry, dentry->d_inode);
2083} /* End Function devfs_d_release */
2084
2085/**
2086 * devfs_d_iput - Callback for when a dentry loses its inode.
2087 * @dentry: The dentry.
2088 * @inode: The inode.
2089 */
2090
2091static void devfs_d_iput(struct dentry *dentry, struct inode *inode)
2092{
2093 struct devfs_entry *de;
2094
2095 de = get_devfs_entry_from_vfs_inode(inode);
2096 DPRINTK(DEBUG_D_IPUT,
2097 "(%s): dentry: %p inode: %p de: %p de->dentry: %p\n", de->name,
2098 dentry, inode, de, de->inode.dentry);
2099 if (de->inode.dentry && (de->inode.dentry != dentry))
2100 OOPS("(%s): de: %p dentry: %p de->dentry: %p\n",
2101 de->name, de, dentry, de->inode.dentry);
2102 de->inode.dentry = NULL;
2103 iput(inode);
2104 devfs_put(de);
2105} /* End Function devfs_d_iput */
2106
2107static int devfs_d_delete(struct dentry *dentry);
2108
2109static struct dentry_operations devfs_dops = {
2110 .d_delete = devfs_d_delete,
2111 .d_release = devfs_d_release,
2112 .d_iput = devfs_d_iput,
2113};
2114
2115static int devfs_d_revalidate_wait(struct dentry *dentry, struct nameidata *);
2116
2117static struct dentry_operations devfs_wait_dops = {
2118 .d_delete = devfs_d_delete,
2119 .d_release = devfs_d_release,
2120 .d_iput = devfs_d_iput,
2121 .d_revalidate = devfs_d_revalidate_wait,
2122};
2123
2124/**
2125 * devfs_d_delete - Callback for when all files for a dentry are closed.
2126 * @dentry: The dentry.
2127 */
2128
2129static int devfs_d_delete(struct dentry *dentry)
2130{
2131 struct inode *inode = dentry->d_inode;
2132
2133 if (dentry->d_op == &devfs_wait_dops)
2134 dentry->d_op = &devfs_dops;
2135 /* Unhash dentry if negative (has no inode) */
2136 if (inode == NULL) {
2137 DPRINTK(DEBUG_D_DELETE, "(%p): dropping negative dentry\n",
2138 dentry);
2139 return 1;
2140 }
2141 return 0;
2142} /* End Function devfs_d_delete */
2143
2144struct devfs_lookup_struct {
2145 devfs_handle_t de;
2146 wait_queue_head_t wait_queue;
2147};
2148
2149/* XXX: this doesn't handle the case where we got a negative dentry
2150 but a devfs entry has been registered in the meanwhile */
2151static int devfs_d_revalidate_wait(struct dentry *dentry, struct nameidata *nd)
2152{
2153 struct inode *dir = dentry->d_parent->d_inode;
2154 struct fs_info *fs_info = dir->i_sb->s_fs_info;
2155 devfs_handle_t parent = get_devfs_entry_from_vfs_inode(dir);
2156 struct devfs_lookup_struct *lookup_info = dentry->d_fsdata;
2157 DECLARE_WAITQUEUE(wait, current);
2158 int need_lock;
2159
2160 /*
2161 * FIXME HACK
2162 *
2163 * make sure that
2164 * d_instantiate always runs under lock
2165 * we release i_mutex lock before going to sleep
2166 *
2167 * unfortunately sometimes d_revalidate is called with
2168 * and sometimes without i_mutex lock held. The following checks
2169 * attempt to deduce when we need to add (and drop resp.) lock
2170 * here. This relies on current (2.6.2) calling coventions:
2171 *
2172 * lookup_hash is always run under i_mutex and is passing NULL
2173 * as nd
2174 *
2175 * open(...,O_CREATE,...) calls _lookup_hash under i_mutex
2176 * and sets flags to LOOKUP_OPEN|LOOKUP_CREATE
2177 *
2178 * all other invocations of ->d_revalidate seem to happen
2179 * outside of i_mutex
2180 */
2181 need_lock = nd &&
2182 (!(nd->flags & LOOKUP_CREATE) || (nd->flags & LOOKUP_PARENT));
2183
2184 if (need_lock)
2185 mutex_lock(&dir->i_mutex);
2186
2187 if (is_devfsd_or_child(fs_info)) {
2188 devfs_handle_t de = lookup_info->de;
2189 struct inode *inode;
2190
2191 DPRINTK(DEBUG_I_LOOKUP,
2192 "(%s): dentry: %p inode: %p de: %p by: \"%s\"\n",
2193 dentry->d_name.name, dentry, dentry->d_inode, de,
2194 current->comm);
2195 if (dentry->d_inode)
2196 goto out;
2197 if (de == NULL) {
2198 read_lock(&parent->u.dir.lock);
2199 de = _devfs_search_dir(parent, dentry->d_name.name,
2200 dentry->d_name.len);
2201 read_unlock(&parent->u.dir.lock);
2202 if (de == NULL)
2203 goto out;
2204 lookup_info->de = de;
2205 }
2206 /* Create an inode, now that the driver information is available */
2207 inode = _devfs_get_vfs_inode(dir->i_sb, de, dentry);
2208 if (!inode)
2209 goto out;
2210 DPRINTK(DEBUG_I_LOOKUP,
2211 "(%s): new VFS inode(%u): %p de: %p by: \"%s\"\n",
2212 de->name, de->inode.ino, inode, de, current->comm);
2213 d_instantiate(dentry, inode);
2214 goto out;
2215 }
2216 if (lookup_info == NULL)
2217 goto out; /* Early termination */
2218 read_lock(&parent->u.dir.lock);
2219 if (dentry->d_fsdata) {
2220 set_current_state(TASK_UNINTERRUPTIBLE);
2221 add_wait_queue(&lookup_info->wait_queue, &wait);
2222 read_unlock(&parent->u.dir.lock);
2223 /* at this point it is always (hopefully) locked */
2224 mutex_unlock(&dir->i_mutex);
2225 schedule();
2226 mutex_lock(&dir->i_mutex);
2227 /*
2228 * This does not need nor should remove wait from wait_queue.
2229 * Wait queue head is never reused - nothing is ever added to it
2230 * after all waiters have been waked up and head itself disappears
2231 * very soon after it. Moreover it is local variable on stack that
2232 * is likely to have already disappeared so any reference to it
2233 * at this point is buggy.
2234 */
2235
2236 } else
2237 read_unlock(&parent->u.dir.lock);
2238
2239 out:
2240 if (need_lock)
2241 mutex_unlock(&dir->i_mutex);
2242 return 1;
2243} /* End Function devfs_d_revalidate_wait */
2244
2245/* Inode operations for device entries follow */
2246
2247static struct dentry *devfs_lookup(struct inode *dir, struct dentry *dentry,
2248 struct nameidata *nd)
2249{
2250 struct devfs_entry tmp; /* Must stay in scope until devfsd idle again */
2251 struct devfs_lookup_struct lookup_info;
2252 struct fs_info *fs_info = dir->i_sb->s_fs_info;
2253 struct devfs_entry *parent, *de;
2254 struct inode *inode;
2255 struct dentry *retval = NULL;
2256
2257 /* Set up the dentry operations before anything else, to ensure cleaning
2258 up on any error */
2259 dentry->d_op = &devfs_dops;
2260 /* First try to get the devfs entry for this directory */
2261 parent = get_devfs_entry_from_vfs_inode(dir);
2262 DPRINTK(DEBUG_I_LOOKUP, "(%s): dentry: %p parent: %p by: \"%s\"\n",
2263 dentry->d_name.name, dentry, parent, current->comm);
2264 if (parent == NULL)
2265 return ERR_PTR(-ENOENT);
2266 read_lock(&parent->u.dir.lock);
2267 de = _devfs_search_dir(parent, dentry->d_name.name, dentry->d_name.len);
2268 read_unlock(&parent->u.dir.lock);
2269 lookup_info.de = de;
2270 init_waitqueue_head(&lookup_info.wait_queue);
2271 dentry->d_fsdata = &lookup_info;
2272 if (de == NULL) { /* Try with devfsd. For any kind of failure, leave a negative dentry
2273 so someone else can deal with it (in the case where the sysadmin
2274 does a mknod()). It's important to do this before hashing the
2275 dentry, so that the devfsd queue is filled before revalidates
2276 can start */
2277 if (try_modload(parent, fs_info, dentry->d_name.name, dentry->d_name.len, &tmp) < 0) { /* Lookup event was not queued to devfsd */
2278 d_add(dentry, NULL);
2279 return NULL;
2280 }
2281 }
2282 dentry->d_op = &devfs_wait_dops;
2283 d_add(dentry, NULL); /* Open the floodgates */
2284 /* Unlock directory semaphore, which will release any waiters. They
2285 will get the hashed dentry, and may be forced to wait for
2286 revalidation */
2287 mutex_unlock(&dir->i_mutex);
2288 wait_for_devfsd_finished(fs_info); /* If I'm not devfsd, must wait */
2289 mutex_lock(&dir->i_mutex); /* Grab it again because them's the rules */
2290 de = lookup_info.de;
2291 /* If someone else has been so kind as to make the inode, we go home
2292 early */
2293 if (dentry->d_inode)
2294 goto out;
2295 if (de == NULL) {
2296 read_lock(&parent->u.dir.lock);
2297 de = _devfs_search_dir(parent, dentry->d_name.name,
2298 dentry->d_name.len);
2299 read_unlock(&parent->u.dir.lock);
2300 if (de == NULL)
2301 goto out;
2302 /* OK, there's an entry now, but no VFS inode yet */
2303 }
2304 /* Create an inode, now that the driver information is available */
2305 inode = _devfs_get_vfs_inode(dir->i_sb, de, dentry);
2306 if (!inode) {
2307 retval = ERR_PTR(-ENOMEM);
2308 goto out;
2309 }
2310 DPRINTK(DEBUG_I_LOOKUP,
2311 "(%s): new VFS inode(%u): %p de: %p by: \"%s\"\n", de->name,
2312 de->inode.ino, inode, de, current->comm);
2313 d_instantiate(dentry, inode);
2314 out:
2315 write_lock(&parent->u.dir.lock);
2316 dentry->d_op = &devfs_dops;
2317 dentry->d_fsdata = NULL;
2318 wake_up(&lookup_info.wait_queue);
2319 write_unlock(&parent->u.dir.lock);
2320 devfs_put(de);
2321 return retval;
2322} /* End Function devfs_lookup */
2323
2324static int devfs_unlink(struct inode *dir, struct dentry *dentry)
2325{
2326 int unhooked;
2327 struct devfs_entry *de;
2328 struct inode *inode = dentry->d_inode;
2329 struct fs_info *fs_info = dir->i_sb->s_fs_info;
2330
2331 de = get_devfs_entry_from_vfs_inode(inode);
2332 DPRINTK(DEBUG_I_UNLINK, "(%s): de: %p\n", dentry->d_name.name, de);
2333 if (de == NULL)
2334 return -ENOENT;
2335 if (!de->vfs)
2336 return -EPERM;
2337 write_lock(&de->parent->u.dir.lock);
2338 unhooked = _devfs_unhook(de);
2339 write_unlock(&de->parent->u.dir.lock);
2340 if (!unhooked)
2341 return -ENOENT;
2342 if (!is_devfsd_or_child(fs_info))
2343 devfsd_notify_de(de, DEVFSD_NOTIFY_DELETE, inode->i_mode,
2344 inode->i_uid, inode->i_gid, fs_info);
2345 free_dentry(de);
2346 devfs_put(de);
2347 return 0;
2348} /* End Function devfs_unlink */
2349
2350static int devfs_symlink(struct inode *dir, struct dentry *dentry,
2351 const char *symname)
2352{
2353 int err;
2354 struct fs_info *fs_info = dir->i_sb->s_fs_info;
2355 struct devfs_entry *parent, *de;
2356 struct inode *inode;
2357
2358 /* First try to get the devfs entry for this directory */
2359 parent = get_devfs_entry_from_vfs_inode(dir);
2360 if (parent == NULL)
2361 return -ENOENT;
2362 err = devfs_do_symlink(parent, dentry->d_name.name, symname, &de);
2363 DPRINTK(DEBUG_DISABLED, "(%s): errcode from <devfs_do_symlink>: %d\n",
2364 dentry->d_name.name, err);
2365 if (err < 0)
2366 return err;
2367 de->vfs = TRUE;
2368 de->inode.uid = current->euid;
2369 de->inode.gid = current->egid;
2370 de->inode.atime = CURRENT_TIME;
2371 de->inode.mtime = CURRENT_TIME;
2372 de->inode.ctime = CURRENT_TIME;
2373 if ((inode = _devfs_get_vfs_inode(dir->i_sb, de, dentry)) == NULL)
2374 return -ENOMEM;
2375 DPRINTK(DEBUG_DISABLED, "(%s): new VFS inode(%u): %p dentry: %p\n",
2376 dentry->d_name.name, de->inode.ino, inode, dentry);
2377 d_instantiate(dentry, inode);
2378 if (!is_devfsd_or_child(fs_info))
2379 devfsd_notify_de(de, DEVFSD_NOTIFY_CREATE, inode->i_mode,
2380 inode->i_uid, inode->i_gid, fs_info);
2381 return 0;
2382} /* End Function devfs_symlink */
2383
2384static int devfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2385{
2386 int err;
2387 struct fs_info *fs_info = dir->i_sb->s_fs_info;
2388 struct devfs_entry *parent, *de;
2389 struct inode *inode;
2390
2391 mode = (mode & ~S_IFMT) | S_IFDIR; /* VFS doesn't pass S_IFMT part */
2392 parent = get_devfs_entry_from_vfs_inode(dir);
2393 if (parent == NULL)
2394 return -ENOENT;
2395 de = _devfs_alloc_entry(dentry->d_name.name, dentry->d_name.len, mode);
2396 if (!de)
2397 return -ENOMEM;
2398 de->vfs = TRUE;
2399 if ((err = _devfs_append_entry(parent, de, NULL)) != 0)
2400 return err;
2401 de->inode.uid = current->euid;
2402 de->inode.gid = current->egid;
2403 de->inode.atime = CURRENT_TIME;
2404 de->inode.mtime = CURRENT_TIME;
2405 de->inode.ctime = CURRENT_TIME;
2406 if ((inode = _devfs_get_vfs_inode(dir->i_sb, de, dentry)) == NULL)
2407 return -ENOMEM;
2408 DPRINTK(DEBUG_DISABLED, "(%s): new VFS inode(%u): %p dentry: %p\n",
2409 dentry->d_name.name, de->inode.ino, inode, dentry);
2410 d_instantiate(dentry, inode);
2411 if (!is_devfsd_or_child(fs_info))
2412 devfsd_notify_de(de, DEVFSD_NOTIFY_CREATE, inode->i_mode,
2413 inode->i_uid, inode->i_gid, fs_info);
2414 return 0;
2415} /* End Function devfs_mkdir */
2416
2417static int devfs_rmdir(struct inode *dir, struct dentry *dentry)
2418{
2419 int err = 0;
2420 struct devfs_entry *de;
2421 struct fs_info *fs_info = dir->i_sb->s_fs_info;
2422 struct inode *inode = dentry->d_inode;
2423
2424 if (dir->i_sb->s_fs_info != inode->i_sb->s_fs_info)
2425 return -EINVAL;
2426 de = get_devfs_entry_from_vfs_inode(inode);
2427 if (de == NULL)
2428 return -ENOENT;
2429 if (!S_ISDIR(de->mode))
2430 return -ENOTDIR;
2431 if (!de->vfs)
2432 return -EPERM;
2433 /* First ensure the directory is empty and will stay that way */
2434 write_lock(&de->u.dir.lock);
2435 if (de->u.dir.first)
2436 err = -ENOTEMPTY;
2437 else
2438 de->u.dir.no_more_additions = TRUE;
2439 write_unlock(&de->u.dir.lock);
2440 if (err)
2441 return err;
2442 /* Now unhook the directory from its parent */
2443 write_lock(&de->parent->u.dir.lock);
2444 if (!_devfs_unhook(de))
2445 err = -ENOENT;
2446 write_unlock(&de->parent->u.dir.lock);
2447 if (err)
2448 return err;
2449 if (!is_devfsd_or_child(fs_info))
2450 devfsd_notify_de(de, DEVFSD_NOTIFY_DELETE, inode->i_mode,
2451 inode->i_uid, inode->i_gid, fs_info);
2452 free_dentry(de);
2453 devfs_put(de);
2454 return 0;
2455} /* End Function devfs_rmdir */
2456
2457static int devfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
2458 dev_t rdev)
2459{
2460 int err;
2461 struct fs_info *fs_info = dir->i_sb->s_fs_info;
2462 struct devfs_entry *parent, *de;
2463 struct inode *inode;
2464
2465 DPRINTK(DEBUG_I_MKNOD, "(%s): mode: 0%o dev: %u:%u\n",
2466 dentry->d_name.name, mode, MAJOR(rdev), MINOR(rdev));
2467 parent = get_devfs_entry_from_vfs_inode(dir);
2468 if (parent == NULL)
2469 return -ENOENT;
2470 de = _devfs_alloc_entry(dentry->d_name.name, dentry->d_name.len, mode);
2471 if (!de)
2472 return -ENOMEM;
2473 de->vfs = TRUE;
2474 if (S_ISCHR(mode) || S_ISBLK(mode))
2475 de->u.dev = rdev;
2476 if ((err = _devfs_append_entry(parent, de, NULL)) != 0)
2477 return err;
2478 de->inode.uid = current->euid;
2479 de->inode.gid = current->egid;
2480 de->inode.atime = CURRENT_TIME;
2481 de->inode.mtime = CURRENT_TIME;
2482 de->inode.ctime = CURRENT_TIME;
2483 if ((inode = _devfs_get_vfs_inode(dir->i_sb, de, dentry)) == NULL)
2484 return -ENOMEM;
2485 DPRINTK(DEBUG_I_MKNOD, ": new VFS inode(%u): %p dentry: %p\n",
2486 de->inode.ino, inode, dentry);
2487 d_instantiate(dentry, inode);
2488 if (!is_devfsd_or_child(fs_info))
2489 devfsd_notify_de(de, DEVFSD_NOTIFY_CREATE, inode->i_mode,
2490 inode->i_uid, inode->i_gid, fs_info);
2491 return 0;
2492} /* End Function devfs_mknod */
2493
2494static void *devfs_follow_link(struct dentry *dentry, struct nameidata *nd)
2495{
2496 struct devfs_entry *p = get_devfs_entry_from_vfs_inode(dentry->d_inode);
2497 nd_set_link(nd, p ? p->u.symlink.linkname : ERR_PTR(-ENODEV));
2498 return NULL;
2499} /* End Function devfs_follow_link */
2500
2501static struct inode_operations devfs_iops = {
2502 .setattr = devfs_notify_change,
2503};
2504
2505static struct inode_operations devfs_dir_iops = {
2506 .lookup = devfs_lookup,
2507 .unlink = devfs_unlink,
2508 .symlink = devfs_symlink,
2509 .mkdir = devfs_mkdir,
2510 .rmdir = devfs_rmdir,
2511 .mknod = devfs_mknod,
2512 .setattr = devfs_notify_change,
2513};
2514
2515static struct inode_operations devfs_symlink_iops = {
2516 .readlink = generic_readlink,
2517 .follow_link = devfs_follow_link,
2518 .setattr = devfs_notify_change,
2519};
2520
2521static int devfs_fill_super(struct super_block *sb, void *data, int silent)
2522{
2523 struct inode *root_inode = NULL;
2524
2525 if (_devfs_get_root_entry() == NULL)
2526 goto out_no_root;
2527 atomic_set(&fs_info.devfsd_overrun_count, 0);
2528 init_waitqueue_head(&fs_info.devfsd_wait_queue);
2529 init_waitqueue_head(&fs_info.revalidate_wait_queue);
2530 fs_info.sb = sb;
2531 sb->s_fs_info = &fs_info;
2532 sb->s_blocksize = 1024;
2533 sb->s_blocksize_bits = 10;
2534 sb->s_magic = DEVFS_SUPER_MAGIC;
2535 sb->s_op = &devfs_sops;
2536 sb->s_time_gran = 1;
2537 if ((root_inode = _devfs_get_vfs_inode(sb, root_entry, NULL)) == NULL)
2538 goto out_no_root;
2539 sb->s_root = d_alloc_root(root_inode);
2540 if (!sb->s_root)
2541 goto out_no_root;
2542 DPRINTK(DEBUG_S_READ, "(): made devfs ptr: %p\n", sb->s_fs_info);
2543 return 0;
2544
2545 out_no_root:
2546 PRINTK("(): get root inode failed\n");
2547 if (root_inode)
2548 iput(root_inode);
2549 return -EINVAL;
2550} /* End Function devfs_fill_super */
2551
2552static int devfs_get_sb(struct file_system_type *fs_type,
2553 int flags, const char *dev_name,
2554 void *data, struct vfsmount *mnt)
2555{
2556 return get_sb_single(fs_type, flags, data, devfs_fill_super, mnt);
2557}
2558
2559static struct file_system_type devfs_fs_type = {
2560 .name = DEVFS_NAME,
2561 .get_sb = devfs_get_sb,
2562 .kill_sb = kill_anon_super,
2563};
2564
2565/* File operations for devfsd follow */
2566
2567static ssize_t devfsd_read(struct file *file, char __user *buf, size_t len,
2568 loff_t * ppos)
2569{
2570 int done = FALSE;
2571 int ival;
2572 loff_t pos, devname_offset, tlen, rpos;
2573 devfs_handle_t de;
2574 struct devfsd_buf_entry *entry;
2575 struct fs_info *fs_info = file->f_dentry->d_inode->i_sb->s_fs_info;
2576 struct devfsd_notify_struct *info = fs_info->devfsd_info;
2577 DECLARE_WAITQUEUE(wait, current);
2578
2579 /* Verify the task has grabbed the queue */
2580 if (fs_info->devfsd_task != current)
2581 return -EPERM;
2582 info->major = 0;
2583 info->minor = 0;
2584 /* Block for a new entry */
2585 set_current_state(TASK_INTERRUPTIBLE);
2586 add_wait_queue(&fs_info->devfsd_wait_queue, &wait);
2587 while (devfsd_queue_empty(fs_info)) {
2588 fs_info->devfsd_sleeping = TRUE;
2589 wake_up(&fs_info->revalidate_wait_queue);
2590 schedule();
2591 fs_info->devfsd_sleeping = FALSE;
2592 if (signal_pending(current)) {
2593 remove_wait_queue(&fs_info->devfsd_wait_queue, &wait);
2594 __set_current_state(TASK_RUNNING);
2595 return -EINTR;
2596 }
2597 set_current_state(TASK_INTERRUPTIBLE);
2598 }
2599 remove_wait_queue(&fs_info->devfsd_wait_queue, &wait);
2600 __set_current_state(TASK_RUNNING);
2601 /* Now play with the data */
2602 ival = atomic_read(&fs_info->devfsd_overrun_count);
2603 info->overrun_count = ival;
2604 entry = fs_info->devfsd_first_event;
2605 info->type = entry->type;
2606 info->mode = entry->mode;
2607 info->uid = entry->uid;
2608 info->gid = entry->gid;
2609 de = entry->de;
2610 if (S_ISCHR(de->mode) || S_ISBLK(de->mode)) {
2611 info->major = MAJOR(de->u.dev);
2612 info->minor = MINOR(de->u.dev);
2613 }
2614 pos = devfs_generate_path(de, info->devname, DEVFS_PATHLEN);
2615 if (pos < 0)
2616 return pos;
2617 info->namelen = DEVFS_PATHLEN - pos - 1;
2618 if (info->mode == 0)
2619 info->mode = de->mode;
2620 devname_offset = info->devname - (char *)info;
2621 rpos = *ppos;
2622 if (rpos < devname_offset) {
2623 /* Copy parts of the header */
2624 tlen = devname_offset - rpos;
2625 if (tlen > len)
2626 tlen = len;
2627 if (copy_to_user(buf, (char *)info + rpos, tlen)) {
2628 return -EFAULT;
2629 }
2630 rpos += tlen;
2631 buf += tlen;
2632 len -= tlen;
2633 }
2634 if ((rpos >= devname_offset) && (len > 0)) {
2635 /* Copy the name */
2636 tlen = info->namelen + 1;
2637 if (tlen > len)
2638 tlen = len;
2639 else
2640 done = TRUE;
2641 if (copy_to_user
2642 (buf, info->devname + pos + rpos - devname_offset, tlen)) {
2643 return -EFAULT;
2644 }
2645 rpos += tlen;
2646 }
2647 tlen = rpos - *ppos;
2648 if (done) {
2649 devfs_handle_t parent;
2650
2651 spin_lock(&fs_info->devfsd_buffer_lock);
2652 fs_info->devfsd_first_event = entry->next;
2653 if (entry->next == NULL)
2654 fs_info->devfsd_last_event = NULL;
2655 spin_unlock(&fs_info->devfsd_buffer_lock);
2656 for (; de != NULL; de = parent) {
2657 parent = de->parent;
2658 devfs_put(de);
2659 }
2660 kmem_cache_free(devfsd_buf_cache, entry);
2661 if (ival > 0)
2662 atomic_sub(ival, &fs_info->devfsd_overrun_count);
2663 *ppos = 0;
2664 } else
2665 *ppos = rpos;
2666 return tlen;
2667} /* End Function devfsd_read */
2668
2669static int devfsd_ioctl(struct inode *inode, struct file *file,
2670 unsigned int cmd, unsigned long arg)
2671{
2672 int ival;
2673 struct fs_info *fs_info = inode->i_sb->s_fs_info;
2674
2675 switch (cmd) {
2676 case DEVFSDIOC_GET_PROTO_REV:
2677 ival = DEVFSD_PROTOCOL_REVISION_KERNEL;
2678 if (copy_to_user((void __user *)arg, &ival, sizeof ival))
2679 return -EFAULT;
2680 break;
2681 case DEVFSDIOC_SET_EVENT_MASK:
2682 /* Ensure only one reader has access to the queue. This scheme will
2683 work even if the global kernel lock were to be removed, because it
2684 doesn't matter who gets in first, as long as only one gets it */
2685 if (fs_info->devfsd_task == NULL) {
2686 static DEFINE_SPINLOCK(lock);
2687
2688 if (!spin_trylock(&lock))
2689 return -EBUSY;
2690 if (fs_info->devfsd_task != NULL) { /* We lost the race... */
2691 spin_unlock(&lock);
2692 return -EBUSY;
2693 }
2694 fs_info->devfsd_task = current;
2695 spin_unlock(&lock);
2696 fs_info->devfsd_pgrp =
2697 (process_group(current) ==
2698 current->pid) ? process_group(current) : 0;
2699 fs_info->devfsd_file = file;
2700 fs_info->devfsd_info =
2701 kmalloc(sizeof *fs_info->devfsd_info, GFP_KERNEL);
2702 if (!fs_info->devfsd_info) {
2703 devfsd_close(inode, file);
2704 return -ENOMEM;
2705 }
2706 } else if (fs_info->devfsd_task != current)
2707 return -EBUSY;
2708 fs_info->devfsd_event_mask = arg; /* Let the masses come forth */
2709 break;
2710 case DEVFSDIOC_RELEASE_EVENT_QUEUE:
2711 if (fs_info->devfsd_file != file)
2712 return -EPERM;
2713 return devfsd_close(inode, file);
2714 /*break; */
2715#ifdef CONFIG_DEVFS_DEBUG
2716 case DEVFSDIOC_SET_DEBUG_MASK:
2717 if (copy_from_user(&ival, (void __user *)arg, sizeof ival))
2718 return -EFAULT;
2719 devfs_debug = ival;
2720 break;
2721#endif
2722 default:
2723 return -ENOIOCTLCMD;
2724 }
2725 return 0;
2726} /* End Function devfsd_ioctl */
2727
2728static int devfsd_close(struct inode *inode, struct file *file)
2729{
2730 struct devfsd_buf_entry *entry, *next;
2731 struct fs_info *fs_info = inode->i_sb->s_fs_info;
2732
2733 if (fs_info->devfsd_file != file)
2734 return 0;
2735 fs_info->devfsd_event_mask = 0;
2736 fs_info->devfsd_file = NULL;
2737 spin_lock(&fs_info->devfsd_buffer_lock);
2738 entry = fs_info->devfsd_first_event;
2739 fs_info->devfsd_first_event = NULL;
2740 fs_info->devfsd_last_event = NULL;
2741 kfree(fs_info->devfsd_info);
2742 fs_info->devfsd_info = NULL;
2743 spin_unlock(&fs_info->devfsd_buffer_lock);
2744 fs_info->devfsd_pgrp = 0;
2745 fs_info->devfsd_task = NULL;
2746 wake_up(&fs_info->revalidate_wait_queue);
2747 for (; entry; entry = next) {
2748 next = entry->next;
2749 kmem_cache_free(devfsd_buf_cache, entry);
2750 }
2751 return 0;
2752} /* End Function devfsd_close */
2753
2754#ifdef CONFIG_DEVFS_DEBUG
2755static ssize_t stat_read(struct file *file, char __user *buf, size_t len,
2756 loff_t * ppos)
2757{
2758 ssize_t num;
2759 char txt[80];
2760
2761 num = sprintf(txt, "Number of entries: %u number of bytes: %u\n",
2762 stat_num_entries, stat_num_bytes) + 1;
2763 if (*ppos >= num)
2764 return 0;
2765 if (*ppos + len > num)
2766 len = num - *ppos;
2767 if (copy_to_user(buf, txt + *ppos, len))
2768 return -EFAULT;
2769 *ppos += len;
2770 return len;
2771} /* End Function stat_read */
2772#endif
2773
2774static int __init init_devfs_fs(void)
2775{
2776 int err;
2777 int major;
2778 struct devfs_entry *devfsd;
2779#ifdef CONFIG_DEVFS_DEBUG
2780 struct devfs_entry *stat;
2781#endif
2782
2783 if (_devfs_get_root_entry() == NULL)
2784 return -ENOMEM;
2785
2786 printk(KERN_INFO "%s: %s Richard Gooch (rgooch@atnf.csiro.au)\n",
2787 DEVFS_NAME, DEVFS_VERSION);
2788 devfsd_buf_cache = kmem_cache_create("devfsd_event",
2789 sizeof(struct devfsd_buf_entry),
2790 0, 0, NULL, NULL);
2791 if (!devfsd_buf_cache)
2792 OOPS("(): unable to allocate event slab\n");
2793#ifdef CONFIG_DEVFS_DEBUG
2794 devfs_debug = devfs_debug_init;
2795 printk(KERN_INFO "%s: devfs_debug: 0x%0x\n", DEVFS_NAME, devfs_debug);
2796#endif
2797 printk(KERN_INFO "%s: boot_options: 0x%0x\n", DEVFS_NAME, boot_options);
2798
2799 /* register special device for devfsd communication */
2800 major = register_chrdev(0, "devfs", &devfs_fops);
2801 if (major < 0)
2802 return major;
2803
2804 /* And create the entry for ".devfsd" */
2805 devfsd = _devfs_alloc_entry(".devfsd", 0, S_IFCHR | S_IRUSR | S_IWUSR);
2806 if (devfsd == NULL)
2807 return -ENOMEM;
2808 devfsd->u.dev = MKDEV(major, 0);
2809 _devfs_append_entry(root_entry, devfsd, NULL);
2810
2811#ifdef CONFIG_DEVFS_DEBUG
2812 stat = _devfs_alloc_entry(".stat", 0, S_IFCHR | S_IRUGO);
2813 if (stat == NULL)
2814 return -ENOMEM;
2815 stat->u.dev = MKDEV(major, 1);
2816 _devfs_append_entry(root_entry, stat, NULL);
2817#endif
2818
2819 err = register_filesystem(&devfs_fs_type);
2820 return err;
2821} /* End Function init_devfs_fs */
2822
2823void __init mount_devfs_fs(void)
2824{
2825 int err;
2826
2827 if (!(boot_options & OPTION_MOUNT))
2828 return;
2829 err = do_mount("none", "/dev", "devfs", 0, NULL);
2830 if (err == 0)
2831 printk(KERN_INFO "Mounted devfs on /dev\n");
2832 else
2833 PRINTK("(): unable to mount devfs, err: %d\n", err);
2834} /* End Function mount_devfs_fs */
2835
2836module_init(init_devfs_fs)
diff --git a/fs/devfs/util.c b/fs/devfs/util.c
deleted file mode 100644
index db06d388c9ac..000000000000
--- a/fs/devfs/util.c
+++ /dev/null
@@ -1,97 +0,0 @@
1/* devfs (Device FileSystem) utilities.
2
3 Copyright (C) 1999-2002 Richard Gooch
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 Richard Gooch may be reached by email at rgooch@atnf.csiro.au
20 The postal address is:
21 Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.
22
23 ChangeLog
24
25 19991031 Richard Gooch <rgooch@atnf.csiro.au>
26 Created.
27 19991103 Richard Gooch <rgooch@atnf.csiro.au>
28 Created <_devfs_convert_name> and supported SCSI and IDE CD-ROMs
29 20000203 Richard Gooch <rgooch@atnf.csiro.au>
30 Changed operations pointer type to void *.
31 20000621 Richard Gooch <rgooch@atnf.csiro.au>
32 Changed interface to <devfs_register_series>.
33 20000622 Richard Gooch <rgooch@atnf.csiro.au>
34 Took account of interface change to <devfs_mk_symlink>.
35 Took account of interface change to <devfs_mk_dir>.
36 20010519 Richard Gooch <rgooch@atnf.csiro.au>
37 Documentation cleanup.
38 20010709 Richard Gooch <rgooch@atnf.csiro.au>
39 Created <devfs_*alloc_major> and <devfs_*alloc_devnum>.
40 20010710 Richard Gooch <rgooch@atnf.csiro.au>
41 Created <devfs_*alloc_unique_number>.
42 20010730 Richard Gooch <rgooch@atnf.csiro.au>
43 Documentation typo fix.
44 20010806 Richard Gooch <rgooch@atnf.csiro.au>
45 Made <block_semaphore> and <char_semaphore> private.
46 20010813 Richard Gooch <rgooch@atnf.csiro.au>
47 Fixed bug in <devfs_alloc_unique_number>: limited to 128 numbers
48 20010818 Richard Gooch <rgooch@atnf.csiro.au>
49 Updated major masks up to Linus' "no new majors" proclamation.
50 Block: were 126 now 122 free, char: were 26 now 19 free.
51 20020324 Richard Gooch <rgooch@atnf.csiro.au>
52 Fixed bug in <devfs_alloc_unique_number>: was clearing beyond
53 bitfield.
54 20020326 Richard Gooch <rgooch@atnf.csiro.au>
55 Fixed bitfield data type for <devfs_*alloc_devnum>.
56 Made major bitfield type and initialiser 64 bit safe.
57 20020413 Richard Gooch <rgooch@atnf.csiro.au>
58 Fixed shift warning on 64 bit machines.
59 20020428 Richard Gooch <rgooch@atnf.csiro.au>
60 Copied and used macro for error messages from fs/devfs/base.c
61 20021013 Richard Gooch <rgooch@atnf.csiro.au>
62 Documentation fix.
63 20030101 Adam J. Richter <adam@yggdrasil.com>
64 Eliminate DEVFS_SPECIAL_{CHR,BLK}. Use mode_t instead.
65 20030106 Christoph Hellwig <hch@infradead.org>
66 Rewrite devfs_{,de}alloc_devnum to look like C code.
67*/
68#include <linux/module.h>
69#include <linux/init.h>
70#include <linux/devfs_fs_kernel.h>
71#include <linux/slab.h>
72#include <linux/vmalloc.h>
73#include <linux/genhd.h>
74#include <linux/bitops.h>
75
76int devfs_register_tape(const char *name)
77{
78 char tname[32], dest[64];
79 static unsigned int tape_counter;
80 unsigned int n = tape_counter++;
81
82 sprintf(dest, "../%s", name);
83 sprintf(tname, "tapes/tape%u", n);
84 devfs_mk_symlink(tname, dest);
85
86 return n;
87}
88
89EXPORT_SYMBOL(devfs_register_tape);
90
91void devfs_unregister_tape(int num)
92{
93 if (num >= 0)
94 devfs_remove("tapes/tape%u", num);
95}
96
97EXPORT_SYMBOL(devfs_unregister_tape);
diff --git a/fs/partitions/Makefile b/fs/partitions/Makefile
index 42c7d3878ed0..d713ce6b3e12 100644
--- a/fs/partitions/Makefile
+++ b/fs/partitions/Makefile
@@ -4,7 +4,6 @@
4 4
5obj-y := check.o 5obj-y := check.o
6 6
7obj-$(CONFIG_DEVFS_FS) += devfs.o
8obj-$(CONFIG_ACORN_PARTITION) += acorn.o 7obj-$(CONFIG_ACORN_PARTITION) += acorn.o
9obj-$(CONFIG_AMIGA_PARTITION) += amiga.o 8obj-$(CONFIG_AMIGA_PARTITION) += amiga.o
10obj-$(CONFIG_ATARI_PARTITION) += atari.o 9obj-$(CONFIG_ATARI_PARTITION) += atari.o
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 2ef313a96b66..839634026eb5 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -18,10 +18,8 @@
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/kmod.h> 19#include <linux/kmod.h>
20#include <linux/ctype.h> 20#include <linux/ctype.h>
21#include <linux/devfs_fs_kernel.h>
22 21
23#include "check.h" 22#include "check.h"
24#include "devfs.h"
25 23
26#include "acorn.h" 24#include "acorn.h"
27#include "amiga.h" 25#include "amiga.h"
@@ -161,18 +159,11 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
161 if (!state) 159 if (!state)
162 return NULL; 160 return NULL;
163 161
164#ifdef CONFIG_DEVFS_FS 162 disk_name(hd, 0, state->name);
165 if (hd->devfs_name[0] != '\0') { 163 printk(KERN_INFO " %s:", state->name);
166 printk(KERN_INFO " /dev/%s:", hd->devfs_name); 164 if (isdigit(state->name[strlen(state->name)-1]))
167 sprintf(state->name, "p"); 165 sprintf(state->name, "p");
168 } 166
169#endif
170 else {
171 disk_name(hd, 0, state->name);
172 printk(KERN_INFO " %s:", state->name);
173 if (isdigit(state->name[strlen(state->name)-1]))
174 sprintf(state->name, "p");
175 }
176 state->limit = hd->minors; 167 state->limit = hd->minors;
177 i = res = 0; 168 i = res = 0;
178 while (!res && check_part[i]) { 169 while (!res && check_part[i]) {
@@ -328,7 +319,6 @@ void delete_partition(struct gendisk *disk, int part)
328 p->nr_sects = 0; 319 p->nr_sects = 0;
329 p->ios[0] = p->ios[1] = 0; 320 p->ios[0] = p->ios[1] = 0;
330 p->sectors[0] = p->sectors[1] = 0; 321 p->sectors[0] = p->sectors[1] = 0;
331 devfs_remove("%s/part%d", disk->devfs_name, part);
332 sysfs_remove_link(&p->kobj, "subsystem"); 322 sysfs_remove_link(&p->kobj, "subsystem");
333 if (p->holder_dir) 323 if (p->holder_dir)
334 kobject_unregister(p->holder_dir); 324 kobject_unregister(p->holder_dir);
@@ -350,10 +340,6 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len)
350 p->nr_sects = len; 340 p->nr_sects = len;
351 p->partno = part; 341 p->partno = part;
352 342
353 devfs_mk_bdev(MKDEV(disk->major, disk->first_minor + part),
354 S_IFBLK|S_IRUSR|S_IWUSR,
355 "%s/part%d", disk->devfs_name, part);
356
357 if (isdigit(disk->kobj.name[strlen(disk->kobj.name)-1])) 343 if (isdigit(disk->kobj.name[strlen(disk->kobj.name)-1]))
358 snprintf(p->kobj.name,KOBJ_NAME_LEN,"%sp%d",disk->kobj.name,part); 344 snprintf(p->kobj.name,KOBJ_NAME_LEN,"%sp%d",disk->kobj.name,part);
359 else 345 else
@@ -423,14 +409,8 @@ void register_disk(struct gendisk *disk)
423 disk_sysfs_add_subdirs(disk); 409 disk_sysfs_add_subdirs(disk);
424 410
425 /* No minors to use for partitions */ 411 /* No minors to use for partitions */
426 if (disk->minors == 1) { 412 if (disk->minors == 1)
427 if (disk->devfs_name[0] != '\0')
428 devfs_add_disk(disk);
429 goto exit; 413 goto exit;
430 }
431
432 /* always add handle for the whole disk */
433 devfs_add_partitioned(disk);
434 414
435 /* No such device (e.g., media were just removed) */ 415 /* No such device (e.g., media were just removed) */
436 if (!get_capacity(disk)) 416 if (!get_capacity(disk))
@@ -538,8 +518,6 @@ void del_gendisk(struct gendisk *disk)
538 disk_stat_set_all(disk, 0); 518 disk_stat_set_all(disk, 0);
539 disk->stamp = 0; 519 disk->stamp = 0;
540 520
541 devfs_remove_disk(disk);
542
543 kobject_uevent(&disk->kobj, KOBJ_REMOVE); 521 kobject_uevent(&disk->kobj, KOBJ_REMOVE);
544 if (disk->holder_dir) 522 if (disk->holder_dir)
545 kobject_unregister(disk->holder_dir); 523 kobject_unregister(disk->holder_dir);
diff --git a/fs/partitions/devfs.c b/fs/partitions/devfs.c
deleted file mode 100644
index 3f0a780c9cec..000000000000
--- a/fs/partitions/devfs.c
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 * This tries to keep block devices away from devfs as much as possible.
3 */
4#include <linux/fs.h>
5#include <linux/devfs_fs_kernel.h>
6#include <linux/vmalloc.h>
7#include <linux/genhd.h>
8#include <linux/bitops.h>
9#include <linux/mutex.h>
10
11
12struct unique_numspace {
13 u32 num_free; /* Num free in bits */
14 u32 length; /* Array length in bytes */
15 unsigned long *bits;
16 struct semaphore mutex;
17};
18
19static DEFINE_MUTEX(numspace_mutex);
20
21static int expand_numspace(struct unique_numspace *s)
22{
23 u32 length;
24 void *bits;
25
26 if (s->length < 16)
27 length = 16;
28 else
29 length = s->length << 1;
30
31 bits = vmalloc(length);
32 if (!bits)
33 return -ENOMEM;
34 if (s->bits) {
35 memcpy(bits, s->bits, s->length);
36 vfree(s->bits);
37 }
38
39 s->num_free = (length - s->length) << 3;
40 s->bits = bits;
41 memset(bits + s->length, 0, length - s->length);
42 s->length = length;
43
44 return 0;
45}
46
47static int alloc_unique_number(struct unique_numspace *s)
48{
49 int rval = 0;
50
51 mutex_lock(&numspace_mutex);
52 if (s->num_free < 1)
53 rval = expand_numspace(s);
54 if (!rval) {
55 rval = find_first_zero_bit(s->bits, s->length << 3);
56 --s->num_free;
57 __set_bit(rval, s->bits);
58 }
59 mutex_unlock(&numspace_mutex);
60
61 return rval;
62}
63
64static void dealloc_unique_number(struct unique_numspace *s, int number)
65{
66 int old_val;
67
68 if (number >= 0) {
69 mutex_lock(&numspace_mutex);
70 old_val = __test_and_clear_bit(number, s->bits);
71 if (old_val)
72 ++s->num_free;
73 mutex_unlock(&numspace_mutex);
74 }
75}
76
77static struct unique_numspace disc_numspace;
78static struct unique_numspace cdrom_numspace;
79
80void devfs_add_partitioned(struct gendisk *disk)
81{
82 char dirname[64], symlink[16];
83
84 devfs_mk_dir(disk->devfs_name);
85 devfs_mk_bdev(MKDEV(disk->major, disk->first_minor),
86 S_IFBLK|S_IRUSR|S_IWUSR,
87 "%s/disc", disk->devfs_name);
88
89 disk->number = alloc_unique_number(&disc_numspace);
90
91 sprintf(symlink, "discs/disc%d", disk->number);
92 sprintf(dirname, "../%s", disk->devfs_name);
93 devfs_mk_symlink(symlink, dirname);
94
95}
96
97void devfs_add_disk(struct gendisk *disk)
98{
99 devfs_mk_bdev(MKDEV(disk->major, disk->first_minor),
100 (disk->flags & GENHD_FL_CD) ?
101 S_IFBLK|S_IRUGO|S_IWUGO :
102 S_IFBLK|S_IRUSR|S_IWUSR,
103 "%s", disk->devfs_name);
104
105 if (disk->flags & GENHD_FL_CD) {
106 char dirname[64], symlink[16];
107
108 disk->number = alloc_unique_number(&cdrom_numspace);
109
110 sprintf(symlink, "cdroms/cdrom%d", disk->number);
111 sprintf(dirname, "../%s", disk->devfs_name);
112 devfs_mk_symlink(symlink, dirname);
113 }
114}
115
116void devfs_remove_disk(struct gendisk *disk)
117{
118 if (disk->minors != 1) {
119 devfs_remove("discs/disc%d", disk->number);
120 dealloc_unique_number(&disc_numspace, disk->number);
121 devfs_remove("%s/disc", disk->devfs_name);
122 }
123 if (disk->flags & GENHD_FL_CD) {
124 devfs_remove("cdroms/cdrom%d", disk->number);
125 dealloc_unique_number(&cdrom_numspace, disk->number);
126 }
127 devfs_remove(disk->devfs_name);
128}
129
130
diff --git a/fs/partitions/devfs.h b/fs/partitions/devfs.h
deleted file mode 100644
index 176118b4e492..000000000000
--- a/fs/partitions/devfs.h
+++ /dev/null
@@ -1,10 +0,0 @@
1
2#ifdef CONFIG_DEVFS_FS
3void devfs_add_disk(struct gendisk *dev);
4void devfs_add_partitioned(struct gendisk *dev);
5void devfs_remove_disk(struct gendisk *dev);
6#else
7# define devfs_add_disk(disk) do { } while (0)
8# define devfs_add_partitioned(disk) do { } while (0)
9# define devfs_remove_disk(disk) do { } while (0)
10#endif
diff --git a/include/asm-ppc/ocp.h b/include/asm-ppc/ocp.h
index 3be5d760ffcd..16dbc7d17450 100644
--- a/include/asm-ppc/ocp.h
+++ b/include/asm-ppc/ocp.h
@@ -26,7 +26,6 @@
26 26
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/list.h> 28#include <linux/list.h>
29#include <linux/devfs_fs_kernel.h>
30#include <linux/device.h> 29#include <linux/device.h>
31 30
32#include <asm/mmu.h> 31#include <asm/mmu.h>
diff --git a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
index 917d62e41480..269d000bb2a3 100644
--- a/include/linux/compat_ioctl.h
+++ b/include/linux/compat_ioctl.h
@@ -567,11 +567,6 @@ COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOSUBVER)
567COMPATIBLE_IOCTL(AUTOFS_IOC_ASKREGHOST) 567COMPATIBLE_IOCTL(AUTOFS_IOC_ASKREGHOST)
568COMPATIBLE_IOCTL(AUTOFS_IOC_TOGGLEREGHOST) 568COMPATIBLE_IOCTL(AUTOFS_IOC_TOGGLEREGHOST)
569COMPATIBLE_IOCTL(AUTOFS_IOC_ASKUMOUNT) 569COMPATIBLE_IOCTL(AUTOFS_IOC_ASKUMOUNT)
570/* DEVFS */
571COMPATIBLE_IOCTL(DEVFSDIOC_GET_PROTO_REV)
572COMPATIBLE_IOCTL(DEVFSDIOC_SET_EVENT_MASK)
573COMPATIBLE_IOCTL(DEVFSDIOC_RELEASE_EVENT_QUEUE)
574COMPATIBLE_IOCTL(DEVFSDIOC_SET_DEBUG_MASK)
575/* Raw devices */ 570/* Raw devices */
576COMPATIBLE_IOCTL(RAW_SETBIND) 571COMPATIBLE_IOCTL(RAW_SETBIND)
577COMPATIBLE_IOCTL(RAW_GETBIND) 572COMPATIBLE_IOCTL(RAW_GETBIND)
diff --git a/include/linux/devfs_fs.h b/include/linux/devfs_fs.h
deleted file mode 100644
index de236f431877..000000000000
--- a/include/linux/devfs_fs.h
+++ /dev/null
@@ -1,41 +0,0 @@
1#ifndef _LINUX_DEVFS_FS_H
2#define _LINUX_DEVFS_FS_H
3
4#include <linux/ioctl.h>
5
6#define DEVFSD_PROTOCOL_REVISION_KERNEL 5
7
8#define DEVFSD_IOCTL_BASE 'd'
9
10/* These are the various ioctls */
11#define DEVFSDIOC_GET_PROTO_REV _IOR(DEVFSD_IOCTL_BASE, 0, int)
12#define DEVFSDIOC_SET_EVENT_MASK _IOW(DEVFSD_IOCTL_BASE, 2, int)
13#define DEVFSDIOC_RELEASE_EVENT_QUEUE _IOW(DEVFSD_IOCTL_BASE, 3, int)
14#define DEVFSDIOC_SET_DEBUG_MASK _IOW(DEVFSD_IOCTL_BASE, 4, int)
15
16#define DEVFSD_NOTIFY_REGISTERED 0
17#define DEVFSD_NOTIFY_UNREGISTERED 1
18#define DEVFSD_NOTIFY_ASYNC_OPEN 2
19#define DEVFSD_NOTIFY_CLOSE 3
20#define DEVFSD_NOTIFY_LOOKUP 4
21#define DEVFSD_NOTIFY_CHANGE 5
22#define DEVFSD_NOTIFY_CREATE 6
23#define DEVFSD_NOTIFY_DELETE 7
24
25#define DEVFS_PATHLEN 1024 /* Never change this otherwise the
26 binary interface will change */
27
28struct devfsd_notify_struct { /* Use native C types to ensure same types in kernel and user space */
29 unsigned int type; /* DEVFSD_NOTIFY_* value */
30 unsigned int mode; /* Mode of the inode or device entry */
31 unsigned int major; /* Major number of device entry */
32 unsigned int minor; /* Minor number of device entry */
33 unsigned int uid; /* Uid of process, inode or device entry */
34 unsigned int gid; /* Gid of process, inode or device entry */
35 unsigned int overrun_count; /* Number of lost events */
36 unsigned int namelen; /* Number of characters not including '\0' */
37 /* The device name MUST come last */
38 char devname[DEVFS_PATHLEN]; /* This will be '\0' terminated */
39};
40
41#endif /* _LINUX_DEVFS_FS_H */
diff --git a/include/linux/devfs_fs_kernel.h b/include/linux/devfs_fs_kernel.h
deleted file mode 100644
index 0d74a6f22abc..000000000000
--- a/include/linux/devfs_fs_kernel.h
+++ /dev/null
@@ -1,57 +0,0 @@
1#ifndef _LINUX_DEVFS_FS_KERNEL_H
2#define _LINUX_DEVFS_FS_KERNEL_H
3
4#include <linux/fs.h>
5#include <linux/spinlock.h>
6#include <linux/types.h>
7
8#include <asm/semaphore.h>
9
10#define DEVFS_SUPER_MAGIC 0x1373
11
12#ifdef CONFIG_DEVFS_FS
13extern int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...)
14 __attribute__ ((format(printf, 3, 4)));
15extern int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...)
16 __attribute__ ((format(printf, 3, 4)));
17extern int devfs_mk_symlink(const char *name, const char *link);
18extern int devfs_mk_dir(const char *fmt, ...)
19 __attribute__ ((format(printf, 1, 2)));
20extern void devfs_remove(const char *fmt, ...)
21 __attribute__ ((format(printf, 1, 2)));
22extern int devfs_register_tape(const char *name);
23extern void devfs_unregister_tape(int num);
24extern void mount_devfs_fs(void);
25#else /* CONFIG_DEVFS_FS */
26static inline int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...)
27{
28 return 0;
29}
30static inline int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...)
31{
32 return 0;
33}
34static inline int devfs_mk_symlink(const char *name, const char *link)
35{
36 return 0;
37}
38static inline int devfs_mk_dir(const char *fmt, ...)
39{
40 return 0;
41}
42static inline void devfs_remove(const char *fmt, ...)
43{
44}
45static inline int devfs_register_tape(const char *name)
46{
47 return -1;
48}
49static inline void devfs_unregister_tape(int num)
50{
51}
52static inline void mount_devfs_fs(void)
53{
54 return;
55}
56#endif /* CONFIG_DEVFS_FS */
57#endif /* _LINUX_DEVFS_FS_KERNEL_H */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 07a08e92bc73..b45928f5c63f 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -380,7 +380,6 @@ struct fb_cursor {
380#include <linux/tty.h> 380#include <linux/tty.h>
381#include <linux/device.h> 381#include <linux/device.h>
382#include <linux/workqueue.h> 382#include <linux/workqueue.h>
383#include <linux/devfs_fs_kernel.h>
384#include <linux/notifier.h> 383#include <linux/notifier.h>
385#include <linux/list.h> 384#include <linux/list.h>
386#include <asm/io.h> 385#include <asm/io.h>
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 3498a0c68184..e4af57e87c17 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -112,8 +112,6 @@ struct gendisk {
112 sector_t capacity; 112 sector_t capacity;
113 113
114 int flags; 114 int flags;
115 char devfs_name[64]; /* devfs crap */
116 int number; /* more of the same */
117 struct device *driverfs_dev; 115 struct device *driverfs_dev;
118 struct kobject kobj; 116 struct kobject kobj;
119 struct kobject *holder_dir; 117 struct kobject *holder_dir;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 0c100168c0cf..285316c836b5 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -552,7 +552,6 @@ typedef struct ide_drive_s {
552 struct hd_driveid *id; /* drive model identification info */ 552 struct hd_driveid *id; /* drive model identification info */
553 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 553 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
554 struct ide_settings_s *settings;/* /proc/ide/ drive settings */ 554 struct ide_settings_s *settings;/* /proc/ide/ drive settings */
555 char devfs_name[64]; /* devfs crap */
556 555
557 struct hwif_s *hwif; /* actually (ide_hwif_t *) */ 556 struct hwif_s *hwif; /* actually (ide_hwif_t *) */
558 557
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 5b584dafb5a6..b03cfb91e228 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -40,7 +40,6 @@ struct miscdevice {
40 struct list_head list; 40 struct list_head list;
41 struct device *dev; 41 struct device *dev;
42 struct class_device *class; 42 struct class_device *class;
43 char devfs_name[64];
44}; 43};
45 44
46extern int misc_register(struct miscdevice * misc); 45extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 951c4e858274..fc1104a2cfa9 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -336,7 +336,6 @@ struct uart_driver {
336 struct module *owner; 336 struct module *owner;
337 const char *driver_name; 337 const char *driver_name;
338 const char *dev_name; 338 const char *dev_name;
339 const char *devfs_name;
340 int major; 339 int major;
341 int minor; 340 int minor;
342 int nr; 341 int nr;
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index b368b296d035..58c961c9e170 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -157,7 +157,6 @@ struct tty_driver {
157 struct cdev cdev; 157 struct cdev cdev;
158 struct module *owner; 158 struct module *owner;
159 const char *driver_name; 159 const char *driver_name;
160 const char *devfs_name;
161 const char *name; 160 const char *name;
162 int name_base; /* offset of printed name */ 161 int name_base; /* offset of printed name */
163 int major; /* major device number */ 162 int major; /* major device number */
@@ -242,8 +241,15 @@ void tty_set_operations(struct tty_driver *driver, struct tty_operations *op);
242 * is also a promise, if the above case is true, not to signal 241 * is also a promise, if the above case is true, not to signal
243 * overruns, either.) 242 * overruns, either.)
244 * 243 *
245 * TTY_DRIVER_NO_DEVFS --- if set, do not create devfs entries. This 244 * TTY_DRIVER_DYNAMIC_DEV --- if set, the individual tty devices need
246 * is only used by tty_register_driver(). 245 * to be registered with a call to tty_register_driver() when the
246 * device is found in the system and unregistered with a call to
247 * tty_unregister_device() so the devices will be show up
248 * properly in sysfs. If not set, driver->num entries will be
249 * created by the tty core in sysfs when tty_register_driver() is
250 * called. This is to be used by drivers that have tty devices
251 * that can appear and disappear while the main tty driver is
252 * registered with the tty core.
247 * 253 *
248 * TTY_DRIVER_DEVPTS_MEM -- don't use the standard arrays, instead 254 * TTY_DRIVER_DEVPTS_MEM -- don't use the standard arrays, instead
249 * use dynamic memory keyed through the devpts filesystem. This 255 * use dynamic memory keyed through the devpts filesystem. This
@@ -252,7 +258,7 @@ void tty_set_operations(struct tty_driver *driver, struct tty_operations *op);
252#define TTY_DRIVER_INSTALLED 0x0001 258#define TTY_DRIVER_INSTALLED 0x0001
253#define TTY_DRIVER_RESET_TERMIOS 0x0002 259#define TTY_DRIVER_RESET_TERMIOS 0x0002
254#define TTY_DRIVER_REAL_RAW 0x0004 260#define TTY_DRIVER_REAL_RAW 0x0004
255#define TTY_DRIVER_NO_DEVFS 0x0008 261#define TTY_DRIVER_DYNAMIC_DEV 0x0008
256#define TTY_DRIVER_DEVPTS_MEM 0x0010 262#define TTY_DRIVER_DEVPTS_MEM 0x0010
257 263
258/* tty driver types */ 264/* tty driver types */
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index a1b473190e65..62dae1a8c441 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -314,7 +314,6 @@ void *priv;
314 /* for videodev.c intenal usage -- please don't touch */ 314 /* for videodev.c intenal usage -- please don't touch */
315 int users; /* video_exclusive_{open|close} ... */ 315 int users; /* video_exclusive_{open|close} ... */
316 struct mutex lock; /* ... helper function uses these */ 316 struct mutex lock; /* ... helper function uses these */
317 char devfs_name[64]; /* devfs */
318 struct class_device class_dev; /* sysfs */ 317 struct class_device class_dev; /* sysfs */
319}; 318};
320 319
diff --git a/init/Makefile b/init/Makefile
index a2300078f2b7..633a268d270d 100644
--- a/init/Makefile
+++ b/init/Makefile
@@ -6,7 +6,6 @@ obj-y := main.o version.o mounts.o initramfs.o
6obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o 6obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o
7 7
8mounts-y := do_mounts.o 8mounts-y := do_mounts.o
9mounts-$(CONFIG_DEVFS_FS) += do_mounts_devfs.o
10mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o 9mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o
11mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o 10mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o
12mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o 11mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 21b3b8f33a72..94aeec7aa917 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -325,7 +325,7 @@ static int __init mount_nfs_root(void)
325{ 325{
326 void *data = nfs_root_data(); 326 void *data = nfs_root_data();
327 327
328 create_dev("/dev/root", ROOT_DEV, NULL); 328 create_dev("/dev/root", ROOT_DEV);
329 if (data && 329 if (data &&
330 do_mount_root("/dev/root", "nfs", root_mountflags, data) == 0) 330 do_mount_root("/dev/root", "nfs", root_mountflags, data) == 0)
331 return 1; 331 return 1;
@@ -386,7 +386,7 @@ void __init mount_root(void)
386 change_floppy("root floppy"); 386 change_floppy("root floppy");
387 } 387 }
388#endif 388#endif
389 create_dev("/dev/root", ROOT_DEV, root_device_name); 389 create_dev("/dev/root", ROOT_DEV);
390 mount_block_root("/dev/root", root_mountflags); 390 mount_block_root("/dev/root", root_mountflags);
391} 391}
392 392
@@ -397,8 +397,6 @@ void __init prepare_namespace(void)
397{ 397{
398 int is_floppy; 398 int is_floppy;
399 399
400 mount_devfs();
401
402 if (root_delay) { 400 if (root_delay) {
403 printk(KERN_INFO "Waiting %dsec before mounting root device...\n", 401 printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
404 root_delay); 402 root_delay);
@@ -428,10 +426,8 @@ void __init prepare_namespace(void)
428 426
429 mount_root(); 427 mount_root();
430out: 428out:
431 umount_devfs("/dev");
432 sys_mount(".", "/", NULL, MS_MOVE, NULL); 429 sys_mount(".", "/", NULL, MS_MOVE, NULL);
433 sys_chroot("."); 430 sys_chroot(".");
434 security_sb_post_mountroot(); 431 security_sb_post_mountroot();
435 mount_devfs_fs ();
436} 432}
437 433
diff --git a/init/do_mounts.h b/init/do_mounts.h
index e0a7ac9649e1..e7f2e7fa066e 100644
--- a/init/do_mounts.h
+++ b/init/do_mounts.h
@@ -1,6 +1,5 @@
1#include <linux/config.h> 1#include <linux/config.h>
2#include <linux/kernel.h> 2#include <linux/kernel.h>
3#include <linux/devfs_fs_kernel.h>
4#include <linux/init.h> 3#include <linux/init.h>
5#include <linux/syscalls.h> 4#include <linux/syscalls.h>
6#include <linux/unistd.h> 5#include <linux/unistd.h>
@@ -15,25 +14,12 @@ void mount_root(void);
15extern int root_mountflags; 14extern int root_mountflags;
16extern char *root_device_name; 15extern char *root_device_name;
17 16
18#ifdef CONFIG_DEVFS_FS 17static inline int create_dev(char *name, dev_t dev)
19
20void mount_devfs(void);
21void umount_devfs(char *path);
22int create_dev(char *name, dev_t dev, char *devfs_name);
23
24#else
25
26static inline void mount_devfs(void) {}
27static inline void umount_devfs(const char *path) {}
28
29static inline int create_dev(char *name, dev_t dev, char *devfs_name)
30{ 18{
31 sys_unlink(name); 19 sys_unlink(name);
32 return sys_mknod(name, S_IFBLK|0600, new_encode_dev(dev)); 20 return sys_mknod(name, S_IFBLK|0600, new_encode_dev(dev));
33} 21}
34 22
35#endif
36
37#if BITS_PER_LONG == 32 23#if BITS_PER_LONG == 32
38static inline u32 bstat(char *name) 24static inline u32 bstat(char *name)
39{ 25{
diff --git a/init/do_mounts_devfs.c b/init/do_mounts_devfs.c
deleted file mode 100644
index cc526474690a..000000000000
--- a/init/do_mounts_devfs.c
+++ /dev/null
@@ -1,137 +0,0 @@
1
2#include <linux/kernel.h>
3#include <linux/dirent.h>
4#include <linux/string.h>
5
6#include "do_mounts.h"
7
8void __init mount_devfs(void)
9{
10 sys_mount("devfs", "/dev", "devfs", 0, NULL);
11}
12
13void __init umount_devfs(char *path)
14{
15 sys_umount(path, 0);
16}
17
18/*
19 * If the dir will fit in *buf, return its length. If it won't fit, return
20 * zero. Return -ve on error.
21 */
22static int __init do_read_dir(int fd, void *buf, int len)
23{
24 long bytes, n;
25 char *p = buf;
26 sys_lseek(fd, 0, 0);
27
28 for (bytes = 0; bytes < len; bytes += n) {
29 n = sys_getdents64(fd, (struct linux_dirent64 *)(p + bytes),
30 len - bytes);
31 if (n < 0)
32 return n;
33 if (n == 0)
34 return bytes;
35 }
36 return 0;
37}
38
39/*
40 * Try to read all of a directory. Returns the contents at *p, which
41 * is kmalloced memory. Returns the number of bytes read at *len. Returns
42 * NULL on error.
43 */
44static void * __init read_dir(char *path, int *len)
45{
46 int size;
47 int fd = sys_open(path, 0, 0);
48
49 *len = 0;
50 if (fd < 0)
51 return NULL;
52
53 for (size = 1 << 9; size <= (PAGE_SIZE << MAX_ORDER); size <<= 1) {
54 void *p = kmalloc(size, GFP_KERNEL);
55 int n;
56 if (!p)
57 break;
58 n = do_read_dir(fd, p, size);
59 if (n > 0) {
60 sys_close(fd);
61 *len = n;
62 return p;
63 }
64 kfree(p);
65 if (n == -EINVAL)
66 continue; /* Try a larger buffer */
67 if (n < 0)
68 break;
69 }
70 sys_close(fd);
71 return NULL;
72}
73
74/*
75 * recursively scan <path>, looking for a device node of type <dev>
76 */
77static int __init find_in_devfs(char *path, unsigned dev)
78{
79 char *end = path + strlen(path);
80 int rest = path + 64 - end;
81 int size;
82 char *p = read_dir(path, &size);
83 char *s;
84
85 if (!p)
86 return -1;
87 for (s = p; s < p + size; s += ((struct linux_dirent64 *)s)->d_reclen) {
88 struct linux_dirent64 *d = (struct linux_dirent64 *)s;
89 if (strlen(d->d_name) + 2 > rest)
90 continue;
91 switch (d->d_type) {
92 case DT_BLK:
93 sprintf(end, "/%s", d->d_name);
94 if (bstat(path) != dev)
95 break;
96 kfree(p);
97 return 0;
98 case DT_DIR:
99 if (strcmp(d->d_name, ".") == 0)
100 break;
101 if (strcmp(d->d_name, "..") == 0)
102 break;
103 sprintf(end, "/%s", d->d_name);
104 if (find_in_devfs(path, dev) < 0)
105 break;
106 kfree(p);
107 return 0;
108 }
109 }
110 kfree(p);
111 return -1;
112}
113
114/*
115 * create a device node called <name> which points to
116 * <devfs_name> if possible, otherwise find a device node
117 * which matches <dev> and make <name> a symlink pointing to it.
118 */
119int __init create_dev(char *name, dev_t dev, char *devfs_name)
120{
121 char path[64];
122
123 sys_unlink(name);
124 if (devfs_name && devfs_name[0]) {
125 if (strncmp(devfs_name, "/dev/", 5) == 0)
126 devfs_name += 5;
127 sprintf(path, "/dev/%s", devfs_name);
128 if (sys_access(path, 0) == 0)
129 return sys_symlink(devfs_name, name);
130 }
131 if (!dev)
132 return -1;
133 strcpy(path, "/dev");
134 if (find_in_devfs(path, new_encode_dev(dev)) < 0)
135 return -1;
136 return sys_symlink(path + 5, name);
137}
diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c
index 405f9031af87..a06f037fa000 100644
--- a/init/do_mounts_initrd.c
+++ b/init/do_mounts_initrd.c
@@ -44,7 +44,7 @@ static void __init handle_initrd(void)
44 int pid; 44 int pid;
45 45
46 real_root_dev = new_encode_dev(ROOT_DEV); 46 real_root_dev = new_encode_dev(ROOT_DEV);
47 create_dev("/dev/root.old", Root_RAM0, NULL); 47 create_dev("/dev/root.old", Root_RAM0);
48 /* mount initrd on rootfs' /root */ 48 /* mount initrd on rootfs' /root */
49 mount_block_root("/dev/root.old", root_mountflags & ~MS_RDONLY); 49 mount_block_root("/dev/root.old", root_mountflags & ~MS_RDONLY);
50 sys_mkdir("/old", 0700); 50 sys_mkdir("/old", 0700);
@@ -54,7 +54,6 @@ static void __init handle_initrd(void)
54 sys_chdir("/root"); 54 sys_chdir("/root");
55 sys_mount(".", "/", NULL, MS_MOVE, NULL); 55 sys_mount(".", "/", NULL, MS_MOVE, NULL);
56 sys_chroot("."); 56 sys_chroot(".");
57 mount_devfs_fs ();
58 57
59 current->flags |= PF_NOFREEZE; 58 current->flags |= PF_NOFREEZE;
60 pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD); 59 pid = kernel_thread(do_linuxrc, "/linuxrc", SIGCHLD);
@@ -71,7 +70,6 @@ static void __init handle_initrd(void)
71 sys_chroot("."); 70 sys_chroot(".");
72 sys_close(old_fd); 71 sys_close(old_fd);
73 sys_close(root_fd); 72 sys_close(root_fd);
74 umount_devfs("/old/dev");
75 73
76 if (new_decode_dev(real_root_dev) == Root_RAM0) { 74 if (new_decode_dev(real_root_dev) == Root_RAM0) {
77 sys_chdir("/old"); 75 sys_chdir("/old");
@@ -107,7 +105,7 @@ static void __init handle_initrd(void)
107int __init initrd_load(void) 105int __init initrd_load(void)
108{ 106{
109 if (mount_initrd) { 107 if (mount_initrd) {
110 create_dev("/dev/ram", Root_RAM0, NULL); 108 create_dev("/dev/ram", Root_RAM0);
111 /* 109 /*
112 * Load the initrd data into /dev/ram0. Execute it as initrd 110 * Load the initrd data into /dev/ram0. Execute it as initrd
113 * unless /dev/ram0 is supposed to be our actual root device, 111 * unless /dev/ram0 is supposed to be our actual root device,
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index f6f36806f84a..2429e1bf8c60 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -125,19 +125,18 @@ static void __init md_setup_drive(void)
125 int err = 0; 125 int err = 0;
126 char *devname; 126 char *devname;
127 mdu_disk_info_t dinfo; 127 mdu_disk_info_t dinfo;
128 char name[16], devfs_name[16]; 128 char name[16];
129 129
130 minor = md_setup_args[ent].minor; 130 minor = md_setup_args[ent].minor;
131 partitioned = md_setup_args[ent].partitioned; 131 partitioned = md_setup_args[ent].partitioned;
132 devname = md_setup_args[ent].device_names; 132 devname = md_setup_args[ent].device_names;
133 133
134 sprintf(name, "/dev/md%s%d", partitioned?"_d":"", minor); 134 sprintf(name, "/dev/md%s%d", partitioned?"_d":"", minor);
135 sprintf(devfs_name, "/dev/md/%s%d", partitioned?"d":"", minor);
136 if (partitioned) 135 if (partitioned)
137 dev = MKDEV(mdp_major, minor << MdpMinorShift); 136 dev = MKDEV(mdp_major, minor << MdpMinorShift);
138 else 137 else
139 dev = MKDEV(MD_MAJOR, minor); 138 dev = MKDEV(MD_MAJOR, minor);
140 create_dev(name, dev, devfs_name); 139 create_dev(name, dev);
141 for (i = 0; i < MD_SB_DISKS && devname != 0; i++) { 140 for (i = 0; i < MD_SB_DISKS && devname != 0; i++) {
142 char *p; 141 char *p;
143 char comp_name[64]; 142 char comp_name[64];
@@ -272,7 +271,7 @@ __setup("md=", md_setup);
272 271
273void __init md_run_setup(void) 272void __init md_run_setup(void)
274{ 273{
275 create_dev("/dev/md0", MKDEV(MD_MAJOR, 0), "md/0"); 274 create_dev("/dev/md0", MKDEV(MD_MAJOR, 0));
276 if (raid_noautodetect) 275 if (raid_noautodetect)
277 printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n"); 276 printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n");
278 else { 277 else {
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index c2683fcd792d..ed652f40f075 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -262,8 +262,8 @@ int __init rd_load_disk(int n)
262{ 262{
263 if (rd_prompt) 263 if (rd_prompt)
264 change_floppy("root floppy disk to be loaded into RAM disk"); 264 change_floppy("root floppy disk to be loaded into RAM disk");
265 create_dev("/dev/root", ROOT_DEV, root_device_name); 265 create_dev("/dev/root", ROOT_DEV);
266 create_dev("/dev/ram", MKDEV(RAMDISK_MAJOR, n), NULL); 266 create_dev("/dev/ram", MKDEV(RAMDISK_MAJOR, n));
267 return rd_load_image("/dev/root"); 267 return rd_load_image("/dev/root");
268} 268}
269 269
diff --git a/init/main.c b/init/main.c
index 0d57f6ccb63a..bce0eb7f4f8f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -15,7 +15,6 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/proc_fs.h> 17#include <linux/proc_fs.h>
18#include <linux/devfs_fs_kernel.h>
19#include <linux/kernel.h> 18#include <linux/kernel.h>
20#include <linux/syscalls.h> 19#include <linux/syscalls.h>
21#include <linux/string.h> 20#include <linux/string.h>
diff --git a/mm/shmem.c b/mm/shmem.c
index ea64c07cbe72..b14ff817d162 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -26,7 +26,6 @@
26#include <linux/config.h> 26#include <linux/config.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/devfs_fs_kernel.h>
30#include <linux/fs.h> 29#include <linux/fs.h>
31#include <linux/mm.h> 30#include <linux/mm.h>
32#include <linux/mman.h> 31#include <linux/mman.h>
@@ -2252,9 +2251,7 @@ static int __init init_tmpfs(void)
2252 printk(KERN_ERR "Could not register tmpfs\n"); 2251 printk(KERN_ERR "Could not register tmpfs\n");
2253 goto out2; 2252 goto out2;
2254 } 2253 }
2255#ifdef CONFIG_TMPFS 2254
2256 devfs_mk_dir("shm");
2257#endif
2258 shm_mnt = vfs_kern_mount(&tmpfs_fs_type, MS_NOUSER, 2255 shm_mnt = vfs_kern_mount(&tmpfs_fs_type, MS_NOUSER,
2259 tmpfs_fs_type.name, NULL); 2256 tmpfs_fs_type.name, NULL);
2260 if (IS_ERR(shm_mnt)) { 2257 if (IS_ERR(shm_mnt)) {
diff --git a/mm/tiny-shmem.c b/mm/tiny-shmem.c
index f9d6a9cc91c4..5f2cbf0f153c 100644
--- a/mm/tiny-shmem.c
+++ b/mm/tiny-shmem.c
@@ -12,7 +12,6 @@
12 12
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/devfs_fs_kernel.h>
16#include <linux/vfs.h> 15#include <linux/vfs.h>
17#include <linux/mount.h> 16#include <linux/mount.h>
18#include <linux/file.h> 17#include <linux/file.h>
@@ -33,9 +32,6 @@ static int __init init_tmpfs(void)
33{ 32{
34 BUG_ON(register_filesystem(&tmpfs_fs_type) != 0); 33 BUG_ON(register_filesystem(&tmpfs_fs_type) != 0);
35 34
36#ifdef CONFIG_TMPFS
37 devfs_mk_dir("shm");
38#endif
39 shm_mnt = kern_mount(&tmpfs_fs_type); 35 shm_mnt = kern_mount(&tmpfs_fs_type);
40 BUG_ON(IS_ERR(shm_mnt)); 36 BUG_ON(IS_ERR(shm_mnt));
41 37
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index b81fad893328..b105a715fa93 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -1021,13 +1021,12 @@ int rfcomm_init_ttys(void)
1021 1021
1022 rfcomm_tty_driver->owner = THIS_MODULE; 1022 rfcomm_tty_driver->owner = THIS_MODULE;
1023 rfcomm_tty_driver->driver_name = "rfcomm"; 1023 rfcomm_tty_driver->driver_name = "rfcomm";
1024 rfcomm_tty_driver->devfs_name = "bluetooth/rfcomm/";
1025 rfcomm_tty_driver->name = "rfcomm"; 1024 rfcomm_tty_driver->name = "rfcomm";
1026 rfcomm_tty_driver->major = RFCOMM_TTY_MAJOR; 1025 rfcomm_tty_driver->major = RFCOMM_TTY_MAJOR;
1027 rfcomm_tty_driver->minor_start = RFCOMM_TTY_MINOR; 1026 rfcomm_tty_driver->minor_start = RFCOMM_TTY_MINOR;
1028 rfcomm_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; 1027 rfcomm_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
1029 rfcomm_tty_driver->subtype = SERIAL_TYPE_NORMAL; 1028 rfcomm_tty_driver->subtype = SERIAL_TYPE_NORMAL;
1030 rfcomm_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; 1029 rfcomm_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
1031 rfcomm_tty_driver->init_termios = tty_std_termios; 1030 rfcomm_tty_driver->init_termios = tty_std_termios;
1032 rfcomm_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; 1031 rfcomm_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
1033 tty_set_operations(rfcomm_tty_driver, &rfcomm_ops); 1032 tty_set_operations(rfcomm_tty_driver, &rfcomm_ops);
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 6f20b4206e08..b592c4bc3331 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -124,7 +124,6 @@ static int __init ircomm_tty_init(void)
124 driver->owner = THIS_MODULE; 124 driver->owner = THIS_MODULE;
125 driver->driver_name = "ircomm"; 125 driver->driver_name = "ircomm";
126 driver->name = "ircomm"; 126 driver->name = "ircomm";
127 driver->devfs_name = "ircomm";
128 driver->major = IRCOMM_TTY_MAJOR; 127 driver->major = IRCOMM_TTY_MAJOR;
129 driver->minor_start = IRCOMM_TTY_MINOR; 128 driver->minor_start = IRCOMM_TTY_MINOR;
130 driver->type = TTY_DRIVER_TYPE_SERIAL; 129 driver->type = TTY_DRIVER_TYPE_SERIAL;
diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h
index e4fe1e80029c..ad6caba02a7b 100644
--- a/net/irda/irnet/irnet.h
+++ b/net/irda/irnet/irnet.h
@@ -244,7 +244,6 @@
244#include <linux/skbuff.h> 244#include <linux/skbuff.h>
245#include <linux/tty.h> 245#include <linux/tty.h>
246#include <linux/proc_fs.h> 246#include <linux/proc_fs.h>
247#include <linux/devfs_fs_kernel.h>
248#include <linux/netdevice.h> 247#include <linux/netdevice.h>
249#include <linux/miscdevice.h> 248#include <linux/miscdevice.h>
250#include <linux/poll.h> 249#include <linux/poll.h>
diff --git a/sound/core/info.c b/sound/core/info.c
index 10c1772bf3ea..340332c6d973 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -29,7 +29,6 @@
29#include <sound/info.h> 29#include <sound/info.h>
30#include <sound/version.h> 30#include <sound/version.h>
31#include <linux/proc_fs.h> 31#include <linux/proc_fs.h>
32#include <linux/devfs_fs_kernel.h>
33#include <linux/mutex.h> 32#include <linux/mutex.h>
34#include <stdarg.h> 33#include <stdarg.h>
35 34
diff --git a/sound/core/sound.c b/sound/core/sound.c
index cd862728346c..264f2efd1af8 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -32,7 +32,6 @@
32#include <sound/control.h> 32#include <sound/control.h>
33#include <sound/initval.h> 33#include <sound/initval.h>
34#include <linux/kmod.h> 34#include <linux/kmod.h>
35#include <linux/devfs_fs_kernel.h>
36#include <linux/mutex.h> 35#include <linux/mutex.h>
37 36
38#define SNDRV_OS_MINORS 256 37#define SNDRV_OS_MINORS 256
@@ -42,7 +41,6 @@ int snd_major;
42EXPORT_SYMBOL(snd_major); 41EXPORT_SYMBOL(snd_major);
43 42
44static int cards_limit = 1; 43static int cards_limit = 1;
45static int device_mode = S_IFCHR | S_IRUGO | S_IWUGO;
46 44
47MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 45MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
48MODULE_DESCRIPTION("Advanced Linux Sound Architecture driver for soundcards."); 46MODULE_DESCRIPTION("Advanced Linux Sound Architecture driver for soundcards.");
@@ -51,10 +49,6 @@ module_param(major, int, 0444);
51MODULE_PARM_DESC(major, "Major # for sound driver."); 49MODULE_PARM_DESC(major, "Major # for sound driver.");
52module_param(cards_limit, int, 0444); 50module_param(cards_limit, int, 0444);
53MODULE_PARM_DESC(cards_limit, "Count of auto-loadable soundcards."); 51MODULE_PARM_DESC(cards_limit, "Count of auto-loadable soundcards.");
54#ifdef CONFIG_DEVFS_FS
55module_param(device_mode, int, 0444);
56MODULE_PARM_DESC(device_mode, "Device file permission mask for devfs.");
57#endif
58MODULE_ALIAS_CHARDEV_MAJOR(CONFIG_SND_MAJOR); 52MODULE_ALIAS_CHARDEV_MAJOR(CONFIG_SND_MAJOR);
59 53
60/* this one holds the actual max. card number currently available. 54/* this one holds the actual max. card number currently available.
@@ -273,8 +267,6 @@ int snd_register_device(int type, struct snd_card *card, int dev,
273 return minor; 267 return minor;
274 } 268 }
275 snd_minors[minor] = preg; 269 snd_minors[minor] = preg;
276 if (type != SNDRV_DEVICE_TYPE_CONTROL || preg->card >= cards_limit)
277 devfs_mk_cdev(MKDEV(major, minor), S_IFCHR | device_mode, "snd/%s", name);
278 if (card) 270 if (card)
279 device = card->dev; 271 device = card->dev;
280 class_device_create(sound_class, NULL, MKDEV(major, minor), device, "%s", name); 272 class_device_create(sound_class, NULL, MKDEV(major, minor), device, "%s", name);
@@ -314,9 +306,6 @@ int snd_unregister_device(int type, struct snd_card *card, int dev)
314 return -EINVAL; 306 return -EINVAL;
315 } 307 }
316 308
317 if (mptr->type != SNDRV_DEVICE_TYPE_CONTROL ||
318 mptr->card >= cards_limit) /* created in sound.c */
319 devfs_remove("snd/%s", mptr->name);
320 class_device_destroy(sound_class, MKDEV(major, minor)); 309 class_device_destroy(sound_class, MKDEV(major, minor));
321 310
322 snd_minors[minor] = NULL; 311 snd_minors[minor] = NULL;
@@ -411,24 +400,17 @@ int __exit snd_minor_info_done(void)
411 400
412static int __init alsa_sound_init(void) 401static int __init alsa_sound_init(void)
413{ 402{
414 short controlnum;
415
416 snd_major = major; 403 snd_major = major;
417 snd_ecards_limit = cards_limit; 404 snd_ecards_limit = cards_limit;
418 devfs_mk_dir("snd");
419 if (register_chrdev(major, "alsa", &snd_fops)) { 405 if (register_chrdev(major, "alsa", &snd_fops)) {
420 snd_printk(KERN_ERR "unable to register native major device number %d\n", major); 406 snd_printk(KERN_ERR "unable to register native major device number %d\n", major);
421 devfs_remove("snd");
422 return -EIO; 407 return -EIO;
423 } 408 }
424 if (snd_info_init() < 0) { 409 if (snd_info_init() < 0) {
425 unregister_chrdev(major, "alsa"); 410 unregister_chrdev(major, "alsa");
426 devfs_remove("snd");
427 return -ENOMEM; 411 return -ENOMEM;
428 } 412 }
429 snd_info_minor_register(); 413 snd_info_minor_register();
430 for (controlnum = 0; controlnum < cards_limit; controlnum++)
431 devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum);
432#ifndef MODULE 414#ifndef MODULE
433 printk(KERN_INFO "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n"); 415 printk(KERN_INFO "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n");
434#endif 416#endif
@@ -437,16 +419,10 @@ static int __init alsa_sound_init(void)
437 419
438static void __exit alsa_sound_exit(void) 420static void __exit alsa_sound_exit(void)
439{ 421{
440 short controlnum;
441
442 for (controlnum = 0; controlnum < cards_limit; controlnum++)
443 devfs_remove("snd/controlC%d", controlnum);
444
445 snd_info_minor_unregister(); 422 snd_info_minor_unregister();
446 snd_info_done(); 423 snd_info_done();
447 if (unregister_chrdev(major, "alsa") != 0) 424 if (unregister_chrdev(major, "alsa") != 0)
448 snd_printk(KERN_ERR "unable to unregister major device number %d\n", major); 425 snd_printk(KERN_ERR "unable to unregister major device number %d\n", major);
449 devfs_remove("snd");
450} 426}
451 427
452module_init(alsa_sound_init) 428module_init(alsa_sound_init)
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index d33bb464f70e..a33289948902 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -38,7 +38,6 @@
38#include <linux/wait.h> 38#include <linux/wait.h>
39#include <linux/slab.h> 39#include <linux/slab.h>
40#include <linux/ioport.h> 40#include <linux/ioport.h>
41#include <linux/devfs_fs_kernel.h>
42#include <linux/major.h> 41#include <linux/major.h>
43#include <linux/delay.h> 42#include <linux/delay.h>
44#include <linux/proc_fs.h> 43#include <linux/proc_fs.h>
@@ -564,9 +563,6 @@ static int __init oss_init(void)
564 sound_dmap_flag = (dmabuf > 0 ? 1 : 0); 563 sound_dmap_flag = (dmabuf > 0 ? 1 : 0);
565 564
566 for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { 565 for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) {
567 devfs_mk_cdev(MKDEV(SOUND_MAJOR, dev_list[i].minor),
568 S_IFCHR | dev_list[i].mode,
569 "sound/%s", dev_list[i].name);
570 class_device_create(sound_class, NULL, 566 class_device_create(sound_class, NULL,
571 MKDEV(SOUND_MAJOR, dev_list[i].minor), 567 MKDEV(SOUND_MAJOR, dev_list[i].minor),
572 NULL, "%s", dev_list[i].name); 568 NULL, "%s", dev_list[i].name);
@@ -574,15 +570,10 @@ static int __init oss_init(void)
574 if (!dev_list[i].num) 570 if (!dev_list[i].num)
575 continue; 571 continue;
576 572
577 for (j = 1; j < *dev_list[i].num; j++) { 573 for (j = 1; j < *dev_list[i].num; j++)
578 devfs_mk_cdev(MKDEV(SOUND_MAJOR,
579 dev_list[i].minor + (j*0x10)),
580 S_IFCHR | dev_list[i].mode,
581 "sound/%s%d", dev_list[i].name, j);
582 class_device_create(sound_class, NULL, 574 class_device_create(sound_class, NULL,
583 MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), 575 MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)),
584 NULL, "%s%d", dev_list[i].name, j); 576 NULL, "%s%d", dev_list[i].name, j);
585 }
586 } 577 }
587 578
588 if (sound_nblocks >= 1024) 579 if (sound_nblocks >= 1024)
@@ -596,14 +587,11 @@ static void __exit oss_cleanup(void)
596 int i, j; 587 int i, j;
597 588
598 for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { 589 for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) {
599 devfs_remove("sound/%s", dev_list[i].name);
600 class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor)); 590 class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor));
601 if (!dev_list[i].num) 591 if (!dev_list[i].num)
602 continue; 592 continue;
603 for (j = 1; j < *dev_list[i].num; j++) { 593 for (j = 1; j < *dev_list[i].num; j++)
604 devfs_remove("sound/%s%d", dev_list[i].name, j);
605 class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10))); 594 class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)));
606 }
607 } 595 }
608 596
609 unregister_sound_special(1); 597 unregister_sound_special(1);
diff --git a/sound/sound_core.c b/sound/sound_core.c
index 6f849720aef3..7535ec821dcf 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -44,7 +44,6 @@
44#include <linux/sound.h> 44#include <linux/sound.h>
45#include <linux/major.h> 45#include <linux/major.h>
46#include <linux/kmod.h> 46#include <linux/kmod.h>
47#include <linux/devfs_fs_kernel.h>
48#include <linux/device.h> 47#include <linux/device.h>
49 48
50#define SOUND_STEP 16 49#define SOUND_STEP 16
@@ -172,8 +171,6 @@ static int sound_insert_unit(struct sound_unit **list, const struct file_operati
172 else 171 else
173 sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP); 172 sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP);
174 173
175 devfs_mk_cdev(MKDEV(SOUND_MAJOR, s->unit_minor),
176 S_IFCHR | mode, s->name);
177 class_device_create(sound_class, NULL, MKDEV(SOUND_MAJOR, s->unit_minor), 174 class_device_create(sound_class, NULL, MKDEV(SOUND_MAJOR, s->unit_minor),
178 dev, s->name+6); 175 dev, s->name+6);
179 return r; 176 return r;
@@ -197,7 +194,6 @@ static void sound_remove_unit(struct sound_unit **list, int unit)
197 p = __sound_remove_unit(list, unit); 194 p = __sound_remove_unit(list, unit);
198 spin_unlock(&sound_loader_lock); 195 spin_unlock(&sound_loader_lock);
199 if (p) { 196 if (p) {
200 devfs_remove(p->name);
201 class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, p->unit_minor)); 197 class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, p->unit_minor));
202 kfree(p); 198 kfree(p);
203 } 199 }
@@ -570,7 +566,6 @@ static void __exit cleanup_soundcore(void)
570 /* We have nothing to really do here - we know the lists must be 566 /* We have nothing to really do here - we know the lists must be
571 empty */ 567 empty */
572 unregister_chrdev(SOUND_MAJOR, "sound"); 568 unregister_chrdev(SOUND_MAJOR, "sound");
573 devfs_remove("sound");
574 class_destroy(sound_class); 569 class_destroy(sound_class);
575} 570}
576 571
@@ -580,7 +575,6 @@ static int __init init_soundcore(void)
580 printk(KERN_ERR "soundcore: sound device already in use.\n"); 575 printk(KERN_ERR "soundcore: sound device already in use.\n");
581 return -EBUSY; 576 return -EBUSY;
582 } 577 }
583 devfs_mk_dir ("sound");
584 sound_class = class_create(THIS_MODULE, "sound"); 578 sound_class = class_create(THIS_MODULE, "sound");
585 if (IS_ERR(sound_class)) 579 if (IS_ERR(sound_class))
586 return PTR_ERR(sound_class); 580 return PTR_ERR(sound_class);