Declaration when writing a module (including Module_license, etc.) (RPM)

Source: Internet
Author: User

To write a module, you must first declare the following two sentences:

#include <linux/module.h>//This header file contains many definitions of symbols and functions that are more relevant to the loading module

#include <linux/init.h>//This header file contains your module initialization and cleanup functions

In addition, if you need to use parameters to pass the module, then you may want to declare moduleparam.h this header file.

Furthermore, the modules often contain descriptive declarations such as:

Module_license ("GPL"); "GPL" indicates that this is any version of the GNU General Public License

"GPL v2" is the second version that indicates that this is only declared as GPL

"GPL and Addtional"

"Dual BSD/GPL"

"Dual MPL/GPL"

"Proprietary" private

Unless your module explicitly declares an open-source version, the kernel defaults to you as a private module (proprietary).

Module_author//Declaration author

Module_description//A simple description of the module, this description is "human-readable"

Module_version//version of this module

Module_alias//alias of this module

Module_device_table//Tell user space what kind of device does this module support

The Module_ declaration can be written anywhere in the module (but must be outside the function), but the formula is written at the end of the module.

Declarations when writing modules (including Module_license, etc.) (RPM)

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.