aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2016-03-03 09:56:04 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2016-03-03 09:56:04 +0000
commit510ebed7beff2d2aae1901753f54f0c335cc3736 (patch)
tree1b97900db5f99e32a4fb1ab1ec90356b7d1b3590 /sys/compat
parent24fe42dcdde379d2a060a95e4f060412e4002f56 (diff)
Notes
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/etherdevice.h6
-rw-r--r--sys/compat/linuxkpi/common/include/linux/kernel.h1
-rw-r--r--sys/compat/linuxkpi/common/include/linux/slab.h1
-rw-r--r--sys/compat/linuxkpi/common/include/linux/string.h11
4 files changed, 16 insertions, 3 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/etherdevice.h b/sys/compat/linuxkpi/common/include/linux/etherdevice.h
index 70e5f64581b1..c58136756c26 100644
--- a/sys/compat/linuxkpi/common/include/linux/etherdevice.h
+++ b/sys/compat/linuxkpi/common/include/linux/etherdevice.h
@@ -94,6 +94,12 @@ ether_addr_equal_64bits(const u8 *pa, const u8 *pb)
}
static inline void
+eth_broadcast_addr(u8 *pa)
+{
+ memset(pa, 0xff, 6);
+}
+
+static inline void
random_ether_addr(u8 * dst)
{
read_random(dst, 6);
diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index 6b6c0afa918c..ef8d0ab218af 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -163,6 +163,7 @@
#define simple_strtol(...) strtol(__VA_ARGS__)
#define kstrtol(a,b,c) ({*(c) = strtol(a,0,b); 0;})
#define kstrtoint(a,b,c) ({*(c) = strtol(a,0,b); 0;})
+#define kstrtouint(a,b,c) ({*(c) = strtol(a,0,b); 0;})
#define min(x, y) ((x) < (y) ? (x) : (y))
#define max(x, y) ((x) > (y) ? (x) : (y))
diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h
index 1b56b555f44e..f36bc3b99a81 100644
--- a/sys/compat/linuxkpi/common/include/linux/slab.h
+++ b/sys/compat/linuxkpi/common/include/linux/slab.h
@@ -46,6 +46,7 @@ MALLOC_DECLARE(M_KMALLOC);
#define kzalloc(size, flags) kmalloc((size), (flags) | M_ZERO)
#define kzalloc_node(size, flags, node) kzalloc(size, flags)
#define kfree(ptr) free(__DECONST(void *, (ptr)), M_KMALLOC)
+#define kfree_const(ptr) kfree(ptr)
#define krealloc(ptr, size, flags) realloc((ptr), (size), M_KMALLOC, (flags))
#define kcalloc(n, size, flags) kmalloc((n) * (size), flags | M_ZERO)
#define vzalloc(size) kzalloc(size, GFP_KERNEL | __GFP_NOWARN)
diff --git a/sys/compat/linuxkpi/common/include/linux/string.h b/sys/compat/linuxkpi/common/include/linux/string.h
index cf55b098a3fc..b480faf5c2b0 100644
--- a/sys/compat/linuxkpi/common/include/linux/string.h
+++ b/sys/compat/linuxkpi/common/include/linux/string.h
@@ -2,7 +2,7 @@
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,8 +37,7 @@
#include <sys/libkern.h>
-#define strnicmp strncasecmp
-
+#define strnicmp(...) strncasecmp(__VA_ARGS__)
static inline void *
kmemdup(const void *src, size_t len, gfp_t gfp)
@@ -51,4 +50,10 @@ kmemdup(const void *src, size_t len, gfp_t gfp)
return (dst);
}
+static inline const char *
+kstrdup_const(const char *src, gfp_t gfp)
+{
+ return (kmemdup(src, strlen(src) + 1, gfp));
+}
+
#endif /* _LINUX_STRING_H_ */