[Midnightbsd-cvs] src [11232] trunk/sbin/devfs: sync with freebsd
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Jul 1 17:13:37 EDT 2018
Revision: 11232
http://svnweb.midnightbsd.org/src/?rev=11232
Author: laffer1
Date: 2018-07-01 17:13:36 -0400 (Sun, 01 Jul 2018)
Log Message:
-----------
sync with freebsd
Modified Paths:
--------------
trunk/sbin/devfs/Makefile
trunk/sbin/devfs/devfs.8
trunk/sbin/devfs/devfs.c
trunk/sbin/devfs/extern.h
trunk/sbin/devfs/rule.c
Property Changed:
----------------
trunk/sbin/devfs/devfs.8
Modified: trunk/sbin/devfs/Makefile
===================================================================
--- trunk/sbin/devfs/Makefile 2018-07-01 21:13:00 UTC (rev 11231)
+++ trunk/sbin/devfs/Makefile 2018-07-01 21:13:36 UTC (rev 11232)
@@ -1,4 +1,5 @@
# $MidnightBSD$
+# $FreeBSD: stable/10/sbin/devfs/Makefile 203916 2010-02-15 14:07:40Z uqs $
PROG= devfs
SRCS= devfs.c rule.c
Modified: trunk/sbin/devfs/devfs.8
===================================================================
--- trunk/sbin/devfs/devfs.8 2018-07-01 21:13:00 UTC (rev 11231)
+++ trunk/sbin/devfs/devfs.8 2018-07-01 21:13:36 UTC (rev 11232)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
.\"
.\" Copyright (c) 2002 Dima Dorfman.
.\" All rights reserved.
@@ -23,9 +24,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/sbin/devfs/devfs.8 307434 2016-10-16 23:37:15Z sevan $
.\"
-.Dd February 21, 2010
+.Dd October 5, 2016
.Dt DEVFS 8
.Os
.Sh NAME
@@ -52,7 +53,7 @@
.Cm rule
keyword.
The following flags are common to all keywords:
-.Bl -tag -offset indent
+.Bl -tag -width 15n
.It Fl m Ar mount-point
Operate on
.Ar mount-point ,
@@ -88,7 +89,7 @@
.Cm rule
keyword.
The following flags are common to all of the rule manipulation commands:
-.Bl -tag -offset indent
+.Bl -tag -width 15n
.It Fl s Ar ruleset
Operate on the ruleset with the number
.Ar ruleset .
@@ -98,7 +99,7 @@
.El
.Pp
The following commands are recognized:
-.Bl -tag -offset indent
+.Bl -tag -width 15n
.It Cm rule add Oo Ar rulenum Oc Ar rulespec
Add the rule described by
.Ar rulespec
@@ -156,7 +157,7 @@
The following conditions are recognized.
Conditions are ANDed together when matching a device;
if OR is desired, multiple rules can be written.
-.Bl -tag -offset indent
+.Bl -tag -width 15n
.It Cm path Ar pattern
Matches any node with a path that matches
.Ar pattern ,
@@ -175,7 +176,7 @@
The following actions are recognized.
Although there is no explicit delimiter between conditions and actions,
they may not be intermixed.
-.Bl -tag -offset indent
+.Bl -tag -width 15n
.It Cm group Ar gid
Set the GID of the node to
.Ar gid ,
@@ -190,6 +191,7 @@
or with the
.Cm unhide
action.
+Hiding a directory node effectively hides all of its child nodes.
.It Cm include Ar ruleset
Apply all the rules in ruleset number
.Ar ruleset
@@ -213,6 +215,8 @@
or number.
.It Cm unhide
Unhide the node.
+If the node resides in a subdirectory,
+all parent directory nodes must be visible to be able to access the node.
.El
.Sh IMPLEMENTATION NOTES
Rulesets are created by the kernel at the first reference
@@ -238,7 +242,7 @@
The mount-point is only relevant when changing what its current ruleset is
or when using one of the apply commands.
.Sh FILES
-.Bl -tag -compact
+.Bl -tag -width "Pa /usr/share/examples/etc/devfs.conf" -compact
.It Pa /etc/defaults/devfs.rules
Default
.Nm
@@ -246,7 +250,8 @@
.It Pa /etc/devfs.rules
Local
.Nm
-configuration file. Rulesets in here override those in
+configuration file.
+Rulesets in here override those in
.Pa /etc/defaults/devfs.rules
with the same ruleset number, otherwise the two files are effectively merged.
.It Pa /etc/devfs.conf
@@ -269,13 +274,11 @@
.Pa /dev
(this only matters for things that might change the properties of nodes).
.Pp
-.Dl "devfs ruleset 10"
-.Pp
Specify that ruleset 10 should be the current ruleset for
.Pa /dev
-(if it does not already exist, it is created).
+(if it does not already exist, it is created):
.Pp
-.Dl "devfs rule add path speaker mode 666"
+.Dl "devfs ruleset 10"
.Pp
Add a rule that causes all nodes that have a path that matches
.Dq Li speaker
@@ -291,22 +294,19 @@
the rule is added
(e.g., the
.Pa atspeaker
-module is loaded after the above rule is added).
+module is loaded after the above rule is added):
.Pp
-.Dl "devfs rule applyset"
+.Dl "devfs rule add path speaker mode 666"
.Pp
Apply all the rules in the current ruleset to all the existing nodes.
-E.g., if the above rule was added after
+E.g., if the below rule was added after
.Pa /dev/speaker
was created,
this command will cause its file mode to be changed to 666
-as prescribed by the rule.
+as prescribed by the rule:
.Pp
-.Dl devfs rule add path "snp*" mode 660 group snoopers
+.Dl "devfs rule applyset"
.Pp
-(Quoting the argument to
-.Cm path
-is often necessary to disable the shell's globbing features.)
For all devices with a path that matches
.Dq Li snp* ,
set the file mode to 660 and the GID to
@@ -315,53 +315,57 @@
.Dq Li snoopers
group to use the
.Xr snp 4
-devices.
+devices
+(quoting the argument to
+.Cm path
+is often necessary to disable the shell's globbing features):
.Pp
-.Dl "devfs rule -s 20 add type disk group wheel"
+.Dl devfs rule add path "snp*" mode 660 group snoopers
.Pp
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).
-However, it can be applied explicitly, as such:
+a current ruleset for some mount-point at a later time):
.Pp
-.Dl "devfs -m /my/jail/dev rule -s 20 applyset"
+.Dl "devfs rule -s 20 add type disk group wheel"
.Pp
-This will apply all rules in ruleset number 20 to the DEVFS mount on
+Explicitly apply all rules in ruleset number 20 to the DEVFS mount on
.Pa /my/jail/dev .
It does not matter that ruleset 20 is not the current ruleset for that
-mount-point; the rules are still applied.
+mount-point; the rules are still applied:
.Pp
-.Dl "devfs rule apply hide"
+.Dl "devfs -m /my/jail/dev rule -s 20 applyset"
.Pp
-Since this rule has no conditions, the action
+Since the following rule has no conditions, the action
.Pq Cm hide
-will be applied to all nodes.
-Since hiding all nodes is not very useful, we can undo it:
+will be applied to all nodes:
.Pp
-.Dl "devfs rule apply unhide"
+.Dl "devfs rule apply hide"
.Pp
-which applies
+Since hiding all nodes is not very useful, we can undo it.
+The following applies
.Cm unhide
to all the nodes,
-causing them to reappear.
+causing them to reappear:
.Pp
-.Dl "devfs rule -s 10 add - < my_rules"
+.Dl "devfs rule apply unhide"
.Pp
Add all the rules from the file
.Pa my_rules
-to ruleset 10.
+to ruleset 10:
.Pp
-.Dl "devfs rule -s 20 show | devfs rule -s 10 add -"
+.Dl "devfs rule -s 10 add - < my_rules"
.Pp
+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
.Cm show
outputs valid rules,
-this feature can be used to copy rulesets.
-The above 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).
+this feature can be used to copy rulesets:
+.Pp
+.Dl "devfs rule -s 20 show | devfs rule -s 10 add -"
.Sh SEE ALSO
.Xr chmod 1 ,
.Xr jail 2 ,
@@ -372,5 +376,10 @@
.Xr chown 8 ,
.Xr jail 8 ,
.Xr mknod 8
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 5.0 .
.Sh AUTHORS
.An Dima Dorfman
Property changes on: trunk/sbin/devfs/devfs.8
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sbin/devfs/devfs.c
===================================================================
--- trunk/sbin/devfs/devfs.c 2018-07-01 21:13:00 UTC (rev 11231)
+++ trunk/sbin/devfs/devfs.c 2018-07-01 21:13:36 UTC (rev 11232)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2001, 2002 Dima Dorfman.
* All rights reserved.
@@ -29,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sbin/devfs/devfs.c 315355 2017-03-16 01:59:43Z ngie $");
#include <sys/param.h>
#include <sys/queue.h>
@@ -225,6 +226,8 @@
usage(void)
{
- fprintf(stderr, "usage: devfs rule|ruleset arguments\n");
+ fprintf(stderr, "usage: %s\n%s\n",
+ "\tdevfs [-m mount-point] [-s ruleset] rule ...",
+ "\tdevfs [-m mount-point] ruleset ...");
exit(1);
}
Modified: trunk/sbin/devfs/extern.h
===================================================================
--- trunk/sbin/devfs/extern.h 2018-07-01 21:13:00 UTC (rev 11231)
+++ trunk/sbin/devfs/extern.h 2018-07-01 21:13:36 UTC (rev 11232)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002 Dima Dorfman.
* All rights reserved.
@@ -23,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sbin/devfs/extern.h 130021 2004-06-02 23:02:31Z stefanf $
*/
#ifndef __DEVFS_H__
Modified: trunk/sbin/devfs/rule.c
===================================================================
--- trunk/sbin/devfs/rule.c 2018-07-01 21:13:00 UTC (rev 11231)
+++ trunk/sbin/devfs/rule.c 2018-07-01 21:13:36 UTC (rev 11232)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
/*-
* Copyright (c) 2002 Dima Dorfman.
* All rights reserved.
@@ -29,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sbin/devfs/rule.c 229778 2012-01-07 16:09:33Z uqs $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -47,7 +48,7 @@
#include "extern.h"
-static void rulespec_infp(FILE *fp, unsigned long reqest, devfs_rsnum rsnum);
+static void rulespec_infp(FILE *fp, unsigned long request, devfs_rsnum rsnum);
static void rulespec_instr(struct devfs_rule *dr, const char *str,
devfs_rsnum rsnum);
static void rulespec_intok(struct devfs_rule *dr, int ac, char **av,
@@ -76,7 +77,7 @@
{ NULL, -1 }
};
-devfs_rsnum in_rsnum;
+static devfs_rsnum in_rsnum;
int
rule_main(int ac, char **av)
More information about the Midnightbsd-cvs
mailing list