chiark / gitweb /
[PATCH] fix ia64 compile
[elogind.git] / namedev.h
1 /*
2  * namedev.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 "udev.h"
27 #include "list.h"
28
29 struct sysfs_class_device;
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_PLACE             "PLACE"
37 #define FIELD_PROGRAM           "PROGRAM"
38 #define FIELD_RESULT            "RESULT"
39 #define FIELD_DRIVER            "DRIVER"
40 #define FIELD_NAME              "NAME"
41 #define FIELD_SYMLINK           "SYMLINK"
42 #define FIELD_OWNER             "OWNER"
43 #define FIELD_GROUP             "GROUP"
44 #define FIELD_MODE              "MODE"
45 #define FIELD_OPTIONS           "OPTIONS"
46
47 #define OPTION_IGNORE_DEVICE    "ignore_device"
48 #define OPTION_IGNORE_REMOVE    "ignore_remove"
49 #define OPTION_PARTITIONS       "all_partitions"
50
51 #define MAX_SYSFS_PAIRS         5
52
53 #define RULEFILE_SUFFIX         ".rules"
54
55 struct sysfs_pair {
56         char file[PATH_SIZE];
57         char value[VALUE_SIZE];
58 };
59
60 struct config_device {
61         struct list_head node;
62
63         char kernel[NAME_SIZE];
64         char subsystem[NAME_SIZE];
65         char bus[NAME_SIZE];
66         char id[NAME_SIZE];
67         char place[NAME_SIZE];
68         struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS];
69         char program[PATH_SIZE];
70         char result[PATH_SIZE];
71         char driver[NAME_SIZE];
72         char name[PATH_SIZE];
73         char symlink[PATH_SIZE];
74
75         char owner[USER_SIZE];
76         char group[USER_SIZE];
77         mode_t mode;
78
79         int partitions;
80         int ignore_device;
81         int ignore_remove;
82
83         char config_file[PATH_SIZE];
84         int config_line;
85 };
86
87 extern struct list_head config_device_list;
88
89 extern int namedev_init(void);
90 extern int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_dev);
91 extern void namedev_close(void);
92
93 extern void dump_config_dev(struct config_device *dev);
94 extern void dump_config_dev_list(void);
95
96 #endif