]>
Commit | Line | Data |
---|---|---|
2232cac8 GKH |
1 | /* |
2 | * namedev.h | |
3 | * | |
4 | * Userspace devfs | |
5 | * | |
274812b5 | 6 | * Copyright (C) 2003,2004 Greg Kroah-Hartman <greg@kroah.com> |
2232cac8 GKH |
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 | ||
8e41d35d | 26 | #include "udev.h" |
cb32ac94 GKH |
27 | #include "list.h" |
28 | ||
19dc5d4c GKH |
29 | struct sysfs_class_device; |
30 | ||
cb32ac94 GKH |
31 | #define BUS_SIZE 30 |
32 | #define FILE_SIZE 50 | |
33 | #define VALUE_SIZE 100 | |
34 | #define ID_SIZE 50 | |
35 | #define PLACE_SIZE 50 | |
f732a97e | 36 | #define PROGRAM_SIZE 100 |
cb32ac94 | 37 | |
d94df232 | 38 | #define FIELD_BUS "BUS" |
d94df232 | 39 | #define FIELD_SYSFS "SYSFS_" |
ac28b86d | 40 | #define FIELD_ID "ID" |
d94df232 KS |
41 | #define FIELD_PLACE "PLACE" |
42 | #define FIELD_PROGRAM "PROGRAM" | |
ac28b86d | 43 | #define FIELD_RESULT "RESULT" |
d94df232 KS |
44 | #define FIELD_KERNEL "KERNEL" |
45 | #define FIELD_NAME "NAME" | |
46 | #define FIELD_SYMLINK "SYMLINK" | |
47 | ||
7e5f7397 | 48 | #define PROGRAM_MAXARG 10 |
a8b01705 GKH |
49 | #define MAX_SYSFS_PAIRS 5 |
50 | ||
51 | struct sysfs_pair { | |
52 | char file[FILE_SIZE]; | |
53 | char value[VALUE_SIZE]; | |
54 | }; | |
cb32ac94 GKH |
55 | |
56 | struct config_device { | |
57 | struct list_head node; | |
58 | ||
cb32ac94 | 59 | char bus[BUS_SIZE]; |
cb32ac94 GKH |
60 | char id[ID_SIZE]; |
61 | char place[PLACE_SIZE]; | |
ac28b86d KS |
62 | char kernel[NAME_SIZE]; |
63 | char program[PROGRAM_SIZE]; | |
64 | char result[PROGRAM_SIZE]; | |
61219c75 | 65 | char name[NAME_SIZE]; |
3d150dfb | 66 | char symlink[NAME_SIZE]; |
a8b01705 | 67 | struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; |
54988802 | 68 | int config_line; |
61219c75 GKH |
69 | }; |
70 | ||
71 | struct perm_device { | |
72 | struct list_head node; | |
f7b4eca4 | 73 | |
9d496c74 GKH |
74 | char name[NAME_SIZE]; |
75 | char owner[OWNER_SIZE]; | |
76 | char group[GROUP_SIZE]; | |
77 | mode_t mode; | |
cb32ac94 GKH |
78 | }; |
79 | ||
19feb351 | 80 | extern struct list_head config_device_list; |
61219c75 | 81 | extern struct list_head perm_device_list; |
cb32ac94 | 82 | |
2232cac8 | 83 | extern int namedev_init(void); |
9d496c74 | 84 | extern int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *dev); |
19feb351 | 85 | extern int namedev_init_permissions(void); |
e8baccca | 86 | extern int namedev_init_rules(void); |
19feb351 | 87 | |
61219c75 | 88 | extern int add_perm_dev(struct perm_device *new_dev); |
19feb351 GKH |
89 | extern void dump_config_dev(struct config_device *dev); |
90 | extern void dump_config_dev_list(void); | |
61219c75 GKH |
91 | extern void dump_perm_dev(struct perm_device *dev); |
92 | extern void dump_perm_dev_list(void); | |
2232cac8 GKH |
93 | |
94 | #endif |