[RFC]confusions about 'struct' define

michi1 at michaelblizek.twilightparadox.com michi1 at michaelblizek.twilightparadox.com
Thu May 31 12:40:20 EDT 2012


Hi!

On 00:50 Thu 31 May     , harryxiyou wrote:
...
> I have never seen struct define like
> 
> "struct device;
> struct device_private;
> struct device_driver;
> [...]
> struct device_node;
> struct iommu_ops;"

This basically says that these structs exist and are defined somewhere. You
need this basically for things like this:

struct b;

struct a{
	struct b *b_ptr;
};

struct b{
	struct a *a_ptr;
};

The struct can only be dereferenced after it is defined. Also, the storage
size is unknown, so the same applies to inlining and sizeof().

	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com



More information about the Kernelnewbies mailing list