标题 | 阅读 | 评论 | 转发 | 发布日期 | |
---|---|---|---|---|---|
移植ubifs到dm368成功 | 4260 | 0 | 0 | 2013-07-13 | |
MTD(4)---nand flash的bbt坏块表的建立函数代码分析 | 4065 | 0 | 0 | 2013-07-13 | |
MTD(3)---nand flash的erase,read,write接口函数代码分析 | 4193 | 0 | 0 | 2013-07-13 | |
MTD(2)---nand flash的底层驱动代码分析 | 4014 | 0 | 0 | 2013-07-13 | |
NAND Flash的坏块管理设计 | 3934 | 0 | 0 | 2013-07-13 | |
linux内核中对nand的坏块管理 | 3133 | 0 | 0 | 2013-07-13 | |
Android Partitions Explained: boot, system, recovery, data, cache & misc | 2854 | 0 | 0 | 2013-07-12 | |
HOWTO: Unpack, Edit, and Re-Pack Boot Images | 3069 | 0 | 0 | 2013-07-12 | |
ubuntu下用samba实现windows与linux文件共享 | 1251 | 0 | 0 | 2013-07-08 | |
Ubuntu 11.10 64Bit版上的Android 4.0 开发环境搭建 | 1389 | 0 | 0 | 2013-07-02 |
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 ,这两个函数不一样吗,自我感觉有点多次一举,,,不太明白