Late_initcall and module_init

Source: Internet
Author: User

 

The following definitions are available in init. h:

 

# Define pure_initcall (FN) _ define_initcall ("0", FN, 1)

# Define core_initcall (FN) _ define_initcall ("1", FN, 1)
# Define core_initcall_sync (FN) _ define_initcall ("1 s", FN, 1 s)
# Define postcore_initcall (FN) _ define_initcall ("2", FN, 2)
# Define postcore_initcall_sync (FN) _ define_initcall ("2 s", FN, 2 S)
# Define arch_initcall (FN) _ define_initcall ("3", FN, 3)
# Define arch_initcall_sync (FN) _ define_initcall ("3 S", FN, 3 S)
# Define subsys_initcall (FN) _ define_initcall ("4", FN, 4)
# Define subsys_initcall_sync (FN) _ define_initcall ("4 s", FN, 4S)
# Define fs_initcall (FN) _ define_initcall ("5", FN, 5)
# Define fs_initcall_sync (FN) _ define_initcall ("5 s", FN, 5S)
# Define rootfs_initcall (FN) _ define_initcall ("rootfs", FN, rootfs)
# Define device_initcall (FN) _ define_initcall ("6", FN, 6)
# Define device_initcall_sync (FN) _ define_initcall ("6 s", FN, 6 S)
# Define late_initcall (FN) _ define_initcall ("7", FN, 7)
# Define late_initcall_sync (FN) _ define_initcall ("7 s", FN, 7 S)

# Define module_init (x) _ initcall (X );
# DEFINE _ initcall (FN) device_initcall (FN)

 


All the _ init functions are in the. init. Text Section, and a function pointer is saved in. initcall. init,
During initialization, the kernel calls these _ init function pointers through these function pointers,
After the initialization is complete, release the entire init section (including. init. Text,. initcall. init, and so on ).
 
The Calling sequence of these functions during kernel Initialization is only related to the order of function pointers.

The order of these functions in the. init. text section is irrelevant.

In the 2.6 kernel, The initcall. init segment is divided into seven sub-segments.

Different segments have different calling sequence. Smaller numbers have a higher priority.


That is to say, late_initcall must be later than module_init.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.