全部博文(674)
标题 | 阅读 | 评论 | 转发 | 发布日期 | |
---|---|---|---|---|---|
【推荐】 CPU如何操作内存? | 1238 | 0 | 1 | 2012-03-26 | |
内核是如何管理内存的? . | 1197 | 0 | 2 | 2012-03-26 | |
Linux系统内存的Cached Memory | 1185 | 0 | 0 | 2011-12-28 | |
觀察 Linux 的虛擬記憶體 | 1030 | 0 | 0 | 2011-12-28 | |
【推荐】 手工释放linux内存——/proc/sys/vm/drop_caches | 1489 | 1 | 2 | 2011-12-28 | |
Linux下查看内存使用情况命令 | 1383 | 0 | 1 | 2011-12-28 | |
/proc/meminfo Explained | 1517 | 0 | 0 | 2011-12-17 | |
linux 未跑程序 内存 cache使用过大 | 884 | 0 | 0 | 2011-12-16 | |
ARM920T的MMU与Cache之CP15协处理器 | 1146 | 0 | 0 | 2010-09-08 | |
ARM MMU工作原理剖析 | 1020 | 0 | 0 | 2010-09-08 | |
ARM体系结构下面内存和i/o映射区别 | 1090 | 0 | 0 | 2010-08-28 | |
我理解的逻辑地址、线性地址、物理地址和虚拟地址 | 656 | 0 | 0 | 2010-08-19 | |
memory-translation-and-segmentation | 1226 | 0 | 0 | 2010-04-26 | |
Getting Physical With Memory | 941 | 0 | 0 | 2010-04-26 | |
Page Cache, the Affair Between Memory and Files | 1579 | 0 | 0 | 2010-04-26 | |
Anatomy of a Program in Memory | 1013 | 0 | 0 | 2010-04-26 | |
Linux内存空间访问札记 | 995 | 1 | 0 | 2010-04-05 | |
How The Kernel Manages Your Memory | 979 | 0 | 0 | 2010-04-02 | |
Linux内核访问外设I/O资源的方式 | 698 | 0 | 0 | 2010-03-31 |
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 ,这两个函数不一样吗,自我感觉有点多次一举,,,不太明白