From owner-svn-src-all@freebsd.org Thu May 26 09:04:16 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 00374B4BFF7; Thu, 26 May 2016 09:04:15 +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 B2BCB10DC; Thu, 26 May 2016 09:04:15 +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 u4Q94EoS054894; Thu, 26 May 2016 09:04:14 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4Q94EXw054893; Thu, 26 May 2016 09:04:14 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201605260904.u4Q94EXw054893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 26 May 2016 09:04:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300721 - 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.22 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, 26 May 2016 09:04:16 -0000 Author: hselasky Date: Thu May 26 09:04:14 2016 New Revision: 300721 URL: https://svnweb.freebsd.org/changeset/base/300721 Log: Add support for runtime modifiable module parameters in the LinuxKPI. Linux module parameters have a permissions value. If any write bits are set we are allowed to modify the module parameter runtime. Reflect this when creating the static SYSCTL nodes. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Modified: head/sys/compat/linuxkpi/common/include/linux/moduleparam.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Thu May 26 08:47:06 2016 (r300720) +++ head/sys/compat/linuxkpi/common/include/linux/moduleparam.h Thu May 26 09:04:14 2016 (r300721) @@ -44,77 +44,81 @@ #define LINUXKPI_PARAM_PREFIX /* empty prefix is the default */ #endif +#ifndef LINUXKPI_PARAM_PERM +#define LINUXKPI_PARAM_PERM(perm) (((perm) & 0222) ? CTLFLAG_RWTUN : CTLFLAG_RDTUN) +#endif + #define LINUXKPI_PARAM_CONCAT_SUB(a,b,c,d) a##b##c##d #define LINUXKPI_PARAM_CONCAT(...) LINUXKPI_PARAM_CONCAT_SUB(__VA_ARGS__) #define LINUXKPI_PARAM_PASS(...) __VA_ARGS__ #define LINUXKPI_PARAM_DESC(name) LINUXKPI_PARAM_CONCAT(linuxkpi_,LINUXKPI_PARAM_PREFIX,name,_desc) #define LINUXKPI_PARAM_NAME(name) LINUXKPI_PARAM_CONCAT(LINUXKPI_PARAM_PREFIX,name,,) -#define LINUXKPI_PARAM_bool(name, var) \ +#define LINUXKPI_PARAM_bool(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_BOOL(LINUXKPI_PARAM_PARENT, OID_AUTO,\ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_byte(name, var) \ +#define LINUXKPI_PARAM_byte(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_U8(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_short(name, var) \ +#define LINUXKPI_PARAM_short(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_S16(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_ushort(name, var) \ +#define LINUXKPI_PARAM_ushort(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_U16(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_int(name, var) \ +#define LINUXKPI_PARAM_int(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_INT(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0,\ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_uint(name, var) \ +#define LINUXKPI_PARAM_uint(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_UINT(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_long(name, var) \ +#define LINUXKPI_PARAM_long(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_LONG(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) -#define LINUXKPI_PARAM_ulong(name, var) \ +#define LINUXKPI_PARAM_ulong(name, var, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_ULONG(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, &(var), 0, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), &(var), 0, \ LINUXKPI_PARAM_DESC(name))) #define module_param_string(name, str, len, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_STRING(LINUXKPI_PARAM_PARENT, OID_AUTO, \ - LINUXKPI_PARAM_NAME(name), CTLFLAG_RDTUN, (str), (len), \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm), (str), (len), \ LINUXKPI_PARAM_DESC(name))) #define module_param_named(name, var, type, mode) \ - LINUXKPI_PARAM_##type(name, var) + LINUXKPI_PARAM_##type(name, var, mode) #define module_param(var, type, mode) \ - LINUXKPI_PARAM_##type(var, var) + LINUXKPI_PARAM_##type(var, var, mode) #define module_param_named_unsafe(name, var, type, mode) \ - LINUXKPI_PARAM_##type(name, var) + LINUXKPI_PARAM_##type(name, var, mode) #define module_param_unsafe(var, type, mode) \ - LINUXKPI_PARAM_##type(var, var) + LINUXKPI_PARAM_##type(var, var, mode) #define module_param_array(var, type, addr_argc, mode)