chiark / gitweb /
[PATCH] correct enum device_type
[elogind.git] / udev_rules.h
1 /*
2  * udev_rules.h
3  *
4  * Userspace devfs
5  *
6  * Copyright (C) 2003,2004 Greg Kroah-Hartman <greg@kroah.com>
7  *
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.
11  * 
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.
16  * 
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.
20  *
21  */
22
23 #ifndef NAMEDEV_H
24 #define NAMEDEV_H
25
26 #include "libsysfs/sysfs/libsysfs.h"
27 #include "udev.h"
28 #include "list.h"
29
30
31 #define FIELD_KERNEL            "KERNEL"
32 #define FIELD_SUBSYSTEM         "SUBSYSTEM"
33 #define FIELD_BUS               "BUS"
34 #define FIELD_SYSFS             "SYSFS"
35 #define FIELD_ID                "ID"
36 #define FIELD_PROGRAM           "PROGRAM"
37 #define FIELD_RESULT            "RESULT"
38 #define FIELD_DRIVER            "DRIVER"
39 #define FIELD_NAME              "NAME"
40 #define FIELD_SYMLINK           "SYMLINK"
41 #define FIELD_OWNER             "OWNER"
42 #define FIELD_GROUP             "GROUP"
43 #define FIELD_MODE              "MODE"
44 #define FIELD_OPTIONS           "OPTIONS"
45
46 #define OPTION_IGNORE_DEVICE    "ignore_device"
47 #define OPTION_IGNORE_REMOVE    "ignore_remove"
48 #define OPTION_PARTITIONS       "all_partitions"
49
50 #define MAX_SYSFS_PAIRS         5
51
52 #define RULEFILE_SUFFIX         ".rules"
53
54 struct sysfs_pair {
55         char file[PATH_SIZE];
56         char value[VALUE_SIZE];
57 };
58
59 struct udev_rule {
60         struct list_head node;
61
62         char kernel[NAME_SIZE];
63         char subsystem[NAME_SIZE];
64         char bus[NAME_SIZE];
65         char id[NAME_SIZE];
66         struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS];
67         char program[PATH_SIZE];
68         char result[PATH_SIZE];
69         char driver[NAME_SIZE];
70         char name[PATH_SIZE];
71         char symlink[PATH_SIZE];
72
73         char owner[USER_SIZE];
74         char group[USER_SIZE];
75         mode_t mode;
76
77         int partitions;
78         int ignore_device;
79         int ignore_remove;
80
81         char config_file[PATH_SIZE];
82         int config_line;
83 };
84
85 extern struct list_head udev_rule_list;
86
87 extern int udev_rules_init(void);
88 extern int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_dev);
89 extern void udev_rules_close(void);
90
91 extern void udev_rule_dump(struct udev_rule *rule);
92 extern void udev_rule_list_dump(void);
93
94 #endif