/[gentoo]/xml/htdocs/doc/en/devfs-guide.xml
Gentoo

Diff of /xml/htdocs/doc/en/devfs-guide.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.3 Revision 1.9
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/devfs-guide.xml,v 1.3 2003/11/15 00:35:18 neysx Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/devfs-guide.xml,v 1.9 2005/06/20 08:09:11 fox2mike Exp $ -->
3 3
4<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 4<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
5 5
6<guide link="/doc/en/devfs-guide.xml"> 6<guide link="/doc/en/devfs-guide.xml">
7<title>Device File System Guide</title> 7<title>Device File System Guide</title>
8<author title="Author"> 8<author title="Author">
9 <mail link="swift@gentoo.org">Sven Vermeulen</mail> 9 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
10</author> 10</author>
11<author title="Reviewer"> 11<author title="Reviewer">
12 <mail link="seemant@gentoo.org">Seemant Kulleen</mail> 12 <mail link="seemant@gentoo.org">Seemant Kulleen</mail>
13</author> 13</author>
14 14
15<abstract> 15<abstract>
16In this document you'll find information on what devfs is really about 16In this document you'll find information on what devfs is really about
17and how to work with it. 17and how to work with it.
18</abstract> 18</abstract>
19<version>0.1</version> 19
20<date>September 11, 2003</date>
21<license/> 20<license/>
21
22<version>0.4</version>
23<date>2005-06-20</date>
24
22<chapter> 25<chapter>
23<title>What is devfs?</title> 26<title>What is devfs?</title>
24
25<section> 27<section>
26<title>The (good?) old days</title> 28<title>The (good?) old days</title>
27<body> 29<body>
30
31<warn>devfs is <e>obsolete</e> and will eventually be removed from the stable
322.6 tree. Users on 2.6 kernels are hereby advised to switch to udev. For further
33information on udev, please refer to the <uri
34link="/doc/en/udev-guide.xml">Gentoo udev Guide</uri>.
35</warn>
28 36
29<p> 37<p>
30Traditional Linux implementations provide their users with an 38Traditional Linux implementations provide their users with an
31abstract device path, called <path>/dev</path>. Inside this path the 39abstract device path, called <path>/dev</path>. Inside this path the
32user finds <e>device nodes</e>, special files that represent devices 40user finds <e>device nodes</e>, special files that represent devices
75fifth terminal). 83fifth terminal).
76</p> 84</p>
77 85
78</body> 86</body>
79</section> 87</section>
80
81<section> 88<section>
82<title>The problems</title> 89<title>The problems</title>
83<body> 90<body>
84 91
85<p> 92<p>
125</p> 132</p>
126 133
127</body> 134</body>
128</section> 135</section>
129<section> 136<section>
130<title>devfs as all-round winner</title> 137<title>devfs as all-round winner ?</title>
131<body> 138<body>
132 139
133<p> 140<p>
134devfs tackles all listed problems. It only provides the user with 141devfs tackles all listed problems. It only provides the user with
135existing devices, adds new nodes when new devices are found, and makes 142existing devices, adds new nodes when new devices are found, and makes
143pairs. It is still supported (for backwards compatibility), but isn't 150pairs. It is still supported (for backwards compatibility), but isn't
144needed. This makes it possible for Linux to support even more devices, 151needed. This makes it possible for Linux to support even more devices,
145since there are no limits anymore (numbers always have boundaries :) 152since there are no limits anymore (numbers always have boundaries :)
146</p> 153</p>
147 154
148</body> 155<p>
149</section> 156Yet devfs does come with it's own problems; for the end users these issues
157aren't really visible, but for the kernel maintainers the problems are big
158enough to mark devfs <e>obsolete</e> in favor of <uri
159link="udev-guide.xml">udev</uri>, which Gentoo supports and uses by default on
160most architectures since the 2005.0 release when using a 2.6 kernel.
161</p>
150 162
163<p>
164For more information as to why devfs is marked obsolete, please read the <uri
165link="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ">udev
166FAQ</uri> and <uri
167link="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev_vs_devfs">udev
168versus devfs document</uri>.
169</p>
170
171</body>
172</section>
151</chapter> 173</chapter>
174
152<chapter> 175<chapter>
153<title>Navigating through the device tree</title> 176<title>Navigating through the device tree</title>
154
155<section> 177<section>
156<title>Directories</title> 178<title>Directories</title>
157<body> 179<body>
158 180
159<p> 181<p>
229</p> 251</p>
230 252
231</body> 253</body>
232</section> 254</section>
233</chapter> 255</chapter>
256
234<chapter> 257<chapter>
235<title>Administrating the device tree</title> 258<title>Administrating the device tree</title>
236
237<section> 259<section>
238<title>Restarting devfsd</title> 260<title>Restarting devfsd</title>
239<body> 261<body>
240 262
241<p> 263<p>
265# <i>killall -s SIGHUP devfsd</i> 287# <i>killall -s SIGHUP devfsd</i>
266</pre> 288</pre>
267 289
268</body> 290</body>
269</section> 291</section>
270
271<section> 292<section>
272<title>Removing compatibility symlinks</title> 293<title>Removing compatibility symlinks</title>
273<body> 294<body>
274 295
275<warn> 296<warn>
292You need to reboot your system for the changes to take affect. 313You need to reboot your system for the changes to take affect.
293</p> 314</p>
294 315
295</body> 316</body>
296</section> 317</section>
297
298<section> 318<section>
299<title>Removing autoload functionality</title> 319<title>Removing autoload functionality</title>
300<body> 320<body>
301 321
302<p> 322<p>
309LOOKUP .* MODLOAD 329LOOKUP .* MODLOAD
310</pre> 330</pre>
311 331
312</body> 332</body>
313</section> 333</section>
314
315</chapter> 334</chapter>
335
316<chapter> 336<chapter>
317<title>Permission Related Items</title> 337<title>Permission Related Items</title>
318<section> 338<section>
319<title>Set/change permissions using PAM</title>
320<body>
321
322<p>
323Although you can set permissions in <path>/etc/devfsd.conf</path>, you
324are advised to use PAM (<e>Pluggable Authentification Modules</e>). This
325is because PAM has the final say on permissions, possibly ignoring the
326changes you make in <path>/etc/devfsd.conf</path>.
327</p>
328
329<p>
330PAM uses the <path>/etc/security/console.perms</path> file for the
331permissions. The file consists of two parts: the first one describes the
332groups, and the second one the permissions.
333</p>
334
335<p>
336Let's first take a look at the groups part. As an example we view the
337sound-group:
338</p>
339
340<pre caption = "Sound group in /etc/security/console.perms">
341&lt;sound&gt;=/dev/dsp* /dev/audio* /dev/midi* \
342 /dev/mixer* /dev/sequencer* \
343 /dev/sound/* /dev/snd/* /dev/beep \
344 /dev/admm* \
345 /dev/adsp* /dev/aload* /dev/amidi* /dev/dmfm* \
346 /dev/dmmidi* /dev/sndstat
347</pre>
348
349<p>
350The syntax is quite easy: you start with a group-name, and end with a
351list of devices that belong to that group.
352</p>
353
354<p>
355Now, groups aren't very usefull if you can't do anything with them. So
356the next part describes how permissions are handled.
357</p>
358
359<pre caption = "Permissions for sound group in /etc/security/console.perms">
360&lt;console&gt; 0600 &lt;sound&gt; 0600 root.audio
361</pre>
362
363<p>
364The first field is the terminal check. On most systems, this is the
365console-group. PAM will check this field for every login. If the login
366happens on a device contained in the console-group, PAM will check and
367possibly change the permissions on some device files.
368</p>
369
370<p>
371The second field contains the permissions to which a device file is set
372upon succesfull login. When a person logs into the system, and the device
373files are owned by a default owner/group, PAM wil change the ownership
374to the logged on user, and set the permissions to those in this second
375field. In this case, 0600 is used (user has read/write access,
376all others don't).
377</p>
378
379<p>
380The third field contains the device-group whose permissions will be
381changed. In this case, the sound-group (all device files related to
382sound) will be changed.
383</p>
384
385<p>
386The fourth field defines the permissions to which the device file is set after
387returning to the default state. In other words, if the person who owns
388all the device files logs out, PAM will set the permissions back to a
389default state, described by this fourth field.
390</p>
391
392<p>
393The fifth field defines the ownership (with group if you want) to which
394the device attributes are set after returning to the default state. In
395other words, if the person who owns all the device files logs out, PAM
396will set the ownership back to a default state, described by this fifth
397field.
398</p>
399
400</body>
401</section>
402
403<section>
404<title>Set/change permissions with devfsd</title> 339<title>Set/change permissions with devfsd</title>
405<body> 340<body>
406 341
342<note>
343These instructions are valid as long as pam_console is disabled in
344<path>/etc/pam.d/system-auth</path>. If you enabled pam_console there,
345then PAM has the final word on permissions.
346</note>
347
407<p> 348<p>
408If you really want to set permissions using 349If you want to set permissions using <path>/etc/devfsd.conf</path>,
409<path>/etc/devfsd.conf</path>, then use the syntax used in the following 350then use the syntax used in the following example:
410example:
411</p> 351</p>
412 352
413<pre caption = "Permissions in /etc/devfsd.conf"> 353<pre caption = "Permissions in /etc/devfsd.conf">
414REGISTER ^cdroms/.* PERMISSIONS root.cdrom 0660 354REGISTER ^cdroms/.* PERMISSIONS root.cdrom 0660
415</pre> 355</pre>
419It is a regular expression, meaning you can select several device files 359It is a regular expression, meaning you can select several device files
420in one rule. 360in one rule.
421</p> 361</p>
422 362
423<p> 363<p>
424The fourth field is the ownership of the device file. Unlike with PAM 364The fourth field is the ownership of the device file, and the fifth
425this isn't changed (unless it is mentioned in <path>console.perms</path>
426since PAM always wins).
427</p>
428
429<p>
430The fifth field contains the permissions of the device file. 365field contains the permissions of the device file.
431</p> 366</p>
432 367
433</body> 368</body>
434</section> 369</section>
435
436<section> 370<section>
437<title>Manually set permissions and have devfsd save it</title> 371<title>Manually set permissions and have devfsd save it</title>
438<body> 372<body>
439 373
440<p> 374<p>
441This is the default behaviour for Gentoo: if you <c>chown</c> (CHange 375This is the default behaviour for Gentoo: if you <c>chown</c> (CHange
442OWNer) and <c>chmod</c> (CHange MODe) some device files, <c>devfsd</c> 376OWNer) and <c>chmod</c> (CHange MODe) some device files, <c>devfsd</c>
443will save the information when you are shutting down the system. This is 377will save the information so that it will persist across reboots. This
444because the <path>/etc/devfsd.conf</path> file contains the following 378is because the <path>/etc/devfsd.conf</path> file contains the
445lines: 379following lines:
446</p> 380</p>
447 381
448<pre caption = "/etc/devfsd.conf for saving permissions"> 382<pre caption = "/etc/devfsd.conf for saving permissions">
449REGISTER ^pt[sy]/.* IGNORE 383REGISTER ^pt[sy]/.* IGNORE
450CHANGE ^pt[sy]/.* IGNORE 384CHANGE ^pt[sy]/.* IGNORE
462RESTORE /lib/dev-state 396RESTORE /lib/dev-state
463</pre> 397</pre>
464 398
465<p> 399<p>
466In other words, changed device files are copied over to 400In other words, changed device files are copied over to
467<path>/lib/dev-state</path> when shutting down the system, and are 401<path>/lib/dev-state</path> as soon as the change happens, and are
468copied over to <path>/dev</path> when booting the system. 402copied over to <path>/dev</path> when booting the system.
469</p> 403</p>
470 404
471<p> 405<p>
472Another possibility is to mount <path>/lib/dev-state</path> on 406Another possibility is to mount <path>/lib/dev-state</path> on
494<p> 428<p>
495For more information on devfs, check out the following resources. 429For more information on devfs, check out the following resources.
496</p> 430</p>
497 431
498<p> 432<p>
499The devfd.conf manpage explains the syntax of the 433The devfsd.conf manpage explains the syntax of the
500<path>/etc/devfsd.conf</path> file. To view it, type <c>man 434<path>/etc/devfsd.conf</path> file. To view it, type <c>man
501devfsd.conf</c>. 435devfsd.conf</c>.
502</p> 436</p>
503 437
504<p> 438<p>
519Daniel Robbins has written a set of articles for IBM's DeveloperWorks 453Daniel Robbins has written a set of articles for IBM's DeveloperWorks
520about Advanced filesystems. Three of them are about devfs: 454about Advanced filesystems. Three of them are about devfs:
521</p> 455</p>
522 456
523<ul> 457<ul>
524<li><uri 458 <li>
525link="http://www-106.ibm.com/developerworks/linux/library/l-fs4/">Introduction 459 <uri link="http://www-106.ibm.com/developerworks/linux/library/l-fs4/">
526to devfs</uri></li> 460 Introduction to devfs</uri>
527<li><uri 461 </li>
462 <li>
528link="http://www-106.ibm.com/developerworks/linux/library/l-fs5/">Setting 463 <uri link="http://www-106.ibm.com/developerworks/linux/library/l-fs5/">
529up devfs</uri></li> 464 Setting up devfs</uri>
530<li><uri 465 </li>
466 <li>
531link="http://www-106.ibm.com/developerworks/linux/library/l-fs6/">Implementing 467 <uri link="http://www-106.ibm.com/developerworks/linux/library/l-fs6/">
532devfs</uri></li> 468 Implementing devfs</uri>
469 </li>
533</ul> 470</ul>
534 471
535</body> 472</body>
536</section> 473</section>
537</chapter> 474</chapter>

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.20