标题 | 阅读 | 评论 | 转发 | 发布日期 | |
---|---|---|---|---|---|
Ubuntu搭建SVN服务器+Apache http访问 | 2939 | 0 | 1 | 2012-07-06 | |
Install Subversion with Web Access on Ubuntu | 636 | 0 | 0 | 2012-07-06 | |
Linux配置svn以及TortoiseSVN的安装和使用 | 1280 | 0 | 0 | 2012-07-06 | |
Ft5406驱动 | 1392 | 0 | 0 | 2012-07-05 | |
IMX233下的LCD背光设备的驱动框架 | 1089 | 0 | 0 | 2012-07-05 | |
内核通知链原理及机制 | 853 | 0 | 0 | 2012-07-05 | |
Linux Kernel and Android 休眠与唤醒(中文版) | 913 | 0 | 0 | 2012-07-03 | |
Debug Android and Linux suspend and resume | 830 | 0 | 0 | 2012-07-03 | |
Android OTA 升级之一:编译升级包 | 1584 | 0 | 0 | 2012-06-29 | |
Precise Pangolin (12.04) Installation Instructions | 1520 | 0 | 1 | 2012-06-29 | |
pandaboard--uboot 启动参数设置 | 1418 | 0 | 0 | 2012-06-29 | |
PandaBoard ES: Getting Started with Ubuntu 12.04 LTS Desktop | 1970 | 0 | 1 | 2012-06-29 | |
DBI接口与DPI接口与DSI接口 | 1265 | 0 | 0 | 2012-06-28 | |
内核通知链机制的原理及实现 | 987 | 0 | 0 | 2012-06-28 | |
内核通知链 | 942 | 0 | 0 | 2012-06-28 | |
Android实现检测耳机插入和拔出 | 2364 | 0 | 0 | 2012-06-25 | |
耳机检测 | 1343 | 0 | 0 | 2012-06-25 | |
Android UEventObserver | 910 | 0 | 0 | 2012-06-21 | |
浅析u盘等热插拔uevent事件用户空间截获方法和具体实现 | 1195 | 0 | 0 | 2012-06-21 | |
Android4.0 LCD和键盘 背光亮度设置 | 1414 | 0 | 0 | 2012-06-21 |
chen_chuang2012-10-11 16:33
高手,有本书上写cdev初始化和注册是这样写的
static void VirtualDisk_setup_cdev(struct VirtualDisk *dev, int minor)
{
int err;
devno = MDDEV(VirtualDisk_major, minor);
cdev_init(&dev->cdev, &VirtualDisk_fops);
dev->cdev.owner = THIS_MOUDULE;
dev->cdev.ops = &VirtualDisk_fops;
err = cdev_add(&dev->cdev, debno, 1);
if (err)
printk(KERN_NOTICE "Error in cdev_add()\n");
}
而cdev_init里
void cdev_init(struct cdev *cdev, const struct file_operations *fops)
{
memset(cdev, 0, sizeof *cdev);
INIT_LIST_HEAD(&cdev->list);
kobject_init(&cdev->kobj, &ktype_cdev_default);
cdev->ops = fops;
}
已经有cdev->ops = fops了
那上面的代码cdev_init之后又有dev->cdev.ops ,这两个函数不一样吗,自我感觉有点多次一举,,,不太明白