How can I log my kernel module (let's call him "test") work process to read by typing cat /sys/module/test/stat/volumes? Which way should I go? Have I use something from kobject functionality or it's possible to write from kernel functions?

Can you please give examples of such work?


In this case, you have to use kobject approach and create function (of course with all the auxiliary) like this:

static struct kobj_attribute stat_info_attribute = __ATTR(volumes, 0444, stat_info_show, stat_info_store);

After that you have to initializate it in __init function.

Full listing with realisation you can find here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.