diff options
author | Samuel Ortiz <sameo@openedhand.com> | 2007-09-28 17:47:54 +0000 |
---|---|---|
committer | Samuel Ortiz <sameo@openedhand.com> | 2007-09-28 17:47:54 +0000 |
commit | 5dfdab596ce5da7e547fd24ad040b1fa66a641f7 (patch) | |
tree | 7eda3c554de8a587adfabbe1d9cb48aecafe7afa /meta/packages/udev/udev-115 | |
parent | cfa5b19e235a7c563a4ffbbde1ae42d04ab42098 (diff) | |
download | poky-5dfdab596ce5da7e547fd24ad040b1fa66a641f7.tar.gz |
udev-115: Kernel events filtering improvement.
In order to avoid creating dozens of ttys and ptys, we have to discard
some specific kernel events.
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2820 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/udev/udev-115')
-rw-r--r-- | meta/packages/udev/udev-115/udevtrigger_add_devname_filtering.patch | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/meta/packages/udev/udev-115/udevtrigger_add_devname_filtering.patch b/meta/packages/udev/udev-115/udevtrigger_add_devname_filtering.patch new file mode 100644 index 0000000000..87cafcaa9d --- /dev/null +++ b/meta/packages/udev/udev-115/udevtrigger_add_devname_filtering.patch | |||
@@ -0,0 +1,104 @@ | |||
1 | --- | ||
2 | udevtrigger.c | 40 ++++++++++++++++++++++++++++++++++++++++ | ||
3 | 1 file changed, 40 insertions(+) | ||
4 | |||
5 | Index: udev-115/udevtrigger.c | ||
6 | =================================================================== | ||
7 | --- udev-115.orig/udevtrigger.c 2007-08-24 01:29:54.000000000 +0200 | ||
8 | +++ udev-115/udevtrigger.c 2007-09-21 18:45:28.000000000 +0200 | ||
9 | @@ -39,6 +39,8 @@ | ||
10 | LIST_HEAD(device_list); | ||
11 | LIST_HEAD(filter_subsystem_match_list); | ||
12 | LIST_HEAD(filter_subsystem_nomatch_list); | ||
13 | +LIST_HEAD(filter_kernel_match_list); | ||
14 | +LIST_HEAD(filter_kernel_nomatch_list); | ||
15 | LIST_HEAD(filter_attr_match_list); | ||
16 | LIST_HEAD(filter_attr_nomatch_list); | ||
17 | |||
18 | @@ -218,6 +220,26 @@ | ||
19 | return 0; | ||
20 | } | ||
21 | |||
22 | +static int kernel_filtered(const char *kernel) | ||
23 | +{ | ||
24 | + struct name_entry *loop_name; | ||
25 | + | ||
26 | + /* skip devices matching the prohibited kernel device names */ | ||
27 | + list_for_each_entry(loop_name, &filter_kernel_nomatch_list, node) | ||
28 | + if (fnmatch(loop_name->name, kernel, 0) == 0) | ||
29 | + return 1; | ||
30 | + | ||
31 | + /* skip devices not matching the listed kernel device names */ | ||
32 | + if (!list_empty(&filter_kernel_match_list)) { | ||
33 | + list_for_each_entry(loop_name, &filter_kernel_match_list, node) | ||
34 | + if (fnmatch(loop_name->name, kernel, 0) == 0) | ||
35 | + return 0; | ||
36 | + return 1; | ||
37 | + } | ||
38 | + | ||
39 | + return 0; | ||
40 | +} | ||
41 | + | ||
42 | static int attr_filtered(const char *path) | ||
43 | { | ||
44 | struct name_entry *loop_name; | ||
45 | @@ -296,6 +318,9 @@ | ||
46 | if (dent2->d_name[0] == '.') | ||
47 | continue; | ||
48 | |||
49 | + if (kernel_filtered(dent2->d_name)) | ||
50 | + continue; | ||
51 | + | ||
52 | strlcpy(dirname2, dirname, sizeof(dirname2)); | ||
53 | strlcat(dirname2, "/", sizeof(dirname2)); | ||
54 | strlcat(dirname2, dent2->d_name, sizeof(dirname2)); | ||
55 | @@ -402,6 +427,9 @@ | ||
56 | if (!strcmp(dent2->d_name, "device")) | ||
57 | continue; | ||
58 | |||
59 | + if (kernel_filtered(dent2->d_name)) | ||
60 | + continue; | ||
61 | + | ||
62 | strlcpy(dirname2, dirname, sizeof(dirname2)); | ||
63 | strlcat(dirname2, "/", sizeof(dirname2)); | ||
64 | strlcat(dirname2, dent2->d_name, sizeof(dirname2)); | ||
65 | @@ -458,6 +486,8 @@ | ||
66 | { "subsystem-nomatch", 1, NULL, 'S' }, | ||
67 | { "attr-match", 1, NULL, 'a' }, | ||
68 | { "attr-nomatch", 1, NULL, 'A' }, | ||
69 | + { "kernel-match", 1, NULL, 'k' }, | ||
70 | + { "kernel-nomatch", 1, NULL, 'K' }, | ||
71 | {} | ||
72 | }; | ||
73 | |||
74 | @@ -496,6 +526,12 @@ | ||
75 | case 'A': | ||
76 | name_list_add(&filter_attr_nomatch_list, optarg, 0); | ||
77 | break; | ||
78 | + case 'k': | ||
79 | + name_list_add(&filter_kernel_match_list, optarg, 0); | ||
80 | + break; | ||
81 | + case 'K': | ||
82 | + name_list_add(&filter_kernel_nomatch_list, optarg, 0); | ||
83 | + break; | ||
84 | case 'h': | ||
85 | printf("Usage: udevtrigger OPTIONS\n" | ||
86 | " --verbose print the list of devices while running\n" | ||
87 | @@ -504,6 +540,8 @@ | ||
88 | " marked as failed during a previous run\n" | ||
89 | " --subsystem-match=<subsystem> trigger devices from a matching subystem\n" | ||
90 | " --subsystem-nomatch=<subsystem> exclude devices from a matching subystem\n" | ||
91 | + " --kernel-match=<subsystem> trigger devices from a matching kernel device name\n" | ||
92 | + " --kernel-nomatch=<subsystem> exclude devices from a matching kernel device name\n" | ||
93 | " --attr-match=<file[=<value>]> trigger devices with a matching sysfs\n" | ||
94 | " attribute\n" | ||
95 | " --attr-nomatch=<file[=<value>]> exclude devices with a matching sysfs\n" | ||
96 | @@ -549,6 +587,8 @@ | ||
97 | exit: | ||
98 | name_list_cleanup(&filter_subsystem_match_list); | ||
99 | name_list_cleanup(&filter_subsystem_nomatch_list); | ||
100 | + name_list_cleanup(&filter_kernel_match_list); | ||
101 | + name_list_cleanup(&filter_kernel_nomatch_list); | ||
102 | name_list_cleanup(&filter_attr_match_list); | ||
103 | name_list_cleanup(&filter_attr_nomatch_list); | ||
104 | |||