Rev 2967 | Rev 4065 | 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 |
||
54 | #ifndef __HAVE_ARCH_STRNCHR |
||
55 | extern char * strnchr(const char *, size_t, int); |
||
56 | #endif |
||
57 | #ifndef __HAVE_ARCH_STRRCHR |
||
58 | extern char * strrchr(const char *,int); |
||
59 | #endif |
||
1964 | serge | 60 | extern char * __must_check skip_spaces(const char *); |
61 | |||
62 | extern char *strim(char *); |
||
63 | |||
64 | static inline __must_check char *strstrip(char *str) |
||
65 | { |
||
66 | return strim(str); |
||
67 | } |
||
68 | |||
1408 | serge | 69 | #ifndef __HAVE_ARCH_STRSTR |
1964 | serge | 70 | extern char * strstr(const char *, const char *); |
1408 | serge | 71 | #endif |
1964 | serge | 72 | #ifndef __HAVE_ARCH_STRNSTR |
73 | extern char * strnstr(const char *, const char *, size_t); |
||
74 | #endif |
||
1408 | serge | 75 | #ifndef __HAVE_ARCH_STRLEN |
76 | extern __kernel_size_t strlen(const char *); |
||
77 | #endif |
||
78 | #ifndef __HAVE_ARCH_STRNLEN |
||
79 | extern __kernel_size_t strnlen(const char *,__kernel_size_t); |
||
80 | #endif |
||
81 | #ifndef __HAVE_ARCH_STRPBRK |
||
82 | extern char * strpbrk(const char *,const char *); |
||
83 | #endif |
||
84 | #ifndef __HAVE_ARCH_STRSEP |
||
85 | extern char * strsep(char **,const char *); |
||
86 | #endif |
||
87 | #ifndef __HAVE_ARCH_STRSPN |
||
88 | extern __kernel_size_t strspn(const char *,const char *); |
||
89 | #endif |
||
90 | #ifndef __HAVE_ARCH_STRCSPN |
||
91 | extern __kernel_size_t strcspn(const char *,const char *); |
||
92 | #endif |
||
93 | |||
94 | #ifndef __HAVE_ARCH_MEMSET |
||
95 | extern void * memset(void *,int,__kernel_size_t); |
||
96 | #endif |
||
97 | #ifndef __HAVE_ARCH_MEMCPY |
||
98 | extern void * memcpy(void *,const void *,__kernel_size_t); |
||
99 | #endif |
||
100 | #ifndef __HAVE_ARCH_MEMMOVE |
||
101 | extern void * memmove(void *,const void *,__kernel_size_t); |
||
102 | #endif |
||
103 | #ifndef __HAVE_ARCH_MEMSCAN |
||
104 | extern void * memscan(void *,int,__kernel_size_t); |
||
105 | #endif |
||
106 | #ifndef __HAVE_ARCH_MEMCMP |
||
107 | extern int memcmp(const void *,const void *,__kernel_size_t); |
||
108 | #endif |
||
109 | #ifndef __HAVE_ARCH_MEMCHR |
||
110 | extern void * memchr(const void *,int,__kernel_size_t); |
||
111 | #endif |
||
2967 | Serge | 112 | void *memchr_inv(const void *s, int c, size_t n); |
1408 | serge | 113 | |
114 | extern char *kstrdup(const char *s, gfp_t gfp); |
||
115 | extern char *kstrndup(const char *s, size_t len, gfp_t gfp); |
||
116 | extern void *kmemdup(const void *src, size_t len, gfp_t gfp); |
||
117 | |||
118 | extern char **argv_split(gfp_t gfp, const char *str, int *argcp); |
||
119 | extern void argv_free(char **argv); |
||
120 | |||
121 | extern bool sysfs_streq(const char *s1, const char *s2); |
||
1970 | serge | 122 | extern int strtobool(const char *s, bool *res); |
1408 | serge | 123 | |
124 | #ifdef CONFIG_BINARY_PRINTF |
||
125 | int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args); |
||
126 | int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf); |
||
127 | int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4); |
||
128 | #endif |
||
129 | |||
130 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, |
||
131 | const void *from, size_t available); |
||
132 | |||
133 | /** |
||
134 | * strstarts - does @str start with @prefix? |
||
135 | * @str: string to examine |
||
136 | * @prefix: prefix to look for. |
||
137 | */ |
||
138 | static inline bool strstarts(const char *str, const char *prefix) |
||
139 | { |
||
140 | return strncmp(str, prefix, strlen(prefix)) == 0; |
||
141 | } |
||
3120 | serge | 142 | |
143 | extern size_t memweight(const void *ptr, size_t bytes); |
||
144 | |||
1408 | serge | 145 | #endif /* _LINUX_STRING_H_ */ |