From owner-svn-src-all@freebsd.org Thu Mar 3 09:56:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A90AA932D2; Thu, 3 Mar 2016 09:56:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3367E6F1; Thu, 3 Mar 2016 09:56:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u239u5kW085170; Thu, 3 Mar 2016 09:56:05 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u239u4te085166; Thu, 3 Mar 2016 09:56:04 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201603030956.u239u4te085166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 3 Mar 2016 09:56:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296344 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Mar 2016 09:56:06 -0000 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 -#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_ */