[PATCH] 055 release
[systemd_ALT/systemd_imz.git] / udev_rules.h
blob423a6f641ecb1f24632c4c5eeeecc595caf0e44a
1 /*
2 * udev_rules.h
4 * Userspace devfs
6 * Copyright (C) 2003,2004 Greg Kroah-Hartman <greg@kroah.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation version 2 of the License.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifndef UDEV_RULES_H
24 #define UDEV_RULES_H
26 #include "libsysfs/sysfs/libsysfs.h"
27 #include "udev.h"
28 #include "list.h"
31 #define KEY_KERNEL "KERNEL"
32 #define KEY_SUBSYSTEM "SUBSYSTEM"
33 #define KEY_BUS "BUS"
34 #define KEY_ID "ID"
35 #define KEY_PROGRAM "PROGRAM"
36 #define KEY_RESULT "RESULT"
37 #define KEY_DRIVER "DRIVER"
38 #define KEY_SYSFS "SYSFS"
39 #define KEY_ENV "ENV"
40 #define KEY_NAME "NAME"
41 #define KEY_SYMLINK "SYMLINK"
42 #define KEY_OWNER "OWNER"
43 #define KEY_GROUP "GROUP"
44 #define KEY_MODE "MODE"
45 #define KEY_OPTIONS "OPTIONS"
47 #define OPTION_LAST_RULE "last_rule"
48 #define OPTION_IGNORE_DEVICE "ignore_device"
49 #define OPTION_IGNORE_REMOVE "ignore_remove"
50 #define OPTION_PARTITIONS "all_partitions"
52 #define KEY_SYSFS_PAIRS_MAX 5
53 #define KEY_ENV_PAIRS_MAX 5
55 #define RULEFILE_SUFFIX ".rules"
57 enum key_operation {
58 KEY_OP_UNKNOWN,
59 KEY_OP_MATCH,
60 KEY_OP_NOMATCH,
61 KEY_OP_ADD,
62 KEY_OP_ASSIGN,
65 struct key_pair {
66 char name[NAME_SIZE];
67 char value[VALUE_SIZE];
68 enum key_operation operation;
71 struct udev_rule {
72 struct list_head node;
74 char kernel[NAME_SIZE];
75 enum key_operation kernel_operation;
76 char subsystem[NAME_SIZE];
77 enum key_operation subsystem_operation;
78 char bus[NAME_SIZE];
79 enum key_operation bus_operation;
80 char id[NAME_SIZE];
81 enum key_operation id_operation;
82 char driver[NAME_SIZE];
83 enum key_operation driver_operation;
84 char program[PATH_SIZE];
85 enum key_operation program_operation;
86 char result[PATH_SIZE];
87 enum key_operation result_operation;
88 struct key_pair sysfs_pair[KEY_SYSFS_PAIRS_MAX];
89 int sysfs_pair_count;
90 struct key_pair env_pair[KEY_ENV_PAIRS_MAX];
91 int env_pair_count;
93 char name[PATH_SIZE];
94 char symlink[PATH_SIZE];
95 char owner[USER_SIZE];
96 char group[USER_SIZE];
97 mode_t mode;
99 int last_rule;
100 int ignore_device;
101 int ignore_remove;
102 int partitions;
104 char config_file[PATH_SIZE];
105 int config_line;
108 extern struct list_head udev_rule_list;
110 extern int udev_rules_init(void);
111 extern int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_dev);
112 extern void udev_rules_close(void);
114 #endif