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. linux总线、设备和设备驱动的关系

    之一:bus_type 总线是处理器和一个或多个设备之间的通道,在设备模型中,所有的设备都通过总线相连,甚至是内部的虚拟"platform"总线.可以通过ls -l /sys/bu ...

  2. ios开发--旋转、移动、缩放手势实例代码

    代码如下: // 添加所有的手势 - (void) addGestureRecognizerToView:(UIView *)view { // 旋转手势 UIRotationGestureRecog ...

  3. VBS基础篇 - Err对象

    Err对象是一个具有全局范围的内部对象,含有关于错误的所有信息.On Error Resume next 忽略运行时产生的所有错误On Error Goto 0 取消忽略错误措施主要方法有:Clear ...

  4. [Android] ImageView.ScaleType设置图解 【转载】

    ImageView的Scaletype决定了图片在View上显示时的样子,如进行何种比例的缩放,及显示图片的整体还是部分,等等. 设置的方式包括: 1. 在layout xml中定义android:s ...

  5. 新建标准mavenWeb工程以及Maven的web应用标准目录结构建议

    到现在为止,使用Maven结构的Web工程越来越多,因此在此介绍一下通过Maven来构建项目的相关知识.     文档主要分为两部分:       1.如何通过maven来构建多模块的web项目    ...

  6. 输入n个整数,找出其中最小的K个数。例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4个数字是1,2,3,4,。

    // ConsoleApplication2.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include "stdafx.h ...

  7. 【BZOJ】【1272】【BeiJingWC2008】Gate of Babylon

    组合数学+容斥原理 Orz zyf-zyf 多重集组合数0.0还带个数限制?  ——>  <组合数学>第6章  6.2带重复的组合 组合数还要模P 0.0? ——> Lucas ...

  8. Introduction To Monte Carlo Methods

    Introduction To Monte Carlo Methods I’m going to keep this tutorial light on math, because the goal ...

  9. uva 10120

    bfs搜索  当n大于等于49 是 总是可能的 ~ http://www.algorithmist.com/index.php/UVa_10120 #include <cstdio> #i ...

  10. $('li','div') $('div li') $('div li')

    $('div','li')是$(子,父),是从父节点里找子,而不是找li外面的div $('div , li')才是找所有的div和li,之间不存在父子关系 $('div li') 是找div里面所有 ...