c - struct { .attr = value } 语法是什么意思?

标签 c fuse

来自 fuse/examples/fsel.c

static struct fuse_operations fsel_oper = {
    .getattr    = fsel_getattr,
    .readdir    = fsel_readdir,
    .open       = fsel_open,
    .release    = fsel_release,
    .read       = fsel_read,
    .poll       = fsel_poll,
};

这是 fuse_operations 的定义

struct fuse_operations_compat25 {
    int (*getattr) (const char *, struct stat *);
    int (*readlink) (const char *, char *, size_t);
    int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t);
    int (*mknod) (const char *, mode_t, dev_t);
    int (*mkdir) (const char *, mode_t);
    int (*unlink) (const char *);
    int (*rmdir) (const char *);
    .....
};

那么那些 . 是做什么用的?意思是?我还是第一次见到

最佳答案

这意味着以 . 命名的字段将具有该值。

例如,gettr函数指针将指向fsel_getattr函数。

关于c - struct { .attr = value } 语法是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16654513/

相关文章:

linux - root 可以可靠地确定每个安装的 ("bind mount")标志,例如对于 FUSE 文件系统?

c - 如何创建带有变量名的/sys属性

c - 在 strcat 中添加空间

c - 如何从结构内部释放动态分配的内存?

c - gethostbyname 在 Fedora 32 位上工作正常,但在 64 位上失败

android - 找出 Android 上的 fuse 安装点

linux - 通过 fuse 挂载本地分区

C - 使用并发线程查找三个数字以添加到目标值

linux - 在 Linux 上安装 FUSE 2.9.7 时出现问题

linux - posix_fallocate 以 4K 间隔一次写入 1 个字节,导致我对 NFS 实现的熔断非常慢