From: Jim C. <jim...@gm...> - 2012-04-17 20:36:19
|
This mod-param explains what flags are set or cleared, so setting them doesnt require finding the relevant constants in the code. root@voyage:~# cat /sys/module/acx_mac80211/parameters/* 3 bit 0:L_LOCK = 1 bit 1:L_INIT = 1 bit 2:L_IRQ = 0 bit 3:L_ASSOC = 0 bit 4:L_FUNC = 0 bit 5:L_XFER = 0 bit 6:L_DATA = 0 bit 7:L_DEBUG = 0 bit 8:L_IOCTL = 0 bit 9:L_CTL = 0 bit 10:L_BUFR = 0 bit 11:L_XFER_BEACON = 0 bit 12:L_BUFT = 0 bit 13:L_USBRXTX = 0 bit 14:L_BUF = 0 The param is writable, but w/o good effect. Fixing this is very low priority. It currently does: TODO: Incomplete code in acx_debug_flag_set() at /home/jimc/projects/lx/acx-mac80211/common.c:6941 Signed-off-by: Jim Cromie <jim...@gm...> --- common.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/common.c b/common.c index e91deac..a7afcdf 100644 --- a/common.c +++ b/common.c @@ -6907,11 +6907,47 @@ module_init(acx_init_module) module_exit(acx_cleanup_module) #if ACX_DEBUG + /* will add __read_mostly later */ unsigned int acx_debug = ACX_DEFAULT_MSG; /* parameter is 'debug', corresponding var is acx_debug */ module_param_named(debug, acx_debug, uint, 0644); MODULE_PARM_DESC(debug, "Debug level mask (see L_xxx constants)"); + +static const char *flag_names[] = { + "L_LOCK", "L_INIT", "L_IRQ", "L_ASSOC", "L_FUNC", "L_XFER", + "L_DATA", "L_DEBUG", "L_IOCTL", "L_CTL", "L_BUFR", "L_XFER_BEACON", + "L_BUFT", "L_USBRXTX", "L_BUF", +}; + +static int acx_debug_flag_get(char *buf, const struct kernel_param *kp) +{ + int i, len; + char *p = buf; // 1 page preallocated (I think - it didnt crash !!) + + for (i = 0; i < ARRAY_SIZE(flag_names); i++) { + if (acx_debug & 1 << i) + len = sprintf(p, "bit %d:%s = 1\n", i, flag_names[i]); + else + len = sprintf(p, "bit %d:%s = 0\n", i, flag_names[i]); + pr_info("%s", p); + p += len; + } + return p - buf; +} +static int acx_debug_flag_set(const char *val, const struct kernel_param *kp) +{ + TODO(); + return 0; +} + +static struct kernel_param_ops acx_debug_flag_ops = { + .get = acx_debug_flag_get, + .set = acx_debug_flag_set, +}; + +module_param_cb(debugflags, &acx_debug_flag_ops, "str", 0644); + #endif #ifdef MODULE_LICENSE -- 1.7.8.1 |