Deleted Added
full compact
devfs_rule.c (227489) devfs_rule.c (231265)
1/*-
2 * Copyright (c) 2002 Dima Dorfman.
3 * All rights reserved.
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:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2002 Dima Dorfman.
3 * All rights reserved.
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:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/fs/devfs/devfs_rule.c 227489 2011-11-13 17:06:33Z eadler $
26 * $FreeBSD: head/sys/fs/devfs/devfs_rule.c 231265 2012-02-09 10:09:12Z mm $
27 */
28
29/*
30 * DEVFS ruleset implementation.
31 *
32 * A note on terminology: To "run" a rule on a dirent is to take the
33 * prescribed action; to "apply" a rule is to check whether it matches
34 * a dirent and run if if it does.

--- 731 unchanged lines hidden (view full) ---

766
767 sx_assert(&dm->dm_lock, SX_XLOCKED);
768 if (dm->dm_ruleset != 0) {
769 ds = devfs_ruleset_bynum(dm->dm_ruleset);
770 --ds->ds_refcount;
771 devfs_ruleset_reap(ds);
772 }
773}
27 */
28
29/*
30 * DEVFS ruleset implementation.
31 *
32 * A note on terminology: To "run" a rule on a dirent is to take the
33 * prescribed action; to "apply" a rule is to check whether it matches
34 * a dirent and run if if it does.

--- 731 unchanged lines hidden (view full) ---

766
767 sx_assert(&dm->dm_lock, SX_XLOCKED);
768 if (dm->dm_ruleset != 0) {
769 ds = devfs_ruleset_bynum(dm->dm_ruleset);
770 --ds->ds_refcount;
771 devfs_ruleset_reap(ds);
772 }
773}
774
775/*
776 * Make rsnum the active ruleset for dm (locked)
777 */
778void
779devfs_ruleset_set(devfs_rsnum rsnum, struct devfs_mount *dm)
780{
781
782 sx_assert(&dm->dm_lock, SX_XLOCKED);
783
784 sx_xlock(&sx_rules);
785 devfs_ruleset_use(rsnum, dm);
786 sx_xunlock(&sx_rules);
787}
788
789/*
790 * Apply the current active ruleset on a mount
791 */
792void
793devfs_ruleset_apply(struct devfs_mount *dm)
794{
795 struct devfs_ruleset *ds;
796
797 sx_assert(&dm->dm_lock, SX_XLOCKED);
798
799 sx_xlock(&sx_rules);
800 if (dm->dm_ruleset == 0) {
801 sx_xunlock(&sx_rules);
802 return;
803 }
804 ds = devfs_ruleset_bynum(dm->dm_ruleset);
805 if (ds != NULL)
806 devfs_ruleset_applydm(ds, dm);
807 sx_xunlock(&sx_rules);
808}