Blame view

include/linux/string.h 4.14 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
  #ifndef _LINUX_STRING_H_
  #define _LINUX_STRING_H_
4ac96572f   Jeff Garzik   linux/string.h: f...
3
  /* We don't want strings.h stuff being used by user stuff by accident */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4

97ef1bb0c   David S. Miller   [TIPC]: Fix heade...
5
6
7
  #ifndef __KERNEL__
  #include <string.h>
  #else
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
8
9
10
11
  
  #include <linux/compiler.h>	/* for inline */
  #include <linux/types.h>	/* for size_t */
  #include <linux/stddef.h>	/* for NULL */
4370aa4aa   Lai Jiangshan   vsprintf: add bin...
12
  #include <stdarg.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13

96840aa00   Davi Arnaut   [PATCH] strndup_u...
14
  extern char *strndup_user(const char __user *, long);
610a77e04   Li Zefan   memdup_user(): in...
15
  extern void *memdup_user(const void __user *, size_t);
96840aa00   Davi Arnaut   [PATCH] strndup_u...
16

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  /*
   * Include machine specific inline routines
   */
  #include <asm/string.h>
  
  #ifndef __HAVE_ARCH_STRCPY
  extern char * strcpy(char *,const char *);
  #endif
  #ifndef __HAVE_ARCH_STRNCPY
  extern char * strncpy(char *,const char *, __kernel_size_t);
  #endif
  #ifndef __HAVE_ARCH_STRLCPY
  size_t strlcpy(char *, const char *, size_t);
  #endif
  #ifndef __HAVE_ARCH_STRCAT
  extern char * strcat(char *, const char *);
  #endif
  #ifndef __HAVE_ARCH_STRNCAT
  extern char * strncat(char *, const char *, __kernel_size_t);
  #endif
  #ifndef __HAVE_ARCH_STRLCAT
  extern size_t strlcat(char *, const char *, __kernel_size_t);
  #endif
  #ifndef __HAVE_ARCH_STRCMP
  extern int strcmp(const char *,const char *);
  #endif
  #ifndef __HAVE_ARCH_STRNCMP
  extern int strncmp(const char *,const char *,__kernel_size_t);
  #endif
  #ifndef __HAVE_ARCH_STRNICMP
  extern int strnicmp(const char *, const char *, __kernel_size_t);
  #endif
ded220bd8   David S. Miller   [STRING]: Move st...
49
50
51
52
53
54
  #ifndef __HAVE_ARCH_STRCASECMP
  extern int strcasecmp(const char *s1, const char *s2);
  #endif
  #ifndef __HAVE_ARCH_STRNCASECMP
  extern int strncasecmp(const char *s1, const char *s2, size_t n);
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
55
56
57
58
59
60
61
62
63
  #ifndef __HAVE_ARCH_STRCHR
  extern char * strchr(const char *,int);
  #endif
  #ifndef __HAVE_ARCH_STRNCHR
  extern char * strnchr(const char *, size_t, int);
  #endif
  #ifndef __HAVE_ARCH_STRRCHR
  extern char * strrchr(const char *,int);
  #endif
f653398c8   AndrĂ© Goddard Rosa   string: factorize...
64
  extern char * __must_check skip_spaces(const char *);
ca54cb8c9   KOSAKI Motohiro   Subject: Re: [PAT...
65
66
67
68
69
70
71
  
  extern char *strim(char *);
  
  static inline __must_check char *strstrip(char *str)
  {
  	return strim(str);
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
72
  #ifndef __HAVE_ARCH_STRSTR
d5f1fb533   Li Zefan   lib: Introduce st...
73
74
75
76
  extern char * strstr(const char *, const char *);
  #endif
  #ifndef __HAVE_ARCH_STRNSTR
  extern char * strnstr(const char *, const char *, size_t);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
77
78
79
80
81
82
83
  #endif
  #ifndef __HAVE_ARCH_STRLEN
  extern __kernel_size_t strlen(const char *);
  #endif
  #ifndef __HAVE_ARCH_STRNLEN
  extern __kernel_size_t strnlen(const char *,__kernel_size_t);
  #endif
8833d328c   Kyle McMartin   [PATCH] Clean up ...
84
85
86
87
88
89
90
91
92
93
94
95
  #ifndef __HAVE_ARCH_STRPBRK
  extern char * strpbrk(const char *,const char *);
  #endif
  #ifndef __HAVE_ARCH_STRSEP
  extern char * strsep(char **,const char *);
  #endif
  #ifndef __HAVE_ARCH_STRSPN
  extern __kernel_size_t strspn(const char *,const char *);
  #endif
  #ifndef __HAVE_ARCH_STRCSPN
  extern __kernel_size_t strcspn(const char *,const char *);
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
  
  #ifndef __HAVE_ARCH_MEMSET
  extern void * memset(void *,int,__kernel_size_t);
  #endif
  #ifndef __HAVE_ARCH_MEMCPY
  extern void * memcpy(void *,const void *,__kernel_size_t);
  #endif
  #ifndef __HAVE_ARCH_MEMMOVE
  extern void * memmove(void *,const void *,__kernel_size_t);
  #endif
  #ifndef __HAVE_ARCH_MEMSCAN
  extern void * memscan(void *,int,__kernel_size_t);
  #endif
  #ifndef __HAVE_ARCH_MEMCMP
  extern int memcmp(const void *,const void *,__kernel_size_t);
  #endif
  #ifndef __HAVE_ARCH_MEMCHR
  extern void * memchr(const void *,int,__kernel_size_t);
  #endif
798248206   Akinobu Mita   lib/string.c: int...
115
  void *memchr_inv(const void *s, int c, size_t n);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
116

dd0fc66fb   Al Viro   [PATCH] gfp flags...
117
  extern char *kstrdup(const char *s, gfp_t gfp);
1e66df3ee   Jeremy Fitzhardinge   add kstrndup
118
  extern char *kstrndup(const char *s, size_t len, gfp_t gfp);
1a2f67b45   Alexey Dobriyan   [PATCH] kmemdup: ...
119
  extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
543537bd9   Paulo Marques   [PATCH] create a ...
120

d84d1cc76   Jeremy Fitzhardinge   add argv_split()
121
122
  extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
  extern void argv_free(char **argv);
34990cf70   David Brownell   Add a new sysfs_s...
123
  extern bool sysfs_streq(const char *s1, const char *s2);
d0f1fed29   Jonathan Cameron   Add a strtobool f...
124
  extern int strtobool(const char *s, bool *res);
34990cf70   David Brownell   Add a new sysfs_s...
125

4370aa4aa   Lai Jiangshan   vsprintf: add bin...
126
127
128
129
130
  #ifdef CONFIG_BINARY_PRINTF
  int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args);
  int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf);
  int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4);
  #endif
e108526e7   Akinobu Mita   move memory_read_...
131
132
  extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
  			const void *from, size_t available);
66f92cf9d   Rusty Russell   strstarts: helper...
133
134
135
136
137
138
139
140
141
  /**
   * strstarts - does @str start with @prefix?
   * @str: string to examine
   * @prefix: prefix to look for.
   */
  static inline bool strstarts(const char *str, const char *prefix)
  {
  	return strncmp(str, prefix, strlen(prefix)) == 0;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
142
143
  #endif
  #endif /* _LINUX_STRING_H_ */