device number(dev_t)

linux driver 2009-08-21 10:08:03 阅读26 评论0 字号:大中小

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;
转载自:http://leewez.blog.163.com/blog/static/2958954620097211083517/

struct dev_t的更多相关文章

  1. Learn ZYNQ Programming(1)

    GPIO LED AND KEY: part1:gpio leds and gpio btns combination. (include 1~4) part2:use gpio btns inter ...

  2. Linux Communication Mechanism Summarize

    目录 . Linux通信机制分类简介 . 控制机制 0x1: 竞态条件 0x2: 临界区 . Inter-Process Communication (IPC) mechanisms: 进程间通信机制 ...

  3. linux 字符驱动

    1 结构体说明:     struct cdev {         struct kobject kobj;          // 每一个 cdev 都是一个 kobject         st ...

  4. struct stat结构体的详解和用法

    [cpp] view plaincopy //! 需要包含de头文件 #include <sys/types.h> #include <sys/stat.h> S_ISLNK( ...

  5. struct inode 和 struct file

    1.struct inode──字符设备驱动相关的重要结构介绍 内核中用inode结构表示具体的文件,而用file结构表示打开的文件描述符.Linux2.6.27内核中,inode结构体具体定义如下: ...

  6. S_ISREG等几个常见的宏 struct stat

    S_ISLNK(st_mode):是否是一个连接.S_ISREG(st_mode):是否是一个常规文件.S_ISDIR(st_mode):是否是一个目录S_ISCHR(st_mode):是否是一个字符 ...

  7. struct stat 作用

    stat,lstat,fstat1 函数都是获取文件(普通文件,目录,管道,socket,字符,块()的属性.函数原型#include <sys/stat.h> int stat(cons ...

  8. VFS四大对象之二 struct inode

    继上一篇文章:http://www.cnblogs.com/linhaostudy/p/7427027.html 二.inode结构体:(转自http://blog.csdn.net/shanshan ...

  9. VFS四大对象之一 struct super_block

    linux虚拟文件系统四大对象: 1)超级块(super block) 2)索引节点(inode) 3)目录项(dentry) 4)文件对象(file) 现在先介绍第一个 一.super_block的 ...

随机推荐

  1. (菜鸟要飞系列)四,基于Asp.Net MVC5的后台管理系统(zTree绑定Json数据生成树)

    上一次老师让我们用递归将中国城市镇县四级联动 显示在树上,那个时候就知道可以显示在zTree上,可是苦于对Json的不了解,对zTree的Api的不了解,一直没有做出来,只好将递归算法显示在了窗体上, ...

  2. IIS本地服务器,设置IP地址问题

    IIS启动本地网站的时候,设置了IP地址为本地IP,并绑定特定的端口号,电脑无法打开,但是同个局域网的手机可以打开.

  3. 如何成为一个牛掰的Java大神?

    一.基础篇 1.1 JVM 1.1.1. Java内存模型,Java内存管理,Java堆和栈,垃圾回收 http://www.jcp.org/en/jsr/detail?id=133http://if ...

  4. ASP.NET Web – 输入的有效性验证

    下面这个示例显示了与文本框textFirstname相关的验证控件RequiredFieldValidator.所有的验证控件都有ErrorMessage和ControlToValidate属性.如果 ...

  5. python调用C语言

    标签(空格分隔): python test.c代码如下 #include<stdio.h> void display(char* msg) { printf("%s\n" ...

  6. System.IO.StreamWriter

    string path = @"D:\a.txt"; System.IO.StreamWriter swOut = new System.IO.StreamWriter(path, ...

  7. 1965: [Ahoi2005]SHUFFLE 洗牌 - BZOJ

    Description 为了表彰小联为Samuel星球的探险所做出的贡献,小联被邀请参加Samuel星球近距离载人探险活动. 由于Samuel星球相当遥远,科学家们要在飞船中度过相当长的一段时间,小联 ...

  8. mysql之sql语句导入与导出讲解

    导出SQL:mysqldump -u root -p 数据库名 [表名1 表名2] > 输出地址其中表名可选 本机测试实例:

  9. 【Asp.Net-- 杂七杂八】的代码

    Request.Url.PathAndQuery public RedirectResult AddToCart(Cart cart, int productId, string returnUrl) ...

  10. spoj 274

    离散化   枚举行  扫描横坐标 #include <iostream> #include <cstdio> #include <cstring> #include ...