]>
Commit | Line | Data |
---|---|---|
c81b35c0 KS |
1 | /* |
2 | * udev_lib - generic stuff used by udev | |
3 | * | |
4 | * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org> | |
5 | * | |
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 | ||
22 | #ifndef _UDEV_LIB_H_ | |
23 | #define _UDEV_LIB_H_ | |
24 | ||
7a947ce5 | 25 | #include "udev.h" |
c81b35c0 KS |
26 | |
27 | #define strfieldcpy(to, from) \ | |
28 | do { \ | |
29 | to[sizeof(to)-1] = '\0'; \ | |
30 | strncpy(to, from, sizeof(to)-1); \ | |
31 | } while (0) | |
32 | ||
33 | #define strfieldcat(to, from) \ | |
34 | do { \ | |
35 | to[sizeof(to)-1] = '\0'; \ | |
36 | strncat(to, from, sizeof(to) - strlen(to)-1); \ | |
37 | } while (0) | |
38 | ||
39 | #define strfieldcpymax(to, from, maxsize) \ | |
40 | do { \ | |
41 | to[maxsize-1] = '\0'; \ | |
42 | strncpy(to, from, maxsize-1); \ | |
43 | } while (0) | |
44 | ||
45 | #define strfieldcatmax(to, from, maxsize) \ | |
46 | do { \ | |
47 | to[maxsize-1] = '\0'; \ | |
48 | strncat(to, from, maxsize - strlen(to)-1); \ | |
49 | } while (0) | |
50 | ||
e5a5b54a MB |
51 | #ifdef asmlinkage |
52 | # undef asmlinkage | |
53 | #endif | |
54 | #ifdef __i386__ | |
55 | # define asmlinkage __attribute__((regparm(0))) | |
56 | #endif | |
57 | #ifndef asmlinkage | |
03fd7a3a | 58 | # define asmlinkage |
e5a5b54a | 59 | #endif |
c81b35c0 | 60 | |
f0308095 KS |
61 | struct name_entry { |
62 | struct list_head node; | |
63 | char name[NAME_SIZE]; | |
64 | }; | |
65 | ||
9ed47a9f | 66 | extern int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem); |
e48fc108 KS |
67 | extern void udev_cleanup_device(struct udevice *udev); |
68 | ||
85925517 | 69 | extern int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel); |
2b41e68a | 70 | extern int create_path(const char *path); |
9f8dfa19 | 71 | extern int parse_get_pair(char **orig_string, char **left, char **right); |
c1ab0461 | 72 | extern int unlink_secure(const char *filename); |
c81b35c0 KS |
73 | extern int file_map(const char *filename, char **buf, size_t *bufsize); |
74 | extern void file_unmap(char *buf, size_t bufsize); | |
9f8dfa19 | 75 | extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); |
2b41e68a | 76 | extern void no_trailing_slash(char *path); |
f0308095 KS |
77 | extern int name_list_add(struct list_head *name_list, const char *name, int sort); |
78 | extern int call_foreach_file(int (*handler_function)(struct udevice *udev, const char *string), | |
79 | struct udevice *udev, const char *dirname, const char *suffix); | |
c81b35c0 | 80 | #endif |