aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 00cec4dc0ae2..fb0e7329fee1 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -248,6 +248,37 @@ int __must_check kstrtos16(const char *s, unsigned int base, s16 *res);
248int __must_check kstrtou8(const char *s, unsigned int base, u8 *res); 248int __must_check kstrtou8(const char *s, unsigned int base, u8 *res);
249int __must_check kstrtos8(const char *s, unsigned int base, s8 *res); 249int __must_check kstrtos8(const char *s, unsigned int base, s8 *res);
250 250
251int __must_check kstrtoull_from_user(const char __user *s, size_t count, unsigned int base, unsigned long long *res);
252int __must_check kstrtoll_from_user(const char __user *s, size_t count, unsigned int base, long long *res);
253int __must_check kstrtoul_from_user(const char __user *s, size_t count, unsigned int base, unsigned long *res);
254int __must_check kstrtol_from_user(const char __user *s, size_t count, unsigned int base, long *res);
255int __must_check kstrtouint_from_user(const char __user *s, size_t count, unsigned int base, unsigned int *res);
256int __must_check kstrtoint_from_user(const char __user *s, size_t count, unsigned int base, int *res);
257int __must_check kstrtou16_from_user(const char __user *s, size_t count, unsigned int base, u16 *res);
258int __must_check kstrtos16_from_user(const char __user *s, size_t count, unsigned int base, s16 *res);
259int __must_check kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, u8 *res);
260int __must_check kstrtos8_from_user(const char __user *s, size_t count, unsigned int base, s8 *res);
261
262static inline int __must_check kstrtou64_from_user(const char __user *s, size_t count, unsigned int base, u64 *res)
263{
264 return kstrtoull_from_user(s, count, base, res);
265}
266
267static inline int __must_check kstrtos64_from_user(const char __user *s, size_t count, unsigned int base, s64 *res)
268{
269 return kstrtoll_from_user(s, count, base, res);
270}
271
272static inline int __must_check kstrtou32_from_user(const char __user *s, size_t count, unsigned int base, u32 *res)
273{
274 return kstrtouint_from_user(s, count, base, res);
275}
276
277static inline int __must_check kstrtos32_from_user(const char __user *s, size_t count, unsigned int base, s32 *res)
278{
279 return kstrtoint_from_user(s, count, base, res);
280}
281
251extern unsigned long simple_strtoul(const char *,char **,unsigned int); 282extern unsigned long simple_strtoul(const char *,char **,unsigned int);
252extern long simple_strtol(const char *,char **,unsigned int); 283extern long simple_strtol(const char *,char **,unsigned int);
253extern unsigned long long simple_strtoull(const char *,char **,unsigned int); 284extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
@@ -283,6 +314,7 @@ extern char *get_options(const char *str, int nints, int *ints);
283extern unsigned long long memparse(const char *ptr, char **retptr); 314extern unsigned long long memparse(const char *ptr, char **retptr);
284 315
285extern int core_kernel_text(unsigned long addr); 316extern int core_kernel_text(unsigned long addr);
317extern int core_kernel_data(unsigned long addr);
286extern int __kernel_text_address(unsigned long addr); 318extern int __kernel_text_address(unsigned long addr);
287extern int kernel_text_address(unsigned long addr); 319extern int kernel_text_address(unsigned long addr);
288extern int func_ptr_is_kernel_text(void *ptr); 320extern int func_ptr_is_kernel_text(void *ptr);
@@ -637,6 +669,13 @@ struct sysinfo {
637 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ 669 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
638}; 670};
639 671
672#ifdef __CHECKER__
673#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
674#define BUILD_BUG_ON_ZERO(e)
675#define BUILD_BUG_ON_NULL(e)
676#define BUILD_BUG_ON(condition)
677#else /* __CHECKER__ */
678
640/* Force a compilation error if a constant expression is not a power of 2 */ 679/* Force a compilation error if a constant expression is not a power of 2 */
641#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ 680#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
642 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) 681 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
@@ -673,6 +712,7 @@ extern int __build_bug_on_failed;
673 if (condition) __build_bug_on_failed = 1; \ 712 if (condition) __build_bug_on_failed = 1; \
674 } while(0) 713 } while(0)
675#endif 714#endif
715#endif /* __CHECKER__ */
676 716
677/* Trap pasters of __FUNCTION__ at compile-time */ 717/* Trap pasters of __FUNCTION__ at compile-time */
678#define __FUNCTION__ (__func__) 718#define __FUNCTION__ (__func__)