|
NAMEdevfs —
DEVFS control
SYNOPSIS
DESCRIPTIONThedevfs utility provides an interface to manipulate
properties of
devfs(5)
mounts.
The rules, by default as configured by /etc/rc.conf, are loaded at boot via the devfs service(8). The rules can be reloaded by running the command: service devfs restart The keyword argument determines the context
for the rest of the arguments. For example, most of the commands related to
the rule subsystem must be preceded by the
Rule SubsystemThe devfs(5) rule subsystem provides a way for the administrator of a system to control the attributes of DEVFS nodes. Each DEVFS mount-point has a “ruleset”, or a list of rules, associated with it. When a device driver creates a new node, all the rules in the ruleset associated with each mount-point are applied (see below) before the node becomes visible to the userland. This permits the administrator to change the properties, including the visibility, of certain nodes. For example, one might want to hide all disk nodes in a jail(2)'s /dev.Rule ManipulationRule manipulation commands follow therule keyword. The
following flags are common to all of the rule manipulation commands:
The following commands are recognized:
Rule SpecificationRules have two parts: the conditions and the actions. The conditions determine which DEVFS nodes the rule matches and the actions determine what should be done when a rule matches a node. For example, a rule can be written that sets the GID to “operator ” for all devices of
type tape. If the first token of a rule specification is a single dash
(‘- ’), rules are read from the standard
input and the rest of the specification is ignored.
The following conditions are recognized. Conditions are ANDed together when matching a device; if OR is desired, multiple rules can be written.
The following actions are recognized. Although there is no explicit delimiter between conditions and actions, they may not be intermixed.
IMPLEMENTATION NOTESRulesets are created by the kernel at the first reference and destroyed when the last reference disappears. E.g., a ruleset is created when a rule is added to it or when it is set as the current ruleset for a mount-point, and a ruleset is destroyed when the last rule in it is deleted and no other references to it exist (i.e., it is not included by any rules and it is not the current ruleset for any mount-point).Ruleset number 0 is the default ruleset for all new mount-points.
It is always empty, cannot be modified or deleted, and does not show up in
the output of Rules and rulesets are unique to the entire system, not a
particular mount-point. I.e., a FILES
EXAMPLESWhen the system boots, the only ruleset that exists is ruleset number 0; since the latter may not be modified, we have to create another ruleset before adding rules. Note that since most of the following examples do not specify-m , the operations are performed on
/dev (this only matters for things that might change
the properties of nodes).
Specify that ruleset 10 should be the current ruleset for /dev (if it does not already exist, it is created): devfs ruleset 10 Add a rule that causes all nodes that have a path that matches
“ devfs rule add path speaker mode
666 Apply all the rules in the current ruleset to all the existing nodes. E.g., if the below rule was added after /dev/speaker was created, this command will cause its file mode to be changed to 666 as prescribed by the rule: devfs rule applyset For all devices with a path that matches
“ devfs rule add path snp* mode 660
group snoopers Add a rule to ruleset number 20. Since this ruleset is not the current ruleset for any mount-points, this rule is never applied automatically (unless ruleset 20 becomes a current ruleset for some mount-point at a later time): devfs rule -s 20 add type disk group
wheel Explicitly apply all rules in ruleset number 20 to the DEVFS mount on /my/jail/dev. It does not matter that ruleset 20 is not the current ruleset for that mount-point; the rules are still applied: devfs -m /my/jail/dev rule -s 20
applyset Since the following rule has no conditions, the action
( devfs rule apply hide Since hiding all nodes is not very useful, we can undo it. The
following applies devfs rule apply unhide Add all the rules from the file my_rules to ruleset 10: devfs rule -s 10 add - <
my_rules The below copies all the rules from ruleset 20 into ruleset 10.
The rule numbers are preserved, but ruleset 10 may already have rules with
non-conflicting numbers (these will be preserved). Since
devfs rule -s 20 show | devfs rule -s
10 add - SEE ALSOchmod(1), jail(2), glob(3), devfs(5), devfs.conf(5), devfs.rules(5), chown(8), jail(8), mknod(8), service(8)HISTORYThedevfs utility first appeared in
FreeBSD 5.0.
AUTHORSDima Dorfman
Visit the GSP FreeBSD Man Page Interface. |