devfs_rule.c (124798) | devfs_rule.c (124804) |
---|---|
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 124798 2004-01-21 16:43:29Z cperciva $ | 26 * $FreeBSD: head/sys/fs/devfs/devfs_rule.c 124804 2004-01-21 18:03:54Z cperciva $ |
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. --- 594 unchanged lines hidden (view full) --- 629 struct devfs_rule *dr = &dk->dk_rule; 630 char *pname; 631 dev_t dev; 632 633 dev = devfs_rule_getdev(de); 634 if (dev != NULL) 635 pname = dev->si_name; 636 else if (de->de_dirent->d_type == DT_LNK || | 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. --- 594 unchanged lines hidden (view full) --- 629 struct devfs_rule *dr = &dk->dk_rule; 630 char *pname; 631 dev_t dev; 632 633 dev = devfs_rule_getdev(de); 634 if (dev != NULL) 635 pname = dev->si_name; 636 else if (de->de_dirent->d_type == DT_LNK || |
637 de->de_dirent->d_type == DT_DIR) | 637 de->de_dirent->d_type == DT_DIR) |
638 pname = de->de_dirent->d_name; 639 else 640 return (0); 641 KASSERT(pname != NULL, ("devfs_rule_matchpath: NULL pname")); 642 643 return (fnmatch(dr->dr_pathptrn, pname, 0) == 0); 644} 645 --- 186 unchanged lines hidden --- | 638 pname = de->de_dirent->d_name; 639 else 640 return (0); 641 KASSERT(pname != NULL, ("devfs_rule_matchpath: NULL pname")); 642 643 return (fnmatch(dr->dr_pathptrn, pname, 0) == 0); 644} 645 --- 186 unchanged lines hidden --- |