blob: 810d80df0a1d1700956e40ededaeefe29883ab46 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#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. Miller97ef1bb2007-10-30 21:44:00 -07006#ifndef __KERNEL__
7#include <string.h>
8#else
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
10#include <linux/compiler.h> /* for inline */
11#include <linux/types.h> /* for size_t */
12#include <linux/stddef.h> /* for NULL */
13
Davi Arnaut96840aa2006-03-24 03:18:42 -080014extern char *strndup_user(const char __user *, long);
15
Linus Torvalds1da177e2005-04-16 15:20:36 -070016/*
17 * Include machine specific inline routines
18 */
19#include <asm/string.h>
20
21#ifndef __HAVE_ARCH_STRCPY
22extern char * strcpy(char *,const char *);
23#endif
24#ifndef __HAVE_ARCH_STRNCPY
25extern char * strncpy(char *,const char *, __kernel_size_t);
26#endif
27#ifndef __HAVE_ARCH_STRLCPY
28size_t strlcpy(char *, const char *, size_t);
29#endif
30#ifndef __HAVE_ARCH_STRCAT
31extern char * strcat(char *, const char *);
32#endif
33#ifndef __HAVE_ARCH_STRNCAT
34extern char * strncat(char *, const char *, __kernel_size_t);
35#endif
36#ifndef __HAVE_ARCH_STRLCAT
37extern size_t strlcat(char *, const char *, __kernel_size_t);
38#endif
39#ifndef __HAVE_ARCH_STRCMP
40extern int strcmp(const char *,const char *);
41#endif
42#ifndef __HAVE_ARCH_STRNCMP
43extern int strncmp(const char *,const char *,__kernel_size_t);
44#endif
45#ifndef __HAVE_ARCH_STRNICMP
46extern int strnicmp(const char *, const char *, __kernel_size_t);
47#endif
David S. Millerded220b2007-03-29 01:18:42 -070048#ifndef __HAVE_ARCH_STRCASECMP
49extern int strcasecmp(const char *s1, const char *s2);
50#endif
51#ifndef __HAVE_ARCH_STRNCASECMP
52extern int strncasecmp(const char *s1, const char *s2, size_t n);
53#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070054#ifndef __HAVE_ARCH_STRCHR
55extern char * strchr(const char *,int);
56#endif
57#ifndef __HAVE_ARCH_STRNCHR
58extern char * strnchr(const char *, size_t, int);
59#endif
60#ifndef __HAVE_ARCH_STRRCHR
61extern char * strrchr(const char *,int);
62#endif
Pekka Enberg481fad42006-06-23 02:05:44 -070063extern char * strstrip(char *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070064#ifndef __HAVE_ARCH_STRSTR
65extern char * strstr(const char *,const char *);
66#endif
67#ifndef __HAVE_ARCH_STRLEN
68extern __kernel_size_t strlen(const char *);
69#endif
70#ifndef __HAVE_ARCH_STRNLEN
71extern __kernel_size_t strnlen(const char *,__kernel_size_t);
72#endif
Kyle McMartin8833d322006-04-10 22:53:57 -070073#ifndef __HAVE_ARCH_STRPBRK
74extern char * strpbrk(const char *,const char *);
75#endif
76#ifndef __HAVE_ARCH_STRSEP
77extern char * strsep(char **,const char *);
78#endif
79#ifndef __HAVE_ARCH_STRSPN
80extern __kernel_size_t strspn(const char *,const char *);
81#endif
82#ifndef __HAVE_ARCH_STRCSPN
83extern __kernel_size_t strcspn(const char *,const char *);
84#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
86#ifndef __HAVE_ARCH_MEMSET
87extern void * memset(void *,int,__kernel_size_t);
88#endif
89#ifndef __HAVE_ARCH_MEMCPY
90extern void * memcpy(void *,const void *,__kernel_size_t);
91#endif
92#ifndef __HAVE_ARCH_MEMMOVE
93extern void * memmove(void *,const void *,__kernel_size_t);
94#endif
95#ifndef __HAVE_ARCH_MEMSCAN
96extern void * memscan(void *,int,__kernel_size_t);
97#endif
98#ifndef __HAVE_ARCH_MEMCMP
99extern int memcmp(const void *,const void *,__kernel_size_t);
100#endif
101#ifndef __HAVE_ARCH_MEMCHR
102extern void * memchr(const void *,int,__kernel_size_t);
103#endif
104
Al Virodd0fc662005-10-07 07:46:04 +0100105extern char *kstrdup(const char *s, gfp_t gfp);
Jeremy Fitzhardinge1e66df32007-07-17 18:37:02 -0700106extern char *kstrndup(const char *s, size_t len, gfp_t gfp);
Alexey Dobriyan1a2f67b2006-09-30 23:27:20 -0700107extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
Paulo Marques543537b2005-06-23 00:09:02 -0700108
Jeremy Fitzhardinged84d1cc2007-07-17 18:37:02 -0700109extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
110extern void argv_free(char **argv);
111
David Brownell34990cf2008-05-01 04:34:42 -0700112extern bool sysfs_streq(const char *s1, const char *s2);
113
Akinobu Mitae108526e2008-07-23 21:26:44 -0700114extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
115 const void *from, size_t available);
116
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117#endif
118#endif /* _LINUX_STRING_H_ */