diff options
Diffstat (limited to 'include/linux/string.h')
| -rw-r--r-- | include/linux/string.h | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/include/linux/string.h b/include/linux/string.h index ac889c5ea11..a176db2f2c8 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
| @@ -1,12 +1,16 @@ | |||
| 1 | #ifndef _LINUX_STRING_H_ | 1 | #ifndef _LINUX_STRING_H_ |
| 2 | #define _LINUX_STRING_H_ | 2 | #define _LINUX_STRING_H_ |
| 3 | 3 | ||
| 4 | /* We don't want strings.h stuff being used by user stuff by accident */ | ||
| 5 | |||
| 6 | #ifndef __KERNEL__ | ||
| 7 | #include <string.h> | ||
| 8 | #else | ||
| 4 | 9 | ||
| 5 | #include <linux/compiler.h> /* for inline */ | 10 | #include <linux/compiler.h> /* for inline */ |
| 6 | #include <linux/types.h> /* for size_t */ | 11 | #include <linux/types.h> /* for size_t */ |
| 7 | #include <linux/stddef.h> /* for NULL */ | 12 | #include <linux/stddef.h> /* for NULL */ |
| 8 | #include <stdarg.h> | 13 | #include <stdarg.h> |
| 9 | #include <uapi/linux/string.h> | ||
| 10 | 14 | ||
| 11 | extern char *strndup_user(const char __user *, long); | 15 | extern char *strndup_user(const char __user *, long); |
| 12 | extern void *memdup_user(const void __user *, size_t); | 16 | extern void *memdup_user(const void __user *, size_t); |
| @@ -110,7 +114,6 @@ extern int memcmp(const void *,const void *,__kernel_size_t); | |||
| 110 | #ifndef __HAVE_ARCH_MEMCHR | 114 | #ifndef __HAVE_ARCH_MEMCHR |
| 111 | extern void * memchr(const void *,int,__kernel_size_t); | 115 | extern void * memchr(const void *,int,__kernel_size_t); |
| 112 | #endif | 116 | #endif |
| 113 | void *memchr_inv(const void *s, int c, size_t n); | ||
| 114 | 117 | ||
| 115 | extern char *kstrdup(const char *s, gfp_t gfp); | 118 | extern char *kstrdup(const char *s, gfp_t gfp); |
| 116 | extern char *kstrndup(const char *s, size_t len, gfp_t gfp); | 119 | extern char *kstrndup(const char *s, size_t len, gfp_t gfp); |
| @@ -140,18 +143,5 @@ static inline bool strstarts(const char *str, const char *prefix) | |||
| 140 | { | 143 | { |
| 141 | return strncmp(str, prefix, strlen(prefix)) == 0; | 144 | return strncmp(str, prefix, strlen(prefix)) == 0; |
| 142 | } | 145 | } |
| 143 | 146 | #endif | |
| 144 | extern size_t memweight(const void *ptr, size_t bytes); | ||
| 145 | |||
| 146 | /** | ||
| 147 | * kbasename - return the last part of a pathname. | ||
| 148 | * | ||
| 149 | * @path: path to extract the filename from. | ||
| 150 | */ | ||
| 151 | static inline const char *kbasename(const char *path) | ||
| 152 | { | ||
| 153 | const char *tail = strrchr(path, '/'); | ||
| 154 | return tail ? tail + 1 : path; | ||
| 155 | } | ||
| 156 | |||
| 157 | #endif /* _LINUX_STRING_H_ */ | 147 | #endif /* _LINUX_STRING_H_ */ |
