Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Dec 2019 21:00:16 +0100
From:      Gary Jennejohn <gljennjohn@gmail.com>
To:        Ian Lepore <ian@freebsd.org>
Cc:        "Kenneth M. Glassey" <kennethg@trueworldfoods.com>, "freebsd-hackers@FreeBSD.org" <freebsd-hackers@FreeBSD.org>
Subject:   Re: How to compile 'struct module' usage?
Message-ID:  <20191216210016.15480d75@ernst.home>
In-Reply-To: <4073d95a738cb52eba5c3426e767b7ac701e42cd.camel@freebsd.org>
References:  <CY4PR13MB186133B99A405BD6900F87BCA0510@CY4PR13MB1861.namprd13.prod.outlook.com> <4073d95a738cb52eba5c3426e767b7ac701e42cd.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 16 Dec 2019 11:01:16 -0700
Ian Lepore <ian@freebsd.org> wrote:

> On Mon, 2019-12-16 at 17:26 +0000, Kenneth M. Glassey wrote:
> > 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? Or is it verboten to access members of
> > that
> > struct?
> > 
> > Thanks!
> > 
> > Kenneth
> >   
> 
> The definition of struct module is private by design.  You need to use
> the existing accessor functions such as module_getname(),
> module_file(), etc (which are likely not well-documented anywhere, but
> can be found in kern_module.c).
> 

This is useful information, especially because the C-code _is_ the
only documentation.

There's a module_setspecific(), would be nice if there were also a
module_getspecific().  But it looks like module_setspecific() is only
there for kern_syscall_module_handler().

-- 
Gary Jennejohn



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20191216210016.15480d75>