Drive Learning 5-Generating device nodes (Miscellaneous devices)

Source: Internet
Author: User

Miscellaneous device header files in "Include/linux/miscdevice.h", you need to use two functions and a struct

Miscellaneous device registration functions: int misc_register (struct misdevice *misc);

Miscellaneous device unload function: int mis_deregister (struct misdevice *misc);

 struct   misdevice{ int   minor;  const  char  *name;  const  struct  file_operations *< Span style= "color: #000000;"    >fops;     struct   List_head list;     parent;     this_device;  const  char  *nodename; mode_t mode;}  

Where the file_operations structure is in the header file "Include/linux/fs.h", the members of the file_operations structure belong to the main content of the driver design, and the function and Linux system correspond to the system interface one by one provided by the application.

You need to define these functions yourself (such as OPEN,RELEASE,IOCTL)

Drive Learning 5-Generating device nodes (Miscellaneous devices)

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.