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
This commit is contained in:
parent
707324edee
commit
06ca64ecf3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300721
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user