Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_STRING_H_ |
| 2 | #define _LINUX_STRING_H_ |
| 3 | |
| 4 | /* We don't want strings.h stuff being user by user stuff by accident */ |
| 5 | |
David S. Miller | 97ef1bb | 2007-10-30 21:44:00 -0700 | [diff] [blame] | 6 | #ifndef __KERNEL__ |
| 7 | #include <string.h> |
| 8 | #else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
| 10 | #include <linux/compiler.h> /* for inline */ |
| 11 | #include <linux/types.h> /* for size_t */ |
| 12 | #include <linux/stddef.h> /* for NULL */ |
| 13 | |
Davi Arnaut | 96840aa | 2006-03-24 03:18:42 -0800 | [diff] [blame] | 14 | extern char *strndup_user(const char __user *, long); |
| 15 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | /* |
| 17 | * Include machine specific inline routines |
| 18 | */ |
| 19 | #include <asm/string.h> |
| 20 | |
| 21 | #ifndef __HAVE_ARCH_STRCPY |
| 22 | extern char * strcpy(char *,const char *); |
| 23 | #endif |
| 24 | #ifndef __HAVE_ARCH_STRNCPY |
| 25 | extern char * strncpy(char *,const char *, __kernel_size_t); |
| 26 | #endif |
| 27 | #ifndef __HAVE_ARCH_STRLCPY |
| 28 | size_t strlcpy(char *, const char *, size_t); |
| 29 | #endif |
| 30 | #ifndef __HAVE_ARCH_STRCAT |
| 31 | extern char * strcat(char *, const char *); |
| 32 | #endif |
| 33 | #ifndef __HAVE_ARCH_STRNCAT |
| 34 | extern char * strncat(char *, const char *, __kernel_size_t); |
| 35 | #endif |
| 36 | #ifndef __HAVE_ARCH_STRLCAT |
| 37 | extern size_t strlcat(char *, const char *, __kernel_size_t); |
| 38 | #endif |
| 39 | #ifndef __HAVE_ARCH_STRCMP |
| 40 | extern int strcmp(const char *,const char *); |
| 41 | #endif |
| 42 | #ifndef __HAVE_ARCH_STRNCMP |
| 43 | extern int strncmp(const char *,const char *,__kernel_size_t); |
| 44 | #endif |
| 45 | #ifndef __HAVE_ARCH_STRNICMP |
| 46 | extern int strnicmp(const char *, const char *, __kernel_size_t); |
| 47 | #endif |
David S. Miller | ded220b | 2007-03-29 01:18:42 -0700 | [diff] [blame] | 48 | #ifndef __HAVE_ARCH_STRCASECMP |
| 49 | extern int strcasecmp(const char *s1, const char *s2); |
| 50 | #endif |
| 51 | #ifndef __HAVE_ARCH_STRNCASECMP |
| 52 | extern int strncasecmp(const char *s1, const char *s2, size_t n); |
| 53 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | #ifndef __HAVE_ARCH_STRCHR |
| 55 | extern char * strchr(const char *,int); |
| 56 | #endif |
| 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 |
Pekka Enberg | 481fad4 | 2006-06-23 02:05:44 -0700 | [diff] [blame] | 63 | extern char * strstrip(char *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | #ifndef __HAVE_ARCH_STRSTR |
| 65 | extern char * strstr(const char *,const char *); |
| 66 | #endif |
| 67 | #ifndef __HAVE_ARCH_STRLEN |
| 68 | extern __kernel_size_t strlen(const char *); |
| 69 | #endif |
| 70 | #ifndef __HAVE_ARCH_STRNLEN |
| 71 | extern __kernel_size_t strnlen(const char *,__kernel_size_t); |
| 72 | #endif |
Kyle McMartin | 8833d32 | 2006-04-10 22:53:57 -0700 | [diff] [blame] | 73 | #ifndef __HAVE_ARCH_STRPBRK |
| 74 | extern char * strpbrk(const char *,const char *); |
| 75 | #endif |
| 76 | #ifndef __HAVE_ARCH_STRSEP |
| 77 | extern char * strsep(char **,const char *); |
| 78 | #endif |
| 79 | #ifndef __HAVE_ARCH_STRSPN |
| 80 | extern __kernel_size_t strspn(const char *,const char *); |
| 81 | #endif |
| 82 | #ifndef __HAVE_ARCH_STRCSPN |
| 83 | extern __kernel_size_t strcspn(const char *,const char *); |
| 84 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | |
| 86 | #ifndef __HAVE_ARCH_MEMSET |
| 87 | extern void * memset(void *,int,__kernel_size_t); |
| 88 | #endif |
| 89 | #ifndef __HAVE_ARCH_MEMCPY |
| 90 | extern void * memcpy(void *,const void *,__kernel_size_t); |
| 91 | #endif |
| 92 | #ifndef __HAVE_ARCH_MEMMOVE |
| 93 | extern void * memmove(void *,const void *,__kernel_size_t); |
| 94 | #endif |
| 95 | #ifndef __HAVE_ARCH_MEMSCAN |
| 96 | extern void * memscan(void *,int,__kernel_size_t); |
| 97 | #endif |
| 98 | #ifndef __HAVE_ARCH_MEMCMP |
| 99 | extern int memcmp(const void *,const void *,__kernel_size_t); |
| 100 | #endif |
| 101 | #ifndef __HAVE_ARCH_MEMCHR |
| 102 | extern void * memchr(const void *,int,__kernel_size_t); |
| 103 | #endif |
| 104 | |
Al Viro | dd0fc66 | 2005-10-07 07:46:04 +0100 | [diff] [blame] | 105 | extern char *kstrdup(const char *s, gfp_t gfp); |
Jeremy Fitzhardinge | 1e66df3 | 2007-07-17 18:37:02 -0700 | [diff] [blame] | 106 | extern char *kstrndup(const char *s, size_t len, gfp_t gfp); |
Alexey Dobriyan | 1a2f67b | 2006-09-30 23:27:20 -0700 | [diff] [blame] | 107 | extern void *kmemdup(const void *src, size_t len, gfp_t gfp); |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 108 | |
Jeremy Fitzhardinge | d84d1cc | 2007-07-17 18:37:02 -0700 | [diff] [blame] | 109 | extern char **argv_split(gfp_t gfp, const char *str, int *argcp); |
| 110 | extern void argv_free(char **argv); |
| 111 | |
David Brownell | 34990cf | 2008-05-01 04:34:42 -0700 | [diff] [blame] | 112 | extern bool sysfs_streq(const char *s1, const char *s2); |
| 113 | |
Akinobu Mita | e108526e | 2008-07-23 21:26:44 -0700 | [diff] [blame] | 114 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, |
| 115 | const void *from, size_t available); |
| 116 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | #endif |
| 118 | #endif /* _LINUX_STRING_H_ */ |