Solved struct module Usage

Hello, I am doing some fiddling on a driver port and I am encountering a compilation error 'incomplete definition of type struct module' concerning lines in the port source that access members of struct module, such as module->name. Looking into the issue, it seems that struct module is not defined in the headers, at least not in sys/module.h, but I did see some definitions in *.c files elsewhere.

To check whether this was a problem specifically due to this driver, I made a simple module following one of the tutorials online and it compiled fine. I then added a line that accessed module->name and I got the compilation error.

So how do we build a module to allow the use of the members of struct module? Is the struct module definition supposed to be constructed at compile time, and if so, how?

Thanks!
 
Last edited:
Ok, thanks to freebsd-hackers, it turns out I had a brain fart and didn't comprehend that struct module was private! D'oh!

So, to document this, in case others get stuck trying to convert Linuxisms, to use struct module one needs to use accessors defined in kern_module.c.
 
Back
Top