标题 | 阅读 | 评论 | 转发 | 发布日期 | |
---|---|---|---|---|---|
The Kernel Boot Process | 995 | 0 | 0 | 2010-04-26 | |
memory-translation-and-segmentation | 1237 | 0 | 0 | 2010-04-26 | |
Getting Physical With Memory | 948 | 0 | 0 | 2010-04-26 | |
Page Cache, the Affair Between Memory and Files | 1584 | 0 | 0 | 2010-04-26 | |
Anatomy of a Program in Memory | 1045 | 0 | 0 | 2010-04-26 | |
start_kernel()函数分析 | 892 | 0 | 0 | 2010-04-26 | |
Linux内核从start_kernel到init | 1869 | 0 | 0 | 2010-04-26 | |
ARM Linux启动分析----head-armv.S内幕 | 788 | 0 | 0 | 2010-04-26 | |
u-boot 启动过程 —— 基于S3C2410 | 1057 | 0 | 0 | 2010-04-26 | |
linux引导分析 | 1151 | 0 | 0 | 2010-04-26 | |
linux内核启动过程——基于S3C2410 (2)Image早期初始化 | 1844 | 0 | 0 | 2010-04-23 | |
linux内核启动过程——基于S3C2410 | 1059 | 0 | 0 | 2010-04-23 | |
Linux内存空间访问札记 | 1021 | 1 | 0 | 2010-04-05 | |
ARM Linux启动过程分析 | 820 | 0 | 0 | 2010-04-05 | |
第五讲:2410上NAND的初始化及驱动流程 | 794 | 0 | 0 | 2010-04-04 | |
第四讲:2410下的中断流程分析 | 822 | 0 | 0 | 2010-04-04 | |
第三讲:2410下rtc驱动分析 | 750 | 0 | 0 | 2010-04-04 | |
第二:2410下片上设备如何添加并使用(以RTC为例) | 839 | 0 | 0 | 2010-04-04 | |
第一讲:2410的初始化流程(设备初始化) | 785 | 0 | 0 | 2010-04-04 | |
解决u-boot-1.2.0中go命令的bug | 1058 | 0 | 0 | 2010-04-04 |
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 ,这两个函数不一样吗,自我感觉有点多次一举,,,不太明白