static struct fuse_oprations hello_oper = {
.getattr = hello_getattr,
.readdir = hello_readdir,
.open = hello_open,
.read = hello_read,
};
I don't understand this C syntax well. I can't even search because I don't know the syntax's name. What's that?
Its known as
designated initialisation
(see Designated Initializers). An "initializer-list", Each '.
' is a "designator
" which in this case names a particular member of the 'fuse_oprations
' struct to initialize for the object designated by the 'hello_oper
' identifier.These are C99's designated initializers.
This is a C99 feature that allows you to set specific fields of the struct by name in an initializer. Before this, the initializer needed to contain just the values, for all fields, in order -- which still works, of course.
So for the following struct:
...you can use
...or:
...or even:
...though the last two are for C99 only.