Re: [PATCH v6 21/57] dyndbg: test DECLARE_DYNDBG_CLASSMAP, sysfs nodes

From: Greg KH
Date: Wed Sep 07 2022 - 10:55:16 EST


On Sun, Sep 04, 2022 at 03:40:58PM -0600, Jim Cromie wrote:
> Demonstrate use of DECLARE_DYNDBG_CLASSMAP macro, and expose them as
> sysfs-nodes for testing.

Wait, why sysfs?

sysfs isn't for testing, why not use debugfs?


>
> For each of the 4 class-map-types:
>
> - declare a class-map of that type,
> - declare the enum corresponding to those class-names
> - share _base across 0..30 range
> - add a __pr_debug_cls() call for each class-name
> - declare 2 sysnodes for each class-map
> for 'p' flag, and future 'T' flag
>
> These declarations create the following sysfs parameter interface:
>
> :#> pwd
> /sys/module/test_dynamic_debug/parameters
> :#> ls
> T_disjoint_bits T_disjoint_names T_level_names T_level_num do_prints
> p_disjoint_bits p_disjoint_names p_level_names p_level_num

What is in these files?

For sysfs stuff, you need Documentation/ABI entries so that you can't
abuse sysfs. With debugfs, you can do anything you want :)

thanks,

greg k-h