views:

78

answers:

3
struct inode_operations ext3_dir_inode_operations = {
        .create         = ext3_create,
        .lookup         = ext3_lookup,
}

This struct is assign to inode structure and further to file system operation structure. My question is what is this flag .create? Do we do the assignment in the structure itself? Or is it some other version of C (C99, C89?) that allows this kind of operation?

I hope my question is clear.

+2  A: 

create and lookup is element of struct inode_operations. .create=ext3_create means ext3_dir_inode_operations.create=ext3_create and so on for other elements of the struct. Not sure from which standard this came into being.

vpit3833
+7  A: 

It's a C99 designated initialiser. It's equivalent to, in C89:

struct inode_operations ext3_dir_inode_operations = { 0 };
ext3_dir_inode_operations.create = ext3_create;
ext3_dir_inode_operations.lookup = ext3_lookup;
caf
A: 

Have a look at struct inode_operations

Daniel Băluţă