[RFC]confusions about 'struct' define

Gaurav Jain gjainroorkee at gmail.com
Wed May 30 13:20:25 EDT 2012


Those are forward declarations as they are being used in defining struct
bus_attribute. It's nothing special about GNU-C. That's the case for ANSI-C
too. Pretty standard.

On Wed, May 30, 2012 at 10:20 PM, harryxiyou <harryxiyou at gmail.com> wrote:

> Hi guys,
>
> When I read the linux/device.h file for some device driver usage, i find
> some
> confusions like following.
>
> $ head -60 device.h
> [...]
>
> struct device;
> struct device_private;
> struct device_driver;
> struct driver_private;
> struct module;
> struct class;
> struct subsys_private;
> struct bus_type;
> struct device_node;
> struct iommu_ops;
>
> struct bus_attribute {
>        struct attribute        attr;
>        ssize_t (*show)(struct bus_type *bus, char *buf);
>        ssize_t (*store)(struct bus_type *bus, const char *buf, size_t
> count);
> };
> [...]
>
> I have never seen struct define like
>
> "struct device;
> struct device_private;
> struct device_driver;
> [...]
> struct device_node;
> struct iommu_ops;"
>
> The common define is like this
>
> "struct a{
>   int a;
>   int b;
> [...]
> }"
>
> Is this just struct declaration or some extension about gcc? Cloud
> anyone give me
> some explanations?
> Thanks in advance ;-)
>
> Note: my kernel version is 3.0 around.
>
> --
> Thanks
> Harry Wei
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
Gaurav Jain
Associate Software Engineer
VxVM Escalations Team, SAMG
Symantec Software India Pvt. Ltd.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120530/144cb394/attachment.html 


More information about the Kernelnewbies mailing list