7

In Linux kernel, given a module how can I know is it's kobject?

Context: I am trying to do a sysfs_create_file(kobj,attr) in a kernel module. I have all the attribute stuff set up, but I want to add an attribute to the current module.

savanto
  • 4,470
  • 23
  • 40
kernelator
  • 131
  • 6

1 Answers1

4

ok after looking through module.h I found it.

struct kobject mod_kobj = (((struct module *)(THIS_MODULE))->mkobj).kobj;
kernelator
  • 131
  • 6