How to get kobject from the current module

In the Linux kernel, given the module, how can I find out if this is kobject?

Context: I'm trying to make sysfs_create_file (kobj, attr) in a kernel module. I have a whole set of attributes, but I want to add an attribute to the current module.

+4
source share
1 answer

ok after viewing the module. I found him.

struct kobject mod_kobj = (((struct module *)(THIS_MODULE))->mkobj).kobj;
+2
source

Source: https://habr.com/ru/post/1543488/


All Articles