]>
Commit | Line | Data |
---|---|---|
c81b35c0 | 1 | /* |
e8d569b4 | 2 | * udev_utils.c - generic stuff used by udev |
c81b35c0 | 3 | * |
e8d569b4 | 4 | * Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org> |
c81b35c0 KS |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation version 2 of the License. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, but | |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License along | |
16 | * with this program; if not, write to the Free Software Foundation, Inc., | |
17 | * 675 Mass Ave, Cambridge, MA 02139, USA. | |
18 | * | |
19 | */ | |
20 | ||
e8d569b4 KS |
21 | #ifndef _UDEV_COMMON_H_ |
22 | #define _UDEV_COMMON_H_ | |
c81b35c0 | 23 | |
7a947ce5 | 24 | #include "udev.h" |
e8d569b4 | 25 | #include "list.h" |
c81b35c0 | 26 | |
27f877e6 KS |
27 | #define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) |
28 | ||
f1ff8d7b KS |
29 | /* pipes */ |
30 | #define READ_END 0 | |
31 | #define WRITE_END 1 | |
32 | ||
f0308095 KS |
33 | struct name_entry { |
34 | struct list_head node; | |
63f61c5c | 35 | char name[PATH_SIZE]; |
f0308095 KS |
36 | }; |
37 | ||
5b13ecb8 | 38 | /* udev_utils.c */ |
6a522681 | 39 | extern int log_priority(const char *priority); |
f0308095 | 40 | extern int name_list_add(struct list_head *name_list, const char *name, int sort); |
b8476286 | 41 | extern int name_list_key_add(struct list_head *name_list, const char *key, const char *value); |
fb179207 | 42 | extern void name_list_cleanup(struct list_head *name_list); |
67747e1d | 43 | extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); |
5b13ecb8 KS |
44 | |
45 | /* udev_utils_string.c */ | |
46 | extern int strcmp_pattern(const char *p, const char *s); | |
47 | extern int string_is_true(const char *str); | |
b2c6818d | 48 | extern void remove_trailing_chars(char *path, char c); |
5b13ecb8 | 49 | extern int utf8_encoded_valid_unichar(const char *str); |
764ce7f2 | 50 | extern int replace_untrusted_chars(char *str); |
5b13ecb8 KS |
51 | |
52 | /* udev_utils_file.c */ | |
53 | extern int create_path(const char *path); | |
0da0efb2 | 54 | extern int delete_path(const char *path); |
5b13ecb8 KS |
55 | extern int file_map(const char *filename, char **buf, size_t *bufsize); |
56 | extern void file_unmap(void *buf, size_t bufsize); | |
57 | extern int unlink_secure(const char *filename); | |
58 | extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); | |
59 | ||
60 | /* udev_utils_run.c */ | |
d455b008 | 61 | extern int pass_env_to_socket(const char *name, const char *devpath, const char *action); |
27f877e6 KS |
62 | extern int run_program(const char *command, const char *subsystem, |
63 | char *result, size_t ressize, size_t *reslen, int log); | |
67747e1d | 64 | |
c81b35c0 | 65 | #endif |