标题 | 阅读 | 评论 | 转发 | 发布日期 | |
---|---|---|---|---|---|
Bootloader与Kernel间参数传递机制 | 1124 | 0 | 0 | 2010-06-11 | |
ARM Linux中断机制分析 | 1510 | 0 | 0 | 2010-05-26 | |
linux中断处理之IRQ中断 | 1022 | 0 | 0 | 2010-05-26 | |
S3C2410的外部中断 | 1858 | 0 | 0 | 2010-05-26 | |
Linux时钟基本概念 | 1309 | 0 | 0 | 2010-05-25 | |
Linux 时钟处理机制 | 911 | 0 | 0 | 2010-05-25 | |
linux新内核的时钟机制代码读后感 | 1538 | 0 | 0 | 2010-05-24 | |
hrtimer小记 | 2857 | 0 | 0 | 2010-05-24 | |
hrtimer + clockevent + Timekeeping | 1052 | 0 | 0 | 2010-05-24 | |
S3C2410 中断程序的实现 | 930 | 0 | 0 | 2010-05-16 | |
s3c2410 Timer工作原理 | 941 | 0 | 0 | 2010-05-16 | |
The Kernel Boot Process | 997 | 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 | 1046 | 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 | |
linux引导分析 | 1152 | 0 | 0 | 2010-04-26 |
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 ,这两个函数不一样吗,自我感觉有点多次一举,,,不太明白