| Commit | Line | Data |
|---|---|---|
| cf0e588c | 1 | .\" |
| af8adb5c SW |
2 | .\" Copyright (c) 2009 |
| 3 | .\" The DragonFly Project. All rights reserved. | |
| cf0e588c MD |
4 | .\" |
| 5 | .\" Redistribution and use in source and binary forms, with or without | |
| 6 | .\" modification, are permitted provided that the following conditions | |
| 7 | .\" are met: | |
| cf0e588c | 8 | .\" |
| cf0e588c MD |
9 | .\" 1. Redistributions of source code must retain the above copyright |
| 10 | .\" notice, this list of conditions and the following disclaimer. | |
| 11 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
| af8adb5c SW |
12 | .\" notice, this list of conditions and the following disclaimer in |
| 13 | .\" the documentation and/or other materials provided with the | |
| 14 | .\" distribution. | |
| 15 | .\" 3. Neither the name of The DragonFly Project nor the names of its | |
| 16 | .\" contributors may be used to endorse or promote products derived | |
| 17 | .\" from this software without specific, prior written permission. | |
| cf0e588c | 18 | .\" |
| af8adb5c SW |
19 | .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 21 | .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | |
| 22 | .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |
| 23 | .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 24 | .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
| 25 | .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 26 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
| 27 | .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
| 28 | .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |
| 29 | .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| cf0e588c MD |
30 | .\" SUCH DAMAGE. |
| 31 | .\" | |
| b374f6d5 | 32 | .Dd August 25, 2009 |
| cf0e588c | 33 | .Os |
| af8adb5c | 34 | .Dt DEVFSCTL 8 |
| cf0e588c | 35 | .Sh NAME |
| af8adb5c SW |
36 | .Nm devfsctl |
| 37 | .Nd manipulate devfs rules | |
| cf0e588c MD |
38 | .Sh SYNOPSIS |
| 39 | .Nm | |
| af8adb5c SW |
40 | .Fl a |
| 41 | .Fl f Ar file | |
| 42 | .Op Fl m Ar mount_point | |
| cf0e588c | 43 | .Nm |
| cf0e588c | 44 | .Fl d |
| af8adb5c | 45 | .Fl f Ar file |
| cf0e588c | 46 | .Nm |
| af8adb5c SW |
47 | .Fl c |
| 48 | .Op Fl m Ar mount_point | |
| cf0e588c | 49 | .Nm |
| af8adb5c SW |
50 | .Fl r |
| 51 | .Op Fl m Ar mount_point | |
| cf0e588c | 52 | .Nm |
| af8adb5c SW |
53 | .Fl h |
| 54 | .Sh DESCRIPTION | |
| 55 | The | |
| cf0e588c | 56 | .Nm |
| af8adb5c SW |
57 | provides an interface to manipulate the in-kernel |
| 58 | .Xr devfs 5 | |
| 59 | ruleset. | |
| cf0e588c | 60 | .Pp |
| af8adb5c SW |
61 | The options are as follows: |
| 62 | .Bl -tag -width indent | |
| 63 | .It Fl a | |
| 64 | Load the ruleset specified by | |
| 65 | .Fl f | |
| 66 | and apply it. | |
| 67 | It will not overwrite currently applied rules, | |
| 68 | but just append the new ones. | |
| 69 | .It Fl c | |
| 70 | Clear the current ruleset. | |
| 71 | This does not reset the device nodes, but only clear out all stored rules | |
| 72 | so that they are not applied to new nodes. | |
| 73 | It is therefore recommended to use this command in conjunction with | |
| 74 | .Fl r . | |
| 75 | .It Fl d | |
| 76 | Reads ruleset specified by | |
| 77 | .Fl f | |
| 78 | and then dumps its contents to stdout. | |
| 79 | The rules will not be applied. | |
| 80 | This option cannot be used in conjuction with any other option. | |
| 81 | It is useful for checking the correct syntax and order of the specified ruleset | |
| 82 | and will show the final interpretation as it would be applied. | |
| 83 | .It Fl f Ar file | |
| 84 | Specifies the file containing the ruleset to be loaded. | |
| af8adb5c SW |
85 | This option is a requirement for |
| 86 | .Fl a | |
| 87 | and | |
| 88 | .Fl d . | |
| 89 | .It Fl h | |
| 90 | Shows a usage message with a short description of | |
| 91 | .Nm Ap s | |
| 92 | options. | |
| 93 | .It Fl m Ar mount_point | |
| 94 | Specifies the mount point to which the loaded rules shall apply. | |
| 95 | If this option is not specified, the rules will apply to all | |
| 96 | .Xr devfs 5 | |
| 97 | mountpoints. | |
| 98 | The | |
| 99 | .Ar mount_point | |
| 100 | argument does not accept wildcards and must be an absolute path. | |
| 101 | .It Fl r | |
| 102 | Reset all | |
| 103 | .Xr devfs 5 | |
| 104 | nodes to their original status. | |
| 105 | This does not clear the current ruleset and it is hence recommended | |
| 106 | to use this command together with | |
| 107 | .Fl c . | |
| cf0e588c | 108 | .El |
| 3f8ce459 SW |
109 | .Sh RULE SYNTAX |
| 110 | Rules are specified one rule per line, with whitespace separated values. | |
| 111 | Empty lines and lines beginning with a | |
| 112 | .Dq # | |
| 113 | are ignored. | |
| 114 | Once applied, the rules are in effect for existing device nodes as well | |
| 115 | as future ones. | |
| 116 | Rules are applied in the order specified, thus later rules will override | |
| 117 | prior ones. | |
| 118 | .Pp | |
| 119 | Names used in | |
| 120 | .Xr devfs 5 | |
| 121 | rules can be either device names (? and * wildcards are allowed), device | |
| 122 | types or existing groups. | |
| 123 | Groups are referenced in rules by prefixing them with | |
| 124 | .Sq @ . | |
| 125 | A device type is one of the following list of special names: | |
| 126 | .Pp | |
| 127 | .Bl -tag -offset indent -width ".Li D_DISK" -compact | |
| 128 | .It Li D_DISK | |
| 129 | disk devices/slices/partitions | |
| 130 | .It Li D_TAPE | |
| 131 | tape devices | |
| 132 | .It Li D_MEM | |
| 133 | (kernel) memory devices | |
| 134 | .It Li D_TTY | |
| 135 | tty devices | |
| 136 | .El | |
| 137 | .Pp | |
| 138 | Rule lines are of the following format: | |
| 139 | .Bd -literal -offset indent | |
| 140 | .Ic action Cm argument ... | |
| 141 | .Ed | |
| 142 | .Pp | |
| 143 | Valid actions are | |
| 144 | .Ic group , | |
| 145 | .Ic include , | |
| 146 | .Ic hide , | |
| 147 | .Ic jail , | |
| 148 | .Ic link , | |
| 149 | .Ic perm | |
| 150 | and | |
| 151 | .Ic show : | |
| 152 | .Bl -tag -width indent -offset indent | |
| 153 | .It Ic group Ar group_name Ar name ... | |
| 154 | This will group the specified names into a group of the specified | |
| 155 | .Ar group_name . | |
| 156 | .It Ic include Ar file | |
| 157 | Includes the specified rule file and processes its rules. | |
| 158 | .It Ic hide Ar name | |
| 159 | This will hide the device node(s) specified by | |
| 160 | .Ar name . | |
| 161 | A hidden node will not appear in directory listings and all operations on | |
| 162 | it will fail, except if it is open already. | |
| 163 | By default, everything except | |
| 164 | .Xr pty 4 | |
| 165 | nodes is shown. | |
| 166 | .It Ic jail Ar yes|no | |
| 167 | A | |
| 168 | .Sq Ar yes | |
| 169 | argument will cause all following rules to only apply to mounts of | |
| 69e4c083 | 170 | .Xr devfs 5 |
| 3f8ce459 SW |
171 | inside a |
| 172 | .Xr jail 8 , | |
| 173 | until a | |
| 174 | .Dq Ic jail Ar no | |
| 175 | is reached. | |
| 176 | .It Ic link Ar device Ar path | |
| 177 | .Ic link | |
| 178 | rules will create a link node at the specified | |
| 179 | .Ar link_path | |
| 180 | to the given | |
| 181 | .Ar device . | |
| 182 | The path is relative to the mountpoint being operated on (see | |
| 183 | .Xr devfsctl 8 Ap s | |
| 184 | .Fl m | |
| 185 | option), which is usually | |
| 186 | .Pa /dev . | |
| 187 | .Pp | |
| 188 | Note that for | |
| 189 | .Ic link | |
| 190 | rules, the | |
| 191 | .Ar device | |
| 192 | has to be a single device node and specifying a device type or group (unless | |
| 193 | it contains only one node) is not possible. | |
| 194 | .It Ic perm Ar name Ar user:group Ar mode | |
| 195 | A | |
| 196 | .Ic perm | |
| 197 | rule will applies the specified mode (octal, see | |
| 198 | .Xr chmod 1 ) | |
| 199 | and ownership (see | |
| 200 | .Xr chown 2 ) | |
| 201 | to | |
| 202 | .Ar name . | |
| 203 | .It Ic show Ar name | |
| 204 | This will show previously hidden nodes again. | |
| 205 | .El | |
| af8adb5c SW |
206 | .Sh FILES |
| 207 | .Bl -tag -width ".Pa /etc/devfs" -compact | |
| b374f6d5 MS |
208 | .It Pa /etc/defaults/devfs.conf |
| 209 | Global devfs ruleset file | |
| 210 | .It Pa /etc/devfs.conf | |
| 211 | Local devfs ruleset file | |
| cf0e588c | 212 | .El |
| 3f8ce459 SW |
213 | .Sh EXAMPLES |
| 214 | Examples of valid names: | |
| 215 | .Bd -literal -offset indent | |
| 216 | bpf* | |
| 217 | tun0 | |
| 218 | D_DISK | |
| 219 | serno/*s3 | |
| 220 | @groupA | |
| 221 | .Ed | |
| 222 | .Pp | |
| 223 | Examples of valid rules: | |
| 224 | .Bd -literal -offset indent | |
| 225 | group foo da* ri* | |
| 226 | group foo ad* | |
| 227 | group foo md* | |
| 228 | ||
| 229 | perm da0 uucp:dialer 0644 | |
| 230 | link foo bar | |
| 231 | hide @foo | |
| 232 | show D_DISK | |
| 233 | group g1 a b f g | |
| 234 | group g2 c d | |
| 235 | group g3 @g1 h @g2 i j k D_MEM | |
| 236 | jail yes | |
| 237 | hide @g3 | |
| 238 | perm @g3 root:wheel 0644 | |
| 239 | jail no | |
| 240 | group cdrom cd* acd* | |
| 241 | group disks da* | |
| 242 | group disks ad* | |
| 243 | group drives @disks @cdrom | |
| 244 | ||
| 245 | group test @disks @g2 y | |
| 246 | show @drives | |
| 247 | show @disks | |
| 248 | show @test | |
| 249 | link da0 "my drives/my new da0" | |
| 250 | .Ed | |
| cf0e588c | 251 | .Sh SEE ALSO |
| af8adb5c | 252 | .Xr devfs 5 , |
| af8adb5c | 253 | .Xr mount_devfs 8 |
| cf0e588c | 254 | .Sh HISTORY |
| af8adb5c | 255 | The |
| cf0e588c | 256 | .Nm |
| af8adb5c SW |
257 | utility appeared in |
| 258 | .Dx 2.3 . | |
| cf0e588c | 259 | .Sh AUTHORS |
| af8adb5c | 260 | .An Alex Hornung |