[OpenAFS-devel] Re: [OpenAFS] 1.5.19 build fails on SunOS 5.11 snv62 SPARC

Dean Anderson dean@av8.com
Mon, 11 Jun 2007 21:16:00 -0400 (EDT)


Take look at this: 

		--Dean

---------- Forwarded message ----------
Date: Mon, 7 May 2007 09:02:22 -0400
From: James Carlson <james.d.carlson@Sun.COM>
To: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Cc: opensolaris-code@opensolaris.org, mladen@imit.kth.se,
     Dana H. Myers <Dana.Myers@Sun.COM>
Subject: [osol-code] usable kernel symbols [was Re: Executing a kernel
    thread periodically]

Thomas De Schampheleire writes:
> There some things I would like to make sure first: can I use all kernel
> functions from a module? In Linux, modules can only use those functions from
> the kernel which are exported by the EXPORT_SYMBOL macro.

Do you really mean "can I" (am I able to) or "should I" (is this a
wise choice)?

Yes, all non-static symbols are available.  In the kernel, we're all
friends.

However, if you have any hope that your module will not just fall over
the next time something in the kernel changes, you should limit
yourself to the functions and symbols documented in section (9s, 9e,
9f) of the man pages.  See also the "writing device drivers" book.

Which interfaces are available depends in part on how you deliver your
software.  If it's not part of ON (you create your own packages or
other install mechanisms), then you should stick to the DDI, and read
the documentation carefully.  If it's part of ON (integrated via
OpenSolaris), then you're able to use "Consolidation Private"
interfaces without special arrangement, which include many of the
undocumented kernel symbols.

You can use symbols in a way contrary to what the original developer
intended if you establish something called an "ARC contract" on the
interfaces you need.  I wouldn't recommend doing this unless it's just
_absolutely_ necessary to make your driver work.

> I suppose there is a similar mechanism for OpenSolaris, isn't there? In that
> case: how do I know which functions are exported and which aren't?

You know by reading the documentation.  No, we don't have equivalent
symbol scoping mechanisms yet for the kernel.  (We probably should,
and it'd be a very nice thing to have, but it just hasn't been done.)

> Secondly, I am still stuck with the question about how my module will be
> loaded. It should be loaded by default when booting, is there a way to
> achieve that?

At a guess, I think you might want to create a driver (so that you'll
have a control node) and do something like this in your driver.conf
file:

name="mydriver" parent="pseudo" instance=0;
ddi-forceattach=1;

-- 
James Carlson, Solaris Networking              <james.d.carlson@sun.com>
Sun Microsystems / 1 Network Drive         71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code