Re: cdev_init and struct file_operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 26, 2014 at 09:18:57PM -0400, Valdis.Kletnieks@xxxxxx wrote:
> On Tue, 26 Aug 2014 20:48:41 -0400, John de la Garza said:
> > Why does the code from ldd3 set dev->cdev.ops = &scull_fops again?
> 
> Probably because when ldd3 was written several years ago, cdev_init()
> didn't set it, so it wasn't "again"....
> 
> > Doesn't cdev_init already do that?
> 
> It does *now*.
> 
> Remember that ldd3 was written about 6 million lines of code ago....

It did then, too (unless I'm missing something)

linux$  git branch
* (detached from v2.6.12)
  master

from v2.6.12

void cdev_init(struct cdev *cdev, struct file_operations *fops)
{
        memset(cdev, 0, sizeof *cdev);
        INIT_LIST_HEAD(&cdev->list);
        cdev->kobj.ktype = &ktype_cdev_default;
        kobject_init(&cdev->kobj);
        cdev->ops = fops;
}

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux