标题 | 阅读 | 评论 | 转发 | 发布日期 | |
---|---|---|---|---|---|
Linux下Android ADB驱动安装详解 | 942 | 0 | 0 | 2011-06-10 | |
打开Android C文件中的LOG | 1180 | 0 | 0 | 2011-05-31 | |
udev与硬件抽象层HAL的实现原理 | 867 | 0 | 0 | 2011-05-23 | |
Android 2.2 源码结构分析 | 1549 | 0 | 0 | 2010-08-21 | |
android获取源代码、编译、命令 | 1437 | 0 | 0 | 2010-08-21 | |
【Android-Source】Install Git and repo to get androi | 1317 | 0 | 0 | 2010-08-21 | |
Using Repo and Git | 1575 | 0 | 0 | 2010-08-19 | |
Git和Repo扫盲——如何取得Android源代码 | 1187 | 0 | 0 | 2010-04-03 | |
Android - strace runtime | 1175 | 0 | 0 | 2010-04-02 | |
Android 2.1 源码结构分析 | 1292 | 0 | 0 | 2010-04-02 | |
Android Getting Started | 3065 | 0 | 0 | 2010-03-30 | |
Why we have to wait for Android on the Neo 1973 | 1104 | 0 | 0 | 2010-03-29 | |
android下载编译以及文件系统提取总结 | 1741 | 0 | 0 | 2010-03-29 | |
android 资源列表-史上最有价值的android资源链接 | 1593 | 0 | 1 | 2010-03-24 |
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 ,这两个函数不一样吗,自我感觉有点多次一举,,,不太明白