Adding a kobject in the device model hierarchy

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

 



Dear All,

        I have written one pseudo char driver. I have initialized the device generic structure
    with cdev_init function. This will initialize the kobject structure embedded within struct cdev
    with appropriate ktype. If I want to add this kobject in /sys/devices/virtual/misc/ location
    of sysfs, how is the following fields set
    * kobj->parent
    * kobj->kset
    * kobj->kset->obj.

    Also, in general how to look out for the parent kobject ? Would like to know, if there are
      mechanisms provisioned by Linux Kernel.

    Robert: My 2 cents as I am reading the LKD(3rd edition), it would be appropriate to add one
            example as a solution to the above problem. Generally, it has been told as
            kobj->kset = my_kset in Page # 353.
       
Note: Even in LDD(3rd editon page 369). It has been mentioned that "The kobject's kset field must be
     pointed at the kset of interest"


Thanks,
Prabhu



_______________________________________________
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