On 05/24/2011 10:50 AM, Ingo Molnar wrote:
Yeah, that would certainly work for simple things but there's several reasons
why explicit control over initcalls is preferred in a tool like tools/kvm/ over
__attribute__((constructor)):
Some advantages you mention are real indeed, but they are general;
there's no reason why they apply only to tools/kvm. You can achieve the
same by doing only minimal work (registering your
subsystems/devices/whatever in a linked list) in the constructors. Then
you iterate on the list and call function pointers.
I know portability is not relevant to tools/kvm/, but using unportable
tricks for the sake of using them is a direct way to NIH. But oh well
all of tools/kvm/ is NIH after all. :)
- The kernel has several classes of initcalls with different call priority,
i'm not aware of an equivalent __attribute__((constructor)) capability.
We could also do more sophisticated layers of initcalls or an explicit
initcall dependency tree, should the need arise.
Constructors and destructors can have a priority (low runs first for
constructors, low runs last for destructors).
Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html