开发者

ext3 code understanding

struct inode_operations ext3_di开发者_运维问答r_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.


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;


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.


Have a look at struct inode_operations

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜