LIB: ARM: use generic strnlen_user and strncpy_from_user
/include/linux/kernel.h
blob:da3e76d00105d5b8a129fec75f359c3397fe7142 -> blob:3a2c1856e027d0dd5c569f8aca37881342a45141
--- include/linux/kernel.h
+++ include/linux/kernel.h
@@ -37,6 +37,8 @@
#define STACK_MAGIC 0xdeadbeef
+#define REPEAT_BYTE(x) ((~0ul / 0xff) * (x))
+
#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
@@ -90,6 +92,19 @@
)
+/*
+ * Multiplies an integer by a fraction, while avoiding unnecessary
+ * overflow or loss of precision.
+ */
+#define mult_frac(x, numer, denom)( \
+{ \
+ typeof(x) quot = (x) / (denom); \
+ typeof(x) rem = (x) % (denom); \
+ (quot * (numer)) + ((rem * (numer)) / (denom)); \
+} \
+)
+
+
#define _RET_IP_ (unsigned long)__builtin_return_address(0)
#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
@@ -301,6 +316,7 @@ extern long long simple_strtoll(const ch
#define strict_strtoull kstrtoull
#define strict_strtoll kstrtoll
+extern int num_to_str(char *buf, int size, unsigned long long num);
extern int sprintf(char * buf, const char * fmt, ...)
__attribute__ ((format (printf, 2, 3)));
extern int vsprintf(char *buf, const char *, va_list)