Date: Wed, 25 Jun 2014 12:04:30 +0200 From: "J. Hannken-Illjes" <hann...@eis.cs.tu-bs.de>
Using "memcpy(__UNCONST(node->vn_key.vk_key), new_key, new_key_len)" works but I'm not sure if __UNCONST is the right way to go. I think __UNCONST is the right way to go -- removing const from the API itself is certainly not right. I would put the __UNCONST in the initialization of temporary vcache keys used to look things up, e.g. in vcache_get: struct vcache_key { struct mount *vk_mount; void *vk_key; size_t vk_key_len; }; int vcache_get(struct mount *mp, const void *key, size_t key_len, struct vnode *vpp) { ... struct vcache_key vcache_key; ... vcache_key.vk_mount = mp; vcache_key.vk_key = __UNCONST(key); vcache_key.vk_key_len = key_len; .... }