Rev 4065 | Rev 5270 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1408 | serge | 1 | #ifndef _LINUX_STRING_H_ |
2 | #define _LINUX_STRING_H_ |
||
3 | |||
4 | |||
5 | #include |
||
6 | #include |
||
7 | #include |
||
8 | #include |
||
9 | |||
10 | extern char *strndup_user(const char __user *, long); |
||
11 | extern void *memdup_user(const void __user *, size_t); |
||
12 | |||
13 | /* |
||
14 | * Include machine specific inline routines |
||
15 | */ |
||
16 | #include |
||
17 | |||
18 | #ifndef __HAVE_ARCH_STRCPY |
||
19 | extern char * strcpy(char *,const char *); |
||
20 | #endif |
||
21 | #ifndef __HAVE_ARCH_STRNCPY |
||
22 | extern char * strncpy(char *,const char *, __kernel_size_t); |
||
23 | #endif |
||
24 | #ifndef __HAVE_ARCH_STRLCPY |
||
25 | size_t strlcpy(char *, const char *, size_t); |
||
26 | #endif |
||
27 | #ifndef __HAVE_ARCH_STRCAT |
||
28 | extern char * strcat(char *, const char *); |
||
29 | #endif |
||
30 | #ifndef __HAVE_ARCH_STRNCAT |
||
31 | extern char * strncat(char *, const char *, __kernel_size_t); |
||
32 | #endif |
||
33 | #ifndef __HAVE_ARCH_STRLCAT |
||
34 | extern size_t strlcat(char *, const char *, __kernel_size_t); |
||
35 | #endif |
||
36 | #ifndef __HAVE_ARCH_STRCMP |
||
37 | extern int strcmp(const char *,const char *); |
||
38 | #endif |
||
39 | #ifndef __HAVE_ARCH_STRNCMP |
||
40 | extern int strncmp(const char *,const char *,__kernel_size_t); |
||
41 | #endif |
||
42 | #ifndef __HAVE_ARCH_STRNICMP |
||
43 | extern int strnicmp(const char *, const char *, __kernel_size_t); |
||
44 | #endif |
||
45 | #ifndef __HAVE_ARCH_STRCASECMP |
||
46 | extern int strcasecmp(const char *s1, const char *s2); |
||
47 | #endif |
||
48 | #ifndef __HAVE_ARCH_STRNCASECMP |
||
49 | extern int strncasecmp(const char *s1, const char *s2, size_t n); |
||
50 | #endif |
||
51 | #ifndef __HAVE_ARCH_STRCHR |
||
52 | extern char * strchr(const char *,int); |
||
53 | #endif |
||
5056 | serge | 54 | #ifndef __HAVE_ARCH_STRCHRNUL |
55 | extern char * strchrnul(const char *,int); |
||
56 | #endif |
||
1408 | serge | 57 | #ifndef __HAVE_ARCH_STRNCHR |
58 | extern char * strnchr(const char *, size_t, int); |
||
59 | #endif |
||
60 | #ifndef __HAVE_ARCH_STRRCHR |
||
61 | extern char * strrchr(const char *,int); |
||
62 | #endif |
||
1964 | serge | 63 | extern char * __must_check skip_spaces(const char *); |
64 | |||
65 | extern char *strim(char *); |
||
66 | |||
67 | static inline __must_check char *strstrip(char *str) |
||
68 | { |
||
69 | return strim(str); |
||
70 | } |
||
71 | |||
1408 | serge | 72 | #ifndef __HAVE_ARCH_STRSTR |
1964 | serge | 73 | extern char * strstr(const char *, const char *); |
1408 | serge | 74 | #endif |
1964 | serge | 75 | #ifndef __HAVE_ARCH_STRNSTR |
76 | extern char * strnstr(const char *, const char *, size_t); |
||
77 | #endif |
||
1408 | serge | 78 | #ifndef __HAVE_ARCH_STRLEN |
79 | extern __kernel_size_t strlen(const char *); |
||
80 | #endif |
||
81 | #ifndef __HAVE_ARCH_STRNLEN |
||
82 | extern __kernel_size_t strnlen(const char *,__kernel_size_t); |
||
83 | #endif |
||
84 | #ifndef __HAVE_ARCH_STRPBRK |
||
85 | extern char * strpbrk(const char *,const char *); |
||
86 | #endif |
||
87 | #ifndef __HAVE_ARCH_STRSEP |
||
88 | extern char * strsep(char **,const char *); |
||
89 | #endif |
||
90 | #ifndef __HAVE_ARCH_STRSPN |
||
91 | extern __kernel_size_t strspn(const char *,const char *); |
||
92 | #endif |
||
93 | #ifndef __HAVE_ARCH_STRCSPN |
||
94 | extern __kernel_size_t strcspn(const char *,const char *); |
||
95 | #endif |
||
96 | |||
97 | #ifndef __HAVE_ARCH_MEMSET |
||
98 | extern void * memset(void *,int,__kernel_size_t); |
||
99 | #endif |
||
100 | #ifndef __HAVE_ARCH_MEMCPY |
||
101 | extern void * memcpy(void *,const void *,__kernel_size_t); |
||
102 | #endif |
||
103 | #ifndef __HAVE_ARCH_MEMMOVE |
||
104 | extern void * memmove(void *,const void *,__kernel_size_t); |
||
105 | #endif |
||
106 | #ifndef __HAVE_ARCH_MEMSCAN |
||
107 | extern void * memscan(void *,int,__kernel_size_t); |
||
108 | #endif |
||
109 | #ifndef __HAVE_ARCH_MEMCMP |
||
110 | extern int memcmp(const void *,const void *,__kernel_size_t); |
||
111 | #endif |
||
112 | #ifndef __HAVE_ARCH_MEMCHR |
||
113 | extern void * memchr(const void *,int,__kernel_size_t); |
||
114 | #endif |
||
2967 | Serge | 115 | void *memchr_inv(const void *s, int c, size_t n); |
1408 | serge | 116 | |
117 | extern char *kstrdup(const char *s, gfp_t gfp); |
||
118 | extern char *kstrndup(const char *s, size_t len, gfp_t gfp); |
||
119 | extern void *kmemdup(const void *src, size_t len, gfp_t gfp); |
||
120 | |||
121 | extern char **argv_split(gfp_t gfp, const char *str, int *argcp); |
||
122 | extern void argv_free(char **argv); |
||
123 | |||
124 | extern bool sysfs_streq(const char *s1, const char *s2); |
||
1970 | serge | 125 | extern int strtobool(const char *s, bool *res); |
1408 | serge | 126 | |
127 | #ifdef CONFIG_BINARY_PRINTF |
||
128 | int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args); |
||
129 | int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf); |
||
130 | int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4); |
||
131 | #endif |
||
132 | |||
133 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, |
||
134 | const void *from, size_t available); |
||
135 | |||
136 | /** |
||
137 | * strstarts - does @str start with @prefix? |
||
138 | * @str: string to examine |
||
139 | * @prefix: prefix to look for. |
||
140 | */ |
||
141 | static inline bool strstarts(const char *str, const char *prefix) |
||
142 | { |
||
143 | return strncmp(str, prefix, strlen(prefix)) == 0; |
||
144 | } |
||
3120 | serge | 145 | |
146 | extern size_t memweight(const void *ptr, size_t bytes); |
||
147 | |||
4065 | Serge | 148 | /** |
149 | * kbasename - return the last part of a pathname. |
||
150 | * |
||
151 | * @path: path to extract the filename from. |
||
152 | */ |
||
153 | static inline const char *kbasename(const char *path) |
||
154 | { |
||
155 | const char *tail = strrchr(path, '/'); |
||
156 | return tail ? tail + 1 : path; |
||
157 | } |
||
158 | |||
1408 | serge | 159 | #endif /* _LINUX_STRING_H_ */ |