Date: Sun, 20 Aug 2006 22:01:24 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: rik@inse.ru Cc: freebsd-hackers@freebsd.org Subject: Re: global date via module howto Message-ID: <20060820.220124.387191884.imp@bsdimp.com> In-Reply-To: <44E87CCD.30105@inse.ru> References: <44E87CCD.30105@inse.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <44E87CCD.30105@inse.ru>
Roman Kurakin <rik@inse.ru> writes:
: I have the following problem:
: module A
: int x;
:
: module B
: extern int x;
:
: Module A is loaded, module B can't be loaded cause of unknow 'x'.
: What should I do to make x global?
Better to make module B depend on module A. Making it global is
generally a bad idea.
in module A:
MODULE_VERSION(A, 1);
In module B:
MODULE_DEPEND(B, A, 1, 1, 1);
Warner
: PS. I am working on porting irda support for USB devices from NetBSD.
: The current model consists of two layers hw and sw. hw is the usb device
: driver. sw is some software layer the same for all device and it is a
: child on top of hw 'bus'. To make this working I need to add
: DRIVER_MODULE for each 'bus'. To make sw independent from the
: bus I need to export _driver and _class structures and put DRIVER_MODULE
: in 'bus' code instead of 'child'.
Are you sure that you need to do this? I'm pretty sure that you can
create a base class irdabus and then derive all the hw modules that
implement irdabus from than and all the children will automatically
probe. No need to export the driver/class structures.
Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060820.220124.387191884.imp>
