dev_t
description:
the dev_t type in is used to hold device numbers—both the major and minor
parts.
header:
#include
constructor:
MKDEV(int major, int minor);
method:
MAJOR(dev_t dev); //obtain the major part of a dev_t
MINOR(dev_t dev); //obtain the minor part of a dev_t
register_chrdev_region(); //manually obtain(register) device numbers
from the system
alloc_chrdev_region(); //allocate a major number by kernel
unregister_chrdev_region(); //free the device number back to kernel
int print_dev_t(char *buffer, dev_t dev); //encode the device number into the given buffer; char *format_dev_t(char *buffer, dev_t dev); //encode the device number into the given buffer;
本文介绍Linux系统中dev_t类型及其作用于设备号管理的方法。包括如何使用构造函数MKDEV来创建设备号,通过MAJOR和MINOR宏获取设备号的主要和次要部分,以及如何利用register_chrdev_region、alloc_chrdev_region和unregister_chrdev_region等函数注册和释放设备号。
4386

被折叠的 条评论
为什么被折叠?



