Allow IPv6 address entry in tools>ping - Loosens valid character check
[tomato/davidwu.git] / release / src / router / udev / udev_rules.h
blob682bedac01fbfb3e42c0271d6c395693a5303f2c
1 /*
2 * Copyright (C) 2003-2004 Greg Kroah-Hartman <greg@kroah.com>
3 * Copyright (C) 2004-2006 Kay Sievers <kay.sievers@vrfy.org>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef UDEV_RULES_H
21 #define UDEV_RULES_H
23 #include "udev.h"
24 #include "list.h"
26 #define PAIRS_MAX 5
27 #define RULESFILE_SUFFIX ".rules"
29 enum key_operation {
30 KEY_OP_UNSET,
31 KEY_OP_MATCH,
32 KEY_OP_NOMATCH,
33 KEY_OP_ADD,
34 KEY_OP_ASSIGN,
35 KEY_OP_ASSIGN_FINAL,
38 struct key {
39 enum key_operation operation;
40 size_t val_off;
43 struct key_pair {
44 struct key key;
45 size_t key_name_off;
48 struct key_pairs {
49 int count;
50 struct key_pair keys[PAIRS_MAX];
53 enum import_type {
54 IMPORT_UNSET,
55 IMPORT_PROGRAM,
56 IMPORT_FILE,
57 IMPORT_PARENT,
60 enum escape_type {
61 ESCAPE_UNSET,
62 ESCAPE_NONE,
63 ESCAPE_REPLACE,
66 struct udev_rule {
67 struct key action;
68 struct key devpath;
69 struct key kernel;
70 struct key subsystem;
71 struct key driver;
72 struct key_pairs attr;
74 struct key kernels;
75 struct key subsystems;
76 struct key drivers;
77 struct key_pairs attrs;
79 struct key_pairs env;
80 struct key program;
81 struct key result;
82 struct key import;
83 enum import_type import_type;
84 struct key test;
85 mode_t test_mode_mask;
86 struct key run;
87 struct key wait_for_sysfs;
88 struct key label;
89 struct key goto_label;
91 struct key name;
92 struct key symlink;
93 struct key owner;
94 struct key group;
95 mode_t mode;
96 enum key_operation mode_operation;
97 enum escape_type string_escape;
99 unsigned int link_priority;
100 unsigned int partitions;
101 unsigned int last_rule:1,
102 ignore_device:1,
103 ignore_remove:1;
105 size_t bufsize;
106 char buf[];
109 struct udev_rules {
110 char *buf;
111 size_t bufsize;
112 size_t current;
113 int resolve_names;
116 extern int udev_rules_init(struct udev_rules *rules, int resolve_names);
117 extern void udev_rules_cleanup(struct udev_rules *rules);
119 extern void udev_rules_iter_init(struct udev_rules *rules);
120 extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules);
121 extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label);
123 extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev);
124 extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev);
126 extern void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize);
128 #endif