Re: Confusion in kobjects

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

 



On Wed, May 04, 2011 at 07:26:44PM +0530, Vikram Narayanan wrote:
> The kernel doc (kobject.txt) says that
> 
> "No structure should EVER have more than one kobject embedded within it.
>  If it does, the reference counting for the object is sure to be messed
>  up and incorrect, and your code will be buggy.  So do not do this. "
> 
> But in the file drivers/uio/uio.c, a structure has two such kobjects.
> 
> struct uio_device {
>          struct module           *owner;
>          struct device           *dev;
>          int                     minor;
>          atomic_t                event;
>          struct fasync_struct    *async_queue;
>          wait_queue_head_t       wait;
>          int                     vma_count;
>          struct uio_info         *info;
>          struct kobject          *map_dir;
>          struct kobject          *portio_dir;
>  };
> 
> So, What is the exception for this structure? Is this right? If yes,
> can someone explain why it is right, and where should we use it?

There are not more than one kobject _IN_ the structure.  It merely
has pointers to more than one kobject (three actually), which is fine to
do.

Hope this helps,

greg k-h

_______________________________________________
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