]>
Commit | Line | Data |
---|---|---|
f0083e3d GKH |
1 | /* |
2 | * udev.h | |
3 | * | |
f0083e3d | 4 | * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com> |
f0308095 | 5 | * Copyright (C) 2003-2005 Kay Sievers <kay.sievers@vrfy.org> |
f0083e3d GKH |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | |
8 | * under the terms of the GNU General Public License as published by the | |
9 | * Free Software Foundation version 2 of the License. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License along | |
17 | * with this program; if not, write to the Free Software Foundation, Inc., | |
18 | * 675 Mass Ave, Cambridge, MA 02139, USA. | |
19 | * | |
20 | */ | |
21 | ||
c81b35c0 KS |
22 | #ifndef _UDEV_H_ |
23 | #define _UDEV_H_ | |
f0083e3d | 24 | |
c1ab0461 | 25 | #include <sys/types.h> |
c076a2bd | 26 | #include <sys/param.h> |
c81b35c0 | 27 | #include "libsysfs/sysfs/libsysfs.h" |
9ed47a9f | 28 | #include "list.h" |
f0083e3d | 29 | |
e8baccca | 30 | #define COMMENT_CHARACTER '#' |
fc55cf68 | 31 | #define PATH_TO_NAME_CHAR '@' |
03cfa139 | 32 | #define LINE_SIZE 512 |
63f61c5c KS |
33 | #define NAME_SIZE 128 |
34 | #define PATH_SIZE 256 | |
5f72c470 | 35 | #define USER_SIZE 32 |
3169e8d1 | 36 | #define SEQNUM_SIZE 32 |
63f61c5c | 37 | #define VALUE_SIZE 128 |
e964c2c0 | 38 | |
6d564166 | 39 | #define DEFAULT_PARTITIONS_COUNT 15 |
0b3dfb3d | 40 | #define UDEV_ALARM_TIMEOUT 180 |
6d564166 | 41 | |
fc55cf68 KS |
42 | #define DB_DIR ".udev/db" |
43 | ||
e8d569b4 KS |
44 | struct udev_rules; |
45 | ||
5ef42682 | 46 | enum device_type { |
e6764498 KS |
47 | DEV_UNKNOWN, |
48 | DEV_CLASS, | |
49 | DEV_BLOCK, | |
50 | DEV_NET, | |
51 | DEV_DEVICE, | |
5ef42682 KS |
52 | }; |
53 | ||
5840bc63 | 54 | struct udevice { |
63f61c5c KS |
55 | char devpath[PATH_SIZE]; |
56 | char subsystem[NAME_SIZE]; | |
821d0ec8 | 57 | char action[NAME_SIZE]; |
2af003fe | 58 | |
e6764498 | 59 | enum device_type type; |
63f61c5c KS |
60 | char name[PATH_SIZE]; |
61 | char devname[PATH_SIZE]; | |
e48fc108 | 62 | struct list_head symlink_list; |
c974742b | 63 | int symlink_final; |
5f72c470 | 64 | char owner[USER_SIZE]; |
c974742b | 65 | int owner_final; |
5f72c470 | 66 | char group[USER_SIZE]; |
c974742b | 67 | int group_final; |
2af003fe | 68 | mode_t mode; |
c974742b | 69 | int mode_final; |
7e720bd4 | 70 | dev_t devt; |
821d0ec8 | 71 | struct list_head run_list; |
c974742b | 72 | int run_final; |
b8476286 | 73 | struct list_head env_list; |
2af003fe | 74 | |
63f61c5c | 75 | char tmp_node[PATH_SIZE]; |
50e5de03 | 76 | int partitions; |
821d0ec8 | 77 | int ignore_device; |
7efa217d | 78 | int ignore_remove; |
b608ade8 | 79 | int config_line; |
63f61c5c KS |
80 | char config_file[PATH_SIZE]; |
81 | char bus_id[NAME_SIZE]; | |
82 | char program_result[PATH_SIZE]; | |
00866ed2 KS |
83 | char kernel_number[NAME_SIZE]; |
84 | char kernel_name[NAME_SIZE]; | |
7a947ce5 | 85 | int test_run; |
5840bc63 GKH |
86 | }; |
87 | ||
e8d569b4 KS |
88 | extern int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem, const char *action); |
89 | extern void udev_cleanup_device(struct udevice *udev); | |
c86be870 | 90 | extern dev_t get_devt(struct sysfs_class_device *class_dev); |
e8d569b4 | 91 | extern int udev_process_event(struct udev_rules *rules, struct udevice *udev); |
7a947ce5 KS |
92 | extern int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev); |
93 | extern int udev_remove_device(struct udevice *udev); | |
e8baccca | 94 | extern void udev_init_config(void); |
eb6c7cd0 | 95 | extern int udev_start(void); |
7e720bd4 | 96 | extern int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); |
a507a015 | 97 | |
fc55cf68 KS |
98 | extern int udev_db_add_device(struct udevice *dev); |
99 | extern int udev_db_delete_device(struct udevice *dev); | |
100 | extern int udev_db_get_device(struct udevice *udev, const char *devpath); | |
101 | extern int udev_db_lookup_name(const char *name, char *devpath, size_t len); | |
102 | extern int udev_db_get_all_entries(struct list_head *name_list); | |
103 | ||
63f61c5c KS |
104 | extern char sysfs_path[PATH_SIZE]; |
105 | extern char udev_root[PATH_SIZE]; | |
63f61c5c KS |
106 | extern char udev_config_filename[PATH_SIZE]; |
107 | extern char udev_rules_filename[PATH_SIZE]; | |
6b493a20 | 108 | extern int udev_log_priority; |
821d0ec8 | 109 | extern int udev_run; |
c056c514 | 110 | |
f0083e3d | 111 | #endif |