rem: cache_oper.getattr  = oper->oper.getattr ? cache_getattr : NULL; cache_oper.readlink = oper->oper.readlink ? cache_readlink : NULL; cache_oper.getdir   = oper->cache_getdir ? cache_getdir : oper->oper.getdir; cache_oper.mknod    = oper->oper.mknod ? cache_mknod : NULL; cache_oper.mkdir    = oper->oper.mkdir ? cache_mkdir : NULL; cache_oper.symlink  = oper->oper.symlink ? cache_symlink : NULL; cache_oper.unlink   = oper->oper.unlink ? cache_unlink : NULL; cache_oper.rmdir    = oper->oper.rmdir ? cache_rmdir : NULL; cache_oper.rename   = oper->oper.rename ? cache_rename : NULL; cache_oper.link     = oper->oper.link ? cache_link : NULL; cache_oper.chmod    = oper->oper.chmod ? cache_chmod : NULL; cache_oper.chown    = oper->oper.chown ? cache_chown : NULL; cache_oper.truncate = oper->oper.truncate ? cache_truncate : NULL; cache_oper.utime    = oper->oper.utime ? cache_utime : NULL; cache_oper.open     = oper->oper.open; cache_oper.read     = oper->oper.read; cache_oper.write    = oper->oper.write ? cache_write : NULL; cache_oper.statfs   = oper->oper.statfs; cache_oper.release  = oper->oper.release; cache_oper.fsync    = oper->oper.fsync; cache_oper.setxattr = oper->oper.setxattr; cache_oper.getxattr = oper->oper.getxattr; cache_oper.listxattr = oper->oper.listxattr; cache_oper.removexattr = oper->oper.removexattr; pthread_mutex_init(&cache_lock, NULL); cache = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, free_node); if (cache == NULL) { fprintf(stderr, "failed to create cache\n"); return NULL;
add: cache_unity_fill(oper, &cache_oper); if (cache_on) { cache_oper.getattr  = oper->oper.getattr ? cache_getattr : NULL; cache_oper.readlink = oper->oper.readlink ? cache_readlink : NULL; cache_oper.getdir   = oper->cache_getdir ? cache_getdir : NULL; cache_oper.mknod    = oper->oper.mknod ? cache_mknod : NULL; cache_oper.mkdir    = oper->oper.mkdir ? cache_mkdir : NULL; cache_oper.symlink  = oper->oper.symlink ? cache_symlink : NULL; cache_oper.unlink   = oper->oper.unlink ? cache_unlink : NULL; cache_oper.rmdir    = oper->oper.rmdir ? cache_rmdir : NULL; cache_oper.rename   = oper->oper.rename ? cache_rename : NULL; cache_oper.link     = oper->oper.link ? cache_link : NULL; cache_oper.chmod    = oper->oper.chmod ? cache_chmod : NULL; cache_oper.chown    = oper->oper.chown ? cache_chown : NULL; cache_oper.truncate = oper->oper.truncate ? cache_truncate : NULL; cache_oper.utime    = oper->oper.utime ? cache_utime : NULL; cache_oper.write    = oper->oper.write ? cache_write : NULL; pthread_mutex_init(&cache_lock, NULL); cache = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, free_node); if (cache == NULL) { fprintf(stderr, "failed to create cache\n"); return NULL; }
context: struct fuse_operations *cache_init(struct fuse_cache_operations *oper){    static struct fuse_operations cache_oper;    next_oper = oper;    cache_oper.getattr  = oper->oper.getattr ? cache_getattr : NULL;    cache_oper.readlink = oper->oper.readlink ? cache_readlink : NULL;    cache_oper.getdir   = oper->cache_getdir ? cache_getdir : oper->oper.getdir;    cache_oper.mknod    = oper->oper.mknod ? cache_mknod : NULL;    cache_oper.mkdir    = oper->oper.mkdir ? cache_mkdir : NULL;    cache_oper.symlink  = oper->oper.symlink ? cache_symlink : NULL;    cache_oper.unlink   = oper->oper.unlink ? cache_unlink : NULL;    cache_oper.rmdir    = oper->oper.rmdir ? cache_rmdir : NULL;    cache_oper.rename   = oper->oper.rename ? cache_rename : NULL;    cache_oper.link     = oper->oper.link ? cache_link : NULL;    cache_oper.chmod    = oper->oper.chmod ? cache_chmod : NULL;    cache_oper.chown    = oper->oper.chown ? cache_chown : NULL;    cache_oper.truncate = oper->oper.truncate ? cache_truncate : NULL;    cache_oper.utime    = oper->oper.utime ? cache_utime : NULL;    cache_oper.open     = oper->oper.open;    cache_oper.read     = oper->oper.read;    cache_oper.write    = oper->oper.write ? cache_write : NULL;    cache_oper.statfs   = oper->oper.statfs;    cache_oper.release  = oper->oper.release;    cache_oper.fsync    = oper->oper.fsync;    cache_oper.setxattr = oper->oper.setxattr;    cache_oper.getxattr = oper->oper.getxattr;    cache_oper.listxattr = oper->oper.listxattr;    cache_oper.removexattr = oper->oper.removexattr;    pthread_mutex_init(&cache_lock, NULL);    cache = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, free_node);    if (cache == NULL) {        fprintf(stderr, "failed to create cache\n");        return NULL;    }    return &cache_oper;}