[RFC]confusions about 'struct' define

harryxiyou harryxiyou at gmail.com
Wed May 30 12:50:02 EDT 2012


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



More information about the Kernelnewbies mailing list