TAILIEUCHUNG - Understanding Linux Network Internals 2005 phần 2

Tôi đã đề cập trong phần trước rằng các macro subsys_initcall đảm bảo rằng net_dev_init được thực hiện trước khi bất kỳ trình điều khiển thiết bị có một cơ hội để đăng ký các thiết bị của nó. Trước khi giới thiệu của cơ chế này, trình tự thực hiện được sử dụng để được thi hành khác nhau, | This document was created by an unregistered ChmMagic please go to http to register it. Thanks time option that you can use to enable or disable the contribution to system entropy by NICs. Search the Web using the keyword SA_SAMPLE_NET_RANDOM and you will find the current version. . Legacy Code I mentioned in the previous section that the subsys_initcall macros ensure thatnet_dev_init is executed before any device driver has a chance to register its devices. Before the introduction of this mechanism the order of execution used to be enforced differently using the old-fashioned mechanism of a one-time flag. The global variable dev_boot_phase was used as a Boolean flag to remember whethenet_dev_init had to be executed. It was initialized to 1 . net_dev_init had not been executed yet and was cleared byiet_dev_init. Each time register_netdevice was invoked by a device driver it checked the value of dev_boot_phase and executednet_dev_init if the flag was set indicating the function had not yet been executed. This mechanism is not needed anymore because register_netdevice cannot be called before net_dev_init if the correct tagging is applied to key device drivers routines as described in Chapter 7. However to detect wrong tagging or buggy code net_dev_init still clears the value of dev_boot_phase and register_netdevice uses the macro BUG_ON to make sure it is never called when dev_boot_phase is set. - The use of the macros BUG_ON and BUG_TRAP is a common mechanism to make sure necessary conditions are met at specific code points and is useful when transitioning from one design to another. 4 PREY NEXT Simpo PDF Merge 9Ud Split Uuregistered Versiou - Pttp This document was created by an unregistered ChmMagic please go to http to register it. Thanks PREV NEXT . User-Space Helpers There are cases where it makes sense for the kernel to invoke a user-space application to handle events. Two such helpers are .