DEVFS - Avoid hiding of /dev/devfs
authorAlex Hornung <ahornung@gmail.com>
Wed, 5 Aug 2009 02:27:58 +0000 (03:27 +0100)
committerAlex Hornung <ahornung@gmail.com>
Wed, 5 Aug 2009 13:32:23 +0000 (14:32 +0100)
Avoid applying a HIDE rule on /dev/devfs so that one can always
add/clear/reset/apply rules, even after a "* HIDE" rule.

sys/vfs/devfs/devfs_rules.c

index 385796c..5e68d02 100644 (file)
@@ -246,6 +246,14 @@ devfs_rule_check_apply(struct devfs_node *node)
                         * hide flag to the node and let devfs do the rest in the
                         * vnops
                         */
+                       if ((node->d_dir.d_namlen == 5) &&
+                               (!memcmp(node->d_dir.d_name, "devfs", 5))) {
+                               /*
+                                * Magically avoid /dev/devfs from being hidden, so that one
+                                * can still use the rule system even after a "* hide".
+                                */
+                                continue;
+                       }
                        node->flags |= DEVFS_HIDDEN;
                        applies = 1;
                } else if (rule->rule_type & DEVFS_RULE_SHOW) {