The tagged structure initialization syntax allow you to initialize structure member in any order. So your code have no need to be modified
after the change of member definition order. And this feature has been a part of C standard since 1999.
struct file_operations mem_fops = {
.owner = THIS_MODULE,
.llseek = mem_seek,
.read = mem_read,
.write = mem_write,
.ioctl = mem_ioctl,
.open = mem_open,
.release = mem_release,
};
.owner, .llseek and others are all the member tags.
For example:
struct foo{
int a;
int b;
};
You can declaration and initialize structure variable like this:
struct foo bar{
.a = 1;
.b = 2;
};
or in the other order:
struct foo bar{
.b = 2;
.a = 1;
};
Have you got it ?
[[it] 本帖最后由 rootkit 于 2008-11-7 15:42 编辑 [/it]]