Possible Duplicate:
What means the dot before variable name in struct?
const struct file_operations generic_ro_fops = {
.llseek = generic_file_llseek,
.read = do_sync_read,
// ....other stuffs
};
my question is :
1) what is the meaning of .llseek and how to use .…the file_operations struct definition is below:
2) can I just say : llseek = generic_file_llseek ; in the struct above to let the pointer llseek points to generic_file_llseek without putting the dot . before llseek?
//sorry for my poor english
struct file_operations {
loff_t (*llseek) (struct file *, loff_t, int);
ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
//....other stuffs
}
This is called designated initializers. You are initializing exact member/field of the structure.
No
You can do something like this to initialize members:
but in this case you will have to initialize everything in order like members are placed inside structure. Designated initializers are very helpful when you want to initialize just some of structure fields.
You can use something like this outside structure: