[RFC PATCH 1/6] moduleparams: Add hexulong type parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Due to the bitmap.h uses a unsigned long pointer for bitmap variable,
Add an 'hexulong' is more convenient.

Signed-off-by: Yang Shen <shenyang39@xxxxxxxxxx>
---
 include/linux/moduleparam.h | 7 ++++++-
 kernel/params.c             | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 962cd41a2cb5..9e0828fa3946 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -118,7 +118,7 @@ struct kparam_array
  * you can create your own by defining those variables.
  *
  * Standard types are:
- *	byte, hexint, short, ushort, int, uint, long, ulong
+ *	byte, hexint, hexulong, short, ushort, int, uint, long, ulong
  *	charp: a character pointer
  *	bool: a bool, values 0/1, y/n, Y/N.
  *	invbool: the above, only sense-reversed (N = true).
@@ -455,6 +455,11 @@ extern int param_set_hexint(const char *val, const struct kernel_param *kp);
 extern int param_get_hexint(char *buffer, const struct kernel_param *kp);
 #define param_check_hexint(name, p) param_check_uint(name, p)
 
+extern const struct kernel_param_ops param_ops_hexulong;
+extern int param_set_hexulong(const char *val, const struct kernel_param *kp);
+extern int param_get_hexulong(char *buffer, const struct kernel_param *kp);
+#define param_check_hexulong(name, p) param_check_ulong(name, p)
+
 extern const struct kernel_param_ops param_ops_charp;
 extern int param_set_charp(const char *val, const struct kernel_param *kp);
 extern int param_get_charp(char *buffer, const struct kernel_param *kp);
diff --git a/kernel/params.c b/kernel/params.c
index 5b92310425c5..f367f0c1f228 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -242,6 +242,7 @@ STANDARD_PARAM_DEF(long,	long,			"%li",		kstrtol);
 STANDARD_PARAM_DEF(ulong,	unsigned long,		"%lu",		kstrtoul);
 STANDARD_PARAM_DEF(ullong,	unsigned long long,	"%llu",		kstrtoull);
 STANDARD_PARAM_DEF(hexint,	unsigned int,		"%#08x", 	kstrtouint);
+STANDARD_PARAM_DEF(hexulong,	unsigned long,		"%#016lx",	kstrtoul);
 
 int param_set_uint_minmax(const char *val, const struct kernel_param *kp,
 		unsigned int min, unsigned int max)
-- 
2.24.0




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux