Author: hselasky
Date: Thu Mar  3 09:56:04 2016
New Revision: 296344
URL: https://svnweb.freebsd.org/changeset/base/296344

Log:
  Add more functions to the LinuxKPI.
  
  Define strnicmp as a function macro instead of a regular macro while
  at it.
  
  MFC after:    1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/etherdevice.h
  head/sys/compat/linuxkpi/common/include/linux/kernel.h
  head/sys/compat/linuxkpi/common/include/linux/slab.h
  head/sys/compat/linuxkpi/common/include/linux/string.h

Modified: head/sys/compat/linuxkpi/common/include/linux/etherdevice.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/etherdevice.h Thu Mar  3 
09:01:00 2016        (r296343)
+++ head/sys/compat/linuxkpi/common/include/linux/etherdevice.h Thu Mar  3 
09:56:04 2016        (r296344)
@@ -94,6 +94,12 @@ ether_addr_equal_64bits(const u8 *pa, co
 }
 
 static inline void
+eth_broadcast_addr(u8 *pa)
+{
+       memset(pa, 0xff, 6);
+}
+
+static inline void
 random_ether_addr(u8 * dst)
 {
        read_random(dst, 6);

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h      Thu Mar  3 
09:01:00 2016        (r296343)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h      Thu Mar  3 
09:56:04 2016        (r296344)
@@ -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))

Modified: head/sys/compat/linuxkpi/common/include/linux/slab.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/slab.h        Thu Mar  3 
09:01:00 2016        (r296343)
+++ head/sys/compat/linuxkpi/common/include/linux/slab.h        Thu Mar  3 
09:56:04 2016        (r296344)
@@ -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)

Modified: head/sys/compat/linuxkpi/common/include/linux/string.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/string.h      Thu Mar  3 
09:01:00 2016        (r296343)
+++ head/sys/compat/linuxkpi/common/include/linux/string.h      Thu Mar  3 
09:56:04 2016        (r296344)
@@ -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
        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_ */
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to