[CFR][DEVFS] rc.conf option devfs_load_rulesets

Martin Matuska mm at FreeBSD.org
Mon Feb 6 09:39:32 UTC 2012


FreeBSD includes four system rulesets in /etc/defaults/devfs.rules and
allows users to configure their custom rulesets in /etc/devfs.rules.
However, if not using jails or not specifying at least one of the
"devfs_system_ruleset" or "devfs_set_rulesets" variables, there is no
way to automatically load the rules from these configuration files.

The attached patch introduces a "devfs_load_rulesets" yes/no variable,
that allows the user to have the devfs rules always loaded on startup or
if manually running /etc/rc.d/devfs start.

The patch is also available at:
http://people.freebsd.org/~mm/patches/devfs/devfs_load_rulesets.patch

Please review and/or comment my attached patch.

-- 
Martin Matuska
FreeBSD committer
http://blog.vx.sk

-------------- next part --------------
Index: etc/defaults/rc.conf
===================================================================
--- etc/defaults/rc.conf	(revision 231065)
+++ etc/defaults/rc.conf	(working copy)
@@ -648,6 +648,7 @@ devfs_rulesets="/etc/defaults/devfs.rules /etc/dev
 devfs_system_ruleset=""	# The name (NOT number) of a ruleset to apply to /dev
 devfs_set_rulesets=""	# A list of /mount/dev=ruleset_name settings to
 			# apply (must be mounted already, i.e. fstab(5))
+devfs_load_rulesets="NO"	# Load devfs rulesets on startup
 performance_cx_lowest="HIGH"	# Online CPU idle state
 performance_cpu_freq="NONE"	# Online CPU frequency
 economy_cx_lowest="HIGH"	# Offline CPU idle state
Index: etc/rc.d/devfs
===================================================================
--- etc/rc.d/devfs	(revision 231065)
+++ etc/rc.d/devfs	(working copy)
@@ -16,7 +16,8 @@ stop_cmd=':'
 
 devfs_start()
 {
-	if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ]; then
+	if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ] || \
+	    checkyesno devfs_load_rulesets; then
 		devfs_init_rulesets
 		if [ -n "$devfs_system_ruleset" ]; then
 			devfs_set_ruleset $devfs_system_ruleset /dev


More information about the freebsd-fs mailing list